Class to handle energy calibrations.
More...
#include <Calibrator.hpp>
|
double | ModelRaw (double raw) const |
|
double | ModelOff () const |
|
double | ModelLinear (const std::vector< double > &par, double raw) const |
|
double | ModelQuadratic (const std::vector< double > &par, double raw) const |
|
double | ModelCubic (const std::vector< double > &par, double raw) const |
|
double | ModelPolynomial (const std::vector< double > &par, double raw) const |
|
double | ModelHypLin (const std::vector< double > &par, double raw) const |
|
double | ModelExp (const std::vector< double > &par, double raw) const |
|
Class to handle energy calibrations.
The Calibrator class returns calibrated energy for the raw channel number. The calibration model and parameters are loaded from Config.xml file (Map section)
Calibrator::Calibrator |
( |
| ) |
|
|
inline |
Calibrator::~Calibrator |
( |
| ) |
|
|
inline |
void Calibrator::AddChannel |
( |
const Identifier & |
chanID, |
|
|
const std::string |
model, |
|
|
double |
min, |
|
|
double |
max, |
|
|
const std::vector< double > & |
par |
|
) |
| |
Add new channel, identified by chanID, to the list of known channels and their calibration model and parameters
- Parameters
-
[in] | chanID | : the channel ID to add to the calibrator |
[in] | model | : the model to associate with the channel |
[in] | min | : the minimum value for the range of the calibration |
[in] | max | : the maximum value for the range of the calibration |
[in] | par | : the vector of coefficients for the model |
double Calibrator::GetCalEnergy |
( |
const Identifier & |
chanID, |
|
|
double |
raw |
|
) |
| const |
- Returns
- calibrated energy for the channel indetified by chanID.
- Parameters
-
[in] | chanID | : the channel ID to get the energy for |
[in] | raw | : the raw value to use for the calibration |
double Calibrator::ModelCubic |
( |
const std::vector< double > & |
par, |
|
|
double |
raw |
|
) |
| const |
|
private |
Cubic calibration, parameters are assumed to be sorted in order par0, par1, par2, par3 f(x) = par0 + par1 * x + par2 * x^2 + par3 * x^3
- Parameters
-
[in] | par | : the vector of calibration coeffs |
[in] | raw | : the raw value to calibrate |
- Returns
- Calibrated energy
double Calibrator::ModelExp |
( |
const std::vector< double > & |
par, |
|
|
double |
raw |
|
) |
| const |
|
private |
Exponential (for logarithmic preamp) f(x) = par0 * exp(x / par[1]) + par2
- Parameters
-
[in] | par | : the vector of calibration coeffs |
[in] | raw | : the raw value to calibrate |
- Returns
- Calibrated energy
double Calibrator::ModelHypLin |
( |
const std::vector< double > & |
par, |
|
|
double |
raw |
|
) |
| const |
|
private |
Linear plus hyperbolic calibration, parameters are assumed to be sorted from the lowest order to the highest f(x) = par0 / x + par1 + par2 * x
- Parameters
-
[in] | par | : the vector of calibration coeffs |
[in] | raw | : the raw value to calibrate |
- Returns
- Calibrated energy
double Calibrator::ModelLinear |
( |
const std::vector< double > & |
par, |
|
|
double |
raw |
|
) |
| const |
|
private |
Linear calibration, parameters are assumed to be sorted in order par0, par1 f(x) = par0 + par1 * x
- Parameters
-
[in] | par | : the vector of calibration coeffs |
[in] | raw | : the raw value to calibrate |
- Returns
- Calibrated energy
double Calibrator::ModelOff |
( |
| ) |
const |
|
private |
Use if you want to switch off the channel
- Returns
- 0.
double Calibrator::ModelPolynomial |
( |
const std::vector< double > & |
par, |
|
|
double |
raw |
|
) |
| const |
|
private |
Polynomial calibration, where parameters are assumed to be sorted from the lowest order to the highest f(x) = par0 + par1 * x + par2 * x^2 + ...
Note that this model covers also Linear and Quadratic, however it is slower due to looping over unknown apriori number of parameters.
- Parameters
-
[in] | par | : the vector of calibration coeffs |
[in] | raw | : the raw value to calibrate |
- Returns
- Calibrated energy
double Calibrator::ModelQuadratic |
( |
const std::vector< double > & |
par, |
|
|
double |
raw |
|
) |
| const |
|
private |
Quadratic calibration, parameters are assumed to be sorted in order par0, par1, par2 f(x) = par0 + par1 * x + par2 * x^2
- Parameters
-
[in] | par | : the vector of calibration coeffs |
[in] | raw | : the raw value to calibrate |
- Returns
- Calibrated energy
double Calibrator::ModelRaw |
( |
double |
raw | ) |
const |
|
private |
Use if you want to switch off the calibration.
- Parameters
-
[in] | raw | : the raw value to calibrate |
- Returns
- the raw channel number.
Map where key is a channel Identifier and value is a vector holding struct with calibration range and calibration model and parameters.
The documentation for this class was generated from the following file: