Open lucabaldini opened 7 years ago
It seems like most of the relevant code is in
pXpolFpga::setDacThreshold(pDetectorConfiguration *configuration)
and if I parse the code correctly, here we're setting the threshold DAC for the 16 buffers and the calibration DAC at the same time. The threshold DAC is referred to vref in the function
// Reads the reference voltage in DAC and sum it to the thresholds - To Be Fixed later
unsigned short vref_dac = readVrefDac();
for(int i=0;i<15;i++)
copythreshold[i] = trh_buffer[i]+ (unsigned short)(vref_dac*AD2_LSB/DAC_LSB);
so all we need is a function call every time a buffer is read out.
And, on a related note, we might consider splitting the functions setting the threshold DAC and the calibration DAC, so that we're not forced to set both of them all the time.
We do have a first hack in place. One thing to notice is that it only makes sense to do this in windowed mode (and as a matter of fact if we call the setDacThreshold() method while running in full frame the system just hangs after the first buffer). The code reads
if (!m_fullFrame) {
pXpolFpga xpol(m_usbController);
xpol.setDacThreshold(m_detectorConfiguration);
}
Ok, there's a first implementation correcting for the vref every 10 seconds---hard-coded in pDataCollector.
In the future we might want to write the value of the vref along with the buffer in the output binary file, but this requires a change in the data format, so it needs planning.
A few notes from a discussion with Ronaldo.
We observed the vref drifting with time and, since the trigger threshold is referred to vref, if we do not compensate for it, we might have a change with time of the trigger efficiency and/or the window size and the pulse height.
We want to: