257 gROOT->ProcessLine(
".L tdrstyle.C");
258 gROOT->ProcessLine(
"setTDRStyle()");
260 std::cout <<
"Trying ABCD method for Background subtration" << std::endl;
263 TString histoName_Ba(
"h_met_EB");
264 TString histoName_Bb(
"h_met_inverse_EB");
265 TString histoName_Ea(
"h_met_EE");
266 TString histoName_Eb(
"h_met_inverse_EE");
269 int fmax = (int)
file.size();
271 for (
int i=0;
i<fmax; ++
i) {
275 TH1F *
h = (TH1F*)
f.Get(histoName_Ba);
276 NBins = h->GetNbinsX();
277 min = h->GetBinLowEdge(1);
278 max = h->GetBinLowEdge(NBins+1);
282 if (NBins ==0 || (max<min)) {
283 std::cout <<
"PlotCombiner::abcd error: Could not find valid histograms in file"
287 cout <<
"Histograms with "<< NBins <<
" bins and range " << min <<
"-" << max << endl;
290 TH1F h_wenu(
"h_wenu",
"h_wenu", NBins, min, max);
291 TH1F h_wenu_inv(
"h_wenu_inv",
"h_wenu_inv", NBins, min, max);
292 for (
int i=0;
i<fmax; ++
i) {
296 TH1F *h_ba = (TH1F*)
f.Get(histoName_Ba);
298 TH1F *h_ea = (TH1F*)
f.Get(histoName_Ea);
299 h_wenu.Add(h_ea,
weight[i]);
301 TH1F *h_bb = (TH1F*)
f.Get(histoName_Bb);
302 h_wenu_inv.Add(h_bb,
weight[i]);
303 TH1F *h_eb = (TH1F*)
f.Get(histoName_Eb);
304 h_wenu_inv.Add(h_eb,
weight[i]);
308 TH1F h_qcd(
"h_qcd",
"h_qcd", NBins, min, max);
309 TH1F h_qcd_inv(
"h_qcd_inv",
"h_qcd_inv", NBins, min, max);
310 for (
int i=0; i<fmax; ++
i) {
311 if ((
type[i] ==
"qcd" ||
type[i] ==
"bce"
315 TH1F *h_ba = (TH1F*)
f.Get(histoName_Ba);
316 h_qcd.Add(h_ba,
weight[i]);
317 TH1F *h_ea = (TH1F*)
f.Get(histoName_Ea);
318 h_qcd.Add(h_ea,
weight[i]);
320 TH1F *h_bb = (TH1F*)
f.Get(histoName_Bb);
321 h_qcd_inv.Add(h_bb,
weight[i]);
322 TH1F *h_eb = (TH1F*)
f.Get(histoName_Eb);
323 h_qcd_inv.Add(h_eb,
weight[i]);
327 TH1F h_ewk(
"h_ewk",
"h_ewk", NBins, min, max);
328 TH1F h_ewk_inv(
"h_ewk_inv",
"h_ewk_inv", NBins, min, max);
329 for (
int i=0; i<fmax; ++
i) {
333 TH1F *h_ba = (TH1F*)
f.Get(histoName_Ba);
334 h_ewk.Add(h_ba,
weight[i]);
335 TH1F *h_ea = (TH1F*)
f.Get(histoName_Ea);
336 h_ewk.Add(h_ea,
weight[i]);
338 TH1F *h_bb = (TH1F*)
f.Get(histoName_Bb);
339 h_ewk_inv.Add(h_bb,
weight[i]);
340 TH1F *h_eb = (TH1F*)
f.Get(histoName_Eb);
341 h_ewk_inv.Add(h_eb,
weight[i]);
349 int IMET = int ((METCut - min)/(max-min) *
double(NBins));
351 double metCalc = min + (max-
min)*
double(IMET)/double(NBins);
352 if (metCalc < METCut || metCalc > METCut) {
353 std::cout <<
"PlotCombiner:abcd: your MET Cut is not in low egde bin position"
356 cout <<
"MET Cut in " << METCut <<
"GeV corresponds to bin #" << IMET << endl;
359 double a_sig = h_wenu.Integral(IMET,NBins+1);
360 double b_sig = h_wenu.Integral(0,IMET-1);
361 double c_sig = h_wenu_inv.Integral(0,IMET-1);
362 double d_sig = h_wenu_inv.Integral(IMET,NBins+1);
364 double a_qcd = h_qcd.Integral(IMET,NBins+1);
365 double b_qcd = h_qcd.Integral(0,IMET-1);
366 double c_qcd = h_qcd_inv.Integral(0,IMET-1);
367 double d_qcd = h_qcd_inv.Integral(IMET,NBins+1);
369 double a_ewk = h_ewk.Integral(IMET,NBins+1);
370 double b_ewk = h_ewk.Integral(0,IMET-1);
371 double c_ewk = h_ewk_inv.Integral(0,IMET-1);
372 double d_ewk = h_ewk_inv.Integral(IMET,NBins+1);
377 if (data < 0 && data >-0.75) {
380 std::cout <<
"Calculating ABCD Result and Stat Error Assuming DATA"
381 << std::endl <<
"Summary: in this implementation we have assumed"
382 <<
" that what real 'data' appear with type sig in the input"
383 << std::endl <<
"No systematics available with this type of"
384 <<
" calculation. If you need systematics try one of the other"
385 <<
" options" << std::endl;
386 double A = (1.0-
I)*(FzP-Fz);
387 double B =
I*(FzP+1.0)*(FzP*(c_sig-c_ewk)-(d_sig-d_ewk)) +
388 (1+Fz)*(1-
I)*((a_sig-a_ewk)-dFzP*(b_sig-b_ewk));
389 double C =
I*(1.+Fz)*(1.+FzP)*((d_sig-d_ewk)*(b_sig-b_ewk) - (a_sig-a_ewk)*(c_sig-c_ewk));
396 double ApI=0, ApFz=0, ApFzP=0, ApNa=0, ApNb=0, ApNc=0, ApNd=0;
397 double BpI=0, BpFz=0, BpFzP=0, BpNa=0, BpNb=0, BpNc=0, BpNd=0;
398 double CpI=0, CpFz=0, CpFzP=0, CpNa=0, CpNb=0, CpNc=0, CpNd=0;
399 double SpI=0, SpFz=0, SpFzP=0, SpNa=0, SpNb=0, SpNc=0, SpNd=0;
401 double Na = a_sig, Nb = b_sig, Nc=c_sig, Nd = d_sig;
402 double Ea = a_ewk, Eb = b_ewk, Ec=c_ewk, Ed = d_ewk;
413 BpI = (FzP+1.0)*(Fz*(Nc-Ec)-(Nd-Ed))-(1.0+Fz)*((Na-Ea)-FzP*(Nb-Eb));
414 BpFz =
I*(FzP+1.0)*(Nc-Ec)+(1.0-
I)*((Na-Ea)-FzP*(Nb-Eb));
415 BpFzP =
I*(Fz*(Nc-Ec)-(Nd-Ed))-(1.0-
I)*(1.0+Fz)*(Nb-Eb);
416 BpNa = (1.0-
I)*(1.0+Fz);
417 BpNb = -(1.0-
I)*(1.0+Fz)*FzP;
418 BpNc =
I*(FzP+1.0)*Fz;
421 CpI = (1.0+Fz)*(1.0+FzP)*((Nd-Ed)*(Nb-Eb)-(Na-Ea)*(Nc-Ec));
422 CpFz =
I*(1.0+FzP)*((Nd-Ed)*(Nb-Eb)-(Na-Ea)*(Nc-Ec));
423 CpFzP =
I*(1.0+F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= -(1.0-
I)*(1.0+Fz)*FzP;
443 BpNc =
I*(FzP+1.0)*Fz;
446 CpI = (1.0+Fz)*(1.0+FzP)*((Nd-Ed)*(Nb-Eb)-(Na-Ea)*(Nc-Ec));
447 CpFz =
I*(1.0+FzP)*((Nd-Ed)*(Nb-Eb)-(Na-Ea)*(Nc-Ec));
448 CpFzP =
I*(1.0+Fz)*((Nd-Ed)*(Nb-Eb)-(Na-Ea)*(Nc-Ec));
449 CpNa = -
I*(1.0+Fz)*(1.0+FzP)*(Nc-Ec);
450 CpNb =
I*(1.0+Fz)*(1.0+FzP)*(Nd-Ed);
451 CpNc = -
I*(1.0+Fz)*(1.0+FzP)*(Na-Ea);
452 CpNd =
I*(1.0+Fz)*(1.0+FzP)*(Nb-Eb);
454 SpI = -CpI/
B+C*BpI/(
B*
B);
455 SpFz = -CpFz/
B+C*BpFz/(
B*
B);
456 SpFzP = -CpFzP/
B+C*BpFzP/(
B*
B);
457 SpNa = -CpNa/
B+C*BpNa/(
B*
B);
458 SpNb = -CpNb/
B+C*BpNb/(
B*
B);
459 SpNc = -CpNc/
B+C*BpNc/(
B*
B);
460 SpNd = -CpNd/
B+C*BpNd/(
B*
B);
463 DS =
sqrt( SpI*dI*SpI*dI + SpFz*dFz*SpFz*dFz + SpFzP*dFzP*SpFzP*dFzP +
464 SpNa*SpNa*Na + SpNb*SpNb*Nb + SpNc*SpNc*Nc + SpNd*SpNd*Nd );
466 cout <<
"********************************************************" << endl;
467 cout <<
"Signal Prediction: " << S <<
"+-" << DS <<
"(stat)" << endl;
468 cout <<
"********************************************************" << endl;
469 cout <<
"Parameters used in calculation: " << endl;
470 cout <<
"I= " <<
I <<
"+-" << dI << endl;
471 cout <<
"Fz= " << Fz <<
"+-" << dFz << endl;
472 cout <<
"FzP=" << FzP <<
"+-" << dFzP << endl;
474 cout <<
"ABCD Regions population:" << endl;
475 cout <<
"A: N=" << Na <<
", sig=" << a_sig <<
", qcd=" << a_qcd
476 <<
", ewk=" << a_ewk << endl;
477 cout <<
"B: N=" << Nb <<
", sig=" << b_sig <<
", qcd=" << b_qcd
478 <<
", ewk=" << b_ewk << endl;
479 cout <<
"C: N=" << Nc <<
", sig=" << c_sig <<
", qcd=" << c_qcd
480 <<
", ewk=" << c_ewk << endl;
481 cout <<
"D: N=" << Nd <<
", sig=" << d_sig <<
", qcd=" << d_qcd
482 <<
", ewk=" << d_ewk << endl;
485 cout <<
"Statistical Error Summary: " << endl;
486 cout <<
"due to Fz = "<< SpFz*dFz<<
", ("<<SpFz*dFz*100./S <<
"%)"<< endl;
487 cout <<
"due to FzP= "<< SpFzP*dFzP
488 <<
", ("<<SpFzP*dFzP*100./S <<
"%)"<< endl;
489 cout <<
"due to I = "<< SpI*dI
490 <<
", ("<<SpI*dI*100./S <<
"%)"<< endl;
491 cout <<
"due to Na = "<< SpNa*
sqrt(Na)
492 <<
", ("<< SpNa*
sqrt(Na)*100./S <<
"%)"<< endl;
493 cout <<
"due to Nb = "<< SpNb*
sqrt(Nb)
494 <<
", ("<< SpNb*
sqrt(Nb)*100./S <<
"%)"<< endl;
495 cout <<
"due to Nc = "<< SpNc*
sqrt(Nc)
496 <<
", ("<< SpNc*
sqrt(Nc)*100./S <<
"%)"<< endl;
497 cout <<
"due to Nd = "<< SpNd*
sqrt(Nd)
498 <<
", ("<< SpNd*
sqrt(Nd)*100./S <<
"%)"<< endl;
499 cout <<
"Total Statistical Error: "
500 << DS <<
", (" << DS*100./S <<
"%)"<< endl;
501 cout <<
"Stat Error percentages are wrt S prediction, not S mc" << endl;
508 if (mc < 0 && mc >-0.75) {
512 double A = (1.0-
I)*(FzP-Fz);
513 double B =
I*(FzP+1.0)*(FzP*(c_sig+c_qcd)-(d_sig+d_qcd)) +
514 (1+Fz)*(1-
I)*((a_sig+a_qcd)-dFzP*(b_sig+b_qcd));
515 double C =
I*(1.+Fz)*(1.+FzP)*((d_sig+d_qcd)*(b_sig+b_qcd) -
516 (a_sig+a_qcd)*(c_sig+c_qcd));
519 double S =
Trionym(A,
B,C, a_sig+b_sig);
521 double ApI=0, ApFz=0, ApFzP=0, ApNa=0, ApNb=0, ApNc=0, ApNd=0;
522 double BpI=0, BpFz=0, BpFzP=0, BpNa=0, BpNb=0, BpNc=0, BpNd=0;
523 double CpI=0, CpFz=0, CpFzP=0, CpNa=0, CpNb=0, CpNc=0, CpNd=0;
524 double SpI=0, SpFz=0, SpFzP=0, SpNa=0, SpNb=0, SpNc=0, SpNd=0;
526 double Na = a_sig+a_qcd+a_ewk, Nb = b_sig+b_qcd+b_ewk;
527 double Nc=c_sig+c_qcd+c_ewk, Nd = d_sig+d_qcd+d_ewk;
528 double Ea = a_ewk, Eb = b_ewk, Ec=c_ewk, Ed = d_ewk;
539 BpI = (FzP+1.0)*(Fz*(Nc-Ec)-(Nd-Ed))-(1.0+Fz)*((Na-Ea)-FzP*(Nb-Eb));
540 BpFz =
I*(FzP+1.0)*(Nc-Ec)+(1.0-
I)*((Na-Ea)-FzP*(Nb-Eb));
541 BpFzP =
I*(Fz*(Nc-Ec)-(Nd-Ed))-(1.0-
I)*(1.0+Fz)*(Nb-Eb);
542 BpNa = (1.0-
I)*(1.0+Fz);
543 BpNb = -(1.0-
I)*(1.0+Fz)*FzP;
544 BpNc =
I*(FzP+1.0)*Fz;
547 CpI = (1.0+Fz)*(1.0+FzP)*((Nd-Ed)*(Nb-Eb)-(Na-Ea)*(Nc-Ec));
548 CpFz =
I*(1.0+FzP)*((Nd-Ed)*(Nb-Eb)-(Na-Ea)*(Nc-Ec));
549 CpFzP =
I*(1.0+Fz)*((Nd-Ed)*(Nb-Eb)-(Na-Ea)*(Nc-Ec));
550 CpNa = -
I*(1.0+Fz)*(1.0+FzP)*(Nc-Ec);
551 CpNb =
I*(1.0+Fz)*(1.0+FzP)*(Nd-Ed);
552 CpNc = -
I*(1.0+Fz)*(1.0+FzP)*(Na-Ea);
553 CpNd =
I*(1.0+Fz)*(1.0+FzP)*(Nb-Eb);
555 SpI = (-BpI + (
B*BpI -2.0*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c-Ec));
575 CpNa = -
I*(1.0+Fz)*(1.0+FzP)*(Nc-Ec);
576 CpNb =
I*(1.0+Fz)*(1.0+FzP)*(Nd-Ed);
577 CpNc = -
I*(1.0+Fz)*(1.0+FzP)*(Na-Ea);
578 CpNd =
I*(1.0+Fz)*(1.0+FzP)*(Nb-Eb);
580 SpI = -CpI/
B+C*BpI/(
B*
B);
581 SpFz = -CpFz/
B+C*BpFz/(
B*
B);
582 SpFzP = -CpFzP/
B+C*BpFzP/(
B*
B);
583 SpNa = -CpNa/
B+C*BpNa/(
B*
B);
584 SpNb = -CpNb/
B+C*BpNb/(
B*
B);
585 SpNc = -CpNc/
B+C*BpNc/(
B*
B);
586 SpNd = -CpNd/
B+C*BpNd/(
B*
B);
589 DS =
sqrt( SpI*dI*SpI*dI + SpFz*dFz*SpFz*dFz + SpFzP*dFzP*SpFzP*dFzP +
590 SpNa*SpNa*Na + SpNb*SpNb*Nb + SpNc*SpNc*Nc + SpNd*SpNd*Nd );
596 double Imc = (a_sig + b_sig) / (a_sig + b_sig + c_sig + d_sig);
597 double dImc =
sqrt(Imc*(1-Imc)/(a_sig + b_sig + c_sig + d_sig));
598 double Fzmc = a_sig/b_sig;
599 double e =a_sig/(a_sig + b_sig);
600 double de =
sqrt(e*(1-e)/(a_sig + b_sig));
601 double alpha = de/(2.*Fzmc-
e);
602 double dFzmc = alpha/(1-
alpha);
603 double FzPmc = d_sig/c_sig;
604 double ep =d_sig/(c_sig + d_sig);
605 double dep =
sqrt(ep*(1-ep)/(c_sig + d_sig));
606 double alphap = dep/(2.*FzPmc-ep);
607 double dFzPmc = alphap/(1-alphap);
610 double KMC = (d_qcd/c_qcd)/(a_qcd/b_qcd);
611 double SMC = a_sig + b_sig;
613 double dfz = Fz -Fzmc;
615 double dfzp = FzP - FzPmc;
616 double fk = fabs(1-KMC);
619 double fm = 1.-ewkerror;
620 double fp = 1.+ewkerror;
621 double S_EWK_PLUS =
CalcABCD(Imc, Fzmc, FzPmc, KMC, fp, Na, Nb, Nc, Nd, Ea,Eb,Ec,Ed);
622 double S_EWK_MINUS =
CalcABCD(Imc, Fzmc, FzPmc, KMC, fm, Na, Nb, Nc, Nd, Ea,Eb,Ec,Ed);
624 double S_K=
CalcABCD(Imc, Fzmc, FzPmc, 1., 1., Na, Nb, Nc, Nd, Ea,Eb,Ec,Ed);
626 double S_FZ=
CalcABCD(Imc, Fz, FzPmc, KMC, 1., Na, Nb, Nc, Nd, Ea,Eb,Ec,Ed);
628 double S_FZP=
CalcABCD(Imc, Fzmc, FzP, KMC, 1., Na, Nb, Nc, Nd, Ea,Eb,Ec,Ed);
630 double S_I =
CalcABCD(
I, Fzmc, FzPmc, KMC, 1., Na, Nb, Nc, Nd, Ea,Eb,Ec,Ed);
639 int const POINTS = 10;
640 int const allPOINTS = 2*POINTS;
641 TGraph g_ewk(allPOINTS);
642 TGraph g_fz(allPOINTS);
643 TGraph g_fzp(allPOINTS);
644 TGraph g_k(allPOINTS);
645 TGraph g_i(allPOINTS);
660 for (
int i=0; i<POINTS; ++
i) {
661 double x_ewk = 1.-ewk_syst_min + (ewk_syst_min)*i/POINTS;
662 double x_fz = fz_syst_min + (Fzmc-fz_syst_min)*i/POINTS;
663 double x_fzp = fzp_syst_min + (FzPmc-fzp_syst_min)*i/POINTS;
664 double x_k = k_syst_min + (KMC-k_syst_min)*i/POINTS;
665 double x_i = i_syst_min + (Imc-i_syst_min)*i/POINTS;
667 double y_ewk=
CalcABCD(Imc, Fzmc, FzPmc, KMC, x_ewk, Na, Nb, Nc, Nd, Ea,Eb,Ec,Ed);
668 double y_fz =
CalcABCD(Imc, x_fz, FzPmc, KMC, 1., Na, Nb, Nc, Nd, Ea,Eb,Ec,Ed);
669 double y_fzp=
CalcABCD(Imc, Fzmc, x_fzp, KMC, 1., Na, Nb, Nc, Nd, Ea,Eb,Ec,Ed);
670 double y_k =
CalcABCD(Imc, Fzmc, FzPmc, x_k, 1., Na, Nb, Nc, Nd, Ea,Eb,Ec,Ed);
671 double y_i =
CalcABCD(x_i, Fzmc, FzPmc, KMC, 1., Na, Nb, Nc, Nd, Ea,Eb,Ec,Ed);
673 g_ewk.SetPoint(i,(x_ewk-1.)*100., 100.*fabs(y_ewk-SMC)/SMC);
674 g_fz.SetPoint(i,(x_fz-Fzmc)*100./Fzmc, 100.*fabs(y_fz-SMC)/SMC);
675 g_fzp.SetPoint(i,(x_fzp-FzPmc)*100./FzPmc, 100.*fabs(y_fzp-SMC)/SMC);
676 g_i.SetPoint(i,(x_i-Imc)*100./Imc, 100.*fabs(y_i-SMC)/SMC);
677 g_k.SetPoint(i,(x_k-KMC)*100./KMC, 100.*fabs(y_k-SMC)/SMC);
681 for (
int i=0; i<=POINTS; ++
i) {
682 double x_ewk = 1.+ewk_syst_max*i/POINTS;
683 double x_fz = Fzmc+fz_syst_max*i/POINTS;
684 double x_fzp = FzPmc+fzp_syst_max*i/POINTS;
685 double x_k = KMC+k_syst_max*i/POINTS;
686 double x_i = Imc+i_syst_max*i/POINTS;
688 double y_ewk=
CalcABCD(Imc, Fzmc, FzPmc, KMC, x_ewk, Na, Nb, Nc, Nd, Ea,Eb,Ec,Ed);
689 double y_fz =
CalcABCD(Imc, x_fz, FzPmc, KMC, 1., Na, Nb, Nc, Nd, Ea,Eb,Ec,Ed);
690 double y_fzp=
CalcABCD(Imc, Fzmc, x_fzp, KMC, 1., Na, Nb, Nc, Nd, Ea,Eb,Ec,Ed);
691 double y_k =
CalcABCD(Imc, Fzmc, FzPmc, x_k, 1., Na, Nb, Nc, Nd, Ea,Eb,Ec,Ed);
692 double y_i =
CalcABCD(x_i, Fzmc, FzPmc, KMC, 1., Na, Nb, Nc, Nd, Ea,Eb,Ec,Ed);
694 g_ewk.SetPoint(i+POINTS,(x_ewk-1.)*100., 100.*fabs(y_ewk-SMC)/SMC);
695 g_fz.SetPoint(i+POINTS,(x_fz-Fzmc)*100./Fzmc, 100.*fabs(y_fz-SMC)/SMC);
696 g_fzp.SetPoint(i+POINTS,(x_fzp-FzPmc)*100./FzPmc, 100.*fabs(y_fzp-SMC)/SMC);
697 g_i.SetPoint(i+POINTS,(x_i-Imc)*100./Imc, 100.*fabs(y_i-SMC)/SMC);
698 g_k.SetPoint(i+POINTS,(x_k-KMC)*100./KMC, 100.*fabs(y_k-SMC)/SMC);
700 TString yaxis(
"(S-S_{mc})/S_{mc} (%)");
702 g_ewk.SetLineWidth(2);
703 g_ewk.GetXaxis()->SetTitle(
"EWK Variation (%)");
704 g_ewk.GetYaxis()->SetTitle(yaxis);
706 c.Print(
"ewk_syst_variation.C");
708 g_fz.SetLineWidth(2);
709 g_fz.GetXaxis()->SetTitle(
"F_{z} Variation (%)");
710 g_fz.GetYaxis()->SetTitle(yaxis);
712 c.Print(
"fz_syst_variation.C");
714 g_fzp.SetLineWidth(2);
715 g_fzp.GetXaxis()->SetTitle(
"F_{z}' Variation (%)");
716 g_fzp.GetYaxis()->SetTitle(yaxis);
718 c.Print(
"fzp_syst_variation.C");
721 g_i.GetXaxis()->SetTitle(
"I Variation (%)");
722 g_i.GetYaxis()->SetTitle(yaxis);
724 c.Print(
"i_syst_variation.C");
727 g_k.GetXaxis()->SetTitle(
"K Variation (%)");
728 g_k.GetYaxis()->SetTitle(yaxis);
730 c.Print(
"k_syst_variation.C");
736 double err_ewk =
std::max(fabs(SMC-S_EWK_PLUS),fabs(SMC-S_EWK_MINUS));
737 double err_fz = fabs(SMC-S_FZ);
738 double err_fzp = fabs(SMC-S_FZP);
739 double err_i = fabs(SMC-S_I);
740 double err_k = fabs(SMC-S_K);
742 double DS_syst =
sqrt(err_ewk*err_ewk + err_fz*err_fz + err_fzp*err_fzp+
743 err_i*err_i + err_k*err_k);
745 cout <<
"********************************************************" << endl;
746 cout <<
"Signal Prediction: " << S <<
"+-" << DS <<
"(stat) +-"
747 << DS_syst <<
"(syst)" << endl;
748 cout <<
"stat error: " << 100.*DS/S <<
"%" << endl;
749 cout <<
"syt error: " << 100.*DS_syst/S<<
"%" << endl;
750 cout <<
"********************************************************" << endl;
751 cout <<
"Parameters used in calculation: " << endl;
752 cout <<
"I= " <<
I <<
"+-" << dI << endl;
753 cout <<
"Fz= " << Fz <<
"+-" << dFz << endl;
754 cout <<
"FzP=" << FzP <<
"+-" << dFzP << endl;
755 cout <<
"EWK error assumed to be: " << ewkerror << endl;
757 cout <<
"ABCD Regions population:" << endl;
758 cout <<
"A: N=" << Na <<
", sig=" << a_sig <<
", qcd=" << a_qcd
759 <<
", ewk=" << a_ewk << endl;
760 cout <<
"B: N=" << Nb <<
", sig=" << b_sig <<
", qcd=" << b_qcd
761 <<
", ewk=" << b_ewk << endl;
762 cout <<
"C: N=" << Nc <<
", sig=" << c_sig <<
", qcd=" << c_qcd
763 <<
", ewk=" << c_ewk << endl;
764 cout <<
"D: N=" << Nd <<
", sig=" << d_sig <<
", qcd=" << d_qcd
765 <<
", ewk=" << d_ewk << endl;
767 cout <<
"Parameters from MC: " << endl;
768 cout <<
"I= " << Imc <<
"+-" << dImc << endl;
769 cout <<
"Fz= " << Fzmc <<
"+-" << dFzmc << endl;
770 cout <<
"FzP=" << FzPmc <<
"+-" << dFzPmc << endl;
772 cout <<
"Real value of K=" << KMC << endl;
773 cout <<
"Real value of Signal=" << SMC << endl;
775 cout <<
"Difference Measured - MC value (% wrt MC value except K=1): "
777 cout <<
"Fz : " << dfz <<
", (" << dfz*100./Fzmc <<
"%)" << endl;
778 cout <<
"FzP: " << dfzp <<
", (" << dfzp*100./FzPmc <<
"%)" << endl;
779 cout <<
"I : " << di <<
", (" << di*100./Imc <<
"%)" << endl;
780 cout <<
"K : " << fk <<
", (" << fk*100./1. <<
"%)" << endl;
783 cout <<
"DETAILS OF THE CALCULATION" << endl;
784 cout <<
"^^^^^^^^^^^^^^^^^^^^^^^^^^" << endl;
785 cout <<
"Statistical Error Summary: " << endl;
786 cout <<
"due to Fz = "<< SpFz*dFz<<
", ("<<SpFz*dFz*100./S <<
"%)"<< endl;
787 cout <<
"due to FzP= "<< SpFzP*dFzP
788 <<
", ("<<SpFzP*dFzP*100./S <<
"%)"<< endl;
789 cout <<
"due to I = "<< SpI*dI
790 <<
", ("<<SpI*dI*100./S <<
"%)"<< endl;
791 cout <<
"due to Na = "<< SpNa*
sqrt(Na)
792 <<
", ("<< SpNa*
sqrt(Na)*100./S <<
"%)"<< endl;
793 cout <<
"due to Nb = "<< SpNb*
sqrt(Nb)
794 <<
", ("<< SpNb*
sqrt(Nb)*100./S <<
"%)"<< endl;
795 cout <<
"due to Nc = "<< SpNc*
sqrt(Nc)
796 <<
", ("<< SpNc*
sqrt(Nc)*100./S <<
"%)"<< endl;
797 cout <<
"due to Nd = "<< SpNd*
sqrt(Nd)
798 <<
", ("<< SpNd*
sqrt(Nd)*100./S <<
"%)"<< endl;
799 cout <<
"Total Statistical Error: "
800 << DS <<
", (" << DS*100./S <<
"%)"<< endl;
801 cout <<
"Stat Error percentages are wrt S prediction, not S mc" << endl;
803 cout <<
"Systematic Error Summary:" << endl;
804 cout <<
"due to k = " << err_k <<
" ( " << err_k*100./S <<
"%)" << endl;
805 cout <<
"due to Fz = " << err_fz <<
" ( " << err_fz*100./S <<
"%)" << endl;
806 cout <<
"due to FzP = " << err_fzp <<
" ( " << err_fzp*100./S <<
"%)" << endl;
807 cout <<
"due to I = " << err_i <<
" ( " << err_i*100./S <<
"%)" << endl;
808 cout <<
"due to EWK = " << err_ewk <<
" ( " << err_ewk*100./S <<
"%)" << endl;
810 cout <<
"Syst Error percentages are wrt S prediction, not S mc" << endl;
814 if (mcOnly < 0 && mcOnly >-0.75) {
816 cout <<
"=======================================================" << endl;
817 cout <<
"Calculating ABCD Result and Stat Error Assuming MC ONLY" << endl;
818 cout <<
"=======================================================" << endl;
819 cout <<
"All input parameters that the user have inserted will be "
820 <<
"ignored and recalculated from MC" << endl;
821 cout <<
"This option will not give you systematics estimation" << endl;
823 I = (a_sig + b_sig) / (a_sig + b_sig + c_sig + d_sig);
824 dI =
sqrt(
I*(1-
I)/(a_sig + b_sig + c_sig + d_sig));
826 double e =a_sig/(a_sig + b_sig);
827 double de =
sqrt(e*(1-e)/(a_sig + b_sig));
828 double alpha = de/(2.*Fz-
e);
829 dFz = alpha/(1-
alpha);
831 double ep =d_sig/(c_sig + d_sig);
832 double dep =
sqrt(ep*(1-ep)/(c_sig + d_sig));
833 double alphap = dep/(2.*FzP-ep);
834 dFzP = alphap/(1-alphap);
836 double KMC = (d_qcd/c_qcd)/(a_qcd/b_qcd);
839 double A = (1.0-
I)*(FzP-Fz);
840 double B =
I*(FzP+1.0)*(FzP*(c_sig+c_qcd)-(d_sig+d_qcd)) +
841 (1+Fz)*(1-
I)*((a_sig+a_qcd)-dFzP*(b_sig+b_qcd));
842 double C =
I*(1.+Fz)*(1.+FzP)*((d_sig+d_qcd)*(b_sig+b_qcd) -
843 (a_sig+a_qcd)*(c_sig+c_qcd));
846 double S =
Trionym(A,
B,C, a_sig+b_sig);
850 double ApI=0, ApFz=0, ApFzP=0, ApNa=0, ApNb=0, ApNc=0, ApNd=0;
851 double BpI=0, BpFz=0, BpFzP=0, BpNa=0, BpNb=0, BpNc=0, BpNd=0;
852 double CpI=0, CpFz=0, CpFzP=0, CpNa=0, CpNb=0, CpNc=0, CpNd=0;
853 double SpI=0, SpFz=0, SpFzP=0, SpNa=0, SpNb=0, SpNc=0, SpNd=0;
855 double Na = a_sig+a_qcd+a_ewk, Nb = b_sig+b_qcd+b_ewk;
856 double Nc=c_sig+c_qcd+c_ewk, Nd = d_sig+d_qcd+d_ewk;
857 double Ea = a_ewk, Eb = b_ewk, Ec=c_ewk, Ed = d_ewk;
868 BpI = (FzP+1.0)*(Fz*(Nc-Ec)-(Nd-Ed))-(1.0+Fz)*((Na-Ea)-FzP*(Nb-Eb));
869 BpFz =
I*(FzP+1.0)*(Nc-Ec)+(1.0-
I)*((Na-Ea)-FzP*(Nb-Eb));
870 BpFzP =
I*(Fz*(Nc-Ec)-(Nd-Ed))-(1.0-
I)*(1.0+Fz)*(Nb-Eb);
871 BpNa = (1.0-
I)*(1.0+Fz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Nd-Ed))-(1.0+Fz)*((Na-Ea)-FzP*(Nb-Eb));
894 BpFz =
I*(FzP+1.0)*(Nc-Ec)+(1.0-
I)*((Na-Ea)-FzP*(Nb-Eb));
895 BpFzP =
I*(Fz*(Nc-Ec)-(Nd-Ed))-(1.0-
I)*(1.0+Fz)*(Nb-Eb);
896 BpNa = (1.0-
I)*(1.0+Fz);
897 BpNb = -(1.0-
I)*(1.0+Fz)*FzP;
898 BpNc =
I*(FzP+1.0)*Fz;
901 CpI = (1.0+Fz)*(1.0+FzP)*((Nd-Ed)*(Nb-Eb)-(Na-Ea)*(Nc-Ec));
902 CpFz =
I*(1.0+FzP)*((Nd-Ed)*(Nb-Eb)-(Na-Ea)*(Nc-Ec));
903 CpFzP =
I*(1.0+Fz)*((Nd-Ed)*(Nb-Eb)-(Na-Ea)*(Nc-Ec));
904 CpNa = -
I*(1.0+Fz)*(1.0+FzP)*(Nc-Ec);
905 CpNb =
I*(1.0+Fz)*(1.0+FzP)*(Nd-Ed);
906 CpNc = -
I*(1.0+Fz)*(1.0+FzP)*(Na-Ea);
907 CpNd =
I*(1.0+Fz)*(1.0+FzP)*(Nb-Eb);
909 SpI = -CpI/
B+C*BpI/(
B*
B);
910 SpFz = -CpFz/
B+C*BpFz/(
B*
B);
911 SpFzP = -CpFzP/
B+C*BpFzP/(
B*
B);
912 SpNa = -CpNa/
B+C*BpNa/(
B*
B);
913 SpNb = -CpNb/
B+C*BpNb/(
B*
B);
914 SpNc = -CpNc/
B+C*BpNc/(
B*
B);
915 SpNd = -CpNd/
B+C*BpNd/(
B*
B);
918 DS =
sqrt( SpI*dI*SpI*dI + SpFz*dFz*SpFz*dFz + SpFzP*dFzP*SpFzP*dFzP +
919 SpNa*SpNa*Na + SpNb*SpNb*Nb + SpNc*SpNc*Nc + SpNd*SpNd*Nd );
921 cout <<
"********************************************************" << endl;
922 cout <<
"Signal Prediction: " << S <<
"+-" << DS <<
"(stat)" << endl;
923 cout <<
"********************************************************" << endl;
924 cout <<
"Parameters used in calculation: " << endl;
925 cout <<
"I= " <<
I <<
"+-" << dI << endl;
926 cout <<
"Fz= " << Fz <<
"+-" << dFz << endl;
927 cout <<
"FzP=" << FzP <<
"+-" << dFzP << endl;
929 cout <<
"ABCD Regions population:" << endl;
930 cout <<
"A: N=" << Na <<
", sig=" << a_sig <<
", qcd=" << a_qcd
931 <<
", ewk=" << a_ewk << endl;
932 cout <<
"B: N=" << Nb <<
", sig=" << b_sig <<
", qcd=" << b_qcd
933 <<
", ewk=" << b_ewk << endl;
934 cout <<
"C: N=" << Nc <<
", sig=" << c_sig <<
", qcd=" << c_qcd
935 <<
", ewk=" << c_ewk << endl;
936 cout <<
"D: N=" << Nd <<
", sig=" << d_sig <<
", qcd=" << d_qcd
937 <<
", ewk=" << d_ewk << endl;
938 cout <<
"K value from MC: " << KMC << endl;
940 cout <<
"Statistical Error Summary: " << endl;
941 cout <<
"due to Fz = "<< SpFz*dFz<<
", ("<<SpFz*dFz*100./S <<
"%)"<< endl;
942 cout <<
"due to FzP= "<< SpFzP*dFzP
943 <<
", ("<<SpFzP*dFzP*100./S <<
"%)"<< endl;
944 cout <<
"due to I = "<< SpI*dI
945 <<
", ("<<SpI*dI*100./S <<
"%)"<< endl;
946 cout <<
"due to Na = "<< SpNa*
sqrt(Na)
947 <<
", ("<< SpNa*
sqrt(Na)*100./S <<
"%)"<< endl;
948 cout <<
"due to Nb = "<< SpNb*
sqrt(Nb)
949 <<
", ("<< SpNb*
sqrt(Nb)*100./S <<
"%)"<< endl;
950 cout <<
"due to Nc = "<< SpNc*
sqrt(Nc)
951 <<
", ("<< SpNc*
sqrt(Nc)*100./S <<
"%)"<< endl;
952 cout <<
"due to Nd = "<< SpNd*
sqrt(Nd)
953 <<
", ("<< SpNd*
sqrt(Nd)*100./S <<
"%)"<< endl;
954 cout <<
"Total Statistical Error: "
955 << DS <<
", (" << DS*100./S <<
"%)"<< endl;
956 cout <<
"Stat Error percentages are wrt S prediction, not S mc" << endl;
double Trionym(double a, double b, double c, double sum)
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
const double EWK_SYST_MIN
const double EWK_SYST_MAX
const std::complex< double > I
double CalcABCD(double I, double Fz, double FzP, double K, double ewk, double Na_, double Nb_, double Nc_, double Nd_, double Ea_, double Eb_, double Ec_, double Ed_)
const double FZP_SYST_MIN
const double FZP_SYST_MAX
double S(const TLorentzVector &, const TLorentzVector &)