Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ClusterErrorPara.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file ClusterErrorPara.cc
1 #include "ClusterErrorPara.h"
4 
5 #include <TF1.h>
6 #include <string>
7 #include <iostream>
8 #include <cmath>
9 
10 namespace
11 {
12 
14  template<class T>
15  inline constexpr T square( const T& x ) { return x*x; }
16 }
17 
19 {
20  f0 = new TF1("f0","pol1",0,10);
21  f0->SetParameter(0,0.0163943);
22  f0->SetParameter(1,0.0192931);
23 
24  f1 = new TF1("f1","pol2",0,10);
25  f1->SetParameter(0,0.0119384);
26  f1->SetParameter(1,0.0253197);
27  f1->SetParameter(2,0.0404213);
28 
29  f2 = new TF1("f2","pol2",0,10);
30  f2->SetParameter(0,0.0107316);
31  f2->SetParameter(1,0.0294968);
32  f2->SetParameter(2,0.0414098);
33  // f2->SetParameter(3,9.75877);
34 
35  fz0 = new TF1("fz0","pol2",-2,2);
36  fz0->SetParameter(0,0.0520278);
37  fz0->SetParameter(1,-0.00578699);
38  fz0->SetParameter(2,0.0156972);
39 
40  fz1 = new TF1("fz1","pol4",-2,2);
41  fz1->SetParameter(0,0.0383233);
42  fz1->SetParameter(1,-0.00577128);
43  fz1->SetParameter(2,0.0770914);
44  fz1->SetParameter(3,-0.0818139);
45  fz1->SetParameter(4,0.050305);
46 
47  fz2 = new TF1("fz2","pol2",-2,2);
48  fz2->SetParameter(0,0.0371611);
49  fz2->SetParameter(1,-0.000694558);
50  fz2->SetParameter(2,0.0437917);
51 
52  fmm_55_2 = new TF1("fmm_55_2","pol2",-2,2);
53  fmm_55_2->SetParameter(0,0.0430592);
54  fmm_55_2->SetParameter(1,-0.000177174);
55  fmm_55_2->SetParameter(2,0.0914288);
56 
57  fmm_56_2 = new TF1("fmm_56_2","pol2",-2,2);
58  fmm_56_2->SetParameter(0,0.00363897);
59  fmm_56_2->SetParameter(1,0.0109713);
60  fmm_56_2->SetParameter(2,0.032354);
61 
62  fmm_3 = new TF1("fmm_3","pol2",-2,2);
63  fmm_3->SetParameter(0,0.00305396);
64  fmm_3->SetParameter(1,0.00505814);
65  fmm_3->SetParameter(2,0.0395137);
66 
67  fadcz0 = new TF1("fadcz0","pol5",0,20000);
68  fadcz0->SetParameter(0,2.08854);
69  fadcz0->SetParameter(1,-0.0536847);
70  fadcz0->SetParameter(2,0.000989393);
71  fadcz0->SetParameter(3,-9.54492e-06);
72  fadcz0->SetParameter(4,4.42178e-08);
73  fadcz0->SetParameter(5,-7.79669e-11);
74 
75  fadcz1 = new TF1("fadcz1","pol5",0,20000);
76  fadcz1->SetParameter(0,2.35278);
77  fadcz1->SetParameter(1,-0.0535903);
78  fadcz1->SetParameter(2,0.00088052);
79  fadcz1->SetParameter(3,-7.75203e-06);
80  fadcz1->SetParameter(4,3.35361e-08);
81  fadcz1->SetParameter(5,-5.61371e-11);
82 
83  fadcz2 = new TF1("fadcz2","pol5",0,20000);
84  fadcz2->SetParameter(0,2.53191);
85  fadcz2->SetParameter(1,-0.062285);
86  fadcz2->SetParameter(2,0.00103893);
87  fadcz2->SetParameter(3,-9.18354e-06);
88  fadcz2->SetParameter(4,3.9802e-08);
89  fadcz2->SetParameter(5,-6.67137e-11);
90 
91  fadcz0fine = new TF1("fadcz0fine","[0]+([1]/pow(x-[2],2))",0,20000);
92  fadcz0fine->SetParameter(0,9.63983e-01);
93  fadcz0fine->SetParameter(1,2.68585e+01);
94  fadcz0fine->SetParameter(2,-4.78664e+00);
95 
96  fadcz1fine = new TF1("fadcz1fine","[0]+([1]/pow(x-[2],2))",0,20000);
97  fadcz1fine->SetParameter(0,9.85546e-01);
98  fadcz1fine->SetParameter(1,1.12622e+02);
99  fadcz1fine->SetParameter(2,-1.26552e+01);
100 
101  fadcz2fine = new TF1("fadcz2fine","[0]+([1]/pow(x-[2],2))",0,20000);
102  fadcz2fine->SetParameter(0,9.71125e-01);
103  fadcz2fine->SetParameter(1,6.67244e+01);
104  fadcz2fine->SetParameter(2,-3.55034e+00);
105 
106 
107  fadcphi0 = new TF1("fadcphi0","pol4",0,20000);
108  fadcphi0->SetParameter(0,1.79273);
109  fadcphi0->SetParameter(1, -0.0306044);
110  fadcphi0->SetParameter(2,0.000355984);
111  fadcphi0->SetParameter(3,-2.09e-06);
112  fadcphi0->SetParameter(4, 4.26161e-09);
113  // fadcphi0->SetParameter(5,-4.22758e-11);
114 
115  fadcphi0fine = new TF1("fadcphi0fine","pol2",0,20000);
116  fadcphi0fine->SetParameter(0,1.02625);
117  fadcphi0fine->SetParameter(1,-0.00167294);
118  fadcphi0fine->SetParameter(2,2.2912e-5);
119 
120  fadcphi1 = new TF1("fadcphi1","pol4",0,20000);
121  fadcphi1->SetParameter(0,2.12873);
122  fadcphi1->SetParameter(1,-0.0369604);
123  fadcphi1->SetParameter(2,0.00042828);
124  fadcphi1->SetParameter(3,-2.3665e-06);
125  fadcphi1->SetParameter(4,4.87683e-09);
126 
127  fadcphi1fine = new TF1("fadcphi1fine","pol4",0,20000);
128  fadcphi1fine->SetParameter(0,1.11749);
129  fadcphi1fine->SetParameter(1,-0.00354277);
130  fadcphi1fine->SetParameter(2, 5.60236e-05);
131  fadcphi1fine->SetParameter(3,-4.46412e-07);
132  fadcphi1fine->SetParameter(4, 1.22689e-09);
133 
134  fadcphi2 = new TF1("fadcphi2","pol5",0,20000);
135  fadcphi2->SetParameter(0,2.29);
136  fadcphi2->SetParameter(1,-0.0474362);
137  fadcphi2->SetParameter(2,0.000717789);
138  fadcphi2->SetParameter(3,-6.00737e-06);
139  fadcphi2->SetParameter(4,2.52007e-08);
140  fadcphi2->SetParameter(5,-4.14747e-11);
141 
142  fadcphi2fine1 = new TF1("fadcphi2fine1","pol4",0,20000);
143  fadcphi2fine1->SetParameter(0,1.39404);
144  fadcphi2fine1->SetParameter(1,-0.0202245);
145  fadcphi2fine1->SetParameter(2,0.000394666);
146  fadcphi2fine1->SetParameter(3,-3.37831e-06);
147  fadcphi2fine1->SetParameter(4,1.05017e-08);
148 
149  fadcphi2fine2 = new TF1("fadcphi2fine2","pol1",0,20000);
150  fadcphi2fine2->SetParameter(0,0.997);
151  fadcphi2fine2->SetParameter(1,0.00047);
152 
153  f0fine = new TF1("f0fine","pol2",0,20000);
154  f0fine->SetParameter(0,0.98611);
155  f0fine->SetParameter(1,-0.169505);
156  f0fine->SetParameter(2,1.12907);
157 
158  f1fine = new TF1("f1fine","pol3",0,20000);
159  f1fine->SetParameter(0,0.968625);
160  f1fine->SetParameter(1,-0.38894);
161  f1fine->SetParameter(2,3.36493);
162  f1fine->SetParameter(3,-6.72275);
163  /*
164  f2fine = new TF1("f2fine","pol4",0,20000);
165  f2fine->SetParameter(0,1.23748);
166  f2fine->SetParameter(1,-2.56956);
167  f2fine->SetParameter(2,15.8147);
168  f2fine->SetParameter(3,-42.4668);
169  f2fine->SetParameter(4,43.6083);
170  */
171  f2fine = new TF1("f2fine","pol5",0,20000);
172  f2fine->SetLineColor(kBlue);
173  f2fine->SetParameter(0,1.14119);
174  f2fine->SetParameter(1,-2.81483);
175  f2fine->SetParameter(2,19.1877);
176  f2fine->SetParameter(3,-57.214);
177  f2fine->SetParameter(4,72.2359);
178  f2fine->SetParameter(5,-20.3802);
179 
180  fz0fine = new TF1("fz0fine","pol2",0,20000);
181  fz0fine->SetParameter(0,0.96933);
182  fz0fine->SetParameter(1,-0.0458534);
183  fz0fine->SetParameter(2,0.231419);
184 
185  fz1fine = new TF1("fz1fine","pol3",0,20000);
186  fz1fine->SetParameter(0,0.886262);
187  fz1fine->SetParameter(1,-0.0818167);
188  fz1fine->SetParameter(2,0.805824);
189  fz1fine->SetParameter(3,-0.425423);
190 
191  fz2fine = new TF1("fz2fine","pol5",0,20000);
192  fz2fine->SetLineColor(kBlue);
193  fz2fine->SetParameter(0,0.880153);
194  fz2fine->SetParameter(1,0.552461);
195  fz2fine->SetParameter(2,-2.57007);
196  fz2fine->SetParameter(3,7.509);
197  fz2fine->SetParameter(4,-9.23698);
198  fz2fine->SetParameter(5,4.23039);
199 
200  static const double invsqrt12 = 1./std::sqrt(12);
201 
202  pitcherr_phi_mvtx = 0.002688 * invsqrt12;
203  pitcherr_phi_intt = 0.0078 * invsqrt12;
204  pitcherr_phi_mm1 = 0.1* invsqrt12 ;
205  pitcherr_phi_mm2 = 31.6* invsqrt12 ;
206  pitcherr_z_mvtx = 0.002924* invsqrt12 ;
207  pitcherr_z_intt = 1.6* invsqrt12 ;
208  pitcherr_z_mm1 = 54.2* invsqrt12 ;
209  pitcherr_z_mm2 = 0.2* invsqrt12 ;
210  pull_fine_phi[0]= 1.055549;
211  pull_fine_phi[1]= 1.049109;
212  pull_fine_phi[2]= 1.043427;
213  pull_fine_phi[3]= 1.200730;
214  pull_fine_phi[4]= 1.157397;
215  pull_fine_phi[5]= 1.357292;
216  pull_fine_phi[6]= 1.367113;
217  pull_fine_phi[7]= 0.999609;
218  pull_fine_phi[8]= 1.020689;
219  pull_fine_phi[9]= 1.032753;
220  pull_fine_phi[10]= 1.018574;
221  pull_fine_phi[11]= 1.035928;
222  pull_fine_phi[12]= 1.024522;
223  pull_fine_phi[13]= 1.035439;
224  pull_fine_phi[14]= 1.020409;
225  pull_fine_phi[15]= 1.035957;
226  pull_fine_phi[16]= 1.033798;
227  pull_fine_phi[17]= 1.032753;
228  pull_fine_phi[18]= 1.030573;
229  pull_fine_phi[19]= 1.035131;
230  pull_fine_phi[20]= 1.031460;
231  pull_fine_phi[21]= 1.039708;
232  pull_fine_phi[22]= 1.015784;
233  pull_fine_phi[23]= 1.013265;
234  pull_fine_phi[24]= 0.997548;
235  pull_fine_phi[25]= 0.990299;
236  pull_fine_phi[26]= 0.999642;
237  pull_fine_phi[27]= 1.005518;
238  pull_fine_phi[28]= 1.012272;
239  pull_fine_phi[29]= 1.016701;
240  pull_fine_phi[30]= 1.013685;
241  pull_fine_phi[31]= 1.025059;
242  pull_fine_phi[32]= 1.030672;
243  pull_fine_phi[33]= 1.031959;
244  pull_fine_phi[34]= 1.040878;
245  pull_fine_phi[35]= 1.045917;
246  pull_fine_phi[36]= 1.052541;
247  pull_fine_phi[37]= 1.056798;
248  pull_fine_phi[38]= 1.000142;
249  pull_fine_phi[39]= 1.028008;
250  pull_fine_phi[40]= 0.980509;
251  pull_fine_phi[41]= 0.981643;
252  pull_fine_phi[42]= 0.988486;
253  pull_fine_phi[43]= 0.987750;
254  pull_fine_phi[44]= 0.989536;
255  pull_fine_phi[45]= 0.992817;
256  pull_fine_phi[46]= 0.993260;
257  pull_fine_phi[47]= 0.994378;
258  pull_fine_phi[48]= 0.988871;
259  pull_fine_phi[49]= 0.985053;
260  pull_fine_phi[50]= 0.985631;
261  pull_fine_phi[51]= 0.987169;
262  pull_fine_phi[52]= 0.992417;
263  pull_fine_phi[53]= 0.996130;
264  pull_fine_phi[54]= 0.996966;
265  pull_fine_phi[55]= 0.943431;
266  pull_fine_phi[56]= 0.000000;
267  pull_fine_phi[57]= 0.000000;
268  pull_fine_phi[58]= 0.000000;
269  pull_fine_phi[59]= 0.000000;
270 
271  pull_fine_phi[3]*= 1.007551;
272  pull_fine_phi[4]*= 1.006760;
273  pull_fine_phi[5]*= 1.026019;
274  pull_fine_phi[6]*= 1.030869;
275  pull_fine_phi[55]*= 0.988674;
276 
277  pull_fine_z[0]= 1.117666;
278  pull_fine_z[1]= 1.119458;
279  pull_fine_z[2]= 1.123506;
280  pull_fine_z[3]= 1.971984;
281  pull_fine_z[4]= 0.643933;
282  pull_fine_z[5]= 0.638478;
283  pull_fine_z[6]= 2.039448;
284  pull_fine_z[7]= 1.047709;
285  pull_fine_z[8]= 1.021305;
286  pull_fine_z[9]= 1.014697;
287  pull_fine_z[10]= 1.011649;
288  pull_fine_z[11]= 1.014099;
289  pull_fine_z[12]= 1.018134;
290  pull_fine_z[13]= 1.004908;
291  pull_fine_z[14]= 1.016988;
292  pull_fine_z[15]= 1.007906;
293  pull_fine_z[16]= 1.006559;
294  pull_fine_z[17]= 1.006695;
295  pull_fine_z[18]= 1.010511;
296  pull_fine_z[19]= 1.008526;
297  pull_fine_z[20]= 1.012481;
298  pull_fine_z[21]= 1.005427;
299  pull_fine_z[22]= 1.008053;
300  pull_fine_z[23]= 0.984082;
301  pull_fine_z[24]= 1.016605;
302  pull_fine_z[25]= 1.020224;
303  pull_fine_z[26]= 1.014571;
304  pull_fine_z[27]= 1.017648;
305  pull_fine_z[28]= 1.021230;
306  pull_fine_z[29]= 1.022464;
307  pull_fine_z[30]= 1.026075;
308  pull_fine_z[31]= 1.028448;
309  pull_fine_z[32]= 1.025604;
310  pull_fine_z[33]= 1.025361;
311  pull_fine_z[34]= 1.031499;
312  pull_fine_z[35]= 1.036946;
313  pull_fine_z[36]= 1.037130;
314  pull_fine_z[37]= 1.036079;
315  pull_fine_z[38]= 0.966569;
316  pull_fine_z[39]= 3.431897;
317  pull_fine_z[40]= 1.000976;
318  pull_fine_z[41]= 1.000437;
319  pull_fine_z[42]= 0.999851;
320  pull_fine_z[43]= 1.003534;
321  pull_fine_z[44]= 1.002914;
322  pull_fine_z[45]= 1.003099;
323  pull_fine_z[46]= 1.008661;
324  pull_fine_z[47]= 1.015236;
325  pull_fine_z[48]= 1.009287;
326  pull_fine_z[49]= 1.011966;
327  pull_fine_z[50]= 1.005105;
328  pull_fine_z[51]= 1.014257;
329  pull_fine_z[52]= 1.020858;
330  pull_fine_z[53]= 1.018221;
331  pull_fine_z[54]= 1.012372;
332  pull_fine_z[55]= 1.007561;
333  pull_fine_z[56]= 0.000000;
334  pull_fine_z[57]= 0.000000;
335  pull_fine_z[58]= 0.000000;
336  pull_fine_z[59]= 0.000000;
337 
338  pull_fine_z[3]*= 0.691672;
339  pull_fine_z[4]*= 1.203607;
340  pull_fine_z[5]*= 1.360947;
341  pull_fine_z[6]*= 0.583844;
342  pull_fine_z[39]*= 0.928246;
343  pull_fine_z[3]*= 0.498090;
344  pull_fine_z[4]*= 1.090848;
345  pull_fine_z[5]*= 0.967529;
346  pull_fine_z[6]*= 0.820550;
347  pull_fine_z[55]*= 1.548348;
348  pull_fine_phi[0] *= 0.976810;
349  pull_fine_phi[1] *= 0.979091;
350  pull_fine_phi[2] *= 0.985423;
351  pull_fine_phi[3] *= 0.848807;
352  pull_fine_phi[4] *= 0.879689;
353  pull_fine_phi[5] *= 0.724431;
354  pull_fine_phi[6] *= 0.717564;
355  pull_fine_phi[7] *= 1.087427;
356  pull_fine_phi[8] *= 1.025145;
357  pull_fine_phi[9] *= 1.020610;
358  pull_fine_phi[10] *= 1.026286;
359  pull_fine_phi[11] *= 1.019533;
360  pull_fine_phi[12] *= 1.022289;
361  pull_fine_phi[13] *= 1.020049;
362  pull_fine_phi[14] *= 1.020093;
363  pull_fine_phi[15] *= 1.017107;
364  pull_fine_phi[16] *= 1.017730;
365  pull_fine_phi[17] *= 1.014773;
366  pull_fine_phi[18] *= 1.016468;
367  pull_fine_phi[19] *= 1.014107;
368  pull_fine_phi[20] *= 1.015574;
369  pull_fine_phi[21] *= 1.015261;
370  pull_fine_phi[22] *= 1.055006;
371  pull_fine_phi[23] *= 1.081166;
372  pull_fine_phi[24] *= 1.037136;
373  pull_fine_phi[25] *= 1.033333;
374  pull_fine_phi[26] *= 1.032861;
375  pull_fine_phi[27] *= 1.032109;
376  pull_fine_phi[28] *= 1.035788;
377  pull_fine_phi[29] *= 1.034689;
378  pull_fine_phi[30] *= 1.034438;
379  pull_fine_phi[31] *= 1.036618;
380  pull_fine_phi[32] *= 1.035785;
381  pull_fine_phi[33] *= 1.039290;
382  pull_fine_phi[34] *= 1.036625;
383  pull_fine_phi[35] *= 1.038621;
384  pull_fine_phi[36] *= 1.038185;
385  pull_fine_phi[37] *= 1.036850;
386  pull_fine_phi[38] *= 1.059049;
387  pull_fine_phi[39] *= 1.122510;
388  pull_fine_phi[40] *= 1.045074;
389  pull_fine_phi[41] *= 1.041234;
390  pull_fine_phi[42] *= 1.041916;
391  pull_fine_phi[43] *= 1.038968;
392  pull_fine_phi[44] *= 1.037942;
393  pull_fine_phi[45] *= 1.037845;
394  pull_fine_phi[46] *= 1.035315;
395  pull_fine_phi[47] *= 1.036548;
396  pull_fine_phi[48] *= 1.032359;
397  pull_fine_phi[49] *= 1.030394;
398  pull_fine_phi[50] *= 1.031460;
399  pull_fine_phi[51] *= 1.032054;
400  pull_fine_phi[52] *= 1.031856;
401  pull_fine_phi[53] *= 1.031389;
402  pull_fine_phi[54] *= 1.030922;
403  pull_fine_phi[55] *= 1.010915;
404  pull_fine_phi[56] *= 1.271132;
405  pull_fine_phi[57] *= 0.000000;
406  pull_fine_z[0] *= 0.903223;
407  pull_fine_z[1] *= 0.906998;
408  pull_fine_z[2] *= 0.909652;
409  pull_fine_z[3] *= 1.379617;
410  pull_fine_z[4] *= 0.877200;
411  pull_fine_z[5] *= 0.944639;
412  pull_fine_z[6] *= 1.130620;
413  pull_fine_z[7] *= 1.074286;
414  pull_fine_z[8] *= 1.031207;
415  pull_fine_z[9] *= 1.026923;
416  pull_fine_z[10] *= 1.029683;
417  pull_fine_z[11] *= 1.023258;
418  pull_fine_z[12] *= 1.024277;
419  pull_fine_z[13] *= 1.022564;
420  pull_fine_z[14] *= 1.023237;
421  pull_fine_z[15] *= 1.020460;
422  pull_fine_z[16] *= 1.022844;
423  pull_fine_z[17] *= 1.022628;
424  pull_fine_z[18] *= 1.020984;
425  pull_fine_z[19] *= 1.018908;
426  pull_fine_z[20] *= 1.019514;
427  pull_fine_z[21] *= 1.020316;
428  pull_fine_z[22] *= 1.044147;
429  pull_fine_z[23] *= 1.054320;
430  pull_fine_z[24] *= 1.031116;
431  pull_fine_z[25] *= 1.029622;
432  pull_fine_z[26] *= 1.026101;
433  pull_fine_z[27] *= 1.025649;
434  pull_fine_z[28] *= 1.027153;
435  pull_fine_z[29] *= 1.025389;
436  pull_fine_z[30] *= 1.024853;
437  pull_fine_z[31] *= 1.026242;
438  pull_fine_z[32] *= 1.027198;
439  pull_fine_z[33] *= 1.027609;
440  pull_fine_z[34] *= 1.024212;
441  pull_fine_z[35] *= 1.026990;
442  pull_fine_z[36] *= 1.026987;
443  pull_fine_z[37] *= 1.025806;
444  pull_fine_z[38] *= 1.036276;
445  pull_fine_z[39] *= 1.029688;
446  pull_fine_z[40] *= 1.028911;
447  pull_fine_z[41] *= 1.026570;
448  pull_fine_z[42] *= 1.023386;
449  pull_fine_z[43] *= 1.025188;
450  pull_fine_z[44] *= 1.024090;
451  pull_fine_z[45] *= 1.022645;
452  pull_fine_z[46] *= 1.023954;
453  pull_fine_z[47] *= 1.022967;
454  pull_fine_z[48] *= 1.021187;
455  pull_fine_z[49] *= 1.022650;
456  pull_fine_z[50] *= 1.021918;
457  pull_fine_z[51] *= 1.021044;
458  pull_fine_z[52] *= 1.021689;
459  pull_fine_z[53] *= 1.020743;
460  pull_fine_z[54] *= 1.022534;
461  pull_fine_z[55] *= 0.784192;
462  pull_fine_z[56] *= 0.767927;
463  pull_fine_z[57] *= 0.000000;
464  pull_fine_z[55] *= 0.876383;
465  pull_fine_z[56] *= 0.766922;
466  pull_fine_z[3] *= 2.000261;
467  pull_fine_z[4] *= 1.127752;
468  pull_fine_z[5] *= 0.804010;
469  pull_fine_z[6] *= 0.567351;
470 
471 
472 }
473 
474 //_________________________________________________________________________________
476 {
477 
478  int layer = TrkrDefs::getLayer(key);
479 
480  double phierror = cluster->getRPhiError();
481  double zerror = cluster->getZError();
482  if( TrkrDefs::getTrkrId( key )== TrkrDefs::tpcId){
483  if(layer==7||layer==22||layer==23||layer==38||layer==39){
484  phierror *= 4;
485  zerror*= 4;
486  }
487  if(cluster->getEdge()>=3)
488  phierror *= 4;
489  if(cluster->getOverlap()>=2)
490  phierror *= 2;
491  if(cluster->getPhiSize()==1)
492  phierror *= 10;
493  if(cluster->getPhiSize()>=5)
494  phierror *= 10;
495 
496  if(phierror>0.1) phierror = 0.1;
497  if(phierror<0.0005) phierror = 0.1;
498  }
499  return std::make_pair(square(phierror),square(zerror));
500 }
501 
502 //_________________________________________________________________________________
503 ClusterErrorPara::error_t ClusterErrorPara::get_cluster_error(TrkrCluster* cluster, double cluster_r, TrkrDefs::cluskey key, float qOverR, float slope)
504 {
505  float r = cluster_r;
506  float R = TMath::Abs(1.0/qOverR);
507  double alpha = (r*r) /(2*r*R);
508  double beta = TMath::Abs(atan(slope));
509  return get_cluster_error(cluster, key, alpha, beta);
510 }
511 
513  double phierror = 0;
514 
515  int sector = -1;
516  if(layer >=7 && layer < 23){
517  sector = 0;
518  }else if(layer>=23 && layer <39){
519  sector = 1;
520  }else if(layer>=39 && layer <55){
521  sector = 2;
522  }
523  phierror = 0.0005;
524 
525  if(sector!=-1)
526  phierror = 0.0005;
527 
528  if(sector==0){
529  //phierror = 0.019886;
530  phierror = f0->Eval(alpha);
531  if(cluster->getMaxAdc()!=0){
532  if(cluster->getMaxAdc()>150)
533  phierror *= 0.54*0.9;
534  else{
535  phierror *= fadcphi0->Eval(cluster->getMaxAdc());
536  phierror *= fadcphi0fine->Eval(cluster->getMaxAdc());
537  }
538  }
539  if(cluster->getEdge()>=5)
540  phierror *= 2;
541 
542  if(cluster->getPhiSize()==1)
543  phierror *= 1.5;
544  if(cluster->getPhiSize()==4)
545  phierror *= 1.5;
546  if(cluster->getPhiSize()>=5)
547  phierror *= 2.5;
548 
549  phierror *= f0fine->Eval(alpha);
550  }
551 
552  if(sector==1){
553  //phierror = 0.018604;
554  phierror = f1->Eval(alpha);
555  if(cluster->getMaxAdc()!=0){
556  if(cluster->getMaxAdc()>160)
557  phierror *= 0.6;
558  else
559  phierror *= fadcphi1->Eval(cluster->getMaxAdc());
560  if(cluster->getEdge()>=5)
561  phierror *= 2;
562  if(cluster->getMaxAdc()>140)
563  phierror *= 0.95;
564  else
565  phierror *= fadcphi1fine->Eval(cluster->getMaxAdc());
566  }
567  phierror *= 0.975;
568  if(cluster->getPhiSize()==1)
569  phierror *= 4;
570  if(cluster->getPhiSize()==4)
571  phierror *= 1.2;
572  if(cluster->getPhiSize()>=5)
573  phierror *= 2;
574 
575  phierror *= f1fine->Eval(alpha);
576 
577  }
578 
579  if(sector==2){
580  //phierror = 0.02043;
581 
582  phierror = f2->Eval(alpha);
583  if(cluster->getMaxAdc()){
584  if(cluster->getMaxAdc()>170)
585  phierror *= 0.6*0.95;
586  else{
587  phierror *= fadcphi2->Eval(cluster->getMaxAdc());
588  if(cluster->getMaxAdc()<100)
589  phierror *= fadcphi2fine1->Eval(cluster->getMaxAdc());
590  }
591  }
592  if(cluster->getEdge()>=5)
593  phierror *= 2;
594 
595  if(cluster->getPhiSize()==1)
596  phierror *= 10;
597  if(cluster->getPhiSize()>=6)
598  phierror *= 10;
599 
600 
601  phierror *= f2fine->Eval(alpha);
602 
603  }
604  if(layer==7)phierror *= (3*0.72);
605  if(layer==22||layer==23) phierror *= (3*0.8);
606  if(layer==38) phierror *= (3*0.9);
607  if(layer==39) phierror *= (3*1.05);
608 
609  if(phierror>0.1) phierror = 0.1;
610  if(phierror<0.0005) phierror = 0.1;
611 
612  return phierror;
613 }
614 double ClusterErrorPara::tpc_z_error(int layer, double beta, TrkrCluster* cluster){
615  double zerror = 0.05;
616 
617  int sector = -1;
618  if(layer >=7 && layer < 23){
619  sector = 0;
620  }else if(layer>=23 && layer <39){
621  sector = 1;
622  }else if(layer>=39 && layer <55){
623  sector = 2;
624  }
625  if(sector!=-1)
626  zerror = 0.05;
627 
628  if(sector==0){
629  zerror = fz0->Eval(beta);
630  if(cluster->getMaxAdc()>180)
631  zerror *= 0.5;
632  else
633  zerror *= fadcz0->Eval(cluster->getMaxAdc());
634  zerror *= fz0fine->Eval(beta);
635  zerror *= fadcz0fine->Eval(cluster->getMaxAdc());
636  }
637 
638  if(sector==1){
639  zerror = fz1->Eval(beta);
640  if(cluster->getMaxAdc()>180)
641  zerror *= 0.6;
642  else
643  zerror *= fadcz1->Eval(cluster->getMaxAdc());
644  zerror *= fz1fine->Eval(beta);
645  zerror *= fadcz1fine->Eval(cluster->getMaxAdc());
646  zerror *= 0.98;
647  // zerror *= 1.05913
648  }
649  if(sector==2){
650  zerror = fz2->Eval(beta);
651  if(cluster->getMaxAdc()>170)
652  zerror *= 0.6;
653  else
654  zerror *= fadcz2->Eval(cluster->getMaxAdc());
655  zerror *= fz2fine->Eval(beta);
656  zerror *= fadcz2fine->Eval(cluster->getMaxAdc());
657  // zerrror *= 1.15575;
658  }
659  if(layer==7) zerror *= (3.5*1.13);
660  if(layer==22) zerror *= (3.5*0.9);
661  if(layer==23) zerror *= (3.5*0.95);
662  if(layer==38) zerror *= (3.5*0.85);
663 
664  if(zerror>0.2) zerror = 0.2;
665  if(zerror<0.0002) zerror = 0.2;
666 
667  return zerror;
668 }
669 
671  double phierror = 0;
672  if(layer==55){
673  if(cluster->getPhiSize()==1){
674  phierror = pitcherr_phi_mm1;
675  }else if(cluster->getPhiSize()==2){
676  phierror = fmm_55_2->Eval(alpha);
677  }else if(cluster->getPhiSize()>=3){
678  phierror = fmm_3->Eval(alpha);
679  }
680  phierror *=scale_mm_0;
681  }else if(layer==56){
682  phierror =pitcherr_phi_mm2;
683  }
684  return phierror;
685 }
686 
687 double ClusterErrorPara::mm_z_error(int layer, double beta, TrkrCluster* cluster){
688  double zerror = 0;
689  if(layer==55){
690  zerror = pitcherr_z_mm1;
691  }else if(layer==56){
692  if(cluster->getZSize()==1){
693  zerror = pitcherr_z_mm2;
694  }else if(cluster->getZSize()==2){
695  zerror = fmm_56_2->Eval(beta);
696  }else if(cluster->getZSize()>=3){
697  zerror = fmm_3->Eval(beta);
698  }
699  zerror *=scale_mm_1;
700  }
701  return zerror;
702 }
703 
705 
706  double phierror = 0;
707  static constexpr std::array<double, 7> scalefactors_mvtx_phi = {{ 0.36, 0.6,0.37,0.49,0.4,0.37,0.33 }};
708  phierror = pitcherr_phi_mvtx;//0.00077595876
709  // std::cout << " phistart: " << phierror << " phisize: " << cluster->getPhiSize() << "zsize: " << cluster->getZSize() << std::endl;
710  if(cluster->getPhiSize() == 1 && cluster->getZSize() == 1) phierror = pitcherr_phi_mvtx*scalefactors_mvtx_phi[0];
711  else if(cluster->getPhiSize() == 2 && cluster->getZSize() == 1) phierror = pitcherr_phi_mvtx*scalefactors_mvtx_phi[1];
712  else if(cluster->getPhiSize() == 1 && cluster->getZSize() == 2) phierror = pitcherr_phi_mvtx*scalefactors_mvtx_phi[2];
713  else if( cluster->getPhiSize() == 2 && cluster->getZSize() == 2 ) phierror = pitcherr_phi_mvtx*scalefactors_mvtx_phi[0];
714  else if( cluster->getPhiSize() == 2 && cluster->getZSize() == 3 ) phierror = pitcherr_phi_mvtx*scalefactors_mvtx_phi[1];
715  else if( cluster->getPhiSize() == 3 && cluster->getZSize() == 2 ) phierror = pitcherr_phi_mvtx*scalefactors_mvtx_phi[2];
716  else if( cluster->getPhiSize() == 3 && cluster->getZSize() == 3 ) phierror = pitcherr_phi_mvtx*scalefactors_mvtx_phi[3];
717  else phierror = pitcherr_phi_mvtx*cluster->getPhiSize();
718  // std::cout << " phi after size: " << phierror << std::endl;
719  phierror *= scale_mvtx;
720  // else zerror = pitcherr_z_mvtx*cluster->getZSize();
721  // std::cout << " phi: " << phierror << std::endl;
722  return phierror;
723 }
724 
726 
727  double phierror = 0;
728  static constexpr std::array<double, 7> scalefactors_mvtx_phi = {{ 0.36, 0.6,0.37,0.49,0.4,0.37,0.33 }};
729  phierror = pitcherr_phi_mvtx;//0.00077595876
730  // std::cout << " phistart: " << phierror << " phisize: " << cluster->getPhiSize() << "zsize: " << cluster->getZSize() << std::endl;
731  if(cluster->getPhiSize() == 1 && cluster->getZSize() == 1) phierror = pitcherr_phi_mvtx*scalefactors_mvtx_phi[0];
732  else if(cluster->getPhiSize() == 2 && cluster->getZSize() == 1) phierror = pitcherr_phi_mvtx*scalefactors_mvtx_phi[1];
733  else if(cluster->getPhiSize() == 1 && cluster->getZSize() == 2) phierror = pitcherr_phi_mvtx*scalefactors_mvtx_phi[2];
734  else if( cluster->getPhiSize() == 2 && cluster->getZSize() == 2 ) phierror = pitcherr_phi_mvtx*scalefactors_mvtx_phi[0];
735  else if( cluster->getPhiSize() == 2 && cluster->getZSize() == 3 ) phierror = pitcherr_phi_mvtx*scalefactors_mvtx_phi[1];
736  else if( cluster->getPhiSize() == 3 && cluster->getZSize() == 2 ) phierror = pitcherr_phi_mvtx*scalefactors_mvtx_phi[2];
737  else if( cluster->getPhiSize() == 3 && cluster->getZSize() == 3 ) phierror = pitcherr_phi_mvtx*scalefactors_mvtx_phi[3];
738  else phierror = pitcherr_phi_mvtx*cluster->getPhiSize();
739  // std::cout << " phi after size: " << phierror << std::endl;
740  phierror *= scale_mvtx;
741  // else zerror = pitcherr_z_mvtx*cluster->getZSize();
742  // std::cout << " phi: " << phierror << std::endl;
743  return phierror;
744 }
745 
747  double zerror = 0;
748 
749  zerror = pitcherr_z_mvtx;
750  static constexpr std::array<double, 4> scalefactors_z = {{ 0.47, 0.48, 0.71, 0.55 }};
751  if( cluster->getZSize() == 2 && cluster->getPhiSize() == 2 ) zerror = pitcherr_z_mvtx*scalefactors_z[0];
752  else if( cluster->getZSize() == 2 && cluster->getPhiSize() == 3 ) zerror = pitcherr_z_mvtx*scalefactors_z[1];
753  else if( cluster->getZSize() == 3 && cluster->getPhiSize() == 2 ) zerror = pitcherr_z_mvtx*scalefactors_z[2];
754  else if( cluster->getZSize() == 3 && cluster->getPhiSize() == 3 ) zerror = pitcherr_z_mvtx*scalefactors_z[3];
755  zerror *= scale_mvtx_z; return zerror;
756 }
758  double zerror = 0;
759 
760  zerror = pitcherr_z_mvtx;
761  static constexpr std::array<double, 4> scalefactors_z = {{ 0.47, 0.48, 0.71, 0.55 }};
762  if( cluster->getZSize() == 2 && cluster->getPhiSize() == 2 ) zerror = pitcherr_z_mvtx*scalefactors_z[0];
763  else if( cluster->getZSize() == 2 && cluster->getPhiSize() == 3 ) zerror = pitcherr_z_mvtx*scalefactors_z[1];
764  else if( cluster->getZSize() == 3 && cluster->getPhiSize() == 2 ) zerror = pitcherr_z_mvtx*scalefactors_z[2];
765  else if( cluster->getZSize() == 3 && cluster->getPhiSize() == 3 ) zerror = pitcherr_z_mvtx*scalefactors_z[3];
766  zerror *= scale_mvtx_z; return zerror;
767 }
768 
770  double phierror = 0;
771  static constexpr std::array<double, 3> scalefactors_intt_phi = {{ 0.85, 0.4, 0.33 }};
772 
773  if( cluster->getPhiSize() == 1 && layer < 5) phierror = pitcherr_phi_intt*scalefactors_intt_phi[0];
774  else if( cluster->getPhiSize() == 2 && layer < 5) phierror = pitcherr_phi_intt*scalefactors_intt_phi[1];
775  else if( cluster->getPhiSize() == 2 && layer > 4) phierror = pitcherr_phi_intt*scalefactors_intt_phi[2];
776  else phierror = pitcherr_phi_intt*cluster->getPhiSize();
777  if( layer == 3) phierror *= scale_intt_3;
778  if( layer == 4) phierror *= scale_intt_4;
779  if( layer == 5) phierror *= scale_intt_5;
780  if( layer == 6) phierror *= scale_intt_6;
781 
782  return phierror;
783 }
784 
786  double zerror = 0;
787  zerror = pitcherr_z_intt*cluster->getZSize();
788  return zerror;
789 }
791  double phierror = 0;
792  static constexpr std::array<double, 3> scalefactors_intt_phi = {{ 0.85, 0.4, 0.33 }};
793 
794  if( cluster->getPhiSize() == 1 && layer < 5) phierror = pitcherr_phi_intt*scalefactors_intt_phi[0];
795  else if( cluster->getPhiSize() == 2 && layer < 5) phierror = pitcherr_phi_intt*scalefactors_intt_phi[1];
796  else if( cluster->getPhiSize() == 2 && layer > 4) phierror = pitcherr_phi_intt*scalefactors_intt_phi[2];
797  else phierror = pitcherr_phi_intt*cluster->getPhiSize();
798  if( layer == 3) phierror *= scale_intt_3;
799  if( layer == 4) phierror *= scale_intt_4;
800  if( layer == 5) phierror *= scale_intt_5;
801  if( layer == 6) phierror *= scale_intt_6;
802 
803  return phierror;
804 }
805 
807  double zerror = 0;
808  zerror = pitcherr_z_intt*cluster->getZSize();
809  return zerror;
810 }
811 
812 //_________________________________________________________________________________
814 {
815 
816  int layer = TrkrDefs::getLayer(key);
817  double phierror = 0;
818  double zerror = 0;
819  switch( TrkrDefs::getTrkrId( key ) )
820  {
821 
822  default: break;
823 
825  phierror=mm_phi_error(layer, alpha, cluster);
826  zerror=mm_z_error(layer, beta, cluster);
827 
828  break;
829  case TrkrDefs::mvtxId:
830 
831  phierror=mvtx_phi_error(cluster);
832  zerror=mvtx_z_error(cluster);
833  // std::cout << " z: " << zerror << " l: " << layer << std::endl;
834  break;
835 
836  case TrkrDefs::inttId:
837 
838  phierror=intt_phi_error(layer,cluster);
839  zerror=intt_z_error(cluster);
840  break;
841 
842  case TrkrDefs::tpcId:
843  phierror = tpc_phi_error(layer,alpha,cluster);
844  zerror = tpc_z_error(layer,beta,cluster);
845  /*
846  std::cout << " phi: " << phierror << " | " << phierror2 << " l: " << layer << " a " << alpha << " maxadc: " << cluster->getMaxAdc() << std::endl;
847  std::cout << " z: " << zerror << " | " << zerror2 << " l: " << layer << " b " << beta << " maxadc: " << cluster->getMaxAdc() << " adc: " << cluster->getAdc() << std::endl;
848  */
849  break;
850 
851  }
852  if(pull_fine_phi[layer]!=0)
853  phierror *= pull_fine_phi[layer];
854  if(pull_fine_z[layer]!=0)
855  zerror *= pull_fine_z[layer];
856 
857  if(phierror==0) phierror = 100;
858  if(zerror==0) zerror = 100;
859 
860  return std::make_pair(square(phierror),square(zerror));
861  // return std::make_pair(phierror,zerror);
862 
863 }
864 //_________________________________________________________________________________
865 
867 {
868  double alpha = 0.17;
869  double beta = 0.4;
870  if(cluster_r > 100000) alpha = 0.17001;
871  int layer = TrkrDefs::getLayer(key);
872  double phierror = 0;
873  double zerror = 0;
874  switch( TrkrDefs::getTrkrId( key ) )
875  {
876 
877  default: break;
878 
880  phierror=mm_phi_error(layer, 0.27, cluster);
881  zerror=mm_z_error(layer, 0.4, cluster);
882 
883  break;
884  case TrkrDefs::mvtxId:
885 
886  phierror=mvtx_phi_error(cluster);
887  zerror=mvtx_z_error(cluster);
888  // std::cout << " z: " << zerror << " l: " << layer << std::endl;
889  break;
890 
891  case TrkrDefs::inttId:
892 
893  phierror=intt_phi_error(layer,cluster);
894  zerror=intt_z_error(cluster);
895  break;
896 
897  case TrkrDefs::tpcId:
898  phierror = tpc_phi_error(layer,alpha,cluster);
899  zerror = tpc_z_error(layer,beta,cluster);
900 
901  break;
902 
903  }
904  if(pull_fine_phi[layer]!=0)
905  phierror *= pull_fine_phi[layer];
906  if(pull_fine_z[layer]!=0)
907  zerror *= pull_fine_z[layer];
908 
909  if(phierror==0) phierror = 100;
910  if(zerror==0) zerror = 100;
911 
912  return std::make_pair(square(phierror),square(zerror));
913 
914 }
915 
916 //_________________________________________________________________________________
918 {
919 
920  int layer = TrkrDefs::getLayer(key);
921  double phierror = 0;
922  double zerror = 0;
923 
924  phierror=mvtx_phi_error(cluster);
925  zerror=mvtx_z_error(cluster);
926 
927  if(pull_fine_phi[layer]!=0)
928  phierror *= pull_fine_phi[layer];
929  if(pull_fine_z[layer]!=0)
930  zerror *= pull_fine_z[layer];
931 
932  if(phierror==0) phierror = 100;
933  if(zerror==0) zerror = 100;
934 
935  return std::make_pair(square(phierror),square(zerror));
936 
937 }
938 
939 //_________________________________________________________________________________
941 {
942 
943  int layer = TrkrDefs::getLayer(key);
944  double phierror = 0;
945  double zerror = 0;
946  switch( TrkrDefs::getTrkrId( key ) )
947  {
948 
949  default: break;
950 
951  case TrkrDefs::mvtxId:
952 
953  phierror=mvtx_phi_error(cluster);
954  zerror=mvtx_z_error(cluster);
955  // std::cout << " z: " << zerror << " l: " << layer << std::endl;
956  break;
957 
958  case TrkrDefs::inttId:
959 
960  phierror=intt_phi_error(layer,cluster);
961  zerror=intt_z_error(cluster);
962  break;
963 
964  }
965  if(pull_fine_phi[layer]!=0)
966  phierror *= pull_fine_phi[layer];
967  if(pull_fine_z[layer]!=0)
968  zerror *= pull_fine_z[layer];
969 
970  if(phierror==0) phierror = 100;
971  if(zerror==0) zerror = 100;
972 
973  return std::make_pair(square(phierror),square(zerror));
974 
975 }