dev jf : bunch id decoder and auto comp disable (#1097)

* jf wip: bunch id decoder only in pcb v2.0 check and comments

* auto comp disable the same way for both chip versions. compdisabletime also available for 1.1 now

* fixed tests

* formatting

* binary in
This commit is contained in:
maliakal_d 2025-02-18 11:17:38 +01:00 committed by GitHub
parent 6b149244d3
commit f1f369b48c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 41 additions and 53 deletions

View File

@ -2570,7 +2570,7 @@ class Detector(CppDetectorApi):
Note
-----
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 only for chipv1.0, the duration can be set for chipv1.1.\n
By default, the on-chip gain switching is active during the entire exposure. This mode disables the on-chip gain switching comparator automatically and the duration is set using compdisabletime.\n
Default is 0 or this mode disabled (comparator enabled throughout). 1 enables mode. 0 disables mode.
"""
return self.getAutoComparatorDisable()
@ -2586,8 +2586,6 @@ class Detector(CppDetectorApi):
Note
-----
It is only possible for chipv1.1.
:getter: always returns in seconds. To get in DurationWrapper, use getComparatorDisableTime
Example
@ -2917,7 +2915,7 @@ class Detector(CppDetectorApi):
@property
@element
def timing_info_decoder(self):
"""[Jungfrau] [Jungfrau] Advanced Command and only for SWISSFEL and SHINE. Sets the bunch id or timing info decoder. Default is SWISSFEL.
"""[Jungfrau] [Jungfrau] Advanced Command and only for SWISSFEL and SHINE. Sets the bunch id or timing info decoder. Default is SWISSFEL. Only allowed for pcbv2.0.
Enum: timingInfoDecoder
"""
return self.getTimingInfoDecoder()

View File

@ -9098,16 +9098,9 @@ int get_comp_disable_time(int file_des) {
functionNotImplemented();
#else
// get only
if (getChipVersion() != 11) {
ret = FAIL;
strcpy(mess,
"Cannot get comparator disable time. Only valid for chipv1.1\n");
LOG(logERROR, (mess));
} else {
retval = getComparatorDisableTime();
LOG(logDEBUG1,
("retval comp disable time %lld ns\n", (long long int)retval));
}
retval = getComparatorDisableTime();
LOG(logDEBUG1,
("retval comp disable time %lld ns\n", (long long int)retval));
#endif
return Server_SendResult(file_des, INT64, &retval, sizeof(retval));
}
@ -9125,23 +9118,16 @@ int set_comp_disable_time(int file_des) {
#else
// only set
if (Server_VerifyLock() == OK) {
if (getChipVersion() != 11) {
ret = FAIL;
strcpy(mess, "Cannot get comparator disable time. Only valid for "
"chipv1.1\n");
ret = setComparatorDisableTime(arg);
int64_t retval = getComparatorDisableTime();
LOG(logDEBUG1,
("retval get comp disable time %lld ns\n", (long long int)retval));
if (ret == FAIL) {
sprintf(mess,
"Could not set comp disable time. Set %lld ns, read "
"%lld ns.\n",
(long long int)arg, (long long int)retval);
LOG(logERROR, (mess));
} else {
ret = setComparatorDisableTime(arg);
int64_t retval = getComparatorDisableTime();
LOG(logDEBUG1, ("retval get comp disable time %lld ns\n",
(long long int)retval));
if (ret == FAIL) {
sprintf(mess,
"Could not set comp disable time. Set %lld ns, read "
"%lld ns.\n",
(long long int)arg, (long long int)retval);
LOG(logERROR, (mess));
}
}
}
#endif
@ -11144,6 +11130,12 @@ int set_timing_info_decoder(int file_des) {
modeNotImplemented("Timing info decoder index", (int)arg);
break;
}
if (ret == OK && isHardwareVersion_1_0()) {
ret = FAIL;
sprintf(mess, "Could not set timing info decoder. Not supported "
"for hardware version 1.0\n");
LOG(logERROR, (mess));
}
if (ret == OK) {
ret = setTimingInfoDecoder(arg);
if (ret == FAIL) {

View File

@ -468,7 +468,7 @@ subdeadtime:
function: setSubDeadTime
compdisabletime:
help: "[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."
help: "[duration] [(optional unit) ns|us|ms|s]\n\t[Jungfrau] Time before end of exposure when comparator is disabled."
inherit_actions: TIME_COMMAND
actions:
GET:
@ -1123,7 +1123,7 @@ temp_control:
input_types: [ bool ]
autocompdisable:
help: "[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 compdisabletime command.\n\tDefault is 0 or this mode disabled(comparator enabled throughout). 1 enables mode. 0 disables mode. "
help: "[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 and the duration is set using compdisabletime command.\n\tDefault is 0 or this mode disabled(comparator enabled throughout). 1 enables mode. 0 disables mode. "
inherit_actions: INTEGER_COMMAND_VEC_ID
actions:
GET:
@ -1210,7 +1210,7 @@ polarity:
input_types: [ defs::polarity ]
timing_info_decoder:
help: "[swissfel|shine]\n\t[Jungfrau] Advanced Command and only for Swissfel and Shine. Sets the bunch id or timing info decoder. Default is swissfel."
help: "[swissfel|shine]\n\t[Jungfrau] Advanced Command and only for Swissfel and Shine. Sets the bunch id or timing info decoder. Default is swissfel. Only allowed for pcbv2.0."
inherit_actions: INTEGER_COMMAND_VEC_ID
actions:
GET:

View File

@ -762,10 +762,9 @@ autocompdisable:
function_alias: autocompdisable
help: "[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 compdisabletime command.\n\tDefault is 0 or this mode disabled(comparator\
\ enabled throughout). 1 enables mode. 0 disables mode. "
\ - chip gain switching comparator automatically and the duration is set using\
\ compdisabletime command.\n\tDefault is 0 or this mode disabled(comparator enabled\
\ throughout). 1 enables mode. 0 disables mode. "
infer_action: true
template: true
badchannels:
@ -1607,7 +1606,7 @@ compdisabletime:
command_name: compdisabletime
function_alias: compdisabletime
help: "[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."
\ exposure when comparator is disabled."
infer_action: true
template: true
confadc:
@ -11386,7 +11385,8 @@ timing_info_decoder:
command_name: timing_info_decoder
function_alias: timing_info_decoder
help: "[swissfel|shine]\n\t[Jungfrau] Advanced Command and only for Swissfel and\
\ Shine. Sets the bunch id or timing info decoder. Default is swissfel."
\ Shine. Sets the bunch id or timing info decoder. Default is swissfel. Only allowed\
\ for pcbv2.0."
infer_action: true
template: true
timinglist:

View File

@ -1309,11 +1309,9 @@ class Detector {
* //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).
* 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.
* automatically and the duration is set using setComparatorDisableTime\n
* Default is false or this mode disabled(comparator enabled throughout).
* true enables mode. 0 disables mode.
*/
void setAutoComparatorDisable(bool value, Positions pos = {});
@ -1321,7 +1319,7 @@ class Detector {
Result<ns> getComparatorDisableTime(Positions pos = {}) const;
/** [Jungfrau] Time before end of exposure when comparator is
* disabled. It is only possible for chipv1.1.*/
* disabled.*/
void setComparatorDisableTime(ns t, Positions pos = {});
/** [Jungfrau] Advanced TODO naming */
@ -1387,7 +1385,7 @@ class Detector {
Result<defs::timingInfoDecoder>
getTimingInfoDecoder(Positions pos = {}) const;
/** [Jungfrau] Advanced Command! */
/** [Jungfrau] Advanced Command! Only for pcb v2.0 */
void setTimingInfoDecoder(defs::timingInfoDecoder value,
Positions pos = {});

View File

@ -1018,7 +1018,7 @@ std::string Caller::autocompdisable(int action) {
// print help
if (action == slsDetectorDefs::HELP_ACTION) {
os << R"V0G0N([0, 1]
[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 compdisabletime command.
[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 and the duration is set using compdisabletime command.
Default is 0 or this mode disabled(comparator enabled throughout). 1 enables mode. 0 disables mode. )V0G0N"
<< std::endl;
return os.str();
@ -2108,7 +2108,7 @@ std::string Caller::compdisabletime(int action) {
// print help
if (action == slsDetectorDefs::HELP_ACTION) {
os << R"V0G0N([duration] [(optional unit) ns|us|ms|s]
[Jungfrau] Time before end of exposure when comparator is disabled. It is only possible for chipv1.1. )V0G0N"
[Jungfrau] Time before end of exposure when comparator is disabled. )V0G0N"
<< std::endl;
return os.str();
}
@ -14655,7 +14655,7 @@ std::string Caller::timing_info_decoder(int action) {
// print help
if (action == slsDetectorDefs::HELP_ACTION) {
os << R"V0G0N([swissfel|shine]
[Jungfrau] Advanced Command and only for Swissfel and Shine. Sets the bunch id or timing info decoder. Default is swissfel. )V0G0N"
[Jungfrau] Advanced Command and only for Swissfel and Shine. Sets the bunch id or timing info decoder. Default is swissfel. Only allowed for pcbv2.0. )V0G0N"
<< std::endl;
return os.str();
}

View File

@ -262,8 +262,7 @@ TEST_CASE("compdisabletime", "[.cmdcall]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
if (det_type == defs::JUNGFRAU &&
det.getChipVersion().squash() * 10 == 11) {
if (det_type == defs::JUNGFRAU) {
auto prev_val = det.getComparatorDisableTime();
{
std::ostringstream oss;
@ -670,7 +669,8 @@ TEST_CASE("pedestalmode", "[.cmdcall]") {
TEST_CASE("timing_info_decoder", "[.cmdcall]") {
Detector det;
Caller caller(&det);
if (det.getDetectorType().squash() == defs::JUNGFRAU) {
if (det.getDetectorType().squash() == defs::JUNGFRAU &&
det.getHardwareVersion().squash() == "2.0") {
auto prev_val = det.getTimingInfoDecoder();
/*{
std::ostringstream oss;

View File

@ -5,9 +5,9 @@
#define APIGOTTHARD2 "developer 0x241107"
#define APIMOENCH "developer 0x241107"
#define APIEIGER "developer 0x241107"
#define APIJUNGFRAU "developer 0x241120"
#define APILIB "developer 0x241122"
#define APIRECEIVER "developer 0x241122"
#define APIXILINXCTB "developer 0x250131"
#define APICTB "developer 0x250131"
#define APIMYTHEN3 "developer 0x250131"
#define APIJUNGFRAU "developer 0x250218"