Closed TheFl0w closed 7 years ago
In this case you should follow the code over the pdf.
1 and 2 agree.
3: it's just a question of how the gain is defined in the maps, but the way it is at the moment you need to divide by the gain.
4: it should be nop = (energy + (beamE/2.))/beamE
. The reason that this is different between code and pdf is just to ensure that when it's cast to an int it is rounded, not floored.
The conversion algorithm to get the number of photons you are using in the example program seems to be different from the algorithm you show in the pdf. I think the wrong pedestal maps are used in step 2, and the energy and number of photons is calculated in a completely different way. Is the algorithm in the pdf the correct one? Also, gain stages are encoded as {0, 1, 3}. Is this correct?
From my understanding:
adc
: raw ADC data for one pixeladcpc
: pedestal corrected ADC data for one pixelenergy
: calibrated energy for the gain stagemapsObjectGain->gXVALs[i]
: gainmaps for gain stage XbeamE
: beam energyPDF version
adcpc = adc - pedestals16_G0[i];
adcpc = pedestals16_G1[i] - adc;
adcpc = pedestals16_G2[i] - adc;
energy = adcpc * mapsObjectGain->g0VALs[i];
energy = adcpc * mapsObjectGain->g1VALs[i];
energy = adcpc * mapsObjectGain->g2VALs[i];
nop = energy / beamE;
Code version
adcpc = adc - pedestals16_G0[i];
adcpc = pedestals16_G1[i] - adc;
adcpc = pedestals16_G1[i] - adc;
energy = (adc - pedestals16_G0[i]) / mapsObjectGain->g0VALs[i];
energy = (-1)*(pedestals16_G1[i] - adc) / mapsObjectGain->g1VALs[i];
energy = (-1)*(pedestals16_G2[i] - adc) / mapsObjectGain->g2VALs[i];
nop = (energy + beamE / 2) / beamE;