|
Pottu
|
Pipeline stage which applies second order calibration. More...
#include <Calibrator.hpp>


Classes | |
| struct | item_t |
| Struct holding the calibration coefficients. More... | |
Public Member Functions | |
| Calibrator () | |
| Constructor. More... | |
| void | readFromGainsFile (const std::string &filename) |
| Reads grain-compatible gains file. More... | |
| double | getCalibratedValue (unsigned int ch, int data) noexcept |
| Returns a calibrated value for a ch and adc value. More... | |
| void | fillCalibratedEnergy (DetectorEvent &event) noexcept |
| Returns a calibrated value for a detector event. More... | |
| virtual void | process (std::vector< DetectorEvent > &data) noexcept |
| Assigns calibrated energies to all events. More... | |
| void | setCoefficients (unsigned int ch, float c0, float c1, float c2) noexcept |
| Sets the coefficient for the channel. More... | |
Public Member Functions inherited from pottu::StageDetectorEvent | |
| virtual | ~StageDetectorEvent () |
| Virtual desctructor. | |
Pipeline stage which applies second order calibration.
The stage reads the adc value of each DetectorEvent, calculates the calibrated energy with the model
e = a + b*x + c*x*x
where a, b and c are constants set by user or read from a file. The default values are a=0; b=1; c=0.
The maximum number of daq channels supported is 4096.
|
inline |
Constructor.
Creates the Calibrator object. All coefficients for daq channels 0–4095 are set to have a=0; b=1; c=0.
|
inlinenoexcept |
Returns a calibrated value for a detector event.
| event | Detector event which is used to read the channel number and adc value. Ch number of the event must be in range [0,4095]. Bigger number will read random memory location. |
An uniformly distributed random number with range [-0.5,0.5] is summed to the adc value before applying the model.
|
inlinenoexcept |
Returns a calibrated value for a ch and adc value.
| ch | Data acquisition channel number. Must be in range [0,4095]. Bigger number will read random memory location. |
| data | ADC value to be used. |
An uniformly distributed random number with range [-0.5,0.5] is summed to the adc value before applying the model.
|
inlinevirtualnoexcept |
Assigns calibrated energies to all events.
| data | Detector events to be calibrated. |
Maximimum channel number is 4095 in DetectorEvent. Bigger number will lead to undefined behavior!
An uniformly distributed random number with range [-0.5,0.5] is summed to the adc value before applying the model.
Implements pottu::StageDetectorEvent.
|
inline |
Reads grain-compatible gains file.
| filename | Filenmame of the gains file to be read. |
File is read with scanf function with the format %d = %lf %lf %lf %d. I.e. the file should have rows like
32 = -23.4 0.456 0 0 921 = -1.4 0.1233 2.231124e-8 0
Channels which are not set in the file will remain unchanged.
|
inlinenoexcept |
Sets the coefficient for the channel.
| ch | Data-acquisition channel. Bigger values than 4095 causes exit(EXIT_FAILURE) to be called. |
| c0 | Offset value. |
| c1 | First order coefficient. |
| c2 | Second order coefficient. |