BOSS 7.0.6
BESIII Offline Software System
Loading...
Searching...
No Matches
WidgetParameterization Class Reference

#include <WidgetParameterization.h>

Public Member Functions

 WidgetParameterization ()
 
 WidgetParameterization (std::string parfile)
 
virtual ~WidgetParameterization ()
 
void setParameters (std::string infile)
 
void printParameters (std::string infile)
 
void showParameters ()
 
double dedxPrediction (double x)
 
double sigmaPrediction (double dedx, double nhit, double sin)
 
double resPrediction (double nhit, double sin)
 
double sinPrediction (double sin)
 
double nhitPrediction (double nhit)
 
double getCurvePars (int i)
 
void setCurvePars (int i, double val)
 
double getDedxPars (int i)
 
void setDedxPars (int i, double val)
 
double getNHitPars (int i)
 
void setNHitPars (int i, double val)
 
double getSinPars (int i)
 
void setSinPars (int i, double val)
 

Detailed Description

Definition at line 26 of file WidgetParameterization.h.

Constructor & Destructor Documentation

◆ WidgetParameterization() [1/2]

WidgetParameterization::WidgetParameterization ( )

Definition at line 3 of file WidgetParameterization.cc.

3 {
4 setParameters("parameters.txt");
5}
void setParameters(std::string infile)

◆ WidgetParameterization() [2/2]

WidgetParameterization::WidgetParameterization ( std::string  parfile)

Definition at line 7 of file WidgetParameterization.cc.

7 {
8 setParameters(infile);
9}

◆ ~WidgetParameterization()

virtual WidgetParameterization::~WidgetParameterization ( )
inlinevirtual

Definition at line 32 of file WidgetParameterization.h.

32{};

Member Function Documentation

◆ dedxPrediction()

double WidgetParameterization::dedxPrediction ( double  x)

Definition at line 98 of file WidgetParameterization.cc.

98 {
99 // define the section of the curve to use
100 double A = 0, B = 0, C = 0;
101 if( bg < 4.5 )
102 A = 1;
103 else if( bg < 10 )
104 B = 1;
105 else
106 C = 1;
107
108 double x[1]; x[0] = bg;
109 double parsA[9];
110 double parsB[5];
111 double parsC[5];
112
113 parsA[0] = 1; parsB[0] = 2; parsC[0] = 3;
114 for( int i = 0; i < 16; ++i ){
115 if( i < 8 ) parsA[i+1] = m_curvepars[i];
116 else if( i < 12 ) parsB[i%8+1] = m_curvepars[i];
117 else parsC[i%12+1] = m_curvepars[i];
118 }
119
120 // calculate dE/dx from the Bethe-Bloch curve
121 WidgetCurve gc;
122 double partA = gc.bgCurve(x,parsA);
123 double partB = gc.bgCurve(x,parsB);
124 double partC = gc.bgCurve(x,parsC);
125
126 return (A*partA+B*partB+C*partC);
127}
***************************************************************************************Pseudo Class RRes *****************************************************************************************Parameters and physical constants **Maarten sept ************************************************************************DOUBLE PRECISION xsmu **************************************************************************PARTICLE DATA all others are from PDG *Only resonances with known widths into electron pairs are sept ************************************************************************C Declarations C
Definition: RRes.h:29
double bgCurve(double *x, double *par)
Definition: WidgetCurve.h:23
double x[1000]
float bg

Referenced by HadronPrep::bgCosThetaFits(), HadronPrep::bgFits(), HadronCalibration::fitSigmaVsNHit(), HadronCalibration::fitSigmaVsSin(), WidgetGenerator::generateEvents(), and HadronCalibration::plotEfficiency().

◆ getCurvePars()

double WidgetParameterization::getCurvePars ( int  i)
inline

Definition at line 59 of file WidgetParameterization.h.

59{ return m_curvepars[i]; };

Referenced by HadronCalibration::fitBGCurve().

◆ getDedxPars()

double WidgetParameterization::getDedxPars ( int  i)
inline

Definition at line 65 of file WidgetParameterization.h.

65{ return m_dedxpars[i]; };

Referenced by HadronCalibration::fitBGCurve().

◆ getNHitPars()

double WidgetParameterization::getNHitPars ( int  i)
inline

Definition at line 71 of file WidgetParameterization.h.

71{ return m_nhitpars[i]; };

Referenced by HadronCalibration::fitSigmaVsNHit().

◆ getSinPars()

double WidgetParameterization::getSinPars ( int  i)
inline

Definition at line 77 of file WidgetParameterization.h.

77{ return m_sinpars[i]; };

Referenced by HadronCalibration::fitSigmaVsSin().

◆ nhitPrediction()

double WidgetParameterization::nhitPrediction ( double  nhit)

Definition at line 216 of file WidgetParameterization.cc.

216 {
217 if( nhit < 5 ) nhit = 5;
218
219 double x[1];
220 double nhitpar[6];
221
222 nhitpar[0] = 2;
223 for( int i = 0; i < 5; ++i ){
224 nhitpar[i+1] = m_nhitpars[i];
225 }
226
227 // determine sigma from the parameterization
228 WidgetSigma gs;
229 x[0] = nhit;
230 double cor_nhit = gs.sigmaCurve(x,nhitpar);
231
232 if( nhit > 35) cor_nhit = 1.0;
233
234 return cor_nhit;
235}
double sigmaCurve(double *x, double *par)
Definition: WidgetSigma.h:24

Referenced by HadronCalibration::fitSigmaVsSin().

◆ printParameters()

void WidgetParameterization::printParameters ( std::string  infile)

Definition at line 44 of file WidgetParameterization.cc.

44 {
45
46 std::cout << "WidgetParameterization: Printing parameters to file..." << std::endl;
47
48 // write out the parameters to file
49 std::ofstream fout( outfile.c_str() );
50 fout << "0\t2" << std::endl << std::endl;
51 for( int i = 1; i <= 16; ++i ){
52 fout << i << "\t" << m_curvepars[i-1] << std::endl;
53 }
54 fout << std::endl << 0 << "\t" << 6 << std::endl << std::endl;
55 for( int i = 1; i <= 3; ++i ){
56 fout << i << "\t" << m_dedxpars[i-1] << std::endl;
57 }
58 fout << std::endl;
59 for( int i = 4; i <= 8; ++i ){
60 fout << i << "\t" << m_nhitpars[i-4] << std::endl;
61 }
62 fout << std::endl;
63 for( int i = 9; i <= 13; ++i ){
64 fout << i << "\t" << m_sinpars[i-9] << std::endl;
65 }
66 fout << std::endl;
67 fout << "14\t1.105" << std::endl;
68
69 fout.close();
70}

Referenced by HadronCalibration::fitBGCurve(), HadronCalibration::fitSigmaVsNHit(), and HadronCalibration::fitSigmaVsSin().

◆ resPrediction()

double WidgetParameterization::resPrediction ( double  nhit,
double  sin 
)

Definition at line 164 of file WidgetParameterization.cc.

164 {
165 if( nhit < 5 ) nhit = 5;
166 if( sin > 0.99 ) sin = 0.99;
167
168 double x[1];
169 double nhitpar[6];
170 double sinpar[6];
171
172 nhitpar[0] = 2; sinpar[0] = 2;
173 for( int i = 0; i < 5; ++i ){
174 nhitpar[i+1] = m_nhitpars[i];
175 }
176 for( int i = 0; i < 5; ++i ){
177 sinpar[i+1] = m_sinpars[i];
178 }
179
180 // determine sigma from the parameterization
181 WidgetSigma gs;
182 x[0] = nhit;
183 double cor_nhit = gs.sigmaCurve(x,nhitpar);
184 x[0] = sin;
185 double cor_sin = gs.sigmaCurve(x,sinpar);
186
187 if( nhit > 35) cor_nhit = 1.0;
188
189 return cor_sin * cor_nhit;
190}
double sin(const BesAngle a)
Definition: BesAngle.h:210

Referenced by HadronPrep::bgFits().

◆ setCurvePars()

void WidgetParameterization::setCurvePars ( int  i,
double  val 
)
inline

Definition at line 62 of file WidgetParameterization.h.

62{ m_curvepars[i] = val; };

Referenced by HadronCalibration::fitBGCurve().

◆ setDedxPars()

void WidgetParameterization::setDedxPars ( int  i,
double  val 
)
inline

Definition at line 68 of file WidgetParameterization.h.

68{ m_dedxpars[i] = val; };

Referenced by HadronCalibration::fitBGCurve().

◆ setNHitPars()

void WidgetParameterization::setNHitPars ( int  i,
double  val 
)
inline

Definition at line 74 of file WidgetParameterization.h.

74{ m_nhitpars[i] = val; };

Referenced by HadronCalibration::fitSigmaVsNHit().

◆ setParameters()

void WidgetParameterization::setParameters ( std::string  infile)

Definition at line 12 of file WidgetParameterization.cc.

12 {
13
14 std::cout << "Setting parameters..." << std::endl;
15
16 std::ifstream fin;
17 fin.open(infile.c_str());
18 if( !fin.good() ){
19 std::cout << "WARNING: CANNOT FIND parameters.txt!" << std::endl;
20 exit(1);
21 }
22
23 int par;
24 std::string stemp;
25 fin >> par >> par;
26 for( int i = 0; i <= 15; ++i ){
27 fin >> par >> m_curvepars[i];
28 }
29 fin >> par >> par;
30 for( int i = 0; i <= 2; ++i ){
31 fin >> par >> m_dedxpars[i];
32 }
33 for( int i = 0; i <= 4; ++i ){
34 fin >> par >> m_nhitpars[i];
35 }
36 for( int i = 0; i <= 4; ++i ){
37 fin >> par >> m_sinpars[i];
38 }
39
40 fin.close();
41}

Referenced by HadronPrep::bgCosThetaFits(), HadronPrep::bgFits(), and WidgetParameterization().

◆ setSinPars()

void WidgetParameterization::setSinPars ( int  i,
double  val 
)
inline

Definition at line 80 of file WidgetParameterization.h.

80{ m_sinpars[i] = val; };

Referenced by HadronCalibration::fitSigmaVsSin().

◆ showParameters()

void WidgetParameterization::showParameters ( )

Definition at line 73 of file WidgetParameterization.cc.

73 {
74
75 std::cout << "WidgetParameterization: Printing parameters to file..." << std::endl;
76
77 std::cout << "0\t2" << std::endl << std::endl;
78 for( int i = 1; i <= 16; ++i ){
79 std::cout << i << "\t" << m_curvepars[i-1] << std::endl;
80 }
81 std::cout << std::endl << 0 << "\t" << 6 << std::endl << std::endl;
82 for( int i = 1; i <= 3; ++i ){
83 std::cout << i << "\t" << m_dedxpars[i-1] << std::endl;
84 }
85 std::cout << std::endl;
86 for( int i = 4; i <= 8; ++i ){
87 std::cout << i << "\t" << m_nhitpars[i-4] << std::endl;
88 }
89 std::cout << std::endl;
90 for( int i = 9; i <= 13; ++i ){
91 std::cout << i << "\t" << m_sinpars[i-9] << std::endl;
92 }
93 std::cout << std::endl;
94 std::cout << "14\t1.105" << std::endl;
95}

◆ sigmaPrediction()

double WidgetParameterization::sigmaPrediction ( double  dedx,
double  nhit,
double  sin 
)

Definition at line 130 of file WidgetParameterization.cc.

130 {
131 if( nhit < 5 ) nhit = 5;
132 if( sin > 0.99 ) sin = 0.99;
133
134 double x[1];
135 double dedxpar[3];
136 double nhitpar[6];
137 double sinpar[6];
138
139 dedxpar[0] = 1; nhitpar[0] = 2; sinpar[0] = 2;
140 for( int i = 0; i < 2; ++i ){
141 dedxpar[i+1] = m_dedxpars[i];
142 }
143 for( int i = 0; i < 5; ++i ){
144 nhitpar[i+1] = m_nhitpars[i];
145 }
146 for( int i = 0; i < 5; ++i ){
147 sinpar[i+1] = m_sinpars[i];
148 }
149
150 // determine sigma from the parameterization
151 WidgetSigma gs;
152 x[0] = dedx;
153 double cor_dedx = gs.sigmaCurve(x,dedxpar);
154 x[0] = nhit;
155 double cor_nhit = gs.sigmaCurve(x,nhitpar);
156 if( nhit > 35) cor_nhit = 1.0;
157 x[0] = sin;
158 double cor_sin = gs.sigmaCurve(x,sinpar);
159
160 return cor_dedx * cor_sin * cor_nhit;
161}

Referenced by HadronPrep::bgCosThetaFits(), HadronPrep::bgFits(), HadronCalibration::fitSigmaVsNHit(), HadronCalibration::fitSigmaVsSin(), WidgetGenerator::generateEvents(), and HadronCalibration::plotEfficiency().

◆ sinPrediction()

double WidgetParameterization::sinPrediction ( double  sin)

Definition at line 194 of file WidgetParameterization.cc.

194 {
195 if( sin > 0.99 ) sin = 0.99;
196
197 double x[1];
198 double sinpar[6];
199
200 sinpar[0] = 2;
201
202 for( int i = 0; i < 5; ++i ){
203 sinpar[i+1] = m_sinpars[i];
204 }
205
206 // determine sigma from the parameterization
207 WidgetSigma gs;
208 x[0] = sin;
209 double cor_sin = gs.sigmaCurve(x,sinpar);
210
211 return cor_sin;
212}

Referenced by HadronCalibration::fitSigmaVsNHit().


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