FloatArrayGainCalibration.h
Go to the documentation of this file.
1 // FloatArrayGainCalibration.h
2 
3 // David Adams
4 // February 2019
5 //
6 // Applies a gain calibration to ADC channel data.
7 // The assigned sample charge is
8 // q = Gains[icha]*(adc - ped)
9 // where adc is the raw value, ped is the pedestal and Gains is taken from
10 // a FloatArrayTool.
11 //
12 // Underflow flag is set for ADC value at or below AdcUnderflow
13 // Overflow flag is set for ADC value at or above AdcOverflow
14 //
15 // Parameters:
16 // LogLevel - 0: silent
17 // 1: display configuration in ctor
18 // 2: display when channel is out of range
19 // Unit - units for the calibrated samples ("fC", "ke", "mV", ...)
20 // If "derived", then /(ADC count) is removed from the gain unit.
21 // GainDefault - Gain used if input gain is <=0 or missing.
22 // If this value is negative, then the default value of
23 // GainTool is used instead (Feb 2021).
24 // AdcUnderflowDefault - value for underflow
25 // AdcOverflowDefault - value for overflow
26 // GainTool - Name of the FloatArrayTool holding the gains.
27 // ScaleFactor - Scale factor formula for the gain (tool or default)
28 //
29 // Output:
30 // calibSampleCount - # of samples calibrated (size of raw data)
31 // calibUnderflowCount - # samples flagged as underflow (ADC <= AdcMin)
32 // calibOverflowCount - # samples flagged as underflow (ADC >= AdcMax)
33 // calibAdcMin - min ADC for the channel
34 // calibAdcMax - max ADC for the channel
35 // calibGain - applied gain
36 //
37 // In the case of zero or negative gain, only the last is returned.
38 //
39 
40 #ifndef FloatArrayGainCalibration_H
41 #define FloatArrayGainCalibration_H
42 
44 #include "fhiclcpp/ParameterSet.h"
47 
48 class FloatArrayTool;
49 class RunDataTool;
50 
52 : public TpcDataTool {
53 
54 public:
55 
56  using Name = std::string;
57  using FloatArrayPtr = const FloatArrayTool*;
58 
60 
61  DataMap view(const AdcChannelData& acd) const override;
62 
63  DataMap update(AdcChannelData& acd) const override;
64 
65 private:
66 
67  // Configuration parameters.
75 
76  // Derived parameters.
78  const RunDataTool* m_prdtool; // Run data tool.
79 
80 };
81 
82 
83 #endif
DataMap update(AdcChannelData &acd) const override
DataMap view(const AdcChannelData &acd) const override
std::string string
Definition: nybbler.cc:12
static constexpr double ps
Definition: Units.h:99
unsigned int AdcIndex
Definition: AdcTypes.h:15
FloatArrayGainCalibration(fhicl::ParameterSet const &ps)