Belle II Software development
SVDCoGCalibrationFunction Class Reference

class to contain the CoG Time calibrations More...

#include <SVDCoGCalibrationFunction.h>

Inheritance diagram for SVDCoGCalibrationFunction:

Public Types

typedef double(SVDCoGCalibrationFunction::* cogFunction) (double, int) const
 typedef of the return value of the calibration function
 
typedef double(SVDCoGCalibrationFunction::* cogFunctionErr) (double, double, int) const
 typedef of the return value of the calibration function ERROR
 

Public Member Functions

double calibratedValue (double raw_time, int trigger_bin) const
 returns the calibrated value of raw_time, depending on the trigger bin
 
double calibratedValueError (double raw_time, double raw_timeErr, int trigger_bin) const
 returns the error of the calibrated value of raw_time, depending on the trigger bin
 
 SVDCoGCalibrationFunction ()
 constructor
 
void set_current (int current)
 allows to choose the function version
 
void set_bias (double tb0, double tb1, double tb2, double tb3)
 set the trigger bin dependent shift
 
void set_scale (double tb0, double tb1, double tb2, double tb3)
 set the trigger bin dependent scale
 
void set_pol3parameters (double a, double b, double c, double d)
 set the pol3 TB independent parameters
 
void set_pol5parameters (double a, double b, double c, double d, double e, double f)
 set the pol5 TB independent parameters
 
void set_elsparameters (double a, double b, double c, double d)
 set the parameters for the ELS TB independent function
 
 SVDCoGCalibrationFunction (const Belle2::SVDCoGCalibrationFunction &a)
 copy constructor
 
SVDCoGCalibrationFunctionoperator= (const Belle2::SVDCoGCalibrationFunction &a)
 operator =
 

Private Member Functions

double pol1TBdep (double raw_time, int tb) const
 pol1 TB dep version implementation
 
double pol1TBdepErr (double, double raw_timeErr, int tb) const
 implementation of pol1 TB dep error
 
double pol3TBindep (double raw_time, int) const
 ID = 1, pol3TBindep VERSION: (TB independent) correctedValue = par[0] + t * par[1] + t^2 * par[2] + t^3 * par[3].
 
double pol3TBindepErr (double raw_time, double raw_timeErr, int) const
 implementation of pol3 TB indep error
 
double pol5TBindep (double raw_time, int) const
 ID = 2, pol5TBindep VERSION: (TB independent) correctedValue = par[0] + t * par[1] + t^2 * par[2] + t^3 * par[3] + t^4 * par[4] + t^5*par[5].
 
double pol5TBindepErr (double raw_time, double raw_timeErr, int) const
 implementation of pol5 TB indep error
 
double elsTBindep (double raw_time, int) const
 ID = 3, elsTBindep VERSION: (TB independent) correctedValue = par[0] + t * par[1] + par[2]/(t - par[3]) if t<=par[3]-sqrt(-par[2])/4 correctedValue = NaN otherwise.
 
double elsTBindepErr (double raw_time, double raw_timeErr, int) const
 implementation of els TB indep error
 

Private Attributes

double m_bias [nTriggerBins] = {0}
 function parameters & implementations
 
double m_scale [nTriggerBins] = {0}
 trigger-bin dependent scale
 
double m_par [m_nPar] = {0}
 vector of parameters
 
int m_current
 current function ID
 

Static Private Attributes

static const int nTriggerBins = 4
 total number of trigger bins
 
static const int m_nPar = 6
 number of parameters of highest-order implemented pol (5)
 
static std::vector< cogFunctionm_implementations
 vector of functions for time calibration, we use the m_current
 
static std::vector< cogFunctionErrm_implementationsErr
 Do not stream this, please throw it in the WC.
 

Detailed Description

class to contain the CoG Time calibrations

Definition at line 25 of file SVDCoGCalibrationFunction.h.

Member Typedef Documentation

◆ cogFunction

typedef double(SVDCoGCalibrationFunction::* cogFunction) (double, int) const

typedef of the return value of the calibration function

Definition at line 30 of file SVDCoGCalibrationFunction.h.

◆ cogFunctionErr

typedef double(SVDCoGCalibrationFunction::* cogFunctionErr) (double, double, int) const

typedef of the return value of the calibration function ERROR

Definition at line 33 of file SVDCoGCalibrationFunction.h.

Constructor & Destructor Documentation

◆ SVDCoGCalibrationFunction() [1/2]

constructor

Definition at line 49 of file SVDCoGCalibrationFunction.h.

50 {
51 // The m_implementations vector is static.
52 // We have to initialize it just once.
53 if (m_implementations.size() == 0) {
54 m_implementations.push_back(&SVDCoGCalibrationFunction::pol1TBdep);
55 m_implementations.push_back(&SVDCoGCalibrationFunction::pol3TBindep);
56 m_implementations.push_back(&SVDCoGCalibrationFunction::pol5TBindep);
57 m_implementations.push_back(&SVDCoGCalibrationFunction::elsTBindep);
58 //m_implementations.push_back(
59 // &SVDCoGCalibrationFunction::betterVersion);
60 }
61
62 // The m_implementationsErr vector is static.
63 // We have to initialize it just once.
64 if (m_implementationsErr.size() == 0) {
65 m_implementationsErr.push_back(&SVDCoGCalibrationFunction::pol1TBdepErr);
66 m_implementationsErr.push_back(&SVDCoGCalibrationFunction::pol3TBindepErr);
67 m_implementationsErr.push_back(&SVDCoGCalibrationFunction::pol5TBindepErr);
68 m_implementationsErr.push_back(&SVDCoGCalibrationFunction::elsTBindepErr);
69 //m_implementationsErr.push_back(
70 // &SVDCoGCalibrationFunction::betterVersion);
71 }
72
73 m_current = m_implementations.size() - 1;
74
75 };

◆ SVDCoGCalibrationFunction() [2/2]

copy constructor

Definition at line 16 of file SVDCoGCalibrationFunction.cc.

16 : TObject(a)
17{
18 for (int i = 0; i < nTriggerBins; i++) {
19 m_bias[i] = a.m_bias[i];
20 m_scale[i] = a.m_scale[i];
21 }
22 m_current = a.m_current;
23 for (int i = 0; i < m_nPar; i++)
24 m_par[i] = a.m_par[i];
25}
static const int nTriggerBins
total number of trigger bins
double m_bias[nTriggerBins]
function parameters & implementations
double m_scale[nTriggerBins]
trigger-bin dependent scale
static const int m_nPar
number of parameters of highest-order implemented pol (5)
double m_par[m_nPar]
vector of parameters

Member Function Documentation

◆ calibratedValue()

double calibratedValue ( double raw_time,
int trigger_bin ) const
inline

returns the calibrated value of raw_time, depending on the trigger bin

Definition at line 36 of file SVDCoGCalibrationFunction.h.

37 {
38 cogFunction f = m_implementations[m_current];
39 return (this->*f)(raw_time, trigger_bin) ;
40 }

◆ calibratedValueError()

double calibratedValueError ( double raw_time,
double raw_timeErr,
int trigger_bin ) const
inline

returns the error of the calibrated value of raw_time, depending on the trigger bin

Definition at line 42 of file SVDCoGCalibrationFunction.h.

43 {
44 cogFunctionErr fErr = m_implementationsErr[m_current];
45 return (this->*fErr)(raw_time, raw_timeErr, trigger_bin) ;
46 }

◆ elsTBindep()

double elsTBindep ( double raw_time,
int  ) const
inlineprivate

ID = 3, elsTBindep VERSION: (TB independent) correctedValue = par[0] + t * par[1] + par[2]/(t - par[3]) if t<=par[3]-sqrt(-par[2])/4 correctedValue = NaN otherwise.

els TB indep version implementation

Definition at line 198 of file SVDCoGCalibrationFunction.h.

199 {
200 if (raw_time > m_par[3] - sqrt(-m_par[2]) / 4)
201 return std::numeric_limits<float>::quiet_NaN();
202
203 return m_par[0] + m_par[1] * raw_time + m_par[2] / (raw_time - m_par[3]);
204 };
double sqrt(double a)
sqrt for double
Definition beamHelpers.h:28

◆ elsTBindepErr()

double elsTBindepErr ( double raw_time,
double raw_timeErr,
int  ) const
inlineprivate

implementation of els TB indep error

Definition at line 207 of file SVDCoGCalibrationFunction.h.

208 {
209 if (raw_time > m_par[3] - sqrt(-m_par[2]) / 4)
210 return std::numeric_limits<float>::quiet_NaN();
211
212 return raw_timeErr * (m_par[1] - m_par[2] / square(raw_time - m_par[3]));
213 };
constexpr T square(const T &x)
Calculate the square of the input.
Definition MathHelpers.h:21

◆ operator=()

operator =

Definition at line 27 of file SVDCoGCalibrationFunction.cc.

28{
29 if (this == &a)
30 return *this;
31 for (int i = 0; i < nTriggerBins; i++) {
32 m_bias[i] = a.m_bias[i];
33 m_scale[i] = a.m_scale[i];
34 }
35 m_current = a.m_current;
36 for (int i = 0; i < m_nPar; i++)
37 m_par[i] = a.m_par[i];
38 return *this;
39}

◆ pol1TBdep()

double pol1TBdep ( double raw_time,
int tb ) const
inlineprivate

pol1 TB dep version implementation

Definition at line 151 of file SVDCoGCalibrationFunction.h.

152 {
153 return raw_time * m_scale[ tb % nTriggerBins] +
154 m_bias[ tb % nTriggerBins ];
155 };

◆ pol1TBdepErr()

double pol1TBdepErr ( double ,
double raw_timeErr,
int tb ) const
inlineprivate

implementation of pol1 TB dep error

Definition at line 157 of file SVDCoGCalibrationFunction.h.

158 {
159 return raw_timeErr * m_scale[ tb % nTriggerBins];
160 };

◆ pol3TBindep()

double pol3TBindep ( double raw_time,
int  ) const
inlineprivate

ID = 1, pol3TBindep VERSION: (TB independent) correctedValue = par[0] + t * par[1] + t^2 * par[2] + t^3 * par[3].

pol3 TB indep version implementation

Definition at line 168 of file SVDCoGCalibrationFunction.h.

169 {
170 return m_par[0] + m_par[1] * raw_time + m_par[2] * square(raw_time) + m_par[3] * cube(raw_time);
171 };
constexpr T cube(const T &x)
Calculate the cube of the input.
Definition MathHelpers.h:29

◆ pol3TBindepErr()

double pol3TBindepErr ( double raw_time,
double raw_timeErr,
int  ) const
inlineprivate

implementation of pol3 TB indep error

Definition at line 173 of file SVDCoGCalibrationFunction.h.

174 {
175 return raw_timeErr * (m_par[1] + 2 * m_par[2] * raw_time + 3 * m_par[3] * square(raw_time));
176 };

◆ pol5TBindep()

double pol5TBindep ( double raw_time,
int  ) const
inlineprivate

ID = 2, pol5TBindep VERSION: (TB independent) correctedValue = par[0] + t * par[1] + t^2 * par[2] + t^3 * par[3] + t^4 * par[4] + t^5*par[5].

pol5 TB indep version implementation

Definition at line 181 of file SVDCoGCalibrationFunction.h.

182 {
183 return m_par[0] + m_par[1] * raw_time + m_par[2] * square(raw_time) + m_par[3] * cube(raw_time) + m_par[4] * pow4(
184 raw_time) + m_par[5] * pow5(raw_time);
185 };
constexpr T pow5(const T &x)
Calculate the fifth power of the input.
Definition MathHelpers.h:46
constexpr T pow4(const T &x)
Calculate the fourth power of the input.
Definition MathHelpers.h:37

◆ pol5TBindepErr()

double pol5TBindepErr ( double raw_time,
double raw_timeErr,
int  ) const
inlineprivate

implementation of pol5 TB indep error

Definition at line 187 of file SVDCoGCalibrationFunction.h.

188 {
189 return raw_timeErr * (m_par[1] + 2 * m_par[2] * raw_time + 3 * m_par[3] * square(raw_time) + 4 * m_par[4] * cube(
190 raw_time) + 5 * m_par[5] * pow4(raw_time));
191 };

◆ set_bias()

void set_bias ( double tb0,
double tb1,
double tb2,
double tb3 )
inline

set the trigger bin dependent shift

Definition at line 85 of file SVDCoGCalibrationFunction.h.

86 {
87 m_bias[0] = tb0;
88 m_bias[1] = tb1;
89 m_bias[2] = tb2;
90 m_bias[3] = tb3;
91 }

◆ set_current()

void set_current ( int current)
inline

allows to choose the function version

Definition at line 78 of file SVDCoGCalibrationFunction.h.

79 {
80 m_current = current;
81 }

◆ set_elsparameters()

void set_elsparameters ( double a,
double b,
double c,
double d )
inline

set the parameters for the ELS TB independent function

Definition at line 126 of file SVDCoGCalibrationFunction.h.

127 {
128 m_par[ 0 ] = a;
129 m_par[ 1 ] = b;
130 m_par[ 2 ] = c;
131 m_par[ 3 ] = d;
132 }

◆ set_pol3parameters()

void set_pol3parameters ( double a,
double b,
double c,
double d )
inline

set the pol3 TB independent parameters

Definition at line 104 of file SVDCoGCalibrationFunction.h.

105 {
106 m_par[ 0 ] = a;
107 m_par[ 1 ] = b;
108 m_par[ 2 ] = c;
109 m_par[ 3 ] = d;
110 }

◆ set_pol5parameters()

void set_pol5parameters ( double a,
double b,
double c,
double d,
double e,
double f )
inline

set the pol5 TB independent parameters

Definition at line 114 of file SVDCoGCalibrationFunction.h.

115 {
116 m_par[ 0 ] = a;
117 m_par[ 1 ] = b;
118 m_par[ 2 ] = c;
119 m_par[ 3 ] = d;
120 m_par[ 4 ] = e;
121 m_par[ 5 ] = f;
122 }

◆ set_scale()

void set_scale ( double tb0,
double tb1,
double tb2,
double tb3 )
inline

set the trigger bin dependent scale

Definition at line 93 of file SVDCoGCalibrationFunction.h.

94 {
95 m_scale[0] = tb0;
96 m_scale[1] = tb1;
97 m_scale[2] = tb2;
98 m_scale[3] = tb3;
99 }

Member Data Documentation

◆ m_bias

double m_bias[nTriggerBins] = {0}
private

function parameters & implementations

ID = {0}, pol1TBdep VERSION: correctedValue = t * scale[tb] + bias[tb] trigger-bin dependent bias

Definition at line 148 of file SVDCoGCalibrationFunction.h.

148{0};

◆ m_current

int m_current
private

current function ID

Definition at line 216 of file SVDCoGCalibrationFunction.h.

◆ m_implementations

std::vector< SVDCoGCalibrationFunction::cogFunction > m_implementations
staticprivate

vector of functions for time calibration, we use the m_current

Definition at line 219 of file SVDCoGCalibrationFunction.h.

◆ m_implementationsErr

std::vector< SVDCoGCalibrationFunction::cogFunctionErr > m_implementationsErr
staticprivate

Do not stream this, please throw it in the WC.

vector of functions for time error calibration, we use the m_current

Definition at line 222 of file SVDCoGCalibrationFunction.h.

◆ m_nPar

const int m_nPar = 6
staticprivate

number of parameters of highest-order implemented pol (5)

Definition at line 163 of file SVDCoGCalibrationFunction.h.

◆ m_par

double m_par[m_nPar] = {0}
private

vector of parameters

Definition at line 164 of file SVDCoGCalibrationFunction.h.

164{0};

◆ m_scale

double m_scale[nTriggerBins] = {0}
private

trigger-bin dependent scale

Definition at line 149 of file SVDCoGCalibrationFunction.h.

149{0};

◆ nTriggerBins

const int nTriggerBins = 4
staticprivate

total number of trigger bins

Definition at line 143 of file SVDCoGCalibrationFunction.h.


The documentation for this class was generated from the following files: