mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-21 09:08:00 +02:00
Merge branch 'developer' into rr_rxr
This commit is contained in:
@ -30,6 +30,14 @@ class Detector {
|
||||
std::unique_ptr<DetectorImpl> pimpl;
|
||||
|
||||
public:
|
||||
/** @name Configuration */
|
||||
///@{
|
||||
/**************************************************
|
||||
* *
|
||||
* Configuration *
|
||||
* *
|
||||
* ************************************************/
|
||||
|
||||
/**
|
||||
* @param shm_id detector shared memory id
|
||||
* Default value is 0. Can be set to more values for
|
||||
@ -38,13 +46,6 @@ class Detector {
|
||||
*/
|
||||
Detector(int shm_id = 0);
|
||||
~Detector();
|
||||
/** @name Configuration */
|
||||
///@{
|
||||
/**************************************************
|
||||
* *
|
||||
* Configuration *
|
||||
* *
|
||||
* ************************************************/
|
||||
|
||||
/** Free the shared memory of this detector and all modules
|
||||
belonging to it */
|
||||
@ -191,7 +192,7 @@ class Detector {
|
||||
void setFlipRows(bool value, Positions pos = {});
|
||||
|
||||
Result<bool> isVirtualDetectorServer(Positions pos = {}) const;
|
||||
///@{
|
||||
///@}
|
||||
|
||||
/** @name Callbacks */
|
||||
///@{
|
||||
@ -222,7 +223,7 @@ class Detector {
|
||||
void registerDataCallback(void (*func)(detectorData *, uint64_t, uint32_t,
|
||||
void *),
|
||||
void *pArg);
|
||||
///@{
|
||||
///@}
|
||||
|
||||
/** @name Acquisition Parameters */
|
||||
///@{
|
||||
@ -526,7 +527,7 @@ class Detector {
|
||||
*/
|
||||
void setReadNRows(const int lines, Positions pos = {});
|
||||
|
||||
///@{
|
||||
///@}
|
||||
|
||||
/** @name Acquisition */
|
||||
///@{
|
||||
@ -613,7 +614,7 @@ class Detector {
|
||||
/** Gets Scan error message if scan ended in error for non blocking
|
||||
* acquisitions.*/
|
||||
Result<std::string> getScanErrorMessage(Positions pos = {}) const;
|
||||
///@{
|
||||
///@}
|
||||
|
||||
/** @name Network Configuration (Detector<->Receiver) */
|
||||
///@{
|
||||
@ -802,7 +803,7 @@ class Detector {
|
||||
* port
|
||||
*/
|
||||
void setTransmissionDelayRight(int value, Positions pos = {});
|
||||
///@{
|
||||
///@}
|
||||
|
||||
/** @name Receiver Configuration */
|
||||
///@{
|
||||
@ -893,7 +894,7 @@ class Detector {
|
||||
* streamer yet or there is no second interface, it gives 0 in its place. */
|
||||
Result<std::array<pid_t, NUM_RX_THREAD_IDS>>
|
||||
getRxThreadIds(Positions pos = {}) const;
|
||||
///@{
|
||||
///@}
|
||||
|
||||
/** @name File */
|
||||
///@{
|
||||
@ -949,7 +950,7 @@ class Detector {
|
||||
/** Default depends on detector type. \n 0 will set frames per file in an
|
||||
* acquisition to unlimited */
|
||||
void setFramesPerFile(int n, Positions pos = {});
|
||||
///@{
|
||||
///@}
|
||||
|
||||
/** @name ZMQ Streaming Parameters (Receiver<->Client) */
|
||||
///@{
|
||||
@ -1058,7 +1059,7 @@ class Detector {
|
||||
*/
|
||||
void setRxZmqHwm(const int limit);
|
||||
|
||||
///@{
|
||||
///@}
|
||||
|
||||
/** @name Eiger Specific */
|
||||
///@{
|
||||
@ -1157,7 +1158,7 @@ class Detector {
|
||||
void setDataStream(const defs::portPosition port, const bool enable,
|
||||
Positions pos = {});
|
||||
|
||||
///@{
|
||||
///@}
|
||||
|
||||
/** @name Jungfrau Specific */
|
||||
///@{
|
||||
@ -1257,13 +1258,13 @@ class Detector {
|
||||
void setGainMode(const defs::gainMode mode, Positions pos = {});
|
||||
|
||||
/** [Jungfrau] Advanced */
|
||||
Result<int> getFilterCell(Positions pos = {}) const;
|
||||
Result<int> getNumberOfFilterCells(Positions pos = {}) const;
|
||||
|
||||
/** [Jungfrau] Advanced Options[0-12], only for chip v1.1
|
||||
*/
|
||||
void setFilterCell(int cell, Positions pos = {});
|
||||
void setNumberOfFilterCells(int cell, Positions pos = {});
|
||||
|
||||
///@{
|
||||
///@}
|
||||
|
||||
/** @name Gotthard Specific */
|
||||
///@{
|
||||
@ -1290,7 +1291,7 @@ class Detector {
|
||||
|
||||
/** [Gotthard] */
|
||||
Result<ns> getExptimeLeft(Positions pos = {}) const;
|
||||
///@{
|
||||
///@}
|
||||
|
||||
/** @name Gotthard2 Specific */
|
||||
///@{
|
||||
@ -1407,7 +1408,7 @@ class Detector {
|
||||
|
||||
/** [Gotthard2] */
|
||||
void setBadChannels(const std::string &fname, Positions pos = {});
|
||||
///@{
|
||||
///@}
|
||||
|
||||
/** @name Mythen3 Specific */
|
||||
///@{
|
||||
@ -1464,7 +1465,7 @@ class Detector {
|
||||
|
||||
Result<int> getGainCaps(Positions pos = {});
|
||||
|
||||
///@{
|
||||
///@}
|
||||
|
||||
/** @name CTB / Moench Specific */
|
||||
///@{
|
||||
@ -1523,7 +1524,7 @@ class Detector {
|
||||
/** [CTB][Moench] If any of a consecutive 4 bits are enabled, the "
|
||||
"complete 4 bits are enabled */
|
||||
void setTenGigaADCEnableMask(uint32_t mask, Positions pos = {});
|
||||
///@{
|
||||
///@}
|
||||
|
||||
/** @name CTB Specific */
|
||||
///@{
|
||||
@ -1605,7 +1606,7 @@ class Detector {
|
||||
|
||||
/** [CTB] Default is enabled. */
|
||||
void setLEDEnable(bool enable, Positions pos = {});
|
||||
///@{
|
||||
///@}
|
||||
|
||||
/** @name Pattern */
|
||||
///@{
|
||||
@ -1692,7 +1693,7 @@ class Detector {
|
||||
|
||||
/** [Mythen3] */
|
||||
void startPattern(Positions pos = {});
|
||||
///@{
|
||||
///@}
|
||||
|
||||
/** @name Moench specific */
|
||||
///@{
|
||||
@ -1726,7 +1727,7 @@ class Detector {
|
||||
void setAdditionalJsonParameter(const std::string &key,
|
||||
const std::string &value,
|
||||
Positions pos = {});
|
||||
///@{
|
||||
///@}
|
||||
|
||||
/** @name Advanced */
|
||||
///@{
|
||||
@ -1823,7 +1824,7 @@ class Detector {
|
||||
/** [CTB][Moench][Jungfrau] Advanced user Function! \n
|
||||
[Jungfrau] Inversions on top of default mask */
|
||||
void setADCInvert(uint32_t value, Positions pos = {});
|
||||
///@{
|
||||
///@}
|
||||
|
||||
/** @name Insignificant */
|
||||
///@{
|
||||
@ -1875,7 +1876,7 @@ class Detector {
|
||||
std::string getUserDetails() const;
|
||||
|
||||
Result<uint64_t> getRxCurrentFrameIndex(Positions pos = {}) const;
|
||||
///@{
|
||||
///@}
|
||||
|
||||
private:
|
||||
std::vector<int> getPortNumbers(int start_port);
|
||||
|
@ -82,9 +82,14 @@ std::map<std::string, std::string> CmdProxy::GetDepreciatedCommands() {
|
||||
}
|
||||
|
||||
void CmdProxy::WrongNumberOfParameters(size_t expected) {
|
||||
throw RuntimeError(
|
||||
"Command " + cmd + " expected <=" + std::to_string(expected) +
|
||||
" parameter/s but got " + std::to_string(args.size()) + "\n");
|
||||
if (expected == 0) {
|
||||
throw RuntimeError("Command " + cmd +
|
||||
" expected no parameter/s but got " +
|
||||
std::to_string(args.size()) + "\n");
|
||||
}
|
||||
throw RuntimeError("Command " + cmd + " expected (or >=) " +
|
||||
std::to_string(expected) + " parameter/s but got " +
|
||||
std::to_string(args.size()) + "\n");
|
||||
}
|
||||
|
||||
/************************************************
|
||||
|
@ -725,6 +725,10 @@ class CmdProxy {
|
||||
{"resmat", "partialreset"},
|
||||
|
||||
/* Jungfrau Specific */
|
||||
{"storagecells", "extrastoragecells"},
|
||||
{"auto_comp_disable", "autocompdisable"},
|
||||
{"comp_disable_time", "compdisabletime"},
|
||||
|
||||
/* Gotthard Specific */
|
||||
/* Gotthard2 Specific */
|
||||
/* Mythen3 Specific */
|
||||
@ -942,13 +946,13 @@ class CmdProxy {
|
||||
{"temp_threshold", &CmdProxy::temp_threshold},
|
||||
{"temp_control", &CmdProxy::temp_control},
|
||||
{"temp_event", &CmdProxy::TemperatureEvent},
|
||||
{"auto_comp_disable", &CmdProxy::auto_comp_disable},
|
||||
{"comp_disable_time", &CmdProxy::comp_disable_time},
|
||||
{"storagecells", &CmdProxy::storagecells},
|
||||
{"autocompdisable", &CmdProxy::autocompdisable},
|
||||
{"compdisabletime", &CmdProxy::compdisabletime},
|
||||
{"extrastoragecells", &CmdProxy::extrastoragecells},
|
||||
{"storagecell_start", &CmdProxy::storagecell_start},
|
||||
{"storagecell_delay", &CmdProxy::storagecell_delay},
|
||||
{"gainmode", &CmdProxy::gainmode},
|
||||
{"filtercell", &CmdProxy::filtercell},
|
||||
{"filtercells", &CmdProxy::filtercells},
|
||||
|
||||
/* Gotthard Specific */
|
||||
{"roi", &CmdProxy::ROI},
|
||||
@ -1905,30 +1909,30 @@ class CmdProxy {
|
||||
"cleared.");
|
||||
|
||||
INTEGER_COMMAND_VEC_ID(
|
||||
auto_comp_disable, getAutoComparatorDisable, setAutoComparatorDisable,
|
||||
autocompdisable, getAutoComparatorDisable, setAutoComparatorDisable,
|
||||
StringTo<int>,
|
||||
"[0, 1]\n\t[Jungfrau] Auto comparator disable mode. By default, the "
|
||||
"on-chip gain switching is active during the entire exposure.This mode "
|
||||
"disables the on - chip gain switching comparator automatically after "
|
||||
"93.75% (only for chipv1.0) of exposure time (only for longer than "
|
||||
"100us). It is possible to set the duration for chipv1.1 using "
|
||||
"comp_disable_time command.\n\tDefault is 0 or this mode "
|
||||
"compdisabletime command.\n\tDefault is 0 or this mode "
|
||||
"disabled(comparator enabled throughout). 1 enables mode. 0 disables "
|
||||
"mode. ");
|
||||
|
||||
TIME_COMMAND(comp_disable_time, getComparatorDisableTime,
|
||||
TIME_COMMAND(compdisabletime, getComparatorDisableTime,
|
||||
setComparatorDisableTime,
|
||||
"[duration] [(optional unit) ns|us|ms|s]\n\t[Jungfrau] Time "
|
||||
"before end of exposure when comparator is disabled. It is "
|
||||
"only possible for chipv1.1.");
|
||||
|
||||
INTEGER_COMMAND_SET_NOID_GET_ID(
|
||||
storagecells, getNumberOfAdditionalStorageCells,
|
||||
extrastoragecells, getNumberOfAdditionalStorageCells,
|
||||
setNumberOfAdditionalStorageCells, StringTo<int>,
|
||||
"[0-15]\n\t[Jungfrau] Only for chipv1.0. Number of additional storage "
|
||||
"cells. Default is "
|
||||
"0. For advanced users only. \n\tThe #images = #frames x #triggers x "
|
||||
"(#storagecells + 1).");
|
||||
"(#extrastoragecells + 1).");
|
||||
|
||||
INTEGER_COMMAND_VEC_ID(
|
||||
storagecell_start, getStorageCellStart, setStorageCellStart,
|
||||
@ -1951,8 +1955,8 @@ class CmdProxy {
|
||||
"Jungfrau] Gain mode.\n\tCAUTION: Do not use fixg0 without caution, "
|
||||
"you can damage the detector!!!");
|
||||
|
||||
INTEGER_COMMAND_VEC_ID(filtercell, getFilterCell, setFilterCell,
|
||||
sls::StringTo<int>,
|
||||
INTEGER_COMMAND_VEC_ID(filtercells, getNumberOfFilterCells,
|
||||
setNumberOfFilterCells, sls::StringTo<int>,
|
||||
"[0-12]\n\t[Jungfrau] Set Filter Cell. Only for "
|
||||
"chipv1.1. Advanced user Command");
|
||||
|
||||
|
@ -1582,12 +1582,12 @@ void Detector::setGainMode(const defs::gainMode mode, Positions pos) {
|
||||
pimpl->Parallel(&Module::setGainMode, pos, mode);
|
||||
}
|
||||
|
||||
Result<int> Detector::getFilterCell(Positions pos) const {
|
||||
return pimpl->Parallel(&Module::getFilterCell, pos);
|
||||
Result<int> Detector::getNumberOfFilterCells(Positions pos) const {
|
||||
return pimpl->Parallel(&Module::getNumberOfFilterCells, pos);
|
||||
}
|
||||
|
||||
void Detector::setFilterCell(int cell, Positions pos) {
|
||||
pimpl->Parallel(&Module::setFilterCell, pos, cell);
|
||||
void Detector::setNumberOfFilterCells(int cell, Positions pos) {
|
||||
pimpl->Parallel(&Module::setNumberOfFilterCells, pos, cell);
|
||||
}
|
||||
|
||||
// Gotthard Specific
|
||||
@ -2161,7 +2161,9 @@ void Detector::resetFPGA(Positions pos) {
|
||||
void Detector::copyDetectorServer(const std::string &fname,
|
||||
const std::string &hostname, Positions pos) {
|
||||
pimpl->Parallel(&Module::copyDetectorServer, pos, fname, hostname);
|
||||
rebootController(pos);
|
||||
if (getDetectorType().squash() != defs::EIGER) {
|
||||
rebootController(pos);
|
||||
}
|
||||
}
|
||||
|
||||
void Detector::rebootController(Positions pos) {
|
||||
|
@ -1855,12 +1855,12 @@ void Module::setGainMode(const slsDetectorDefs::gainMode mode) {
|
||||
sendToDetector(F_SET_GAIN_MODE, mode, nullptr);
|
||||
}
|
||||
|
||||
int Module::getFilterCell() const {
|
||||
return sendToDetector<int>(F_GET_FILTER_CELL);
|
||||
int Module::getNumberOfFilterCells() const {
|
||||
return sendToDetector<int>(F_GET_NUM_FILTER_CELLS);
|
||||
}
|
||||
|
||||
void Module::setFilterCell(int value) {
|
||||
sendToDetector(F_SET_FILTER_CELL, value, nullptr);
|
||||
void Module::setNumberOfFilterCells(int value) {
|
||||
sendToDetector(F_SET_NUM_FILTER_CELLS, value, nullptr);
|
||||
}
|
||||
|
||||
// Gotthard Specific
|
||||
|
@ -395,8 +395,8 @@ class Module : public virtual slsDetectorDefs {
|
||||
void setStorageCellDelay(int64_t value);
|
||||
gainMode getGainMode() const;
|
||||
void setGainMode(const gainMode mode);
|
||||
int getFilterCell() const;
|
||||
void setFilterCell(int value);
|
||||
int getNumberOfFilterCells() const;
|
||||
void setNumberOfFilterCells(int value);
|
||||
|
||||
/**************************************************
|
||||
* *
|
||||
|
@ -255,7 +255,7 @@ TEST_CASE("temp_event", "[.cmd]") {
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("auto_comp_disable", "[.cmd]") {
|
||||
TEST_CASE("autocompdisable", "[.cmd]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
@ -263,29 +263,29 @@ TEST_CASE("auto_comp_disable", "[.cmd]") {
|
||||
auto prev_val = det.getAutoComparatorDisable();
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("auto_comp_disable", {"0"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "auto_comp_disable 0\n");
|
||||
proxy.Call("autocompdisable", {"0"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "autocompdisable 0\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("auto_comp_disable", {"1"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "auto_comp_disable 1\n");
|
||||
proxy.Call("autocompdisable", {"1"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "autocompdisable 1\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("auto_comp_disable", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "auto_comp_disable 1\n");
|
||||
proxy.Call("autocompdisable", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "autocompdisable 1\n");
|
||||
}
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setAutoComparatorDisable(prev_val[i], {i});
|
||||
}
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("auto_comp_disable", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("auto_comp_disable", {"0"}, -1, PUT));
|
||||
REQUIRE_THROWS(proxy.Call("autocompdisable", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("autocompdisable", {"0"}, -1, PUT));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("comp_disable_time", "[.cmd]") {
|
||||
TEST_CASE("compdisabletime", "[.cmd]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
@ -294,29 +294,29 @@ TEST_CASE("comp_disable_time", "[.cmd]") {
|
||||
auto prev_val = det.getComparatorDisableTime();
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("comp_disable_time", {"125ns"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "comp_disable_time 125ns\n");
|
||||
proxy.Call("compdisabletime", {"125ns"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "compdisabletime 125ns\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("comp_disable_time", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "comp_disable_time 125ns\n");
|
||||
proxy.Call("compdisabletime", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "compdisabletime 125ns\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("comp_disable_time", {"0"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "comp_disable_time 0\n");
|
||||
proxy.Call("compdisabletime", {"0"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "compdisabletime 0\n");
|
||||
}
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setComparatorDisableTime(prev_val[i], {i});
|
||||
}
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("comp_disable_time", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("comp_disable_time", {"0"}, -1, PUT));
|
||||
REQUIRE_THROWS(proxy.Call("compdisabletime", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("compdisabletime", {"0"}, -1, PUT));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("storagecells", "[.cmd]") {
|
||||
TEST_CASE("extrastoragecells", "[.cmd]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
@ -327,35 +327,35 @@ TEST_CASE("storagecells", "[.cmd]") {
|
||||
"inconsistent #additional storage cells to test");
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("storagecells", {"1"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "storagecells 1\n");
|
||||
proxy.Call("extrastoragecells", {"1"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "extrastoragecells 1\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("storagecells", {"15"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "storagecells 15\n");
|
||||
proxy.Call("extrastoragecells", {"15"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "extrastoragecells 15\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("storagecells", {"0"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "storagecells 0\n");
|
||||
proxy.Call("extrastoragecells", {"0"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "extrastoragecells 0\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("storagecells", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "storagecells 0\n");
|
||||
proxy.Call("extrastoragecells", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "extrastoragecells 0\n");
|
||||
}
|
||||
REQUIRE_THROWS(proxy.Call("storagecells", {"16"}, -1, PUT));
|
||||
REQUIRE_THROWS(proxy.Call("extrastoragecells", {"16"}, -1, PUT));
|
||||
det.setNumberOfAdditionalStorageCells(prev_val);
|
||||
}
|
||||
// chip version 1.1
|
||||
else {
|
||||
// cannot set number of addl. storage cells
|
||||
REQUIRE_THROWS(proxy.Call("storagecells", {"1"}, -1, PUT));
|
||||
REQUIRE_THROWS(proxy.Call("extrastoragecells", {"1"}, -1, PUT));
|
||||
}
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("storagecells", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("storagecells", {"0"}, -1, PUT));
|
||||
REQUIRE_THROWS(proxy.Call("extrastoragecells", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("extrastoragecells", {"0"}, -1, PUT));
|
||||
}
|
||||
}
|
||||
|
||||
@ -494,47 +494,47 @@ TEST_CASE("gainmode", "[.cmd]") {
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("filtercell", "[.cmd]") {
|
||||
TEST_CASE("filtercells", "[.cmd]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
if (det_type == defs::JUNGFRAU) {
|
||||
// chip version 1.1
|
||||
if (det.getChipVersion().squash() * 10 == 11) {
|
||||
auto prev_val = det.getFilterCell();
|
||||
auto prev_val = det.getNumberOfFilterCells();
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("filtercell", {"1"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "filtercell 1\n");
|
||||
proxy.Call("filtercells", {"1"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "filtercells 1\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("filtercell", {"12"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "filtercell 12\n");
|
||||
proxy.Call("filtercells", {"12"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "filtercells 12\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("filtercell", {"0"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "filtercell 0\n");
|
||||
proxy.Call("filtercells", {"0"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "filtercells 0\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("filtercell", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "filtercell 0\n");
|
||||
proxy.Call("filtercells", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "filtercells 0\n");
|
||||
}
|
||||
REQUIRE_THROWS(proxy.Call("filtercell", {"13"}, -1, PUT));
|
||||
REQUIRE_THROWS(proxy.Call("filtercells", {"13"}, -1, PUT));
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setFilterCell(prev_val[i], {i});
|
||||
det.setNumberOfFilterCells(prev_val[i], {i});
|
||||
}
|
||||
}
|
||||
// chip version 1.0
|
||||
else {
|
||||
// cannot set/get filter cell
|
||||
REQUIRE_THROWS(proxy.Call("filtercell", {"1"}, -1, PUT));
|
||||
REQUIRE_THROWS(proxy.Call("filtercell", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("filtercells", {"1"}, -1, PUT));
|
||||
REQUIRE_THROWS(proxy.Call("filtercells", {}, -1, GET));
|
||||
}
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("filtercell", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("filtercell", {"0"}, -1, PUT));
|
||||
REQUIRE_THROWS(proxy.Call("filtercells", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("filtercells", {"0"}, -1, PUT));
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user