BOSS 7.0.6
BESIII Offline Software System
Loading...
Searching...
No Matches
WidgetParameterization.cc
Go to the documentation of this file.
2
4 setParameters("parameters.txt");
5}
6
8 setParameters(infile);
9}
10
11void
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}
42
43void
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}
71
72void
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}
96
97double
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}
128
129double
130WidgetParameterization::sigmaPrediction( double dedx, double nhit, double sin ){
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}
162
163double
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}
191
192
193double
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}
213
214
215double
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 sin(const BesAngle a)
Definition: BesAngle.h:210
***************************************************************************************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 sinPrediction(double sin)
void setParameters(std::string infile)
void printParameters(std::string infile)
double resPrediction(double nhit, double sin)
double sigmaPrediction(double dedx, double nhit, double sin)
double nhitPrediction(double nhit)
double sigmaCurve(double *x, double *par)
Definition: WidgetSigma.h:24
double x[1000]
float bg