1 #ifndef _CALIB_CLASSES_H_
2 #define _CALIB_CLASSES_H_
36 virtual std::ostream&
print( std::ostream& a_stream =std::cout)
const;
59 inline double applyCalib(
double a_value)
const;
77 inline double applyCalib(
double a_value)
const;
79 virtual std::ostream&
print( std::ostream& a_stream = std::cout)
const;
96 virtual inline double applyCalib(
double a_value)
const;
101 virtual std::ostream&
print( std::ostream& a_stream = std::cout)
const;
120 inline double applyCalib(
double a_value)
const;
121 void setCalibration(
double a_quadScalar,
double a_scalar,
double a_offset);
125 virtual std::ostream&
print( std::ostream& a_stream = std::cout)
const;
145 inline double applyCalib(
double a_value)
const;
146 void setCoeffs(std::vector<double> a_calibCoeffs);
147 virtual std::ostream&
print( std::ostream& a_stream = std::cout)
const;
150 std::vector< double > m_calibCoeff;
162 inline double applyCalib(
double a_value)
const;
165 virtual std::ostream&
print( std::ostream& a_stream = std::cout)
const;
168 std::map<uint32_t,double> m_gcFactorMap;
181 inline double applyCalib(
double a_value)
const;
184 virtual std::ostream&
print( std::ostream& a_stream = std::cout)
const;
187 std::map<uint32_t,double> m_tdOffset;
201 inline double applyCalib(
double a_value)
const;
204 virtual std::ostream&
print( std::ostream& a_stream = std::cout)
const;
207 std::map<uint32_t,double> m_gcFactorMap;
214 return a_value*m_scalar;
239 auto mpIter = m_gcFactorMap.find(
m_t);
240 if(mpIter!=m_gcFactorMap.end())
242 double factor = mpIter->second;
251 auto mpIter = m_tdOffset.upper_bound(
m_t);
252 auto secondIter = m_tdOffset.begin();
255 if(mpIter != m_tdOffset.end()
257 && mpIter != m_tdOffset.begin()
260 double tAfter = mpIter->first;
261 double offsetAfter = mpIter->second;
263 double tBefore = mpIter->first;
264 double offsetBefore = mpIter->second;
265 double dt = tAfter-tBefore;
266 double slope = (offsetAfter-offsetBefore)/dt;
267 double step =
m_t-tBefore;
268 double additionalOffset = step*slope;
269 return a_value +
m_offset+additionalOffset+offsetBefore;
279 auto mpIter = m_gcFactorMap.find(
m_t);
280 if(mpIter!=m_gcFactorMap.end())
282 double factor = mpIter->second;
284 double cV = factor*a_value;
CalibType
Definition: CalibrationClasses.h:12
@ offset
Definition: CalibrationClasses.h:14
@ linear
Definition: CalibrationClasses.h:15
@ quadratic
Definition: CalibrationClasses.h:16
@ scalar
Definition: CalibrationClasses.h:13
Definition: CalibrationClasses.h:21
void setTDiv(int a_timeDiv)
sets the divisor for which to consider the given time
Definition: CalibrationClasses.cpp:39
int m_tDiv
Definition: CalibrationClasses.h:48
void setTime(uint32_t a_t)
sets the experiment time during the processing in time since epoch
Definition: CalibrationClasses.cpp:32
uint32_t m_t
Definition: CalibrationClasses.h:47
CalibType m_type
Definition: CalibrationClasses.h:46
virtual DetectorCalib * clone()=0
CalibType getCalibType()
Definition: CalibrationClasses.cpp:27
virtual ~DetectorCalib()
Definition: CalibrationClasses.cpp:17
DetectorCalib()
Definition: CalibrationClasses.cpp:9
virtual double applyCalib(double a_value) const =0
virtual std::ostream & print(std::ostream &a_stream=std::cout) const
prints nothing by default
Definition: CalibrationClasses.cpp:3
virtual double invertCalib(double a_value) const
Definition: CalibrationClasses.cpp:22
Definition: CalibrationClasses.h:89
double invertCalib(double a_value) const
Definition: CalibrationClasses.h:224
LinearCalib()
Definition: CalibrationClasses.cpp:83
virtual std::ostream & print(std::ostream &a_stream=std::cout) const
prints nothing by default
Definition: CalibrationClasses.cpp:245
void setCalibration(double a_scalar, double a_offset)
Definition: CalibrationClasses.cpp:90
void setOffset(double a_offset)
Definition: CalibrationClasses.cpp:100
virtual LinearCalib * clone()
Definition: CalibrationClasses.cpp:105
double m_scalar
scalar for the calibration
Definition: CalibrationClasses.h:105
void setScalar(double a_scalar)
Definition: CalibrationClasses.cpp:95
virtual double applyCalib(double a_value) const
returns a_value*m_scalar+m_offset
Definition: CalibrationClasses.h:220
double m_offset
offset for the calibration
Definition: CalibrationClasses.h:107
Definition: CalibrationClasses.h:71
virtual std::ostream & print(std::ostream &a_stream=std::cout) const
prints nothing by default
Definition: CalibrationClasses.cpp:238
double m_offset
offset for the calibration
Definition: CalibrationClasses.h:83
virtual OffsetCalib * clone()
Definition: CalibrationClasses.cpp:77
double applyCalib(double a_value) const
returns a_value + m_offset
Definition: CalibrationClasses.h:216
OffsetCalib()
Definition: CalibrationClasses.cpp:64
void setOffset(double a_offset)
returns a_value + m_offset
Definition: CalibrationClasses.cpp:72
Definition: CalibrationClasses.h:138
virtual std::ostream & print(std::ostream &a_stream=std::cout) const
prints nothing by default
Definition: CalibrationClasses.cpp:264
void setCoeffs(std::vector< double > a_calibCoeffs)
Definition: CalibrationClasses.cpp:153
virtual PolyCalib * clone()
Definition: CalibrationClasses.cpp:159
PolyCalib()
Definition: CalibrationClasses.cpp:148
double applyCalib(double a_value) const
returns gc(t)*a_value*m_scalar+m_offset
Definition: CalibrationClasses.h:232
Definition: CalibrationClasses.h:112
void setCalibration(double a_quadScalar, double a_scalar, double a_offset)
Definition: CalibrationClasses.cpp:119
double m_offset
scalar for the calibration
Definition: CalibrationClasses.h:133
void setQuadScalar(double a_quadScalar)
Definition: CalibrationClasses.cpp:128
virtual QuadraticCalib * clone()
Definition: CalibrationClasses.cpp:143
void setScalar(double a_scalar)
Definition: CalibrationClasses.cpp:133
virtual std::ostream & print(std::ostream &a_stream=std::cout) const
prints nothing by default
Definition: CalibrationClasses.cpp:253
double m_scalar
scalar for the calibration
Definition: CalibrationClasses.h:131
void setOffset(double a_offset)
Definition: CalibrationClasses.cpp:138
double m_quadScalar
Definition: CalibrationClasses.h:129
double applyCalib(double a_value) const
returns a_value*a_value*m_quadScalar + a_value*m_scalar
Definition: CalibrationClasses.h:228
QuadraticCalib()
returns a_value*a_value*m_quadScalar + a_value*m_scalar
Definition: CalibrationClasses.cpp:111
Definition: CalibrationClasses.h:53
virtual ScalarCalib * clone()
Definition: CalibrationClasses.cpp:58
void setScalar(double a_scalar)
Definition: CalibrationClasses.cpp:52
ScalarCalib()
Definition: CalibrationClasses.cpp:44
double applyCalib(double a_value) const
returns a_value*m_scalar
Definition: CalibrationClasses.h:212
Definition: CalibrationClasses.h:155
virtual std::ostream & print(std::ostream &a_stream=std::cout) const
prints nothing by default
Definition: CalibrationClasses.cpp:180
double applyCalib(double a_value) const
returns gc(t)*a_value*m_scalar+m_offset
Definition: CalibrationClasses.h:237
virtual TDepLinearCalib * clone()
Definition: CalibrationClasses.cpp:168
TDepLinearCalib()
Definition: CalibrationClasses.cpp:163
void setGainCorrectionFactors(const std::map< uint32_t, double > &a_gcMap)
Definition: CalibrationClasses.cpp:175
Definition: CalibrationClasses.h:174
void setOffsetCorrectionFactors(const std::map< uint32_t, double > &a_tdMap)
Definition: CalibrationClasses.cpp:194
double applyCalib(double a_value) const
returns gc(t)*a_value*m_scalar+m_offset
Definition: CalibrationClasses.h:248
virtual std::ostream & print(std::ostream &a_stream=std::cout) const
prints nothing by default
Definition: CalibrationClasses.cpp:199
virtual TDepOffsetCalib * clone()
Definition: CalibrationClasses.cpp:208
TDepOffsetCalib()
Definition: CalibrationClasses.cpp:189
Definition: CalibrationClasses.h:194
virtual TDepPolyCalib * clone()
Definition: CalibrationClasses.cpp:233
void setGainCorrectionFactors(const std::map< uint32_t, double > &a_gcMap)
Definition: CalibrationClasses.cpp:219
virtual std::ostream & print(std::ostream &a_stream=std::cout) const
prints nothing by default
Definition: CalibrationClasses.cpp:224
TDepPolyCalib()
Definition: CalibrationClasses.cpp:214
double applyCalib(double a_value) const
returns gc(t)*a_value*m_scalar+m_offset
Definition: CalibrationClasses.h:277