mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-21 19:30:03 +02:00
gotthard2: vetophoton now has gain thresholds for each row and the get writes to file gain indices and adu for each channel, adus written in dec instead of hex, veto file in server removed and uses vetophoton instead
This commit is contained in:
parent
df3ae7f409
commit
74a7ca9b71
129
examples/gotthard2_veto_file.txt
Normal file
129
examples/gotthard2_veto_file.txt
Normal file
@ -0,0 +1,129 @@
|
|||||||
|
#Gain index ADU value (12 bit)
|
||||||
|
1 3655
|
||||||
|
1 3655
|
||||||
|
1 3655
|
||||||
|
1 3655
|
||||||
|
1 3655
|
||||||
|
1 3655
|
||||||
|
1 3655
|
||||||
|
1 3655
|
||||||
|
1 3655
|
||||||
|
1 3655
|
||||||
|
1 3655
|
||||||
|
1 3655
|
||||||
|
1 3655
|
||||||
|
1 3655
|
||||||
|
1 3655
|
||||||
|
1 3655
|
||||||
|
1 3655
|
||||||
|
1 3655
|
||||||
|
1 3655
|
||||||
|
1 3655
|
||||||
|
1 3655
|
||||||
|
1 3655
|
||||||
|
1 3655
|
||||||
|
1 3655
|
||||||
|
1 3655
|
||||||
|
1 3655
|
||||||
|
1 3655
|
||||||
|
1 3655
|
||||||
|
1 3655
|
||||||
|
1 3655
|
||||||
|
1 3655
|
||||||
|
1 3655
|
||||||
|
1 3655
|
||||||
|
1 3655
|
||||||
|
1 3655
|
||||||
|
1 3655
|
||||||
|
1 3655
|
||||||
|
1 3655
|
||||||
|
1 3655
|
||||||
|
1 3655
|
||||||
|
1 3655
|
||||||
|
1 3655
|
||||||
|
1 3655
|
||||||
|
1 3655
|
||||||
|
1 3655
|
||||||
|
1 3655
|
||||||
|
1 3655
|
||||||
|
1 3655
|
||||||
|
1 3655
|
||||||
|
1 3655
|
||||||
|
1 3655
|
||||||
|
1 3655
|
||||||
|
1 3655
|
||||||
|
1 3655
|
||||||
|
1 3655
|
||||||
|
1 3655
|
||||||
|
1 3655
|
||||||
|
1 3655
|
||||||
|
1 3655
|
||||||
|
1 3655
|
||||||
|
1 3655
|
||||||
|
1 3655
|
||||||
|
1 3655
|
||||||
|
1 3655
|
||||||
|
1 3655
|
||||||
|
1 3655
|
||||||
|
1 3655
|
||||||
|
1 3655
|
||||||
|
1 3655
|
||||||
|
1 3655
|
||||||
|
1 3655
|
||||||
|
1 3655
|
||||||
|
1 3655
|
||||||
|
1 3655
|
||||||
|
1 3655
|
||||||
|
1 3655
|
||||||
|
1 3655
|
||||||
|
1 3655
|
||||||
|
1 3655
|
||||||
|
1 3655
|
||||||
|
1 3655
|
||||||
|
1 3655
|
||||||
|
1 3655
|
||||||
|
1 3655
|
||||||
|
1 3655
|
||||||
|
1 3655
|
||||||
|
1 3655
|
||||||
|
1 3655
|
||||||
|
1 3655
|
||||||
|
1 3655
|
||||||
|
1 3655
|
||||||
|
1 3655
|
||||||
|
1 3655
|
||||||
|
1 3655
|
||||||
|
1 3655
|
||||||
|
1 3655
|
||||||
|
1 3655
|
||||||
|
1 3655
|
||||||
|
1 3655
|
||||||
|
1 3655
|
||||||
|
1 3655
|
||||||
|
1 3655
|
||||||
|
1 3655
|
||||||
|
1 3655
|
||||||
|
1 3655
|
||||||
|
1 3655
|
||||||
|
1 3655
|
||||||
|
1 3655
|
||||||
|
1 3655
|
||||||
|
1 3655
|
||||||
|
1 3655
|
||||||
|
1 3655
|
||||||
|
1 3655
|
||||||
|
1 3655
|
||||||
|
1 3655
|
||||||
|
1 3655
|
||||||
|
1 3655
|
||||||
|
1 3655
|
||||||
|
1 3655
|
||||||
|
1 3655
|
||||||
|
1 3655
|
||||||
|
1 3655
|
||||||
|
1 3655
|
||||||
|
1 3655
|
||||||
|
1 3655
|
||||||
|
1 3655
|
||||||
|
1 3655
|
||||||
|
1 3655
|
@ -1,132 +1,129 @@
|
|||||||
#G1 Energy #G2 Energy
|
#G0 pedestal G1 pedestal G2 pedestal G0 gain G1 gain G2 gain #G1 Energy #G2 Energy
|
||||||
300 7000
|
100 100 100 10 1 0.1 300 7000
|
||||||
|
100 100 100 10 1 0.1 300 7000
|
||||||
#G0 pedestal G1 pedestal G2 pedestal G0 gain G1 gain G2 gain (for every channel) ADU
|
100 100 100 10 1 0.1 300 7000
|
||||||
100 100 100 10 1 0.1
|
100 100 100 10 1 0.1 300 7000
|
||||||
100 100 100 10 1 0.1
|
100 100 100 10 1 0.1 300 7000
|
||||||
100 100 100 10 1 0.1
|
100 100 100 10 1 0.1 300 7000
|
||||||
100 100 100 10 1 0.1
|
100 100 100 10 1 0.1 300 7000
|
||||||
100 100 100 10 1 0.1
|
100 100 100 10 1 0.1 300 7000
|
||||||
100 100 100 10 1 0.1
|
100 100 100 10 1 0.1 300 7000
|
||||||
100 100 100 10 1 0.1
|
100 100 100 10 1 0.1 300 7000
|
||||||
100 100 100 10 1 0.1
|
100 100 100 10 1 0.1 300 7000
|
||||||
100 100 100 10 1 0.1
|
100 100 100 10 1 0.1 300 7000
|
||||||
100 100 100 10 1 0.1
|
100 100 100 10 1 0.1 300 7000
|
||||||
100 100 100 10 1 0.1
|
100 100 100 10 1 0.1 300 7000
|
||||||
100 100 100 10 1 0.1
|
100 100 100 10 1 0.1 300 7000
|
||||||
100 100 100 10 1 0.1
|
100 100 100 10 1 0.1 300 7000
|
||||||
100 100 100 10 1 0.1
|
100 100 100 10 1 0.1 300 7000
|
||||||
100 100 100 10 1 0.1
|
100 100 100 10 1 0.1 300 7000
|
||||||
100 100 100 10 1 0.1
|
100 100 100 10 1 0.1 300 7000
|
||||||
100 100 100 10 1 0.1
|
100 100 100 10 1 0.1 300 7000
|
||||||
100 100 100 10 1 0.1
|
100 100 100 10 1 0.1 300 7000
|
||||||
100 100 100 10 1 0.1
|
100 100 100 10 1 0.1 300 7000
|
||||||
100 100 100 10 1 0.1
|
100 100 100 10 1 0.1 300 7000
|
||||||
100 100 100 10 1 0.1
|
100 100 100 10 1 0.1 300 7000
|
||||||
100 100 100 10 1 0.1
|
100 100 100 10 1 0.1 300 7000
|
||||||
100 100 100 10 1 0.1
|
100 100 100 10 1 0.1 300 7000
|
||||||
100 100 100 10 1 0.1
|
100 100 100 10 1 0.1 300 7000
|
||||||
100 100 100 10 1 0.1
|
100 100 100 10 1 0.1 300 7000
|
||||||
100 100 100 10 1 0.1
|
100 100 100 10 1 0.1 300 7000
|
||||||
100 100 100 10 1 0.1
|
100 100 100 10 1 0.1 300 7000
|
||||||
100 100 100 10 1 0.1
|
100 100 100 10 1 0.1 300 7000
|
||||||
100 100 100 10 1 0.1
|
100 100 100 10 1 0.1 300 7000
|
||||||
100 100 100 10 1 0.1
|
100 100 100 10 1 0.1 300 7000
|
||||||
100 100 100 10 1 0.1
|
100 100 100 10 1 0.1 300 7000
|
||||||
100 100 100 10 1 0.1
|
100 100 100 10 1 0.1 300 7000
|
||||||
100 100 100 10 1 0.1
|
100 100 100 10 1 0.1 300 7000
|
||||||
100 100 100 10 1 0.1
|
100 100 100 10 1 0.1 300 7000
|
||||||
100 100 100 10 1 0.1
|
100 100 100 10 1 0.1 300 7000
|
||||||
100 100 100 10 1 0.1
|
100 100 100 10 1 0.1 300 7000
|
||||||
100 100 100 10 1 0.1
|
100 100 100 10 1 0.1 300 7000
|
||||||
100 100 100 10 1 0.1
|
100 100 100 10 1 0.1 300 7000
|
||||||
100 100 100 10 1 0.1
|
100 100 100 10 1 0.1 300 7000
|
||||||
100 100 100 10 1 0.1
|
100 100 100 10 1 0.1 300 7000
|
||||||
100 100 100 10 1 0.1
|
100 100 100 10 1 0.1 300 7000
|
||||||
100 100 100 10 1 0.1
|
100 100 100 10 1 0.1 300 7000
|
||||||
100 100 100 10 1 0.1
|
100 100 100 10 1 0.1 300 7000
|
||||||
100 100 100 10 1 0.1
|
100 100 100 10 1 0.1 300 7000
|
||||||
100 100 100 10 1 0.1
|
100 100 100 10 1 0.1 300 7000
|
||||||
100 100 100 10 1 0.1
|
100 100 100 10 1 0.1 300 7000
|
||||||
100 100 100 10 1 0.1
|
100 100 100 10 1 0.1 300 7000
|
||||||
100 100 100 10 1 0.1
|
100 100 100 10 1 0.1 300 7000
|
||||||
100 100 100 10 1 0.1
|
100 100 100 10 1 0.1 300 7000
|
||||||
100 100 100 10 1 0.1
|
100 100 100 10 1 0.1 300 7000
|
||||||
100 100 100 10 1 0.1
|
100 100 100 10 1 0.1 300 7000
|
||||||
100 100 100 10 1 0.1
|
100 100 100 10 1 0.1 300 7000
|
||||||
100 100 100 10 1 0.1
|
100 100 100 10 1 0.1 300 7000
|
||||||
100 100 100 10 1 0.1
|
100 100 100 10 1 0.1 300 7000
|
||||||
100 100 100 10 1 0.1
|
100 100 100 10 1 0.1 300 7000
|
||||||
100 100 100 10 1 0.1
|
100 100 100 10 1 0.1 300 7000
|
||||||
100 100 100 10 1 0.1
|
100 100 100 10 1 0.1 300 7000
|
||||||
100 100 100 10 1 0.1
|
100 100 100 10 1 0.1 300 7000
|
||||||
100 100 100 10 1 0.1
|
100 100 100 10 1 0.1 300 7000
|
||||||
100 100 100 10 1 0.1
|
100 100 100 10 1 0.1 300 7000
|
||||||
100 100 100 10 1 0.1
|
100 100 100 10 1 0.1 300 7000
|
||||||
100 100 100 10 1 0.1
|
100 100 100 10 1 0.1 300 7000
|
||||||
100 100 100 10 1 0.1
|
100 100 100 10 1 0.1 300 7000
|
||||||
100 100 100 10 1 0.1
|
100 100 100 10 1 0.1 300 7000
|
||||||
100 100 100 10 1 0.1
|
100 100 100 10 1 0.1 300 7000
|
||||||
100 100 100 10 1 0.1
|
100 100 100 10 1 0.1 300 7000
|
||||||
100 100 100 10 1 0.1
|
100 100 100 10 1 0.1 300 7000
|
||||||
100 100 100 10 1 0.1
|
100 100 100 10 1 0.1 300 7000
|
||||||
100 100 100 10 1 0.1
|
100 100 100 10 1 0.1 300 7000
|
||||||
100 100 100 10 1 0.1
|
100 100 100 10 1 0.1 300 7000
|
||||||
100 100 100 10 1 0.1
|
100 100 100 10 1 0.1 300 7000
|
||||||
100 100 100 10 1 0.1
|
100 100 100 10 1 0.1 300 7000
|
||||||
100 100 100 10 1 0.1
|
100 100 100 10 1 0.1 300 7000
|
||||||
100 100 100 10 1 0.1
|
100 100 100 10 1 0.1 300 7000
|
||||||
100 100 100 10 1 0.1
|
100 100 100 10 1 0.1 300 7000
|
||||||
100 100 100 10 1 0.1
|
100 100 100 10 1 0.1 300 7000
|
||||||
100 100 100 10 1 0.1
|
100 100 100 10 1 0.1 300 7000
|
||||||
100 100 100 10 1 0.1
|
100 100 100 10 1 0.1 300 7000
|
||||||
100 100 100 10 1 0.1
|
100 100 100 10 1 0.1 300 7000
|
||||||
100 100 100 10 1 0.1
|
100 100 100 10 1 0.1 300 7000
|
||||||
100 100 100 10 1 0.1
|
100 100 100 10 1 0.1 300 7000
|
||||||
100 100 100 10 1 0.1
|
100 100 100 10 1 0.1 300 7000
|
||||||
100 100 100 10 1 0.1
|
100 100 100 10 1 0.1 300 7000
|
||||||
100 100 100 10 1 0.1
|
100 100 100 10 1 0.1 300 7000
|
||||||
100 100 100 10 1 0.1
|
100 100 100 10 1 0.1 300 7000
|
||||||
100 100 100 10 1 0.1
|
100 100 100 10 1 0.1 300 7000
|
||||||
100 100 100 10 1 0.1
|
100 100 100 10 1 0.1 300 7000
|
||||||
100 100 100 10 1 0.1
|
100 100 100 10 1 0.1 300 7000
|
||||||
100 100 100 10 1 0.1
|
100 100 100 10 1 0.1 300 7000
|
||||||
100 100 100 10 1 0.1
|
100 100 100 10 1 0.1 300 7000
|
||||||
100 100 100 10 1 0.1
|
100 100 100 10 1 0.1 300 7000
|
||||||
100 100 100 10 1 0.1
|
100 100 100 10 1 0.1 300 7000
|
||||||
100 100 100 10 1 0.1
|
100 100 100 10 1 0.1 300 7000
|
||||||
100 100 100 10 1 0.1
|
100 100 100 10 1 0.1 300 7000
|
||||||
100 100 100 10 1 0.1
|
100 100 100 10 1 0.1 300 7000
|
||||||
100 100 100 10 1 0.1
|
100 100 100 10 1 0.1 300 7000
|
||||||
100 100 100 10 1 0.1
|
100 100 100 10 1 0.1 300 7000
|
||||||
100 100 100 10 1 0.1
|
100 100 100 10 1 0.1 300 7000
|
||||||
100 100 100 10 1 0.1
|
100 100 100 10 1 0.1 300 7000
|
||||||
100 100 100 10 1 0.1
|
100 100 100 10 1 0.1 300 7000
|
||||||
100 100 100 10 1 0.1
|
100 100 100 10 1 0.1 300 7000
|
||||||
100 100 100 10 1 0.1
|
100 100 100 10 1 0.1 300 7000
|
||||||
100 100 100 10 1 0.1
|
100 100 100 10 1 0.1 300 7000
|
||||||
100 100 100 10 1 0.1
|
100 100 100 10 1 0.1 300 7000
|
||||||
100 100 100 10 1 0.1
|
100 100 100 10 1 0.1 300 7000
|
||||||
100 100 100 10 1 0.1
|
100 100 100 10 1 0.1 300 7000
|
||||||
100 100 100 10 1 0.1
|
100 100 100 10 1 0.1 300 7000
|
||||||
100 100 100 10 1 0.1
|
100 100 100 10 1 0.1 300 7000
|
||||||
100 100 100 10 1 0.1
|
100 100 100 10 1 0.1 300 7000
|
||||||
100 100 100 10 1 0.1
|
100 100 100 10 1 0.1 300 7000
|
||||||
100 100 100 10 1 0.1
|
100 100 100 10 1 0.1 300 7000
|
||||||
100 100 100 10 1 0.1
|
100 100 100 10 1 0.1 300 7000
|
||||||
100 100 100 10 1 0.1
|
100 100 100 10 1 0.1 300 7000
|
||||||
100 100 100 10 1 0.1
|
100 100 100 10 1 0.1 300 7000
|
||||||
100 100 100 10 1 0.1
|
100 100 100 10 1 0.1 300 7000
|
||||||
100 100 100 10 1 0.1
|
100 100 100 10 1 0.1 300 7000
|
||||||
100 100 100 10 1 0.1
|
100 100 100 10 1 0.1 300 7000
|
||||||
100 100 100 10 1 0.1
|
100 100 100 10 1 0.1 300 7000
|
||||||
100 100 100 10 1 0.1
|
100 100 100 10 1 0.1 300 7000
|
||||||
100 100 100 10 1 0.1
|
100 100 100 10 1 0.1 300 7000
|
||||||
100 100 100 10 1 0.1
|
100 100 100 10 1 0.1 300 7000
|
||||||
100 100 100 10 1 0.1
|
100 100 100 10 1 0.1 300 7000
|
||||||
100 100 100 10 1 0.1
|
100 100 100 10 1 0.1 300 7000
|
||||||
100 100 100 10 1 0.1
|
100 100 100 10 1 0.1 300 7000
|
||||||
100 100 100 10 1 0.1
|
100 100 100 10 1 0.1 300 7000
|
||||||
100 100 100 10 1 0.1
|
|
||||||
100 100 100 10 1 0.1
|
|
||||||
100 100 100 10 1 0.1
|
|
||||||
|
@ -50,6 +50,7 @@ int onChipdacValues[ONCHIP_NDAC][NCHIP] = {};
|
|||||||
int injectedChannelsOffset = 0;
|
int injectedChannelsOffset = 0;
|
||||||
int injectedChannelsIncrement = 0;
|
int injectedChannelsIncrement = 0;
|
||||||
int vetoReference[NCHIP][NCHAN];
|
int vetoReference[NCHIP][NCHAN];
|
||||||
|
int vetoGainIndices[NCHIP][NCHAN];
|
||||||
uint8_t adcConfiguration[NCHIP][NADC];
|
uint8_t adcConfiguration[NCHIP][NADC];
|
||||||
int burstMode = BURST_INTERNAL;
|
int burstMode = BURST_INTERNAL;
|
||||||
int64_t numTriggersReg = 1;
|
int64_t numTriggersReg = 1;
|
||||||
@ -387,6 +388,7 @@ void setupDetector() {
|
|||||||
for (int i = 0; i < NCHIP; ++i) {
|
for (int i = 0; i < NCHIP; ++i) {
|
||||||
for (int j = 0; j < NCHAN; ++j) {
|
for (int j = 0; j < NCHAN; ++j) {
|
||||||
vetoReference[i][j] = 0;
|
vetoReference[i][j] = 0;
|
||||||
|
vetoGainIndices[i][j] = 0;
|
||||||
}
|
}
|
||||||
for (int j = 0; j < NADC; ++j) {
|
for (int j = 0; j < NADC; ++j) {
|
||||||
adcConfiguration[i][j] = 0;
|
adcConfiguration[i][j] = 0;
|
||||||
@ -1786,49 +1788,23 @@ void getInjectedChannels(int *offset, int *increment) {
|
|||||||
int setVetoReference(int gainIndex, int value) {
|
int setVetoReference(int gainIndex, int value) {
|
||||||
LOG(logINFO, ("Setting veto reference [chip:-1, G%d, value:0x%x]\n",
|
LOG(logINFO, ("Setting veto reference [chip:-1, G%d, value:0x%x]\n",
|
||||||
gainIndex, value));
|
gainIndex, value));
|
||||||
int vals[NCHAN];
|
int values[NCHAN];
|
||||||
memset(vals, 0, sizeof(vals));
|
memset(values, 0, sizeof(values));
|
||||||
|
int gainIndices[NCHAN];
|
||||||
|
memset(gainIndices, 0, sizeof(gainIndices));
|
||||||
for (int ich = 0; ich < NCHAN; ++ich) {
|
for (int ich = 0; ich < NCHAN; ++ich) {
|
||||||
vals[ich] = value;
|
values[ich] = value;
|
||||||
|
gainIndices[ich] = gainIndex;
|
||||||
}
|
}
|
||||||
return setVetoPhoton(-1, gainIndex, vals);
|
return configureASICVetoReference(-1, gainIndices, values);
|
||||||
}
|
}
|
||||||
|
|
||||||
int setVetoPhoton(int chipIndex, int gainIndex, int *values) {
|
int setVetoPhoton(int chipIndex, int *gainIndices, int *values) {
|
||||||
LOG(logINFO,
|
return configureASICVetoReference(chipIndex, gainIndices, values);
|
||||||
("Setting veto photon [chip:%d, G%d]\n", chipIndex, gainIndex));
|
|
||||||
|
|
||||||
// add gain bits
|
|
||||||
int gainValue = 0;
|
|
||||||
switch (gainIndex) {
|
|
||||||
case 0:
|
|
||||||
gainValue = ASIC_G0_VAL;
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
gainValue = ASIC_G1_VAL;
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
gainValue = ASIC_G2_VAL;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
LOG(logERROR, ("Unknown gain index %d\n", gainIndex));
|
|
||||||
return FAIL;
|
|
||||||
}
|
|
||||||
LOG(logDEBUG2, ("Adding gain bits\n"));
|
|
||||||
for (int i = 0; i < NCHAN; ++i) {
|
|
||||||
values[i] |= gainValue;
|
|
||||||
LOG(logDEBUG2, ("Value %d: 0x%x\n", i, values[i]));
|
|
||||||
}
|
|
||||||
|
|
||||||
return configureASICVetoReference(chipIndex, values);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int configureASICVetoReference(int chipIndex, int *values) {
|
int configureASICVetoReference(int chipIndex, int *gainIndices, int *values) {
|
||||||
const int lenDataBitsPerchannel = ASIC_GAIN_MAX_BITS + ADU_MAX_BITS; // 14
|
LOG(logINFO, ("Setting veto photon/file/reference [chip:%d]\n", chipIndex));
|
||||||
const int lenBits = lenDataBitsPerchannel * NCHAN; // 1792
|
|
||||||
const int padding = 4; // due to address (4) to make it byte aligned
|
|
||||||
const int lenTotalBits = padding + lenBits + ASIC_ADDR_MAX_BITS; // 1800
|
|
||||||
const int len = lenTotalBits / 8; // 225
|
|
||||||
|
|
||||||
// reversing the values sent to the chip
|
// reversing the values sent to the chip
|
||||||
int revValues[NCHAN] = {};
|
int revValues[NCHAN] = {};
|
||||||
@ -1836,6 +1812,34 @@ int configureASICVetoReference(int chipIndex, int *values) {
|
|||||||
revValues[i] = values[NCHAN - 1 - i];
|
revValues[i] = values[NCHAN - 1 - i];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// correct gain bits and integrate into revValues
|
||||||
|
for (int i = 0; i < NCHAN; ++i) {
|
||||||
|
int gainValue = 0;
|
||||||
|
switch (gainIndices[i]) {
|
||||||
|
case 0:
|
||||||
|
gainValue = ASIC_G0_VAL;
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
gainValue = ASIC_G1_VAL;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
gainValue = ASIC_G2_VAL;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
LOG(logERROR,
|
||||||
|
("Unknown gain index %d for channel %d\n", gainIndices[i], i));
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
|
revValues[i] |= gainValue;
|
||||||
|
LOG(logDEBUG2, ("Values[%d]: 0x%x\n", i, revValues[i]));
|
||||||
|
}
|
||||||
|
|
||||||
|
const int lenDataBitsPerchannel = ASIC_GAIN_MAX_BITS + ADU_MAX_BITS; // 14
|
||||||
|
const int lenBits = lenDataBitsPerchannel * NCHAN; // 1792
|
||||||
|
const int padding = 4; // due to address (4) to make it byte aligned
|
||||||
|
const int lenTotalBits = padding + lenBits + ASIC_ADDR_MAX_BITS; // 1800
|
||||||
|
const int len = lenTotalBits / 8; // 225
|
||||||
|
|
||||||
// assign each bit into 4 + 1792 into byte array
|
// assign each bit into 4 + 1792 into byte array
|
||||||
uint8_t commandBytes[lenTotalBits];
|
uint8_t commandBytes[lenTotalBits];
|
||||||
memset(commandBytes, 0, sizeof(commandBytes));
|
memset(commandBytes, 0, sizeof(commandBytes));
|
||||||
@ -1873,6 +1877,7 @@ int configureASICVetoReference(int chipIndex, int *values) {
|
|||||||
for (int ichan = 0; ichan < NCHAN; ++ichan) {
|
for (int ichan = 0; ichan < NCHAN; ++ichan) {
|
||||||
for (int ichip = 0; ichip < NCHIP; ++ichip) {
|
for (int ichip = 0; ichip < NCHIP; ++ichip) {
|
||||||
vetoReference[ichip][ichan] = values[ichan];
|
vetoReference[ichip][ichan] = values[ichan];
|
||||||
|
vetoGainIndices[ichip][ichan] = gainIndices[ichan];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1880,17 +1885,19 @@ int configureASICVetoReference(int chipIndex, int *values) {
|
|||||||
// specific chip
|
// specific chip
|
||||||
else {
|
else {
|
||||||
for (int ichan = 0; ichan < NCHAN; ++ichan) {
|
for (int ichan = 0; ichan < NCHAN; ++ichan) {
|
||||||
vetoReference[chipIndex][chipIndex] = values[ichan];
|
vetoReference[chipIndex][ichan] = values[ichan];
|
||||||
;
|
vetoGainIndices[chipIndex][ichan] = gainIndices[ichan];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
int getVetoPhoton(int chipIndex, int *retvals) {
|
int getVetoPhoton(int chipIndex, int *retvals, int *gainRetvals) {
|
||||||
if (chipIndex == -1) {
|
if (chipIndex == -1) {
|
||||||
|
// if chipindex is -1, check that all values and gain indices are same
|
||||||
for (int i = 0; i < NCHAN; ++i) {
|
for (int i = 0; i < NCHAN; ++i) {
|
||||||
int val = vetoReference[0][i];
|
int val = vetoReference[0][i];
|
||||||
|
int gval = vetoGainIndices[0][i];
|
||||||
for (int j = 1; j < NCHIP; ++j) {
|
for (int j = 1; j < NCHIP; ++j) {
|
||||||
if (vetoReference[j][i] != val) {
|
if (vetoReference[j][i] != val) {
|
||||||
LOG(logERROR,
|
LOG(logERROR,
|
||||||
@ -1900,6 +1907,14 @@ int getVetoPhoton(int chipIndex, int *retvals) {
|
|||||||
chipIndex, j, i, vetoReference[j][i], i, val));
|
chipIndex, j, i, vetoReference[j][i], i, val));
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
|
if (vetoGainIndices[j][i] != gval) {
|
||||||
|
LOG(logERROR,
|
||||||
|
("Get vet photon fail for chipIndex:%d. Different "
|
||||||
|
"gain indices between [nchip:%d, nchan:%d, gain "
|
||||||
|
"index:%d] and [nchip:0, nchan:%d, gain index:%d]\n",
|
||||||
|
chipIndex, j, i, vetoGainIndices[j][i], i, gval));
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
chipIndex = 0;
|
chipIndex = 0;
|
||||||
@ -1907,35 +1922,12 @@ int getVetoPhoton(int chipIndex, int *retvals) {
|
|||||||
memcpy((char *)retvals,
|
memcpy((char *)retvals,
|
||||||
((char *)vetoReference) + NCHAN * chipIndex * sizeof(int),
|
((char *)vetoReference) + NCHAN * chipIndex * sizeof(int),
|
||||||
sizeof(int) * NCHAN);
|
sizeof(int) * NCHAN);
|
||||||
|
memcpy((char *)gainRetvals,
|
||||||
|
((char *)vetoGainIndices) + NCHAN * chipIndex * sizeof(int),
|
||||||
|
sizeof(int) * NCHAN);
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
int setVetoFile(int chipIndex, int *gainIndices, int *values) {
|
|
||||||
LOG(logINFO, ("Setting veto file [chip:%d]\n", chipIndex));
|
|
||||||
|
|
||||||
// correct gain bits and integrate into values
|
|
||||||
for (int i = 0; i < NCHAN; ++i) {
|
|
||||||
switch (gainIndices[i]) {
|
|
||||||
case 0:
|
|
||||||
gainIndices[i] = ASIC_G0_VAL;
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
gainIndices[i] = ASIC_G1_VAL;
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
gainIndices[i] = ASIC_G2_VAL;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
LOG(logERROR,
|
|
||||||
("Unknown gain index %d for channel %d\n", gainIndices[i], i));
|
|
||||||
return FAIL;
|
|
||||||
}
|
|
||||||
values[i] |= gainIndices[i];
|
|
||||||
LOG(logDEBUG2, ("Values[%d]: 0x%x\n", i, values[i]));
|
|
||||||
}
|
|
||||||
return configureASICVetoReference(chipIndex, values);
|
|
||||||
}
|
|
||||||
|
|
||||||
int setADCConfiguration(int chipIndex, int adcIndex, int value) {
|
int setADCConfiguration(int chipIndex, int adcIndex, int value) {
|
||||||
LOG(logINFO, ("Configuring ADC [chipIndex:%d, adcIndex:%d, value:0x%x]\n",
|
LOG(logINFO, ("Configuring ADC [chipIndex:%d, adcIndex:%d, value:0x%x]\n",
|
||||||
chipIndex, adcIndex, value));
|
chipIndex, adcIndex, value));
|
||||||
|
@ -504,10 +504,9 @@ int getClockDivider(enum CLKINDEX ind);
|
|||||||
int setInjectChannel(int offset, int increment);
|
int setInjectChannel(int offset, int increment);
|
||||||
void getInjectedChannels(int *offset, int *increment);
|
void getInjectedChannels(int *offset, int *increment);
|
||||||
int setVetoReference(int gainIndex, int value);
|
int setVetoReference(int gainIndex, int value);
|
||||||
int setVetoPhoton(int chipIndex, int gainIndex, int *values);
|
int setVetoPhoton(int chipIndex, int *gainIndices, int *values);
|
||||||
int configureASICVetoReference(int chipIndex, int *values);
|
int configureASICVetoReference(int chipIndex, int *gainIndices, int *values);
|
||||||
int getVetoPhoton(int chipIndex, int *retvals);
|
int getVetoPhoton(int chipIndex, int *retvals, int *gainRetvals);
|
||||||
int setVetoFile(int chipIndex, int *gainIndices, int *values);
|
|
||||||
int setADCConfiguration(int chipIndex, int adcIndex, int value);
|
int setADCConfiguration(int chipIndex, int adcIndex, int value);
|
||||||
int getADCConfiguration(int chipIndex, int adcIndex);
|
int getADCConfiguration(int chipIndex, int adcIndex);
|
||||||
int setBurstModeinFPGA(enum burstMode value);
|
int setBurstModeinFPGA(enum burstMode value);
|
||||||
|
@ -233,7 +233,6 @@ int get_cds_gain(int);
|
|||||||
int set_cds_gain(int);
|
int set_cds_gain(int);
|
||||||
int get_filter(int);
|
int get_filter(int);
|
||||||
int set_filter(int);
|
int set_filter(int);
|
||||||
int set_veto_file(int);
|
|
||||||
int get_adc_config(int);
|
int get_adc_config(int);
|
||||||
int set_adc_config(int);
|
int set_adc_config(int);
|
||||||
int get_bad_channels(int);
|
int get_bad_channels(int);
|
||||||
|
@ -350,7 +350,6 @@ void function_table() {
|
|||||||
flist[F_SET_CDS_GAIN] = &set_cds_gain;
|
flist[F_SET_CDS_GAIN] = &set_cds_gain;
|
||||||
flist[F_GET_FILTER] = &get_filter;
|
flist[F_GET_FILTER] = &get_filter;
|
||||||
flist[F_SET_FILTER] = &set_filter;
|
flist[F_SET_FILTER] = &set_filter;
|
||||||
flist[F_SET_VETO_FILE] = &set_veto_file;
|
|
||||||
flist[F_GET_ADC_CONFIGURATION] = &get_adc_config;
|
flist[F_GET_ADC_CONFIGURATION] = &get_adc_config;
|
||||||
flist[F_SET_ADC_CONFIGURATION] = &set_adc_config;
|
flist[F_SET_ADC_CONFIGURATION] = &set_adc_config;
|
||||||
flist[F_GET_BAD_CHANNELS] = &get_bad_channels;
|
flist[F_GET_BAD_CHANNELS] = &get_bad_channels;
|
||||||
@ -6329,35 +6328,37 @@ int get_inject_channel(int file_des) {
|
|||||||
int set_veto_photon(int file_des) {
|
int set_veto_photon(int file_des) {
|
||||||
ret = OK;
|
ret = OK;
|
||||||
memset(mess, 0, sizeof(mess));
|
memset(mess, 0, sizeof(mess));
|
||||||
int args[3] = {-1, -1, -1};
|
|
||||||
|
|
||||||
|
int args[2] = {-1, -1};
|
||||||
if (receiveData(file_des, args, sizeof(args), INT32) < 0)
|
if (receiveData(file_des, args, sizeof(args), INT32) < 0)
|
||||||
return printSocketReadError();
|
return printSocketReadError();
|
||||||
int values[args[2]];
|
int chipIndex = args[0];
|
||||||
|
int numChannels = args[1];
|
||||||
|
|
||||||
|
int gainIndices[args[1]];
|
||||||
|
memset(gainIndices, 0, sizeof(gainIndices));
|
||||||
|
if (receiveData(file_des, gainIndices, sizeof(gainIndices), INT32) < 0)
|
||||||
|
return printSocketReadError();
|
||||||
|
|
||||||
|
int values[args[1]];
|
||||||
memset(values, 0, sizeof(values));
|
memset(values, 0, sizeof(values));
|
||||||
if (receiveData(file_des, values, sizeof(values), INT32) < 0)
|
if (receiveData(file_des, values, sizeof(values), INT32) < 0)
|
||||||
return printSocketReadError();
|
return printSocketReadError();
|
||||||
LOG(logINFO, ("Setting Veto Photon: [chipIndex:%d, G%d, nch:%d]\n", args[0],
|
|
||||||
args[1], args[2]));
|
LOG(logINFO, ("Setting Veto Photon: [chipIndex:%d, nch:%d]\n", chipIndex,
|
||||||
|
numChannels));
|
||||||
|
|
||||||
#ifndef GOTTHARD2D
|
#ifndef GOTTHARD2D
|
||||||
functionNotImplemented();
|
functionNotImplemented();
|
||||||
#else
|
#else
|
||||||
// only set
|
// only set
|
||||||
if (Server_VerifyLock() == OK) {
|
if (Server_VerifyLock() == OK) {
|
||||||
int chipIndex = args[0];
|
|
||||||
int gainIndex = args[1];
|
|
||||||
int numChannels = args[2];
|
|
||||||
if (chipIndex < -1 || chipIndex >= NCHIP) {
|
if (chipIndex < -1 || chipIndex >= NCHIP) {
|
||||||
ret = FAIL;
|
ret = FAIL;
|
||||||
sprintf(mess, "Could not set veto photon. Invalid chip index %d\n",
|
sprintf(mess, "Could not set veto photon. Invalid chip index %d\n",
|
||||||
chipIndex);
|
chipIndex);
|
||||||
LOG(logERROR, (mess));
|
LOG(logERROR, (mess));
|
||||||
} else if (gainIndex < 0 || gainIndex > 2) {
|
|
||||||
ret = FAIL;
|
|
||||||
sprintf(mess, "Could not set veto photon. Invalid gain index %d\n",
|
|
||||||
gainIndex);
|
|
||||||
LOG(logERROR, (mess));
|
|
||||||
} else if (numChannels != NCHAN) {
|
} else if (numChannels != NCHAN) {
|
||||||
ret = FAIL;
|
ret = FAIL;
|
||||||
sprintf(mess,
|
sprintf(mess,
|
||||||
@ -6367,6 +6368,15 @@ int set_veto_photon(int file_des) {
|
|||||||
LOG(logERROR, (mess));
|
LOG(logERROR, (mess));
|
||||||
} else {
|
} else {
|
||||||
for (int i = 0; i < NCHAN; ++i) {
|
for (int i = 0; i < NCHAN; ++i) {
|
||||||
|
if (gainIndices[i] < 0 || gainIndices[i] > 2) {
|
||||||
|
ret = FAIL;
|
||||||
|
sprintf(mess,
|
||||||
|
"Could not set veto photon. Invalid gain index %d "
|
||||||
|
"for channel %d.\n",
|
||||||
|
gainIndices[i], i);
|
||||||
|
LOG(logERROR, (mess));
|
||||||
|
break;
|
||||||
|
}
|
||||||
if (values[i] > ADU_MAX_VAL) {
|
if (values[i] > ADU_MAX_VAL) {
|
||||||
ret = FAIL;
|
ret = FAIL;
|
||||||
sprintf(mess,
|
sprintf(mess,
|
||||||
@ -6378,7 +6388,7 @@ int set_veto_photon(int file_des) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (ret == OK) {
|
if (ret == OK) {
|
||||||
ret = setVetoPhoton(chipIndex, gainIndex, values);
|
ret = setVetoPhoton(chipIndex, gainIndices, values);
|
||||||
if (ret == FAIL) {
|
if (ret == FAIL) {
|
||||||
sprintf(mess,
|
sprintf(mess,
|
||||||
"Could not set veto photon for chip index %d\n",
|
"Could not set veto photon for chip index %d\n",
|
||||||
@ -6398,6 +6408,8 @@ int get_veto_photon(int file_des) {
|
|||||||
int arg = -1;
|
int arg = -1;
|
||||||
int retvals[NCHAN];
|
int retvals[NCHAN];
|
||||||
memset(retvals, 0, sizeof(retvals));
|
memset(retvals, 0, sizeof(retvals));
|
||||||
|
int gainRetvals[NCHAN];
|
||||||
|
memset(gainRetvals, 0, sizeof(gainRetvals));
|
||||||
|
|
||||||
if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0)
|
if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0)
|
||||||
return printSocketReadError();
|
return printSocketReadError();
|
||||||
@ -6414,14 +6426,16 @@ int get_veto_photon(int file_des) {
|
|||||||
chipIndex);
|
chipIndex);
|
||||||
LOG(logERROR, (mess));
|
LOG(logERROR, (mess));
|
||||||
} else {
|
} else {
|
||||||
ret = getVetoPhoton(chipIndex, retvals);
|
ret = getVetoPhoton(chipIndex, retvals, gainRetvals);
|
||||||
if (ret == FAIL) {
|
if (ret == FAIL) {
|
||||||
strcpy(mess, "Could not get veto photon for chipIndex -1. Not the "
|
strcpy(mess,
|
||||||
"same for all chips.\n");
|
"Could not get veto photon for chipIndex -1. Not the "
|
||||||
|
"same for all chips. Select specific chip index instead.\n");
|
||||||
LOG(logERROR, (mess));
|
LOG(logERROR, (mess));
|
||||||
} else {
|
} else {
|
||||||
for (int i = 0; i < NCHAN; ++i) {
|
for (int i = 0; i < NCHAN; ++i) {
|
||||||
LOG(logDEBUG1, ("%d:0x%x\n", i, retvals[i]));
|
LOG(logDEBUG1,
|
||||||
|
("%d:[%d, %d]\n", i, retvals[i], gainRetvals[i]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -6430,6 +6444,7 @@ int get_veto_photon(int file_des) {
|
|||||||
if (ret != FAIL) {
|
if (ret != FAIL) {
|
||||||
int nch = NCHAN;
|
int nch = NCHAN;
|
||||||
sendData(file_des, &nch, sizeof(nch), INT32);
|
sendData(file_des, &nch, sizeof(nch), INT32);
|
||||||
|
sendData(file_des, gainRetvals, sizeof(gainRetvals), INT32);
|
||||||
sendData(file_des, retvals, sizeof(retvals), INT32);
|
sendData(file_des, retvals, sizeof(retvals), INT32);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
@ -7763,78 +7778,6 @@ int set_filter(int file_des) {
|
|||||||
return Server_SendResult(file_des, INT32, NULL, 0);
|
return Server_SendResult(file_des, INT32, NULL, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int set_veto_file(int file_des) {
|
|
||||||
ret = OK;
|
|
||||||
memset(mess, 0, sizeof(mess));
|
|
||||||
int args[2] = {-1, -1};
|
|
||||||
|
|
||||||
if (receiveData(file_des, args, sizeof(args), INT32) < 0)
|
|
||||||
return printSocketReadError();
|
|
||||||
int chipIndex = args[0];
|
|
||||||
int nch = args[1];
|
|
||||||
int gainIndices[nch];
|
|
||||||
memset(gainIndices, 0, sizeof(gainIndices));
|
|
||||||
int values[nch];
|
|
||||||
memset(values, 0, sizeof(values));
|
|
||||||
if (receiveData(file_des, gainIndices, sizeof(gainIndices), INT32) < 0)
|
|
||||||
return printSocketReadError();
|
|
||||||
if (receiveData(file_des, values, sizeof(values), INT32) < 0)
|
|
||||||
return printSocketReadError();
|
|
||||||
LOG(logINFO,
|
|
||||||
("Setting Veto file: [chipIndex:%d, nch:%d]\n", chipIndex, nch));
|
|
||||||
|
|
||||||
#ifndef GOTTHARD2D
|
|
||||||
functionNotImplemented();
|
|
||||||
#else
|
|
||||||
// only set
|
|
||||||
if (Server_VerifyLock() == OK) {
|
|
||||||
if (chipIndex < -1 || chipIndex >= NCHIP) {
|
|
||||||
ret = FAIL;
|
|
||||||
sprintf(mess, "Could not set veto file. Invalid chip index %d\n",
|
|
||||||
chipIndex);
|
|
||||||
LOG(logERROR, (mess));
|
|
||||||
} else if (nch != NCHAN) {
|
|
||||||
ret = FAIL;
|
|
||||||
sprintf(mess,
|
|
||||||
"Could not set veto file. Invalid number of channels %d. "
|
|
||||||
"Expected %d\n",
|
|
||||||
nch, NCHAN);
|
|
||||||
LOG(logERROR, (mess));
|
|
||||||
} else {
|
|
||||||
for (int i = 0; i < NCHAN; ++i) {
|
|
||||||
if (values[i] < 0 || values[i] > ADU_MAX_VAL) {
|
|
||||||
ret = FAIL;
|
|
||||||
sprintf(mess,
|
|
||||||
"Could not set veto file. Invalid ADU value 0x%x "
|
|
||||||
"for channel %d, must be 12 bit.\n",
|
|
||||||
values[i], i);
|
|
||||||
LOG(logERROR, (mess));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (gainIndices[i] < 0 || gainIndices[i] > 2) {
|
|
||||||
ret = FAIL;
|
|
||||||
sprintf(mess,
|
|
||||||
"Could not set veto file. Invalid gain index %d "
|
|
||||||
"for channel %d\n",
|
|
||||||
gainIndices[i], i);
|
|
||||||
LOG(logERROR, (mess));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (ret == OK) {
|
|
||||||
ret = setVetoFile(chipIndex, gainIndices, values);
|
|
||||||
if (ret == FAIL) {
|
|
||||||
sprintf(mess, "Could not set veto file for chip index %d\n",
|
|
||||||
chipIndex);
|
|
||||||
LOG(logERROR, (mess));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
return Server_SendResult(file_des, INT32, NULL, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
int get_adc_config(int file_des) {
|
int get_adc_config(int file_des) {
|
||||||
ret = OK;
|
ret = OK;
|
||||||
memset(mess, 0, sizeof(mess));
|
memset(mess, 0, sizeof(mess));
|
||||||
|
@ -980,9 +980,9 @@ class Detector {
|
|||||||
void setInjectChannel(const int offsetChannel, const int incrementChannel,
|
void setInjectChannel(const int offsetChannel, const int incrementChannel,
|
||||||
Positions pos = {});
|
Positions pos = {});
|
||||||
|
|
||||||
/** [Gotthard2] adu values for each channel */
|
/** [Gotthard2] gain indices and adu values for each channel */
|
||||||
Result<std::vector<int>> getVetoPhoton(const int chipIndex,
|
void getVetoPhoton(const int chipIndex, const std::string &fname,
|
||||||
Positions pos = {});
|
Positions pos = {});
|
||||||
|
|
||||||
/** [Gotthard2] energy in keV */
|
/** [Gotthard2] energy in keV */
|
||||||
void setVetoPhoton(const int chipIndex, const int numPhotons,
|
void setVetoPhoton(const int chipIndex, const int numPhotons,
|
||||||
@ -993,7 +993,7 @@ class Detector {
|
|||||||
void setVetoReference(const int gainIndex, const int value,
|
void setVetoReference(const int gainIndex, const int value,
|
||||||
Positions pos = {});
|
Positions pos = {});
|
||||||
|
|
||||||
/** [Gotthard2] */
|
/** [Gotthard2] gain indices and adu values for each channel */
|
||||||
void setVetoFile(const int chipIndex, const std::string &fname,
|
void setVetoFile(const int chipIndex, const std::string &fname,
|
||||||
Positions pos = {});
|
Positions pos = {});
|
||||||
|
|
||||||
|
@ -1625,17 +1625,19 @@ std::string CmdProxy::VetoPhoton(int action) {
|
|||||||
std::ostringstream os;
|
std::ostringstream os;
|
||||||
os << cmd << ' ';
|
os << cmd << ' ';
|
||||||
if (action == defs::HELP_ACTION) {
|
if (action == defs::HELP_ACTION) {
|
||||||
os << "[n_chip] [#photons] [energy in keV] [reference "
|
os << "[ichip] [#photons] [energy in keV] [reference "
|
||||||
"file]\n\t[Gotthard2] Set veto reference for 128 channels for "
|
"file]\n\t[Gotthard2] Set veto reference for 128 channels for "
|
||||||
"chip n_chip according to referenc file and #photons and energy "
|
"chip ichip according to reference file and #photons and energy "
|
||||||
"in keV."
|
"in keV.\n"
|
||||||
|
<< "[ichip] [output file]\n\t Get gain indices and veto reference "
|
||||||
|
"for 128 channels for chip ichip, saved to file."
|
||||||
<< '\n';
|
<< '\n';
|
||||||
} else if (action == defs::GET_ACTION) {
|
} else if (action == defs::GET_ACTION) {
|
||||||
if (args.size() != 1) {
|
if (args.size() != 2) {
|
||||||
WrongNumberOfParameters(1);
|
WrongNumberOfParameters(2);
|
||||||
}
|
}
|
||||||
auto t = det->getVetoPhoton(StringTo<int>(args[0]), {det_id});
|
det->getVetoPhoton(StringTo<int>(args[0]), args[1], {det_id});
|
||||||
os << args[0] << ' ' << OutStringHex(t) << '\n';
|
os << "saved to file " << args[1] << '\n';
|
||||||
} else if (action == defs::PUT_ACTION) {
|
} else if (action == defs::PUT_ACTION) {
|
||||||
if (args.size() != 4) {
|
if (args.size() != 4) {
|
||||||
WrongNumberOfParameters(4);
|
WrongNumberOfParameters(4);
|
||||||
@ -1653,7 +1655,7 @@ std::string CmdProxy::VetoReference(int action) {
|
|||||||
std::ostringstream os;
|
std::ostringstream os;
|
||||||
os << cmd << ' ';
|
os << cmd << ' ';
|
||||||
if (action == defs::HELP_ACTION) {
|
if (action == defs::HELP_ACTION) {
|
||||||
os << "[gain index] [12 bit value in hex] \n\t[Gotthard2] Set veto "
|
os << "[gain index] [12 bit value] \n\t[Gotthard2] Set veto "
|
||||||
"reference for all 128 channels for all chips."
|
"reference for all 128 channels for all chips."
|
||||||
<< '\n';
|
<< '\n';
|
||||||
} else if (action == defs::GET_ACTION) {
|
} else if (action == defs::GET_ACTION) {
|
||||||
@ -1677,7 +1679,7 @@ std::string CmdProxy::VetoFile(int action) {
|
|||||||
if (action == defs::HELP_ACTION) {
|
if (action == defs::HELP_ACTION) {
|
||||||
os << "[chip index 0-10, -1 for all] [file name] \n\t[Gotthard2] Set "
|
os << "[chip index 0-10, -1 for all] [file name] \n\t[Gotthard2] Set "
|
||||||
"veto reference for each 128 channels for specific chip. The "
|
"veto reference for each 128 channels for specific chip. The "
|
||||||
"file should have 128 rows of gain index and 12 bit value in hex"
|
"file should have 128 rows of gain index and 12 bit value in dec"
|
||||||
<< '\n';
|
<< '\n';
|
||||||
} else if (action == defs::GET_ACTION) {
|
} else if (action == defs::GET_ACTION) {
|
||||||
throw sls::RuntimeError(
|
throw sls::RuntimeError(
|
||||||
|
@ -1290,9 +1290,9 @@ void Detector::setInjectChannel(const int offsetChannel,
|
|||||||
incrementChannel);
|
incrementChannel);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result<std::vector<int>> Detector::getVetoPhoton(const int chipIndex,
|
void Detector::getVetoPhoton(const int chipIndex, const std::string &fname,
|
||||||
Positions pos) {
|
Positions pos) {
|
||||||
return pimpl->Parallel(&Module::getVetoPhoton, pos, chipIndex);
|
pimpl->Parallel(&Module::getVetoPhoton, pos, chipIndex, fname);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Detector::setVetoPhoton(const int chipIndex, const int numPhotons,
|
void Detector::setVetoPhoton(const int chipIndex, const int numPhotons,
|
||||||
|
@ -187,7 +187,7 @@ void Module::setAllTrimbits(int val) {
|
|||||||
sendToDetector<int>(F_SET_ALL_TRIMBITS, val);
|
sendToDetector<int>(F_SET_ALL_TRIMBITS, val);
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t Module::getNumberOfFrames() const{
|
int64_t Module::getNumberOfFrames() const {
|
||||||
return sendToDetector<int64_t>(F_GET_NUM_FRAMES);
|
return sendToDetector<int64_t>(F_GET_NUM_FRAMES);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -198,7 +198,7 @@ void Module::setNumberOfFrames(int64_t value) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t Module::getNumberOfTriggers() const{
|
int64_t Module::getNumberOfTriggers() const {
|
||||||
return sendToDetector<int64_t>(F_GET_NUM_TRIGGERS);
|
return sendToDetector<int64_t>(F_GET_NUM_TRIGGERS);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -209,7 +209,7 @@ void Module::setNumberOfTriggers(int64_t value) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t Module::getExptime(int gateIndex) const{
|
int64_t Module::getExptime(int gateIndex) const {
|
||||||
return sendToDetector<int64_t>(F_GET_EXPTIME, gateIndex);
|
return sendToDetector<int64_t>(F_GET_EXPTIME, gateIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -228,7 +228,9 @@ void Module::setExptime(int gateIndex, int64_t value) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t Module::getPeriod() const { return sendToDetector<int64_t>(F_GET_PERIOD); }
|
int64_t Module::getPeriod() const {
|
||||||
|
return sendToDetector<int64_t>(F_GET_PERIOD);
|
||||||
|
}
|
||||||
|
|
||||||
void Module::setPeriod(int64_t value) {
|
void Module::setPeriod(int64_t value) {
|
||||||
sendToDetector(F_SET_PERIOD, value, nullptr);
|
sendToDetector(F_SET_PERIOD, value, nullptr);
|
||||||
@ -321,7 +323,7 @@ void Module::setClockPhase(int clkIndex, int value, bool inDegrees) {
|
|||||||
sendToDetector(F_SET_CLOCK_PHASE, args, nullptr);
|
sendToDetector(F_SET_CLOCK_PHASE, args, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Module::getMaxClockPhaseShift(int clkIndex) const{
|
int Module::getMaxClockPhaseShift(int clkIndex) const {
|
||||||
return sendToDetector<int>(F_GET_MAX_CLOCK_PHASE_SHIFT, clkIndex);
|
return sendToDetector<int>(F_GET_MAX_CLOCK_PHASE_SHIFT, clkIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -498,11 +500,11 @@ std::string Module::getScanErrorMessage() const {
|
|||||||
|
|
||||||
// Network Configuration (Detector<->Receiver)
|
// Network Configuration (Detector<->Receiver)
|
||||||
|
|
||||||
int Module::getNumberofUDPInterfacesFromShm() const{
|
int Module::getNumberofUDPInterfacesFromShm() const {
|
||||||
return shm()->numUDPInterfaces;
|
return shm()->numUDPInterfaces;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Module::getNumberofUDPInterfaces() const{
|
int Module::getNumberofUDPInterfaces() const {
|
||||||
shm()->numUDPInterfaces = sendToDetector<int>(F_GET_NUM_INTERFACES);
|
shm()->numUDPInterfaces = sendToDetector<int>(F_GET_NUM_INTERFACES);
|
||||||
return shm()->numUDPInterfaces;
|
return shm()->numUDPInterfaces;
|
||||||
}
|
}
|
||||||
@ -534,7 +536,7 @@ void Module::setSourceUDPIP(const IpAddr ip) {
|
|||||||
sendToDetector(F_SET_SOURCE_UDP_IP, ip, nullptr);
|
sendToDetector(F_SET_SOURCE_UDP_IP, ip, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
sls::IpAddr Module::getSourceUDPIP2() const{
|
sls::IpAddr Module::getSourceUDPIP2() const {
|
||||||
return sendToDetector<sls::IpAddr>(F_GET_SOURCE_UDP_IP2);
|
return sendToDetector<sls::IpAddr>(F_GET_SOURCE_UDP_IP2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -638,7 +640,7 @@ void Module::setDestinationUDPPort(const int port) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int Module::getDestinationUDPPort2() const{
|
int Module::getDestinationUDPPort2() const {
|
||||||
return sendToDetector<int>(F_GET_DEST_UDP_PORT2);
|
return sendToDetector<int>(F_GET_DEST_UDP_PORT2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -831,7 +833,8 @@ void Module::setReceiverSilentMode(bool enable) {
|
|||||||
nullptr);
|
nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
slsDetectorDefs::frameDiscardPolicy Module::getReceiverFramesDiscardPolicy() const {
|
slsDetectorDefs::frameDiscardPolicy
|
||||||
|
Module::getReceiverFramesDiscardPolicy() const {
|
||||||
return static_cast<frameDiscardPolicy>(
|
return static_cast<frameDiscardPolicy>(
|
||||||
sendToReceiver<int>(F_GET_RECEIVER_DISCARD_POLICY));
|
sendToReceiver<int>(F_GET_RECEIVER_DISCARD_POLICY));
|
||||||
}
|
}
|
||||||
@ -880,7 +883,7 @@ std::array<pid_t, NUM_RX_THREAD_IDS> Module::getReceiverThreadIds() const {
|
|||||||
|
|
||||||
// File
|
// File
|
||||||
|
|
||||||
slsDetectorDefs::fileFormat Module::getFileFormat() const{
|
slsDetectorDefs::fileFormat Module::getFileFormat() const {
|
||||||
return static_cast<fileFormat>(
|
return static_cast<fileFormat>(
|
||||||
sendToReceiver<int>(F_GET_RECEIVER_FILE_FORMAT));
|
sendToReceiver<int>(F_GET_RECEIVER_FILE_FORMAT));
|
||||||
}
|
}
|
||||||
@ -1103,7 +1106,9 @@ void Module::setThresholdEnergy(int e_eV, detectorSettings isettings,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string Module::getSettingsDir() const { return std::string(shm()->settingsDir); }
|
std::string Module::getSettingsDir() const {
|
||||||
|
return std::string(shm()->settingsDir);
|
||||||
|
}
|
||||||
|
|
||||||
std::string Module::setSettingsDir(const std::string &dir) {
|
std::string Module::setSettingsDir(const std::string &dir) {
|
||||||
sls::strcpy_safe(shm()->settingsDir, dir.c_str());
|
sls::strcpy_safe(shm()->settingsDir, dir.c_str());
|
||||||
@ -1173,7 +1178,9 @@ void Module::setRateCorrection(int64_t t) {
|
|||||||
sendToDetector(F_SET_RATE_CORRECT, t, nullptr);
|
sendToDetector(F_SET_RATE_CORRECT, t, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Module::getReadNLines() const { return sendToDetector<int>(F_GET_READ_N_LINES); }
|
int Module::getReadNLines() const {
|
||||||
|
return sendToDetector<int>(F_GET_READ_N_LINES);
|
||||||
|
}
|
||||||
|
|
||||||
void Module::setReadNLines(const int value) {
|
void Module::setReadNLines(const int value) {
|
||||||
sendToDetector(F_SET_READ_N_LINES, value, nullptr);
|
sendToDetector(F_SET_READ_N_LINES, value, nullptr);
|
||||||
@ -1231,7 +1238,8 @@ void Module::setDeactivatedRxrPaddingMode(bool padding) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool Module::getCounterBit() const {
|
bool Module::getCounterBit() const {
|
||||||
return (!static_cast<bool>(sendToDetector<int>(F_SET_COUNTER_BIT, GET_FLAG)));
|
return (
|
||||||
|
!static_cast<bool>(sendToDetector<int>(F_SET_COUNTER_BIT, GET_FLAG)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Module::setCounterBit(bool cb) {
|
void Module::setCounterBit(bool cb) {
|
||||||
@ -1294,8 +1302,9 @@ void Module::resetTemperatureEvent() {
|
|||||||
sendToDetectorStop<int>(F_TEMP_EVENT, 0);
|
sendToDetectorStop<int>(F_TEMP_EVENT, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Module::getAutoComparatorDisableMode() const{
|
bool Module::getAutoComparatorDisableMode() const {
|
||||||
return static_cast<bool>(sendToDetector<int>(F_AUTO_COMP_DISABLE, GET_FLAG));
|
return static_cast<bool>(
|
||||||
|
sendToDetector<int>(F_AUTO_COMP_DISABLE, GET_FLAG));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Module::setAutoComparatorDisableMode(bool val) {
|
void Module::setAutoComparatorDisableMode(bool val) {
|
||||||
@ -1380,7 +1389,30 @@ void Module::setInjectChannel(const int offsetChannel,
|
|||||||
sendToDetector(F_SET_INJECT_CHANNEL, args, nullptr);
|
sendToDetector(F_SET_INJECT_CHANNEL, args, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<int> Module::getVetoPhoton(const int chipIndex) const {
|
void Module::sendVetoPhoton(const int chipIndex, int *gainIndices,
|
||||||
|
int *values) {
|
||||||
|
int fnum = F_SET_VETO_PHOTON;
|
||||||
|
int ret = FAIL;
|
||||||
|
int nch = shm()->nChan.x;
|
||||||
|
int args[]{chipIndex, nch};
|
||||||
|
LOG(logDEBUG1) << "Sending veto photon/file to detector [chip:" << chipIndex
|
||||||
|
<< ", nch:" << nch << "]";
|
||||||
|
auto client = DetectorSocket(shm()->hostname, shm()->controlPort);
|
||||||
|
client.Send(&fnum, sizeof(fnum));
|
||||||
|
client.Send(args, sizeof(args));
|
||||||
|
client.Send(gainIndices, sizeof(int) * nch);
|
||||||
|
client.Send(values, sizeof(int) * nch);
|
||||||
|
client.Receive(&ret, sizeof(ret));
|
||||||
|
if (ret == FAIL) {
|
||||||
|
char mess[MAX_STR_LENGTH]{};
|
||||||
|
client.Receive(mess, MAX_STR_LENGTH);
|
||||||
|
throw RuntimeError("Detector " + std::to_string(moduleId) +
|
||||||
|
" returned error: " + std::string(mess));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Module::getVetoPhoton(const int chipIndex,
|
||||||
|
const std::string &fname) const {
|
||||||
int fnum = F_GET_VETO_PHOTON;
|
int fnum = F_GET_VETO_PHOTON;
|
||||||
int ret = FAIL;
|
int ret = FAIL;
|
||||||
auto client = DetectorSocket(shm()->hostname, shm()->controlPort);
|
auto client = DetectorSocket(shm()->hostname, shm()->controlPort);
|
||||||
@ -1395,14 +1427,25 @@ std::vector<int> Module::getVetoPhoton(const int chipIndex) const {
|
|||||||
}
|
}
|
||||||
int nch = -1;
|
int nch = -1;
|
||||||
client.Receive(&nch, sizeof(nch));
|
client.Receive(&nch, sizeof(nch));
|
||||||
|
|
||||||
int adus[nch];
|
|
||||||
memset(adus, 0, sizeof(adus));
|
|
||||||
client.Receive(adus, sizeof(adus));
|
|
||||||
std::vector<int> retvals(adus, adus + nch);
|
|
||||||
LOG(logDEBUG1) << "Getting veto photon [" << chipIndex << "]: " << nch
|
LOG(logDEBUG1) << "Getting veto photon [" << chipIndex << "]: " << nch
|
||||||
<< " channels\n";
|
<< " channels\n";
|
||||||
return retvals;
|
int gainIndices[nch];
|
||||||
|
memset(gainIndices, 0, sizeof(gainIndices));
|
||||||
|
client.Receive(gainIndices, sizeof(gainIndices));
|
||||||
|
int values[nch];
|
||||||
|
memset(values, 0, sizeof(values));
|
||||||
|
client.Receive(values, sizeof(values));
|
||||||
|
|
||||||
|
// save to file
|
||||||
|
std::ofstream outfile;
|
||||||
|
outfile.open(fname.c_str(), std::ios_base::out);
|
||||||
|
if (!outfile.is_open()) {
|
||||||
|
throw RuntimeError("Could not create file to save veto photon");
|
||||||
|
}
|
||||||
|
for (int i = 0; i < nch; ++i) {
|
||||||
|
outfile << gainIndices[i] << ' ' << values[i] << '\n';
|
||||||
|
}
|
||||||
|
LOG(logDEBUG1) << nch << " veto photon saved to file";
|
||||||
}
|
}
|
||||||
|
|
||||||
void Module::setVetoPhoton(const int chipIndex, const int numPhotons,
|
void Module::setVetoPhoton(const int chipIndex, const int numPhotons,
|
||||||
@ -1429,14 +1472,15 @@ void Module::setVetoPhoton(const int chipIndex, const int numPhotons,
|
|||||||
throw RuntimeError("Could not set veto photon. Could not open file: " +
|
throw RuntimeError("Could not set veto photon. Could not open file: " +
|
||||||
fname);
|
fname);
|
||||||
}
|
}
|
||||||
|
LOG(logDEBUG1) << "Setting veto photon. Reading Gain values from file";
|
||||||
|
|
||||||
int totalEnergy = numPhotons * energy;
|
int totalEnergy = numPhotons * energy;
|
||||||
int ch = shm()->nChan.x;
|
int ch = shm()->nChan.x;
|
||||||
int gainIndex = 2;
|
|
||||||
int nRead = 0;
|
int nRead = 0;
|
||||||
int value[ch];
|
int values[ch];
|
||||||
memset(value, 0, sizeof(value));
|
int gainIndices[ch];
|
||||||
bool firstLine = true;
|
memset(values, 0, sizeof(values));
|
||||||
|
memset(gainIndices, 0, sizeof(gainIndices));
|
||||||
|
|
||||||
while (infile.good()) {
|
while (infile.good()) {
|
||||||
std::string line;
|
std::string line;
|
||||||
@ -1448,65 +1492,43 @@ void Module::setVetoPhoton(const int chipIndex, const int numPhotons,
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
std::istringstream ss(line);
|
std::istringstream ss(line);
|
||||||
// first line: caluclate gain index from gain thresholds from file
|
|
||||||
if (firstLine) {
|
// read pedestal, gain values, gain thresholds
|
||||||
int g0 = -1, g1 = -1;
|
double gainPedestal[3] = {-1, -1, -1};
|
||||||
ss >> g0 >> g1;
|
double gainValue[3] = {-1, -1, -1};
|
||||||
if (ss.fail()) {
|
int gainThreshold[2] = {-1, -1};
|
||||||
throw RuntimeError(
|
ss >> gainPedestal[0] >> gainPedestal[1] >> gainPedestal[2] >>
|
||||||
"Could not set veto photon. Invalid gain thresholds");
|
gainValue[0] >> gainValue[1] >> gainValue[2] >> gainThreshold[0] >>
|
||||||
}
|
gainThreshold[1];
|
||||||
// set gain index and gain bit values
|
if (ss.fail()) {
|
||||||
if (totalEnergy < g0) {
|
throw RuntimeError("Could not set veto photon. Invalid pedestals, "
|
||||||
gainIndex = 0;
|
"gain values or gain thresholds for channel " +
|
||||||
} else if (totalEnergy < g1) {
|
std::to_string(nRead));
|
||||||
gainIndex = 1;
|
|
||||||
}
|
|
||||||
LOG(logINFO) << "Setting veto photon. Reading Gain " << gainIndex
|
|
||||||
<< " values";
|
|
||||||
firstLine = false;
|
|
||||||
}
|
}
|
||||||
// read pedestal and gain values
|
|
||||||
else {
|
// caluclate gain index from gain thresholds and threhsold energy
|
||||||
double p[3] = {-1, -1, -1}, g[3] = {-1, -1, -1};
|
int gainIndex = 2;
|
||||||
ss >> p[0] >> p[1] >> p[2] >> g[0] >> g[1] >> g[2];
|
if (totalEnergy < gainThreshold[0]) {
|
||||||
if (ss.fail()) {
|
gainIndex = 0;
|
||||||
throw RuntimeError("Could not set veto photon. Invalid "
|
} else if (totalEnergy < gainThreshold[1]) {
|
||||||
"pedestal or gain values for channel " +
|
gainIndex = 1;
|
||||||
std::to_string(nRead));
|
}
|
||||||
}
|
// calculate ADU values = pedestal + gainvalue * total energy
|
||||||
value[nRead] =
|
values[nRead] =
|
||||||
p[gainIndex] +
|
gainPedestal[gainIndex] + (gainValue[gainIndex] * totalEnergy);
|
||||||
(g[gainIndex] *
|
gainIndices[nRead] = gainIndex;
|
||||||
totalEnergy); // ADU value = pedestal + gain * total energy
|
++nRead;
|
||||||
++nRead;
|
if (nRead >= ch) {
|
||||||
if (nRead >= ch) {
|
break;
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (nRead != ch) {
|
if (nRead != ch) {
|
||||||
throw RuntimeError("Could not set veto photon. Insufficient pedestal "
|
throw RuntimeError("Could not set veto photon. Insufficient pedestal "
|
||||||
"pr gain values: " +
|
"for gain values: " +
|
||||||
std::to_string(nRead));
|
std::to_string(nRead));
|
||||||
}
|
}
|
||||||
|
|
||||||
int fnum = F_SET_VETO_PHOTON;
|
sendVetoPhoton(chipIndex, gainIndices, values);
|
||||||
int ret = FAIL;
|
|
||||||
int args[]{chipIndex, gainIndex, ch};
|
|
||||||
LOG(logDEBUG) << "Sending veto photon value to detector [chip:" << chipIndex
|
|
||||||
<< ", G" << gainIndex << "]: " << args;
|
|
||||||
auto client = DetectorSocket(shm()->hostname, shm()->controlPort);
|
|
||||||
client.Send(&fnum, sizeof(fnum));
|
|
||||||
client.Send(args, sizeof(args));
|
|
||||||
client.Send(value, sizeof(value));
|
|
||||||
client.Receive(&ret, sizeof(ret));
|
|
||||||
if (ret == FAIL) {
|
|
||||||
char mess[MAX_STR_LENGTH]{};
|
|
||||||
client.Receive(mess, MAX_STR_LENGTH);
|
|
||||||
throw RuntimeError("Detector " + std::to_string(moduleId) +
|
|
||||||
" returned error: " + std::string(mess));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Module::setVetoReference(const int gainIndex, const int value) {
|
void Module::setVetoReference(const int gainIndex, const int value) {
|
||||||
@ -1572,26 +1594,10 @@ void Module::setVetoFile(const int chipIndex, const std::string &fname) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int fnum = F_SET_VETO_FILE;
|
sendVetoPhoton(chipIndex, gainIndices, values);
|
||||||
int ret = FAIL;
|
|
||||||
int args[]{chipIndex, ch};
|
|
||||||
LOG(logDEBUG) << "Sending veto file value to detector [chip:" << chipIndex
|
|
||||||
<< "]: " << args;
|
|
||||||
auto client = DetectorSocket(shm()->hostname, shm()->controlPort);
|
|
||||||
client.Send(&fnum, sizeof(fnum));
|
|
||||||
client.Send(args, sizeof(args));
|
|
||||||
client.Send(gainIndices, sizeof(gainIndices));
|
|
||||||
client.Send(values, sizeof(values));
|
|
||||||
client.Receive(&ret, sizeof(ret));
|
|
||||||
if (ret == FAIL) {
|
|
||||||
char mess[MAX_STR_LENGTH]{};
|
|
||||||
client.Receive(mess, MAX_STR_LENGTH);
|
|
||||||
throw RuntimeError("Detector " + std::to_string(moduleId) +
|
|
||||||
" returned error: " + std::string(mess));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
slsDetectorDefs::burstMode Module::getBurstMode() const{
|
slsDetectorDefs::burstMode Module::getBurstMode() const {
|
||||||
auto r = sendToDetector<int>(F_GET_BURST_MODE);
|
auto r = sendToDetector<int>(F_GET_BURST_MODE);
|
||||||
return static_cast<slsDetectorDefs::burstMode>(r);
|
return static_cast<slsDetectorDefs::burstMode>(r);
|
||||||
}
|
}
|
||||||
@ -1681,7 +1687,7 @@ void Module::getBadChannels(const std::string &fname) const {
|
|||||||
std::ofstream outfile;
|
std::ofstream outfile;
|
||||||
outfile.open(fname.c_str(), std::ios_base::out);
|
outfile.open(fname.c_str(), std::ios_base::out);
|
||||||
if (!outfile.is_open()) {
|
if (!outfile.is_open()) {
|
||||||
throw RuntimeError("Could not create file to save pattern");
|
throw RuntimeError("Could not create file to save bad channels");
|
||||||
}
|
}
|
||||||
for (int i = 0; i < nch; ++i) {
|
for (int i = 0; i < nch; ++i) {
|
||||||
outfile << badchannels[i] << '\n';
|
outfile << badchannels[i] << '\n';
|
||||||
@ -1750,7 +1756,9 @@ void Module::setCounterMask(uint32_t countermask) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int Module::getNumberOfGates() const { return sendToDetector<int>(F_GET_NUM_GATES); }
|
int Module::getNumberOfGates() const {
|
||||||
|
return sendToDetector<int>(F_GET_NUM_GATES);
|
||||||
|
}
|
||||||
|
|
||||||
void Module::setNumberOfGates(int value) {
|
void Module::setNumberOfGates(int value) {
|
||||||
sendToDetector(F_SET_NUM_GATES, value, nullptr);
|
sendToDetector(F_SET_NUM_GATES, value, nullptr);
|
||||||
@ -1885,7 +1893,7 @@ int Module::setExternalSamplingSource(int value) {
|
|||||||
return sendToDetector<int>(F_EXTERNAL_SAMPLING_SOURCE, value);
|
return sendToDetector<int>(F_EXTERNAL_SAMPLING_SOURCE, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Module::getExternalSampling() const{
|
bool Module::getExternalSampling() const {
|
||||||
return sendToDetector<int>(F_EXTERNAL_SAMPLING, GET_FLAG);
|
return sendToDetector<int>(F_EXTERNAL_SAMPLING, GET_FLAG);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -371,7 +371,8 @@ class Module : public virtual slsDetectorDefs {
|
|||||||
void setBurstPeriod(int64_t value);
|
void setBurstPeriod(int64_t value);
|
||||||
std::array<int, 2> getInjectChannel() const;
|
std::array<int, 2> getInjectChannel() const;
|
||||||
void setInjectChannel(const int offsetChannel, const int incrementChannel);
|
void setInjectChannel(const int offsetChannel, const int incrementChannel);
|
||||||
std::vector<int> getVetoPhoton(const int chipIndex) const;
|
void sendVetoPhoton(const int chipIndex, int *gainIndices, int *values);
|
||||||
|
void getVetoPhoton(const int chipIndex, const std::string &fname) const;
|
||||||
void setVetoPhoton(const int chipIndex, const int numPhotons,
|
void setVetoPhoton(const int chipIndex, const int numPhotons,
|
||||||
const int energy, const std::string &fname);
|
const int energy, const std::string &fname);
|
||||||
void setVetoReference(const int gainIndex, const int value);
|
void setVetoReference(const int gainIndex, const int value);
|
||||||
@ -519,7 +520,7 @@ class Module : public virtual slsDetectorDefs {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
void checkArgs(const void *args, size_t args_size, void *retval,
|
void checkArgs(const void *args, size_t args_size, void *retval,
|
||||||
size_t retval_size) const;
|
size_t retval_size) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send function parameters to detector (control server)
|
* Send function parameters to detector (control server)
|
||||||
|
@ -316,7 +316,9 @@ TEST_CASE("vetophoton", "[.cmd][.new]") {
|
|||||||
|
|
||||||
if (det_type == defs::GOTTHARD2) {
|
if (det_type == defs::GOTTHARD2) {
|
||||||
REQUIRE_THROWS(proxy.Call("vetophoton", {}, -1, GET));
|
REQUIRE_THROWS(proxy.Call("vetophoton", {}, -1, GET));
|
||||||
REQUIRE_NOTHROW(proxy.Call("vetophoton", {"-1"}, -1, GET));
|
REQUIRE_THROWS(proxy.Call("vetophoton", {"-1"}, -1, GET));
|
||||||
|
REQUIRE_NOTHROW(
|
||||||
|
proxy.Call("vetophoton", {"-1", "/tmp/bla.txt"}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("vetophoton", {"12", "1", "39950"}, -1,
|
REQUIRE_THROWS(proxy.Call("vetophoton", {"12", "1", "39950"}, -1,
|
||||||
PUT)); // invalid chip index
|
PUT)); // invalid chip index
|
||||||
REQUIRE_THROWS(proxy.Call("vetophoton", {"-1", "0"}, -1,
|
REQUIRE_THROWS(proxy.Call("vetophoton", {"-1", "0"}, -1,
|
||||||
@ -324,7 +326,8 @@ TEST_CASE("vetophoton", "[.cmd][.new]") {
|
|||||||
REQUIRE_THROWS(proxy.Call("vetophoton", {"-1", "1", "39950"}, -1,
|
REQUIRE_THROWS(proxy.Call("vetophoton", {"-1", "1", "39950"}, -1,
|
||||||
PUT)); // invald file
|
PUT)); // invald file
|
||||||
} else {
|
} else {
|
||||||
REQUIRE_THROWS(proxy.Call("vetophoton", {"-1"}, -1, GET));
|
REQUIRE_THROWS(
|
||||||
|
proxy.Call("vetophoton", {"-1", "/tmp/bla.txt"}, -1, GET));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -207,7 +207,6 @@ enum detFuncs {
|
|||||||
F_SET_CDS_GAIN,
|
F_SET_CDS_GAIN,
|
||||||
F_GET_FILTER,
|
F_GET_FILTER,
|
||||||
F_SET_FILTER,
|
F_SET_FILTER,
|
||||||
F_SET_VETO_FILE,
|
|
||||||
F_GET_ADC_CONFIGURATION,
|
F_GET_ADC_CONFIGURATION,
|
||||||
F_SET_ADC_CONFIGURATION,
|
F_SET_ADC_CONFIGURATION,
|
||||||
F_GET_BAD_CHANNELS,
|
F_GET_BAD_CHANNELS,
|
||||||
@ -519,7 +518,6 @@ const char* getFunctionNameFromEnum(enum detFuncs func) {
|
|||||||
case F_SET_CDS_GAIN: return "F_SET_CDS_GAIN";
|
case F_SET_CDS_GAIN: return "F_SET_CDS_GAIN";
|
||||||
case F_GET_FILTER: return "F_GET_FILTER";
|
case F_GET_FILTER: return "F_GET_FILTER";
|
||||||
case F_SET_FILTER: return "F_SET_FILTER";
|
case F_SET_FILTER: return "F_SET_FILTER";
|
||||||
case F_SET_VETO_FILE: return "F_SET_VETO_FILE";
|
|
||||||
case F_SET_ADC_CONFIGURATION: return "F_SET_ADC_CONFIGURATION";
|
case F_SET_ADC_CONFIGURATION: return "F_SET_ADC_CONFIGURATION";
|
||||||
case F_GET_ADC_CONFIGURATION: return "F_GET_ADC_CONFIGURATION";
|
case F_GET_ADC_CONFIGURATION: return "F_GET_ADC_CONFIGURATION";
|
||||||
case F_GET_BAD_CHANNELS: return "F_GET_BAD_CHANNELS";
|
case F_GET_BAD_CHANNELS: return "F_GET_BAD_CHANNELS";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user