6std::vector<double>
cpar;
7std::vector<double>
spar;
12 TFile* fcurve =
new TFile(
curve_files[index].c_str());
14 TTree*
curve = (TTree*)fcurve->Get(
"curve");
15 TTree*
sigma = (TTree*)fcurve->Get(
"sigma");
16 double c[100],
s[100];
18 curve->SetBranchAddress(
"curve", c);
19 curve->SetBranchAddress(
"CurveSize", &csize);
20 sigma->SetBranchAddress(
"sigma",
s);
21 sigma->SetBranchAddress(
"SigmaSize", &ssize);
28 if (c[0] < 0 &&
s[0] < 0)
36 for (
int i = 1; i < csize; i++) {
39 for (
int i = 1; i < ssize; i++) {
53 const int par_cand(5);
54 const float Charge_Mass[par_cand] = { 0.00051100, 0.10566, 0.13957, 0.4937, 0.93827 };
55 double beta_G, beta, betterm, bethe_B;
58 int dedxflag =
vflag[0];
59 int sigmaflag =
vflag[1];
61 if(
vflag[2] == 1) ifMC =
true;
63 for(
int it = 0; it < par_cand; it++ ) {
64 beta_G = mom/Charge_Mass[it];
67 beta = beta_G/sqrt(1+(beta_G)*(beta_G));
71 else if(dedxflag == 2) {
84 bethe_B = 550*(A*partA+B*partB+
C*partC);
100 bethe_B = 550*(A*partA+B*partB+
C*partC);
102 if(beta_G> 100) bethe_B=550*1.0;
106 dedx_exp[it] = bethe_B;
107 double sig_the = std::sin((
double)theta);
108 double f_betagamma, g_sinth, h_nhit, i_t0;
111 double nhit = (double)Nohit;
113 double ndedx=bethe_B/550;
115 double cor_nhit = 1.0;
116 if (nhit < 5) nhit = 5;
118 cor_nhit =
spar[3]*pow(nhit,4)+
spar[4]*pow(nhit,3)+
spar[5]*pow(nhit,2) +
122 if(sig_the>0.99) sig_the=0.99;
123 cor_sin =
spar[8]*pow(sig_the,4)+
spar[9]*pow(sig_the,3) +
131 ex_sigma[it] = 550 * sigma_bg * cor_nhit * cor_sin * cor_t0;
133 ex_sigma[it] = 550 * sigma_bg * cor_nhit * cor_sin * cor_t0 *
spar[13];
138 double nhit = (double)Nohit;
139 double sigma_bg = 1.0;
146 double cor_nhit = 1.0;
147 if (nhit < 5) nhit = 5;
149 cor_nhit =
spar[8]*pow(nhit,4)+
spar[9]*pow(nhit,3)+
spar[10]*pow(nhit,2) +
153 double cor_sin = 1.0;
154 if(sig_the>0.99) sig_the=0.99;
155 cor_sin =
spar[13]*pow(sig_the,4)+
spar[14]*pow(sig_the,3) +
163 ex_sigma[it] = 550 * sigma_bg * cor_nhit * cor_sin * cor_t0;
165 ex_sigma[it] = 550 * sigma_bg * cor_nhit * cor_sin * cor_t0 *
spar[18];
177 else if(
spar[13] == 0)
181 ex_sigma[it]= f_betagamma* g_sinth * h_nhit * i_t0;
183 else if(sigmaflag == 2) {
185 double nhit = (double)Nohit;
195 cor_nhit =
spar[8]*pow(nhit,4)+
spar[9]*pow(nhit,3)+
spar[10]*pow(nhit,2) +
spar[11]*nhit+
spar[12];
198 if(sig_the>0.99) sig_the = 0.99;
199 cor_sin =
spar[13]*pow(sig_the,4)+
spar[14]*pow(sig_the,3) +
203 if (t0 > 1200) t0 = 1200;
207 ex_sigma[it]=550*sigma_bg*cor_nhit*cor_sin*cor_t0;
209 else if(sigmaflag == 3) {
211 double nhit = (double)Nohit;
218 double cor_nhit = 1.0;
219 if (nhit < 5) nhit = 5;
221 cor_nhit =
spar[8]*pow(nhit,4)+
spar[9]*pow(nhit,3)+
spar[10]*pow(nhit,2) +
spar[11]*nhit+
spar[12];
224 if(sig_the>0.99) sig_the=0.99;
225 cor_sin =
spar[13]*pow(sig_the,4)+
spar[14]*pow(sig_the,3) +
228 ex_sigma[it]=550*sigma_bg*cor_nhit*cor_sin;
230 else if(sigmaflag == 4) {
232 double nhit = (double)Nohit;
239 double cor_nhit = 1.0;
240 if (nhit < 5) nhit = 5;
242 cor_nhit =
spar[8]*pow(nhit,4)+
spar[9]*pow(nhit,3)+
spar[10]*pow(nhit,2) +
spar[11]*nhit+
spar[12];
245 if(sig_the>0.99) sig_the=0.99;
246 cor_sin =
spar[13]*pow(sig_the,4)+
spar[14]*pow(sig_the,3) +
250 ex_sigma[it]=550*sigma_bg*cor_nhit*cor_sin;
252 ex_sigma[it]=550*sigma_bg*cor_nhit*cor_sin*
spar[18];
254 else if(sigmaflag == 5) {
256 double nhit = (double)Nohit;
266 cor_nhit =
spar[8]*pow(nhit,4)+
spar[9]*pow(nhit,3)+
spar[10]*pow(nhit,2) +
269 if(sig_the>0.99) sig_the = 0.99;
270 cor_sin =
spar[13]*pow(sig_the,4)+
spar[14]*pow(sig_the,3) +
274 if (t0 > 1200) t0 = 1200;
279 ex_sigma[it]=550*sigma_bg*cor_nhit*cor_sin*cor_t0;
281 ex_sigma[it]=550*sigma_bg*cor_nhit*cor_sin*cor_t0*
spar[21];
283 else if(sigmaflag == 6) {
284 double x= bethe_B/550;
285 double nhit = (double)Nohit;
290 double cor_nhit = 1.0;
291 if (nhit < 5) nhit = 5;
296 if(sig_the>0.99) sig_the=0.99;
297 cor_sin =
spar[8]*pow(sig_the,4)+
spar[9]*pow(sig_the,3) +
301 ex_sigma[it]=550*sigma_bg*cor_nhit*cor_sin;
303 ex_sigma[it]=550*sigma_bg*cor_nhit*cor_sin*
spar[13];
305 else if(sigmaflag == 7) {
306 double x= bethe_B/550;
307 double nhit = (double)Nohit;
316 cor_nhit =
spar[3]*pow(nhit,4)+
spar[4]*pow(nhit,3)+
spar[5]*pow(nhit,2) +
319 if(sig_the>0.99) sig_the = 0.99;
320 cor_sin =
spar[8]*pow(sig_the,4)+
spar[9]*pow(sig_the,3) +
324 if (t0 > 1200) t0 = 1200;
329 ex_sigma[it]=550*sigma_bg*cor_nhit*cor_sin*cor_t0;
331 ex_sigma[it]=550*sigma_bg*cor_nhit*cor_sin*cor_t0*
spar[16];
337 ex_sigma[it] = 1000.0;
343 int Nohit,
double mom,
double theta,
double t0,
344 double dedx_exp[5],
double ex_sigma[5],
345 double pid_prob[5],
double chi_dedx[5],
346 std::vector<double> & par, std::vector<double> & sig_par)
348 const int par_cand( 5 );
349 const float Charge_Mass[par_cand] = {0.00051100, 0.10566, 0.13957, 0.4937, 0.93827 };
350 double beta_G, beta, betterm, bethe_B;
352 int dedxflag =
vflag[0];
353 int sigmaflag =
vflag[1];
355 if(
vflag[2] == 1) ifMC =
true;
358 float max_prob(-0.01);
362 for(
int it = 0; it < par_cand; it++ ) {
363 beta_G = mom/Charge_Mass[it];
366 beta = beta_G/sqrt(1+(beta_G)*(beta_G));
367 betterm = par[1]-log(par[2]+pow(1/beta_G,par[4]));
368 bethe_B = par[0]/pow(beta,par[3])*betterm-par[0];
370 else if(dedxflag == 2) {
379 double partA = par[0]*pow(sqrt(
x*
x+1),par[2])/pow(
x,par[2])*(par[1]-par[5]*log(pow(1/
x,par[3])) ) - par[4]+
exp(par[6]+par[7]*
x);
380 double partB = par[8]*pow(
x,3)+par[9]*pow(
x,2)+par[10]*
x+par[11];
381 double partC = -par[12]*log(par[15]+pow(1/
x,par[13]))+par[14];
382 bethe_B = 550*(A*partA+B*partB+
C*partC);
384 if(beta_G> 100) bethe_B=550*1.0;
396 double partA = par[0]*pow(sqrt(
x*
x+1),par[2])/pow(
x,par[2])*(par[1]-par[5]*log(pow(1/
x,par[3])) ) - par[4]+
exp(par[6]+par[7]*
x);
397 double partB = par[8]*pow(
x,3)+par[9]*pow(
x,2)+par[10]*
x+par[11];
398 double partC = -par[12]*log(par[15]+pow(1/
x,par[13]))+par[14];
399 bethe_B = 550*(A*partA+B*partB+
C*partC);
401 if(beta_G> 100) bethe_B=550*1.0;
406 dedx_exp[it] = bethe_B;
407 double sig_the = std::sin((
double)theta);
408 double f_betagamma, g_sinth, h_nhit, i_t0;
414 double nhit = (double)Nohit;
416 double ndedx=bethe_B/550;
417 sigma_bg= sig_par[0]+sig_par[1]*ndedx+sig_par[2]*ndedx*ndedx;
419 double cor_nhit = 1.0;
420 if (nhit < 5) nhit = 5;
422 cor_nhit = sig_par[3]*pow(nhit,4)+sig_par[4]*pow(nhit,3)+sig_par[5]*pow(nhit,2) +
423 sig_par[6]*nhit+sig_par[7];
426 if(sig_the>0.99) sig_the=0.99;
427 cor_sin = sig_par[8]*pow(sig_the,4)+sig_par[9]*pow(sig_the,3) +
428 sig_par[10]*pow(sig_the,2)+sig_par[11]*sig_the+sig_par[12];
435 ex_sigma[it] = 550 * sigma_bg * cor_nhit * cor_sin * cor_t0;
437 ex_sigma[it] = 550 * sigma_bg * cor_nhit * cor_sin * cor_t0 * sig_par[13];
443 double nhit = (double)Nohit;
447 sigma_bg = sig_par[0]*
exp(sig_par[1]*
x)+sig_par[2]*
exp(sig_par[3]*pow(
x,0.25))+sig_par[4];
449 sigma_bg = sig_par[5]*
exp(sig_par[6]*
x)+ sig_par[7];
452 double cor_nhit = 1.0;
453 if (nhit < 5) nhit = 5;
455 cor_nhit = sig_par[8]*pow(nhit,4)+sig_par[9]*pow(nhit,3)+sig_par[10]*pow(nhit,2) +
456 sig_par[11]*nhit+sig_par[12];
459 if(sig_the>0.99) sig_the=0.99;
460 cor_sin = sig_par[13]*pow(sig_the,4)+sig_par[14]*pow(sig_the,3) +
461 sig_par[15]*pow(sig_the,2)+sig_par[16]*sig_the+sig_par[17];
468 ex_sigma[it] = 550 * sigma_bg * cor_nhit * cor_sin * cor_t0;
470 ex_sigma[it] = 550 * sigma_bg * cor_nhit * cor_sin * cor_t0 * sig_par[18];
476 f_betagamma=sig_par[0]*pow(beta_G,sig_par[1])+sig_par[2];
477 g_sinth=(sig_par[3]*sig_the*sig_the+sig_par[4])/(sig_par[3]*sig_par[5]*sig_par[5]+sig_par[4]);
478 h_nhit=(sig_par[6]*Nohit*Nohit+sig_par[7]*Nohit+sig_par[8]) /
479 (sig_par[6]*sig_par[9]*sig_par[9]+sig_par[7]*sig_par[9]+sig_par[8]);
481 i_t0 = (sig_par[10]*t0*t0+sig_par[11]*t0+sig_par[12]) /
482 (sig_par[10]*sig_par[13]*sig_par[13]+sig_par[11]*sig_par[13]+sig_par[12]);
483 else if(sig_par[13] == 0)
487 ex_sigma[it]= f_betagamma* g_sinth * h_nhit * i_t0;
489 else if(sigmaflag == 2) {
491 double nhit = (double)Nohit;
494 sigma_bg = sig_par[0]*
exp(sig_par[1]*
x)+sig_par[2]*
exp(sig_par[3]*pow(
x,0.25))+sig_par[4];
496 sigma_bg = sig_par[5]*
exp(sig_par[6]*
x)+ sig_par[7];
501 cor_nhit = sig_par[8]*pow(nhit,4)+sig_par[9]*pow(nhit,3)+sig_par[10]*pow(nhit,2) + sig_par[11]*nhit+sig_par[12];
504 if(sig_the>0.99) sig_the = 0.99;
505 cor_sin = sig_par[13]*pow(sig_the,4)+sig_par[14]*pow(sig_the,3) +
506 sig_par[15]*pow(sig_the,2)+sig_par[16]*sig_the+sig_par[17];
509 if (t0 > 1200) t0 = 1200;
511 cor_t0 = sig_par[18]*pow(t0,2)+sig_par[19]*t0+sig_par[20];
513 ex_sigma[it]=550*sigma_bg*cor_nhit*cor_sin*cor_t0;
515 else if(sigmaflag == 3) {
517 double nhit = (double)Nohit;
520 sigma_bg = sig_par[0]*
exp(sig_par[1]*
x)+sig_par[2]*
exp(sig_par[3]*pow(
x,0.25))+sig_par[4];
522 sigma_bg = sig_par[5]*
exp(sig_par[6]*
x)+ sig_par[7];
524 double cor_nhit = 1.0;
525 if (nhit < 5) nhit = 5;
527 cor_nhit = sig_par[8]*pow(nhit,4)+sig_par[9]*pow(nhit,3)+sig_par[10]*pow(nhit,2) + sig_par[11]*nhit+sig_par[12];
530 if(sig_the>0.99) sig_the=0.99;
531 cor_sin = sig_par[13]*pow(sig_the,4)+sig_par[14]*pow(sig_the,3) +
532 sig_par[15]*pow(sig_the,2)+sig_par[16]*sig_the+sig_par[17];
534 ex_sigma[it]=550*sigma_bg*cor_nhit*cor_sin;
536 else if(sigmaflag == 4) {
538 double nhit = (double)Nohit;
541 sigma_bg = sig_par[0]*
exp(sig_par[1]*
x)+sig_par[2]*
exp(sig_par[3]*pow(
x,0.25))+sig_par[4];
543 sigma_bg = sig_par[5]*
exp(sig_par[6]*
x)+ sig_par[7];
545 double cor_nhit = 1.0;
546 if (nhit < 5) nhit = 5;
548 cor_nhit = sig_par[8]*pow(nhit,4)+sig_par[9]*pow(nhit,3)+sig_par[10]*pow(nhit,2) + sig_par[11]*nhit+sig_par[12];
551 if(sig_the>0.99) sig_the=0.99;
552 cor_sin = sig_par[13]*pow(sig_the,4)+sig_par[14]*pow(sig_the,3) +
553 sig_par[15]*pow(sig_the,2)+sig_par[16]*sig_the+sig_par[17];
556 ex_sigma[it]=550*sigma_bg*cor_nhit*cor_sin;
558 ex_sigma[it]=550*sigma_bg*cor_nhit*cor_sin*sig_par[18];
560 else if(sigmaflag == 5) {
562 double nhit = (double)Nohit;
565 sigma_bg = sig_par[0]*
exp(sig_par[1]*
x)+sig_par[2]*
exp(sig_par[3]*pow(
x,0.25))+sig_par[4];
567 sigma_bg = sig_par[5]*
exp(sig_par[6]*
x)+ sig_par[7];
572 cor_nhit = sig_par[8]*pow(nhit,4)+sig_par[9]*pow(nhit,3)+sig_par[10]*pow(nhit,2) +
573 sig_par[11]*nhit+sig_par[12];
575 if(sig_the>0.99) sig_the = 0.99;
576 cor_sin = sig_par[13]*pow(sig_the,4)+sig_par[14]*pow(sig_the,3) +
577 sig_par[15]*pow(sig_the,2)+sig_par[16]*sig_the+sig_par[17];
580 if (t0 > 1200) t0 = 1200;
582 cor_t0 = sig_par[18]*pow(t0,2)+sig_par[19]*t0+sig_par[20];
585 ex_sigma[it]=550*sigma_bg*cor_nhit*cor_sin*cor_t0;
587 ex_sigma[it]=550*sigma_bg*cor_nhit*cor_sin*cor_t0*sig_par[21];
589 else if(sigmaflag == 6) {
590 double x= bethe_B/550;
591 double nhit = (double)Nohit;
594 sigma_bg= sig_par[0]+sig_par[1]*
x+sig_par[2]*
x*
x;
596 double cor_nhit = 1.0;
597 if (nhit < 5) nhit = 5;
599 cor_nhit = sig_par[3]*pow(nhit,4)+sig_par[4]*pow(nhit,3)+sig_par[5]*pow(nhit,2) + sig_par[6]*nhit+sig_par[7];
602 if(sig_the>0.99) sig_the=0.99;
603 cor_sin = sig_par[8]*pow(sig_the,4)+sig_par[9]*pow(sig_the,3) +
604 sig_par[10]*pow(sig_the,2)+sig_par[11]*sig_the+sig_par[12];
607 ex_sigma[it]=550*sigma_bg*cor_nhit*cor_sin;
609 ex_sigma[it]=550*sigma_bg*cor_nhit*cor_sin*sig_par[13];
611 else if(sigmaflag == 7) {
612 double x= bethe_B/550;
613 double nhit = (double)Nohit;
616 sigma_bg= sig_par[0]+sig_par[1]*
x+sig_par[2]*
x*
x;
622 cor_nhit = sig_par[3]*pow(nhit,4)+sig_par[4]*pow(nhit,3)+sig_par[5]*pow(nhit,2) +
623 sig_par[6]*nhit+sig_par[7];
625 if(sig_the>0.99) sig_the = 0.99;
626 cor_sin = sig_par[8]*pow(sig_the,4)+sig_par[9]*pow(sig_the,3) +
627 sig_par[10]*pow(sig_the,2)+sig_par[11]*sig_the+sig_par[12];
630 if (t0 > 1200) t0 = 1200;
632 cor_t0 = sig_par[13]*pow(t0,2)+sig_par[14]*t0+sig_par[15];
635 ex_sigma[it]=550*sigma_bg*cor_nhit*cor_sin*cor_t0;
637 ex_sigma[it]=550*sigma_bg*cor_nhit*cor_sin*cor_t0*sig_par[16];
641 double dedx_correc = dedx;
642 chi_dedx[it] = (dedx_correc - dedx_exp[it])/ex_sigma[it];
643 chi2 = chi_dedx[it]*chi_dedx[it];
649 std::cout <<
" mom = " << mom <<
"exp"<< dedx_exp[it]
650 <<
" sigma "<<ex_sigma[it] <<
" prob "<<pid_prob[it]
653 if( pid_prob[it] > max_prob ){
654 max_prob = pid_prob[it];
660 ex_sigma[it] = 1000.0;
662 chi_dedx[it] = 999.0;
EvtComplex exp(const EvtComplex &c)
***************************************************************************************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
int vflag[3]
Curve parameter vars.
void ReadCurPara(int index)
std::vector< double > spar
void dedx_pid_exp(double mom, double theta, double Nohit, double t0, double dedx_exp[5], double ex_sigma[5])
std::vector< double > cpar
const std::string curve_files[2]