Belle II Software development
CDCDedxSigmaPred Class Reference

Class to hold the prediction of resolution depending dE/dx, nhit, and cos(theta) More...

#include <CDCDedxSigmaPred.h>

Public Member Functions

void setParameters (std::string infile)
 set the parameters from file
 
void setParameters ()
 set the parameters
 
void printParameters (std::string infile)
 write the parameters in file
 
double getSigma (double dedx, double nhit, double cos, double timereso)
 Return the predicted resolution depending on dE/dx, nhit, and cos(theta)
 
double nhitPrediction (double nhit)
 Return sigma from the nhit parameterization.
 
double ionzPrediction (double dedx)
 Return sigma from the ionization parameterization.
 
double cosPrediction (double cos)
 Return sigma from the cos parameterization.
 
double getDedxPars (int i)
 get the dedx parameters
 
void setDedxPars (int i, double val)
 set the dedx parameters
 
double getNHitPars (int i)
 get the nhit parameters
 
void setNHitPars (int i, double val)
 set the nhit parameters
 
double getCosPars (int i)
 get the cos(theta) parameters
 
void setCosPars (int i, double val)
 set the cos(theta) parameters
 

Private Attributes

double m_dedxpars [2]
 parameters for sigma vs.
 
double m_cospars [10]
 parameters for sigma vs.
 
double m_nhitpars [5]
 parameters for sigma vs.
 
const DBObjPtr< CDCDedxSigmaParsm_DBSigmaPars
 db object for dE/dx resolution parameters
 

Detailed Description

Class to hold the prediction of resolution depending dE/dx, nhit, and cos(theta)

Definition at line 36 of file CDCDedxSigmaPred.h.

Member Function Documentation

◆ cosPrediction()

double cosPrediction ( double  cos)

Return sigma from the cos parameterization.

Definition at line 141 of file CDCDedxSigmaPred.cc.

142{
143 // Create an instance of the CDCDedxWidgetSigma class
145
146 // Define the parameter array and initialize it
147 double cospar[11];
148 cospar[0] = 3;
149 for (int i = 0; i < 10; ++i) cospar[i + 1] = m_cospars[i];
150
151 // Initialize x array to pass to sigmaCurve
152 double x[1];
153 x[0] = cos;
154
155 double corCos;
156 corCos = gs.sigmaCurve(x, std::vector<double>(cospar, cospar + 11));
157
158 return corCos;
159}
double m_cospars[10]
parameters for sigma vs.
Class to hold the beta-gamma (bg) resolution function.
double sigmaCurve(double *x, const std::vector< double > &par) const
calculate the predicted sigma value as a function of beta-gamma (bg) this is done with a different fu...

◆ getCosPars()

double getCosPars ( int  i)
inline

get the cos(theta) parameters

Definition at line 98 of file CDCDedxSigmaPred.h.

98{ return m_cospars[i]; };

◆ getDedxPars()

double getDedxPars ( int  i)
inline

get the dedx parameters

Definition at line 78 of file CDCDedxSigmaPred.h.

78{ return m_dedxpars[i]; };
double m_dedxpars[2]
parameters for sigma vs.

◆ getNHitPars()

double getNHitPars ( int  i)
inline

get the nhit parameters

Definition at line 88 of file CDCDedxSigmaPred.h.

88{ return m_nhitpars[i]; };
double m_nhitpars[5]
parameters for sigma vs.

◆ getSigma()

double getSigma ( double  dedx,
double  nhit,
double  cos,
double  timereso 
)

Return the predicted resolution depending on dE/dx, nhit, and cos(theta)

Definition at line 81 of file CDCDedxSigmaPred.cc.

82{
83 double correction = cosPrediction(cos) * nhitPrediction(nhit) * ionzPrediction(dedx) * timereso;
84 return correction;
85}
double ionzPrediction(double dedx)
Return sigma from the ionization parameterization.
double cosPrediction(double cos)
Return sigma from the cos parameterization.
double nhitPrediction(double nhit)
Return sigma from the nhit parameterization.

◆ ionzPrediction()

double ionzPrediction ( double  dedx)

Return sigma from the ionization parameterization.

Definition at line 122 of file CDCDedxSigmaPred.cc.

123{
124 // Define the parameter array and initialize it
125 double dedxpar[3];
126 dedxpar[0] = 1;
127 for (int i = 0; i < 2; ++i) dedxpar[i + 1] = m_dedxpars[i];
128
129 // Create an instance of the CDCDedxWidgetSigma class
131
132// Initialize x array to pass to sigmaCurve
133 double x[1];
134 x[0] = dedx;
135
136 double corDedx = gs.sigmaCurve(x, std::vector<double>(dedxpar, dedxpar + 3));
137
138 return corDedx;
139}

◆ nhitPrediction()

double nhitPrediction ( double  nhit)

Return sigma from the nhit parameterization.

Definition at line 88 of file CDCDedxSigmaPred.cc.

89{
90
91// Define minimum and maximum nhit values
92 int nhit_min = 8, nhit_max = 37;
93
94 // Define the parameter array and initialize it
95 double nhitpar[6];
96 nhitpar[0] = 2;
97 for (int i = 0; i < 5; ++i) nhitpar[i + 1] = m_nhitpars[i];
98
99 // Create an instance of the CDCDedxWidgetSigma class
101
102 // Initialize x array to pass to sigmaCurve
103 double x[1];
104
105 x[0] = nhit;
106
107 double corNHit;
108
109 if (nhit < nhit_min) {
110 x[0] = nhit_min;
111 corNHit = gs.sigmaCurve(x, std::vector<double>(nhitpar, nhitpar + 6)) * std::sqrt(nhit_min / nhit);
112 } else if (nhit > nhit_max) {
113 x[0] = nhit_max;
114 corNHit = gs.sigmaCurve(x, std::vector<double>(nhitpar, nhitpar + 6)) * std::sqrt(nhit_max / nhit);
115 } else {
116 corNHit = gs.sigmaCurve(x, std::vector<double>(nhitpar, nhitpar + 6));
117 }
118
119 return corNHit;
120}

◆ printParameters()

void printParameters ( std::string  infile)

write the parameters in file

Definition at line 60 of file CDCDedxSigmaPred.cc.

61{
62
63 B2INFO("\n\tCDCDedxSigmaPred: Printing parameters to file --> " << outfile.c_str());
64
65 // write out the parameters to file
66 std::ofstream fout(outfile.c_str());
67
68 for (int i = 1; i < 3; ++i) fout << i << "\t" << m_dedxpars[i - 1] << std::endl;
69
70 fout << std::endl;
71 for (int i = 3; i < 8; ++i) fout << i << "\t" << m_nhitpars[i - 3] << std::endl;
72
73 fout << std::endl;
74 for (int i = 8; i < 18; ++i) fout << i << "\t" << m_cospars[i - 8] << std::endl;
75
76 fout << std::endl;
77
78 fout.close();
79}

◆ setCosPars()

void setCosPars ( int  i,
double  val 
)
inline

set the cos(theta) parameters

Definition at line 103 of file CDCDedxSigmaPred.h.

103{ m_cospars[i] = val; };

◆ setDedxPars()

void setDedxPars ( int  i,
double  val 
)
inline

set the dedx parameters

Definition at line 83 of file CDCDedxSigmaPred.h.

83{ m_dedxpars[i] = val; };

◆ setNHitPars()

void setNHitPars ( int  i,
double  val 
)
inline

set the nhit parameters

Definition at line 93 of file CDCDedxSigmaPred.h.

93{ m_nhitpars[i] = val; };

◆ setParameters() [1/2]

void setParameters ( )

set the parameters

Definition at line 13 of file CDCDedxSigmaPred.cc.

14{
15
16 // make sure the resolution parameters are reasonable
17 if (!m_DBSigmaPars || m_DBSigmaPars->getSize() == 0)
18 B2FATAL("No dE/dx sigma parameters!");
19
20 std::vector<double> sigmapar;
21 sigmapar = m_DBSigmaPars->getSigmaPars();
22 for (int i = 0; i < 2; ++i) m_dedxpars[i] = sigmapar[i];
23 for (int i = 0; i < 5; ++i) m_nhitpars[i] = sigmapar[i + 2];
24 for (int i = 0; i < 10; ++i) m_cospars[i] = sigmapar[i + 7];
25}
const DBObjPtr< CDCDedxSigmaPars > m_DBSigmaPars
db object for dE/dx resolution parameters

◆ setParameters() [2/2]

void setParameters ( std::string  infile)

set the parameters from file

Definition at line 27 of file CDCDedxSigmaPred.cc.

28{
29
30 B2INFO("\n\tWidgetParameterization: Using parameters from file --> " << infile);
31
32 std::ifstream fin;
33 fin.open(infile.c_str());
34
35 if (!fin.good()) B2FATAL("\tWARNING: CANNOT FIND " << infile);
36
37 int par;
38
39 B2INFO("\t --> dedx parameters");
40 for (int i = 0; i < 2; ++i) {
41 fin >> par >> m_dedxpars[i];
42 B2INFO("\t\t (" << i << ")" << m_dedxpars[i]);
43 }
44
45 B2INFO("\t --> nhit parameters");
46 for (int i = 0; i <= 4; ++i) {
47 fin >> par >> m_nhitpars[i];
48 B2INFO("\t\t (" << i << ")" << m_nhitpars[i]);
49 }
50
51 B2INFO("\t --> cos parameters");
52 for (int i = 0; i < 10; ++i) { //4
53 fin >> par >> m_cospars[i];
54 B2INFO("\t\t (" << i << ")" << m_cospars[i]);
55 }
56
57 fin.close();
58}

Member Data Documentation

◆ m_cospars

double m_cospars[10]
private

parameters for sigma vs.

cos(theta) curve

Definition at line 108 of file CDCDedxSigmaPred.h.

◆ m_DBSigmaPars

const DBObjPtr<CDCDedxSigmaPars> m_DBSigmaPars
private

db object for dE/dx resolution parameters

Definition at line 111 of file CDCDedxSigmaPred.h.

◆ m_dedxpars

double m_dedxpars[2]
private

parameters for sigma vs.

dE/dx curve

Definition at line 107 of file CDCDedxSigmaPred.h.

◆ m_nhitpars

double m_nhitpars[5]
private

parameters for sigma vs.

nhit curve

Definition at line 109 of file CDCDedxSigmaPred.h.


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