Merge pull request #183 from slsdetectorgroup/positions

Replacing initializer list with vector
This commit is contained in:
Dhanya Thattil 2020-09-17 12:57:18 +02:00 committed by GitHub
commit bf69951456
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 448 additions and 327 deletions

View File

@ -128,7 +128,7 @@ std::string CmdProxy::Hostname(int action) {
if (!args.empty()) {
WrongNumberOfParameters(0);
}
auto t = det->getHostname({det_id});
auto t = det->getHostname(std::vector<int>{det_id});
os << OutString(t) << '\n';
} else if (action == defs::PUT_ACTION) {
if (args.empty()) {
@ -227,7 +227,7 @@ std::string CmdProxy::FirmwareVersion(int action) {
if (!args.empty()) {
WrongNumberOfParameters(0);
}
auto t = det->getFirmwareVersion({det_id});
auto t = det->getFirmwareVersion(std::vector<int>{det_id});
if (det->getDetectorType().squash() == defs::EIGER) {
os << OutString(t) << '\n';
} else {
@ -420,7 +420,7 @@ std::string CmdProxy::Exptime(int action) {
// vector of exptimes
if (gateIndex == -1 &&
det->getDetectorType().squash() == defs::MYTHEN3) {
auto t = det->getExptimeForAllGates({det_id});
auto t = det->getExptimeForAllGates(std::vector<int>{det_id});
if (args.empty()) {
os << OutString(t) << '\n';
} else if (args.size() == 1) {
@ -431,9 +431,9 @@ std::string CmdProxy::Exptime(int action) {
else {
Result<ns> t;
if (gateIndex == -1) {
t = det->getExptime({det_id});
t = det->getExptime(std::vector<int>{det_id});
} else {
t = det->getExptime(gateIndex, {det_id});
t = det->getExptime(gateIndex, std::vector<int>{det_id});
}
if (args.empty()) {
os << OutString(t) << '\n';
@ -448,16 +448,16 @@ std::string CmdProxy::Exptime(int action) {
std::string unit = RemoveUnit(time_str);
auto t = StringTo<time::ns>(time_str, unit);
if (type == defs::MYTHEN3) {
det->setExptime(gateIndex, t, {det_id});
det->setExptime(gateIndex, t, std::vector<int>{det_id});
} else {
det->setExptime(t, {det_id});
det->setExptime(t, std::vector<int>{det_id});
}
} else if (args.size() == 2) {
auto t = StringTo<time::ns>(args[0], args[1]);
if (type == defs::MYTHEN3) {
det->setExptime(gateIndex, t, {det_id});
det->setExptime(gateIndex, t, std::vector<int>{det_id});
} else {
det->setExptime(t, {det_id});
det->setExptime(t, std::vector<int>{det_id});
}
} else {
WrongNumberOfParameters(2);
@ -488,7 +488,7 @@ std::string CmdProxy::DynamicRange(int action) {
if (!args.empty()) {
WrongNumberOfParameters(0);
}
auto t = det->getDynamicRange({det_id});
auto t = det->getDynamicRange(std::vector<int>{det_id});
os << OutString(t) << '\n';
} else if (action == defs::PUT_ACTION) {
if (det_id != -1) {
@ -531,7 +531,7 @@ std::string CmdProxy::Speed(int action) {
if (!args.empty()) {
WrongNumberOfParameters(0);
}
auto t = det->getSpeed({det_id});
auto t = det->getSpeed(std::vector<int>{det_id});
os << OutString(t) << '\n';
} else if (action == defs::PUT_ACTION) {
if (args.size() != 1) {
@ -556,7 +556,7 @@ std::string CmdProxy::Speed(int action) {
} catch (...) {
t = sls::StringTo<defs::speedLevel>(args[0]);
}
det->setSpeed(t, {det_id});
det->setSpeed(t, std::vector<int>{det_id});
os << sls::ToString(t) << '\n'; // no args to convert 0,1,2 as well
} else {
throw sls::RuntimeError("Unknown action");
@ -588,7 +588,7 @@ std::string CmdProxy::Adcphase(int action) {
if (action == defs::GET_ACTION) {
Result<int> t;
if (args.empty()) {
t = det->getADCPhase({det_id});
t = det->getADCPhase(std::vector<int>{det_id});
os << OutString(t) << '\n';
} else if (args.size() == 1) {
if (args[0] != "deg") {
@ -596,21 +596,23 @@ std::string CmdProxy::Adcphase(int action) {
args[0] +
". Did you mean deg? ");
}
t = det->getADCPhaseInDegrees({det_id});
t = det->getADCPhaseInDegrees(std::vector<int>{det_id});
os << OutString(t) << " deg\n";
} else {
WrongNumberOfParameters(0);
}
} else if (action == defs::PUT_ACTION) {
if (args.size() == 1) {
det->setADCPhase(StringTo<int>(args[0]), {det_id});
det->setADCPhase(StringTo<int>(args[0]),
std::vector<int>{det_id});
os << args.front() << '\n';
} else if (args.size() == 2) {
if (args[1] != "deg") {
throw sls::RuntimeError("Unknown adcphase 2nd argument " +
args[1] + ". Did you mean deg?");
}
det->setADCPhaseInDegrees(StringTo<int>(args[0]), {det_id});
det->setADCPhaseInDegrees(StringTo<int>(args[0]),
std::vector<int>{det_id});
os << args[0] << " " << args[1] << '\n';
} else {
WrongNumberOfParameters(1);
@ -641,28 +643,30 @@ std::string CmdProxy::Dbitphase(int action) {
if (action == defs::GET_ACTION) {
Result<int> t;
if (args.empty()) {
t = det->getDBITPhase({det_id});
t = det->getDBITPhase(std::vector<int>{det_id});
os << OutString(t) << '\n';
} else if (args.size() == 1) {
if (args[0] != "deg") {
throw sls::RuntimeError("Unknown dbitphase argument " +
args[0] + ". Did you mean deg? ");
}
t = det->getDBITPhaseInDegrees({det_id});
t = det->getDBITPhaseInDegrees(std::vector<int>{det_id});
os << OutString(t) << " deg\n";
} else {
WrongNumberOfParameters(0);
}
} else if (action == defs::PUT_ACTION) {
if (args.size() == 1) {
det->setDBITPhase(StringTo<int>(args[0]), {det_id});
det->setDBITPhase(StringTo<int>(args[0]),
std::vector<int>{det_id});
os << args.front() << '\n';
} else if (args.size() == 2) {
if (args[1] != "deg") {
throw sls::RuntimeError("Unknown dbitphase 2nd argument " +
args[1] + ". Did you mean deg? ");
}
det->setDBITPhaseInDegrees(StringTo<int>(args[0]), {det_id});
det->setDBITPhaseInDegrees(StringTo<int>(args[0]),
std::vector<int>{det_id});
os << args[0] << " " << args[1] << '\n';
} else {
WrongNumberOfParameters(1);
@ -691,14 +695,16 @@ std::string CmdProxy::ClockFrequency(int action) {
if (args.size() != 1) {
WrongNumberOfParameters(1);
}
auto t = det->getClockFrequency(StringTo<int>(args[0]), {det_id});
auto t = det->getClockFrequency(StringTo<int>(args[0]),
std::vector<int>{det_id});
os << OutString(t) << '\n';
} else if (action == defs::PUT_ACTION) {
if (args.size() != 2) {
WrongNumberOfParameters(2);
}
det->setClockFrequency(StringTo<int>(args[0]),
StringTo<int>(args[1]), {det_id});
StringTo<int>(args[1]),
std::vector<int>{det_id});
os << StringTo<int>(args[1]) << '\n';
} else {
throw sls::RuntimeError("Unknown action");
@ -724,7 +730,8 @@ std::string CmdProxy::ClockPhase(int action) {
}
if (action == defs::GET_ACTION) {
if (args.size() == 1) {
auto t = det->getClockPhase(StringTo<int>(args[0]), {det_id});
auto t = det->getClockPhase(StringTo<int>(args[0]),
std::vector<int>{det_id});
os << OutString(t) << '\n';
} else if (args.size() == 2) {
if (args[1] != "deg") {
@ -740,7 +747,8 @@ std::string CmdProxy::ClockPhase(int action) {
} else if (action == defs::PUT_ACTION) {
if (args.size() == 2) {
det->setClockPhase(StringTo<int>(args[0]),
StringTo<int>(args[1]), {det_id});
StringTo<int>(args[1]),
std::vector<int>{det_id});
os << args[1] << '\n';
} else if (args.size() == 3) {
if (args[2] != "deg") {
@ -748,7 +756,8 @@ std::string CmdProxy::ClockPhase(int action) {
". Did you mean deg?");
}
det->setClockPhaseinDegrees(StringTo<int>(args[0]),
StringTo<int>(args[1]), {det_id});
StringTo<int>(args[1]),
std::vector<int>{det_id});
os << args[1] << " " << args[2] << '\n';
} else {
WrongNumberOfParameters(1);
@ -777,8 +786,8 @@ std::string CmdProxy::MaxClockPhaseShift(int action) {
if (args.size() != 1) {
WrongNumberOfParameters(1);
}
auto t =
det->getMaxClockPhaseShift(StringTo<int>(args[0]), {det_id});
auto t = det->getMaxClockPhaseShift(StringTo<int>(args[0]),
std::vector<int>{det_id});
os << OutString(t) << '\n';
} else if (action == defs::PUT_ACTION) {
throw sls::RuntimeError("Cannot put");
@ -806,7 +815,8 @@ std::string CmdProxy::ClockDivider(int action) {
if (args.size() != 1) {
WrongNumberOfParameters(1);
}
auto t = det->getClockDivider(StringTo<int>(args[0]), {det_id});
auto t = det->getClockDivider(StringTo<int>(args[0]),
std::vector<int>{det_id});
os << OutString(t) << '\n';
} else if (action == defs::PUT_ACTION) {
if (args.size() != 2) {
@ -840,7 +850,8 @@ std::string CmdProxy::ExternalSignal(int action) {
if (args.size() != 1) {
WrongNumberOfParameters(1);
}
auto t = det->getExternalSignalFlags(StringTo<int>(args[0]), {det_id});
auto t = det->getExternalSignalFlags(StringTo<int>(args[0]),
std::vector<int>{det_id});
os << args[0] << " " << OutString(t) << '\n';
} else if (action == defs::PUT_ACTION) {
if (args.size() != 2) {
@ -848,7 +859,8 @@ std::string CmdProxy::ExternalSignal(int action) {
}
det->setExternalSignalFlags(
StringTo<int>(args[0]),
StringTo<slsDetectorDefs::externalSignalFlag>(args[1]), {det_id});
StringTo<slsDetectorDefs::externalSignalFlag>(args[1]),
std::vector<int>{det_id});
os << args[0] << " " << args[1] << '\n';
} else {
throw sls::RuntimeError("Unknown action");
@ -872,10 +884,14 @@ std::string CmdProxy::TemperatureValues(int action) {
if (t.size() > 0) {
auto it = t.cbegin();
os << ToString(*it) << ' ';
os << OutString(det->getTemperature(*it++, {det_id})) << " °C";
os << OutString(
det->getTemperature(*it++, std::vector<int>{det_id}))
<< " °C";
while (it != t.cend()) {
os << ", " << ToString(*it) << ' ';
os << OutString(det->getTemperature(*it++, {det_id})) << " °C";
os << OutString(
det->getTemperature(*it++, std::vector<int>{det_id}))
<< " °C";
}
}
os << "]\n";
@ -911,8 +927,9 @@ std::string CmdProxy::Dac(int action) {
} else if (args.size() > 2) {
WrongNumberOfParameters(1);
}
auto t = det->getDAC(
static_cast<defs::dacIndex>(StringTo<int>(args[0])), mv, {det_id});
auto t =
det->getDAC(static_cast<defs::dacIndex>(StringTo<int>(args[0])), mv,
std::vector<int>{det_id});
os << args[0] << ' ' << OutString(t)
<< (args.size() > 1 ? " mV\n" : "\n");
} else if (action == defs::PUT_ACTION) {
@ -927,7 +944,7 @@ std::string CmdProxy::Dac(int action) {
WrongNumberOfParameters(2);
}
det->setDAC(static_cast<defs::dacIndex>(StringTo<int>(args[0])),
StringTo<int>(args[1]), mv, {det_id});
StringTo<int>(args[1]), mv, std::vector<int>{det_id});
os << args[0] << ' ' << args[1] << (args.size() > 2 ? " mV\n" : "\n");
} else {
throw sls::RuntimeError("Unknown action");
@ -957,11 +974,11 @@ std::string CmdProxy::DacValues(int action) {
os << '[';
auto it = t.cbegin();
os << ToString(*it) << ' ';
os << OutString(det->getDAC(*it++, mv, {det_id}))
os << OutString(det->getDAC(*it++, mv, std::vector<int>{det_id}))
<< (!args.empty() ? " mV" : "");
while (it != t.cend()) {
os << ", " << ToString(*it) << ' ';
os << OutString(det->getDAC(*it++, mv, {det_id}))
os << OutString(det->getDAC(*it++, mv, std::vector<int>{det_id}))
<< (!args.empty() ? " mV" : "");
}
os << "]\n";
@ -985,7 +1002,7 @@ std::string CmdProxy::ReceiverStatus(int action) {
if (!args.empty()) {
WrongNumberOfParameters(0);
}
auto t = det->getReceiverStatus({det_id});
auto t = det->getReceiverStatus(std::vector<int>{det_id});
os << OutString(t) << '\n';
} else if (action == defs::PUT_ACTION) {
throw sls::RuntimeError(
@ -1007,7 +1024,7 @@ std::string CmdProxy::DetectorStatus(int action) {
if (!args.empty()) {
WrongNumberOfParameters(0);
}
auto t = det->getDetectorStatus({det_id});
auto t = det->getDetectorStatus(std::vector<int>{det_id});
os << OutString(t) << '\n';
} else if (action == defs::PUT_ACTION) {
throw sls::RuntimeError(
@ -1084,7 +1101,7 @@ std::string CmdProxy::UDPDestinationIP(int action) {
"rx_hostname."
<< '\n';
} else if (action == defs::GET_ACTION) {
auto t = det->getDestinationUDPIP({det_id});
auto t = det->getDestinationUDPIP(std::vector<int>{det_id});
if (!args.empty()) {
WrongNumberOfParameters(0);
}
@ -1095,7 +1112,7 @@ std::string CmdProxy::UDPDestinationIP(int action) {
}
if (args[0] == "auto") {
std::string rxHostname =
det->getRxHostname({det_id}).squash("none");
det->getRxHostname(std::vector<int>{det_id}).squash("none");
// Hostname could be ip try to decode otherwise look up the hostname
auto val = sls::IpAddr{rxHostname};
if (val == 0) {
@ -1103,11 +1120,11 @@ std::string CmdProxy::UDPDestinationIP(int action) {
}
LOG(logINFO) << "Setting udp_dstip of detector " << det_id << " to "
<< val;
det->setDestinationUDPIP(val, {det_id});
det->setDestinationUDPIP(val, std::vector<int>{det_id});
os << val << '\n';
} else {
auto val = IpAddr(args[0]);
det->setDestinationUDPIP(val, {det_id});
det->setDestinationUDPIP(val, std::vector<int>{det_id});
os << args.front() << '\n';
}
} else {
@ -1126,7 +1143,7 @@ std::string CmdProxy::UDPDestinationIP2(int action) {
"\n\t[Gotthard2] veto debugging. "
<< '\n';
} else if (action == defs::GET_ACTION) {
auto t = det->getDestinationUDPIP2({det_id});
auto t = det->getDestinationUDPIP2(std::vector<int>{det_id});
if (!args.empty()) {
WrongNumberOfParameters(0);
}
@ -1137,7 +1154,7 @@ std::string CmdProxy::UDPDestinationIP2(int action) {
}
if (args[0] == "auto") {
std::string rxHostname =
det->getRxHostname({det_id}).squash("none");
det->getRxHostname(std::vector<int>{det_id}).squash("none");
// Hostname could be ip try to decode otherwise look up the hostname
auto val = sls::IpAddr{rxHostname};
if (val == 0) {
@ -1145,11 +1162,11 @@ std::string CmdProxy::UDPDestinationIP2(int action) {
}
LOG(logINFO) << "Setting udp_dstip2 of detector " << det_id
<< " to " << val;
det->setDestinationUDPIP2(val, {det_id});
det->setDestinationUDPIP2(val, std::vector<int>{det_id});
os << val << '\n';
} else {
auto val = IpAddr(args[0]);
det->setDestinationUDPIP2(val, {det_id});
det->setDestinationUDPIP2(val, std::vector<int>{det_id});
os << args.front() << '\n';
}
} else {
@ -1177,7 +1194,7 @@ std::string CmdProxy::ReceiverHostname(int action) {
if (!args.empty()) {
WrongNumberOfParameters(0);
}
auto t = det->getRxHostname({det_id});
auto t = det->getRxHostname(std::vector<int>{det_id});
os << OutString(t) << '\n';
} else if (action == defs::PUT_ACTION) {
if (args.size() < 1) {
@ -1211,7 +1228,7 @@ std::string CmdProxy::ReceiverHostname(int action) {
}
// single receiver
else {
det->setRxHostname(args[0], {det_id});
det->setRxHostname(args[0], std::vector<int>{det_id});
os << ToString(args) << '\n';
}
}
@ -1237,13 +1254,14 @@ std::string CmdProxy::Threshold(int action) {
if (!args.empty()) {
WrongNumberOfParameters(0);
}
auto t = det->getThresholdEnergy({det_id});
auto t = det->getThresholdEnergy(std::vector<int>{det_id});
os << OutString(t) << '\n';
} else if (action == defs::PUT_ACTION) {
if (args.size() == 1) {
auto t = det->getSettings({det_id}).tsquash(
"Inconsistent settings between detectors");
det->setThresholdEnergy(StringTo<int>(args[0]), t, true, {det_id});
auto t = det->getSettings(std::vector<int>{det_id})
.tsquash("Inconsistent settings between detectors");
det->setThresholdEnergy(StringTo<int>(args[0]), t, true,
std::vector<int>{det_id});
} else if (args.size() == 2) {
det->setThresholdEnergy(
StringTo<int>(args[0]),
@ -1271,14 +1289,15 @@ std::string CmdProxy::ThresholdNoTb(int action) {
throw sls::RuntimeError("cannot get");
} else if (action == defs::PUT_ACTION) {
if (args.size() == 1) {
auto t = det->getSettings({det_id}).tsquash(
"Inconsistent settings between detectors");
det->setThresholdEnergy(StringTo<int>(args[0]), t, false, {det_id});
auto t = det->getSettings(std::vector<int>{det_id})
.tsquash("Inconsistent settings between detectors");
det->setThresholdEnergy(StringTo<int>(args[0]), t, false,
std::vector<int>{det_id});
} else if (args.size() == 2) {
det->setThresholdEnergy(
StringTo<int>(args[0]),
sls::StringTo<slsDetectorDefs::detectorSettings>(args[1]),
false, {det_id});
false, std::vector<int>{det_id});
} else {
WrongNumberOfParameters(1);
}
@ -1302,7 +1321,7 @@ std::string CmdProxy::TrimEnergies(int action) {
if (!args.empty()) {
WrongNumberOfParameters(0);
}
auto t = det->getTrimEnergies({det_id});
auto t = det->getTrimEnergies(std::vector<int>{det_id});
os << OutString(t) << '\n';
} else if (action == defs::PUT_ACTION) {
std::vector<int> t(args.size());
@ -1311,7 +1330,7 @@ std::string CmdProxy::TrimEnergies(int action) {
t[i] = StringTo<int>(args[i]);
}
}
det->setTrimEnergies(t, {det_id});
det->setTrimEnergies(t, std::vector<int>{det_id});
os << sls::ToString(args) << '\n';
} else {
throw sls::RuntimeError("Unknown action");
@ -1331,7 +1350,7 @@ std::string CmdProxy::RateCorrection(int action) {
if (!args.empty()) {
WrongNumberOfParameters(0);
}
auto t = det->getRateCorrection({det_id});
auto t = det->getRateCorrection(std::vector<int>{det_id});
os << OutString(t) << '\n';
} else if (action == defs::PUT_ACTION) {
if (args.size() != 1) {
@ -1339,12 +1358,12 @@ std::string CmdProxy::RateCorrection(int action) {
}
int tau = StringTo<int>(args[0]);
if (tau == -1) {
det->setDefaultRateCorrection({det_id});
auto t = det->getRateCorrection({det_id});
det->setDefaultRateCorrection(std::vector<int>{det_id});
auto t = det->getRateCorrection(std::vector<int>{det_id});
os << OutString(t) << '\n';
} else {
auto t = StringTo<time::ns>(args[0], "ns");
det->setRateCorrection(t, {det_id});
det->setRateCorrection(t, std::vector<int>{det_id});
os << args.front() << "ns\n";
}
} else {
@ -1365,8 +1384,8 @@ std::string CmdProxy::Activate(int action) {
if (!args.empty()) {
WrongNumberOfParameters(0);
}
auto t = det->getActive({det_id});
auto p = det->getRxPadDeactivatedMode({det_id});
auto t = det->getActive(std::vector<int>{det_id});
auto p = det->getRxPadDeactivatedMode(std::vector<int>{det_id});
Result<std::string> pResult(p.size());
for (unsigned int i = 0; i < p.size(); ++i) {
pResult[i] = p[i] ? "padding" : "nopadding";
@ -1377,7 +1396,7 @@ std::string CmdProxy::Activate(int action) {
WrongNumberOfParameters(2);
}
int t = StringTo<int>(args[0]);
det->setActive(t, {det_id});
det->setActive(t, std::vector<int>{det_id});
os << args[0];
if (args.size() == 2) {
bool p = true;
@ -1387,7 +1406,7 @@ std::string CmdProxy::Activate(int action) {
throw sls::RuntimeError(
"Unknown argument for deactivated padding.");
}
det->setRxPadDeactivatedMode(p, {det_id});
det->setRxPadDeactivatedMode(p, std::vector<int>{det_id});
os << ' ' << args[1];
}
os << '\n';
@ -1414,7 +1433,7 @@ std::string CmdProxy::PulsePixel(int action) {
defs::xy c;
c.x = StringTo<int>(args[1]);
c.y = StringTo<int>(args[2]);
det->pulsePixel(n, c, {det_id});
det->pulsePixel(n, c, std::vector<int>{det_id});
os << sls::ToString(args) << '\n';
} else {
throw sls::RuntimeError("Unknown action");
@ -1439,7 +1458,7 @@ std::string CmdProxy::PulsePixelAndMove(int action) {
defs::xy c;
c.x = StringTo<int>(args[1]);
c.y = StringTo<int>(args[2]);
det->pulsePixelNMove(n, c, {det_id});
det->pulsePixelNMove(n, c, std::vector<int>{det_id});
os << sls::ToString(args) << '\n';
} else {
throw sls::RuntimeError("Unknown action");
@ -1461,7 +1480,7 @@ std::string CmdProxy::PulseChip(int action) {
if (args.size() != 1) {
WrongNumberOfParameters(1);
}
det->pulseChip(StringTo<int>(args[0]), {det_id});
det->pulseChip(StringTo<int>(args[0]), std::vector<int>{det_id});
os << args.front() << '\n';
} else {
throw sls::RuntimeError("Unknown action");
@ -1480,7 +1499,7 @@ std::string CmdProxy::Quad(int action) {
if (!args.empty()) {
WrongNumberOfParameters(0);
}
auto t = det->getQuad({det_id});
auto t = det->getQuad(std::vector<int>{det_id});
os << OutString(t) << '\n';
} else if (action == defs::PUT_ACTION) {
if (det_id != -1) {
@ -1514,7 +1533,7 @@ std::string CmdProxy::TemperatureEvent(int action) {
if (!args.empty()) {
WrongNumberOfParameters(0);
}
auto t = det->getTemperatureEvent({det_id});
auto t = det->getTemperatureEvent(std::vector<int>{det_id});
os << OutString(t) << '\n';
} else if (action == defs::PUT_ACTION) {
if (args.size() != 1) {
@ -1524,7 +1543,7 @@ std::string CmdProxy::TemperatureEvent(int action) {
throw sls::RuntimeError("Unknown argument for temp event. Did you "
"mean 0 to reset event?");
}
det->resetTemperatureEvent({det_id});
det->resetTemperatureEvent(std::vector<int>{det_id});
os << "cleared" << '\n';
} else {
throw sls::RuntimeError("Unknown action");
@ -1546,7 +1565,7 @@ std::string CmdProxy::ROI(int action) {
if (!args.empty()) {
WrongNumberOfParameters(0);
}
auto t = det->getROI({det_id});
auto t = det->getROI(std::vector<int>{det_id});
for (auto &it : t) {
os << '[' << it.xmin << ", " << it.xmax << "] \n";
}
@ -1579,7 +1598,7 @@ std::string CmdProxy::ClearROI(int action) {
if (!args.empty()) {
WrongNumberOfParameters(0);
}
det->clearROI({det_id});
det->clearROI(std::vector<int>{det_id});
os << "[-1, -1]\n";
} else {
throw sls::RuntimeError("Unknown action");
@ -1602,7 +1621,7 @@ std::string CmdProxy::InjectChannel(int action) {
if (!args.empty()) {
WrongNumberOfParameters(0);
}
auto t = det->getInjectChannel({det_id});
auto t = det->getInjectChannel(std::vector<int>{det_id});
os << OutString(t) << '\n';
} else if (action == defs::PUT_ACTION) {
if (args.size() != 2) {
@ -1632,14 +1651,16 @@ std::string CmdProxy::VetoPhoton(int action) {
if (args.size() != 2) {
WrongNumberOfParameters(2);
}
det->getVetoPhoton(StringTo<int>(args[0]), args[1], {det_id});
det->getVetoPhoton(StringTo<int>(args[0]), args[1],
std::vector<int>{det_id});
os << "saved to file " << args[1] << '\n';
} else if (action == defs::PUT_ACTION) {
if (args.size() != 4) {
WrongNumberOfParameters(4);
}
det->setVetoPhoton(StringTo<int>(args[0]), StringTo<int>(args[1]),
StringTo<int>(args[2]), args[3], {det_id});
StringTo<int>(args[2]), args[3],
std::vector<int>{det_id});
os << sls::ToString(args) << '\n';
} else {
throw sls::RuntimeError("Unknown action");
@ -1684,7 +1705,8 @@ std::string CmdProxy::VetoFile(int action) {
if (args.size() != 2) {
WrongNumberOfParameters(2);
}
det->setVetoFile(StringTo<int>(args[0]), args[1], {det_id});
det->setVetoFile(StringTo<int>(args[0]), args[1],
std::vector<int>{det_id});
os << sls::ToString(args) << '\n';
} else {
throw sls::RuntimeError("Unknown action");
@ -1704,7 +1726,7 @@ std::string CmdProxy::BurstMode(int action) {
if (!args.empty()) {
WrongNumberOfParameters(0);
}
auto t = det->getBurstMode({det_id});
auto t = det->getBurstMode(std::vector<int>{det_id});
os << OutString(t) << '\n';
} else if (action == defs::PUT_ACTION) {
if (args.size() != 1) {
@ -1732,7 +1754,7 @@ std::string CmdProxy::BurstMode(int action) {
} catch (...) {
t = sls::StringTo<defs::burstMode>(args[0]);
}
det->setBurstMode(t, {det_id});
det->setBurstMode(t, std::vector<int>{det_id});
os << sls::ToString(t) << '\n'; // no args to convert 0,1,2 as well
} else {
throw sls::RuntimeError("Unknown action");
@ -1755,7 +1777,8 @@ std::string CmdProxy::ConfigureADC(int action) {
WrongNumberOfParameters(2);
}
auto t = det->getADCConfiguration(StringTo<int>(args[0]),
StringTo<int>(args[1]), {det_id});
StringTo<int>(args[1]),
std::vector<int>{det_id});
os << OutStringHex(t) << '\n';
} else if (action == defs::PUT_ACTION) {
if (args.size() != 3) {
@ -1763,7 +1786,7 @@ std::string CmdProxy::ConfigureADC(int action) {
}
int value = StringTo<int>(args[2]);
det->setADCConfiguration(StringTo<int>(args[0]), StringTo<int>(args[1]),
value, {det_id});
value, std::vector<int>{det_id});
os << '[' << args[0] << ", " << args[1] << ", " << ToStringHex(value)
<< "]\n";
} else {
@ -1783,13 +1806,13 @@ std::string CmdProxy::BadChannels(int action) {
if (args.size() != 1) {
WrongNumberOfParameters(1);
}
det->getBadChannels(args[0], {det_id});
det->getBadChannels(args[0], std::vector<int>{det_id});
os << "successfully retrieved" << '\n';
} else if (action == defs::PUT_ACTION) {
if (args.size() != 1) {
WrongNumberOfParameters(1);
}
det->setBadChannels(args[0], {det_id});
det->setBadChannels(args[0], std::vector<int>{det_id});
os << "successfully loaded" << '\n';
} else {
throw sls::RuntimeError("Unknown action");
@ -1811,7 +1834,7 @@ std::string CmdProxy::Counters(int action) {
if (!args.empty()) {
WrongNumberOfParameters(0);
}
auto mask = det->getCounterMask({det_id}).squash(-1);
auto mask = det->getCounterMask(std::vector<int>{det_id}).squash(-1);
os << sls::ToString(getSetBits(mask)) << '\n';
} else if (action == defs::PUT_ACTION) {
if (args.empty()) {
@ -1829,7 +1852,7 @@ std::string CmdProxy::Counters(int action) {
}
mask |= (1 << val);
}
det->setCounterMask(mask, {det_id});
det->setCounterMask(mask, std::vector<int>{det_id});
os << sls::ToString(args) << '\n';
} else {
throw sls::RuntimeError("Unknown action");
@ -1879,7 +1902,7 @@ std::string CmdProxy::GateDelay(int action) {
}
// vector of gate delays
if (gateIndex == -1) {
auto t = det->getGateDelayForAllGates({det_id});
auto t = det->getGateDelayForAllGates(std::vector<int>{det_id});
if (args.empty()) {
os << OutString(t) << '\n';
} else if (args.size() == 1) {
@ -1888,7 +1911,7 @@ std::string CmdProxy::GateDelay(int action) {
}
// single gate delay
else {
auto t = det->getGateDelay(gateIndex, {det_id});
auto t = det->getGateDelay(gateIndex, std::vector<int>{det_id});
if (args.empty()) {
os << OutString(t) << '\n';
} else if (args.size() == 1) {
@ -1900,10 +1923,10 @@ std::string CmdProxy::GateDelay(int action) {
std::string time_str(args[0]);
std::string unit = RemoveUnit(time_str);
auto t = StringTo<time::ns>(time_str, unit);
det->setGateDelay(gateIndex, t, {det_id});
det->setGateDelay(gateIndex, t, std::vector<int>{det_id});
} else if (args.size() == 2) {
auto t = StringTo<time::ns>(args[0], args[1]);
det->setGateDelay(gateIndex, t, {det_id});
det->setGateDelay(gateIndex, t, std::vector<int>{det_id});
} else {
WrongNumberOfParameters(2);
}
@ -1932,10 +1955,10 @@ std::string CmdProxy::Samples(int action) {
if (!args.empty()) {
WrongNumberOfParameters(0);
}
auto a = det->getNumberOfAnalogSamples({det_id});
auto a = det->getNumberOfAnalogSamples(std::vector<int>{det_id});
// get also digital samples for ctb and compare with analog
if (det->getDetectorType().squash() == defs::CHIPTESTBOARD) {
auto d = det->getNumberOfDigitalSamples({det_id});
auto d = det->getNumberOfDigitalSamples(std::vector<int>{det_id});
int as = a.squash(-1);
int ds = d.squash(-1);
if (as == -1 || ds == -1 || as != ds) { // check if a == d?
@ -1948,10 +1971,12 @@ std::string CmdProxy::Samples(int action) {
if (args.size() != 1) {
WrongNumberOfParameters(1);
}
det->setNumberOfAnalogSamples(StringTo<int>(args[0]), {det_id});
det->setNumberOfAnalogSamples(StringTo<int>(args[0]),
std::vector<int>{det_id});
// set also digital samples for ctb
if (det->getDetectorType().squash() == defs::CHIPTESTBOARD) {
det->setNumberOfDigitalSamples(StringTo<int>(args[0]), {det_id});
det->setNumberOfDigitalSamples(StringTo<int>(args[0]),
std::vector<int>{det_id});
}
os << args.front() << '\n';
} else {
@ -1978,7 +2003,8 @@ std::string CmdProxy::SlowAdc(int action) {
throw sls::RuntimeError("Unknown adc argument " + args[0]);
}
auto t = det->getSlowADC(
static_cast<defs::dacIndex>(nchan + defs::SLOW_ADC0), {det_id});
static_cast<defs::dacIndex>(nchan + defs::SLOW_ADC0),
std::vector<int>{det_id});
Result<double> result(t.size());
for (unsigned int i = 0; i < t.size(); ++i) {
result[i] = t[i] / 1000.00;
@ -2006,7 +2032,7 @@ std::string CmdProxy::ReceiverDbitList(int action) {
if (!args.empty()) {
WrongNumberOfParameters(0);
}
auto t = det->getRxDbitList({det_id});
auto t = det->getRxDbitList(std::vector<int>{det_id});
os << OutString(t) << '\n';
} else if (action == defs::PUT_ACTION) {
if (args.empty()) {
@ -2025,7 +2051,7 @@ std::string CmdProxy::ReceiverDbitList(int action) {
t[i] = StringTo<int>(args[i]);
}
}
det->setRxDbitList(t, {det_id});
det->setRxDbitList(t, std::vector<int>{det_id});
os << sls::ToString(args) << '\n';
} else {
throw sls::RuntimeError("Unknown action");
@ -2048,7 +2074,8 @@ std::string CmdProxy::DigitalIODelay(int action) {
WrongNumberOfParameters(2);
}
det->setDigitalIODelay(StringTo<uint64_t>(args[0]),
StringTo<int>(args[1]), {det_id});
StringTo<int>(args[1]),
std::vector<int>{det_id});
os << sls::ToString(args) << '\n';
} else {
throw sls::RuntimeError("Unknown action");
@ -2071,7 +2098,7 @@ std::string CmdProxy::Pattern(int action) {
if (args.size() != 1) {
WrongNumberOfParameters(1);
}
det->setPattern(args[0], {det_id});
det->setPattern(args[0], std::vector<int>{det_id});
os << args.front() << '\n';
} else {
throw sls::RuntimeError("Unknown action");
@ -2092,7 +2119,7 @@ std::string CmdProxy::PatternWord(int action) {
WrongNumberOfParameters(1);
}
int addr = StringTo<int>(args[0]);
auto t = det->getPatternWord(addr, {det_id});
auto t = det->getPatternWord(addr, std::vector<int>{det_id});
os << '[' << ToStringHex(addr, 4) << ", " << OutStringHex(t, 16)
<< "]\n";
} else if (action == defs::PUT_ACTION) {
@ -2101,7 +2128,7 @@ std::string CmdProxy::PatternWord(int action) {
}
int addr = StringTo<int>(args[0]);
uint64_t word = StringTo<uint64_t>(args[1]);
det->setPatternWord(addr, word, {det_id});
det->setPatternWord(addr, word, std::vector<int>{det_id});
os << '[' << ToStringHex(addr, 4) << ", " << ToStringHex(word, 16)
<< "]\n";
} else {
@ -2152,7 +2179,8 @@ std::string CmdProxy::PatternLoopAddresses(int action) {
if (!args.empty()) {
WrongNumberOfParameters(0);
}
auto t = det->getPatternLoopAddresses(level, {det_id});
auto t =
det->getPatternLoopAddresses(level, std::vector<int>{det_id});
os << OutStringHex(t, 4) << '\n';
} else if (action == defs::PUT_ACTION) {
if (args.size() != 2) {
@ -2160,7 +2188,8 @@ std::string CmdProxy::PatternLoopAddresses(int action) {
}
int start = StringTo<int>(args[0]);
int stop = StringTo<int>(args[1]);
det->setPatternLoopAddresses(level, start, stop, {det_id});
det->setPatternLoopAddresses(level, start, stop,
std::vector<int>{det_id});
os << '[' << ToStringHex(start, 4) << ", " << ToStringHex(stop, 4)
<< "]\n";
} else {
@ -2206,13 +2235,14 @@ std::string CmdProxy::PatternLoopCycles(int action) {
if (!args.empty()) {
WrongNumberOfParameters(0);
}
auto t = det->getPatternLoopCycles(level, {det_id});
auto t = det->getPatternLoopCycles(level, std::vector<int>{det_id});
os << OutString(t) << '\n';
} else if (action == defs::PUT_ACTION) {
if (args.size() != 1) {
WrongNumberOfParameters(1);
}
det->setPatternLoopCycles(level, StringTo<int>(args[0]), {det_id});
det->setPatternLoopCycles(level, StringTo<int>(args[0]),
std::vector<int>{det_id});
os << args.front() << '\n';
} else {
throw sls::RuntimeError("Unknown action");
@ -2251,14 +2281,14 @@ std::string CmdProxy::PatternWaitAddress(int action) {
if (!args.empty()) {
WrongNumberOfParameters(0);
}
auto t = det->getPatternWaitAddr(level, {det_id});
auto t = det->getPatternWaitAddr(level, std::vector<int>{det_id});
os << OutStringHex(t, 4) << '\n';
} else if (action == defs::PUT_ACTION) {
if (args.size() != 1) {
WrongNumberOfParameters(1);
}
int addr = StringTo<int>(args[0]);
det->setPatternWaitAddr(level, addr, {det_id});
det->setPatternWaitAddr(level, addr, std::vector<int>{det_id});
os << ToStringHex(addr, 4) << '\n';
} else {
throw sls::RuntimeError("Unknown action");
@ -2303,7 +2333,7 @@ std::string CmdProxy::PatternWaitTime(int action) {
if (!args.empty()) {
WrongNumberOfParameters(0);
}
auto t = det->getPatternWaitTime(level, {det_id});
auto t = det->getPatternWaitTime(level, std::vector<int>{det_id});
os << OutString(t) << '\n';
} else if (action == defs::PUT_ACTION) {
if (args.size() != 1) {
@ -2336,7 +2366,7 @@ std::string CmdProxy::AdditionalJsonHeader(int action) {
if (!args.empty()) {
WrongNumberOfParameters(0);
}
auto t = det->getAdditionalJsonHeader({det_id});
auto t = det->getAdditionalJsonHeader(std::vector<int>{det_id});
os << OutString(t) << '\n';
} else if (action == defs::PUT_ACTION) {
// arguments can be empty
@ -2349,7 +2379,7 @@ std::string CmdProxy::AdditionalJsonHeader(int action) {
json[args[i]] = args[i + 1];
}
}
det->setAdditionalJsonHeader(json, {det_id});
det->setAdditionalJsonHeader(json, std::vector<int>{det_id});
os << sls::ToString(json) << '\n';
} else {
throw sls::RuntimeError("Unknown action");
@ -2370,15 +2400,18 @@ std::string CmdProxy::JsonParameter(int action) {
if (args.size() != 1) {
WrongNumberOfParameters(1);
}
auto t = det->getAdditionalJsonParameter(args[0], {det_id});
auto t =
det->getAdditionalJsonParameter(args[0], std::vector<int>{det_id});
os << OutString(t) << '\n';
} else if (action == defs::PUT_ACTION) {
switch (args.size()) {
case 1:
det->setAdditionalJsonParameter(args[0], "", {det_id});
det->setAdditionalJsonParameter(args[0], "",
std::vector<int>{det_id});
break;
case 2:
det->setAdditionalJsonParameter(args[0], args[1], {det_id});
det->setAdditionalJsonParameter(args[0], args[1],
std::vector<int>{det_id});
break;
default:
WrongNumberOfParameters(1);
@ -2409,7 +2442,7 @@ std::string CmdProxy::ProgramFpga(int action) {
if (args.size() != 1) {
WrongNumberOfParameters(1);
}
det->programFPGA(args[0], {det_id});
det->programFPGA(args[0], std::vector<int>{det_id});
os << "successful\n";
} else {
throw sls::RuntimeError("Unknown action");
@ -2434,7 +2467,7 @@ std::string CmdProxy::CopyDetectorServer(int action) {
if (args.size() != 2) {
WrongNumberOfParameters(2);
}
det->copyDetectorServer(args[0], args[1], {det_id});
det->copyDetectorServer(args[0], args[1], std::vector<int>{det_id});
os << "successful\n";
} else {
throw sls::RuntimeError("Unknown action");
@ -2460,7 +2493,8 @@ std::string CmdProxy::UpdateFirmwareAndDetectorServer(int action) {
if (args[2].find(".pof") == std::string::npos) {
throw sls::RuntimeError("Programming file must be a pof file.");
}
det->updateFirmwareAndServer(args[0], args[1], args[2], {det_id});
det->updateFirmwareAndServer(args[0], args[1], args[2],
std::vector<int>{det_id});
os << "successful\n";
} else {
throw sls::RuntimeError("Unknown action");
@ -2480,14 +2514,16 @@ std::string CmdProxy::Register(int action) {
if (args.size() != 1) {
WrongNumberOfParameters(1);
}
auto t = det->readRegister(StringTo<uint32_t>(args[0]), {det_id});
auto t = det->readRegister(StringTo<uint32_t>(args[0]),
std::vector<int>{det_id});
os << OutStringHex(t) << '\n';
} else if (action == defs::PUT_ACTION) {
if (args.size() != 2) {
WrongNumberOfParameters(2);
}
det->writeRegister(StringTo<uint32_t>(args[0]),
StringTo<uint32_t>(args[1]), {det_id});
StringTo<uint32_t>(args[1]),
std::vector<int>{det_id});
os << sls::ToString(args) << '\n';
} else {
throw sls::RuntimeError("Unknown action");
@ -2510,7 +2546,8 @@ std::string CmdProxy::AdcRegister(int action) {
WrongNumberOfParameters(2);
}
det->writeAdcRegister(StringTo<uint32_t>(args[0]),
StringTo<uint32_t>(args[1]), {det_id});
StringTo<uint32_t>(args[1]),
std::vector<int>{det_id});
os << sls::ToString(args) << '\n';
} else {
throw sls::RuntimeError("Unknown action");
@ -2556,7 +2593,7 @@ std::string CmdProxy::BitOperations(int action) {
if (cmd == "setbit" || cmd == "clearbit") {
throw sls::RuntimeError("Cannot get");
}
auto t = det->readRegister(addr, {det_id});
auto t = det->readRegister(addr, std::vector<int>{det_id});
Result<int> result(t.size());
for (unsigned int i = 0; i < t.size(); ++i) {
result[i] = ((t[i] >> bitnr) & 0x1);
@ -2567,9 +2604,9 @@ std::string CmdProxy::BitOperations(int action) {
throw sls::RuntimeError("Cannot put");
}
if (cmd == "setbit") {
det->setBit(addr, bitnr, {det_id});
det->setBit(addr, bitnr, std::vector<int>{det_id});
} else if (cmd == "clearbit") {
det->clearBit(addr, bitnr, {det_id});
det->clearBit(addr, bitnr, std::vector<int>{det_id});
}
os << sls::ToString(args) << '\n';
} else {
@ -2627,7 +2664,7 @@ std::string CmdProxy::ExecuteCommand(int action) {
if (args.size() != 1) {
WrongNumberOfParameters(1);
}
auto t = det->executeCommand(args[0], {det_id});
auto t = det->executeCommand(args[0], std::vector<int>{det_id});
os << OutString(t) << '\n';
} else {
throw sls::RuntimeError("Unknown action");

View File

@ -24,7 +24,7 @@
if (action == slsDetectorDefs::HELP_ACTION) \
os << HLPSTR << '\n'; \
else if (action == slsDetectorDefs::GET_ACTION) { \
auto t = det->GETFCN({det_id}); \
auto t = det->GETFCN(std::vector<int>{det_id}); \
if (args.empty()) { \
os << OutString(t) << '\n'; \
} else if (args.size() == 1) { \
@ -37,10 +37,10 @@
std::string time_str(args[0]); \
std::string unit = RemoveUnit(time_str); \
auto t = StringTo<time::ns>(time_str, unit); \
det->SETFCN(t, {det_id}); \
det->SETFCN(t, std::vector<int>{det_id}); \
} else if (args.size() == 2) { \
auto t = StringTo<time::ns>(args[0], args[1]); \
det->SETFCN(t, {det_id}); \
det->SETFCN(t, std::vector<int>{det_id}); \
} else { \
WrongNumberOfParameters(2); \
} \
@ -64,7 +64,7 @@
if (action == slsDetectorDefs::HELP_ACTION) \
os << HLPSTR << '\n'; \
else if (action == slsDetectorDefs::GET_ACTION) { \
auto t = det->GETFCN({det_id}); \
auto t = det->GETFCN(std::vector<int>{det_id}); \
if (args.empty()) { \
os << OutString(t) << '\n'; \
} else if (args.size() == 1) { \
@ -91,13 +91,13 @@
if (!args.empty()) { \
WrongNumberOfParameters(0); \
} \
auto t = det->GETFCN({det_id}); \
auto t = det->GETFCN(std::vector<int>{det_id}); \
os << OutString(t) << '\n'; \
} else if (action == slsDetectorDefs::PUT_ACTION) { \
if (args.size() != 1) { \
WrongNumberOfParameters(1); \
} \
det->SETFCN(args[0], {det_id}); \
det->SETFCN(args[0], std::vector<int>{det_id}); \
os << args.front() << '\n'; \
} else { \
throw sls::RuntimeError("Unknown action"); \
@ -116,14 +116,14 @@
if (!args.empty()) { \
WrongNumberOfParameters(0); \
} \
auto t = det->GETFCN({det_id}); \
auto t = det->GETFCN(std::vector<int>{det_id}); \
os << OutStringHex(t, 16) << '\n'; \
} else if (action == slsDetectorDefs::PUT_ACTION) { \
if (args.size() != 1) { \
WrongNumberOfParameters(1); \
} \
auto val = CONV(args[0]); \
det->SETFCN(val, {det_id}); \
det->SETFCN(val, std::vector<int>{det_id}); \
os << ToStringHex(val, 16) << '\n'; \
} else { \
throw sls::RuntimeError("Unknown action"); \
@ -142,14 +142,14 @@
if (!args.empty()) { \
WrongNumberOfParameters(0); \
} \
auto t = det->GETFCN({det_id}); \
auto t = det->GETFCN(std::vector<int>{det_id}); \
os << OutStringHex(t) << '\n'; \
} else if (action == slsDetectorDefs::PUT_ACTION) { \
if (args.size() != 1) { \
WrongNumberOfParameters(1); \
} \
auto val = CONV(args[0]); \
det->SETFCN(val, {det_id}); \
det->SETFCN(val, std::vector<int>{det_id}); \
os << args.front() << '\n'; \
} else { \
throw sls::RuntimeError("Unknown action"); \
@ -158,7 +158,7 @@
}
/** int or enum */
#define INTEGER_COMMAND(CMDNAME, GETFCN, SETFCN, CONV, HLPSTR) \
#define INTEGER_COMMAND_VEC_ID(CMDNAME, GETFCN, SETFCN, CONV, HLPSTR) \
std::string CMDNAME(const int action) { \
std::ostringstream os; \
os << cmd << ' '; \
@ -168,14 +168,66 @@
if (!args.empty()) { \
WrongNumberOfParameters(0); \
} \
auto t = det->GETFCN({det_id}); \
auto t = det->GETFCN(std::vector<int>{det_id}); \
os << OutString(t) << '\n'; \
} else if (action == slsDetectorDefs::PUT_ACTION) { \
if (args.size() != 1) { \
WrongNumberOfParameters(1); \
} \
auto val = CONV(args[0]); \
det->SETFCN(val, {det_id}); \
det->SETFCN(val, std::vector<int>{det_id}); \
os << args.front() << '\n'; \
} else { \
throw sls::RuntimeError("Unknown action"); \
} \
return os.str(); \
}
/** int or enum */
#define INTEGER_COMMAND_VEC_ID_GET(CMDNAME, GETFCN, SETFCN, CONV, HLPSTR) \
std::string CMDNAME(const int action) { \
std::ostringstream os; \
os << cmd << ' '; \
if (action == slsDetectorDefs::HELP_ACTION) \
os << HLPSTR << '\n'; \
else if (action == slsDetectorDefs::GET_ACTION) { \
if (!args.empty()) { \
WrongNumberOfParameters(0); \
} \
auto t = det->GETFCN(std::vector<int>{det_id}); \
os << OutString(t) << '\n'; \
} else if (action == slsDetectorDefs::PUT_ACTION) { \
if (args.size() != 1) { \
WrongNumberOfParameters(1); \
} \
auto val = CONV(args[0]); \
det->SETFCN(val, det_id); \
os << args.front() << '\n'; \
} else { \
throw sls::RuntimeError("Unknown action"); \
} \
return os.str(); \
}
/** int or enum */
#define INTEGER_COMMAND_SINGLE_ID(CMDNAME, GETFCN, SETFCN, CONV, HLPSTR) \
std::string CMDNAME(const int action) { \
std::ostringstream os; \
os << cmd << ' '; \
if (action == slsDetectorDefs::HELP_ACTION) \
os << HLPSTR << '\n'; \
else if (action == slsDetectorDefs::GET_ACTION) { \
if (!args.empty()) { \
WrongNumberOfParameters(0); \
} \
auto t = det->GETFCN(det_id); \
os << OutString(t) << '\n'; \
} else if (action == slsDetectorDefs::PUT_ACTION) { \
if (args.size() != 1) { \
WrongNumberOfParameters(1); \
} \
auto val = CONV(args[0]); \
det->SETFCN(val, det_id); \
os << args.front() << '\n'; \
} else { \
throw sls::RuntimeError("Unknown action"); \
@ -223,14 +275,14 @@
if (!args.empty()) { \
WrongNumberOfParameters(0); \
} \
auto t = det->GETFCN(INDEX, {det_id}); \
auto t = det->GETFCN(INDEX, std::vector<int>{det_id}); \
os << OutString(t) << '\n'; \
} else if (action == slsDetectorDefs::PUT_ACTION) { \
if (args.size() != 1) { \
WrongNumberOfParameters(1); \
} \
auto val = CONV(args[0]); \
det->SETFCN(INDEX, val, {det_id}); \
det->SETFCN(INDEX, val, std::vector<int>{det_id}); \
os << args.front() << '\n'; \
} else { \
throw sls::RuntimeError("Unknown action"); \
@ -249,14 +301,16 @@
if (args.size() != 1) { \
WrongNumberOfParameters(1); \
} \
auto t = det->GETFCN(INDEX, StringTo<int>(args[0]), {det_id}); \
auto t = det->GETFCN(INDEX, StringTo<int>(args[0]), \
std::vector<int>{det_id}); \
os << args[0] << ' ' << OutStringHex(t) << '\n'; \
} else if (action == slsDetectorDefs::PUT_ACTION) { \
if (args.size() != 2) { \
WrongNumberOfParameters(2); \
} \
auto val = CONV(args[1]); \
det->SETFCN(INDEX, StringTo<int>(args[0]), val, {det_id}); \
det->SETFCN(INDEX, StringTo<int>(args[0]), val, \
std::vector<int>{det_id}); \
os << args[0] << ' ' << args[1] << '\n'; \
} else { \
throw sls::RuntimeError("Unknown action"); \
@ -282,7 +336,7 @@
} else if (args.size() > 1) { \
WrongNumberOfParameters(0); \
} \
auto t = det->GETFCN(DAC_INDEX, mv, {det_id}); \
auto t = det->GETFCN(DAC_INDEX, mv, std::vector<int>{det_id}); \
os << OutString(t) << (!args.empty() ? " mV\n" : "\n"); \
} else if (action == slsDetectorDefs::PUT_ACTION) { \
bool mv = false; \
@ -295,7 +349,8 @@
} else if (args.size() > 2 || args.empty()) { \
WrongNumberOfParameters(1); \
} \
det->SETFCN(DAC_INDEX, StringTo<int>(args[0]), mv, {det_id}); \
det->SETFCN(DAC_INDEX, StringTo<int>(args[0]), mv, \
std::vector<int>{det_id}); \
os << args.front() << (args.size() > 1 ? " mV\n" : "\n"); \
} else { \
throw sls::RuntimeError("Unknown action"); \
@ -340,7 +395,7 @@
if (!args.empty()) { \
WrongNumberOfParameters(0); \
} \
det->SETFCN({det_id}); \
det->SETFCN(std::vector<int>{det_id}); \
os << "successful\n"; \
} else { \
throw sls::RuntimeError("Unknown action"); \
@ -385,7 +440,7 @@
if (args.size() != 1) { \
WrongNumberOfParameters(1); \
} \
det->SETFCN(args[0], {det_id}); \
det->SETFCN(args[0], std::vector<int>{det_id}); \
os << args.front() << '\n'; \
} else { \
throw sls::RuntimeError("Unknown action"); \
@ -404,7 +459,7 @@
if (!args.empty()) { \
WrongNumberOfParameters(0); \
} \
auto t = det->GETFCN({det_id}); \
auto t = det->GETFCN(std::vector<int>{det_id}); \
os << OutString(t) << '\n'; \
} else if (action == slsDetectorDefs::PUT_ACTION) { \
throw sls::RuntimeError("Cannot put"); \
@ -446,7 +501,7 @@
if (!args.empty()) { \
WrongNumberOfParameters(0); \
} \
auto t = det->GETFCN({det_id}); \
auto t = det->GETFCN(std::vector<int>{det_id}); \
os << OutStringHex(t) << '\n'; \
} else if (action == slsDetectorDefs::PUT_ACTION) { \
throw sls::RuntimeError("Cannot put"); \
@ -466,7 +521,7 @@
if (!args.empty()) { \
WrongNumberOfParameters(0); \
} \
auto t = det->GETFCN(VAL, {det_id}); \
auto t = det->GETFCN(VAL, std::vector<int>{det_id}); \
os << OutString(t) << APPEND << '\n'; \
} else if (action == slsDetectorDefs::PUT_ACTION) { \
throw sls::RuntimeError("Cannot put"); \
@ -1133,32 +1188,34 @@ class CmdProxy {
GET_COMMAND_NOID(settingslist, getSettingsList,
"\n\tList of settings implemented for this detector.");
INTEGER_COMMAND(settings, getSettings, setSettings,
sls::StringTo<slsDetectorDefs::detectorSettings>,
"[standard, fast, highgain, dynamicgain, lowgain, "
"mediumgain, veryhighgain, dynamichg0, "
"fixgain1, fixgain2, forceswitchg1, forceswitchg2, "
"verylowgain, g1_hg, g1_lg, g2_hc_hg, g2_hc_lg, "
"g2_lc_hg, g2_lc_lg, g4_hg, g4_lg]"
"\n\t Detector Settings"
"\n\t[Jungfrau] - [dynamicgain | dynamichg0 | fixgain1 | "
"fixgain2 | forceswitchg1 | forceswitchg2]"
"\n\t[Gotthard] - [dynamicgain | highgain | lowgain | "
"mediumgain | veryhighgain]"
"\n\t[Gotthard2] - [dynamicgain | fixgain1 | fixgain2]"
"\n\t[Moench] - [g1_hg | g1_lg | g2_hc_hg | g2_hc_lg | "
"g2_lc_hg | g2_lc_lg | g4_hg | g4_lg]"
"\n\t[Eiger] Use threshold or thresholdnotb. \n\t[Eiger] "
"settings loaded from file found in settingspath.");
INTEGER_COMMAND_VEC_ID(
settings, getSettings, setSettings,
sls::StringTo<slsDetectorDefs::detectorSettings>,
"[standard, fast, highgain, dynamicgain, lowgain, "
"mediumgain, veryhighgain, dynamichg0, "
"fixgain1, fixgain2, forceswitchg1, forceswitchg2, "
"verylowgain, g1_hg, g1_lg, g2_hc_hg, g2_hc_lg, "
"g2_lc_hg, g2_lc_lg, g4_hg, g4_lg]"
"\n\t Detector Settings"
"\n\t[Jungfrau] - [dynamicgain | dynamichg0 | fixgain1 | "
"fixgain2 | forceswitchg1 | forceswitchg2]"
"\n\t[Gotthard] - [dynamicgain | highgain | lowgain | "
"mediumgain | veryhighgain]"
"\n\t[Gotthard2] - [dynamicgain | fixgain1 | fixgain2]"
"\n\t[Moench] - [g1_hg | g1_lg | g2_hc_hg | g2_hc_lg | "
"g2_lc_hg | g2_lc_lg | g4_hg | g4_lg]"
"\n\t[Eiger] Use threshold or thresholdnotb. \n\t[Eiger] "
"settings loaded from file found in settingspath.");
EXECUTE_SET_COMMAND_1ARG(
trimbits, loadTrimbits,
"[fname]\n\t[Eiger][Mythen3] Loads the trimbit file to detector. If no "
"extension specified, serial number of each module is attached.");
INTEGER_COMMAND(trimval, getAllTrimbits, setAllTrimbits, StringTo<int>,
"[n_trimval]\n\t[Eiger][Mythen3] All trimbits set to this "
"value. Returns -1 if all trimbits are different values.");
INTEGER_COMMAND_VEC_ID(
trimval, getAllTrimbits, setAllTrimbits, StringTo<int>,
"[n_trimval]\n\t[Eiger][Mythen3] All trimbits set to this "
"value. Returns -1 if all trimbits are different values.");
/* acquisition parameters */
@ -1206,13 +1263,14 @@ class CmdProxy {
GET_COMMAND_NOID(drlist, getDynamicRangeList,
"\n\tGets the list of dynamic ranges for this detector.");
INTEGER_COMMAND(timing, getTimingMode, setTimingMode,
sls::StringTo<slsDetectorDefs::timingMode>,
"[auto|trigger|gating|burst_trigger]\n\tTiming Mode of "
"detector.\n\t[Jungfrau][Gotthard][Ctb][Moench][Gotthard2] "
"[auto|trigger]\n\t[Mythen3] "
"[auto|trigger|gating|trigger_gating]\n\t[Eiger] "
"[auto|trigger|gating|burst_trigger]");
INTEGER_COMMAND_VEC_ID(
timing, getTimingMode, setTimingMode,
sls::StringTo<slsDetectorDefs::timingMode>,
"[auto|trigger|gating|burst_trigger]\n\tTiming Mode of "
"detector.\n\t[Jungfrau][Gotthard][Ctb][Moench][Gotthard2] "
"[auto|trigger]\n\t[Mythen3] "
"[auto|trigger|gating|trigger_gating]\n\t[Eiger] "
"[auto|trigger|gating|burst_trigger]");
GET_COMMAND_NOID(timinglist, getTimingModeList,
"\n\tGets the list of timing modes for this detector.");
@ -1225,35 +1283,38 @@ class CmdProxy {
"\n\t[CTB][Jungfrau] Absolute maximum Phase shift of of the "
"clock to latch digital bits.");
INTEGER_COMMAND(highvoltage, getHighVoltage, setHighVoltage, StringTo<int>,
"[n_value]\n\tHigh voltage to the sensor in Voltage."
"\n\t[Gotthard] [0|90|110|120|150|180|200]"
"\n\t[Eiger][Mythen3][Gotthard2] 0-200"
"\n\t[Jungfrau][Ctb][Moench] [0|60-200]");
INTEGER_COMMAND_VEC_ID(highvoltage, getHighVoltage, setHighVoltage,
StringTo<int>,
"[n_value]\n\tHigh voltage to the sensor in Voltage."
"\n\t[Gotthard] [0|90|110|120|150|180|200]"
"\n\t[Eiger][Mythen3][Gotthard2] 0-200"
"\n\t[Jungfrau][Ctb][Moench] [0|60-200]");
INTEGER_COMMAND(powerchip, getPowerChip, setPowerChip, StringTo<int>,
"[0, 1]\n\t[Jungfrau][Mythen3][Gotthard2][Moench] Power "
"the chip. Default 0."
"\n\t[Jungfrau] Get will return power status."
"Can be off if temperature event occured (temperature over "
"temp_threshold with temp_control enabled."
"\n\t[Mythen3] If module not connected or wrong module, 1 "
"will fail. By default, not powered on"
"\n\t[Gotthard2] If module not connected or wrong module, "
"1 will fail. By default, powered on at server start up.");
INTEGER_COMMAND_VEC_ID(
powerchip, getPowerChip, setPowerChip, StringTo<int>,
"[0, 1]\n\t[Jungfrau][Mythen3][Gotthard2][Moench] Power "
"the chip. Default 0."
"\n\t[Jungfrau] Get will return power status."
"Can be off if temperature event occured (temperature over "
"temp_threshold with temp_control enabled."
"\n\t[Mythen3] If module not connected or wrong module, 1 "
"will fail. By default, not powered on"
"\n\t[Gotthard2] If module not connected or wrong module, "
"1 will fail. By default, powered on at server start up.");
INTEGER_COMMAND(
INTEGER_COMMAND_VEC_ID(
imagetest, getImageTestMode, setImageTestMode, StringTo<int>,
"[0, 1]\n\t[Gotthard] 1 adds channel intensity with precalculated "
"values when taking an acquisition. Default is 0."
"\n\t[Eiger][Jungfrau] Only for Virtual servers. If 0, each pixel "
"intensity incremented by 1. If 1, all pixels almost saturated.");
INTEGER_COMMAND(parallel, getParallelMode, setParallelMode, StringTo<int>,
"[0, 1]\n\t[Eiger][Mythen3] Enable or disable parallel "
"mode.\n\t[Mythen3] If exptime is too short, the "
"acquisition will return ERROR status and take fewer "
"frames than expected.");
INTEGER_COMMAND_VEC_ID(
parallel, getParallelMode, setParallelMode, StringTo<int>,
"[0, 1]\n\t[Eiger][Mythen3] Enable or disable parallel "
"mode.\n\t[Mythen3] If exptime is too short, the "
"acquisition will return ERROR status and take fewer "
"frames than expected.");
/** temperature */
GET_COMMAND_NOID(
@ -1637,11 +1698,12 @@ class CmdProxy {
GET_COMMAND(rx_missingpackets, getNumMissingPackets,
"\n\tNumber of missing packets for each port in receiver.");
INTEGER_COMMAND(startingfnum, getStartingFrameNumber,
setStartingFrameNumber, StringTo<uint64_t>,
"[n_value]\n\t[Eiger][Jungfrau] Starting frame number for "
"next acquisition. Stopping acquiistion might result in "
"different frame numbers for different modules.");
INTEGER_COMMAND_VEC_ID(
startingfnum, getStartingFrameNumber, setStartingFrameNumber,
StringTo<uint64_t>,
"[n_value]\n\t[Eiger][Jungfrau] Starting frame number for "
"next acquisition. Stopping acquiistion might result in "
"different frame numbers for different modules.");
EXECUTE_SET_COMMAND(
trigger, sendSoftwareTrigger,
@ -1653,7 +1715,7 @@ class CmdProxy {
/* Network Configuration (Detector<->Receiver) */
INTEGER_COMMAND(
INTEGER_COMMAND_VEC_ID(
numinterfaces, getNumberofUDPInterfaces, setNumberofUDPInterfaces,
StringTo<int>,
"[1, 2]\n\t[Jungfrau][Gotthard2] Number of udp interfaces to stream "
@ -1664,42 +1726,44 @@ class CmdProxy {
"veto information via 10Gbps for debugging. By default, if veto "
"enabled, it is sent via 2.5 gbps interface.");
INTEGER_COMMAND(
INTEGER_COMMAND_VEC_ID(
selinterface, getSelectedUDPInterface, selectUDPInterface,
StringTo<int>,
"[0, 1]\n\t[Jungfrau] The udp interface to stream data from detector. "
"Effective only when number of interfaces is 1. Default: 0 (outer)");
INTEGER_COMMAND(udp_srcip, getSourceUDPIP, setSourceUDPIP, IpAddr,
"[x.x.x.x]\n\tIp address of the detector (source) udp "
"interface. Must be same subnet as destination udp "
"ip.\n\t[Eiger] Set only for 10G. For 1G, detector will "
"replace with its own DHCP IP address.");
INTEGER_COMMAND_VEC_ID(
udp_srcip, getSourceUDPIP, setSourceUDPIP, IpAddr,
"[x.x.x.x]\n\tIp address of the detector (source) udp "
"interface. Must be same subnet as destination udp "
"ip.\n\t[Eiger] Set only for 10G. For 1G, detector will "
"replace with its own DHCP IP address.");
INTEGER_COMMAND(
INTEGER_COMMAND_VEC_ID(
udp_srcip2, getSourceUDPIP2, setSourceUDPIP2, IpAddr,
"[x.x.x.x]\n\t[Jungfrau][Gotthard2] Ip address of the detector "
"(source) udp interface 2. Must be same subnet as destination udp "
"ip2.\n\t [Jungfrau] bottom half \n\t [Gotthard2] veto debugging.");
INTEGER_COMMAND(
INTEGER_COMMAND_VEC_ID(
udp_srcmac, getSourceUDPMAC, setSourceUDPMAC, MacAddr,
"[x:x:x:x:x:x]\n\tMac address of the detector (source) udp "
"interface. \n\t[Eiger] Do not set as detector will replace with its "
"own DHCP Mac (1G) or DHCP Mac + 1 (10G).");
INTEGER_COMMAND(udp_srcmac2, getSourceUDPMAC2, setSourceUDPMAC2, MacAddr,
"[x:x:x:x:x:x]\n\t[Jungfrau] Mac address of the bottom "
"half of detector (source) udp interface. ");
INTEGER_COMMAND_VEC_ID(
udp_srcmac2, getSourceUDPMAC2, setSourceUDPMAC2, MacAddr,
"[x:x:x:x:x:x]\n\t[Jungfrau] Mac address of the bottom "
"half of detector (source) udp interface. ");
INTEGER_COMMAND(
INTEGER_COMMAND_VEC_ID(
udp_dstmac, getDestinationUDPMAC, setDestinationUDPMAC, MacAddr,
"[x:x:x:x:x:x]\n\tMac address of the receiver (destination) udp "
"interface. Not mandatory to set as udp_dstip retrieves it from "
"slsReceiver process, but must be set if you use a custom receiver "
"(not slsReceiver).");
INTEGER_COMMAND(
INTEGER_COMMAND_VEC_ID(
udp_dstmac2, getDestinationUDPMAC2, setDestinationUDPMAC2, MacAddr,
"[x:x:x:x:x:x]\n\t[Jungfrau] Mac address of the receiver (destination) "
"udp interface 2. Not mandatory to set as udp_dstip2 retrieves it from "
@ -1707,20 +1771,21 @@ class CmdProxy {
"slsReceiver). \n\t [Jungfrau] bottom half \n\t [Gotthard2] veto "
"debugging.");
INTEGER_COMMAND(
INTEGER_COMMAND_VEC_ID_GET(
udp_dstport, getDestinationUDPPort, setDestinationUDPPort,
StringTo<int>,
"[n]\n\tPort number of the receiver (destination) udp "
"interface. Default is 50001. \n\tIf multi command, ports for each "
"module is calculated (incremented by 1 if no 2nd interface)");
INTEGER_COMMAND(udp_dstport2, getDestinationUDPPort2,
setDestinationUDPPort2, StringTo<int>,
"[n]\n\t[Jungfrau][Eiger][Gotthard2] Port number of the "
"receiver (destination) udp interface 2. Default is 50002. "
"\n\tIf multi command, ports for each module is calculated "
"(incremented by 2) \n\t[Jungfrau] bottom half \n\t[Eiger] "
"right half \n\t[Gotthard2] veto debugging");
INTEGER_COMMAND_VEC_ID_GET(
udp_dstport2, getDestinationUDPPort2, setDestinationUDPPort2,
StringTo<int>,
"[n]\n\t[Jungfrau][Eiger][Gotthard2] Port number of the "
"receiver (destination) udp interface 2. Default is 50002. "
"\n\tIf multi command, ports for each module is calculated "
"(incremented by 2) \n\t[Jungfrau] bottom half \n\t[Eiger] "
"right half \n\t[Gotthard2] veto debugging");
EXECUTE_SET_COMMAND(
udp_reconfigure, reconfigureUDPDestination,
@ -1737,14 +1802,15 @@ class CmdProxy {
GET_COMMAND(rx_printconfig, printRxConfiguration,
"\n\tPrints the receiver configuration.");
INTEGER_COMMAND(tengiga, getTenGiga, setTenGiga, StringTo<int>,
"[0, 1]\n\t[Eiger][Ctb][Moench][Mythen3] 10GbE Enable.");
INTEGER_COMMAND_VEC_ID(
tengiga, getTenGiga, setTenGiga, StringTo<int>,
"[0, 1]\n\t[Eiger][Ctb][Moench][Mythen3] 10GbE Enable.");
INTEGER_COMMAND(flowcontrol10g, getTenGigaFlowControl,
setTenGigaFlowControl, StringTo<int>,
"[0, 1]\n\t[Eiger][Jungfrau] 10GbE Flow Control.");
INTEGER_COMMAND_VEC_ID(flowcontrol10g, getTenGigaFlowControl,
setTenGigaFlowControl, StringTo<int>,
"[0, 1]\n\t[Eiger][Jungfrau] 10GbE Flow Control.");
INTEGER_COMMAND(
INTEGER_COMMAND_VEC_ID(
txndelay_frame, getTransmissionDelayFrame, setTransmissionDelayFrame,
StringTo<int>,
"[n_delay]\n\t[Eiger][Jungfrau][Mythen3] Transmission delay of each "
@ -1755,14 +1821,14 @@ class CmdProxy {
"50000.\n\t[Mythen3] [0-16777215] Each value represents 8 ns (125 MHz "
"clock), max is 134 ms.");
INTEGER_COMMAND(
INTEGER_COMMAND_VEC_ID(
txndelay_left, getTransmissionDelayLeft, setTransmissionDelayLeft,
StringTo<int>,
"[n_delay]\n\t[Eiger] Transmission delay of first packet in an image "
"being streamed out of the module's left UDP port. Each value "
"represents 10ns. Typical value is 50000.");
INTEGER_COMMAND(
INTEGER_COMMAND_VEC_ID(
txndelay_right, getTransmissionDelayRight, setTransmissionDelayRight,
StringTo<int>,
"[n_delay]\n\t[Eiger] Transmission delay of first packet in an image "
@ -1771,22 +1837,23 @@ class CmdProxy {
/* Receiver Config */
INTEGER_COMMAND(
INTEGER_COMMAND_VEC_ID_GET(
rx_tcpport, getRxPort, setRxPort, StringTo<int>,
"[port]\n\tTCP port for client-receiver communication. Default is "
"1954. Must be different if multiple receivers on same pc. Must be "
"first command to set a receiver parameter. Multi command will "
"automatically increment for individual modules.");
INTEGER_COMMAND(rx_fifodepth, getRxFifoDepth, setRxFifoDepth, StringTo<int>,
"[n_frames]\n\tSet the number of frames in the receiver "
"fifo depth (buffer between listener and writer threads).");
INTEGER_COMMAND_VEC_ID(
rx_fifodepth, getRxFifoDepth, setRxFifoDepth, StringTo<int>,
"[n_frames]\n\tSet the number of frames in the receiver "
"fifo depth (buffer between listener and writer threads).");
INTEGER_COMMAND(
INTEGER_COMMAND_VEC_ID(
rx_silent, getRxSilentMode, setRxSilentMode, StringTo<int>,
"[0, 1]\n\tSwitch on or off receiver text output during acquisition.");
INTEGER_COMMAND(
INTEGER_COMMAND_VEC_ID(
rx_discardpolicy, getRxFrameDiscardPolicy, setRxFrameDiscardPolicy,
sls::StringTo<slsDetectorDefs::frameDiscardPolicy>,
"[nodiscard (default)|discardempty|discardpartial(fastest)]\n\tFrame "
@ -1794,12 +1861,12 @@ class CmdProxy {
"discardempty discards empty frames, discardpartial discards partial "
"frames.");
INTEGER_COMMAND(rx_padding, getPartialFramesPadding,
setPartialFramesPadding, StringTo<int>,
"[0, 1]\n\tPartial frames padding enable in the "
"receiver. Default: enabled. Disabling is fastest.");
INTEGER_COMMAND_VEC_ID(rx_padding, getPartialFramesPadding,
setPartialFramesPadding, StringTo<int>,
"[0, 1]\n\tPartial frames padding enable in the "
"receiver. Default: enabled. Disabling is fastest.");
INTEGER_COMMAND(
INTEGER_COMMAND_VEC_ID(
rx_udpsocksize, getRxUDPSocketBufferSize, setRxUDPSocketBufferSize,
StringTo<int64_t>,
"[n_size]\n\tUDP socket buffer size in receiver. Tune rmem_default and "
@ -1809,9 +1876,10 @@ class CmdProxy {
"\n\tActual udp socket buffer size. Double the size of "
"rx_udpsocksize due to kernel bookkeeping.");
INTEGER_COMMAND(rx_lock, getRxLock, setRxLock, StringTo<int>,
"[0, 1]\n\tLock receiver to one client IP, 1 locks, 0 "
"unlocks. Default is unlocked. 1: locks");
INTEGER_COMMAND_VEC_ID(
rx_lock, getRxLock, setRxLock, StringTo<int>,
"[0, 1]\n\tLock receiver to one client IP, 1 locks, 0 "
"unlocks. Default is unlocked. 1: locks");
GET_COMMAND(
rx_lastclient, getRxLastClientIP,
@ -1827,7 +1895,7 @@ class CmdProxy {
/* File */
INTEGER_COMMAND(
INTEGER_COMMAND_VEC_ID(
fformat, getFileFormat, setFileFormat,
sls::StringTo<slsDetectorDefs::fileFormat>,
"[binary|hdf5]\n\tFile format of data file. For HDF5, package must be "
@ -1843,11 +1911,11 @@ class CmdProxy {
"is run. File name: [file name prefix]_d[detector "
"index]_f[sub file index]_[acquisition/file index].raw.");
INTEGER_COMMAND(findex, getAcquisitionIndex, setAcquisitionIndex,
StringTo<int64_t>,
"[n_value]\n\tFile or Acquisition index.");
INTEGER_COMMAND_VEC_ID(findex, getAcquisitionIndex, setAcquisitionIndex,
StringTo<int64_t>,
"[n_value]\n\tFile or Acquisition index.");
INTEGER_COMMAND(
INTEGER_COMMAND_VEC_ID(
fwrite, getFileWrite, setFileWrite, StringTo<int>,
"[0, 1]\n\tEnable or disable receiver file write. Default is 1.");
@ -1855,18 +1923,18 @@ class CmdProxy {
fmaster, getMasterFileWrite, setMasterFileWrite, StringTo<int>,
"[0, 1]\n\tEnable or disable receiver master file. Default is 1.");
INTEGER_COMMAND(
INTEGER_COMMAND_VEC_ID(
foverwrite, getFileOverWrite, setFileOverWrite, StringTo<int>,
"[0, 1]\n\tEnable or disable file overwriting. Default is 1.");
INTEGER_COMMAND(rx_framesperfile, getFramesPerFile, setFramesPerFile,
StringTo<int>,
"[n_frames]\n\tNumber of frames per file in receiver. 0 is "
"infinite or all frames in single file.");
INTEGER_COMMAND_VEC_ID(
rx_framesperfile, getFramesPerFile, setFramesPerFile, StringTo<int>,
"[n_frames]\n\tNumber of frames per file in receiver. 0 is "
"infinite or all frames in single file.");
/* ZMQ Streaming Parameters (Receiver<->Client) */
INTEGER_COMMAND(
INTEGER_COMMAND_VEC_ID(
rx_zmqstream, getRxZmqDataStream, setRxZmqDataStream, StringTo<int>,
"[0, 1]\n\tEnable/ disable data streaming from receiver via zmq (eg. "
"to GUI or to another process for further processing). This creates/ "
@ -1875,7 +1943,7 @@ class CmdProxy {
"to command line acquire will require disabling data streaming in "
"receiver for fast applications. ");
INTEGER_COMMAND(
INTEGER_COMMAND_VEC_ID(
rx_zmqfreq, getRxZmqFrequency, setRxZmqFrequency, StringTo<int>,
"[nth frame]\n\tFrequency of frames streamed out from receiver via "
"zmq\n\tDefault: 1, Means every frame is streamed out. \n\tIf 2, every "
@ -1883,13 +1951,14 @@ class CmdProxy {
"timeout, after which current frame is sent out. (default timeout is "
"200 ms). Usually used for gui purposes.");
INTEGER_COMMAND(rx_zmqstartfnum, getRxZmqStartingFrame,
setRxZmqStartingFrame, StringTo<int>,
"[fnum]\n\tThe starting frame index to stream out. 0 by "
"default, which streams the first frame in an acquisition, "
"and then depending on the rx zmq frequency/ timer");
INTEGER_COMMAND_VEC_ID(
rx_zmqstartfnum, getRxZmqStartingFrame, setRxZmqStartingFrame,
StringTo<int>,
"[fnum]\n\tThe starting frame index to stream out. 0 by "
"default, which streams the first frame in an acquisition, "
"and then depending on the rx zmq frequency/ timer");
INTEGER_COMMAND(
INTEGER_COMMAND_VEC_ID_GET(
rx_zmqport, getRxZmqPort, setRxZmqPort, StringTo<int>,
"[port]\n\tZmq port for data to be streamed out of the receiver. Also "
"restarts receiver zmq streaming if enabled. Default is 30001. "
@ -1897,7 +1966,7 @@ class CmdProxy {
"client(gui). Must be different for every detector (and udp port). "
"Multi command will automatically increment for individual modules.");
INTEGER_COMMAND(
INTEGER_COMMAND_VEC_ID_GET(
zmqport, getClientZmqPort, setClientZmqPort, StringTo<int>,
"[port]\n\tZmq port in client(gui) or intermediate process for data to "
"be streamed to from receiver. Default connects to receiver zmq "
@ -1907,14 +1976,14 @@ class CmdProxy {
"port). Multi command will automatically increment for individual "
"modules.");
INTEGER_COMMAND(
INTEGER_COMMAND_VEC_ID(
rx_zmqip, getRxZmqIP, setRxZmqIP, IpAddr,
"[x.x.x.x]\n\tZmq Ip Address from which data is to be streamed out of "
"the receiver. Also restarts receiver zmq streaming if enabled. "
"Default is from rx_hostname. Modified only when using an intermediate "
"process between receiver.");
INTEGER_COMMAND(
INTEGER_COMMAND_VEC_ID(
zmqip, getClientZmqIp, setClientZmqIp, IpAddr,
"[x.x.x.x]\n\tIp Address to listen to zmq data streamed out from "
"receiver or intermediate process. Default connects to "
@ -1937,27 +2006,29 @@ class CmdProxy {
settingspath, getSettingsPath, setSettingsPath,
"[path]\n\t[Eiger] Directory where settings files are loaded from/to.");
INTEGER_COMMAND(overflow, getOverFlowMode, setOverFlowMode, StringTo<int>,
"[0, 1]\n\t[Eiger] Enable or disable show overflow flag in "
"32 bit mode. Default is disabled.");
INTEGER_COMMAND_VEC_ID(
overflow, getOverFlowMode, setOverFlowMode, StringTo<int>,
"[0, 1]\n\t[Eiger] Enable or disable show overflow flag in "
"32 bit mode. Default is disabled.");
INTEGER_COMMAND(
INTEGER_COMMAND_VEC_ID(
flippeddatax, getBottom, setBottom, StringTo<int>,
"[0, 1]\n\t[Eiger] Top or Bottom Half of Eiger module. 1 is bottom, 0 "
"is top. Used to let Receivers and Gui know to flip the bottom image "
"over the x axis. Files are not written without the flip however.");
INTEGER_COMMAND(
INTEGER_COMMAND_VEC_ID(
readnlines, getPartialReadout, setPartialReadout, StringTo<int>,
"[1 - 256]\n\t[Eiger] Number of rows to readout per half module "
"starting from the centre. 256 is default. The permissible values "
"depend on dynamic range and 10Gbe enabled.");
INTEGER_COMMAND(interruptsubframe, getInterruptSubframe,
setInterruptSubframe, StringTo<int>,
"[0, 1]\n\t[Eiger] 1 interrupts last subframe at required "
"exposure time. 0 will wait for last sub frame to finish "
"exposing. 0 is default.");
INTEGER_COMMAND_VEC_ID(
interruptsubframe, getInterruptSubframe, setInterruptSubframe,
StringTo<int>,
"[0, 1]\n\t[Eiger] 1 interrupts last subframe at required "
"exposure time. 0 will wait for last sub frame to finish "
"exposing. 0 is default.");
TIME_GET_COMMAND(measuredperiod, getMeasuredPeriod,
"[(optional unit) ns|us|ms|s]\n\t[Eiger] Measured frame "
@ -1968,7 +2039,7 @@ class CmdProxy {
"[(optional unit) ns|us|ms|s]\n\t[Eiger] Measured sub "
"frame period between last sub frame and previous one.");
INTEGER_COMMAND(
INTEGER_COMMAND_VEC_ID(
partialreset, getPartialReset, setPartialReset, StringTo<int>,
"[0, 1]\n\t[Eiger] Sets up detector to do partial or complete reset at "
"start of acquisition. 0 complete reset, 1 partial reset. Default is "
@ -1976,7 +2047,7 @@ class CmdProxy {
/* Jungfrau Specific */
INTEGER_COMMAND(
INTEGER_COMMAND_VEC_ID(
temp_threshold, getThresholdTemperature, setThresholdTemperature,
StringTo<int>,
"[n_temp (in degrees)]\n\t[Jungfrau] Threshold temperature in degrees. "
@ -1985,7 +2056,7 @@ class CmdProxy {
"occurs. To power on chip again, temperature has to be less than "
"threshold temperature and temperature event has to be cleared.");
INTEGER_COMMAND(
INTEGER_COMMAND_VEC_ID(
temp_control, getTemperatureControl, setTemperatureControl,
StringTo<int>,
"[0, 1]\n\t[Jungfrau] Temperature control enable. Default is 0 "
@ -1995,7 +2066,7 @@ class CmdProxy {
"to be less than threshold temperature and temperature event has to be "
"cleared.");
INTEGER_COMMAND(
INTEGER_COMMAND_VEC_ID(
auto_comp_disable, getAutoCompDisable, setAutoCompDisable,
StringTo<int>,
"[0, 1]\n\t[Jungfrau] Auto comparator disable mode. By default, the "
@ -2012,7 +2083,7 @@ class CmdProxy {
"0. For advanced users only. \n\tThe #images = #frames x #triggers x "
"(#storagecells + 1).");
INTEGER_COMMAND(
INTEGER_COMMAND_VEC_ID(
storagecell_start, getStorageCellStart, setStorageCellStart,
StringTo<int>,
"[0-15]\n\t[Jungfrau] Storage cell that stores the first acquisition "
@ -2040,54 +2111,57 @@ class CmdProxy {
"[duration] [(optional unit) ns|us|ms|s]\n\t[Gotthard2] Burst "
"period. Only in burst mode and auto timing mode.");
INTEGER_COMMAND(cdsgain, getCDSGain, setCDSGain, StringTo<bool>,
"[0, 1]\n\t[Gotthard2] Enable or disable CDS gain. Default "
"is disabled.");
INTEGER_COMMAND_VEC_ID(
cdsgain, getCDSGain, setCDSGain, StringTo<bool>,
"[0, 1]\n\t[Gotthard2] Enable or disable CDS gain. Default "
"is disabled.");
INTEGER_COMMAND(
INTEGER_COMMAND_VEC_ID(
filter, getFilter, setFilter, StringTo<int>,
"[0|1|2|3]\n\t[Gotthard2] Set filter resistor. Default is 0.");
INTEGER_COMMAND(currentsource, getCurrentSource, setCurrentSource,
StringTo<int>,
"[0, 1]\n\t[Gotthard2] Enable or disable current source. "
"Default is disabled.");
INTEGER_COMMAND_VEC_ID(
currentsource, getCurrentSource, setCurrentSource, StringTo<int>,
"[0, 1]\n\t[Gotthard2] Enable or disable current source. "
"Default is disabled.");
INTEGER_COMMAND(
INTEGER_COMMAND_VEC_ID(
timingsource, getTimingSource, setTimingSource,
sls::StringTo<slsDetectorDefs::timingSourceType>,
"[internal|external]\n\t[Gotthard2] Timing source. Internal is crystal "
"and external is system timing. Default is internal.");
INTEGER_COMMAND(veto, getVeto, setVeto, StringTo<int>,
"[0, 1]\n\t[Gotthard2] Enable or disable veto data "
"streaming from detector. Default is 0.");
INTEGER_COMMAND_VEC_ID(veto, getVeto, setVeto, StringTo<int>,
"[0, 1]\n\t[Gotthard2] Enable or disable veto data "
"streaming from detector. Default is 0.");
/* Mythen3 Specific */
INTEGER_COMMAND(gates, getNumberOfGates, setNumberOfGates, StringTo<int>,
"[n_gates]\n\t[Mythen3] Number of external gates in gating "
"or trigger_gating mode (external gating).");
INTEGER_COMMAND_VEC_ID(
gates, getNumberOfGates, setNumberOfGates, StringTo<int>,
"[n_gates]\n\t[Mythen3] Number of external gates in gating "
"or trigger_gating mode (external gating).");
/* CTB/ Moench Specific */
INTEGER_COMMAND(
INTEGER_COMMAND_VEC_ID(
asamples, getNumberOfAnalogSamples, setNumberOfAnalogSamples,
StringTo<int>,
"[n_samples]\n\t[CTB][Moench] Number of analog samples expected.");
INTEGER_COMMAND(
INTEGER_COMMAND_VEC_ID(
adcclk, getADCClock, setADCClock, StringTo<int>,
"[n_clk in MHz]\n\t[Ctb][Moench] ADC clock frequency in MHz.");
INTEGER_COMMAND(runclk, getRUNClock, setRUNClock, StringTo<int>,
"[n_clk in MHz]\n\t[Ctb][Moench] Run clock in MHz.");
INTEGER_COMMAND_VEC_ID(runclk, getRUNClock, setRUNClock, StringTo<int>,
"[n_clk in MHz]\n\t[Ctb][Moench] Run clock in MHz.");
GET_COMMAND(syncclk, getSYNCClock,
"[n_clk in MHz]\n\t[Ctb][Moench] Sync clock in MHz.");
INTEGER_COMMAND(adcpipeline, getADCPipeline, setADCPipeline, StringTo<int>,
"[n_value]\n\t[Ctb][Moench] Pipeline for ADC clock.");
INTEGER_COMMAND_VEC_ID(
adcpipeline, getADCPipeline, setADCPipeline, StringTo<int>,
"[n_value]\n\t[Ctb][Moench] Pipeline for ADC clock.");
INTEGER_IND_COMMAND(v_limit, getVoltage, setVoltage, StringTo<int>,
defs::V_LIMIT,
@ -2108,20 +2182,22 @@ class CmdProxy {
/* CTB Specific */
INTEGER_COMMAND(dsamples, getNumberOfDigitalSamples,
setNumberOfDigitalSamples, StringTo<int>,
"[n_value]\n\t[CTB] Number of digital samples expected.");
INTEGER_COMMAND_VEC_ID(
dsamples, getNumberOfDigitalSamples, setNumberOfDigitalSamples,
StringTo<int>,
"[n_value]\n\t[CTB] Number of digital samples expected.");
INTEGER_COMMAND(romode, getReadoutMode, setReadoutMode,
sls::StringTo<slsDetectorDefs::readoutMode>,
"[analog|digital|analog_digital]\n\t[CTB] Readout mode. "
"Default is analog.");
INTEGER_COMMAND_VEC_ID(
romode, getReadoutMode, setReadoutMode,
sls::StringTo<slsDetectorDefs::readoutMode>,
"[analog|digital|analog_digital]\n\t[CTB] Readout mode. "
"Default is analog.");
INTEGER_COMMAND(
INTEGER_COMMAND_VEC_ID(
dbitclk, getDBITClock, setDBITClock, StringTo<int>,
"[n_clk in MHz]\n\t[Ctb] Clock for latching the digital bits in MHz.");
INTEGER_COMMAND(
INTEGER_COMMAND_VEC_ID(
dbitpipeline, getDBITPipeline, setDBITPipeline, StringTo<int>,
"[n_value]\n\t[Ctb] Pipeline of the clock for latching digital bits.");
@ -2182,23 +2258,24 @@ class CmdProxy {
GET_IND_COMMAND(im_io, getMeasuredCurrent, defs::I_POWER_IO, "",
"\n\t[Ctb] Measured current of power supply io in mA.");
INTEGER_COMMAND(
INTEGER_COMMAND_VEC_ID(
extsampling, getExternalSampling, setExternalSampling, StringTo<int>,
"[0, 1]\n\t[Ctb] Enable for external sampling signal to extsamplingsrc "
"signal for digital data. For advanced users only.");
INTEGER_COMMAND(extsamplingsrc, getExternalSamplingSource,
setExternalSamplingSource, StringTo<int>,
"[0-63]\n\t[Ctb] Sampling source signal for digital data. "
"For advanced users only.");
INTEGER_COMMAND_VEC_ID(
extsamplingsrc, getExternalSamplingSource, setExternalSamplingSource,
StringTo<int>,
"[0-63]\n\t[Ctb] Sampling source signal for digital data. "
"For advanced users only.");
INTEGER_COMMAND(rx_dbitoffset, getRxDbitOffset, setRxDbitOffset,
StringTo<int>,
"[n_bytes]\n\t[Ctb] Offset in bytes in digital data to "
"skip in receiver.");
INTEGER_COMMAND_VEC_ID(
rx_dbitoffset, getRxDbitOffset, setRxDbitOffset, StringTo<int>,
"[n_bytes]\n\t[Ctb] Offset in bytes in digital data to "
"skip in receiver.");
INTEGER_COMMAND(led, getLEDEnable, setLEDEnable, StringTo<int>,
"[0, 1]\n\t[Ctb] Switches on/off all LEDs.");
INTEGER_COMMAND_VEC_ID(led, getLEDEnable, setLEDEnable, StringTo<int>,
"[0, 1]\n\t[Ctb] Switches on/off all LEDs.");
/* Pattern */
@ -2253,18 +2330,19 @@ class CmdProxy {
/* Insignificant */
INTEGER_COMMAND(
INTEGER_COMMAND_VEC_ID(
port, getControlPort, setControlPort, StringTo<int>,
"[n]\n\tPort number of the control server on detector for "
"detector-client tcp interface. Default is 1952. Normally unchanged.");
INTEGER_COMMAND(
INTEGER_COMMAND_VEC_ID(
stopport, getStopPort, setStopPort, StringTo<int>,
"[n]\n\tPort number of the stop server on detector for detector-client "
"tcp interface. Default is 1953. Normally unchanged.");
INTEGER_COMMAND(lock, getDetectorLock, setDetectorLock, StringTo<int>,
"[0, 1]\n\tLock detector to one IP, 1: locks");
INTEGER_COMMAND_VEC_ID(lock, getDetectorLock, setDetectorLock,
StringTo<int>,
"[0, 1]\n\tLock detector to one IP, 1: locks");
GET_COMMAND(
lastclient, getLastClientIP,

View File

@ -298,7 +298,7 @@ TEST_CASE("triggers", "[.cmd][.new]") {
det.setNumberOfTriggers(prev_val);
}
TEST_CASE("exptime", "[.cmd][.new]") {
TEST_CASE("exptime", "[.cmd][.time]") {
Detector det;
CmdProxy proxy(&det);
auto det_type = det.getDetectorType().squash();
@ -333,6 +333,12 @@ TEST_CASE("exptime", "[.cmd][.new]") {
proxy.Call("exptime", {"0"}, -1, PUT, oss);
REQUIRE(oss.str() == "exptime 0\n");
}
{
//Get exptime of single module
std::ostringstream oss;
proxy.Call("exptime", {}, 0, GET, oss);
REQUIRE(oss.str() == "exptime 0ns\n");
}
det.setExptime(-1, prev_val);
}