1 #include "../CommonTools.h"
2 #include <sPhenixStyle.C>
10 void GetNormalization(TFile *qa_file_new, TFile *qa_file_ref,
const TString &
prefix,
const TString &tag)
14 TH1 *h_norm = (TH1 *) qa_file_new->GetObjectChecked(prefix + TString(
"Normalization"),
"TH1");
16 Nevent_new = h_norm->GetBinContent(h_norm->GetXaxis()->FindBin(tag));
21 TH1 *h_norm = (TH1 *) qa_file_ref->GetObjectChecked(prefix + TString(
"Normalization"),
"TH1");
23 Nevent_ref = h_norm->GetBinContent(h_norm->GetXaxis()->FindBin(tag));
27 void Draw(TFile *qa_file_new, TFile *qa_file_ref,
const TString &prefix,
const TString &tag)
29 auto h_new =
static_cast<TH1 *
>(qa_file_new->GetObjectChecked(prefix + tag,
"TH1"));
32 h_new->Scale(1. / Nevent_new);
37 h_ref =
static_cast<TH1 *
>(qa_file_ref->GetObjectChecked(prefix + tag,
"TH1"));
40 h_ref->Scale(1.0 / Nevent_ref);
49 inline double square(
const double&
x ) {
return x*
x; }
52 Double_t
CBcalc(Double_t *xx, Double_t *par)
56 const double x = xx[0];
60 const double alpha = par[0];
61 const double n = par[1];
62 const double x_mean = par[2];
63 const double sigma = par[3];
64 const double N = par[4];
67 const double t = (x-x_mean)/sigma;
73 return N * exp( -
square(t)/2 );
77 const double A = pow( (n/TMath::Abs(alpha)),n) * exp(-
square(alpha)/2.0);
78 const double B = n/TMath::Abs(alpha) - TMath::Abs(alpha);
79 return N * A * pow(B - t, -n);
85 Double_t CBcalc2(Double_t *xx, Double_t *par)
88 const double x = xx[0];
96 const double N = par[0];
97 const double x_mean = par[1];
98 const double sigma = par[2];
99 const double t = (x-x_mean)/sigma;
102 const double alpha_left = std::abs(par[3]);
103 const double n_left = par[4];
106 const double alpha_right = std::abs(par[5]);
107 const double n_right = par[6];
110 if( t < -alpha_left )
112 const double A = pow( (n_left/TMath::Abs(alpha_left)),n_left) * exp(-
square(alpha_left)/2.0);
113 const double B = n_left/std::abs(alpha_left) - std::abs(alpha_left);
114 return N * A * pow(B - t, -n_left);
115 }
else if( t > alpha_right ) {
116 const double A = pow( (n_right/TMath::Abs(alpha_right)),n_right) * exp(-
square(alpha_right)/2.0);
117 const double B = n_right/std::abs(alpha_right) - std::abs(alpha_right);
118 return N * A * pow(B + t, -n_right);
120 return N * exp( -
square(t)/2);
130 TFile *qa_file_new = TFile::Open(newfile.c_str());
131 TFile *qa_file_ref = TFile::Open(reffile.c_str());
133 TFile *outfilef =
new TFile(outfile.c_str(),
"recreate");
137 TString prefix = TString(
"h_") + hist_name_prefix + TString(
"_");
139 TCanvas *rawResCan =
new TCanvas(TString(
"QA_Draw_pTResolution") + TString(
"_") + hist_name_prefix,
140 TString(
"QA_Draw_pTResolution") + TString(
"_") + hist_name_prefix,
142 rawResCan->Divide(2,2);
144 TH2F *h_QAG4SimulationTracking_pTRecoGenRatio_pTGen_new =
145 (TH2F *)qa_file_new->GetObjectChecked(prefix +
"pTRecoGenRatio_pTGen",
147 assert(h_QAG4SimulationTracking_pTRecoGenRatio_pTGen_new);
149 h_QAG4SimulationTracking_pTRecoGenRatio_pTGen_new->SetDirectory(
nullptr);
151 TGraphErrors *newScale =
FitResolution(h_QAG4SimulationTracking_pTRecoGenRatio_pTGen_new,
false, 1);
152 TGraphErrors *newRes =
FitResolution(h_QAG4SimulationTracking_pTRecoGenRatio_pTGen_new,
false, 2);
153 newScale->SetMarkerStyle(20);
154 newScale->SetMarkerColor(kBlack);
155 newScale->SetMarkerSize(1.0);
156 newRes->SetMarkerStyle(20);
157 newRes->SetMarkerColor(kBlack);
158 newRes->SetMarkerSize(1.0);
161 newScale->GetXaxis()->SetTitle(
"Truth p_{T} [GeV]");
162 newScale->GetYaxis()->SetTitle(
"#LTp_{T}^{reco}/p_{T}^{true}#GT");
163 newScale->GetYaxis()->SetRangeUser(0.9,1.1);
164 newScale->Draw(
"ap");
167 newRes->GetXaxis()->SetTitle(
"Truth p_{T} [GeV]");
168 newRes->GetYaxis()->SetTitle(
"#sigma(p_{T}^{reco}/p_{T}^{true})");
169 newRes->GetYaxis()->SetRangeUser(0,0.08);
173 gPad->SetRightMargin(0.2);
176 h_QAG4SimulationTracking_pTRecoGenRatio_pTGen_new->SetTitle(
"New pT Spectrum");
177 h_QAG4SimulationTracking_pTRecoGenRatio_pTGen_new->Draw(
"colz");
180 newl.SetTextSize(0.05);
182 newl.SetTextColor(kBlack);
183 newl.DrawLatex(0.45,0.96,
"New");
186 TH2F *h_QAG4SimulationTracking_pTRecoGenRatio_pTGen_ref =
187 (TH2F *)qa_file_ref->GetObjectChecked(prefix +
"pTRecoGenRatio_pTGen",
189 assert(h_QAG4SimulationTracking_pTRecoGenRatio_pTGen_ref);
190 h_QAG4SimulationTracking_pTRecoGenRatio_pTGen_ref->SetDirectory(
nullptr);
192 TGraphErrors *refScale =
FitResolution(h_QAG4SimulationTracking_pTRecoGenRatio_pTGen_ref,
false, 1);
193 TGraphErrors *refRes =
FitResolution(h_QAG4SimulationTracking_pTRecoGenRatio_pTGen_ref,
false, 2);
194 refScale->SetMarkerStyle(24);
195 refScale->SetMarkerColor(kRed);
196 refScale->SetMarkerSize(1.0);
197 refRes->SetMarkerStyle(24);
198 refRes->SetMarkerColor(kRed);
199 refRes->SetMarkerSize(1.0);
201 TLegend *ptresleg =
new TLegend(0.4,0.77,0.5,0.9);
202 ptresleg->AddEntry(refScale,
"Reference",
"P");
203 ptresleg->AddEntry(newScale,
"New",
"P");
206 refScale->Draw(
"psame");
207 ptresleg->Draw(
"same");
210 refRes->Draw(
"psame");
211 ptresleg->Draw(
"same");
215 gPad->SetRightMargin(0.2);
218 h_QAG4SimulationTracking_pTRecoGenRatio_pTGen_ref->SetTitle(
"Reference pT Spectrum");
219 h_QAG4SimulationTracking_pTRecoGenRatio_pTGen_ref->Draw(
"colz");
221 refl.SetTextSize(0.05);
223 refl.SetTextColor(kBlack);
224 refl.DrawLatex(0.45,0.96,
"Reference");
240 TString prefix = TString(
"h_") + hist_name_prefix + TString(
"_");
243 double Nevent_new = 1;
244 double Nevent_ref = 1;
246 TCanvas *c1 =
new TCanvas(TString(
"QA_Draw_Tracking_TruthMatchingOverview") +
247 TString(
"_") + hist_name_prefix,
248 TString(
"QA_Draw_Tracking_TruthMatchingOverview") +
249 TString(
"_") + hist_name_prefix,
256 static const int nrebin = 5;
258 p = (TPad *)c1->cd(idx++);
264 (TH1 *)qa_file_new->GetObjectChecked(prefix +
"nReco_pTGen",
"TH1");
266 (TH1 *)qa_file_new->GetObjectChecked(prefix +
"nGen_pTGen",
"TH1");
270 h_norm->SetDirectory(
nullptr);
271 h_pass->SetDirectory(
nullptr);
273 h_norm->Rebin(nrebin);
274 h_pass->Rebin(nrebin);
279 h_ratio->GetYaxis()->SetTitle(
"Reco efficiency");
280 h_ratio->GetYaxis()->SetRangeUser(-0, 1.);
282 TH1 *h_ratio_ref = NULL;
285 (TH1 *)qa_file_ref->GetObjectChecked(prefix +
"nReco_pTGen",
"TH1");
287 (TH1 *)qa_file_ref->GetObjectChecked(prefix +
"nGen_pTGen",
"TH1");
290 h_norm->SetDirectory(
nullptr);
291 h_pass->SetDirectory(
nullptr);
292 h_norm->Rebin(nrebin);
293 h_pass->Rebin(nrebin);
297 h_ratio->SetTitle(TString(hist_name_prefix) +
": Tracking Efficiency");
304 static const int nrebin = 4;
306 p = (TPad *)c1->cd(idx++);
312 (TH1 *)qa_file_new->GetObjectChecked(prefix +
"nReco_etaGen",
"TH1");
314 (TH1 *)qa_file_new->GetObjectChecked(prefix +
"nGen_etaGen",
"TH1");
318 h_norm->SetDirectory(
nullptr);
319 h_pass->SetDirectory(
nullptr);
320 h_norm->Rebin(nrebin);
321 h_pass->Rebin(nrebin);
325 h_ratio->GetXaxis()->SetRangeUser(-1.1, 1.1);
326 h_ratio->GetYaxis()->SetTitle(
"Reco efficiency");
327 h_ratio->GetYaxis()->SetRangeUser(-0, 1.);
329 TH1 *h_ratio_ref = NULL;
332 (TH1 *)qa_file_ref->GetObjectChecked(prefix +
"nReco_etaGen",
"TH1");
334 (TH1 *)qa_file_ref->GetObjectChecked(prefix +
"nGen_etaGen",
"TH1");
337 h_norm->SetDirectory(
nullptr);
338 h_pass->SetDirectory(
nullptr);
339 h_norm->Rebin(nrebin);
340 h_pass->Rebin(nrebin);
344 h_ratio->SetTitle(TString(hist_name_prefix) +
": Tracking Efficiency");
350 p = (TPad *)c1->cd(idx++);
353 TH1 *frame = p->DrawFrame(0, .9, 50, 1.1,
354 "Mean and sigma, p_{T,reco}/p_{T,truth};Truth p_{T} [GeV/c];<p_{T,reco}/p_{T,truth}> #pm #sigma(p_{T,reco}/p_{T,truth})");
356 gPad->SetTopMargin(-1);
357 frame->GetYaxis()->SetTitleOffset(1.7);
363 TH2 *h_QAG4SimulationTracking_pTRecoGenRatio_pTGen =
364 (TH2 *)qa_file_new->GetObjectChecked(prefix +
"pTRecoGenRatio_pTGen",
366 assert(h_QAG4SimulationTracking_pTRecoGenRatio_pTGen);
368 h_QAG4SimulationTracking_pTRecoGenRatio_pTGen->SetDirectory(
nullptr);
369 h_QAG4SimulationTracking_pTRecoGenRatio_pTGen->Rebin2D(16, 1);
370 TGraphErrors *ge_QAG4SimulationTracking_pTRecoGenRatio_pTGen =
371 FitProfile(h_QAG4SimulationTracking_pTRecoGenRatio_pTGen);
372 ge_QAG4SimulationTracking_pTRecoGenRatio_pTGen->Draw(
"pe");
373 ge_QAG4SimulationTracking_pTRecoGenRatio_pTGen->SetTitle(
374 "Mean and sigma, p_{T,reco}/p_{T,truth}");
376 TGraphErrors *h_ratio_ref = NULL;
378 TH2 *h_QAG4SimulationTracking_pTRecoGenRatio_pTGen =
379 (TH2 *)qa_file_ref->GetObjectChecked(prefix +
"pTRecoGenRatio_pTGen",
381 assert(h_QAG4SimulationTracking_pTRecoGenRatio_pTGen);
383 h_QAG4SimulationTracking_pTRecoGenRatio_pTGen->SetDirectory(
nullptr);
384 h_QAG4SimulationTracking_pTRecoGenRatio_pTGen->Rebin2D(16, 1);
386 h_ratio_ref =
FitProfile(h_QAG4SimulationTracking_pTRecoGenRatio_pTGen);
387 ge_QAG4SimulationTracking_pTRecoGenRatio_pTGen->Draw(
"pe");
390 DrawReference(ge_QAG4SimulationTracking_pTRecoGenRatio_pTGen, h_ratio_ref,
407 TString prefix = TString(
"h_") + hist_name_prefix + TString(
"_");
410 double Nevent_new = 1;
411 double Nevent_ref = 1;
414 TH2 *h_new = (TH2 *) qa_file_new->GetObjectChecked(
415 prefix + TString(
"pTRecoGenRatio_pTGen"),
"TH2");
425 h_ref = (TH2 *) qa_file_ref->GetObjectChecked(
426 prefix + TString(
"pTRecoGenRatio_pTGen"),
"TH2");
431 h_ref->Scale(Nevent_new / Nevent_ref);
434 TCanvas *c1 =
new TCanvas(TString(
"QA_Draw_Tracking_pTRatio") + TString(
"_") + hist_name_prefix,
435 TString(
"QA_Draw_Tracking_pTRatio") + TString(
"_") + hist_name_prefix,
441 vector<pair<double, double>> gpt_ranges{
453 Double_t sigma_unc = 0;
455 TLatex *res =
nullptr;
456 for (
auto pt_range : gpt_ranges)
460 p = (TPad *) c1->cd(idx++);
464 const double epsilon = 1
e-6;
465 const int bin_start = h_new->GetXaxis()->FindBin(pt_range.first + epsilon);
466 const int bin_end = h_new->GetXaxis()->FindBin(pt_range.second - epsilon);
468 TH1 *h_proj_new = h_new->ProjectionY(
470 "%s_New_ProjX_%d_%d",
471 h_new->GetName(), bin_start, bin_end),
474 h_proj_new->GetXaxis()->SetRangeUser(.7, 1.3);
475 h_proj_new->SetTitle(TString(hist_name_prefix) + TString::Format(
476 ": %.1f - %.1f GeV/c", pt_range.first, pt_range.second));
477 h_proj_new->GetXaxis()->SetTitle(TString::Format(
478 "Reco p_{T}/Truth p_{T}"));
480 f1 =
new TF1(
"f1",
"gaus", -.85, 1.15);
481 h_proj_new->Fit(f1,
"mq");
482 sigma = f1->GetParameter(2);
483 sigma_unc = f1->GetParError(2);
485 TH1 *h_proj_ref =
nullptr;
490 "%s_Ref_ProjX_%d_%d",
491 h_new->GetName(), bin_start, bin_end),
495 sprintf(resstr,
"#sigma = %.5f #pm %.5f", sigma, sigma_unc);
496 res =
new TLatex(0.325, 0.825, resstr);
498 res->SetTextSize(0.05);
499 res->SetTextAlign(13);
512 TString prefix = TString(
"h_") + hist_name_prefix + TString(
"_");
516 double Nevent_new = 1;
517 double Nevent_ref = 1;
523 TH1 *h_norm = (TH1 *) qa_file_new->GetObjectChecked(
524 prefix + TString(
"Normalization"),
"TH1");
527 Nevent_new = h_norm->GetBinContent(h_norm->GetXaxis()->FindBin(
"Event"));
532 TH1 *h_norm = (TH1 *) qa_file_ref->GetObjectChecked(
533 prefix + TString(
"Normalization"),
"TH1");
536 Nevent_ref = h_norm->GetBinContent(h_norm->GetXaxis()->FindBin(
"Event"));
540 TCanvas *c1 =
new TCanvas(TString(
"QA_Draw_Tracking_RecoTruthMatching") +
541 TString(
"_") + hist_name_prefix,
542 TString(
"QA_Draw_Tracking_RecoTruthMatching") +
543 TString(
"_") + hist_name_prefix,
550 static const int nrebin = 5;
552 p = (TPad *) c1->cd(idx++);
558 (TH1 *) qa_file_new->GetObjectChecked(prefix +
"nGen_pTReco",
"TH1");
560 (TH1 *) qa_file_new->GetObjectChecked(prefix +
"nReco_pTReco",
"TH1");
564 h_norm->SetDirectory(
nullptr);
565 h_pass->SetDirectory(
nullptr);
567 h_norm->Rebin(nrebin);
568 h_pass->Rebin(nrebin);
573 h_ratio->GetYaxis()->SetTitle(
"Tracking Purity");
574 h_ratio->GetYaxis()->SetRangeUser(-0, 1.1);
576 TH1 *h_ratio_ref = NULL;
580 (TH1 *) qa_file_ref->GetObjectChecked(prefix +
"nGen_pTReco",
"TH1");
582 (TH1 *) qa_file_ref->GetObjectChecked(prefix +
"nReco_pTReco",
"TH1");
585 h_norm->SetDirectory(
nullptr);
586 h_pass->SetDirectory(
nullptr);
587 h_norm->Rebin(nrebin);
588 h_pass->Rebin(nrebin);
592 h_ratio->SetTitle(
"Tracking Purity (matched truth-reco pairs)");
598 p = (TPad *) c1->cd(idx++);
601 TH1 *frame = p->DrawFrame(0, .9, 50, 1.1,
602 "Mean and sigma p_{Tmatched}/p_{Treco};Reco p_{T} [GeV/c];<p_{T,matched}/p_{T,reco}> #pm #sigma(p_{T,matched}/p_{T,reco})");
604 gPad->SetTopMargin(-1);
605 frame->GetYaxis()->SetTitleOffset(1.7);
611 TH2 *h_QAG4SimulationTracking_pTRecoTruthMatchedRatio_pTReco =
612 (TH2 *) qa_file_new->GetObjectChecked(
613 prefix +
"pTRecoTruthMatchedRatio_pTReco",
"TH2");
614 assert(h_QAG4SimulationTracking_pTRecoTruthMatchedRatio_pTReco);
616 h_QAG4SimulationTracking_pTRecoTruthMatchedRatio_pTReco->SetDirectory(
nullptr);
617 h_QAG4SimulationTracking_pTRecoTruthMatchedRatio_pTReco->Rebin2D(16, 1);
619 TGraphErrors *ge_QAG4SimulationTracking_pTRecoTruthMatchedRatio_pTReco =
620 FitProfile(h_QAG4SimulationTracking_pTRecoTruthMatchedRatio_pTReco);
621 ge_QAG4SimulationTracking_pTRecoTruthMatchedRatio_pTReco->Draw(
"pe");
622 ge_QAG4SimulationTracking_pTRecoTruthMatchedRatio_pTReco->SetTitle(
623 "Mean and sigma p_{Tmatched}/p_{Treco}");
625 TGraphErrors *h_ratio_ref = NULL;
628 TH2 *h_QAG4SimulationTracking_pTRecoTruthMatchedRatio_pTReco =
629 (TH2 *) qa_file_ref->GetObjectChecked(
630 prefix +
"pTRecoTruthMatchedRatio_pTReco",
"TH2");
631 assert(h_QAG4SimulationTracking_pTRecoTruthMatchedRatio_pTReco);
633 h_QAG4SimulationTracking_pTRecoTruthMatchedRatio_pTReco->SetDirectory(
nullptr);
634 h_QAG4SimulationTracking_pTRecoTruthMatchedRatio_pTReco->Rebin2D(16, 1);
637 FitProfile(h_QAG4SimulationTracking_pTRecoTruthMatchedRatio_pTReco);
638 ge_QAG4SimulationTracking_pTRecoTruthMatchedRatio_pTReco->Draw(
"pe");
641 DrawReference(ge_QAG4SimulationTracking_pTRecoTruthMatchedRatio_pTReco,
653 TString prefix = TString(
"h_") + hist_name_prefix + TString(
"_");
656 double Nevent_new = 1;
657 double Nevent_ref = 1;
663 TH1 *h_norm = (TH1 *) qa_file_new->GetObjectChecked(
664 prefix + TString(
"Normalization"),
"TH1");
667 Nevent_new = h_norm->GetBinContent(h_norm->GetXaxis()->FindBin(
"Event"));
671 TH1 *h_norm = (TH1 *) qa_file_ref->GetObjectChecked(
672 prefix + TString(
"Normalization"),
"TH1");
675 Nevent_ref = h_norm->GetBinContent(h_norm->GetXaxis()->FindBin(
"Event"));
679 vector<TString>
detectors{
"MVTX",
"INTT",
"TPC"};
680 vector<int> eff_ncluster_cuts{2, 2, 40};
681 vector<double> ncluster_spectrum_pt_cuts{2, 2, 2};
682 vector<TH2 *> h_pass_detectors(3,
nullptr);
683 static const int nrebin = 5;
685 h_pass_detectors[0] = (TH2 *) qa_file_new->GetObjectChecked(
686 prefix +
"nMVTX_nReco_pTGen",
"TH1") ;
687 h_pass_detectors[1] = (TH2 *) qa_file_new->GetObjectChecked(
688 prefix +
"nINTT_nReco_pTGen",
"TH1") ;
689 h_pass_detectors[2] = (TH2 *) qa_file_new->GetObjectChecked(
690 prefix +
"nTPC_nReco_pTGen",
"TH1") ;
692 TH1 *h_norm = (TH1 *) qa_file_new->GetObjectChecked(
693 prefix +
"nGen_pTGen",
"TH1") ;
695 h_norm->SetDirectory(
nullptr);
696 h_norm->Rebin(nrebin);
698 vector<TH2 *> h_pass_detectors_ref(3,
nullptr);
699 TH1 *h_norm_ref =
nullptr;
702 h_pass_detectors_ref[0] = (TH2 *) qa_file_ref->GetObjectChecked(
703 prefix +
"nMVTX_nReco_pTGen",
"TH1") ;
704 h_pass_detectors_ref[1] = (TH2 *) qa_file_ref->GetObjectChecked(
705 prefix +
"nINTT_nReco_pTGen",
"TH1") ;
706 h_pass_detectors_ref[2] = (TH2 *) qa_file_ref->GetObjectChecked(
707 prefix +
"nTPC_nReco_pTGen",
"TH1") ;
709 h_norm_ref = (TH1 *) qa_file_ref->GetObjectChecked(
710 prefix +
"nGen_pTGen",
"TH1") ;
711 h_norm_ref->SetDirectory(
nullptr);
712 h_norm_ref->Rebin(nrebin);
716 TCanvas *c1 =
new TCanvas(TString(
"QA_Draw_Tracking_TruthMatching_NumOfClusters") + TString(
"_") + hist_name_prefix,
717 TString(
"QA_Draw_Tracking_TruthMatching_NumOfClusters") + TString(
"_") + hist_name_prefix,
722 for (
int i = 0;
i < 3; ++
i)
725 TH2 *h_pass_detector = h_pass_detectors[
i];
726 TH2 *h_pass_detector_ref = h_pass_detectors_ref[
i];
730 p = (TPad *) c1->cd(
i + 1);
734 const int bin_start = h_pass_detector->GetXaxis()->FindBin(ncluster_spectrum_pt_cuts[
i]);
736 TH1 *h_pass_detector_ncluster = h_pass_detector->ProjectionY(
737 TString(h_pass_detector->GetName()) +
"_nCluster_new",
739 TH1 *h_pass_detector_ncluster_ref =
nullptr;
740 if (h_pass_detector_ref)
742 h_pass_detector_ncluster_ref = h_pass_detector_ref->ProjectionY(
743 TString(h_pass_detector_ref->GetName()) +
"_nCluster_ref",
747 h_pass_detector_ncluster->SetTitle(TString(hist_name_prefix) +
": " + detector + Form(
" n_{Cluster} | p_{T} #geq %.1fGeV/c", ncluster_spectrum_pt_cuts[i]));
748 h_pass_detector_ncluster->SetYTitle(
"# of reconstructed track");
749 DrawReference(h_pass_detector_ncluster, h_pass_detector_ncluster_ref,
false);
753 p = (TPad *) c1->cd(
i + 3 + 1);
758 const int bin_start = h_pass_detector->GetYaxis()->FindBin(eff_ncluster_cuts[
i]);
759 TH1 *h_pass = h_pass_detector->ProjectionX(
760 TString(h_pass_detector->GetName()) +
"_nReco_new",
764 h_pass->SetDirectory(
nullptr);
765 h_pass->Rebin(nrebin);
768 h_ratio->GetYaxis()->SetTitle(
"Reco efficiency | " + detector + Form(
" n_{Cluster} #geq %d", eff_ncluster_cuts[i]));
769 h_ratio->GetYaxis()->SetRangeUser(-0, 1.);
771 TH1 *h_ratio_ref = NULL;
772 if (h_pass_detector_ref)
774 TH1 *h_pass = h_pass_detector_ref->ProjectionX(
775 TString(h_pass_detector->GetName()) +
"_nReco_ref",
779 h_pass->SetDirectory(
nullptr);
780 h_pass->Rebin(nrebin);
785 h_ratio->SetTitle(
"Tracking efficiency | " + detector + Form(
" n_{Cluster} #geq %d", eff_ncluster_cuts[i]));
800 TString prefix = TString(
"h_") + hist_name_prefix + TString(
"_");
802 auto c1 =
new TCanvas(TString(
"QA_Draw_Tracking_nClus_Layer") + TString(
"_") + hist_name_prefix,
803 TString(
"QA_Draw_Tracking_nClus_Layer") + TString(
"_") + hist_name_prefix,
808 GetNormalization(qa_file_new, qa_file_ref, prefix,
"Truth Track");
809 Draw(qa_file_new, qa_file_ref, prefix,
"nClus_layerGen");
812 GetNormalization(qa_file_new, qa_file_ref, prefix,
"Reco Track");
813 Draw(qa_file_new, qa_file_ref, prefix,
"nClus_layer");
824 TString prefix = TString(
"h_") + hist_name_prefix + TString(
"_");
827 double Nevent_new = 1;
828 double Nevent_ref = 1;
830 if ( qa_file_new->GetObjectChecked(
831 prefix + TString(
"pTRecoGenRatio_pTGen"),
"TH2")
834 cout <<
"QAG4SimulationUpsilon is not enabled. Skip...."<<endl;
839 TCanvas *c1 =
new TCanvas(TString(
"QA_Draw_Tracking_UpsilonOverview") + TString(
"_") + hist_name_prefix,
840 TString(
"QA_Draw_Tracking_UpsilonOverview") + TString(
"_") + hist_name_prefix,
847 p = (TPad *) c1->cd(idx++);
851 TH2 *h_new = (TH2 *) qa_file_new->GetObjectChecked(
852 prefix + TString(
"pTRecoGenRatio_pTGen"),
"TH2");
862 h_ref = (TH2 *) qa_file_ref->GetObjectChecked(
863 prefix + TString(
"pTRecoGenRatio_pTGen"),
"TH2");
868 h_ref->Scale(Nevent_new / Nevent_ref);
871 TH1 *h_proj_new = h_new->ProjectionY(
876 h_proj_new->GetXaxis()->SetRangeUser(0, 1.3);
877 h_proj_new->SetTitle(TString(hist_name_prefix) + TString::Format(
878 ": Electron lineshape"));
879 h_proj_new->GetXaxis()->SetTitle(TString::Format(
880 "Reco p_{T}/Truth p_{T}"));
882 TF1 *f_eLineshape =
new TF1(
"f_eLineshape",
CBcalc, 7, 11, 5);
883 f_eLineshape->SetParameter(0, 1.0);
884 f_eLineshape->SetParameter(1, 1.0);
885 f_eLineshape->SetParameter(2, 0.95);
886 f_eLineshape->SetParameter(3, 0.08);
887 f_eLineshape->SetParameter(4, 20.0);
889 f_eLineshape->SetParNames(
"alpha",
"n",
"m",
"sigma",
"N");
890 f_eLineshape->SetLineColor(kRed);
891 f_eLineshape->SetLineWidth(3);
892 f_eLineshape->SetLineStyle(kSolid);
893 f_eLineshape->SetNpx(1000);
895 h_proj_new->Fit(f_eLineshape);
897 TH1 *h_proj_ref =
nullptr;
906 TF1 *f_eLineshape_ref =
new TF1(
"f_eLineshape_ref",
CBcalc, 7, 11, 5);
907 f_eLineshape_ref->SetParameter(0, 1.0);
908 f_eLineshape_ref->SetParameter(1, 1.0);
909 f_eLineshape_ref->SetParameter(2, 0.95);
910 f_eLineshape_ref->SetParameter(3, 0.08);
911 f_eLineshape_ref->SetParameter(4, 20.0);
913 f_eLineshape_ref->SetParNames(
"alpha",
"n",
"m",
"sigma",
"N");
914 f_eLineshape_ref->SetLineColor(kRed);
915 f_eLineshape_ref->SetLineWidth(3);
916 f_eLineshape_ref->SetLineStyle(kSolid);
918 h_proj_ref->Fit(f_eLineshape_ref);
922 f_eLineshape->Draw(
"same");
925 sprintf(resstr_1,
"#sigma_{dp/p} = %.2f #pm %.2f %%", f_eLineshape->GetParameter(3)*100, f_eLineshape->GetParError(3)*100);
926 TLatex *res_1 =
new TLatex(0.2,0.75,resstr_1);
928 res_1->SetTextSize(0.05);
929 res_1->SetTextAlign(13);
933 sprintf(resstr_2,
"#sigma_{dp/p,ref} = %.2f #pm %.2f %%", f_eLineshape_ref->GetParameter(3)*100, f_eLineshape_ref->GetParError(3)*100);
934 TLatex *res_2 =
new TLatex(0.2,0.7,resstr_2);
936 res_2->SetTextSize(0.05);
937 res_2->SetTextAlign(13);
942 p = (TPad *) c1->cd(idx++);
946 TH1 *h_new = (TH1 *) qa_file_new->GetObjectChecked(
947 prefix + TString(
"nReco_Pair_InvMassReco"),
"TH1");
954 TF1 *f1S =
new TF1(
"f1S", CBcalc2, 7, 11, 7);
955 f1S->SetParameter(0, 50.0);
956 f1S->SetParameter(1, 9.46);
957 f1S->SetParameter(2, 0.08);
958 f1S->SetParameter(3, 1.0);
959 f1S->SetParameter(4, 3.0);
960 f1S->SetParameter(5, 1.0);
961 f1S->SetParLimits(3, 0.120, 10);
962 f1S->SetParLimits(4, 1.05, 10);
963 f1S->SetParameter(6, 3.0);
964 f1S->SetParLimits(5, 0.120, 10);
965 f1S->SetParLimits(6, 1.05, 10);
967 f1S->SetParNames(
"N",
"m",
"#sigma",
"#alpha_{left}",
"n_{left}",
"#alpha_{right}",
"#sigma_{right}");
968 f1S->SetLineColor(kRed);
969 f1S->SetLineWidth(3);
970 f1S->SetLineStyle(kSolid);
978 h_ref = (TH1 *) qa_file_ref->GetObjectChecked(
979 prefix + TString(
"nReco_Pair_InvMassReco"),
"TH1");
987 h_new->SetTitle(TString(hist_name_prefix) + TString::Format(
988 ": #Upsilon #rightarrow e^{+}e^{-} lineshape"));
989 h_new->GetXaxis()->SetRangeUser(7, 10);
991 TF1 *f1S_ref =
new TF1(
"f1S_ref", CBcalc2, 7, 11, 7);
992 f1S_ref->SetParameter(0, 50.0);
993 f1S_ref->SetParameter(1, 9.46);
994 f1S_ref->SetParameter(2, 0.08);
995 f1S_ref->SetParameter(3, 1.0);
996 f1S_ref->SetParameter(4, 3.0);
997 f1S_ref->SetParameter(5, 1.0);
998 f1S_ref->SetParLimits(3, 0.120, 10);
999 f1S_ref->SetParLimits(4, 1.05, 10);
1000 f1S_ref->SetParameter(6, 3.0);
1001 f1S_ref->SetParLimits(5, 0.120, 10);
1002 f1S_ref->SetParLimits(6, 1.05, 10);
1004 f1S_ref->SetParNames(
"N",
"m",
"#sigma",
"#alpha_{left}",
"n_{left}",
"#alpha_{right}",
"#sigma_{right}");
1005 f1S_ref->SetLineColor(kRed);
1006 f1S_ref->SetLineWidth(3);
1007 f1S_ref->SetLineStyle(kSolid);
1009 h_ref->Fit(f1S_ref);
1017 sprintf(resstr_3,
"#sigma_{1S} = %.1f #pm %.1f MeV", f1S->GetParameter(2)*1000, f1S->GetParError(2)*1000);
1018 TLatex *res_3 =
new TLatex(0.2,0.75,resstr_3);
1020 res_3->SetTextSize(0.05);
1021 res_3->SetTextAlign(13);
1025 sprintf(resstr_4,
"#sigma_{1S,ref} = %.1f #pm %.1f MeV", f1S_ref->GetParameter(2)*1000, f1S_ref->GetParError(2)*1000);
1026 TLatex *res_4 =
new TLatex(0.2,0.7,resstr_4);
1028 res_4->SetTextSize(0.05);
1029 res_4->SetTextAlign(13);