FembLinearCalibration.h
Go to the documentation of this file.
1 // FembLinearCalibration.h
2 
3 // David Adams
4 // November 2017
5 //
6 // Applies a linear FEMB-based calibration to ADC channel data.
7 // The sample charge is
8 // q = Gains[icha]*(adc - ped)
9 // where adc is the raw value, ped is the pedestal and Gains is a calibration
10 // parameter.
11 // The sample flag is set to underflow if the raw ADC value is at or below
12 // the calibration parameter AdcMins[icha].
13 // The sample flag is set to overflow if the raw ADC value is at or above
14 // the calibration parameter AdcMaxs[icha].
15 // If AdcMins has length zero, then AdcMin is used for all channels.
16 // If AdcMaxs has length zero, then AdcMax is used for all channels.
17 //
18 // If the gain is zero or negative, then no calibration is performed and the
19 // prepared data vector is cleared.
20 //
21 // Calibration parameters are read from fcl files with the name FclNameBaseFFF
22 // where FFF is the FEMB ID.
23 //
24 // Parameters:
25 // LogLevel - 0=silent, 1=init, 2=each event, >2=more
26 // Units - units for the calibrated samples ("fC", "ke", "mV", ...)
27 // Gains - gain for each channel
28 // AdcMin - min ADC if AdcMins is empty
29 // AdcMins - min ADC for each channel
30 // AdcMax - max ADC if AdcMaxs is empty
31 // AdcMaxs - max ADC for each channel
32 //
33 // Output:
34 // calibSampleCount - # of samples calibrated (size of raw data)
35 // calibUnderflowCount - # samples flagged as underflow (ADC <= AdcMin)
36 // calibOverflowCount - # samples flagged as underflow (ADC >= AdcMax)
37 // calibAdcMin - min ADC for the channel
38 // calibAdcMax - max ADC for the channel
39 // calibGain - applied gain
40 //
41 // In the case of zero or negative gain, only the last is returned.
42 //
43 
44 #ifndef FembLinearCalibration_H
45 #define FembLinearCalibration_H
46 
48 #include "fhiclcpp/ParameterSet.h"
50 
52 : public TpcDataTool {
53 
54 public:
55 
57 
58  DataMap view(const AdcChannelData& acd) const override;
59 
60  DataMap update(AdcChannelData& acd) const override;
61 
62 private:
63 
64  // Parameters.
72 
73 };
74 
75 
76 #endif
std::vector< AdcCount > AdcCountVector
Definition: AdcTypes.h:19
FembLinearCalibration(fhicl::ParameterSet const &ps)
std::string string
Definition: nybbler.cc:12
DataMap update(AdcChannelData &acd) const override
static constexpr double ps
Definition: Units.h:99
std::vector< AdcSignal > AdcSignalVector
Definition: AdcTypes.h:22
short AdcCount
Definition: AdcTypes.h:18
DataMap view(const AdcChannelData &acd) const override