Pixie16 Analysis Software Suite
Analysis code for processing of .ldf files
Calibrator Class Reference

Class to handle energy calibrations. More...

#include <Calibrator.hpp>

Collaboration diagram for Calibrator:

Public Member Functions

 Calibrator ()
 
 ~Calibrator ()
 
void AddChannel (const Identifier &chanID, const std::string model, double min, double max, const std::vector< double > &par)
 
double GetCalEnergy (const Identifier &chanID, double raw) const
 

Private Member Functions

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
 

Private Attributes

std::map< Identifier, std::vector< CalibrationParams > > channels_
 

Detailed Description

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)

Constructor & Destructor Documentation

Calibrator::Calibrator ( )
inline

Default constructor

Calibrator::~Calibrator ( )
inline

Default Destructor

Member Function Documentation

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.

Field Documentation

std::map<Identifier, std::vector<CalibrationParams> > Calibrator::channels_
private

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: