12 #include <TEfficiency.h>
13 #include <TGraphAsymmErrors.h>
15 #include "sPhenixStyle.C"
48 bool pt_resolution_fit =
true;
51 TFile *fin =
new TFile(
"root_files/purity_out.root");
57 cout <<
"Failed to find input file" << endl;
61 TCanvas *c1 =
new TCanvas(
"c1",
"c1",5,5,900,500);
67 fin->GetObject(
"hpt_dca2d",hpt_dca2d);
69 gPad->SetLeftMargin(0.12);
70 hpt_dca2d->GetYaxis()->SetTitleOffset(1.5);
71 hpt_dca2d->SetMarkerStyle(20);
72 hpt_dca2d->SetMarkerSize(0.3);
77 fin->GetObject(
"hpt_dcaZ",hpt_dcaZ);
79 gPad->SetLeftMargin(0.12);
80 hpt_dcaZ->SetMarkerStyle(20);
81 hpt_dcaZ->SetMarkerSize(0.3);
82 hpt_dcaZ->GetYaxis()->SetTitleOffset(1.5);
85 TH2D *hpt_compare = 0;
86 fin->GetObject(
"hpt_compare",hpt_compare);
88 gPad->SetLeftMargin(0.12);
89 hpt_compare->GetYaxis()->SetTitleOffset(1.5);
90 hpt_compare->SetMarkerStyle(20);
91 hpt_compare->SetMarkerSize(0.3);
98 TCanvas *
c2 =
new TCanvas(
"c2",
"c2",20,20,800,600);
100 int NPT = (int) (ptmax/ptstep);
104 for(
int i = 0;
i<NPT;
i++)
108 double ptlo = (
double)
i * ptstep + 0.0;
109 double pthi = (
double)
i * ptstep + ptstep;
111 int binlo = hpt_dca2d->GetXaxis()->FindBin(ptlo);
112 int binhi = hpt_dca2d->GetXaxis()->FindBin(pthi);
114 std::cout <<
"ptlo " << ptlo <<
" binlo " << binlo <<
" pthi " << pthi <<
" binhi " << binhi << std::endl;
116 TH1D *
h =
new TH1D(
"h",
"dca2d resolution",2000, -0.1, 0.1);
117 hpt_dca2d->ProjectionY(
"h",binlo,binhi);
118 h->GetXaxis()->SetTitle(
"p_{T} (GeV/c)");
119 h->GetXaxis()->SetTitle(
"#Delta dca2d (cm)");
120 h->GetXaxis()->SetTitleOffset(1.0);
124 double mean = h->GetMean();
125 double sigma = h->GetRMS();
126 double yield = h->Integral();
128 pT[
i] = (ptlo + pthi) / 2.0;
130 double low = -0.01, high=0.01;
131 if(n_maps_layer == 0)
142 TF1 *
f =
new TF1(
"f",
"gaus",low, high);
143 f->SetParameter(1, yield/100.0);
144 f->SetParameter(2, 0.0);
145 f->SetParameter(3,0.002);
150 dca2d[
i] = f->GetParameter(2);
151 cout <<
" pT " << pT[
i] <<
" dca2d " << dca2d[
i] <<
" counts " << h->Integral() <<
" hist mean " << h->GetMean() <<
" hist RMS " << h->GetRMS() << endl;
157 TCanvas *c3 =
new TCanvas(
"c3",
"c3",100,100,800,600);
158 TGraph *grdca2d =
new TGraph(NPT,pT,dca2d);
159 grdca2d->SetMarkerStyle(20);
160 grdca2d->SetMarkerSize(1.2);
161 grdca2d->SetMarkerColor(kRed);
162 grdca2d->SetName(
"dca2d_resolution");
163 grdca2d->SetTitle(
"dca2d resolution");
165 TH1D *hdummy =
new TH1D(
"hdummy",
"#Delta dca2d vs p_{T}",100,0.0,hptmax);
166 hdummy->SetMinimum(0);
167 if(n_maps_layer == 0)
168 hdummy->SetMaximum(0.015);
170 hdummy->SetMaximum(0.0051);
171 hdummy->GetXaxis()->SetTitle(
"p_{T} (GeV/c)");
172 hdummy->GetYaxis()->SetTitle(
"DCA(r#phi) resolution (cm)");
173 hdummy->GetYaxis()->SetTitleOffset(1.5);
174 gPad->SetLeftMargin(0.15);
181 sprintf(dcalab,
"sPHENIX HIJING b=0-12 fm, 100 kHz pileup");
183 sprintf(dcalab,
"sPHENIX 100 pions");
184 TLegend *ldca =
new TLegend(0.3, 0.75, 1.05, 0.90,dcalab,
"NDC");
185 ldca->SetBorderSize(0);
186 ldca->SetFillColor(0);
187 ldca->SetFillStyle(0);
190 sprintf(lstr1,
"INTT+TPC",n_maps_layer,n_intt_layer,n_tpc_layer);
191 ldca->AddEntry(grdca2d, lstr1,
"p");
200 TCanvas *c2a =
new TCanvas(
"c2a",
"c2a",20,20,800,600);
203 for(
int i = 0;
i<NPT;
i++)
207 double ptlo = (
double)
i * ptstep + 0.0;
208 double pthi = (
double)
i * ptstep + ptstep;
210 int binlo = hpt_dcaZ->GetXaxis()->FindBin(ptlo);
211 int binhi = hpt_dcaZ->GetXaxis()->FindBin(pthi);
213 std::cout <<
"ptlo " << ptlo <<
" binlo " << binlo <<
" pthi " << pthi <<
" binhi " << binhi << std::endl;
214 TH1D *
h =
new TH1D(
"h",
"DCA (Z) resolution (cm)",2000, -0.1, 0.1);
215 hpt_dcaZ->ProjectionY(
"h",binlo,binhi);
216 h->GetXaxis()->SetTitle(
"p_{T} (GeV/c)");
217 h->GetYaxis()->SetTitle(
"DCA(Z) resolution (cm)");
218 h->GetYaxis()->SetTitleOffset(1.0);
222 double mean = h->GetMean();
223 double sigma = h->GetRMS();
224 double yield = h->Integral();
226 pT[
i] = (ptlo + pthi) / 2.0;
228 double low = -0.01, high=0.01;
229 if(n_maps_layer == 0)
241 TF1 *
f =
new TF1(
"f",
"gaus",low, high);
242 f->SetParameter(1, yield/100.0);
243 f->SetParameter(2, 0.0);
244 f->SetParameter(3,0.002);
247 dcaZ[
i] = f->GetParameter(2);
248 cout <<
" pT " << pT[
i] <<
" dcaZ " << dcaZ[
i] <<
" counts " << h->Integral() <<
" hist mean " << h->GetMean() <<
" hist RMS " << h->GetRMS() << endl;
254 TCanvas *c3a =
new TCanvas(
"c3a",
"c3a",100,100,800,600);
255 TGraph *grdcaZ =
new TGraph(NPT,pT,dcaZ);
256 grdcaZ->SetMarkerStyle(20);
257 grdcaZ->SetMarkerSize(1.2);
258 grdcaZ->SetMarkerColor(kRed);
259 grdcaZ->SetName(
"dcaZ_resolution");
260 grdcaZ->SetTitle(
"dcaZ resolution");
262 TH1D *hdummya =
new TH1D(
"hdummya",
"#Delta dcaZ vs p_{T}",100,0.0,hptmax);
263 hdummya->SetMinimum(0);
265 if(n_maps_layer == 0)
266 hdummya->SetMaximum(0.051);
268 hdummya->SetMaximum(0.0051);
269 hdummya->GetXaxis()->SetTitle(
"p_{T} (GeV/c)");
270 hdummya->GetYaxis()->SetTitle(
"DCA(Z) resolution (cm)");
271 hdummya->GetYaxis()->SetTitleOffset(1.5);
272 gPad->SetLeftMargin(0.15);
276 TLegend *ldcaZ =
new TLegend(0.3, 0.75, 1.05, 0.90, dcalab,
"NDC");
277 ldcaZ->SetBorderSize(0);
278 ldcaZ->SetFillColor(0);
279 ldcaZ->SetFillStyle(0);
282 sprintf(lstr1,
"INTT+TPC",n_maps_layer,n_intt_layer,n_tpc_layer);
283 ldcaZ->AddEntry(grdcaZ, lstr1,
"p");
291 TCanvas *c4 =
new TCanvas(
"c4",
"c4",60,60,800,600);
296 for(
int i = 1;
i<NPT;
i++)
301 double ptlo = (
double)
i * ptstep + 0.0;
302 double pthi = (
double)
i * ptstep + ptstep;
304 int binlo = hpt_compare->GetXaxis()->FindBin(ptlo);
305 int binhi = hpt_compare->GetXaxis()->FindBin(pthi);
307 TH1D *hpt =
new TH1D(
"hpt",
"pT resolution ",200, 0, 2.0);
308 hpt_compare->ProjectionY(
"hpt",binlo,binhi);
309 hpt->GetXaxis()->SetTitle(
"#Delta p_{T}/p_{T}");
310 hpt->GetXaxis()->SetTitleOffset(1.0);
311 if(
i>30) hpt->Rebin(4);
314 std::cout <<
"ptlo " << ptlo <<
" binlo " << binlo <<
" pthi " << pthi <<
" binhi " << binhi <<
" integral " << hpt->Integral() << std::endl;
316 TF1 *
f =
new TF1(
"f",
"gaus",0.8,1.2);
319 pT[
i] = (ptlo + pthi) / 2.0;
321 dpT[
i] = f->GetParameter(2);
322 cout <<
" pT " << pT[
i] <<
" dpT " << dpT[
i] <<
" integral " << hpt->Integral() << std::endl;
328 TCanvas *c5 =
new TCanvas(
"c5",
"c5",100,100,800,800);
329 c5->SetLeftMargin(0.14);
330 TGraph *grdpt =
new TGraph(NPT,pT,dpT);
331 grdpt->SetMarkerStyle(20);
332 grdpt->SetMarkerSize(1.1);
333 grdpt->SetName(
"pt_resolution");
334 grdpt->SetTitle(
"pT resolution");
336 TH1D *hdummy2 =
new TH1D(
"hdummy2",
"#Delta p_{T} vs p_{T}",100,0.0,hptmax);
337 hdummy2->SetMinimum(0);
340 hdummy2->SetMaximum(0.3);
341 hdummy2->GetXaxis()->SetTitle(
"p_{T}");
342 hdummy2->GetYaxis()->SetTitle(
"#Delta p_{T}/p_{T}");
343 hdummy2->GetYaxis()->SetTitleOffset(1.5);
347 TLegend *ldpt=
new TLegend(0.25, 0.75, 0.95, 0.90, dcalab,
"NDC");
348 ldpt->SetBorderSize(0);
349 ldpt->SetFillColor(0);
350 ldpt->SetFillStyle(0);
353 sprintf(lstr1,
"INTT+TPC",n_maps_layer,n_intt_layer,n_tpc_layer);
354 ldpt->AddEntry(grdpt, lstr1,
"p");
360 TF1 *fpt =
new TF1(
"fpt",
"[0] + [1]*x", 2.0, hptmax);
361 fpt->SetParameter(0,0.005);
363 fpt->SetParameter(1,0.0015);
364 if(pt_resolution_fit)
369 sprintf(lab,
"#frac{#Deltap_{T}}{p_{T}} = %.4f + %.6f #times p_{T}", fpt->GetParameter(0), fpt->GetParameter(1));
370 TLatex *mres =
new TLatex(0.45,0.25,lab);
373 if(pt_resolution_fit)
377 double pT_sigmas = 6.0;
378 double const_term = fpt->GetParameter(0);
379 double linear_term = fpt->GetParameter(1);
382 fin->GetObject(
"hpt_truth",hpt_truth);
385 cout <<
"Failed to get hpt_truth, quit!" << endl;
391 TH1D *hpt_matched =
new TH1D(
"hpt_matched",
"hpt_matched", 500, 0.0, hptmax);
394 for(
int i = 0;
i<NPT;
i++)
398 double ptlo = (
double)
i * ptstep + 0.0;
399 double pthi = (
double)
i * ptstep + ptstep;
400 double ptval = (ptlo+pthi)/2.0;
402 int binlo = hpt_dca2d->GetXaxis()->FindBin(ptlo);
403 int binhi = hpt_dca2d->GetXaxis()->FindBin(pthi);
405 TH1D *hpt1 =
new TH1D(
"hpt1",
"pT resolution ",2000, 0.0, 2.0);
406 hpt_compare->ProjectionY(
"hpt1",binlo,binhi);
408 double ptres = sqrt(pow(const_term,2) + pow(linear_term * ptval,2));
409 double ptreslo = 1.0 - ptres * pT_sigmas;
410 double ptreshi = 1.0 + ptres * pT_sigmas;
412 int momlo = hpt1->GetXaxis()->FindBin(ptreslo);
413 int momhi = hpt1->GetXaxis()->FindBin(ptreshi);
415 hpt_matched->Fill(ptval, hpt1->Integral(momlo, momhi));
417 int tlo = hpt_truth->FindBin(ptlo);
418 int thi = hpt_truth->FindBin(pthi);
419 double truth_yield = hpt_truth->Integral(tlo, thi);;
420 eff_pt[
i] = hpt1->Integral(momlo, momhi) / truth_yield;
422 cout <<
" pT " << ptval <<
" ptres " << ptres <<
" ptreslo " << ptreslo <<
" ptreshi " << ptreshi <<
" momlo " << momlo <<
" momhi " << momhi << endl;
423 cout <<
" truth_yield " << truth_yield <<
" yield " << hpt1->Integral(momlo,momhi) <<
" eff_pt " << eff_pt[
i] << endl;
446 cout <<
" ptval " << ptval
447 <<
" ptreslo " << ptreslo
448 <<
" ptreshi " << ptreshi
449 <<
" total " << hpt1->Integral()
450 <<
" momlo " << momlo
451 <<
" momhi " << momhi
452 <<
" cut " << hpt1->Integral(momlo,momhi)
455 <<
" truth " << truth_yield
456 <<
" eff_pt " << eff_pt[
i]
463 cout <<
" create canvas c7" << endl;
464 TCanvas *c7 =
new TCanvas(
"c7",
"c7",60,60,800,800);
466 TH1F *hd =
new TH1F(
"hd",
"hd",100, 0.0, hptmax);
469 hd->GetXaxis()->SetTitle(
"p_{T} (GeV/c)");
470 hd->GetYaxis()->SetTitle(
"Single track efficiency");
471 hd->GetYaxis()->SetTitleOffset(1.0);
474 TGraph *gr_eff =
new TGraph(NPT,pT,eff_pt);
475 gr_eff->SetName(
"single_track_efficiency");
476 gr_eff->SetMarkerStyle(20);
477 gr_eff->SetMarkerSize(1);
478 gr_eff->SetMarkerColor(kRed);
482 TLegend *leff =
new TLegend(0.40, 0.35, 0.99, 0.50, dcalab,
"NDC");
483 leff->SetBorderSize(0);
484 leff->SetFillColor(0);
485 leff->SetFillStyle(0);
488 sprintf(lstr,
"INTT+TPC",n_maps_layer,n_intt_layer,n_tpc_layer);
489 leff->AddEntry(gr_eff, lstr,
"p");
574 TCanvas *cpq =
new TCanvas(
"cpq",
"cpq",40,40,1200,600);
576 fin->GetObject(
"hquality",hquality);
581 TCanvas *c8 =
new TCanvas(
"c8",
"c8",40,40,1200,600);
583 fin->GetObject(
"hnhits",hnhits);
584 hnhits->GetXaxis()->SetTitle(
"hits per track");
586 cout <<
"hnhits integral = " << hnhits->Integral() << endl;
592 TCanvas *cdcadist =
new TCanvas(
"cdcadist",
"cdcadist",5,20,1200,800);
593 cdcadist->Divide(3,1);
595 double dcaptbinlo[3] = {0.5, 1.0, 2.0};
596 double dcaptbinhi[3] = {1.0, 2.0, 50.0};
597 for(
int i = 0;
i<3;
i++)
599 double ptlo = dcaptbinlo[
i];
600 double pthi = dcaptbinhi[
i];
602 int binlo = hpt_dca2d->GetXaxis()->FindBin(ptlo);
603 int binhi = hpt_dca2d->GetXaxis()->FindBin(pthi);
605 std::cout <<
"DCA distr: ptlo " << ptlo <<
" binlo " << binlo <<
" pthi " << pthi <<
" binhi " << binhi << std::endl;
607 TH1D *
h =
new TH1D(
"h",
"dca2d resolution",2000, -0.1, 0.1);
608 hpt_dca2d->ProjectionY(
"h",binlo,binhi);
609 h->GetXaxis()->SetTitle(
"DCA (r#phi) (cm)");
610 h->GetXaxis()->SetTitleOffset(1.0);
618 h->SetMarkerSize(0.8);
619 h->GetXaxis()->SetNdivisions(505);
622 double mean = h->GetMean();
623 double sigma = h->GetRMS();
624 double yield = h->Integral();
626 double low = -0.01, high=0.01;
627 if(n_maps_layer == 0)
639 TF1 *
f =
new TF1(
"f",
"gaus",low, high);
640 f->SetParameter(1, yield/100.0);
641 f->SetParameter(2, 0.0);
642 f->SetParameter(3,0.002);
643 f->SetLineColor(kRed);
647 sprintf(fitr,
"p_{T} = %.1f-%.1f GeV/c",ptlo,pthi);
648 TLatex *
l1 =
new TLatex(0.2,0.971,fitr);
650 l1->SetTextSize(0.07);
653 sprintf(fitr,
"#sigma = %.1f #mum", f->GetParameter(2)*10000);
654 TLatex *l1a =
new TLatex(0.2,0.892,fitr);
656 l1a->SetTextSize(0.07);
659 cout <<
" pT range " << ptlo <<
" " << pthi <<
" counts " << h->Integral() <<
" hist mean " << h->GetMean() <<
" hist RMS " << h->GetRMS() << endl;
665 TCanvas *cdcazdist =
new TCanvas(
"cdcazdist",
"cdcazdist",5,20,1200,800);
666 cdcazdist->Divide(3,1);
668 for(
int i = 0;
i<3;
i++)
670 double ptlo = dcaptbinlo[
i];
671 double pthi = dcaptbinhi[
i];
673 int binlo = hpt_dcaZ->GetXaxis()->FindBin(ptlo);
674 int binhi = hpt_dcaZ->GetXaxis()->FindBin(pthi);
676 std::cout <<
"DCA Z distr: ptlo " << ptlo <<
" binlo " << binlo <<
" pthi " << pthi <<
" binhi " << binhi << std::endl;
678 TH1D *
h =
new TH1D(
"h",
"dcaZ resolution",2000, -0.1, 0.1);
679 hpt_dcaZ->ProjectionY(
"h",binlo,binhi);
680 h->GetXaxis()->SetTitle(
"DCA (Z) (cm)");
681 h->GetXaxis()->SetTitleOffset(1.0);
687 h->SetMarkerSize(0.8);
688 h->GetXaxis()->SetNdivisions(505);
692 double mean = h->GetMean();
693 double sigma = h->GetRMS();
694 double yield = h->Integral();
696 double low = -0.01, high=0.01;
697 if(n_maps_layer == 0)
709 TF1 *
f =
new TF1(
"f",
"gaus",low, high);
710 f->SetParameter(1, yield/100.0);
711 f->SetParameter(2, 0.0);
712 f->SetParameter(3,0.002);
713 f->SetLineColor(kRed);
717 sprintf(fitr,
"p_{T} = %.1f-%.1f GeV/c",ptlo,pthi);
718 TLatex *
l1 =
new TLatex(0.2,0.971,fitr);
720 l1->SetTextSize(0.07);
723 sprintf(fitr,
"#sigma = %.1f #mum", f->GetParameter(2)*10000);
724 TLatex *l1a =
new TLatex(0.2,0.892,fitr);
726 l1a->SetTextSize(0.07);
729 cout <<
" pT range " << ptlo <<
" " << pthi <<
" counts " << h->Integral() <<
" hist mean " << h->GetMean() <<
" hist RMS " << h->GetRMS() << endl;
809 TCanvas *ceta =
new TCanvas(
"ceta",
"ceta",10,10,600,600);
812 fin->GetObject(
"hgeta",hgeta);
815 cout <<
"Did not get hgeta" << endl;
819 fin->GetObject(
"hreta",hreta);
821 hreta->GetXaxis()->SetTitle(
"#eta");
822 hreta->GetYaxis()->SetNdivisions(505);
823 hreta->SetLineColor(kRed);
824 hreta->SetMinimum(0.0);
830 TLegend *leta =
new TLegend(0.3, 0.35, 1.0, 0.60, dcalab,
"NDC");
831 leta->SetBorderSize(0);
832 leta->SetFillColor(0);
833 leta->SetFillStyle(0);
834 leta->AddEntry(hgeta,
"Truth",
"l");
835 leta->AddEntry(hreta,
"Reconstructed",
"l");
839 TCanvas *cfake =
new TCanvas(
"cfake",
"cfake",4,4,800,600);
840 cfake->SetLeftMargin(0.15);
842 fin->GetObject(
"hpt_nfake",hpt_nfake);
845 cout <<
"Did not get hpt_nfake" << endl;
850 double ynoise[10][200];
851 double ynoise_ref[200];
853 double dptfake = 0.2;
854 double fake_ptmax = 20.0;
855 int nptfake = (int) (fake_ptmax/dptfake);
857 for(
int ipt=0;ipt<nptfake;ipt++)
859 double ptlo = dptfake * ipt;
860 double pthi = dptfake*ipt + dptfake;
861 ptfake[ipt] = (ptlo+pthi) / 2.0;
862 int binlo = hpt_nfake->GetXaxis()->FindBin(ptlo);
863 int binhi = hpt_nfake->GetXaxis()->FindBin(pthi);
865 TH1D *hnoise =
new TH1D(
"hnoise",
"",73,-5,68);
866 hpt_nfake->ProjectionY(
"hnoise",binlo,binhi);
867 double ynoise_ref = hnoise->Integral();
868 for(
int j=0;
j<n_noise;
j++)
870 int bin = hnoise->FindBin(
j);
871 ynoise[
j][ipt]= hnoise->GetBinContent(bin);
872 ynoise[
j][ipt] /= ynoise_ref;
878 TH1D *hfdummy =
new TH1D(
"hfdummy",
"",100,0.0,fake_ptmax);
879 hfdummy->SetMaximum(1.05);
880 hfdummy->SetMinimum(0.001);
881 hfdummy->GetXaxis()->SetTitle(
"p_{T} (GeV/c)");
882 hfdummy->GetYaxis()->SetTitle(
"Fraction of tracks");
886 TLegend *lfake =
new TLegend(0.35,0.55,0.87,0.89,
"",
"NDC");
887 lfake->SetBorderSize(1);
889 int fake_col[5] = {kBlack,kRed,kBlue,kMagenta,kViolet};
890 for(
int j=0;
j<n_noise;
j++)
892 hnoise[
j] =
new TGraph(nptfake,ptfake,ynoise[
j]);
893 hnoise[
j]->SetMarkerStyle(20);
894 hnoise[
j]->SetMarkerSize(1.0);
895 hnoise[
j]->SetMarkerColor(fake_col[j]);
897 hnoise[
j]->Draw(
"p");
899 hnoise[
j]->Draw(
"p same");
901 sprintf(lab,
"%i mismatched hits",j);
902 lfake->AddEntry(hnoise[j],lab,
"p");
906 TH2D *hcorr_nfake_nmaps = 0;
907 fin->GetObject(
"hcorr_nfake_nmaps",hcorr_nfake_nmaps);
908 if(hcorr_nfake_nmaps)
910 TCanvas *cmm =
new TCanvas(
"cmm",
"cmm",4,4,800,600);
911 cmm->SetLeftMargin(0.15);
915 TLegend *lmm =
new TLegend(0.35,0.62,0.9,0.90,
"",
"NDC");
916 lmm->SetBorderSize(1);
917 for(
int imaps =0;imaps<n_maps_layer+1;imaps++)
919 double nmapslo = -0.5 + 1.0 * imaps;
920 double nmapshi = nmapslo + 1.0;
922 int binlo = hcorr_nfake_nmaps->GetYaxis()->FindBin(nmapslo);
923 int binhi = hcorr_nfake_nmaps->GetYaxis()->FindBin(nmapshi);
925 TH1D *
h =
new TH1D(
"h",
"h",40,-1,4);
926 hcorr_nfake_nmaps->ProjectionX(
"h",binlo,binhi);
928 h->SetMarkerStyle(20);
929 h->SetMarkerSize(1.5);
930 h->SetMarkerColor(fake_col[imaps]);
932 h->SetMaximum(5.0e6);
934 sprintf(lab,
"%i missed maps layers",imaps);
935 lmm->AddEntry(h,lab,
"p");
939 h->GetXaxis()->SetTitle(
"Mismatched hits");
940 h->GetYaxis()->SetTitle(
"Tracks");
945 h->DrawCopy(
"same p");
951 TCanvas *cvtx =
new TCanvas(
"cvtx",
"cvtx",4,4,800,600);
953 fin->GetObject(
"hzevt",hzevt);
956 cout <<
"Did not get hzevt" << endl;
961 TCanvas *cvtx_res =
new TCanvas(
"cvtx_res",
"cvtx_res",4,4,1200,800);
962 cvtx_res->Divide(2,2);
965 fin->GetObject(
"hzvtx_res",hzvtx_res);
968 cout <<
"Did not get hzvtx_res" << endl;
975 hzvtx_res->SetNdivisions(505);
978 TF1 *fvtxres =
new TF1(
"fvtxres",
"gaus");
983 fin->GetObject(
"hxvtx_res",hxvtx_res);
986 cout <<
"Did not get hxvtx_res" << endl;
993 hxvtx_res->SetNdivisions(505);
996 TF1 *fvtxres =
new TF1(
"fvtxres",
"gaus");
1000 TH1D *hyvtx_res = 0;
1001 fin->GetObject(
"hyvtx_res",hyvtx_res);
1004 cout <<
"Did not get hyvtx_res" << endl;
1011 hyvtx_res->SetNdivisions(505);
1014 TF1 *fvtxres =
new TF1(
"fvtxres",
"gaus");
1018 TH1D *hdcavtx_res = 0;
1019 fin->GetObject(
"hdcavtx_res",hdcavtx_res);
1022 cout <<
"Did not get hdcavtx_res" << endl;
1029 hdcavtx_res->SetNdivisions(505);
1030 hdcavtx_res->Draw();
1032 TF1 *fvtxres =
new TF1(
"fvtxres",
"gaus");
1037 TCanvas *g4ntr =
new TCanvas(
"g4ntr",
"g4ntr",5,10,1200,800);
1040 TH2D *hg4ntrack = 0;
1041 fin->GetObject(
"hg4ntrack",hg4ntrack);
1044 hg4ntrack->GetXaxis()->SetTitle(
" Tracks/event from truth");
1045 hg4ntrack->GetYaxis()->SetTitle(
" Tracks/event reconstructed");
1049 cout <<
"Did not get hgn4track" << endl;
1052 TH1D *hg4ntr =
new TH1D(
"hg4ntr",
"hg4ntr",200, 0.0, 2000.0);
1053 hg4ntrack->ProjectionX(
"hg4ntr");
1054 hg4ntr->GetXaxis()->SetTitle(
" Tracks/event from truth");
1055 hg4ntr->GetYaxis()->SetTitle(
" Yield");
1062 double ytot = hg4ntr->Integral();
1063 for(
int i=1;
i<20;
i++)
1066 int binhi = hg4ntr->FindBin(nhits[
i]);
1067 double y = hg4ntr->Integral(1,binhi);
1069 cout <<
"nhits = " << nhits[
i] <<
" binhi = " << binhi <<
" y = " << y <<
" ytot = " << ytot <<
" cent = " << cent[
i] << endl;
1071 TGraph *
gy =
new TGraph(20,nhits,cent);
1072 gy->GetXaxis()->SetTitle(
" Tracks/event from truth");
1073 gy->GetYaxis()->SetTitle(
" integral fraction of events");
1076 TF1 *fgy =
new TF1(
"fgy",
"[0]*x+[1]*x*x+[2]*x*x*x",0,2300);
1081 TFile *
fout =
new TFile(
"root_files/look_purity_out.root",
"recreate");