45 vector< float > v_momenta;
46 v_momenta.push_back(1.0);
47 v_momenta.push_back(2.0);
48 v_momenta.push_back(5.0);
49 v_momenta.push_back(10.0);
50 v_momenta.push_back(20.0);
53 vector< int > v_styles;
54 v_styles.push_back(20);
55 v_styles.push_back(24);
56 v_styles.push_back(21);
57 v_styles.push_back(25);
58 v_styles.push_back(22);
59 v_styles.push_back(26);
60 v_styles.push_back(23);
61 v_styles.push_back(27);
62 v_styles.push_back(34);
63 v_styles.push_back(28);
64 v_styles.push_back(29);
65 v_styles.push_back(30);
69 gROOT->LoadMacro(
"efficiency_purity_analysisMacro.C");
70 gROOT->LoadMacro(
"/sphenix/user/gregtom3/SBU/research/macros/macros/sPHENIXStyle/sPhenixStyle.C");
83 TCanvas *c_CEMC =
new TCanvas(
"cc",
"cc",1000,600);
84 TGraph *graphs_CEMC[size_C];
85 auto legend_CEMC_t =
new TLegend(0.51,0.2,1.0,0.9);
86 auto legend_CEMC_f =
new TLegend(0.51,0.2,1.0,0.9);
88 legend_CEMC_t->SetTextSize(0.06);
89 legend_CEMC_f->SetTextSize(0.06);
91 for(
unsigned idx_cut=0;idx_cut <
v_cuts_CEMC.size(); idx_cut++)
96 int idx_fp=idx_cut*2+1;
99 graphs_CEMC[idx_tp]=
new TGraph(v_momenta.size());
100 graphs_CEMC[idx_fp]=
new TGraph(v_momenta.size());
103 v_rate_tp = v_rate_fp = 0.0;
106 for (
unsigned idx_p = 0; idx_p < v_momenta.size(); idx_p++ )
108 v_rate_tp=get_true_positive(
"C",
v_cuts_CEMC.at(idx_cut),v_momenta.at(idx_p));
109 v_rate_fp=get_false_positive(
"C",
v_cuts_CEMC.at(idx_cut),v_momenta.at(idx_p));
110 graphs_CEMC[idx_tp]->SetPoint(idx_p,v_momenta[idx_p],v_rate_tp);
111 graphs_CEMC[idx_fp]->SetPoint(idx_p,v_momenta[idx_p],v_rate_fp);
115 graphs_CEMC[idx_tp]->SetMarkerColor(kGreen+2);
116 graphs_CEMC[idx_fp]->SetMarkerColor(kRed+2);
118 graphs_CEMC[idx_tp]->SetLineColor(graphs_CEMC[idx_tp]->GetMarkerColor());
119 graphs_CEMC[idx_fp]->SetLineColor(graphs_CEMC[idx_fp]->GetMarkerColor());
121 graphs_CEMC[idx_tp]->SetMarkerStyle(v_styles.at(idx_cut));
122 graphs_CEMC[idx_fp]->SetMarkerStyle(v_styles.at(idx_cut));
124 graphs_CEMC[idx_tp]->SetMarkerSize(1);
125 graphs_CEMC[idx_fp]->SetMarkerSize(1);
127 graphs_CEMC[idx_tp]->SetTitle(
"");
128 graphs_CEMC[idx_fp]->SetTitle(
"");
132 legend_CEMC_t->AddEntry(graphs_CEMC[idx_tp],
v_cuts_CEMC_short.at(idx_cut)+
" True Positive",
"P");
133 legend_CEMC_f->AddEntry(graphs_CEMC[idx_fp],
v_cuts_CEMC_short.at(idx_cut)+
" False Positive",
"P");
138 for(
int i = 0;
i<size_C;
i++)
144 gPad->SetRightMargin(0.5);
145 graphs_CEMC[0]->Draw(
"PA");
146 graphs_CEMC[0]->GetXaxis()->SetTitle(
"True Momentum (GeV)");
147 graphs_CEMC[0]->GetYaxis()->SetRangeUser(0.7,1.0);
148 graphs_CEMC[0]->GetYaxis()->SetTitle(
"Rate");
154 gPad->SetRightMargin(0.5);
155 graphs_CEMC[1]->GetXaxis()->SetTitle(
"True Momentum (GeV)");
156 graphs_CEMC[1]->GetYaxis()->SetRangeUser(-0.01,0.11);
157 graphs_CEMC[1]->GetYaxis()->SetTitle(
"Rate");
158 graphs_CEMC[1]->Draw(
"PA");
163 graphs_CEMC[
i]->Draw(
"PSame");
168 graphs_CEMC[
i]->Draw(
"P");
173 legend_CEMC_t->Draw();
175 legend_CEMC_f->Draw();
184 TCanvas *c_EEMC =
new TCanvas(
"ce",
"ce",1000,600);
185 TGraph *graphs_EEMC[size_E];
186 auto legend_EEMC_t =
new TLegend(0.51,0.2,1,0.9);
187 auto legend_EEMC_f =
new TLegend(0.51,0.2,1,0.9);
189 legend_EEMC_t->SetTextSize(0.06);
190 legend_EEMC_f->SetTextSize(0.06);
191 for(
unsigned idx_cut=0;idx_cut <
v_cuts_EEMC.size()/2; idx_cut++)
195 int idx_tp=idx_cut*2;
196 int idx_fp=idx_cut*2+1;
199 graphs_EEMC[idx_tp]=
new TGraph(v_momenta.size());
200 graphs_EEMC[idx_fp]=
new TGraph(v_momenta.size());
203 v_rate_tp = v_rate_fp = 0.0;
206 for (
unsigned idx_p = 0; idx_p < v_momenta.size(); idx_p++ )
209 v_rate_tp=get_true_positive(
"E",cut,v_momenta.at(idx_p));
210 v_rate_fp=get_false_positive(
"E",cut,v_momenta.at(idx_p));
211 graphs_EEMC[idx_tp]->SetPoint(idx_p,v_momenta[idx_p],v_rate_tp);
212 graphs_EEMC[idx_fp]->SetPoint(idx_p,v_momenta[idx_p],v_rate_fp);
215 graphs_EEMC[idx_tp]->SetMarkerColor(kGreen+2);
216 graphs_EEMC[idx_fp]->SetMarkerColor(kRed+2);
218 graphs_EEMC[idx_tp]->SetLineColor(graphs_EEMC[idx_tp]->GetMarkerColor());
219 graphs_EEMC[idx_fp]->SetLineColor(graphs_EEMC[idx_fp]->GetMarkerColor());
221 graphs_EEMC[idx_tp]->SetMarkerStyle(v_styles.at(idx_cut));
222 graphs_EEMC[idx_fp]->SetMarkerStyle(v_styles.at(idx_cut));
224 graphs_EEMC[idx_tp]->SetMarkerSize(1);
225 graphs_EEMC[idx_fp]->SetMarkerSize(1);
227 graphs_EEMC[idx_tp]->SetTitle(
"");
228 graphs_EEMC[idx_fp]->SetTitle(
"");
230 legend_EEMC_t->AddEntry(graphs_EEMC[idx_tp],
v_cuts_EEMC_short.at(idx_cut)+
" True Positive",
"P");
231 legend_EEMC_f->AddEntry(graphs_EEMC[idx_tp],
v_cuts_EEMC_short.at(idx_cut)+
" False Positive",
"P");
235 for(
int i = 0;
i<size_E;
i++)
240 gPad->SetRightMargin(0.5);
241 graphs_EEMC[0]->Draw(
"PA");
242 graphs_EEMC[0]->GetXaxis()->SetTitle(
"True Momentum (GeV)");
243 graphs_EEMC[0]->GetYaxis()->SetRangeUser(0.7,1.0);
244 graphs_EEMC[0]->GetYaxis()->SetTitle(
"Rate");
249 gPad->SetRightMargin(0.5);
250 graphs_EEMC[1]->Draw(
"PA");
251 graphs_EEMC[1]->GetXaxis()->SetTitle(
"True Momentum (GeV)");
252 graphs_EEMC[1]->GetYaxis()->SetRangeUser(-0.01,0.11);
253 graphs_EEMC[1]->GetYaxis()->SetTitle(
"Rate");
258 graphs_EEMC[
i]->Draw(
"PSame");
263 graphs_EEMC[
i]->Draw(
"P");
267 legend_EEMC_t->Draw();
269 legend_EEMC_f->Draw();
278 TCanvas *c_FEMC =
new TCanvas(
"cf",
"cf",1000,600);
279 TGraph *graphs_FEMC[size_F];
280 auto legend_FEMC_t =
new TLegend(0.51,0.2,1.0,0.9);
281 auto legend_FEMC_f =
new TLegend(0.51,0.2,1.0,0.9);
283 legend_FEMC_t->SetTextSize(0.06);
284 legend_FEMC_f->SetTextSize(0.06);
286 for(
unsigned idx_cut=0;idx_cut <
v_cuts_FEMC.size()/2; idx_cut++)
290 int idx_tp=idx_cut*2;
291 int idx_fp=idx_cut*2+1;
294 graphs_FEMC[idx_tp]=
new TGraph(v_momenta.size());
295 graphs_FEMC[idx_fp]=
new TGraph(v_momenta.size());
298 v_rate_tp = v_rate_fp = 0.0;
301 for (
unsigned idx_p = 0; idx_p < v_momenta.size(); idx_p++ )
304 v_rate_tp=get_true_positive(
"F",cut,v_momenta.at(idx_p));
305 v_rate_fp=get_false_positive(
"F",cut,v_momenta.at(idx_p));
306 graphs_FEMC[idx_tp]->SetPoint(idx_p,v_momenta[idx_p],v_rate_tp);
307 graphs_FEMC[idx_fp]->SetPoint(idx_p,v_momenta[idx_p],v_rate_fp);
310 graphs_FEMC[idx_tp]->SetMarkerColor(kGreen+2);
311 graphs_FEMC[idx_fp]->SetMarkerColor(kRed+2);
313 graphs_FEMC[idx_tp]->SetLineColor(graphs_FEMC[idx_tp]->GetMarkerColor());
314 graphs_FEMC[idx_fp]->SetLineColor(graphs_FEMC[idx_fp]->GetMarkerColor());
316 graphs_FEMC[idx_tp]->SetMarkerStyle(v_styles.at(idx_cut));
317 graphs_FEMC[idx_fp]->SetMarkerStyle(v_styles.at(idx_cut));
319 graphs_FEMC[idx_tp]->SetMarkerSize(1);
320 graphs_FEMC[idx_fp]->SetMarkerSize(1);
322 graphs_FEMC[idx_tp]->SetTitle(
"");
323 graphs_FEMC[idx_fp]->SetTitle(
"");
325 legend_FEMC_t->AddEntry(graphs_FEMC[idx_tp],
v_cuts_FEMC_short.at(idx_cut)+
" True Positive",
"P");
326 legend_FEMC_f->AddEntry(graphs_FEMC[idx_fp],
v_cuts_FEMC_short.at(idx_cut)+
" False Positive",
"P");
331 for(
int i = 0;
i<size_F;
i++)
337 gPad->SetRightMargin(0.5);
338 graphs_FEMC[0]->Draw(
"PA");
339 graphs_FEMC[0]->GetXaxis()->SetTitle(
"True Momentum (GeV)");
340 graphs_FEMC[0]->GetYaxis()->SetRangeUser(0.7,1.0);
341 graphs_FEMC[0]->GetYaxis()->SetTitle(
"Rate");
347 gPad->SetRightMargin(0.5);
348 graphs_FEMC[1]->GetXaxis()->SetTitle(
"True Momentum (GeV)");
349 graphs_FEMC[1]->GetYaxis()->SetRangeUser(-0.01,0.11);
350 graphs_FEMC[1]->GetYaxis()->SetTitle(
"Rate");
351 graphs_FEMC[1]->Draw(
"PA");
356 graphs_FEMC[
i]->Draw(
"PSame");
361 graphs_FEMC[
i]->Draw(
"PSame");
365 legend_FEMC_t->Draw();
367 legend_FEMC_f->Draw();
376 TString base_ep =
"em_cluster_e/em_track_ptotal > ";
377 TString base_prob =
"em_cluster_prob >= ";
381 TString base_ep_short =
"E/P > ";
382 TString base_prob_short =
"Prob >= ";
385 sprintf(str_1,
"%.2f", ep);
386 sprintf(str_2,
"%.3f", prob);
390 bool do_ep=
true;
bool do_prob=
true;
403 else if(do_ep&&!do_prob)
410 v_cuts_CEMC.push_back((TString(base_ep) += ep) +
"&&" + (TString(base_prob) += prob));
411 v_cuts_CEMC_short.push_back((TString(base_ep_short) += str_1) +
"&&" +(TString(base_prob_short) += str_2));
417 TString base_ep=
"em_cluster_e/";
418 TString base_ep_short =
"E/P > ";
420 sprintf(str_1,
"%.2f", ep);
430 TString base_ep=
"em_cluster_e/";
431 TString base_ep_short =
"E/P > ";
433 sprintf(str_1,
"%.2f", ep);