3 #include "TEfficiency.h"
5 #include "TGraphErrors.h"
13 #include "TRatioPlot.h"
25 if (which ==
"charm") {
26 h->SetLineColor(kBlue);
27 h->SetMarkerColor(kBlue);
28 h->SetMarkerStyle(kOpenSquare);
29 h->SetMarkerColor(kBlue);
30 }
else if (which ==
"light") {
31 h->SetLineColor(kRed);
32 h->SetMarkerColor(kRed);
33 h->SetMarkerStyle(kFullCrossX);
34 h->SetMarkerColor(kRed);
40 TString trackname =
"barrelDircTrack",
41 TString filePattern =
"*/out.root")
43 auto data =
new TChain(
"tree");
45 data->SetTitle(input.Data());
46 auto files =
fileVector(Form(
"%s/%s/%s", dir.Data(), input.Data(), filePattern.Data()));
63 TCut *cut_fiducial =
nullptr;
66 Bool_t logplot = kFALSE;
68 if (trackname ==
"mRICHTrack") {
73 }
else if (trackname ==
"barrelDIRCTrack") {
78 }
else if (trackname ==
"CF4RICHTrack") {
82 }
else if (trackname ==
"tofBarrelTrack") {
86 }
else if (trackname ==
"dualRICHTrack") {
97 cut_fiducial =
new TCut(Form(
"%0.1f < pid_track_eta && pid_track_eta < %0.1f && pid_track_pt>0.1", etaMin, etaMax));
99 Float_t xbinsize = 0.5;
100 Int_t
nbinsx = TMath::Ceil((xmax - xmin) / xbinsize);
102 TCut cut_truekaon(
"TMath::Abs(pid_track_true_pid) == 321");
103 TCut cut_recokaon(
"TMath::Abs(pid_track_reco_pid) == 321");
104 TCut cut_truepion(
"TMath::Abs(pid_track_true_pid) == 211");
105 TCut cut_recopion(
"TMath::Abs(pid_track_reco_pid) == 211");
108 draw_config.
htemplate =
new TH1F(
"TrackPT",
117 draw_config.
ylimits = std::vector < float > ();
118 draw_config.
ylimits.push_back(0.0);
119 draw_config.
ylimits.push_back(1e4);
120 draw_config.
xtitle =
"Track Momentum [GeV]";
121 draw_config.
ytitle =
"Frequency";
122 draw_config.
logy = kFALSE;
123 draw_config.
logx = kFALSE;
124 draw_config.
cuts =
"";
127 auto true_kaon_pt =
GeneratePlot(draw_config,
data,
"True Kaon PT",
"pid_track_pt*TMath::CosH(pid_track_eta)", *cut_fiducial && cut_truekaon);
128 auto reco_kaon_pt =
GeneratePlot(draw_config,
data,
"Reconstructed Kaon PT",
"pid_track_pt*TMath::CosH(pid_track_eta)", *cut_fiducial && cut_truekaon && cut_recokaon);
131 TH1F *h_template = static_cast < TH1F * > (reco_kaon_pt->Clone(
"h_template"));
132 h_template->SetAxisRange(0.0, 1.12,
"Y");
134 h_template->SetAxisRange(1.0
e-5, 10.0,
"Y");
136 h_template->GetYaxis()->SetTitle(
"Efficiency");
138 auto pid_efficiency =
new TEfficiency(*reco_kaon_pt,
140 pid_efficiency->SetMarkerColor(kBlue);
141 pid_efficiency->SetFillColor(kBlue);
142 pid_efficiency->SetLineColor(kBlue);
143 pid_efficiency->SetMarkerStyle(kOpenSquare);
146 auto true_pion_pt =
GeneratePlot(draw_config,
data,
"True Pion PT",
"pid_track_pt*TMath::CosH(pid_track_eta)", *cut_fiducial && cut_truepion);
147 auto reco_pion_pt =
GeneratePlot(draw_config,
data,
"Reconstructed Pion PT",
"pid_track_pt*TMath::CosH(pid_track_eta)", *cut_fiducial && cut_truepion && cut_recokaon);
150 auto misid_efficiency =
new TEfficiency(*reco_pion_pt,
152 misid_efficiency->SetMarkerColor(kRed);
153 misid_efficiency->SetFillColor(kRed);
154 misid_efficiency->SetLineColor(kRed);
155 misid_efficiency->SetMarkerStyle(kFullCrossX);
168 h_template->Draw(
"AXIS");
169 pid_efficiency->Draw(
"E1 SAME");
170 misid_efficiency->Draw(
"E1 SAME");
172 TLatex etaRange((xmin + (xmax - xmin) * 0.67),
174 Form(
"%0.1f < #eta < %0.1f", etaMin, etaMax));
179 legend->AddEntry(pid_efficiency,
"K^{#pm} #rightarrow K^{#pm}",
"lp");
180 legend->AddEntry(misid_efficiency,
"#pi^{#pm} #rightarrow K^{#pm}",
"lp");
183 c1.SaveAs(Form(
"%s_KaonIDStudy.pdf", trackname.Data()));
192 TCut true_charm_mother(
"pid_track_jetmother == 4");
193 TCut true_light_mother(
"pid_track_jetmother > 0 && pid_track_jetmother < 4");
195 if (cut_fiducial !=
nullptr)
delete cut_fiducial;
196 cut_fiducial =
new TCut(Form(
"-4.0 < pid_track_eta && pid_track_eta < 4.0 && pid_track_pt>0.1 && pid_track_jet_pt > 10.0 && TMath::Abs(pid_track_jet_eta)<3.0"));
199 auto charm_true_kaon_pt =
GeneratePlot(draw_config,
data,
"True Kaon PT",
"pid_track_pt*TMath::CosH(pid_track_eta)", *cut_fiducial && true_charm_mother && cut_truekaon);
200 auto light_true_kaon_pt =
GeneratePlot(draw_config,
data,
"True Kaon PT",
"pid_track_pt*TMath::CosH(pid_track_eta)", *cut_fiducial && true_light_mother && cut_truekaon);
204 charm_true_kaon_pt->SetYTitle(
"Probability");
209 charm_true_kaon_pt->Rebin(2);
210 light_true_kaon_pt->Rebin(2);
212 TH1 *charm_true_kaon = charm_true_kaon_pt->DrawNormalized(
"E1");
213 TH1 *light_true_kaon = light_true_kaon_pt->DrawNormalized(
"E1 SAME");
215 charm_true_kaon->SetAxisRange(1
e-5, 1.0,
"Y");
218 c1.SaveAs(Form(
"True_Kaon_Momentum.pdf"));
221 auto charm_reco_kaon_pt =
GeneratePlot(draw_config,
data,
"reco Kaon PT",
"pid_track_pt*TMath::CosH(pid_track_eta)", *cut_fiducial && true_charm_mother && cut_truekaon && cut_recokaon);
222 auto light_reco_kaon_pt =
GeneratePlot(draw_config,
data,
"True Kaon PT",
"pid_track_pt*TMath::CosH(pid_track_eta)", *cut_fiducial && true_light_mother && cut_truekaon && cut_recokaon);
226 charm_reco_kaon_pt->SetYTitle(
"Probability");
231 charm_reco_kaon_pt->Rebin(2);
232 light_reco_kaon_pt->Rebin(2);
234 TH1 *charm_reco_kaon = charm_reco_kaon_pt->DrawNormalized(
"E1");
235 TH1 *light_reco_kaon = light_reco_kaon_pt->DrawNormalized(
"E1 SAME");
237 charm_reco_kaon->SetAxisRange(1
e-5, 1.0,
"Y");
240 c1.SaveAs(Form(
"Reco_Kaon_Momentum.pdf"));
248 kaon_low_p_config.
htemplate =
new TH1F(
"TrackMomentum_Low",
257 kaon_low_p_config.
ylimits = std::vector < float > ();
258 kaon_low_p_config.
ylimits.push_back(0.0);
259 kaon_low_p_config.
ylimits.push_back(1.0e6);
260 kaon_low_p_config.
xtitle =
"Track Momentum [GeV]";
261 kaon_low_p_config.
ytitle =
"Frequency";
262 kaon_low_p_config.
logy = kFALSE;
263 kaon_low_p_config.
logx = kFALSE;
264 kaon_low_p_config.
cuts =
"";
270 auto charm_true_kaon_p_low =
GeneratePlot(kaon_low_p_config,
data,
"Charm True Kaon P",
"pid_track_pt*TMath::CosH(pid_track_eta)", *cut_fiducial && true_charm_mother && cut_truekaon);
271 auto light_true_kaon_p_low =
GeneratePlot(kaon_low_p_config,
data,
"Light True Kaon P",
"pid_track_pt*TMath::CosH(pid_track_eta)", *cut_fiducial && true_light_mother && cut_truekaon);
273 std::cout << charm_true_kaon_p_low->GetNbinsX() << std::endl;
274 std::cout << light_true_kaon_p_low->GetNbinsX() << std::endl;
277 c1.SetLogy(kaon_low_p_config.
logy);
278 c1.SetLogx(kaon_low_p_config.
logx);
280 charm_true_kaon_p_low->SetYTitle(
"Probability");
285 charm_true_kaon = charm_true_kaon_p_low->DrawNormalized(
"E1");
286 light_true_kaon = light_true_kaon_p_low->DrawNormalized(
"E1 SAME");
288 charm_true_kaon->SetAxisRange(0.0, 0.04,
"Y");
290 c1.SaveAs(Form(
"True_Kaon_Momentum_Low.pdf"));
293 auto charm_reco_kaon_p_low =
GeneratePlot(kaon_low_p_config,
data,
"Charm True Kaon P",
"pid_track_pt*TMath::CosH(pid_track_eta)", *cut_fiducial && true_charm_mother && cut_truekaon && cut_recokaon);
294 auto light_reco_kaon_p_low =
GeneratePlot(kaon_low_p_config,
data,
"Light True Kaon P",
"pid_track_pt*TMath::CosH(pid_track_eta)", *cut_fiducial && true_light_mother && cut_truekaon && cut_recokaon);
296 std::cout << charm_reco_kaon_p_low->GetNbinsX() << std::endl;
297 std::cout << light_reco_kaon_p_low->GetNbinsX() << std::endl;
300 c1.SetLogy(kaon_low_p_config.
logy);
301 c1.SetLogx(kaon_low_p_config.
logx);
303 charm_reco_kaon_p_low->SetYTitle(
"Probability");
308 charm_reco_kaon = charm_reco_kaon_p_low->DrawNormalized(
"E1");
309 light_reco_kaon = light_reco_kaon_p_low->DrawNormalized(
"E1 SAME");
311 charm_reco_kaon->SetAxisRange(0.0, 0.04,
"Y");
313 c1.SaveAs(Form(
"Reco_Kaon_Momentum_Low.pdf"));