mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-12 21:07:13 +02:00
Merge branch 'test' into developer
This commit is contained in:
BIN
settingsdir/eiger/standard/4500eV/noise.sn000
Executable file
BIN
settingsdir/eiger/standard/4500eV/noise.sn000
Executable file
Binary file not shown.
Binary file not shown.
@ -1622,9 +1622,6 @@ int setDetectorPosition(int pos[]) {
|
||||
int *getDetectorPosition() { return detPos; }
|
||||
|
||||
int enableTenGigabitEthernet(int val) {
|
||||
#ifdef VIRTUAL
|
||||
return 0;
|
||||
#endif
|
||||
uint32_t addr = CONFIG_REG;
|
||||
|
||||
// set
|
||||
|
Binary file not shown.
@ -96,6 +96,8 @@ uint64_t eiger_virtual_startingframenumber = 1;
|
||||
int eiger_virtual_detPos[2] = {0, 0};
|
||||
int eiger_virtual_test_mode = 0;
|
||||
int eiger_virtual_quad_mode = 0;
|
||||
int eiger_virtual_read_nlines = 256;
|
||||
int eiger_virtual_interrupt_subframe = 0;
|
||||
#endif
|
||||
|
||||
int isInitCheckDone() { return initCheckDone; }
|
||||
@ -1516,13 +1518,15 @@ int setInterruptSubframe(int value) {
|
||||
if (!Feb_Control_SetInterruptSubframe(value)) {
|
||||
return FAIL;
|
||||
}
|
||||
#else
|
||||
eiger_virtual_interrupt_subframe = value;
|
||||
#endif
|
||||
return OK;
|
||||
}
|
||||
|
||||
int getInterruptSubframe() {
|
||||
#ifdef VIRTUAL
|
||||
return 0;
|
||||
return eiger_virtual_interrupt_subframe;
|
||||
#else
|
||||
return Feb_Control_GetInterruptSubframe();
|
||||
#endif
|
||||
@ -1536,13 +1540,15 @@ int setReadNLines(int value) {
|
||||
return FAIL;
|
||||
}
|
||||
Beb_SetReadNLines(value);
|
||||
#else
|
||||
eiger_virtual_read_nlines = value;
|
||||
#endif
|
||||
return OK;
|
||||
}
|
||||
|
||||
int getReadNLines() {
|
||||
#ifdef VIRTUAL
|
||||
return 0;
|
||||
return eiger_virtual_read_nlines;
|
||||
#else
|
||||
return Feb_Control_GetReadNLines();
|
||||
#endif
|
||||
@ -1835,6 +1841,7 @@ void setExternalGating(int enable[]) {
|
||||
}
|
||||
|
||||
int setAllTrimbits(int val) {
|
||||
LOG(logINFO, ("Setting all trimbits to %d\n", val));
|
||||
#ifndef VIRTUAL
|
||||
if (!Feb_Control_SaveAllTrimbitsTo(val, top)) {
|
||||
LOG(logERROR, ("Could not set all trimbits\n"));
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1255,9 +1255,6 @@ int setDetectorPosition(int pos[]) {
|
||||
int *getDetectorPosition() { return detPos; }
|
||||
|
||||
int enableTenGigabitEthernet(int val) {
|
||||
#ifdef VIRTUAL
|
||||
return 0;
|
||||
#endif
|
||||
uint32_t addr = CONFIG_REG;
|
||||
|
||||
// set
|
||||
|
Binary file not shown.
@ -177,7 +177,9 @@ int main(int argc, char *argv[]) {
|
||||
#if defined(MYTHEN3D) || defined(GOTTHARD2D)
|
||||
rebootNiosControllerAndFPGA();
|
||||
#else
|
||||
#ifndef VIRTUAL
|
||||
system("reboot");
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
LOG(logINFO, ("Goodbye!\n"));
|
||||
|
@ -2591,8 +2591,8 @@ int get_period_left(int file_des) {
|
||||
memset(mess, 0, sizeof(mess));
|
||||
int64_t retval = -1;
|
||||
|
||||
#if !defined(JUNGFRAUD) && !defined(GOTTHARDD) && !defined(CHIPTESTBOARDD) && \
|
||||
!defined(MOENCHD) && !defined(MYTHEN3D) && !defined(GOTTHARD2D)
|
||||
#if !defined(JUNGFRAUD) && !defined(GOTTHARDD) /* && !defined(CHIPTESTBOARDD) \
|
||||
&& !defined(MOENCHD) && !defined(MYTHEN3D) && !defined(GOTTHARD2D)*/
|
||||
functionNotImplemented();
|
||||
#else
|
||||
// get only
|
||||
@ -2607,8 +2607,8 @@ int get_delay_after_trigger_left(int file_des) {
|
||||
memset(mess, 0, sizeof(mess));
|
||||
int64_t retval = -1;
|
||||
|
||||
#if !defined(JUNGFRAUD) && !defined(GOTTHARDD) && !defined(CHIPTESTBOARDD) && \
|
||||
!defined(MOENCHD) && !defined(MYTHEN3D) && !defined(GOTTHARD2D)
|
||||
#if !defined(JUNGFRAUD) && !defined(GOTTHARDD) /* && !defined(CHIPTESTBOARDD) \
|
||||
&& !defined(MOENCHD) && !defined(MYTHEN3D) && !defined(GOTTHARD2D)*/
|
||||
functionNotImplemented();
|
||||
#else
|
||||
// get only
|
||||
@ -4775,7 +4775,7 @@ int set_read_n_lines(int file_des) {
|
||||
} else {
|
||||
if (setReadNLines(arg) == FAIL) {
|
||||
ret = FAIL;
|
||||
sprintf(mess, "Could not set read n lines.\n");
|
||||
sprintf(mess, "Could not set read n lines to %d.\n", arg);
|
||||
LOG(logERROR, (mess));
|
||||
} else {
|
||||
int retval = getReadNLines();
|
||||
@ -5633,7 +5633,8 @@ int set_readout_mode(int file_des) {
|
||||
if (ret == OK) {
|
||||
if (setReadoutMode(arg) == FAIL) {
|
||||
ret = FAIL;
|
||||
sprintf(mess, "Could not set readout mode\n");
|
||||
sprintf(mess, "Could not set readout mode. Check #samples or "
|
||||
"memory allocation\n");
|
||||
LOG(logERROR, (mess));
|
||||
} else {
|
||||
int retval = getReadoutMode();
|
||||
|
@ -117,6 +117,16 @@ class Detector {
|
||||
/**[Eiger][Mythen3] */
|
||||
void setAllTrimbits(int value, Positions pos = {});
|
||||
|
||||
/**[Eiger][Jungfrau] */
|
||||
bool getGapPixelsinCallback() const;
|
||||
|
||||
/**
|
||||
* [Eiger][Jungfrau]
|
||||
* Only in client data call back
|
||||
* Fills in gap pixels in data
|
||||
*/
|
||||
void setGapPixelsinCallback(const bool enable);
|
||||
|
||||
/**************************************************
|
||||
* *
|
||||
* Callbacks *
|
||||
@ -146,16 +156,6 @@ class Detector {
|
||||
void *),
|
||||
void *pArg);
|
||||
|
||||
/**[Eiger][Jungfrau] */
|
||||
bool getGapPixelsinCallback() const;
|
||||
|
||||
/**
|
||||
* [Eiger][Jungfrau]
|
||||
* Only in client data call back
|
||||
* Fills in gap pixels in data
|
||||
*/
|
||||
void setGapPixelsinCallback(const bool enable);
|
||||
|
||||
/**************************************************
|
||||
* *
|
||||
* Acquisition Parameters *
|
||||
@ -1143,7 +1143,7 @@ class Detector {
|
||||
void setExternalSamplingSource(int value, Positions pos = {});
|
||||
|
||||
/** [CTB] */
|
||||
Result<int> getExternalSampling(Positions pos = {}) const;
|
||||
Result<bool> getExternalSampling(Positions pos = {}) const;
|
||||
|
||||
/** [CTB] */
|
||||
void setExternalSampling(bool value, Positions pos = {});
|
||||
@ -1186,16 +1186,16 @@ class Detector {
|
||||
/** [CTB][Moench][Mythen3] */
|
||||
void savePattern(const std::string &fname);
|
||||
|
||||
/** [CTB][Moench][Mythen3] */
|
||||
/** [CTB][Moench] */
|
||||
Result<uint64_t> getPatternIOControl(Positions pos = {}) const;
|
||||
|
||||
/** [CTB][Moench][Mythen3] */
|
||||
/** [CTB][Moench] */
|
||||
void setPatternIOControl(uint64_t word, Positions pos = {});
|
||||
|
||||
/** [CTB][Moench][Mythen3] */
|
||||
/** [CTB][Moench] */
|
||||
Result<uint64_t> getPatternClockControl(Positions pos = {}) const;
|
||||
|
||||
/** [CTB][Moench][Mythen3] */
|
||||
/** [CTB][Moench] */
|
||||
void setPatternClockControl(uint64_t word, Positions pos = {});
|
||||
|
||||
/** [CTB][Moench][Mythen3] same as executing for ctb and moench */
|
||||
@ -1324,7 +1324,7 @@ class Detector {
|
||||
/** [Jungfrau][CTB][Moench] */
|
||||
void resetFPGA(Positions pos = {});
|
||||
|
||||
/** [Jungfrau][Gotthard][CTB][Moench]
|
||||
/** [Jungfrau][Gotthard][CTB][Moench][Mythen3][Gotthard2]
|
||||
* Copy detector server fname from tftp folder of hostname to detector
|
||||
* Also changes respawn server, which is effective after a reboot.
|
||||
*/
|
||||
|
@ -331,6 +331,37 @@ std::string CmdProxy::DetectorSize(int action) {
|
||||
return os.str();
|
||||
}
|
||||
|
||||
std::string CmdProxy::GapPixels(int action) {
|
||||
std::ostringstream os;
|
||||
os << cmd << ' ';
|
||||
if (action == defs::HELP_ACTION) {
|
||||
os << "[0, 1]\n\t[Eiger][Jungfrau] Include Gap pixels only in data "
|
||||
"call back."
|
||||
<< '\n';
|
||||
} else if (action == defs::GET_ACTION) {
|
||||
if (det_id != -1) {
|
||||
throw sls::RuntimeError("Cannot get gap pixels at module level");
|
||||
}
|
||||
if (!args.empty()) {
|
||||
WrongNumberOfParameters(0);
|
||||
}
|
||||
auto t = det->getGapPixelsinCallback();
|
||||
os << t << '\n';
|
||||
} else if (action == defs::PUT_ACTION) {
|
||||
if (det_id != -1) {
|
||||
throw sls::RuntimeError("Cannot add gap pixels at module level");
|
||||
}
|
||||
if (args.size() != 1) {
|
||||
WrongNumberOfParameters(1);
|
||||
}
|
||||
det->setGapPixelsinCallback(StringTo<int>(args[0]));
|
||||
os << args.front() << '\n';
|
||||
} else {
|
||||
throw sls::RuntimeError("Unknown action");
|
||||
}
|
||||
return os.str();
|
||||
}
|
||||
|
||||
/* acquisition parameters */
|
||||
|
||||
std::string CmdProxy::Exptime(int action) {
|
||||
@ -1224,37 +1255,6 @@ std::string CmdProxy::ThresholdNoTb(int action) {
|
||||
return os.str();
|
||||
}
|
||||
|
||||
std::string CmdProxy::GapPixels(int action) {
|
||||
std::ostringstream os;
|
||||
os << cmd << ' ';
|
||||
if (action == defs::HELP_ACTION) {
|
||||
os << "[0, 1]\n\t[Eiger][Jungfrau] Include Gap pixels only in data "
|
||||
"call back."
|
||||
<< '\n';
|
||||
} else if (action == defs::GET_ACTION) {
|
||||
if (det_id != -1) {
|
||||
throw sls::RuntimeError("Cannot get gap pixels at module level");
|
||||
}
|
||||
if (!args.empty()) {
|
||||
WrongNumberOfParameters(0);
|
||||
}
|
||||
auto t = det->getGapPixelsinCallback();
|
||||
os << t << '\n';
|
||||
} else if (action == defs::PUT_ACTION) {
|
||||
if (det_id != -1) {
|
||||
throw sls::RuntimeError("Cannot add gap pixels at module level");
|
||||
}
|
||||
if (args.size() != 1) {
|
||||
WrongNumberOfParameters(1);
|
||||
}
|
||||
det->setGapPixelsinCallback(StringTo<int>(args[0]));
|
||||
os << args.front() << '\n';
|
||||
} else {
|
||||
throw sls::RuntimeError("Unknown action");
|
||||
}
|
||||
return os.str();
|
||||
}
|
||||
|
||||
std::string CmdProxy::TrimEnergies(int action) {
|
||||
std::ostringstream os;
|
||||
os << cmd << ' ';
|
||||
@ -1271,13 +1271,11 @@ std::string CmdProxy::TrimEnergies(int action) {
|
||||
auto t = det->getTrimEnergies({det_id});
|
||||
os << OutString(t) << '\n';
|
||||
} else if (action == defs::PUT_ACTION) {
|
||||
if (args.empty()) {
|
||||
WrongNumberOfParameters(1);
|
||||
}
|
||||
|
||||
std::vector<int> t(args.size());
|
||||
for (size_t i = 0; i < t.size(); ++i) {
|
||||
t[i] = StringTo<int>(args[i]);
|
||||
if (!args.empty()) {
|
||||
for (size_t i = 0; i < t.size(); ++i) {
|
||||
t[i] = StringTo<int>(args[i]);
|
||||
}
|
||||
}
|
||||
det->setTrimEnergies(t, {det_id});
|
||||
os << sls::ToString(args) << '\n';
|
||||
@ -1529,7 +1527,7 @@ std::string CmdProxy::ROI(int action) {
|
||||
t.xmin = StringTo<int>(args[0]);
|
||||
t.xmax = StringTo<int>(args[1]);
|
||||
det->setROI(t, det_id);
|
||||
os << '[' << t.xmin << ", " << t.xmax << "] \n";
|
||||
os << '[' << t.xmin << ", " << t.xmax << "]\n";
|
||||
} else {
|
||||
throw sls::RuntimeError("Unknown action");
|
||||
}
|
||||
@ -1550,7 +1548,7 @@ std::string CmdProxy::ClearROI(int action) {
|
||||
WrongNumberOfParameters(0);
|
||||
}
|
||||
det->clearROI({det_id});
|
||||
os << "[-1, -1] \n";
|
||||
os << "[-1, -1]\n";
|
||||
} else {
|
||||
throw sls::RuntimeError("Unknown action");
|
||||
}
|
||||
@ -1963,7 +1961,7 @@ std::string CmdProxy::Pattern(int action) {
|
||||
std::ostringstream os;
|
||||
os << cmd << ' ';
|
||||
if (action == defs::HELP_ACTION) {
|
||||
os << "[fname]\n\t[Mythen3][Moench][Ctb][Moench] Loads binary pattern "
|
||||
os << "[fname]\n\t[Mythen3][Moench][Ctb] Loads binary pattern "
|
||||
"file with only pattern "
|
||||
"words"
|
||||
<< '\n';
|
||||
@ -2363,7 +2361,9 @@ std::string CmdProxy::CopyDetectorServer(int action) {
|
||||
std::ostringstream os;
|
||||
os << cmd << ' ';
|
||||
if (action == defs::HELP_ACTION) {
|
||||
os << "[server_name] [pc_host_name]\n\t[Jungfrau][Ctb][Moench] Copies "
|
||||
os << "[server_name] "
|
||||
"[pc_host_name]\n\t[Jungfrau][Ctb][Moench][Mythen3][Gotthard2] "
|
||||
"Copies "
|
||||
"detector "
|
||||
"server via tftp from pc and changes respawn server name in "
|
||||
"/etc/inittab of detector."
|
||||
|
@ -565,6 +565,7 @@ class CmdProxy {
|
||||
{"settings", &CmdProxy::settings},
|
||||
{"trimbits", &CmdProxy::trimbits},
|
||||
{"trimval", &CmdProxy::trimval},
|
||||
{"gappixels", &CmdProxy::GapPixels},
|
||||
|
||||
/* acquisition parameters */
|
||||
{"acquire", &CmdProxy::acquire},
|
||||
@ -754,7 +755,6 @@ class CmdProxy {
|
||||
{"threshold", &CmdProxy::Threshold},
|
||||
{"thresholdnotb", &CmdProxy::ThresholdNoTb},
|
||||
{"settingspath", &CmdProxy::settingspath},
|
||||
{"gappixels", &CmdProxy::GapPixels},
|
||||
{"parallel", &CmdProxy::parallel},
|
||||
{"overflow", &CmdProxy::overflow},
|
||||
{"storeinram", &CmdProxy::storeinram},
|
||||
@ -923,6 +923,7 @@ class CmdProxy {
|
||||
std::string PackageVersion(int action);
|
||||
std::string ClientVersion(int action);
|
||||
std::string DetectorSize(int action);
|
||||
std::string GapPixels(int action);
|
||||
/* acquisition parameters */
|
||||
std::string acquire(int action);
|
||||
std::string Exptime(int action);
|
||||
@ -954,7 +955,6 @@ class CmdProxy {
|
||||
std::string DynamicRange(int action);
|
||||
std::string Threshold(int action);
|
||||
std::string ThresholdNoTb(int action);
|
||||
std::string GapPixels(int action);
|
||||
std::string TrimEnergies(int action);
|
||||
std::string RateCorrection(int action);
|
||||
std::string Activate(int action);
|
||||
@ -2027,12 +2027,12 @@ class CmdProxy {
|
||||
|
||||
INTEGER_COMMAND_HEX(patioctrl, getPatternIOControl, setPatternIOControl,
|
||||
StringTo<uint64_t>,
|
||||
"[64 bit mask]\n\t[Ctb][Moench][Mythen3] 64 bit mask "
|
||||
"[64 bit mask]\n\t[Ctb][Moench] 64 bit mask "
|
||||
"defining input (0) and output (1) signals.");
|
||||
|
||||
INTEGER_COMMAND_HEX(patclkctrl, getPatternClockControl,
|
||||
setPatternClockControl, StringTo<uint64_t>,
|
||||
"[64 bit mask]\n\t[Ctb][Moench][Mythen3] 64 bit mask "
|
||||
"[64 bit mask]\n\t[Ctb][Moench] 64 bit mask "
|
||||
"defining output clock enable.");
|
||||
|
||||
INTEGER_COMMAND_HEX(
|
||||
@ -2081,7 +2081,7 @@ class CmdProxy {
|
||||
|
||||
INTEGER_COMMAND_HEX(
|
||||
adcinvert, getADCInvert, setADCInvert, StringTo<uint32_t>,
|
||||
"[bitmask]\n\t[Ctb][Moench][Jungfrau][Moench] ADC Inversion "
|
||||
"[bitmask]\n\t[Ctb][Moench][Jungfrau] ADC Inversion "
|
||||
"Mask.\n\t[Jungfrau][Moench] Inversions on top of the default mask.");
|
||||
|
||||
/* Insignificant */
|
||||
@ -2104,7 +2104,7 @@ class CmdProxy {
|
||||
"\n\tClient IP Address that last communicated with the detector.");
|
||||
|
||||
GET_COMMAND(nframes, getNumberOfFramesFromStart,
|
||||
"\n\t[Jungfrau][Mythen3][Gotthard2][Moench][CTB][Moench] "
|
||||
"\n\t[Jungfrau][Mythen3][Gotthard2][Moench][CTB] "
|
||||
"Number of frames from start run control."
|
||||
"\n\t[Gotthard2] only in continuous mode.");
|
||||
|
||||
|
@ -161,6 +161,14 @@ void Detector::setAllTrimbits(int value, Positions pos) {
|
||||
pimpl->Parallel(&Module::setAllTrimbits, pos, value);
|
||||
}
|
||||
|
||||
bool Detector::getGapPixelsinCallback() const {
|
||||
return pimpl->getGapPixelsinCallback();
|
||||
}
|
||||
|
||||
void Detector::setGapPixelsinCallback(bool enable) {
|
||||
pimpl->setGapPixelsinCallback(enable);
|
||||
}
|
||||
|
||||
// Callback
|
||||
|
||||
void Detector::registerAcquisitionFinishedCallback(void (*func)(double, int,
|
||||
@ -175,14 +183,6 @@ void Detector::registerDataCallback(void (*func)(detectorData *, uint64_t,
|
||||
pimpl->registerDataCallback(func, pArg);
|
||||
}
|
||||
|
||||
bool Detector::getGapPixelsinCallback() const {
|
||||
return pimpl->getGapPixelsinCallback();
|
||||
}
|
||||
|
||||
void Detector::setGapPixelsinCallback(bool enable) {
|
||||
pimpl->setGapPixelsinCallback(enable);
|
||||
}
|
||||
|
||||
// Acquisition Parameters
|
||||
|
||||
Result<int64_t> Detector::getNumberOfFrames(Positions pos) const {
|
||||
@ -1468,7 +1468,7 @@ void Detector::setExternalSamplingSource(int value, Positions pos) {
|
||||
pimpl->Parallel(&Module::setExternalSamplingSource, pos, value);
|
||||
}
|
||||
|
||||
Result<int> Detector::getExternalSampling(Positions pos) const {
|
||||
Result<bool> Detector::getExternalSampling(Positions pos) const {
|
||||
return pimpl->Parallel(&Module::getExternalSampling, pos);
|
||||
}
|
||||
|
||||
@ -1525,13 +1525,17 @@ void Detector::savePattern(const std::string &fname) {
|
||||
proxy.Call("patword", {addr}, -1, defs::GET_ACTION, outfile);
|
||||
}
|
||||
// rest of pattern file
|
||||
const std::vector<std::string> commands{
|
||||
std::vector<std::string> commands{
|
||||
"patioctrl", "patclkctrl", "patlimits", "patloop0",
|
||||
"patnloop0", "patloop1", "patnloop1", "patloop2",
|
||||
"patnloop2", "patwait0", "patwaittime0", "patwait1",
|
||||
"patwaittime1", "patwait2", "patwaittime2", "patmask",
|
||||
"patsetbit",
|
||||
};
|
||||
auto det_type = getDetectorType().squash();
|
||||
if (det_type == defs::MYTHEN3) {
|
||||
commands.erase(commands.begin(), commands.begin() + 2);
|
||||
}
|
||||
for (const auto &cmd : commands)
|
||||
proxy.Call(cmd, {}, -1, defs::GET_ACTION, outfile);
|
||||
}
|
||||
|
@ -357,7 +357,7 @@ void DetectorImpl::setGapPixelsinCallback(const bool enable) {
|
||||
break;
|
||||
default:
|
||||
throw RuntimeError("Gap Pixels is not implemented for " +
|
||||
multi_shm()->multiDetectorType);
|
||||
ToString(multi_shm()->multiDetectorType));
|
||||
}
|
||||
}
|
||||
multi_shm()->gapPixels = enable;
|
||||
|
@ -1386,11 +1386,15 @@ bool Module::getInterruptSubframe() {
|
||||
|
||||
uint32_t Module::writeRegister(uint32_t addr, uint32_t val) {
|
||||
uint32_t args[]{addr, val};
|
||||
return sendToDetector<uint32_t>(F_WRITE_REGISTER, args);
|
||||
uint32_t retval = -1;
|
||||
sendToDetectorStop(F_WRITE_REGISTER, args, retval);
|
||||
return retval;
|
||||
}
|
||||
|
||||
uint32_t Module::readRegister(uint32_t addr) {
|
||||
return sendToDetector<uint32_t>(F_READ_REGISTER, addr);
|
||||
uint32_t retval = -1;
|
||||
sendToDetectorStop(F_READ_REGISTER, addr, retval);
|
||||
return retval;
|
||||
}
|
||||
|
||||
uint32_t Module::setBit(uint32_t addr, int n) {
|
||||
@ -2197,11 +2201,14 @@ int Module::getExternalSamplingSource() {
|
||||
return setExternalSamplingSource(-1);
|
||||
}
|
||||
|
||||
int Module::setExternalSampling(int value) {
|
||||
return sendToDetector<int>(F_EXTERNAL_SAMPLING, value);
|
||||
void Module::setExternalSampling(bool value) {
|
||||
sendToDetector<int>(F_EXTERNAL_SAMPLING, static_cast<int>(value));
|
||||
}
|
||||
|
||||
int Module::getExternalSampling() { return setExternalSampling(-1); }
|
||||
bool Module::getExternalSampling() {
|
||||
int arg = -1;
|
||||
return sendToDetector<int>(F_EXTERNAL_SAMPLING, arg);
|
||||
}
|
||||
|
||||
void Module::setReceiverDbitList(const std::vector<int> &list) {
|
||||
LOG(logDEBUG1) << "Setting Receiver Dbit List";
|
||||
|
@ -1079,20 +1079,9 @@ class Module : public virtual slsDetectorDefs {
|
||||
*/
|
||||
int getExternalSamplingSource();
|
||||
|
||||
/**
|
||||
* Set external sampling enable (CTB only)
|
||||
* @param value external sampling source (Option: 0-63)
|
||||
* @param detPos -1 for all detectors in list or specific detector position
|
||||
* @returns external sampling enable
|
||||
*/
|
||||
int setExternalSampling(int value);
|
||||
void setExternalSampling(bool value);
|
||||
|
||||
/**
|
||||
* Get external sampling source (CTB only)
|
||||
* @param detPos -1 for all detectors in list or specific detector position
|
||||
* @returns external sampling enable
|
||||
*/
|
||||
int getExternalSampling();
|
||||
bool getExternalSampling();
|
||||
|
||||
/** digital data bits enable (CTB only) */
|
||||
void setReceiverDbitList(const std::vector<int> &list);
|
||||
|
@ -3,6 +3,7 @@ target_sources(tests PRIVATE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test-slsDetector.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test-CmdProxy.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test-CmdProxy-rx.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test-CmdProxy-pattern.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test-CmdProxy-eiger.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test-CmdProxy-jungfrau.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test-CmdProxy-mythen3.cpp
|
||||
|
@ -17,8 +17,7 @@ using test::PUT;
|
||||
|
||||
/* dacs */
|
||||
|
||||
TEST_CASE("Setting and reading back Chip test board dacs",
|
||||
"[.cmd][.dacs][.new]") {
|
||||
TEST_CASE("dac", "[.cmd][.dacs][.new]") {
|
||||
// dac 0 to dac 17
|
||||
|
||||
Detector det;
|
||||
@ -100,3 +99,803 @@ TEST_CASE("Setting and reading back Chip test board dacs",
|
||||
REQUIRE_THROWS(proxy.Call("vcom_adc2", {}, -1, GET));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("adcvpp", "[.cmd][.new]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
|
||||
if (det_type == defs::CHIPTESTBOARD || det_type == defs::MOENCH) {
|
||||
auto prev_val = det.getDAC(defs::ADC_VPP, false);
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("adcvpp", {"1"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "adcvpp 1\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("adcvpp", {"1140", "mv"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "adcvpp 1140 mv\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("adcvpp", {"mv"}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "adcvpp 1140 mv\n");
|
||||
}
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setDAC(defs::ADC_VPP, prev_val[i], false, {i});
|
||||
}
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("adcvpp", {}, -1, GET));
|
||||
}
|
||||
}
|
||||
|
||||
/* CTB/ Moench Specific */
|
||||
|
||||
TEST_CASE("samples", "[.cmd][.new]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
|
||||
if (det_type == defs::CHIPTESTBOARD || det_type == defs::MOENCH) {
|
||||
auto prev_asamples = det.getNumberOfAnalogSamples();
|
||||
sls::Result<int> prev_dsamples = 0;
|
||||
if (det_type == defs::CHIPTESTBOARD) {
|
||||
prev_dsamples = det.getNumberOfDigitalSamples();
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("samples", {"25"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "samples 25\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("samples", {"450"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "samples 450\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("samples", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "samples 450\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("asamples", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "asamples 450\n");
|
||||
}
|
||||
if (det_type == defs::CHIPTESTBOARD) {
|
||||
std::ostringstream oss;
|
||||
proxy.Call("dsamples", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "dsamples 450\n");
|
||||
}
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setNumberOfAnalogSamples(prev_asamples[i], {i});
|
||||
if (det_type == defs::CHIPTESTBOARD) {
|
||||
det.setNumberOfDigitalSamples(prev_dsamples[i], {i});
|
||||
}
|
||||
}
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("samples", {}, -1, GET));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("asamples", "[.cmd][.new]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
|
||||
if (det_type == defs::CHIPTESTBOARD || det_type == defs::MOENCH) {
|
||||
auto prev_val = det.getNumberOfAnalogSamples();
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("asamples", {"25"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "asamples 25\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("asamples", {"450"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "asamples 450\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("asamples", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "asamples 450\n");
|
||||
}
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setNumberOfAnalogSamples(prev_val[i], {i});
|
||||
}
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("asamples", {}, -1, GET));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("adcclk", "[.cmd][.new]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
|
||||
if (det_type == defs::CHIPTESTBOARD || det_type == defs::MOENCH) {
|
||||
auto prev_val = det.getADCClock();
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("adcclk", {"20"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "adcclk 20\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("adcclk", {"10"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "adcclk 10\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("adcclk", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "adcclk 10\n");
|
||||
}
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setADCClock(prev_val[i], {i});
|
||||
}
|
||||
} else {
|
||||
// clock index might work
|
||||
// REQUIRE_THROWS(proxy.Call("adcclk", {}, -1, GET));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("runclk", "[.cmd][.new]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
|
||||
if (det_type == defs::CHIPTESTBOARD || det_type == defs::MOENCH) {
|
||||
auto prev_val = det.getRUNClock();
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("runclk", {"20"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "runclk 20\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("runclk", {"10"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "runclk 10\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("runclk", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "runclk 10\n");
|
||||
}
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setRUNClock(prev_val[i], {i});
|
||||
}
|
||||
} else {
|
||||
// clock index might work
|
||||
// REQUIRE_THROWS(proxy.Call("runclk", {}, -1, GET));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("syncclk", "[.cmd][.new]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
if (det_type == defs::CHIPTESTBOARD || det_type == defs::MOENCH) {
|
||||
REQUIRE_NOTHROW(proxy.Call("syncclk", {}, -1, GET));
|
||||
} else {
|
||||
// clock index might work
|
||||
// REQUIRE_THROWS(proxy.Call("syncclk", {}, -1, GET));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("adcpipeline", "[.cmd][.new]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
|
||||
if (det_type == defs::CHIPTESTBOARD || det_type == defs::MOENCH) {
|
||||
auto prev_val = det.getADCPipeline();
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("adcpipeline", {"1"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "adcpipeline 1\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("adcpipeline", {"0"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "adcpipeline 0\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("adcpipeline", {"15"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "adcpipeline 15\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("adcpipeline", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "adcpipeline 15\n");
|
||||
}
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setADCPipeline(prev_val[i], {i});
|
||||
}
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("adcpipeline", {}, -1, GET));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("v_limit", "[.cmd][.new]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
|
||||
if (det_type == defs::CHIPTESTBOARD || det_type == defs::MOENCH) {
|
||||
auto prev_val = det.getVoltage(defs::V_LIMIT);
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("v_limit", {"1500"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "v_limit 1500\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("v_limit", {"0"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "v_limit 0\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("v_limit", {"0"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "v_limit 0\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("v_limit", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "v_limit 0\n");
|
||||
}
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
if (prev_val[i] == -100) {
|
||||
prev_val[i] = 0;
|
||||
}
|
||||
det.setVoltage(defs::V_LIMIT, prev_val[i], {i});
|
||||
}
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("v_limit", {}, -1, GET));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("adcenable", "[.cmd][.new]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
|
||||
if (det_type == defs::CHIPTESTBOARD || det_type == defs::MOENCH) {
|
||||
auto prev_val = det.getADCEnableMask();
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("adcenable", {"0x8d0aa0d8"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "adcenable 0x8d0aa0d8\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("adcenable", {"0xffffffff"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "adcenable 0xffffffff\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("adcenable", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "adcenable 0xffffffff\n");
|
||||
}
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setADCEnableMask(prev_val[i], {i});
|
||||
}
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("adcenable", {}, -1, GET));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("adcenable10g", "[.cmd][.new]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
|
||||
if (det_type == defs::CHIPTESTBOARD || det_type == defs::MOENCH) {
|
||||
auto prev_val = det.getTenGigaADCEnableMask();
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("adcenable10g", {"0xff0000ff"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "adcenable10g 0xff0000ff\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("adcenable10g", {"0xffffffff"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "adcenable10g 0xffffffff\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("adcenable10g", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "adcenable10g 0xffffffff\n");
|
||||
}
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setTenGigaADCEnableMask(prev_val[i], {i});
|
||||
}
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("adcenable10g", {}, -1, GET));
|
||||
}
|
||||
}
|
||||
|
||||
/* CTB Specific */
|
||||
|
||||
TEST_CASE("dsamples", "[.cmd][.new]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
|
||||
if (det_type == defs::CHIPTESTBOARD) {
|
||||
auto prev_val = det.getNumberOfDigitalSamples();
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("dsamples", {"1"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "dsamples 1\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("dsamples", {"450"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "dsamples 450\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("dsamples", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "dsamples 450\n");
|
||||
}
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setNumberOfDigitalSamples(prev_val[i], {i});
|
||||
}
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("dsamples", {}, -1, GET));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("romode", "[.cmd][.new]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
if (det_type == defs::CHIPTESTBOARD) {
|
||||
auto prev_romode = det.getReadoutMode();
|
||||
auto prev_asamples = det.getNumberOfAnalogSamples();
|
||||
auto prev_dsamples = det.getNumberOfDigitalSamples();
|
||||
det.setNumberOfAnalogSamples(5000);
|
||||
det.setNumberOfDigitalSamples(5000);
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("romode", {"digital"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "romode digital\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("romode", {"analog_digital"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "romode analog_digital\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("romode", {"analog"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "romode analog\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("romode", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "romode analog\n");
|
||||
}
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setReadoutMode(prev_romode[i], {i});
|
||||
det.setNumberOfAnalogSamples(prev_asamples[i], {i});
|
||||
det.setNumberOfDigitalSamples(prev_dsamples[i], {i});
|
||||
}
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("romode", {}, -1, GET));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("dbitclk", "[.cmd][.new]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
|
||||
if (det_type == defs::CHIPTESTBOARD) {
|
||||
auto prev_val = det.getRUNClock();
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("dbitclk", {"20"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "dbitclk 20\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("dbitclk", {"10"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "dbitclk 10\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("dbitclk", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "dbitclk 10\n");
|
||||
}
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setRUNClock(prev_val[i], {i});
|
||||
}
|
||||
} else {
|
||||
// clock index might work
|
||||
// REQUIRE_THROWS(proxy.Call("dbitclk", {}, -1, GET));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("dbitpipeline", "[.cmd][.new]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
|
||||
if (det_type == defs::CHIPTESTBOARD) {
|
||||
auto prev_val = det.getDBITPipeline();
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("dbitpipeline", {"1"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "dbitpipeline 1\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("dbitpipeline", {"0"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "dbitpipeline 0\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("dbitpipeline", {"15"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "dbitpipeline 15\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("dbitpipeline", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "dbitpipeline 15\n");
|
||||
}
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setDBITPipeline(prev_val[i], {i});
|
||||
}
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("dbitpipeline", {}, -1, GET));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("v_a", "[.cmd][.new]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
if (det_type == defs::CHIPTESTBOARD) {
|
||||
auto prev_val = det.getVoltage(defs::V_POWER_A);
|
||||
{
|
||||
std::ostringstream oss1, oss2;
|
||||
proxy.Call("v_a", {"700"}, -1, PUT, oss1);
|
||||
REQUIRE(oss1.str() == "v_a 700\n");
|
||||
proxy.Call("v_a", {}, -1, GET, oss2);
|
||||
REQUIRE(oss2.str() == "v_a 700\n");
|
||||
}
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setVoltage(defs::V_POWER_A, prev_val[i], {i});
|
||||
}
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("v_a", {}, -1, GET));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("v_b", "[.cmd][.new]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
if (det_type == defs::CHIPTESTBOARD) {
|
||||
auto prev_val = det.getVoltage(defs::V_POWER_B);
|
||||
{
|
||||
std::ostringstream oss1, oss2;
|
||||
proxy.Call("v_b", {"700"}, -1, PUT, oss1);
|
||||
REQUIRE(oss1.str() == "v_b 700\n");
|
||||
proxy.Call("v_b", {}, -1, GET, oss2);
|
||||
REQUIRE(oss2.str() == "v_b 700\n");
|
||||
}
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setVoltage(defs::V_POWER_B, prev_val[i], {i});
|
||||
}
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("v_b", {}, -1, GET));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("v_c", "[.cmd][.new]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
if (det_type == defs::CHIPTESTBOARD) {
|
||||
auto prev_val = det.getVoltage(defs::V_POWER_C);
|
||||
{
|
||||
std::ostringstream oss1, oss2;
|
||||
proxy.Call("v_c", {"700"}, -1, PUT, oss1);
|
||||
REQUIRE(oss1.str() == "v_c 700\n");
|
||||
proxy.Call("v_c", {}, -1, GET, oss2);
|
||||
REQUIRE(oss2.str() == "v_c 700\n");
|
||||
}
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setVoltage(defs::V_POWER_C, prev_val[i], {i});
|
||||
}
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("v_c", {}, -1, GET));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("v_d", "[.cmd][.new]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
if (det_type == defs::CHIPTESTBOARD) {
|
||||
auto prev_val = det.getVoltage(defs::V_POWER_D);
|
||||
{
|
||||
std::ostringstream oss1, oss2;
|
||||
proxy.Call("v_d", {"700"}, -1, PUT, oss1);
|
||||
REQUIRE(oss1.str() == "v_d 700\n");
|
||||
proxy.Call("v_d", {}, -1, GET, oss2);
|
||||
REQUIRE(oss2.str() == "v_d 700\n");
|
||||
}
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setVoltage(defs::V_POWER_D, prev_val[i], {i});
|
||||
}
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("v_d", {}, -1, GET));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("v_io", "[.cmd][.new]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
if (det_type == defs::CHIPTESTBOARD) {
|
||||
// better not to play with setting it
|
||||
REQUIRE_NOTHROW(proxy.Call("v_io", {}, -1, GET));
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("v_io", {}, -1, GET));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("v_chip", "[.cmd][.new]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
if (det_type == defs::CHIPTESTBOARD) {
|
||||
// better not to play with setting it
|
||||
REQUIRE_NOTHROW(proxy.Call("v_chip", {}, -1, GET));
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("v_chip", {}, -1, GET));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("vm_a", "[.cmd][.new]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
if (det_type == defs::CHIPTESTBOARD) {
|
||||
REQUIRE_NOTHROW(proxy.Call("vm_a", {}, -1, GET));
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("vm_a", {}, -1, GET));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("vm_b", "[.cmd][.new]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
if (det_type == defs::CHIPTESTBOARD) {
|
||||
REQUIRE_NOTHROW(proxy.Call("vm_b", {}, -1, GET));
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("vm_b", {}, -1, GET));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("vm_c", "[.cmd][.new]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
if (det_type == defs::CHIPTESTBOARD) {
|
||||
REQUIRE_NOTHROW(proxy.Call("vm_c", {}, -1, GET));
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("vm_c", {}, -1, GET));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("vm_d", "[.cmd][.new]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
if (det_type == defs::CHIPTESTBOARD) {
|
||||
REQUIRE_NOTHROW(proxy.Call("vm_d", {}, -1, GET));
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("vm_d", {}, -1, GET));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("vm_io", "[.cmd][.new]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
if (det_type == defs::CHIPTESTBOARD) {
|
||||
REQUIRE_NOTHROW(proxy.Call("vm_io", {}, -1, GET));
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("vm_io", {}, -1, GET));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("im_a", "[.cmd][.new]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
if (det_type == defs::CHIPTESTBOARD) {
|
||||
REQUIRE_NOTHROW(proxy.Call("im_a", {}, -1, GET));
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("im_a", {}, -1, GET));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("im_b", "[.cmd][.new]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
if (det_type == defs::CHIPTESTBOARD) {
|
||||
REQUIRE_NOTHROW(proxy.Call("im_b", {}, -1, GET));
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("im_b", {}, -1, GET));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("im_c", "[.cmd][.new]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
if (det_type == defs::CHIPTESTBOARD) {
|
||||
REQUIRE_NOTHROW(proxy.Call("im_c", {}, -1, GET));
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("im_c", {}, -1, GET));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("im_d", "[.cmd][.new]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
if (det_type == defs::CHIPTESTBOARD) {
|
||||
REQUIRE_NOTHROW(proxy.Call("im_d", {}, -1, GET));
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("im_d", {}, -1, GET));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("im_io", "[.cmd][.new]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
if (det_type == defs::CHIPTESTBOARD) {
|
||||
REQUIRE_NOTHROW(proxy.Call("im_io", {}, -1, GET));
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("im_io", {}, -1, GET));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("adc", "[.cmd][.new]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
if (det_type == defs::CHIPTESTBOARD) {
|
||||
for (int i = 0; i <= 8; ++i) {
|
||||
REQUIRE_NOTHROW(proxy.Call("adc", {std::to_string(i)}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("adc", {"0"}, -1, PUT));
|
||||
}
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("adc", {"0"}, -1, GET));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("extsampling", "[.cmd][.new]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
|
||||
if (det_type == defs::CHIPTESTBOARD) {
|
||||
auto prev_val = det.getExternalSampling();
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("extsampling", {"1"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "extsampling 1\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("extsampling", {"0"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "extsampling 0\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("extsampling", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "extsampling 0\n");
|
||||
}
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setExternalSampling(prev_val[i], {i});
|
||||
}
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("extsampling", {}, -1, GET));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("extsamplingsrc", "[.cmd][.new]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
|
||||
if (det_type == defs::CHIPTESTBOARD) {
|
||||
auto prev_val = det.getExternalSamplingSource();
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("extsamplingsrc", {"63"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "extsamplingsrc 63\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("extsamplingsrc", {"0"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "extsamplingsrc 0\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("extsamplingsrc", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "extsamplingsrc 0\n");
|
||||
}
|
||||
REQUIRE_THROWS(proxy.Call("extsamplingsrc", {"64"}, -1, PUT));
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setExternalSamplingSource(prev_val[i], {i});
|
||||
}
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("extsamplingsrc", {}, -1, GET));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("diodelay", "[.cmd][.new]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
|
||||
if (det_type == defs::CHIPTESTBOARD) {
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("diodelay", {"0x01010", "0"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "diodelay [0x01010, 0]\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("diodelay", {"0x01010", "775"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "diodelay [0x01010, 775]\n");
|
||||
}
|
||||
REQUIRE_THROWS(proxy.Call("diodelay", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("diodelay", {"0x01010", "776"}, -1, GET));
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("diodelay", {"0x01010", "775"}, -1, PUT));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("led", "[.cmd][.new]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
|
||||
if (det_type == defs::CHIPTESTBOARD) {
|
||||
auto prev_val = det.getLEDEnable();
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("led", {"1"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "led 1\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("led", {"0"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "led 0\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("led", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "led 0\n");
|
||||
}
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setLEDEnable(prev_val[i], {i});
|
||||
}
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("led", {}, -1, GET));
|
||||
}
|
||||
}
|
@ -4,6 +4,7 @@
|
||||
#include "sls_detector_defs.h"
|
||||
#include <array>
|
||||
#include <sstream>
|
||||
#include <thread>
|
||||
|
||||
#include "test-CmdProxy-global.h"
|
||||
#include "tests/globals.h"
|
||||
@ -242,8 +243,14 @@ TEST_CASE("trigger", "[.cmd][.new]") {
|
||||
det.getTimingMode().tsquash("inconsistent timing mode in test");
|
||||
auto prev_frames =
|
||||
det.getNumberOfFrames().tsquash("inconsistent #frames in test");
|
||||
auto prev_exptime =
|
||||
det.getExptime().tsquash("inconsistent exptime in test");
|
||||
auto prev_period =
|
||||
det.getPeriod().tsquash("inconsistent period in test");
|
||||
det.setTimingMode(defs::TRIGGER_EXPOSURE);
|
||||
det.setNumberOfFrames(1);
|
||||
det.setExptime(std::chrono::milliseconds(1));
|
||||
det.setPeriod(std::chrono::milliseconds(1));
|
||||
auto startingfnum = det.getStartingFrameNumber().tsquash(
|
||||
"inconsistent frame nr in test");
|
||||
det.startDetector();
|
||||
@ -252,6 +259,7 @@ TEST_CASE("trigger", "[.cmd][.new]") {
|
||||
proxy.Call("trigger", {}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "trigger successful\n");
|
||||
}
|
||||
std::this_thread::sleep_for(std::chrono::seconds(2));
|
||||
auto currentfnum = det.getStartingFrameNumber().tsquash(
|
||||
"inconsistent frame nr in test");
|
||||
REQUIRE(startingfnum + 1 == currentfnum);
|
||||
@ -263,52 +271,55 @@ TEST_CASE("trigger", "[.cmd][.new]") {
|
||||
|
||||
/* Network Configuration (Detector<->Receiver) */
|
||||
|
||||
TEST_CASE("Eiger transmission delay", "[.cmd]") {
|
||||
TEST_CASE("txndelay_left", "[.cmd][.new]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
auto frame = det.getTransmissionDelayFrame();
|
||||
auto left = det.getTransmissionDelayLeft();
|
||||
auto right = det.getTransmissionDelayRight();
|
||||
if (det_type == defs::EIGER) {
|
||||
SECTION("txndelay_frame") {
|
||||
std::ostringstream oss1, oss2;
|
||||
proxy.Call("txndelay_frame", {"5000"}, -1, PUT, oss1);
|
||||
REQUIRE(oss1.str() == "txndelay_frame 5000\n");
|
||||
proxy.Call("txndelay_frame", {}, -1, GET, oss2);
|
||||
REQUIRE(oss2.str() == "txndelay_frame 5000\n");
|
||||
}
|
||||
SECTION("txndelay_left") {
|
||||
auto prev_val = det.getTransmissionDelayLeft();
|
||||
{
|
||||
std::ostringstream oss1, oss2;
|
||||
proxy.Call("txndelay_left", {"5000"}, -1, PUT, oss1);
|
||||
REQUIRE(oss1.str() == "txndelay_left 5000\n");
|
||||
proxy.Call("txndelay_left", {}, -1, GET, oss2);
|
||||
REQUIRE(oss2.str() == "txndelay_left 5000\n");
|
||||
}
|
||||
SECTION("txndelay_right") {
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setTransmissionDelayLeft(prev_val[i]);
|
||||
}
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("txndelay_left", {}, -1, GET));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("txndelay_right", "[.cmd][.new]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
if (det_type == defs::EIGER) {
|
||||
auto prev_val = det.getTransmissionDelayRight();
|
||||
{
|
||||
std::ostringstream oss1, oss2;
|
||||
proxy.Call("txndelay_right", {"5000"}, -1, PUT, oss1);
|
||||
REQUIRE(oss1.str() == "txndelay_right 5000\n");
|
||||
proxy.Call("txndelay_right", {}, -1, GET, oss2);
|
||||
REQUIRE(oss2.str() == "txndelay_right 5000\n");
|
||||
}
|
||||
|
||||
// Reset to previous values
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setTransmissionDelayFrame(frame[i]);
|
||||
det.setTransmissionDelayLeft(left[i]);
|
||||
det.setTransmissionDelayRight(right[i]);
|
||||
det.setTransmissionDelayRight(prev_val[i]);
|
||||
}
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("txndelay_right", {}, -1, GET));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("dr", "[.cmd]") {
|
||||
/* Eiger Specific */
|
||||
|
||||
TEST_CASE("dr", "[.cmd][.new]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
if (det_type == defs::EIGER) {
|
||||
// The only detector currently supporting setting dr
|
||||
// is EIGER?
|
||||
auto dr = det.getDynamicRange().squash();
|
||||
std::array<int, 4> vals{4, 8, 16, 32};
|
||||
for (const auto val : vals) {
|
||||
@ -319,6 +330,17 @@ TEST_CASE("dr", "[.cmd]") {
|
||||
REQUIRE(oss2.str() == "dr " + std::to_string(val) + '\n');
|
||||
}
|
||||
det.setDynamicRange(dr);
|
||||
} else if (det_type == defs::MYTHEN3) {
|
||||
// not updated in firmware to support anything other than 32 at the
|
||||
// moment
|
||||
std::ostringstream oss1, oss2;
|
||||
proxy.Call("dr", {"32"}, -1, PUT, oss1);
|
||||
REQUIRE(oss1.str() == "dr 32\n");
|
||||
proxy.Call("dr", {"32"}, -1, PUT, oss2);
|
||||
REQUIRE(oss2.str() == "dr 32\n");
|
||||
REQUIRE_THROWS(proxy.Call("dr", {"4"}, -1, PUT));
|
||||
REQUIRE_THROWS(proxy.Call("dr", {"8"}, -1, PUT));
|
||||
REQUIRE_THROWS(proxy.Call("dr", {"16"}, -1, PUT));
|
||||
} else {
|
||||
// For the other detectors we should get an error message
|
||||
// except for dr 16
|
||||
@ -334,124 +356,7 @@ TEST_CASE("dr", "[.cmd]") {
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("interruptsubframe", "[.cmd][!mayfail]") {
|
||||
// TODO! Fix this for virtual server
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
if (det_type == defs::EIGER) {
|
||||
auto previous = det.getInterruptSubframe();
|
||||
|
||||
std::ostringstream oss1, oss2, oss3;
|
||||
proxy.Call("interruptsubframe", {"1"}, -1, PUT, oss1);
|
||||
REQUIRE(oss1.str() == "interruptsubframe 1\n");
|
||||
proxy.Call("interruptsubframe", {}, -1, GET, oss2);
|
||||
REQUIRE(oss2.str() == "interruptsubframe 1\n");
|
||||
proxy.Call("interruptsubframe", {"0"}, -1, PUT, oss3);
|
||||
REQUIRE(oss3.str() == "interruptsubframe 0\n");
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setInterruptSubframe(previous[i], {i});
|
||||
}
|
||||
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("interruptsubframe", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("interruptsubframe", {"1"}, -1, PUT));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("overflow", "[.cmd]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
if (det_type == defs::EIGER) {
|
||||
auto previous = det.getOverFlowMode();
|
||||
|
||||
std::ostringstream oss1, oss2, oss3;
|
||||
proxy.Call("overflow", {"1"}, -1, PUT, oss1);
|
||||
REQUIRE(oss1.str() == "overflow 1\n");
|
||||
proxy.Call("overflow", {}, -1, GET, oss2);
|
||||
REQUIRE(oss2.str() == "overflow 1\n");
|
||||
proxy.Call("overflow", {"0"}, -1, PUT, oss3);
|
||||
REQUIRE(oss3.str() == "overflow 0\n");
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setOverFlowMode(previous[i], {i});
|
||||
}
|
||||
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("overflow", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("overflow", {"1"}, -1, PUT));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("trimen", "[.cmd][.this]") {
|
||||
// TODO! Also Mythen?
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
if (det_type == defs::EIGER) {
|
||||
|
||||
auto previous = det.getTrimEnergies();
|
||||
std::ostringstream oss1, oss2;
|
||||
proxy.Call("trimen", {"4500", "5400", "6400"}, -1, PUT, oss1);
|
||||
REQUIRE(oss1.str() == "trimen [4500, 5400, 6400]\n");
|
||||
proxy.Call("trimen", {}, -1, GET, oss2);
|
||||
REQUIRE(oss2.str() == "trimen [4500, 5400, 6400]\n");
|
||||
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setTrimEnergies(previous[i], {i});
|
||||
}
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("trimen", {"4500", "5400", "6400"}, -1, PUT));
|
||||
REQUIRE_THROWS(proxy.Call("trimen", {}, -1, GET));
|
||||
}
|
||||
}
|
||||
|
||||
// TEST_CASE("threshold"{
|
||||
|
||||
// })
|
||||
|
||||
// TEST_CASE("activate", "[.cmd][.eiger]") {
|
||||
// if (test::type == slsDetectorDefs::EIGER) {
|
||||
// {
|
||||
// std::ostringstream oss;
|
||||
// REQUIRE_NOTHROW(multiSlsDetectorClient("0:activate 1", PUT,
|
||||
// nullptr, oss)); REQUIRE(oss.str() == "activate 1\n");
|
||||
// }
|
||||
// {
|
||||
// std::ostringstream oss;
|
||||
// REQUIRE_NOTHROW(multiSlsDetectorClient("0:activate 1 nopadding",
|
||||
// PUT, nullptr, oss)); REQUIRE(oss.str() == "activate 1
|
||||
// nopadding\n");
|
||||
// }
|
||||
// {
|
||||
// std::ostringstream oss;
|
||||
// REQUIRE_NOTHROW(multiSlsDetectorClient("0:activate 0 padding",
|
||||
// PUT, nullptr, oss)); REQUIRE(oss.str() == "activate 0
|
||||
// padding\n");
|
||||
// }
|
||||
// {
|
||||
// std::ostringstream oss;
|
||||
// REQUIRE_NOTHROW(multiSlsDetectorClient("0:activate 0 nopadding",
|
||||
// PUT, nullptr, oss)); REQUIRE(oss.str() == "activate 0
|
||||
// nopadding\n");
|
||||
// }
|
||||
// {
|
||||
// std::ostringstream oss;
|
||||
// REQUIRE_NOTHROW(multiSlsDetectorClient("0:activate 1 padding",
|
||||
// PUT, nullptr, oss)); REQUIRE(oss.str() == "activate 1
|
||||
// padding\n");
|
||||
// }
|
||||
// {
|
||||
// std::ostringstream oss;
|
||||
// REQUIRE_NOTHROW(multiSlsDetectorClient("0:activate", GET,
|
||||
// nullptr, oss)); REQUIRE(oss.str() == "activate 1 padding\n");
|
||||
// }
|
||||
// } else {
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("activate", GET));
|
||||
// }
|
||||
// }
|
||||
|
||||
TEST_CASE("subexptime", "[.cmd]") {
|
||||
TEST_CASE("subexptime", "[.cmd][.new]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
|
||||
@ -472,7 +377,7 @@ TEST_CASE("subexptime", "[.cmd]") {
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("subdeadtime", "[.cmd]") {
|
||||
TEST_CASE("subdeadtime", "[.cmd][.new]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
|
||||
@ -493,37 +398,468 @@ TEST_CASE("subdeadtime", "[.cmd]") {
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("tengiga", "[.cmd]") {
|
||||
TEST_CASE("threshold", "[.cmd][.new]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
if (det_type == defs::EIGER || det_type == defs::CHIPTESTBOARD) {
|
||||
auto tengiga = det.getTenGiga();
|
||||
det.setTenGiga(false);
|
||||
|
||||
std::ostringstream oss1, oss2;
|
||||
proxy.Call("tengiga", {"1"}, -1, PUT, oss1);
|
||||
REQUIRE(oss1.str() == "tengiga 1\n");
|
||||
proxy.Call("tengiga", {}, -1, GET, oss2);
|
||||
REQUIRE(oss2.str() == "tengiga 1\n");
|
||||
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setTenGiga(tengiga[i], {i});
|
||||
if (det_type == defs::EIGER) {
|
||||
auto prev_threshold = det.getThresholdEnergy();
|
||||
auto prev_energies =
|
||||
det.getTrimEnergies().tsquash("inconsistent trim energies to test");
|
||||
if (prev_energies.size() != 0) {
|
||||
std::ostringstream oss1, oss2;
|
||||
proxy.Call("threshold", {"4500", "standard"}, -1, PUT, oss1);
|
||||
REQUIRE(oss1.str() == "threshold [4500, standard]\n");
|
||||
proxy.Call("threshold", {}, -1, GET, oss2);
|
||||
REQUIRE(oss2.str() == "threshold 4500\n");
|
||||
det.setTrimEnergies(prev_energies);
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
if (prev_threshold[i] >= 0) {
|
||||
det.setThresholdEnergy(prev_threshold[i], defs::STANDARD,
|
||||
true, {i});
|
||||
}
|
||||
}
|
||||
}
|
||||
REQUIRE_NOTHROW(proxy.Call("threshold", {}, -1, GET));
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("threshold", {}, -1, GET));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("quad", "[.cmd]") {
|
||||
// TODO! set and get once available in virtual detector
|
||||
TEST_CASE("thresholdnotb", "[.cmd][.new]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
if (det_type == defs::EIGER) {
|
||||
auto prev_threshold = det.getThresholdEnergy();
|
||||
auto prev_energies =
|
||||
det.getTrimEnergies().tsquash("inconsistent trim energies to test");
|
||||
if (prev_energies.size() != 0) {
|
||||
std::ostringstream oss1, oss2;
|
||||
proxy.Call("thresholdnotb", {"4500 standard"}, -1, PUT, oss1);
|
||||
REQUIRE(oss1.str() == "thresholdnotb [4500 standard]\n");
|
||||
proxy.Call("threshold", {}, -1, GET, oss2);
|
||||
REQUIRE(oss2.str() == "threshold 4500\n");
|
||||
det.setTrimEnergies(prev_energies);
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
if (prev_threshold[i] >= 0) {
|
||||
det.setThresholdEnergy(prev_threshold[i], defs::STANDARD,
|
||||
false, {i});
|
||||
}
|
||||
}
|
||||
}
|
||||
REQUIRE_NOTHROW(proxy.Call("threshold", {}, -1, GET));
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("thresholdnotb", {}, -1, GET));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("settingspath", "[.cmd][.new]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto prev_val = det.getSettingsPath();
|
||||
{
|
||||
std::ostringstream oss1, oss2;
|
||||
proxy.Call("settingspath", {"/tmp"}, -1, PUT, oss1);
|
||||
REQUIRE(oss1.str() == "settingspath /tmp\n");
|
||||
proxy.Call("settingspath", {}, -1, GET, oss2);
|
||||
REQUIRE(oss2.str() == "settingspath /tmp\n");
|
||||
}
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setSettingsPath(prev_val[i], {i});
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("parallel", "[.cmd][.new]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
|
||||
if (det_type == defs::EIGER) {
|
||||
auto prev_val = det.getParallelMode();
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("parallel", {"1"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "parallel 1\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("parallel", {"0"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "parallel 0\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("parallel", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "parallel 0\n");
|
||||
}
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setParallelMode(prev_val[i], {i});
|
||||
}
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("parallel", {}, -1, GET));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("overflow", "[.cmd][.new]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
if (det_type == defs::EIGER) {
|
||||
auto previous = det.getOverFlowMode();
|
||||
std::ostringstream oss1, oss2, oss3;
|
||||
proxy.Call("overflow", {"1"}, -1, PUT, oss1);
|
||||
REQUIRE(oss1.str() == "overflow 1\n");
|
||||
proxy.Call("overflow", {}, -1, GET, oss2);
|
||||
REQUIRE(oss2.str() == "overflow 1\n");
|
||||
proxy.Call("overflow", {"0"}, -1, PUT, oss3);
|
||||
REQUIRE(oss3.str() == "overflow 0\n");
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setOverFlowMode(previous[i], {i});
|
||||
}
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("overflow", {}, -1, GET));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("storeinram", "[.cmd][.new]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
if (det_type == defs::EIGER) {
|
||||
auto previous = det.getStoreInRamMode();
|
||||
std::ostringstream oss1, oss2, oss3;
|
||||
proxy.Call("storeinram", {"1"}, -1, PUT, oss1);
|
||||
REQUIRE(oss1.str() == "storeinram 1\n");
|
||||
proxy.Call("storeinram", {}, -1, GET, oss2);
|
||||
REQUIRE(oss2.str() == "storeinram 1\n");
|
||||
proxy.Call("storeinram", {"0"}, -1, PUT, oss3);
|
||||
REQUIRE(oss3.str() == "storeinram 0\n");
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setStoreInRamMode(previous[i], {i});
|
||||
}
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("storeinram", {}, -1, GET));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("flippeddatax", "[.cmd][.new]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
if (det_type == defs::EIGER) {
|
||||
auto previous = det.getBottom();
|
||||
std::ostringstream oss1, oss2, oss3;
|
||||
proxy.Call("flippeddatax", {"1"}, -1, PUT, oss1);
|
||||
REQUIRE(oss1.str() == "flippeddatax 1\n");
|
||||
proxy.Call("flippeddatax", {}, -1, GET, oss2);
|
||||
REQUIRE(oss2.str() == "flippeddatax 1\n");
|
||||
proxy.Call("flippeddatax", {"0"}, -1, PUT, oss3);
|
||||
REQUIRE(oss3.str() == "flippeddatax 0\n");
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setBottom(previous[i], {i});
|
||||
}
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("flippeddatax", {}, -1, GET));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("trimen", "[.cmd][.this][.new]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
if (det_type == defs::EIGER) {
|
||||
auto previous = det.getTrimEnergies();
|
||||
std::ostringstream oss1, oss2;
|
||||
proxy.Call("trimen", {"4500", "5400", "6400"}, -1, PUT, oss1);
|
||||
REQUIRE(oss1.str() == "trimen [4500, 5400, 6400]\n");
|
||||
proxy.Call("trimen", {}, -1, GET, oss2);
|
||||
REQUIRE(oss2.str() == "trimen [4500, 5400, 6400]\n");
|
||||
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setTrimEnergies(previous[i], {i});
|
||||
}
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("trimen", {"4500", "5400", "6400"}, -1, PUT));
|
||||
REQUIRE_THROWS(proxy.Call("trimen", {}, -1, GET));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("ratecorr", "[.cmd][.new]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
if (det_type == defs::EIGER) {
|
||||
auto prev_dr = det.getDynamicRange().tsquash("inconsistent dr to test");
|
||||
auto prev_tau = det.getRateCorrection();
|
||||
det.setDynamicRange(16);
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("ratecorr", {"120"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "ratecorr 120ns\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("ratecorr", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "ratecorr 120ns\n");
|
||||
}
|
||||
// may fail if default settings not loaded
|
||||
// REQUIRE_NOTHROW(proxy.Call("ratecorr", {"-1"}, -1, PUT));
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("ratecorr", {"0"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "ratecorr 0ns\n");
|
||||
}
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setRateCorrection(prev_tau[i], {i});
|
||||
}
|
||||
det.setDynamicRange(prev_dr);
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("ratecorr", {}, -1, GET));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("readnlines", "[.cmd][.new]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
if (det_type == defs::EIGER) {
|
||||
auto prev_val = det.getPartialReadout();
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("readnlines", {"256"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "readnlines 256\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("readnlines", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "readnlines 256\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("readnlines", {"16"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "readnlines 16\n");
|
||||
}
|
||||
REQUIRE_THROWS(proxy.Call("readnlines", {"0"}, -1, PUT));
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setPartialReadout(prev_val[i], {i});
|
||||
}
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("readnlines", {}, -1, GET));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("interruptsubframe", "[.cmd][.new]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
if (det_type == defs::EIGER) {
|
||||
auto prev_val = det.getInterruptSubframe();
|
||||
|
||||
std::ostringstream oss1, oss2, oss3;
|
||||
proxy.Call("interruptsubframe", {"1"}, -1, PUT, oss1);
|
||||
REQUIRE(oss1.str() == "interruptsubframe 1\n");
|
||||
proxy.Call("interruptsubframe", {}, -1, GET, oss2);
|
||||
REQUIRE(oss2.str() == "interruptsubframe 1\n");
|
||||
proxy.Call("interruptsubframe", {"0"}, -1, PUT, oss3);
|
||||
REQUIRE(oss3.str() == "interruptsubframe 0\n");
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setInterruptSubframe(prev_val[i], {i});
|
||||
}
|
||||
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("interruptsubframe", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("interruptsubframe", {"1"}, -1, PUT));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("measuredperiod", "[.cmd][.new]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
if (det_type == defs::EIGER) {
|
||||
auto prev_frames = det.getNumberOfFrames().tsquash(
|
||||
"inconsistent number of frames to test");
|
||||
auto prev_timing =
|
||||
det.getTimingMode().tsquash("inconsistent timing mode to test");
|
||||
auto prev_period = det.getPeriod();
|
||||
det.setNumberOfFrames(2);
|
||||
det.setPeriod(std::chrono::seconds(1));
|
||||
det.setTimingMode(defs::AUTO_TIMING);
|
||||
det.startDetector();
|
||||
std::this_thread::sleep_for(std::chrono::seconds(3));
|
||||
std::ostringstream oss;
|
||||
proxy.Call("measuredperiod", {}, -1, GET, oss);
|
||||
std::string st = oss.str();
|
||||
std::string s = st.erase(0, strlen("measuredperiod "));
|
||||
double val = std::stod(s);
|
||||
// REQUIRE(val >= 1.0);
|
||||
REQUIRE(val < 2.0);
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setPeriod(prev_period[i], {i});
|
||||
}
|
||||
det.setNumberOfFrames(prev_frames);
|
||||
det.setTimingMode(prev_timing);
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("measuredperiod", {}, -1, GET));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("measuredsubperiod", "[.cmd][.new]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
if (det_type == defs::EIGER) {
|
||||
auto prev_frames = det.getNumberOfFrames().tsquash(
|
||||
"inconsistent number of frames to test");
|
||||
auto prev_timing =
|
||||
det.getTimingMode().tsquash("inconsistent timing mode to test");
|
||||
auto prev_period = det.getPeriod();
|
||||
auto prev_dr = det.getDynamicRange().tsquash("inconsistent dr to test");
|
||||
det.setNumberOfFrames(1);
|
||||
det.setPeriod(std::chrono::seconds(1));
|
||||
det.setTimingMode(defs::AUTO_TIMING);
|
||||
det.setDynamicRange(32);
|
||||
det.startDetector();
|
||||
std::this_thread::sleep_for(std::chrono::seconds(3));
|
||||
std::ostringstream oss;
|
||||
proxy.Call("measuredsubperiod", {}, -1, GET, oss);
|
||||
std::string st = oss.str();
|
||||
std::string s = st.erase(0, strlen("measuredsubperiod "));
|
||||
double val = std::stod(s);
|
||||
REQUIRE(val >= 0);
|
||||
REQUIRE(val < 1000);
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setPeriod(prev_period[i], {i});
|
||||
}
|
||||
det.setNumberOfFrames(prev_frames);
|
||||
det.setTimingMode(prev_timing);
|
||||
det.setDynamicRange(prev_dr);
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("measuredsubperiod", {}, -1, GET));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("activate", "[.cmd][.new]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
if (det_type == defs::EIGER) {
|
||||
auto prev_val = det.getActive();
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("activate", {"1"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "activate 1\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("activate", {"1", "nopadding"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "activate 1 nopadding\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("activate", {"0", "padding"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "activate 0 padding\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("activate", {"0", "nopadding"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "activate 0 nopadding\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("activate", {"1", "padding"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "activate 1 padding\n");
|
||||
}
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setActive(prev_val[i], {i});
|
||||
}
|
||||
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("activate", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("activate", {"1"}, -1, PUT));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("partialreset", "[.cmd][.new]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
if (det_type == defs::EIGER) {
|
||||
auto prev_val = det.getPartialReset();
|
||||
std::ostringstream oss1, oss2, oss3;
|
||||
proxy.Call("partialreset", {"1"}, -1, PUT, oss1);
|
||||
REQUIRE(oss1.str() == "partialreset 1\n");
|
||||
proxy.Call("partialreset", {}, -1, GET, oss2);
|
||||
REQUIRE(oss2.str() == "partialreset 1\n");
|
||||
proxy.Call("partialreset", {"0"}, -1, PUT, oss3);
|
||||
REQUIRE(oss3.str() == "partialreset 0\n");
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setPartialReset(prev_val[i], {i});
|
||||
}
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("partialreset", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("partialreset", {"1"}, -1, PUT));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("pulse", "[.cmd][.new]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
if (det_type == defs::EIGER) {
|
||||
REQUIRE_THROWS(proxy.Call("pulse", {}, -1, GET));
|
||||
std::ostringstream oss;
|
||||
proxy.Call("pulse", {"1", "1", "5"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "pulse [1, 1, 5]\n");
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("pulse", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("pulse", {"1", "1", "5"}, -1, PUT));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("pulsenmove", "[.cmd][.new]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
if (det_type == defs::EIGER) {
|
||||
REQUIRE_THROWS(proxy.Call("pulsenmove", {}, -1, GET));
|
||||
std::ostringstream oss;
|
||||
proxy.Call("pulsenmove", {"1", "1", "5"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "pulsenmove [1, 1, 5]\n");
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("pulsenmove", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("pulsenmove", {"1", "1", "5"}, -1, PUT));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("pulsechip", "[.cmd][.new]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
if (det_type == defs::EIGER) {
|
||||
REQUIRE_THROWS(proxy.Call("pulsechip", {}, -1, GET));
|
||||
std::ostringstream oss;
|
||||
proxy.Call("pulsechip", {"1"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "pulsechip 1\n");
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("pulsechip", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("pulsechip", {"1"}, -1, PUT));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("quad", "[.cmd]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
if (det_type == defs::EIGER) {
|
||||
auto prev_val = det.getQuad().tsquash("inconsistent quad to test");
|
||||
// Quad only works with a single half module EIGER
|
||||
std::ostringstream oss;
|
||||
proxy.Call("quad", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "quad 0\n");
|
||||
det.setQuad(prev_val);
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("quad", {}, -1, GET));
|
||||
}
|
||||
|
@ -94,3 +94,62 @@ TEST_CASE("Setting and reading back GOTTHARD dacs", "[.cmd][.dacs][.new]") {
|
||||
REQUIRE_THROWS(proxy.Call("vcom_adc2", {}, -1, GET));
|
||||
}
|
||||
}
|
||||
|
||||
/* Gotthard Specific */
|
||||
|
||||
TEST_CASE("roi", "[.cmd][.new]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
|
||||
if (det_type == defs::GOTTHARD) {
|
||||
auto prev_val = det.getROI();
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("roi", {"0", "255"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "roi [0, 255]\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("roi", {"256", "511"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "roi [256, 511]\n");
|
||||
}
|
||||
REQUIRE_THROWS(proxy.Call("roi", {"0", "256"}, -1, PUT));
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setROI(prev_val[i], i);
|
||||
}
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("roi", {}, -1, GET));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("clearroi", "[.cmd][.new]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
|
||||
if (det_type == defs::GOTTHARD) {
|
||||
auto prev_val = det.getROI();
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("clearroi", {}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "clearroi [-1, -1]\n");
|
||||
}
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setROI(prev_val[i], i);
|
||||
}
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("clearroi", {}, -1, PUT));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("exptimel", "[.cmd][.new]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
if (det_type == defs::GOTTHARD) {
|
||||
REQUIRE_NOTHROW(proxy.Call("exptimel", {}, -1, GET));
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("exptimel", {}, -1, GET));
|
||||
}
|
||||
}
|
@ -15,82 +15,6 @@ using sls::Detector;
|
||||
using test::GET;
|
||||
using test::PUT;
|
||||
|
||||
/* acquisition parameters */
|
||||
|
||||
TEST_CASE("bursts", "[.cmd][.new]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
if (det_type == defs::GOTTHARD2) {
|
||||
auto prev_burst =
|
||||
det.getNumberOfBursts().tsquash("#bursts should be same to test");
|
||||
auto prev_trigger =
|
||||
det.getNumberOfFrames().tsquash("#frames should be same to test");
|
||||
auto prev_frames = det.getNumberOfTriggers().tsquash(
|
||||
"#triggers should be same to test");
|
||||
auto prev_timingMode = det.getTimingMode();
|
||||
auto prev_burstMode = det.getBurstMode();
|
||||
// changing continuous mode frames and bursts
|
||||
det.setBurstMode(defs::BURST_INTERNAL);
|
||||
det.setTimingMode(defs::AUTO_TIMING);
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("bursts", {"3"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "bursts 3\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("bursts", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "bursts 3\n");
|
||||
}
|
||||
REQUIRE_THROWS(proxy.Call("bursts", {"0"}, -1, PUT));
|
||||
// trigger mode: reg set to 1, but bursts must be same
|
||||
det.setTimingMode(defs::TRIGGER_EXPOSURE);
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("bursts", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "bursts 3\n");
|
||||
}
|
||||
det.setTimingMode(defs::AUTO_TIMING);
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("bursts", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "bursts 3\n");
|
||||
}
|
||||
// continuous mode: reg set to #frames,
|
||||
// but bursts should return same value
|
||||
det.setBurstMode(defs::BURST_OFF);
|
||||
det.setNumberOfFrames(2);
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("bursts", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "bursts 3\n");
|
||||
}
|
||||
det.setTimingMode(defs::TRIGGER_EXPOSURE);
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("bursts", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "bursts 3\n");
|
||||
}
|
||||
det.setBurstMode(defs::BURST_INTERNAL);
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("bursts", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "bursts 3\n");
|
||||
}
|
||||
// set to previous values
|
||||
det.setNumberOfBursts(prev_burst);
|
||||
det.setNumberOfFrames(prev_frames);
|
||||
det.setNumberOfTriggers(prev_trigger);
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setTimingMode(prev_timingMode[i], {i});
|
||||
det.setBurstMode(prev_burstMode[i], {i});
|
||||
}
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("bursts", {}, -1, GET));
|
||||
}
|
||||
}
|
||||
|
||||
/* dacs */
|
||||
|
||||
TEST_CASE("Setting and reading back GOTTHARD2 dacs", "[.cmd][.dacs][.new]") {
|
||||
@ -262,7 +186,164 @@ TEST_CASE("vchip_cs", "[.cmd][.onchipdacs][.new]") {
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("burstmode", "[.cmd]") {
|
||||
/* Gotthard2 Specific */
|
||||
|
||||
TEST_CASE("bursts", "[.cmd][.new]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
if (det_type == defs::GOTTHARD2) {
|
||||
auto prev_burst =
|
||||
det.getNumberOfBursts().tsquash("#bursts should be same to test");
|
||||
auto prev_trigger =
|
||||
det.getNumberOfFrames().tsquash("#frames should be same to test");
|
||||
auto prev_frames = det.getNumberOfTriggers().tsquash(
|
||||
"#triggers should be same to test");
|
||||
auto prev_timingMode = det.getTimingMode();
|
||||
auto prev_burstMode = det.getBurstMode();
|
||||
// changing continuous mode frames and bursts
|
||||
det.setBurstMode(defs::BURST_INTERNAL);
|
||||
det.setTimingMode(defs::AUTO_TIMING);
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("bursts", {"3"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "bursts 3\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("bursts", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "bursts 3\n");
|
||||
}
|
||||
REQUIRE_THROWS(proxy.Call("bursts", {"0"}, -1, PUT));
|
||||
// trigger mode: reg set to 1, but bursts must be same
|
||||
det.setTimingMode(defs::TRIGGER_EXPOSURE);
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("bursts", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "bursts 3\n");
|
||||
}
|
||||
det.setTimingMode(defs::AUTO_TIMING);
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("bursts", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "bursts 3\n");
|
||||
}
|
||||
// continuous mode: reg set to #frames,
|
||||
// but bursts should return same value
|
||||
det.setBurstMode(defs::BURST_OFF);
|
||||
det.setNumberOfFrames(2);
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("bursts", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "bursts 3\n");
|
||||
}
|
||||
det.setTimingMode(defs::TRIGGER_EXPOSURE);
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("bursts", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "bursts 3\n");
|
||||
}
|
||||
det.setBurstMode(defs::BURST_INTERNAL);
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("bursts", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "bursts 3\n");
|
||||
}
|
||||
// set to previous values
|
||||
det.setNumberOfBursts(prev_burst);
|
||||
det.setNumberOfFrames(prev_frames);
|
||||
det.setNumberOfTriggers(prev_trigger);
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setTimingMode(prev_timingMode[i], {i});
|
||||
det.setBurstMode(prev_burstMode[i], {i});
|
||||
}
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("bursts", {}, -1, GET));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("burstperiod", "[.cmd][.new]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
|
||||
if (det_type == defs::GOTTHARD2) {
|
||||
auto previous = det.getBurstPeriod();
|
||||
|
||||
std::ostringstream oss_set, oss_get;
|
||||
proxy.Call("burstperiod", {"30ms"}, -1, PUT, oss_set);
|
||||
REQUIRE(oss_set.str() == "burstperiod 30ms\n");
|
||||
proxy.Call("burstperiod", {}, -1, GET, oss_get);
|
||||
REQUIRE(oss_get.str() == "burstperiod 30ms\n");
|
||||
// Reset to previous value
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setBurstPeriod(previous[i], {i});
|
||||
}
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("burstperiod", {}, -1, GET));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("inj_ch", "[.cmd][.new]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
|
||||
if (det_type == defs::GOTTHARD2) {
|
||||
REQUIRE_THROWS(
|
||||
proxy.Call("inj_ch", {"-1", "1"}, -1, PUT)); // invalid offset
|
||||
REQUIRE_THROWS(
|
||||
proxy.Call("inj_ch", {"0", "0"}, -1, PUT)); // invalid increment
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("inj_ch", {"0", "1"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "inj_ch [0, 1]\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("inj_ch", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "inj_ch [0, 1]\n");
|
||||
}
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("inj_ch", {}, -1, GET));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("vetophoton", "[.cmd][.new]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
|
||||
if (det_type == defs::GOTTHARD2) {
|
||||
REQUIRE_THROWS(proxy.Call("vetophoton", {}, -1, GET));
|
||||
REQUIRE_NOTHROW(proxy.Call("vetophoton", {"-1"}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vetophoton", {"12", "1", "39950"}, -1,
|
||||
PUT)); // invalid chip index
|
||||
REQUIRE_THROWS(proxy.Call("vetophoton", {"-1", "0"}, -1,
|
||||
PUT)); // invalid photon number
|
||||
REQUIRE_THROWS(proxy.Call("vetophoton", {"-1", "1", "39950"}, -1,
|
||||
PUT)); // invald file
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("vetophoton", {"-1"}, -1, GET));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("vetoref", "[.cmd][.new]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
|
||||
if (det_type == defs::GOTTHARD2) {
|
||||
REQUIRE_THROWS(proxy.Call("vetoref", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vetoref", {"3", "0x3ff"}, -1,
|
||||
PUT)); // invalid chip index
|
||||
REQUIRE_NOTHROW(proxy.Call("vetoref", {"1", "0x010"}, -1, PUT));
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("vetoref", {"3", "0x0"}, -1, PUT));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("burstmode", "[.cmd][.new]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
@ -293,92 +374,7 @@ TEST_CASE("burstmode", "[.cmd]") {
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("vetoref", "[.cmd]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
|
||||
if (det_type == defs::GOTTHARD2) {
|
||||
REQUIRE_THROWS(proxy.Call("vetoref", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vetoref", {"3", "0x3ff"}, -1,
|
||||
PUT)); // invalid chip index
|
||||
REQUIRE_NOTHROW(proxy.Call("vetoref", {"1", "0x010"}, -1, PUT));
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("vetoref", {"3", "0x0"}, -1, PUT));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("vetophoton", "[.cmd]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
|
||||
if (det_type == defs::GOTTHARD2) {
|
||||
REQUIRE_THROWS(proxy.Call("vetophoton", {}, -1, GET));
|
||||
REQUIRE_NOTHROW(proxy.Call("vetophoton", {"-1"}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vetophoton", {"12", "1", "39950"}, -1,
|
||||
PUT)); // invalid chip index
|
||||
REQUIRE_THROWS(proxy.Call("vetophoton", {"-1", "0"}, -1,
|
||||
PUT)); // invalid photon number
|
||||
REQUIRE_THROWS(proxy.Call("vetophoton", {"-1", "1", "39950"}, -1,
|
||||
PUT)); // invald file
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("vetophoton", {"-1"}, -1, GET));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("inj_ch", "[.cmd]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
|
||||
if (det_type == defs::GOTTHARD2) {
|
||||
auto inj = det.getInjectChannel();
|
||||
REQUIRE_THROWS(
|
||||
proxy.Call("inj_ch", {"-1", "1"}, -1, PUT)); // invalid offset
|
||||
REQUIRE_THROWS(
|
||||
proxy.Call("inj_ch", {"0", "0"}, -1, PUT)); // invalid increment
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("inj_ch", {"0", "1"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "inj_ch [0, 1]\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("inj_ch", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "inj_ch [0, 1]\n");
|
||||
}
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setInjectChannel(inj[i][0], inj[i][1], {i});
|
||||
}
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("inj_ch", {}, -1, GET));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("burstperiod", "[.cmd]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
|
||||
if (det_type == defs::GOTTHARD2) {
|
||||
auto previous = det.getBurstPeriod();
|
||||
|
||||
std::ostringstream oss_set, oss_get;
|
||||
proxy.Call("burstperiod", {"30ms"}, -1, PUT, oss_set);
|
||||
REQUIRE(oss_set.str() == "burstperiod 30ms\n");
|
||||
proxy.Call("burstperiod", {}, -1, GET, oss_get);
|
||||
REQUIRE(oss_get.str() == "burstperiod 30ms\n");
|
||||
// Reset to previous value
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setBurstPeriod(previous[i], {i});
|
||||
}
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("burstperiod", {}, -1, GET));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("currentsource", "[.cmd]") {
|
||||
TEST_CASE("currentsource", "[.cmd][.new]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
@ -408,7 +404,7 @@ TEST_CASE("currentsource", "[.cmd]") {
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("timingsource", "[.cmd]") {
|
||||
TEST_CASE("timingsource", "[.cmd][.new]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
@ -437,3 +433,33 @@ TEST_CASE("timingsource", "[.cmd]") {
|
||||
REQUIRE_THROWS(proxy.Call("timingsource", {}, -1, GET));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("veto", "[.cmd][.new]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
|
||||
if (det_type == defs::GOTTHARD2) {
|
||||
auto prev_val = det.getVeto();
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("veto", {"1"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "veto 1\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("veto", {"0"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "veto 0\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("veto", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "veto 0\n");
|
||||
}
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setVeto(prev_val[i], {i});
|
||||
}
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("veto", {}, -1, GET));
|
||||
}
|
||||
}
|
@ -94,114 +94,248 @@ TEST_CASE("Setting and reading back Jungfrau dacs", "[.cmd][.dacs][.new]") {
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("nframes", "[.cmd]") {
|
||||
/* Network Configuration (Detector<->Receiver) */
|
||||
|
||||
TEST_CASE("selinterface", "[.cmd][.new]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
if (det_type == defs::JUNGFRAU || det_type == defs::CHIPTESTBOARD) {
|
||||
auto nframes = det.getNumberOfFramesFromStart().squash();
|
||||
std::ostringstream oss;
|
||||
proxy.Call("nframes", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "nframes " + std::to_string(nframes) + "\n");
|
||||
|
||||
if (det_type == defs::JUNGFRAU) {
|
||||
auto prev_val = det.getSelectedUDPInterface().tsquash(
|
||||
"inconsistent selected interface to test");
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("selinterface", {"1"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "selinterface 1\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("selinterface", {"0"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "selinterface 0\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("selinterface", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "selinterface 0\n");
|
||||
}
|
||||
det.selectUDPInterface(prev_val);
|
||||
REQUIRE_THROWS(proxy.Call("selinterface", {"2"}, -1, PUT));
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("nframes", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("selinterface", {}, -1, GET));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("now", "[.cmd]") {
|
||||
// TODO! can we test this?
|
||||
/* Jungfrau Specific */
|
||||
|
||||
TEST_CASE("temp_threshold", "[.cmd][.new]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
if (det_type == defs::JUNGFRAU || det_type == defs::CHIPTESTBOARD) {
|
||||
std::ostringstream oss;
|
||||
proxy.Call("now", {}, -1, GET, oss);
|
||||
|
||||
// Get only
|
||||
REQUIRE_THROWS(proxy.Call("now", {"2019"}, -1, PUT));
|
||||
if (det_type == defs::JUNGFRAU) {
|
||||
auto prev_val = det.getThresholdTemperature();
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("temp_threshold", {"65"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "temp_threshold 65\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("temp_threshold", {"70"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "temp_threshold 70\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("temp_threshold", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "temp_threshold 70\n");
|
||||
}
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setThresholdTemperature(prev_val[i], {i});
|
||||
}
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("now", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("temp_threshold", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("temp_threshold", {"70"}, -1, PUT));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("timestamp", "[.cmd]") {
|
||||
// TODO! can we test this?
|
||||
TEST_CASE("temp_control", "[.cmd][.new]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
if (det_type == defs::JUNGFRAU || det_type == defs::CHIPTESTBOARD) {
|
||||
std::ostringstream oss;
|
||||
proxy.Call("timestamp", {}, -1, GET, oss);
|
||||
|
||||
// Get only
|
||||
REQUIRE_THROWS(proxy.Call("timestamp", {"2019"}, -1, PUT));
|
||||
if (det_type == defs::JUNGFRAU) {
|
||||
auto prev_val = det.getTemperatureControl();
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("temp_control", {"0"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "temp_control 0\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("temp_control", {"1"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "temp_control 1\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("temp_control", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "temp_control 1\n");
|
||||
}
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setTemperatureControl(prev_val[i], {i});
|
||||
}
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("timestamp", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("temp_control", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("temp_control", {"0"}, -1, PUT));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("adcreg", "[.cmd]") {
|
||||
// TODO! what is a safe value to use?
|
||||
TEST_CASE("temp_event", "[.cmd][.new]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
if (det_type == defs::JUNGFRAU || det_type == defs::CHIPTESTBOARD ||
|
||||
det_type == defs::GOTTHARD) {
|
||||
std::ostringstream oss;
|
||||
proxy.Call("adcreg", {"0x0", "0"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "adcreg [0x0, 0]\n");
|
||||
// This is a put only command
|
||||
REQUIRE_THROWS(proxy.Call("adcreg", {}, -1, GET));
|
||||
if (det_type == defs::JUNGFRAU) {
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("temp_event", {"0"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "temp_event cleared\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("temp_event", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "temp_event 0\n");
|
||||
}
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("adcreg", {"0x0", "0"}, -1, PUT));
|
||||
REQUIRE_THROWS(proxy.Call("adcreg", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("temp_event", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("temp_event", {"0"}, -1, PUT));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("bustest", "[.cmd]") {
|
||||
TEST_CASE("auto_comp_disable", "[.cmd][.new]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
if (det_type == defs::JUNGFRAU || det_type == defs::CHIPTESTBOARD ||
|
||||
det_type == defs::GOTTHARD) {
|
||||
std::ostringstream oss;
|
||||
proxy.Call("bustest", {}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "bustest successful\n");
|
||||
REQUIRE_THROWS(proxy.Call("bustest", {}, -1, GET));
|
||||
if (det_type == defs::JUNGFRAU) {
|
||||
auto prev_val = det.getAutoCompDisable();
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("auto_comp_disable", {"0"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "auto_comp_disable 0\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("auto_comp_disable", {"1"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "auto_comp_disable 1\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("auto_comp_disable", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "auto_comp_disable 1\n");
|
||||
}
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setAutoCompDisable(prev_val[i], {i});
|
||||
}
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("bustest", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("bustest", {}, -1, PUT));
|
||||
REQUIRE_THROWS(proxy.Call("auto_comp_disable", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("auto_comp_disable", {"0"}, -1, PUT));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("firmwaretest", "[.cmd]") {
|
||||
TEST_CASE("storagecells", "[.cmd][.new]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
if (det_type == defs::JUNGFRAU || det_type == defs::CHIPTESTBOARD ||
|
||||
det_type == defs::GOTTHARD) {
|
||||
std::ostringstream oss;
|
||||
proxy.Call("firmwaretest", {}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "firmwaretest successful\n");
|
||||
REQUIRE_THROWS(proxy.Call("firmwaretest", {}, -1, GET));
|
||||
if (det_type == defs::JUNGFRAU) {
|
||||
auto prev_val = det.getNumberOfAdditionalStorageCells().tsquash(
|
||||
"inconsistent #additional storage cells to test");
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("storagecells", {"1"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "storagecells 1\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("storagecells", {"15"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "storagecells 15\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("storagecells", {"0"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "storagecells 0\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("storagecells", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "storagecells 0\n");
|
||||
}
|
||||
REQUIRE_THROWS(proxy.Call("storagecells", {"16"}, -1, PUT));
|
||||
det.setNumberOfAdditionalStorageCells(prev_val);
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("firmwaretest", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("firmwaretest", {}, -1, PUT));
|
||||
REQUIRE_THROWS(proxy.Call("storagecells", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("storagecells", {"0"}, -1, PUT));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("resetfpga", "[.cmd]") {
|
||||
TEST_CASE("storagecell_start", "[.cmd][.new]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
if (det_type == defs::JUNGFRAU || det_type == defs::CHIPTESTBOARD) {
|
||||
std::ostringstream oss;
|
||||
proxy.Call("resetfpga", {}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "resetfpga successful\n");
|
||||
REQUIRE_THROWS(proxy.Call("resetfpga", {}, -1, GET));
|
||||
if (det_type == defs::JUNGFRAU) {
|
||||
auto prev_val = det.getStorageCellStart();
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("storagecell_start", {"1"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "storagecell_start 1\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("storagecell_start", {"15"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "storagecell_start 15\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("storagecell_start", {"0"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "storagecell_start 0\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("storagecell_start", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "storagecell_start 0\n");
|
||||
}
|
||||
REQUIRE_THROWS(proxy.Call("storagecell_start", {"16"}, -1, PUT));
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setStorageCellStart(prev_val[i], {i});
|
||||
}
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("resetfpga", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("resetfpga", {}, -1, PUT));
|
||||
REQUIRE_THROWS(proxy.Call("storagecell_start", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("storagecell_start", {"0"}, -1, PUT));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("storagecell_delay", "[.cmd][.new]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
if (det_type == defs::JUNGFRAU) {
|
||||
auto prev_val = det.getStorageCellDelay();
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("storagecell_delay", {"1.62ms"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "storagecell_delay 1.62ms\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("storagecell_delay", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "storagecell_delay 1.62ms\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("storagecell_delay", {"0"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "storagecell_delay 0\n");
|
||||
}
|
||||
REQUIRE_THROWS(proxy.Call("storagecell_delay", {"1638376ns"}, -1, PUT));
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setStorageCellDelay(prev_val[i], {i});
|
||||
}
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("storagecell_delay", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("storagecell_delay", {"0"}, -1, PUT));
|
||||
}
|
||||
}
|
@ -106,3 +106,121 @@ TEST_CASE("Setting and reading back MOENCH dacs", "[.cmd][.dacs][.new]") {
|
||||
REQUIRE_THROWS(proxy.Call("vcom_adc2", {}, -1, GET));
|
||||
}
|
||||
}
|
||||
|
||||
/* Moench */
|
||||
|
||||
TEST_CASE("emin", "[.cmd][.new]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
if (det_type == defs::MOENCH) {
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("emin", {"100"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "emin 100\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("emin", {"200"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "emin 200\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("emin", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "emin 200\n");
|
||||
}
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("emin", {}, -1, GET));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("emax", "[.cmd][.new]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
if (det_type == defs::MOENCH) {
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("emax", {"100"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "emax 100\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("emax", {"200"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "emax 200\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("emax", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "emax 200\n");
|
||||
}
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("emax", {}, -1, GET));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("framemode", "[.cmd][.new]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
if (det_type == defs::MOENCH) {
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("framemode", {"pedestal"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "framemode pedestal\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("framemode", {"newpedestal"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "framemode newpedestal\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("framemode", {"flatfield"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "framemode flatfield\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("framemode", {"newflatfield"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "framemode newflatfield\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("framemode", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "framemode newflatfield\n");
|
||||
}
|
||||
REQUIRE_THROWS(proxy.Call("framemode", {"counting"}, -1, PUT));
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("framemode", {}, -1, GET));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("detectormode", "[.cmd][.new]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
if (det_type == defs::MOENCH) {
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("detectormode", {"counting"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "detectormode counting\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("detectormode", {"interpolating"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "detectormode interpolating\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("detectormode", {"analog"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "detectormode analog\n");
|
||||
}
|
||||
std::ostringstream oss;
|
||||
proxy.Call("detectormode", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "detectormode analog\n");
|
||||
|
||||
REQUIRE_THROWS(proxy.Call("detectormode", {"pedestal"}, -1, PUT));
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("detectormode", {}, -1, GET));
|
||||
}
|
||||
}
|
@ -89,7 +89,9 @@ TEST_CASE("Setting and reading back MYTHEN3 dacs", "[.cmd][.dacs][.new]") {
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("counters", "[.cmd]") {
|
||||
/* Mythen3 Specific */
|
||||
|
||||
TEST_CASE("counters", "[.cmd][.new]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
@ -120,3 +122,243 @@ TEST_CASE("counters", "[.cmd]") {
|
||||
REQUIRE_THROWS(proxy.Call("counters", {}, -1, GET));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("gates", "[.cmd][.new]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
if (det_type == defs::MYTHEN3) {
|
||||
auto prev_val = det.getNumberOfGates();
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("gates", {"1000"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "gates 1000\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("gates", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "gates 1000\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("gates", {"1"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "gates 1\n");
|
||||
}
|
||||
REQUIRE_THROWS(proxy.Call("gates", {"0"}, -1, PUT));
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setNumberOfGates(prev_val[i], {i});
|
||||
}
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("gates", {}, -1, GET));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("exptime1", "[.cmd][.new]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
if (det_type == defs::MYTHEN3) {
|
||||
auto prev_val = det.getExptime(0);
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("exptime1", {"1.25s"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "exptime1 1.25s\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("exptime1", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "exptime1 1.25s\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("exptime1", {"0"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "exptime1 0\n");
|
||||
}
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setExptime(0, prev_val[i], {i});
|
||||
}
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("exptime1", {}, -1, GET));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("exptime2", "[.cmd][.new]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
if (det_type == defs::MYTHEN3) {
|
||||
auto prev_val = det.getExptime(1);
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("exptime2", {"1.25s"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "exptime2 1.25s\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("exptime2", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "exptime2 1.25s\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("exptime2", {"0"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "exptime2 0\n");
|
||||
}
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setExptime(1, prev_val[i], {i});
|
||||
}
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("exptime2", {}, -1, GET));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("exptime3", "[.cmd][.new]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
if (det_type == defs::MYTHEN3) {
|
||||
auto prev_val = det.getExptime(2);
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("exptime3", {"1.25s"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "exptime3 1.25s\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("exptime3", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "exptime3 1.25s\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("exptime3", {"0"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "exptime3 0\n");
|
||||
}
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setExptime(2, prev_val[i], {i});
|
||||
}
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("exptime3", {}, -1, GET));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("gatedelay", "[.cmd][.new]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
if (det_type == defs::MYTHEN3) {
|
||||
auto prev_val = det.getExptimeForAllGates().tsquash(
|
||||
"inconsistent gatedelay to test");
|
||||
if (prev_val[0] != prev_val[1] || prev_val[1] != prev_val[2]) {
|
||||
throw sls::RuntimeError("inconsistent gatedelay for all gates");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("gatedelay", {"0.05"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "gatedelay 0.05\n");
|
||||
}
|
||||
if (det_type != defs::MYTHEN3) {
|
||||
std::ostringstream oss;
|
||||
proxy.Call("gatedelay", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "gatedelay 50ms\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("gatedelay", {"1s"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "gatedelay 1s\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("gatedelay", {"0"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "gatedelay 0\n");
|
||||
}
|
||||
det.setGateDelay(-1, prev_val[0]);
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("gatedelay", {}, -1, GET));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("gatedelay1", "[.cmd][.new]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
if (det_type == defs::MYTHEN3) {
|
||||
auto prev_val = det.getGateDelay(0);
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("gatedelay1", {"1.25s"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "gatedelay1 1.25s\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("gatedelay1", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "gatedelay1 1.25s\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("gatedelay1", {"0"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "gatedelay1 0\n");
|
||||
}
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setGateDelay(0, prev_val[i], {i});
|
||||
}
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("gatedelay1", {}, -1, GET));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("gatedelay2", "[.cmd][.new]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
if (det_type == defs::MYTHEN3) {
|
||||
auto prev_val = det.getGateDelay(1);
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("gatedelay2", {"1.25s"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "gatedelay2 1.25s\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("gatedelay2", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "gatedelay2 1.25s\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("gatedelay2", {"0"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "gatedelay2 0\n");
|
||||
}
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setGateDelay(1, prev_val[i], {i});
|
||||
}
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("gatedelay2", {}, -1, GET));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("gatedelay3", "[.cmd][.new]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
if (det_type == defs::MYTHEN3) {
|
||||
auto prev_val = det.getGateDelay(2);
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("gatedelay3", {"1.25s"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "gatedelay3 1.25s\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("gatedelay3", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "gatedelay3 1.25s\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("gatedelay3", {"0"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "gatedelay3 0\n");
|
||||
}
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setGateDelay(2, prev_val[i], {i});
|
||||
}
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("gatedelay3", {}, -1, GET));
|
||||
}
|
||||
}
|
544
slsDetectorSoftware/tests/test-CmdProxy-pattern.cpp
Normal file
544
slsDetectorSoftware/tests/test-CmdProxy-pattern.cpp
Normal file
@ -0,0 +1,544 @@
|
||||
#include "CmdProxy.h"
|
||||
#include "Detector.h"
|
||||
#include "catch.hpp"
|
||||
#include "sls_detector_defs.h"
|
||||
#include <sstream>
|
||||
|
||||
#include "Result.h"
|
||||
#include "ToString.h"
|
||||
#include "test-CmdProxy-global.h"
|
||||
#include "tests/globals.h"
|
||||
#include "versionAPI.h"
|
||||
|
||||
using sls::CmdProxy;
|
||||
using sls::Detector;
|
||||
using test::GET;
|
||||
using test::PUT;
|
||||
|
||||
/* Pattern */
|
||||
|
||||
TEST_CASE("pattern", "[.cmd][.new]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
if (det_type == defs::CHIPTESTBOARD || det_type == defs::MOENCH ||
|
||||
det_type == defs::MYTHEN3) {
|
||||
// no proper test for put
|
||||
REQUIRE_THROWS(proxy.Call("pattern", {}, -1, GET));
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("pattern", {}, -1, GET));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("savepattern", "[.cmd][.new]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
if (det_type == defs::CHIPTESTBOARD || det_type == defs::MOENCH ||
|
||||
det_type == defs::MYTHEN3) {
|
||||
REQUIRE_THROWS(
|
||||
proxy.Call("savepattern", {"/tmp/pattern.txt"}, -1, GET));
|
||||
REQUIRE_NOTHROW(
|
||||
proxy.Call("savepattern", {"/tmp/pattern.txt"}, -1, PUT));
|
||||
} else {
|
||||
REQUIRE_THROWS(
|
||||
proxy.Call("savepattern", {"/tmp/pattern.txt"}, -1, PUT));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("patioctrl", "[.cmd][.new]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
|
||||
if (det_type == defs::CHIPTESTBOARD || det_type == defs::MOENCH) {
|
||||
auto prev_val = det.getPatternIOControl();
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("patioctrl", {"0xc15004808d0a21a4"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "patioctrl 0xc15004808d0a21a4\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("patioctrl", {"0x0"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "patioctrl 0x0\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("patioctrl", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "patioctrl 0x0\n");
|
||||
}
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setPatternIOControl(prev_val[i], {i});
|
||||
}
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("patioctrl", {}, -1, GET));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("patclkctrl", "[.cmd][.new]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
|
||||
if (det_type == defs::CHIPTESTBOARD || det_type == defs::MOENCH) {
|
||||
auto prev_val = det.getPatternClockControl();
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("patclkctrl", {"0xc15004808d0a21a4"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "patclkctrl 0xc15004808d0a21a4\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("patclkctrl", {"0x0"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "patclkctrl 0x0\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("patclkctrl", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "patclkctrl 0x0\n");
|
||||
}
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setPatternClockControl(prev_val[i], {i});
|
||||
}
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("patclkctrl", {}, -1, GET));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("patword", "[.cmd][.new]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
|
||||
if (det_type == defs::CHIPTESTBOARD || det_type == defs::MOENCH ||
|
||||
det_type == defs::MYTHEN3) {
|
||||
int addr = 0x23;
|
||||
std::string saddr = sls::ToStringHex(addr);
|
||||
auto prev_val = det.getPatternWord(addr);
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("patword", {saddr, "0xc15004808d0a21a4"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() ==
|
||||
"patword [" + saddr + ", 0xc15004808d0a21a4]\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("patword", {saddr, "0x0"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "patword [" + saddr + ", 0x0]\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("patword", {saddr}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "patword 0x0\n");
|
||||
}
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setPatternWord(addr, prev_val[i], {i});
|
||||
}
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("patword", {"0x23"}, -1, GET));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("patlimits", "[.cmd][.new]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
|
||||
if (det_type == defs::CHIPTESTBOARD || det_type == defs::MOENCH ||
|
||||
det_type == defs::MYTHEN3) {
|
||||
auto prev_val = det.getPatternLoopAddresses(-1);
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("patlimits", {"0x20", "0x5c"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "patlimits [0x20, 0x5c]\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("patlimits", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "patlimits [0x20, 0x5c]\n");
|
||||
}
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setPatternLoopAddresses(-1, prev_val[i][0], prev_val[i][1],
|
||||
{i});
|
||||
}
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("patlimits", {}, -1, GET));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("patloop0", "[.cmd][.new]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
|
||||
if (det_type == defs::CHIPTESTBOARD || det_type == defs::MOENCH ||
|
||||
det_type == defs::MYTHEN3) {
|
||||
auto prev_val = det.getPatternLoopAddresses(0);
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("patloop0", {"0x20", "0x5c"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "patloop0 [0x20, 0x5c]\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("patloop0", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "patloop0 [0x20, 0x5c]\n");
|
||||
}
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setPatternLoopAddresses(0, prev_val[i][0], prev_val[i][1], {i});
|
||||
}
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("patloop0", {}, -1, GET));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("patloop1", "[.cmd][.new]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
|
||||
if (det_type == defs::CHIPTESTBOARD || det_type == defs::MOENCH ||
|
||||
det_type == defs::MYTHEN3) {
|
||||
auto prev_val = det.getPatternLoopAddresses(1);
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("patloop1", {"0x20", "0x5c"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "patloop1 [0x20, 0x5c]\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("patloop1", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "patloop1 [0x20, 0x5c]\n");
|
||||
}
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setPatternLoopAddresses(1, prev_val[i][0], prev_val[i][1], {i});
|
||||
}
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("patloop1", {}, -1, GET));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("patloop2", "[.cmd][.new]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
|
||||
if (det_type == defs::CHIPTESTBOARD || det_type == defs::MOENCH ||
|
||||
det_type == defs::MYTHEN3) {
|
||||
auto prev_val = det.getPatternLoopAddresses(2);
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("patloop2", {"0x20", "0x5c"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "patloop2 [0x20, 0x5c]\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("patloop2", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "patloop2 [0x20, 0x5c]\n");
|
||||
}
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setPatternLoopAddresses(2, prev_val[i][0], prev_val[i][1], {i});
|
||||
}
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("patloop2", {}, -1, GET));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("patnloop0", "[.cmd][.new]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
|
||||
if (det_type == defs::CHIPTESTBOARD || det_type == defs::MOENCH ||
|
||||
det_type == defs::MYTHEN3) {
|
||||
auto prev_val = det.getPatternLoopCycles(0);
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("patnloop0", {"5"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "patnloop0 5\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("patnloop0", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "patnloop0 5\n");
|
||||
}
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setPatternLoopCycles(0, prev_val[i], {i});
|
||||
}
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("patnloop0", {}, -1, GET));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("patnloop1", "[.cmd][.new]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
|
||||
if (det_type == defs::CHIPTESTBOARD || det_type == defs::MOENCH ||
|
||||
det_type == defs::MYTHEN3) {
|
||||
auto prev_val = det.getPatternLoopCycles(1);
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("patnloop1", {"5"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "patnloop1 5\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("patnloop1", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "patnloop1 5\n");
|
||||
}
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setPatternLoopCycles(1, prev_val[i], {i});
|
||||
}
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("patnloop1", {}, -1, GET));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("patnloop2", "[.cmd][.new]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
|
||||
if (det_type == defs::CHIPTESTBOARD || det_type == defs::MOENCH ||
|
||||
det_type == defs::MYTHEN3) {
|
||||
auto prev_val = det.getPatternLoopCycles(2);
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("patnloop2", {"5"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "patnloop2 5\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("patnloop2", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "patnloop2 5\n");
|
||||
}
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setPatternLoopCycles(2, prev_val[i], {i});
|
||||
}
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("patnloop2", {}, -1, GET));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("patwait0", "[.cmd][.new]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
|
||||
if (det_type == defs::CHIPTESTBOARD || det_type == defs::MOENCH ||
|
||||
det_type == defs::MYTHEN3) {
|
||||
auto prev_val = det.getPatternWaitAddr(0);
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("patwait0", {"0x5c"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "patwait0 0x5c\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("patwait0", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "patwait0 0x5c\n");
|
||||
}
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setPatternWaitAddr(0, prev_val[i], {i});
|
||||
}
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("patwait0", {}, -1, GET));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("patwait1", "[.cmd][.new]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
|
||||
if (det_type == defs::CHIPTESTBOARD || det_type == defs::MOENCH ||
|
||||
det_type == defs::MYTHEN3) {
|
||||
auto prev_val = det.getPatternWaitAddr(1);
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("patwait1", {"0x5c"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "patwait1 0x5c\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("patwait1", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "patwait1 0x5c\n");
|
||||
}
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setPatternWaitAddr(1, prev_val[i], {i});
|
||||
}
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("patwait1", {}, -1, GET));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("patwait2", "[.cmd][.new]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
|
||||
if (det_type == defs::CHIPTESTBOARD || det_type == defs::MOENCH ||
|
||||
det_type == defs::MYTHEN3) {
|
||||
auto prev_val = det.getPatternWaitAddr(2);
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("patwait2", {"0x5c"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "patwait2 0x5c\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("patwait2", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "patwait2 0x5c\n");
|
||||
}
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setPatternWaitAddr(2, prev_val[i], {i});
|
||||
}
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("patwait2", {}, -1, GET));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("patwaittime0", "[.cmd][.new]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
|
||||
if (det_type == defs::CHIPTESTBOARD || det_type == defs::MOENCH ||
|
||||
det_type == defs::MYTHEN3) {
|
||||
auto prev_val = det.getPatternWaitTime(0);
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("patwaittime0", {"8589936640"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "patwaittime0 8589936640\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("patwaittime0", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "patwaittime0 8589936640\n");
|
||||
}
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setPatternWaitTime(0, prev_val[i], {i});
|
||||
}
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("patwaittime0", {}, -1, GET));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("patwaittime1", "[.cmd][.new]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
|
||||
if (det_type == defs::CHIPTESTBOARD || det_type == defs::MOENCH ||
|
||||
det_type == defs::MYTHEN3) {
|
||||
auto prev_val = det.getPatternWaitTime(1);
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("patwaittime1", {"8589936640"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "patwaittime1 8589936640\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("patwaittime1", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "patwaittime1 8589936640\n");
|
||||
}
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setPatternWaitTime(1, prev_val[i], {i});
|
||||
}
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("patwaittime1", {}, -1, GET));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("patwaittime2", "[.cmd][.new]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
|
||||
if (det_type == defs::CHIPTESTBOARD || det_type == defs::MOENCH ||
|
||||
det_type == defs::MYTHEN3) {
|
||||
auto prev_val = det.getPatternWaitTime(2);
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("patwaittime2", {"8589936640"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "patwaittime2 8589936640\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("patwaittime2", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "patwaittime2 8589936640\n");
|
||||
}
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setPatternWaitTime(2, prev_val[i], {i});
|
||||
}
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("patwaittime2", {}, -1, GET));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("patmask", "[.cmd][.new]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
|
||||
if (det_type == defs::CHIPTESTBOARD || det_type == defs::MOENCH ||
|
||||
det_type == defs::MYTHEN3) {
|
||||
auto prev_val = det.getPatternMask();
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("patmask", {"0x842f020204200dc0"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "patmask 0x842f020204200dc0\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("patmask", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "patmask 0x842f020204200dc0\n");
|
||||
}
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setPatternMask(prev_val[i], {i});
|
||||
}
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("patmask", {}, -1, GET));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("patsetbit", "[.cmd][.new]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
|
||||
if (det_type == defs::CHIPTESTBOARD || det_type == defs::MOENCH ||
|
||||
det_type == defs::MYTHEN3) {
|
||||
auto prev_val = det.getPatternBitMask();
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("patsetbit", {"0x842f020204200dc0"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "patsetbit 0x842f020204200dc0\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("patsetbit", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "patsetbit 0x842f020204200dc0\n");
|
||||
}
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setPatternBitMask(prev_val[i], {i});
|
||||
}
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("patsetbit", {}, -1, GET));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("patternstart", "[.cmd][.new]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
REQUIRE_THROWS(proxy.Call("patternstart", {}, -1, GET));
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
if (det_type == defs::MYTHEN3) {
|
||||
REQUIRE_NOTHROW(proxy.Call("patternstart", {}, -1, PUT));
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("patternstart", {}, -1, PUT));
|
||||
}
|
||||
}
|
@ -374,7 +374,7 @@ TEST_CASE("rx_lastclient", "[.cmd][.rx][.new]") {
|
||||
|
||||
/* File */
|
||||
|
||||
TEST_CASE("fformat", "[.cmd]") {
|
||||
TEST_CASE("fformat", "[.cmd][.new]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto prev_val = det.getFileFormat();
|
||||
@ -393,7 +393,7 @@ TEST_CASE("fformat", "[.cmd]") {
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("fpath", "[.cmd]") {
|
||||
TEST_CASE("fpath", "[.cmd][.new]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto prev_val = det.getFilePath();
|
||||
@ -412,7 +412,7 @@ TEST_CASE("fpath", "[.cmd]") {
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("fname", "[.cmd]") {
|
||||
TEST_CASE("fname", "[.cmd][.new]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto prev_val = det.getFileNamePrefix();
|
||||
@ -436,7 +436,7 @@ TEST_CASE("fname", "[.cmd]") {
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("findex", "[.cmd]") {
|
||||
TEST_CASE("findex", "[.cmd][.new]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto prev_val = det.getAcquisitionIndex();
|
||||
@ -460,7 +460,7 @@ TEST_CASE("findex", "[.cmd]") {
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("fwrite", "[.cmd]") {
|
||||
TEST_CASE("fwrite", "[.cmd][.new]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto prev_val = det.getFileWrite();
|
||||
@ -484,7 +484,7 @@ TEST_CASE("fwrite", "[.cmd]") {
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("fmaster", "[.cmd]") {
|
||||
TEST_CASE("fmaster", "[.cmd][.new]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto prev_val = det.getMasterFileWrite();
|
||||
@ -508,7 +508,7 @@ TEST_CASE("fmaster", "[.cmd]") {
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("foverwrite", "[.cmd]") {
|
||||
TEST_CASE("foverwrite", "[.cmd][.new]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto prev_val = det.getFileOverWrite();
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -3,10 +3,10 @@
|
||||
#define APILIB 0x200409
|
||||
#define APIRECEIVER 0x200409
|
||||
#define APIGUI 0x200409
|
||||
#define APICTB 0x200520
|
||||
#define APIGOTTHARD 0x200520
|
||||
#define APIJUNGFRAU 0x200520
|
||||
#define APIMOENCH 0x200515
|
||||
#define APIEIGER 0x200520
|
||||
#define APIGOTTHARD2 0x200528
|
||||
#define APIMYTHEN3 0x200528
|
||||
#define APICTB 0x200605
|
||||
#define APIGOTTHARD 0x200605
|
||||
#define APIGOTTHARD2 0x200605
|
||||
#define APIJUNGFRAU 0x200605
|
||||
#define APIMYTHEN3 0x200605
|
||||
#define APIMOENCH 0x200605
|
||||
#define APIEIGER 0x200605
|
||||
|
Reference in New Issue
Block a user