9 #include "TDatabasePDG.h"
10 #include "TParticlePDG.h"
15 #include "TParticle.h"
16 #include "TClonesArray.h"
22 #include "TEventList.h"
37 std::map<TString, TString>
cuts;
38 std::map<TString, TString>
modes;
40 TString ntpname[10] = {
"nphi",
"nlam",
"nee",
"njpsi1",
"njpsi2",
"netac",
"nd0",
"ndpm",
"nds",
"nlamc"};
41 TString plotname[10] = {
"phim",
"lamm",
"eem",
"jpsi1m",
"jpsi2m",
"etacm",
"d0m",
"dm" ,
"dsm",
"lamcm"};
46 gStyle->SetPadTopMargin(0.13);
47 gStyle->SetPadBottomMargin(0.18);
48 gStyle->SetPadLeftMargin(0.2);
49 gStyle->SetPadRightMargin(0.016);
51 gStyle->SetLabelSize(0.076,
"X");
52 gStyle->SetLabelSize(0.07,
"Y");
54 gStyle->SetStatY(0.87);
55 gStyle->SetStatX(0.986);
56 gStyle->SetStatW(0.4);
57 gStyle->SetStatH(0.12);
58 gStyle->SetOptStat(
"e");
60 gStyle->SetTitleH(0.1);
61 gStyle->SetTitleX(0.08);
62 gStyle->SetTitleOffset(1.1,
"x");
63 gStyle->SetTitleXSize(0.076);
68 h->SetFillStyle(3001);
78 modes[
"nphi"] =
"000";
79 modes[
"nlam"] =
"400";
81 modes[
"njpsi1"] =
"200";
82 modes[
"njpsi2"] =
"201";
83 modes[
"netac"] =
"221";
85 modes[
"ndpm"] =
"120";
87 modes[
"nlamc"] =
"420";
96 cuts[
"nphi"] =
"pmax<0.6&&phipcm>0.55&&phipcm<0.7";
97 cuts[
"nlam"] =
"abs(lampcm-0.44)<0.04&&fw1>0.1&&fw2>0.1";
100 else if (energy==
"38")
102 cuts[
"nphi"] =
"thr>0.87&&phipcm>1.35&&phip>0.8";
103 cuts[
"nlam"] =
"fw2>0.66&&fw5>0.21&&lampcm>1.4&&fw1<0.75";
105 cuts[
"njpsi1"] =
"1";
106 cuts[
"njpsi2"] =
"1";
107 cuts[
"netac"] =
"sumpc>3.3&&ptmax>0.83&&etace>5.5";
108 cuts[
"nd0"] =
"abs(d0pcm-0.275)<0.045&&d0e>3.1&&ptmax>0.68&&pmax>0.85";
109 cuts[
"ndpm"] =
"abs(dpcm-0.23)<0.03&&de>3.3&&ptmax>0.58&&pmax<0.8";
112 else if (energy==
"45")
114 cuts[
"nphi"] =
"thr>0.93&&phipcm>1.8";
115 cuts[
"nlam"] =
"lampcm>1.7&&fw2>0.75&&lamtht>0.09&&fw4>0.5&&pmax>1.4";
117 cuts[
"njpsi1"] =
"sumpc>3";
118 cuts[
"njpsi2"] =
"sumpc>3";
119 cuts[
"netac"] =
"sumptc>3&&ptmax>0.7&&sumpc>4.1&&ptmax>0.85";
120 cuts[
"nd0"] =
"abs(d0pcm-1.28)<0.09&&ptmax>1&&sumpt>3&&d0tht<0.31";
121 cuts[
"ndpm"] =
"abs(dpcm-1.25)<0.05&&ptmax>0.87&&abs(dp-5)<2&&dpt>1.1";
122 cuts[
"nds"] =
"abs(dspcm-1.1)<0.07&&ptmax>0.85&&dspt>0.8&&dstht<0.27";
124 else if (energy==
"55")
126 cuts[
"nphi"] =
"thr>0.955&&phipcm>2";
127 cuts[
"nlam"] =
"fw2>0.87&&sumptc>0.9&&lampcm>2.2&&fw1>-0.1";
129 cuts[
"njpsi1"] =
"sumptc>2.1&&pmax>1.5";
130 cuts[
"njpsi2"] =
"sumptc>2.1&&pmax>1.5";
131 cuts[
"netac"] =
"ptmax>1&&sumptc>2.6&&sumpc>4.9";
132 cuts[
"nd0"] =
"d0pcm>1.8&&sumpt>2.7&&ptmax>0.8&&d0pt>1.3&&d0tht<0.41";
133 cuts[
"ndpm"] =
"dpcm>1.9&&dp>4&&ptmax>0.7&&dtht>0.09";
134 cuts[
"nds"] =
"dspcm>1.8&&ptmax>0.8&&dsp>3&&dspt>1&&dspcm<2.1";
135 cuts[
"nlamc"] =
"lamcpcm>1.43&&lamcpcm<1.65&&fw1>0&&lamcpt>1.27";
143 cuts[
"njpsi1"] =
"1";
144 cuts[
"njpsi2"] =
"1";
157 cuts[
"nphi"] =
"pmax<0.6&&phipcm>0.55&&phipcm<0.7";
158 cuts[
"nlam"] =
"abs(lampcm-0.44)<0.04&&fw1>0.1&&fw2>0.1";
161 else if (energy==
"38")
163 cuts[
"nphi"] =
"thr>0.87&&phipcm>1.35&&phip>0.8";
164 cuts[
"nlam"] =
"fw2>0.66&&fw5>0.21&&lampcm>1.4&&fw1<0.75";
166 cuts[
"njpsi1"] =
"1";
167 cuts[
"njpsi2"] =
"1";
168 cuts[
"netac"] =
"etace>4.95&&sumpc>2.9&&etacpcm<0.75&&sumptc>1.63";
169 cuts[
"nd0"] =
"abs(d0pcm-0.285)<0.085&&d0e>3.2&&ptmax>0.415";
170 cuts[
"ndpm"] =
"abs(dpcm-0.2425)<0.0625&&dp>2.65&&ptmax>0.3&&de>3.25";
173 else if (energy==
"45")
175 cuts[
"nphi"] =
"thr>0.93&&phipcm>1.8";
176 cuts[
"nlam"] =
"lampcm>1.7&&fw2>0.75&&lamtht>0.09&&fw4>0.5&&pmax>1.4";
178 cuts[
"njpsi1"] =
"sumpc>3";
179 cuts[
"njpsi2"] =
"sumpc>3";
180 cuts[
"netac"] =
"sumptc>2.06&&ptmax>0.64&&sumpc>3.45&&pmax>0.8&&etace>5";
181 cuts[
"nd0"] =
"abs(d0pcm-1.27)<0.13&&ptmax>0.64&&d0e>2.7";
182 cuts[
"ndpm"] =
"abs(dpcm-1.255)<0.105&&de>2.6&&ptmax>0.48&&dtht<0.33";
183 cuts[
"nds"] =
"abs(dspcm-1.095)<0.096&&dse>2.9&&ptmax>0.39&&dstht<0.28";
185 else if (energy==
"55")
187 cuts[
"nphi"] =
"thr>0.955&&phipcm>2";
188 cuts[
"nlam"] =
"fw2>0.87&&sumptc>0.9&&lampcm>2.2&&fw1>-0.1";
190 cuts[
"njpsi1"] =
"sumptc>2.1&&pmax>1.5";
191 cuts[
"njpsi2"] =
"sumptc>2.1&&pmax>1.5";
192 cuts[
"netac"] =
"ptmax>0.75&&pmax>1.1&&sumptc>2.8&&sumpc>4";
193 cuts[
"nd0"] =
"d0pcm>1.84&&sumpt>2.1&&d0e>2.1&&ptmax>0.8&&d0tht<0.45";
194 cuts[
"ndpm"] =
"abs(dpcm-2.05)<0.2&&dp>2&&dpt>0.5&&ptmax>0.5";
195 cuts[
"nds"] =
"abs(dspcm-1.96)<0.24&&ptmax>0.55&&dse>3";
196 cuts[
"nlamc"] =
"abs(lamcpcm-1.54)<0.16&&fw1>-0.05&&lamcp>3.3&&sumptc>1.3";
204 cuts[
"njpsi1"] =
"1";
205 cuts[
"njpsi2"] =
"1";
219 cuts[
"nphi"] =
"pmax<0.56&&phipcm>0.55&&phipcm<0.68";
220 cuts[
"nlam"] =
"lampcm<0.5&&fw1>0.16&&lampcm>0.39";
228 else if (energy==
"38")
230 cuts[
"nphi"] =
"thr>0.9&&phipcm>1.46";
231 cuts[
"nlam"] =
"thr>0.93&&thr<0.99&&fw5>0.21&&lampcm>1.38&&fw4>0.35";
233 cuts[
"njpsi1"] =
"1";
234 cuts[
"njpsi2"] =
"1";
235 cuts[
"netac"] =
"sumptc>1.68&&ptmax>0.54&&sumpc>2.9";
236 cuts[
"nd0"] =
"d0pcm<0.36&&pmax>0.8&&ptmax>0.42";
237 cuts[
"ndpm"] =
"dpcm<0.32&&dpcm>0.17&&ptmax>0.4&&dp>2.7";
254 else if (energy==
"45")
256 cuts[
"nphi"] =
"thr>0.94&&phipcm>1.85";
257 cuts[
"nlam"] =
"thr>0.95&&fw4>0.53&&pmax>1.1&&sumptc>0.7";
259 cuts[
"njpsi1"] =
"sumpc>3.5";
260 cuts[
"njpsi2"] =
"sumpc>3.5";
261 cuts[
"netac"] =
"sumptc>2.1&&ptmax>0.65&&sumpc>3.4";
262 cuts[
"nd0"] =
"ptmax>0.64&&d0pcm>0.95&&pmax>1&&sumpt>2&&d0pcm<1.4";
263 cuts[
"ndpm"] =
"dpcm>1.1&&dpcm<1.4&&ptmax>0.58";
264 cuts[
"nds"] =
"dspcm>0.9&&dspcm<1.35&&ptmax>0.55";
282 else if (energy==
"55")
284 cuts[
"nphi"] =
"thr>0.96&&phipcm>2.3";
285 cuts[
"nlam"] =
"thr>0.97&&pmax>1.6&&sumptc>1.4";
287 cuts[
"njpsi1"] =
"sumpc>4";
288 cuts[
"njpsi2"] =
"sumpc>4";
289 cuts[
"netac"] =
"ptmax>0.8&&sumptc>2.8&&pmax>1.15";
290 cuts[
"nd0"] =
"d0pcm>1.75&&ptmax>0.8&&sumpt>2.4";
291 cuts[
"ndpm"] =
"dpcm>1.8&&ptmax>0.68&&dpcm<2.3&&dpt>0.5";
292 cuts[
"nds"] =
"dspcm>1.75&&dspcm<2.2&&ptmax>0.6";
293 cuts[
"nlamc"] =
"lamcpcm>1.3&&lamcpcm<1.7&&ptmax>0.5&&fw1>-0.02";
314 cuts[
"njpsi1"] =
"1";
315 cuts[
"njpsi2"] =
"1";
329 TEventList *el=(TEventList*)gDirectory->Get(
"el");
331 t->SetBranchStatus(
"*",0);
332 t->SetBranchStatus(
"evt",1);
333 t->SetBranchAddress(
"evt",&ev);
335 std::map<int, int> sigcnt;
336 for (
int j=0;j<el->GetN();++j)
338 t->GetEntry(el->GetEntry(j));
340 if (globcnt)
evcnt[(int)ev]+=1;
342 t->SetBranchStatus(
"*",1);
343 return sigcnt.size();
348 t->Project(all,var,cut);
349 t->Project(sel,var,cut+
" && tag");
350 t->Project(sig,var,cut+
" && mct");
364 double sqrts=energy.Atof();
375 TFile *
f=
new TFile(fname);
384 TCanvas *
c2=
new TCanvas(
"c2",
"c2",20,20,1800,800);
385 c2->Divide(5,2,0.005,0.01);
390 TH1F *h_jpsi1=
new TH1F(
"h_jpsi1",
"J/#psi #rightarrow e^{+}e^{-}",
nbins,
low,
high);
391 TH1F *h_jpsi1sel=
new TH1F(
"h_jpsi1sel",
"J/psi",
nbins,
low,
high);
392 TH1F *h_jpsi1sig=
new TH1F(
"h_jpsi1sig",
"J/psi",
nbins,
low,
high);
393 h_jpsi1sig->SetLineColor(2);
397 TH1F *h_jpsi2=
new TH1F(
"h_jpsi2",
"J/#psi #rightarrow #mu^{+}#mu^{-}",
nbins,
low,
high);
398 TH1F *h_jpsi2sel=
new TH1F(
"h_jpsi2sel",
"J/psi",
nbins,
low,
high);
399 TH1F *h_jpsi2sig=
new TH1F(
"h_jpsi2sig",
"J/psi",
nbins,
low,
high);
400 h_jpsi2sig->SetLineColor(2);
404 TH1F *h_etac=
new TH1F(
"h_etac",
"#eta_{c} #rightarrow K_{S} K^{+} #pi^{-}",
nbins,
low,
high);
405 TH1F *h_etacsel=
new TH1F(
"h_etacsel",
"etac",
nbins,
low,
high);
406 TH1F *h_etacsig=
new TH1F(
"h_etacsig",
"etac",
nbins,
low,
high);
407 h_etacsig->SetLineColor(2);
411 TH1F *h_d0=
new TH1F(
"h_d0",
"D^{0} #rightarrow K^{-}#pi^{+}",
nbins,
low,
high);
414 h_d0sig->SetLineColor(2);
418 TH1F *h_dpm=
new TH1F(
"h_dpm",
"D^{+} #rightarrow K^{-}#pi^{+}#pi^{+}",
nbins,
low,
high);
419 TH1F *h_dpmsel=
new TH1F(
"h_dpmsel",
"D#pm",
nbins,
low,
high);
420 TH1F *h_dpmsig=
new TH1F(
"h_dpmsig",
"D#pm",
nbins,
low,
high);
421 h_dpmsig->SetLineColor(2);
425 TH1F *h_ds=
new TH1F(
"h_ds",
"D_{s}^{+} #rightarrow K^{+}K^{-}#pi^{+}",
nbins,
low,
high);
428 h_dssig->SetLineColor(2);
432 TH1F *h_phi=
new TH1F(
"h_phi",
"#phi #rightarrow K^{+}K^{-}",
nbins,low2,
high/2);
433 TH1F *h_phisel=
new TH1F(
"h_phisel",
"Phi",
nbins,low2,
high/2);
434 TH1F *h_phisig=
new TH1F(
"h_phisig",
"Phi",
nbins,low2,
high/2);
435 h_phisig->SetLineColor(2);
439 TH1F *h_lamc=
new TH1F(
"h_lamc",
"#Lambda_{c} #rightarrow pK^{-}#pi^{+}",
nbins,
low,
high);
440 TH1F *h_lamcsel=
new TH1F(
"h_lamcsel",
"Lam_c",
nbins,
low,
high);
441 TH1F *h_lamcsig=
new TH1F(
"h_lamcsig",
"Lam_c",
nbins,
low,
high);
442 h_lamcsig->SetLineColor(2);
446 TH1F *h_lam=
new TH1F(
"h_lam",
"#Lambda #rightarrow p#pi^{-}",
nbins,low2,
high/2);
447 TH1F *h_lamsel=
new TH1F(
"h_lamsel",
"Lam",
nbins,low2,
high/2);
448 TH1F *h_lamsig=
new TH1F(
"h_lamsig",
"Lam",
nbins,low2,
high/2);
449 h_lamsig->SetLineColor(2);
453 TH1F *h_ee=
new TH1F(
"h_ee",
"p#bar{p} #rightarrow e^{+}e^{-}",
nbins,
low,
high*1.2);
454 TH1F *h_eesel=
new TH1F(
"h_eesel",
"ee",
nbins,
low,
high*1.2);
455 TH1F *h_eesig=
new TH1F(
"h_eesig",
"ee",
nbins,
low,
high*1.2);
456 h_eesig->SetLineColor(2);
459 h_jpsi1->SetXTitle(
"m(e^{+}e^{-}) [GeV/c^{2}]");
460 h_jpsi2->SetXTitle(
"m(#mu^{+}#mu^{-}) [GeV/c^{2}]");
461 h_etac->SetXTitle(
"m(K_{S} K^{+}#pi^{-}) [GeV/c^{2}]");
463 h_d0->SetXTitle(
"m(K^{-}#pi^{+}) [GeV/c^{2}]");
465 h_dpm->SetXTitle(
"m(K^{-}#pi^{+}#pi^{+}) [GeV/c^{2}]");
467 h_ds->SetXTitle(
"m(K^{+}K^{-}#pi^{+}) [GeV/c^{2}]");
469 h_phi->SetXTitle(
"m(K^{+}K^{-}) [GeV/c^{2}]");
470 h_lamc->SetXTitle(
"m(pK^{-}#pi^{+}) [GeV/c^{2}]");
471 h_lam->SetXTitle(
"m(p#pi^{-}) [GeV/c^{2}]");
472 h_ee->SetXTitle(
"m(e^{+}e^{-}) [GeV/c^{2}]");
475 fillHistos(t[0],
"phim",
cuts[
"nphi"],
"h_phi",
"h_phisel",
"h_phisig");
476 fillHistos(t[1],
"lamm",
cuts[
"nlam"],
"h_lam",
"h_lamsel",
"h_lamsig");
477 fillHistos(t[2],
"eem",
cuts[
"nee"],
"h_ee",
"h_eesel",
"h_eesig");
481 fillHistos(t[3],
"jpsi1m",
cuts[
"njpsi1"],
"h_jpsi1",
"h_jpsi1sel",
"h_jpsi1sig");
482 fillHistos(t[4],
"jpsi2m",
cuts[
"njpsi2"],
"h_jpsi2",
"h_jpsi2sel",
"h_jpsi2sig");
483 fillHistos(t[5],
"etacm",
cuts[
"netac"],
"h_etac",
"h_etacsel",
"h_etacsig");
484 fillHistos(t[6],
"d0m",
cuts[
"nd0"],
"h_d0",
"h_d0sel",
"h_d0sig");
485 fillHistos(t[7],
"dm",
cuts[
"ndpm"],
"h_dpm",
"h_dpmsel",
"h_dpmsig");
489 fillHistos(t[8],
"dsm",
cuts[
"nds"],
"h_ds",
"h_dssel",
"h_dssig");
492 fillHistos(t[9],
"lamcm",
cuts[
"nlamc"],
"h_lamc",
"h_lamcsel",
"h_lamcsig");
496 double channelcount[10]={0,0,0,0,0,0,0,0,0,0};
497 double eff[10]={0,0,0,0,0,0,0,0,0,0};
503 cout <<i<<
" "<<channelcount[
i]<<endl;
510 cout <<i<<
" "<<channelcount[
i]<<endl;
516 cout <<i<<
" "<<channelcount[
i]<<endl;
522 cout <<i<<
" "<<channelcount[
i]<<endl;
525 double evCnt =
evcnt.size();
526 for (i=0;i<10;++
i) eff[i]=channelcount[i]/nev*100.;
528 cout <<
"all:"<<evCnt<<endl;
532 latex.SetTextSize(0.08);
535 double pos=3.3, pos2=1.85;
542 c2->cd(2); h_phi->Draw(); h_phisel->Draw(
"same"); h_phisig->Draw(
"same");
543 sprintf(tmp,
"#epsilon = %4.1f%%",eff[0]);
544 latex.DrawLatex(pos2,h_phi->GetMaximum()*hfac+
offset,tmp);
546 c2->cd(1); h_ee->Draw(); h_eesel->Draw(
"same"); h_eesig->Draw(
"same");
547 sprintf(tmp,
"#epsilon = %4.1f%%",eff[2]);
548 latex.DrawLatex(pos*1.2,h_ee->GetMaximum()*hfac+
offset,tmp);
550 c2->cd(9); h_lam->Draw(); h_lamsel->Draw(
"same"); h_lamsig->Draw(
"same");
551 sprintf(tmp,
"#epsilon = %4.1f%%",eff[1]);
552 latex.DrawLatex(pos2,h_lam->GetMaximum()*hfac+
offset,tmp);
554 c2->cd(3); h_etac->Draw(); h_etacsel->Draw(
"same"); h_etacsig->Draw(
"same");
555 sprintf(tmp,
"#epsilon = %4.1f%%",eff[5]);
556 latex.DrawLatex(pos,h_etac->GetMaximum()*hfac+
offset,tmp);
558 c2->cd(4); h_jpsi1->Draw(); h_jpsi1sel->Draw(
"same"); h_jpsi1sig->Draw(
"same");
559 sprintf(tmp,
"#epsilon = %4.1f%%",eff[3]);
560 latex.DrawLatex(pos,h_jpsi1->GetMaximum()*hfac+
offset,tmp);
562 c2->cd(5); h_jpsi2->Draw(); h_jpsi2sel->Draw(
"same"); h_jpsi2sig->Draw(
"same");
563 sprintf(tmp,
"#epsilon = %4.1f%%",eff[4]);
564 latex.DrawLatex(pos,h_jpsi2->GetMaximum()*hfac+
offset,tmp);
566 c2->cd(7); h_dpm->Draw(); h_dpmsel->Draw(
"same"); h_dpmsig->Draw(
"same");
567 sprintf(tmp,
"#epsilon = %4.1f%%",eff[7]);
568 latex.DrawLatex(pos,h_dpm->GetMaximum()*hfac+
offset,tmp);
570 c2->cd(6); h_d0->Draw(); h_d0sel->Draw(
"same"); h_d0sig->Draw(
"same");
571 sprintf(tmp,
"#epsilon = %4.1f%%",eff[6]);
572 latex.DrawLatex(pos,h_d0->GetMaximum()*hfac+
offset,tmp);
574 c2->cd(8); h_ds->Draw(); h_dssel->Draw(
"same"); h_dssig->Draw(
"same");
575 sprintf(tmp,
"#epsilon = %4.1f%%",eff[8]);
576 latex.DrawLatex(pos,h_ds->GetMaximum()*hfac+
offset,tmp);
578 c2->cd(10); h_lamc->Draw(); h_lamcsel->Draw(
"same"); h_lamcsig->Draw(
"same");
579 sprintf(tmp,
"#epsilon = %4.1f%%",eff[9]);
580 latex.DrawLatex(pos,h_lamc->GetMaximum()*hfac+
offset,tmp);
584 double posy = h_jpsi2->GetMaximum()*1.12;
585 if (posy==0) posy=1.12;
586 sprintf(tmp,
"(#epsilon_{t} = %4.1f%%)",
double(evCnt)/
double(nev)*100.);
587 latex.SetTextColor(kMagenta+2);
588 latex.DrawLatex(3.0,posy,tmp);
593 TString plot(fname(fname.Last(
'/')+5,5));
594 if (!tagonly) plot+=
"_opt_supr1000";
596 c2->SaveAs(
"figtoy_v2/toy_"+plot+
".gif");
597 c2->SaveAs(
"figtoy_v2/toy_"+plot+
".pdf");
602 TString result=TString::Format(
"%s & %3.1f & %6.2f & %6.2f & %6.2f & %6.2f & %6.2f & %6.2f & %6.2f & %6.2f & %6.2f & %6.2f & %6.2f \\\\\n",
603 mode.Data(), sqrts/10., eff[2], eff[0], eff[5], eff[3], eff[4], eff[6], eff[7], eff[8], eff[1], eff[9], evCnt/nev*100);
void init_cuts_1000(TString energy)
void init_cuts_old(TString energy)
int toy_core_ntp(TString fname, int nev=50, bool tagonly=false)
int cnt_events(TChain *t, TString cut, bool globcnt=false)
void fillHistos(TChain *t, TString var, TString cut, TString all, TString sel, TString sig)
void init_cuts_95(TString energy)