Merge branch 'm3' into eiger

This commit is contained in:
maliakal_d 2020-07-29 17:21:14 +02:00
commit 4cebefbc55
24 changed files with 517 additions and 455 deletions

View 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

View File

@ -1,132 +1,129 @@
#G1 Energy #G2 Energy
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
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
#G0 pedestal G1 pedestal G2 pedestal G0 gain G1 gain G2 gain #G1 Energy #G2 Energy
100 100 100 10 1 0.1 300 7000
100 100 100 10 1 0.1 300 7000
100 100 100 10 1 0.1 300 7000
100 100 100 10 1 0.1 300 7000
100 100 100 10 1 0.1 300 7000
100 100 100 10 1 0.1 300 7000
100 100 100 10 1 0.1 300 7000
100 100 100 10 1 0.1 300 7000
100 100 100 10 1 0.1 300 7000
100 100 100 10 1 0.1 300 7000
100 100 100 10 1 0.1 300 7000
100 100 100 10 1 0.1 300 7000
100 100 100 10 1 0.1 300 7000
100 100 100 10 1 0.1 300 7000
100 100 100 10 1 0.1 300 7000
100 100 100 10 1 0.1 300 7000
100 100 100 10 1 0.1 300 7000
100 100 100 10 1 0.1 300 7000
100 100 100 10 1 0.1 300 7000
100 100 100 10 1 0.1 300 7000
100 100 100 10 1 0.1 300 7000
100 100 100 10 1 0.1 300 7000
100 100 100 10 1 0.1 300 7000
100 100 100 10 1 0.1 300 7000
100 100 100 10 1 0.1 300 7000
100 100 100 10 1 0.1 300 7000
100 100 100 10 1 0.1 300 7000
100 100 100 10 1 0.1 300 7000
100 100 100 10 1 0.1 300 7000
100 100 100 10 1 0.1 300 7000
100 100 100 10 1 0.1 300 7000
100 100 100 10 1 0.1 300 7000
100 100 100 10 1 0.1 300 7000
100 100 100 10 1 0.1 300 7000
100 100 100 10 1 0.1 300 7000
100 100 100 10 1 0.1 300 7000
100 100 100 10 1 0.1 300 7000
100 100 100 10 1 0.1 300 7000
100 100 100 10 1 0.1 300 7000
100 100 100 10 1 0.1 300 7000
100 100 100 10 1 0.1 300 7000
100 100 100 10 1 0.1 300 7000
100 100 100 10 1 0.1 300 7000
100 100 100 10 1 0.1 300 7000
100 100 100 10 1 0.1 300 7000
100 100 100 10 1 0.1 300 7000
100 100 100 10 1 0.1 300 7000
100 100 100 10 1 0.1 300 7000
100 100 100 10 1 0.1 300 7000
100 100 100 10 1 0.1 300 7000
100 100 100 10 1 0.1 300 7000
100 100 100 10 1 0.1 300 7000
100 100 100 10 1 0.1 300 7000
100 100 100 10 1 0.1 300 7000
100 100 100 10 1 0.1 300 7000
100 100 100 10 1 0.1 300 7000
100 100 100 10 1 0.1 300 7000
100 100 100 10 1 0.1 300 7000
100 100 100 10 1 0.1 300 7000
100 100 100 10 1 0.1 300 7000
100 100 100 10 1 0.1 300 7000
100 100 100 10 1 0.1 300 7000
100 100 100 10 1 0.1 300 7000
100 100 100 10 1 0.1 300 7000
100 100 100 10 1 0.1 300 7000
100 100 100 10 1 0.1 300 7000
100 100 100 10 1 0.1 300 7000
100 100 100 10 1 0.1 300 7000
100 100 100 10 1 0.1 300 7000
100 100 100 10 1 0.1 300 7000
100 100 100 10 1 0.1 300 7000
100 100 100 10 1 0.1 300 7000
100 100 100 10 1 0.1 300 7000
100 100 100 10 1 0.1 300 7000
100 100 100 10 1 0.1 300 7000
100 100 100 10 1 0.1 300 7000
100 100 100 10 1 0.1 300 7000
100 100 100 10 1 0.1 300 7000
100 100 100 10 1 0.1 300 7000
100 100 100 10 1 0.1 300 7000
100 100 100 10 1 0.1 300 7000
100 100 100 10 1 0.1 300 7000
100 100 100 10 1 0.1 300 7000
100 100 100 10 1 0.1 300 7000
100 100 100 10 1 0.1 300 7000
100 100 100 10 1 0.1 300 7000
100 100 100 10 1 0.1 300 7000
100 100 100 10 1 0.1 300 7000
100 100 100 10 1 0.1 300 7000
100 100 100 10 1 0.1 300 7000
100 100 100 10 1 0.1 300 7000
100 100 100 10 1 0.1 300 7000
100 100 100 10 1 0.1 300 7000
100 100 100 10 1 0.1 300 7000
100 100 100 10 1 0.1 300 7000
100 100 100 10 1 0.1 300 7000
100 100 100 10 1 0.1 300 7000
100 100 100 10 1 0.1 300 7000
100 100 100 10 1 0.1 300 7000
100 100 100 10 1 0.1 300 7000
100 100 100 10 1 0.1 300 7000
100 100 100 10 1 0.1 300 7000
100 100 100 10 1 0.1 300 7000
100 100 100 10 1 0.1 300 7000
100 100 100 10 1 0.1 300 7000
100 100 100 10 1 0.1 300 7000
100 100 100 10 1 0.1 300 7000
100 100 100 10 1 0.1 300 7000
100 100 100 10 1 0.1 300 7000
100 100 100 10 1 0.1 300 7000
100 100 100 10 1 0.1 300 7000
100 100 100 10 1 0.1 300 7000
100 100 100 10 1 0.1 300 7000
100 100 100 10 1 0.1 300 7000
100 100 100 10 1 0.1 300 7000
100 100 100 10 1 0.1 300 7000
100 100 100 10 1 0.1 300 7000
100 100 100 10 1 0.1 300 7000
100 100 100 10 1 0.1 300 7000
100 100 100 10 1 0.1 300 7000
100 100 100 10 1 0.1 300 7000
100 100 100 10 1 0.1 300 7000
100 100 100 10 1 0.1 300 7000
100 100 100 10 1 0.1 300 7000
100 100 100 10 1 0.1 300 7000
100 100 100 10 1 0.1 300 7000
100 100 100 10 1 0.1 300 7000
100 100 100 10 1 0.1 300 7000

View File

@ -50,6 +50,7 @@ int onChipdacValues[ONCHIP_NDAC][NCHIP] = {};
int injectedChannelsOffset = 0;
int injectedChannelsIncrement = 0;
int vetoReference[NCHIP][NCHAN];
int vetoGainIndices[NCHIP][NCHAN];
uint8_t adcConfiguration[NCHIP][NADC];
int burstMode = BURST_INTERNAL;
int64_t numTriggersReg = 1;
@ -373,25 +374,16 @@ void setupDetector() {
burstPeriodReg = 0;
filter = 0;
cdsGain = 0;
for (int i = 0; i < NUM_CLOCKS; ++i) {
clkPhase[i] = 0;
}
for (int i = 0; i < NDAC; ++i) {
dacValues[i] = 0;
}
memset(clkPhase, 0, sizeof(clkPhase));
memset(dacValues, 0, sizeof(dacValues));
for (int i = 0; i < ONCHIP_NDAC; ++i) {
for (int j = 0; j < NCHIP; ++j) {
onChipdacValues[i][j] = -1;
}
}
for (int i = 0; i < NCHIP; ++i) {
for (int j = 0; j < NCHAN; ++j) {
vetoReference[i][j] = 0;
}
for (int j = 0; j < NADC; ++j) {
adcConfiguration[i][j] = 0;
}
}
memset(vetoReference, 0, sizeof(vetoReference));
memset(vetoGainIndices, 0, sizeof(vetoGainIndices));
memset(adcConfiguration, 0, sizeof(adcConfiguration));
#ifdef VIRTUAL
sharedMemory_setStatus(IDLE);
#endif
@ -1786,49 +1778,21 @@ void getInjectedChannels(int *offset, int *increment) {
int setVetoReference(int gainIndex, int value) {
LOG(logINFO, ("Setting veto reference [chip:-1, G%d, value:0x%x]\n",
gainIndex, value));
int vals[NCHAN];
memset(vals, 0, sizeof(vals));
int values[NCHAN];
int gainIndices[NCHAN];
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) {
LOG(logINFO,
("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 setVetoPhoton(int chipIndex, int *gainIndices, int *values) {
return configureASICVetoReference(chipIndex, gainIndices, values);
}
int configureASICVetoReference(int chipIndex, int *values) {
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
int configureASICVetoReference(int chipIndex, int *gainIndices, int *values) {
LOG(logINFO, ("Setting veto photon/file/reference [chip:%d]\n", chipIndex));
// reversing the values sent to the chip
int revValues[NCHAN] = {};
@ -1836,6 +1800,34 @@ int configureASICVetoReference(int chipIndex, int *values) {
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
uint8_t commandBytes[lenTotalBits];
memset(commandBytes, 0, sizeof(commandBytes));
@ -1873,6 +1865,7 @@ int configureASICVetoReference(int chipIndex, int *values) {
for (int ichan = 0; ichan < NCHAN; ++ichan) {
for (int ichip = 0; ichip < NCHIP; ++ichip) {
vetoReference[ichip][ichan] = values[ichan];
vetoGainIndices[ichip][ichan] = gainIndices[ichan];
}
}
}
@ -1880,17 +1873,19 @@ int configureASICVetoReference(int chipIndex, int *values) {
// specific chip
else {
for (int ichan = 0; ichan < NCHAN; ++ichan) {
vetoReference[chipIndex][chipIndex] = values[ichan];
;
vetoReference[chipIndex][ichan] = values[ichan];
vetoGainIndices[chipIndex][ichan] = gainIndices[ichan];
}
}
return OK;
}
int getVetoPhoton(int chipIndex, int *retvals) {
int getVetoPhoton(int chipIndex, int *retvals, int *gainRetvals) {
if (chipIndex == -1) {
// if chipindex is -1, check that all values and gain indices are same
for (int i = 0; i < NCHAN; ++i) {
int val = vetoReference[0][i];
int gval = vetoGainIndices[0][i];
for (int j = 1; j < NCHIP; ++j) {
if (vetoReference[j][i] != val) {
LOG(logERROR,
@ -1900,6 +1895,14 @@ int getVetoPhoton(int chipIndex, int *retvals) {
chipIndex, j, i, vetoReference[j][i], i, val));
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;
@ -1907,35 +1910,12 @@ int getVetoPhoton(int chipIndex, int *retvals) {
memcpy((char *)retvals,
((char *)vetoReference) + NCHAN * chipIndex * sizeof(int),
sizeof(int) * NCHAN);
memcpy((char *)gainRetvals,
((char *)vetoGainIndices) + NCHAN * chipIndex * sizeof(int),
sizeof(int) * NCHAN);
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) {
LOG(logINFO, ("Configuring ADC [chipIndex:%d, adcIndex:%d, value:0x%x]\n",
chipIndex, adcIndex, value));

View File

@ -2055,21 +2055,28 @@ void *start_timer(void *arg) {
return NULL;
}
int64_t periodNs = getPeriod();
int numFrames = (getNumFrames() * getNumTriggers());
int64_t expUs = getGatePeriod() / 1000;
const int64_t periodNs = getPeriod();
const int numFrames = (getNumFrames() * getNumTriggers());
const int64_t expUs = getGatePeriod() / 1000;
int imagesize = calculateDataBytes();
int dataSize = imagesize / PACKETS_PER_FRAME;
int packetSize = dataSize + sizeof(sls_detector_header);
const int imagesize = calculateDataBytes();
const int tgEnable = enableTenGigabitEthernet(-1);
const int packetsPerFrame =
tgEnable ? PACKETS_PER_FRAME_10G : PACKETS_PER_FRAME_1G;
const int dataSize = imagesize / packetsPerFrame;
const int packetSize = dataSize + sizeof(sls_detector_header);
LOG(logDEBUG1,
("imagesize:%d tg:%d packets/Frame:%d datasize:%d packetSize:%d\n",
imagesize, tgEnable, packetsPerFrame, dataSize, packetSize));
// Generate data
char imageData[imagesize];
memset(imageData, 0, imagesize);
{
int dr = setDynamicRange(-1);
int numCounters = __builtin_popcount(getCounterMask());
int nchannels = NCHAN_1_COUNTER * NCHIP * numCounters;
const int dr = setDynamicRange(-1);
const int numCounters = __builtin_popcount(getCounterMask());
const int nchannels = NCHAN_1_COUNTER * NCHIP * numCounters;
switch (dr) {
/*case 1: // TODO: Not implemented in firmware yet
@ -2111,7 +2118,7 @@ void *start_timer(void *arg) {
int srcOffset = 0;
// loop packet
for (int i = 0; i != PACKETS_PER_FRAME; ++i) {
for (int i = 0; i != packetsPerFrame; ++i) {
char packetData[packetSize];
memset(packetData, 0, packetSize);

View File

@ -133,7 +133,8 @@ typedef struct udp_header_struct {
uint16_t udp_destport;
} udp_header;
#define UDP_IP_HEADER_LENGTH_BYTES (28)
#define PACKETS_PER_FRAME (2)
#define PACKETS_PER_FRAME_10G (2)
#define PACKETS_PER_FRAME_1G (20)
/** Signal Definitions */
#define SIGNAL_TBLoad_1 (0)

View File

@ -504,10 +504,9 @@ int getClockDivider(enum CLKINDEX ind);
int setInjectChannel(int offset, int increment);
void getInjectedChannels(int *offset, int *increment);
int setVetoReference(int gainIndex, int value);
int setVetoPhoton(int chipIndex, int gainIndex, int *values);
int configureASICVetoReference(int chipIndex, int *values);
int getVetoPhoton(int chipIndex, int *retvals);
int setVetoFile(int chipIndex, int *gainIndices, int *values);
int setVetoPhoton(int chipIndex, int *gainIndices, int *values);
int configureASICVetoReference(int chipIndex, int *gainIndices, int *values);
int getVetoPhoton(int chipIndex, int *retvals, int *gainRetvals);
int setADCConfiguration(int chipIndex, int adcIndex, int value);
int getADCConfiguration(int chipIndex, int adcIndex);
int setBurstModeinFPGA(enum burstMode value);

View File

@ -233,7 +233,6 @@ int get_cds_gain(int);
int set_cds_gain(int);
int get_filter(int);
int set_filter(int);
int set_veto_file(int);
int get_adc_config(int);
int set_adc_config(int);
int get_bad_channels(int);

View File

@ -350,7 +350,6 @@ void function_table() {
flist[F_SET_CDS_GAIN] = &set_cds_gain;
flist[F_GET_FILTER] = &get_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_SET_ADC_CONFIGURATION] = &set_adc_config;
flist[F_GET_BAD_CHANNELS] = &get_bad_channels;
@ -6329,44 +6328,52 @@ int get_inject_channel(int file_des) {
int set_veto_photon(int file_des) {
ret = OK;
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)
return printSocketReadError();
int values[args[2]];
memset(values, 0, sizeof(values));
const int chipIndex = args[0];
const int numChannels = args[1];
int gainIndices[numChannels];
if (receiveData(file_des, gainIndices, sizeof(gainIndices), INT32) < 0)
return printSocketReadError();
int values[numChannels];
if (receiveData(file_des, values, sizeof(values), INT32) < 0)
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
functionNotImplemented();
#else
// only set
if (Server_VerifyLock() == OK) {
int chipIndex = args[0];
int gainIndex = args[1];
int numChannels = args[2];
if (chipIndex < -1 || chipIndex >= NCHIP) {
ret = FAIL;
sprintf(mess, "Could not set veto photon. Invalid chip index %d\n",
chipIndex);
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) {
if (numChannels != NCHAN) {
ret = FAIL;
sprintf(mess,
"Could not set veto photon. Invalid number of channels %d. "
"Expected %d\n",
numChannels, NCHAN);
LOG(logERROR, (mess));
} else if (chipIndex < -1 || chipIndex >= NCHIP) {
ret = FAIL;
sprintf(mess, "Could not set veto photon. Invalid chip index %d\n",
chipIndex);
LOG(logERROR, (mess));
} else {
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) {
ret = FAIL;
sprintf(mess,
@ -6378,7 +6385,7 @@ int set_veto_photon(int file_des) {
}
}
if (ret == OK) {
ret = setVetoPhoton(chipIndex, gainIndex, values);
ret = setVetoPhoton(chipIndex, gainIndices, values);
if (ret == FAIL) {
sprintf(mess,
"Could not set veto photon for chip index %d\n",
@ -6398,6 +6405,8 @@ int get_veto_photon(int file_des) {
int arg = -1;
int retvals[NCHAN];
memset(retvals, 0, sizeof(retvals));
int gainRetvals[NCHAN];
memset(gainRetvals, 0, sizeof(gainRetvals));
if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0)
return printSocketReadError();
@ -6414,14 +6423,16 @@ int get_veto_photon(int file_des) {
chipIndex);
LOG(logERROR, (mess));
} else {
ret = getVetoPhoton(chipIndex, retvals);
ret = getVetoPhoton(chipIndex, retvals, gainRetvals);
if (ret == FAIL) {
strcpy(mess, "Could not get veto photon for chipIndex -1. Not the "
"same for all chips.\n");
strcpy(mess,
"Could not get veto photon for chipIndex -1. Not the "
"same for all chips. Select specific chip index instead.\n");
LOG(logERROR, (mess));
} else {
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 +6441,7 @@ int get_veto_photon(int file_des) {
if (ret != FAIL) {
int nch = NCHAN;
sendData(file_des, &nch, sizeof(nch), INT32);
sendData(file_des, gainRetvals, sizeof(gainRetvals), INT32);
sendData(file_des, retvals, sizeof(retvals), INT32);
}
return ret;
@ -7014,7 +7026,8 @@ int get_receiver_parameters(int file_des) {
return printSocketReadError();
// 10 gbe
#if defined(EIGERD) || defined(CHIPTESTBOARDD) || defined(MOENCHD)
#if defined(EIGERD) || defined(CHIPTESTBOARDD) || defined(MOENCHD) || \
defined(MYTHEN3D)
i32 = enableTenGigabitEthernet(GET_FLAG);
#else
i32 = 0;
@ -7763,78 +7776,6 @@ int set_filter(int file_des) {
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) {
ret = OK;
memset(mess, 0, sizeof(mess));

View File

@ -980,9 +980,9 @@ class Detector {
void setInjectChannel(const int offsetChannel, const int incrementChannel,
Positions pos = {});
/** [Gotthard2] adu values for each channel */
Result<std::vector<int>> getVetoPhoton(const int chipIndex,
Positions pos = {});
/** [Gotthard2] gain indices and adu values for each channel */
void getVetoPhoton(const int chipIndex, const std::string &fname,
Positions pos = {});
/** [Gotthard2] energy in keV */
void setVetoPhoton(const int chipIndex, const int numPhotons,
@ -993,7 +993,7 @@ class Detector {
void setVetoReference(const int gainIndex, const int value,
Positions pos = {});
/** [Gotthard2] */
/** [Gotthard2] gain indices and adu values for each channel */
void setVetoFile(const int chipIndex, const std::string &fname,
Positions pos = {});

View File

@ -1625,17 +1625,19 @@ std::string CmdProxy::VetoPhoton(int action) {
std::ostringstream os;
os << cmd << ' ';
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 "
"chip n_chip according to referenc file and #photons and energy "
"in keV."
"chip ichip according to reference file and #photons and energy "
"in keV.\n"
<< "[ichip] [output file]\n\t Get gain indices and veto reference "
"for 128 channels for chip ichip, saved to file."
<< '\n';
} else if (action == defs::GET_ACTION) {
if (args.size() != 1) {
WrongNumberOfParameters(1);
if (args.size() != 2) {
WrongNumberOfParameters(2);
}
auto t = det->getVetoPhoton(StringTo<int>(args[0]), {det_id});
os << args[0] << ' ' << OutStringHex(t) << '\n';
det->getVetoPhoton(StringTo<int>(args[0]), args[1], {det_id});
os << "saved to file " << args[1] << '\n';
} else if (action == defs::PUT_ACTION) {
if (args.size() != 4) {
WrongNumberOfParameters(4);
@ -1653,7 +1655,7 @@ std::string CmdProxy::VetoReference(int action) {
std::ostringstream os;
os << cmd << ' ';
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."
<< '\n';
} else if (action == defs::GET_ACTION) {
@ -1677,7 +1679,7 @@ std::string CmdProxy::VetoFile(int action) {
if (action == defs::HELP_ACTION) {
os << "[chip index 0-10, -1 for all] [file name] \n\t[Gotthard2] Set "
"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';
} else if (action == defs::GET_ACTION) {
throw sls::RuntimeError(

View File

@ -1290,9 +1290,9 @@ void Detector::setInjectChannel(const int offsetChannel,
incrementChannel);
}
Result<std::vector<int>> Detector::getVetoPhoton(const int chipIndex,
Positions pos) {
return pimpl->Parallel(&Module::getVetoPhoton, pos, chipIndex);
void Detector::getVetoPhoton(const int chipIndex, const std::string &fname,
Positions pos) {
pimpl->Parallel(&Module::getVetoPhoton, pos, chipIndex, fname);
}
void Detector::setVetoPhoton(const int chipIndex, const int numPhotons,

View File

@ -1392,7 +1392,37 @@ void Module::setInjectChannel(const int offsetChannel,
sendToDetector(F_SET_INJECT_CHANNEL, args, nullptr);
}
std::vector<int> Module::getVetoPhoton(const int chipIndex) const {
void Module::sendVetoPhoton(const int chipIndex, std::vector<int> gainIndices,
std::vector<int> values) {
const int nch = gainIndices.size();
if (gainIndices.size() != values.size()) {
throw RuntimeError("Number of Gain Indices and values do not match! "
"Gain Indices size: " +
std::to_string(gainIndices.size()) +
", values size: " + std::to_string(values.size()));
}
LOG(logDEBUG1) << "Sending veto photon/file to detector [chip:" << chipIndex
<< ", nch:" << nch << "]";
int fnum = F_SET_VETO_PHOTON;
int ret = FAIL;
int args[]{chipIndex, nch};
auto client = DetectorSocket(shm()->hostname, shm()->controlPort);
client.Send(&fnum, sizeof(fnum));
client.Send(args, sizeof(args));
client.Send(gainIndices.data(), sizeof(int) * nch);
client.Send(values.data(), 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 {
LOG(logDEBUG1) << "Getting veto photon [" << chipIndex << "]\n";
int fnum = F_GET_VETO_PHOTON;
int ret = FAIL;
auto client = DetectorSocket(shm()->hostname, shm()->controlPort);
@ -1405,16 +1435,29 @@ std::vector<int> Module::getVetoPhoton(const int chipIndex) const {
throw RuntimeError("Detector " + std::to_string(moduleId) +
" returned error: " + std::string(mess));
}
int nch = -1;
client.Receive(&nch, sizeof(nch));
if (nch != shm()->nChan.x) {
throw RuntimeError("Could not get veto photon. Expected " +
std::to_string(shm()->nChan.x) + " channels, got " +
std::to_string(nch));
}
std::vector<int> gainIndices(nch);
std::vector<int> values(nch);
client.Receive(gainIndices.data(), nch * sizeof(int));
client.Receive(values.data(), nch * sizeof(int));
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
<< " channels\n";
return retvals;
// 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,
@ -1441,14 +1484,11 @@ void Module::setVetoPhoton(const int chipIndex, const int numPhotons,
throw RuntimeError("Could not set veto photon. Could not open file: " +
fname);
}
LOG(logDEBUG1) << "Setting veto photon. Reading Gain values from file";
int totalEnergy = numPhotons * energy;
int ch = shm()->nChan.x;
int gainIndex = 2;
int nRead = 0;
int value[ch];
memset(value, 0, sizeof(value));
bool firstLine = true;
std::vector<int> gainIndices;
std::vector<int> values;
while (infile.good()) {
std::string line;
@ -1460,65 +1500,41 @@ void Module::setVetoPhoton(const int chipIndex, const int numPhotons,
continue;
}
std::istringstream ss(line);
// first line: caluclate gain index from gain thresholds from file
if (firstLine) {
int g0 = -1, g1 = -1;
ss >> g0 >> g1;
if (ss.fail()) {
throw RuntimeError(
"Could not set veto photon. Invalid gain thresholds");
}
// set gain index and gain bit values
if (totalEnergy < g0) {
gainIndex = 0;
} else if (totalEnergy < g1) {
gainIndex = 1;
}
LOG(logINFO) << "Setting veto photon. Reading Gain " << gainIndex
<< " values";
firstLine = false;
// read pedestal, gain values, gain thresholds
double gainPedestal[3] = {-1, -1, -1};
double gainValue[3] = {-1, -1, -1};
int gainThreshold[2] = {-1, -1};
ss >> gainPedestal[0] >> gainPedestal[1] >> gainPedestal[2] >>
gainValue[0] >> gainValue[1] >> gainValue[2] >> gainThreshold[0] >>
gainThreshold[1];
if (ss.fail()) {
throw RuntimeError("Could not set veto photon. Invalid pedestals, "
"gain values or gain thresholds for channel " +
std::to_string(gainIndices.size()));
}
// read pedestal and gain values
else {
double p[3] = {-1, -1, -1}, g[3] = {-1, -1, -1};
ss >> p[0] >> p[1] >> p[2] >> g[0] >> g[1] >> g[2];
if (ss.fail()) {
throw RuntimeError("Could not set veto photon. Invalid "
"pedestal or gain values for channel " +
std::to_string(nRead));
}
value[nRead] =
p[gainIndex] +
(g[gainIndex] *
totalEnergy); // ADU value = pedestal + gain * total energy
++nRead;
if (nRead >= ch) {
break;
}
// caluclate gain index from gain thresholds and threhsold energy
int gainIndex = 2;
if (totalEnergy < gainThreshold[0]) {
gainIndex = 0;
} else if (totalEnergy < gainThreshold[1]) {
gainIndex = 1;
}
gainIndices.push_back(gainIndex);
// calculate ADU value
values.push_back(gainPedestal[gainIndex] +
(gainValue[gainIndex] * totalEnergy));
}
if (nRead != ch) {
throw RuntimeError("Could not set veto photon. Insufficient pedestal "
"pr gain values: " +
std::to_string(nRead));
// check size
if ((int)gainIndices.size() != shm()->nChan.x) {
throw RuntimeError("Could not set veto photon. Invalid number of "
"entries in file. Expected " +
std::to_string(shm()->nChan.x) + ", read " +
std::to_string(gainIndices.size()));
}
int fnum = F_SET_VETO_PHOTON;
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));
}
sendVetoPhoton(chipIndex, gainIndices, values);
}
void Module::setVetoReference(const int gainIndex, const int value) {
@ -1548,12 +1564,8 @@ void Module::setVetoFile(const int chipIndex, const std::string &fname) {
" for reading");
}
int ch = shm()->nChan.x;
int nRead = 0;
int gainIndices[ch];
memset(gainIndices, 0, sizeof(gainIndices));
int values[ch];
memset(values, 0, sizeof(values));
std::vector<int> gainIndices;
std::vector<int> values;
for (std::string line; std::getline(input_file, line);) {
if (line.find('#') != std::string::npos) {
@ -1564,43 +1576,34 @@ void Module::setVetoFile(const int chipIndex, const std::string &fname) {
// convert command and string to a vector
std::istringstream iss(line);
std::string val;
iss >> gainIndices[nRead] >> val;
int gainIndex = -1;
int value = -1;
iss >> gainIndex >> val;
if (iss.fail()) {
throw RuntimeError("Could not set veto file. Invalid gain "
"or reference value for channel " +
std::to_string(nRead));
std::to_string(gainIndices.size()));
}
try {
values[nRead] = StringTo<int>(val);
value = StringTo<int>(val);
} catch (...) {
throw RuntimeError("Could not set veto file. Invalid value " +
val + " for channel " +
std::to_string(nRead));
}
++nRead;
if (nRead >= ch) {
break;
std::to_string(gainIndices.size()));
}
gainIndices.push_back(gainIndex);
values.push_back(value);
}
}
int fnum = F_SET_VETO_FILE;
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));
// check size
if ((int)gainIndices.size() != shm()->nChan.x) {
throw RuntimeError("Could not set veto file. Invalid number of "
"entries in file. Expected " +
std::to_string(shm()->nChan.x) + ", read " +
std::to_string(gainIndices.size()));
}
sendVetoPhoton(chipIndex, gainIndices, values);
}
slsDetectorDefs::burstMode Module::getBurstMode() const {
@ -1693,7 +1696,7 @@ void Module::getBadChannels(const std::string &fname) const {
std::ofstream outfile;
outfile.open(fname.c_str(), std::ios_base::out);
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) {
outfile << badchannels[i] << '\n';

View File

@ -371,7 +371,9 @@ class Module : public virtual slsDetectorDefs {
void setBurstPeriod(int64_t value);
std::array<int, 2> getInjectChannel() const;
void setInjectChannel(const int offsetChannel, const int incrementChannel);
std::vector<int> getVetoPhoton(const int chipIndex) const;
void sendVetoPhoton(const int chipIndex, std::vector<int> gainIndices,
std::vector<int> values);
void getVetoPhoton(const int chipIndex, const std::string &fname) const;
void setVetoPhoton(const int chipIndex, const int numPhotons,
const int energy, const std::string &fname);
void setVetoReference(const int gainIndex, const int value);
@ -519,7 +521,7 @@ class Module : public virtual slsDetectorDefs {
private:
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)

View File

@ -316,7 +316,9 @@ TEST_CASE("vetophoton", "[.cmd][.new]") {
if (det_type == defs::GOTTHARD2) {
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,
PUT)); // invalid chip index
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,
PUT)); // invald file
} else {
REQUIRE_THROWS(proxy.Call("vetophoton", {"-1"}, -1, GET));
REQUIRE_THROWS(
proxy.Call("vetophoton", {"-1", "/tmp/bla.txt"}, -1, GET));
}
}

View File

@ -462,6 +462,7 @@ class Mythen3Data : public GeneralData {
*/
void SetDynamicRange(int dr, bool tgEnable) {
imageSize = nPixelsX * nPixelsY * ((double)dr / 8.00);
packetsPerFrame = tgEnable ? 2 : 20;
dataSize = imageSize / packetsPerFrame;
packetSize = headerSizeinPacket + dataSize;
LOG(logINFO) << "PacketSize: " << packetSize;

View File

@ -207,7 +207,6 @@ enum detFuncs {
F_SET_CDS_GAIN,
F_GET_FILTER,
F_SET_FILTER,
F_SET_VETO_FILE,
F_GET_ADC_CONFIGURATION,
F_SET_ADC_CONFIGURATION,
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_GET_FILTER: return "F_GET_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_GET_ADC_CONFIGURATION: return "F_GET_ADC_CONFIGURATION";
case F_GET_BAD_CHANNELS: return "F_GET_BAD_CHANNELS";

View File

@ -3,10 +3,10 @@
#define APILIB 0x200409
#define APIRECEIVER 0x200409
#define APIGUI 0x200409
#define APICTB 0x200723
#define APIGOTTHARD 0x200723
#define APIMYTHEN3 0x200723
#define APIMOENCH 0x200722
#define APIEIGER 0x200723
#define APIJUNGFRAU 0x200728
#define APIGOTTHARD2 0x200728
#define APICTB 0x200729
#define APIGOTTHARD 0x200729
#define APIGOTTHARD2 0x200729
#define APIJUNGFRAU 0x200729
#define APIMYTHEN3 0x200729
#define APIMOENCH 0x200728
#define APIEIGER 0x200729