mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-23 18:17:59 +02:00
jungfrau: comp disable time
This commit is contained in:
@ -1131,15 +1131,23 @@ class Detector {
|
||||
|
||||
/** [Jungfrau] Advanced
|
||||
* //TODO naming
|
||||
* 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% of exposure time (only for longer than
|
||||
* 100us).\n
|
||||
* Default is false or this mode disabled(comparator enabled throughout).
|
||||
* true enables mode. 0 disables 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% of exposure time (only for longer than 100us).
|
||||
* The % is for chipv1.0. One can set the duration for chipv1.1 using
|
||||
* setComparatorDisableTime\n Default is false or this mode
|
||||
* disabled(comparator enabled throughout). true enables mode. 0 disables
|
||||
* mode.
|
||||
*/
|
||||
void setAutoCompDisable(bool value, Positions pos = {});
|
||||
|
||||
/** [Jungfrau] */
|
||||
Result<ns> getComparatorDisableTime(Positions pos = {}) const;
|
||||
|
||||
/** [Jungfrau] Time before end of exposure when comparator is disabled. It
|
||||
* is only possible for chipv1.1.*/
|
||||
void setComparatorDisableTime(ns t, Positions pos = {});
|
||||
|
||||
/** [Jungfrau] Advanced TODO naming */
|
||||
Result<int> getNumberOfAdditionalStorageCells(Positions pos = {}) const;
|
||||
|
||||
|
@ -1729,37 +1729,6 @@ std::string CmdProxy::TemperatureEvent(int action) {
|
||||
return os.str();
|
||||
}
|
||||
|
||||
std::string AutoComparatorDisable(const int action) {
|
||||
std::ostringstream os;
|
||||
os << cmd << ' ';
|
||||
if (action == slsDetectorDefs::HELP_ACTION)
|
||||
os << "[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% of exposure time (only "
|
||||
"for longer than 100us). \n\tDefault is 0 or this mode "
|
||||
"disabled(comparator enabled throughout). 1 enables mode. 0 "
|
||||
"disables mode."
|
||||
<< '\n';
|
||||
else if (action == slsDetectorDefs::GET_ACTION) {
|
||||
if (!args.empty()) {
|
||||
WrongNumberOfParameters(0);
|
||||
}
|
||||
auto t = det->GETFCN(std::vector<int>{det_id});
|
||||
os << OutString(t) << '\n';
|
||||
} else if (action == slsDetectorDefs::PUT_ACTION) {
|
||||
if (args.size() != 1) {
|
||||
WrongNumberOfParameters(1);
|
||||
}
|
||||
auto val = CONV(args[0]);
|
||||
det->SETFCN(val, std::vector<int>{det_id});
|
||||
os << args.front() << '\n';
|
||||
} else {
|
||||
throw sls::RuntimeError("Unknown action");
|
||||
}
|
||||
return os.str();
|
||||
}
|
||||
|
||||
/* Gotthard Specific */
|
||||
|
||||
std::string CmdProxy::ROI(int action) {
|
||||
|
@ -925,7 +925,8 @@ class CmdProxy {
|
||||
{"temp_threshold", &CmdProxy::temp_threshold},
|
||||
{"temp_control", &CmdProxy::temp_control},
|
||||
{"temp_event", &CmdProxy::TemperatureEvent},
|
||||
{"auto_comp_disable", &CmdProxy::AutoComparatorDisable},
|
||||
{"auto_comp_disable", &CmdProxy::auto_comp_disable},
|
||||
{"comp_disable_time", &CmdProxy::comp_disable_time},
|
||||
{"storagecells", &CmdProxy::storagecells},
|
||||
{"storagecell_start", &CmdProxy::storagecell_start},
|
||||
{"storagecell_delay", &CmdProxy::storagecell_delay},
|
||||
@ -1123,7 +1124,6 @@ class CmdProxy {
|
||||
std::string DataStream(int action);
|
||||
/* Jungfrau Specific */
|
||||
std::string TemperatureEvent(int action);
|
||||
std::string AutoComparatorDisable(int action);
|
||||
/* Gotthard Specific */
|
||||
std::string ROI(int action);
|
||||
std::string ClearROI(int action);
|
||||
@ -1837,6 +1837,24 @@ class CmdProxy {
|
||||
"to be less than threshold temperature and temperature event has to be "
|
||||
"cleared.");
|
||||
|
||||
INTEGER_COMMAND_VEC_ID(
|
||||
auto_comp_disable, getAutoCompDisable, setAutoCompDisable,
|
||||
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 "
|
||||
"disabled(comparator enabled throughout). 1 enables mode. 0 disables "
|
||||
"mode. ");
|
||||
|
||||
TIME_COMMAND(comp_disable_time, 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,
|
||||
setNumberOfAdditionalStorageCells, StringTo<int>,
|
||||
|
@ -1459,6 +1459,14 @@ void Detector::setAutoCompDisable(bool value, Positions pos) {
|
||||
pimpl->Parallel(&Module::setAutoComparatorDisableMode, pos, value);
|
||||
}
|
||||
|
||||
Result<ns> Detector::getComparatorDisableTime(Positions pos) const {
|
||||
return pimpl->Parallel(&Module::getComparatorDisableTime, pos);
|
||||
}
|
||||
|
||||
void Detector::setComparatorDisableTime(ns t, Positions pos) {
|
||||
pimpl->Parallel(&Module::setComparatorDisableTime, pos, t.count());
|
||||
}
|
||||
|
||||
Result<int> Detector::getNumberOfAdditionalStorageCells(Positions pos) const {
|
||||
return pimpl->Parallel(&Module::getNumberOfAdditionalStorageCells, pos);
|
||||
}
|
||||
|
@ -1577,6 +1577,14 @@ void Module::setAutoComparatorDisableMode(bool val) {
|
||||
sendToDetector<int>(F_AUTO_COMP_DISABLE, static_cast<int>(val));
|
||||
}
|
||||
|
||||
int64_t Module::getComparatorDisableTime() const {
|
||||
return sendToDetector<int64_t>(F_GET_COMP_DISABLE_TIME);
|
||||
}
|
||||
|
||||
void Module::setComparatorDisableTime(int64_t value) {
|
||||
sendToDetector(F_SET_COMP_DISABLE_TIME, value, nullptr);
|
||||
}
|
||||
|
||||
int Module::getNumberOfAdditionalStorageCells() const {
|
||||
return sendToDetector<int>(F_GET_NUM_ADDITIONAL_STORAGE_CELLS);
|
||||
}
|
||||
|
@ -363,6 +363,8 @@ class Module : public virtual slsDetectorDefs {
|
||||
void resetTemperatureEvent();
|
||||
bool getAutoComparatorDisableMode() const;
|
||||
void setAutoComparatorDisableMode(bool val);
|
||||
int64_t getComparatorDisableTime() const;
|
||||
void setComparatorDisableTime(int64_t value);
|
||||
int getNumberOfAdditionalStorageCells() const;
|
||||
void setNumberOfAdditionalStorageCells(int value);
|
||||
int getStorageCellStart() const;
|
||||
|
@ -283,6 +283,36 @@ TEST_CASE("auto_comp_disable", "[.cmd]") {
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("comp_disable_time", "[.cmd]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
if (det_type == defs::JUNGFRAU) {
|
||||
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");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("comp_disable_time", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "comp_disable_time 125ns\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("comp_disable_time", {"0"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "comp_disable_time 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));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("storagecells", "[.cmd]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
|
Reference in New Issue
Block a user