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 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. Default is 0 or this mode disabled (comparator enabled throughout). 1 enables mode. 0 disables mode.
""" """
return self.getAutoComparatorDisable() return self.getAutoComparatorDisable()
@ -2586,8 +2586,6 @@ class Detector(CppDetectorApi):
Note Note
----- -----
It is only possible for chipv1.1.
:getter: always returns in seconds. To get in DurationWrapper, use getComparatorDisableTime :getter: always returns in seconds. To get in DurationWrapper, use getComparatorDisableTime
Example Example
@ -2917,7 +2915,7 @@ class Detector(CppDetectorApi):
@property @property
@element @element
def timing_info_decoder(self): 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 Enum: timingInfoDecoder
""" """
return self.getTimingInfoDecoder() return self.getTimingInfoDecoder()

View File

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

View File

@ -468,7 +468,7 @@ subdeadtime:
function: setSubDeadTime function: setSubDeadTime
compdisabletime: 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 inherit_actions: TIME_COMMAND
actions: actions:
GET: GET:
@ -1123,7 +1123,7 @@ temp_control:
input_types: [ bool ] input_types: [ bool ]
autocompdisable: 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 inherit_actions: INTEGER_COMMAND_VEC_ID
actions: actions:
GET: GET:
@ -1210,7 +1210,7 @@ polarity:
input_types: [ defs::polarity ] input_types: [ defs::polarity ]
timing_info_decoder: 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 inherit_actions: INTEGER_COMMAND_VEC_ID
actions: actions:
GET: GET:

View File

@ -762,10 +762,9 @@ autocompdisable:
function_alias: autocompdisable function_alias: autocompdisable
help: "[0, 1]\n\t[Jungfrau] Auto comparator disable mode. By default, the on-chip\ 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\ \ 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)\ \ - chip gain switching comparator automatically and the duration is set using\
\ of exposure time (only for longer than 100us). It is possible to set the duration\ \ compdisabletime command.\n\tDefault is 0 or this mode disabled(comparator enabled\
\ for chipv1.1 using compdisabletime command.\n\tDefault is 0 or this mode disabled(comparator\ \ throughout). 1 enables mode. 0 disables mode. "
\ enabled throughout). 1 enables mode. 0 disables mode. "
infer_action: true infer_action: true
template: true template: true
badchannels: badchannels:
@ -1607,7 +1606,7 @@ compdisabletime:
command_name: compdisabletime command_name: compdisabletime
function_alias: compdisabletime function_alias: compdisabletime
help: "[duration] [(optional unit) ns|us|ms|s]\n\t[Jungfrau] Time before end of\ 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 infer_action: true
template: true template: true
confadc: confadc:
@ -11386,7 +11385,8 @@ timing_info_decoder:
command_name: timing_info_decoder command_name: timing_info_decoder
function_alias: timing_info_decoder function_alias: timing_info_decoder
help: "[swissfel|shine]\n\t[Jungfrau] Advanced Command and only for Swissfel and\ 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 infer_action: true
template: true template: true
timinglist: timinglist:

View File

@ -1309,11 +1309,9 @@ class Detector {
* //TODO naming * //TODO naming
* By default, the on-chip gain switching is active during the * By default, the on-chip gain switching is active during the
* entire exposure. This mode disables the on-chip gain switching comparator * entire exposure. This mode disables the on-chip gain switching comparator
* automatically after 93.75% of exposure time (only for longer than 100us). * automatically and the duration is set using setComparatorDisableTime\n
* The % is for chipv1.0. One can set the duration for chipv1.1 using * Default is false or this mode disabled(comparator enabled throughout).
* setComparatorDisableTime\n Default is false or this mode * true enables mode. 0 disables mode.
* disabled(comparator enabled throughout). true enables mode. 0 disables
* mode.
*/ */
void setAutoComparatorDisable(bool value, Positions pos = {}); void setAutoComparatorDisable(bool value, Positions pos = {});
@ -1321,7 +1319,7 @@ class Detector {
Result<ns> getComparatorDisableTime(Positions pos = {}) const; Result<ns> getComparatorDisableTime(Positions pos = {}) const;
/** [Jungfrau] Time before end of exposure when comparator is /** [Jungfrau] Time before end of exposure when comparator is
* disabled. It is only possible for chipv1.1.*/ * disabled.*/
void setComparatorDisableTime(ns t, Positions pos = {}); void setComparatorDisableTime(ns t, Positions pos = {});
/** [Jungfrau] Advanced TODO naming */ /** [Jungfrau] Advanced TODO naming */
@ -1387,7 +1385,7 @@ class Detector {
Result<defs::timingInfoDecoder> Result<defs::timingInfoDecoder>
getTimingInfoDecoder(Positions pos = {}) const; getTimingInfoDecoder(Positions pos = {}) const;
/** [Jungfrau] Advanced Command! */ /** [Jungfrau] Advanced Command! Only for pcb v2.0 */
void setTimingInfoDecoder(defs::timingInfoDecoder value, void setTimingInfoDecoder(defs::timingInfoDecoder value,
Positions pos = {}); Positions pos = {});

View File

@ -1018,7 +1018,7 @@ std::string Caller::autocompdisable(int action) {
// print help // print help
if (action == slsDetectorDefs::HELP_ACTION) { if (action == slsDetectorDefs::HELP_ACTION) {
os << R"V0G0N([0, 1] 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" Default is 0 or this mode disabled(comparator enabled throughout). 1 enables mode. 0 disables mode. )V0G0N"
<< std::endl; << std::endl;
return os.str(); return os.str();
@ -2108,7 +2108,7 @@ std::string Caller::compdisabletime(int action) {
// print help // print help
if (action == slsDetectorDefs::HELP_ACTION) { if (action == slsDetectorDefs::HELP_ACTION) {
os << R"V0G0N([duration] [(optional unit) ns|us|ms|s] 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; << std::endl;
return os.str(); return os.str();
} }
@ -14655,7 +14655,7 @@ std::string Caller::timing_info_decoder(int action) {
// print help // print help
if (action == slsDetectorDefs::HELP_ACTION) { if (action == slsDetectorDefs::HELP_ACTION) {
os << R"V0G0N([swissfel|shine] 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; << std::endl;
return os.str(); return os.str();
} }

View File

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

View File

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