Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DrawEcal_Likelihood_Sum.C
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file DrawEcal_Likelihood_Sum.C
1 // $Id: $
2 
11 #include <cmath>
12 #include <TFile.h>
13 #include <TString.h>
14 #include <TLine.h>
15 #include <TTree.h>
16 #include <cassert>
17 #include "SaveCanvas.C"
18 #include "SetOKStyle.C"
19 using namespace std;
20 
21 TFile * _file0 = NULL;
22 TTree * T = NULL;
23 TString cuts = "";
24 
25 void
27 // TString base_dir =
28 // "../../sPHENIX_work/production_analysis_cemc2x2/emcstudies/pidstudies/spacal2d/fieldmap/",
29 
30  TString base_dir =
31  "../../sPHENIX_work/production_analysis_cemc2x2/embedding/emcstudies/pidstudies/spacal2d/fieldmap/",
32 // TString base_dir =
33 // "../../sPHENIX_work/production_analysis_cemc2x2/embedding/emcstudies/pidstudies/spacal1d/fieldmap/",
34  TString kine_config = "eta0"
35 // TString kine_config = "eta0.90"
36  )
37 {
38  SetOKStyle();
39  gStyle->SetOptStat(0);
40  gStyle->SetOptFit(1111);
41  TVirtualFitter::SetDefaultFitter("Minuit2");
42 
43  gSystem->Load("libg4eval.so");
44  gSystem->Load("libemcal_ana.so");
45  gSystem->Load("libg4vertex.so");
46 
47 // RejectionCurve(base_dir, kine_config, "Edep_LL_Distribution_eval_sample",
48 // "hll_edep_diff", 0.6);
50 // RejectionCurvePos(base_dir, kine_config, "Edep_LL_Distribution_eval_sample",
51 // "hll_edep_diff", 0.6);
52 
53 // RejectionCurve(base_dir, kine_config, "EP_LL_Distribution_eval_sample",
54 // "hll_ep_diff", 0.6);
55 
56 // RejectionCurve(base_dir, kine_config, "Edep_LL_Distribution_eval_sample",
57 // "hll_edep_diff", 0.85);
58 // RejectionCurvePos(base_dir, kine_config, "Edep_LL_Distribution_eval_sample",
59 // "hll_edep_diff", 0.85);
60 
61 // RejectionCurve(base_dir, kine_config, "EP_LL_Distribution_eval_sample",
62 // "hll_ep_diff", 0.85);
63 
64 // RejectionCurve_PiProton(base_dir, kine_config,
65 // "Edep_LL_Distribution_eval_sample", "hll_edep_diff", 0.85);
66 // RejectionCurve_PiProtonPos(base_dir, kine_config,
67 // "Edep_LL_Distribution_eval_sample", "hll_edep_diff", 0.85);
68 //
69 // RejectionCurve_PiProton(base_dir, kine_config,
70 // "EP_LL_Distribution_eval_sample", "hll_ep_diff", 0.85);
71 //
72 // RejectionCurve_RejMethodComparison();
73 // RejectionCurve_RejMethodComparison_AntiProton();
74 // RejectionCurve_ppSummary();
75 // RejectionCurve_ppSummaryPos();
76 
77 // RejectionCurve_AuAuSummary("../../sPHENIX_work/production_analysis_cemc2x2/embedding/emcstudies/pidstudies/spacal2d/fieldmap/",
78 // "2-D Proj. SPACAL, e^{-} VS h^{-} in Au+Au 10%C");
79  RejectionCurve_AuAuSummaryPos("../../sPHENIX_work/production_analysis_cemc2x2/embedding/emcstudies/pidstudies/spacal2d/fieldmap/",
80  "2-D Proj. SPACAL, e^{+} VS h^{+} in Au+Au 10%C");
81 // RejectionCurve_AuAuSummary("../../sPHENIX_work/production_analysis_cemc2x2/embedding/emcstudies/pidstudies/spacal1d/fieldmap/",
82 // "1-D Proj. SPACAL, e^{-} VS h^{-} in Au+Au 10%C");
83 // RejectionCurve_AuAuSummaryPos("../../sPHENIX_work/production_analysis_cemc2x2/embedding/emcstudies/pidstudies/spacal1d/fieldmap/",
84 // "1-D Proj. SPACAL, e^{+} VS h^{+} in Au+Au 10%C");
85 
86  // RejectionCurve_AuAuSummary_Compare();
87 // RejectionCurve_AuAuSummary_Compare2();
88 
89 }
90 
91 void
93  TString base_dir =
94  "../../sPHENIX_work/production_analysis_cemc2x2/emcstudies/pidstudies/spacal2d/fieldmap/",
95  TString kine_config = "eta0", //
96  TString ll_config = "Edep_LL_Distribution_eval_sample", //
97  TString hist_name = "hll_edep_diff", //
98  const double min_eff = 0.85)
99 {
100 
101  TCanvas *c1 = new TCanvas(
102  "RejectionCurvePos" + kine_config + "_" + ll_config + "_" + hist_name,
103  "RejectionCurvePos" + kine_config + "_" + ll_config + "_" + hist_name,
104  900, 900);
105  c1->Divide(1, 1);
106  int idx = 1;
107  TPad * p;
108 
109  p = (TPad *) c1->cd(idx++);
110  c1->Update();
111  p->SetLogy();
112 
113  p->DrawFrame(min_eff, 1, 1, 1e3,
114  ";Electron Efficiency;Positively Charged Hadron Rejection");
115 
116  TGraphErrors *ge = ExtractRejCurve(base_dir, kine_config + "_8GeV", ll_config,
117  hist_name, "e+", "pi+");
118 
119  ge->SetLineColor(kRed + 2);
120  ge->SetMarkerColor(kRed + 2);
121  ge->SetFillColor(kRed - 9);
122  ge->SetLineWidth(3);
123 // ge->Draw("3");
124  ge->Draw("lx");
125  TGraphErrors *ge = ExtractRejCurve(base_dir, kine_config + "_8GeV", ll_config,
126  hist_name, "e+", "kaon+");
127 
128  ge->SetLineColor(kRed + 2);
129  ge->SetMarkerColor(kRed + 2);
130  ge->SetFillColor(kRed - 9);
131  ge->SetLineWidth(3);
132  ge->SetLineStyle(kDashed);
133 // ge->Draw("3");
134  ge->Draw("lx");
135  TGraphErrors *ge = ExtractRejCurve(base_dir, kine_config + "_8GeV", ll_config,
136  hist_name, "e+", "proton");
137  ge->SetLineColor(kRed + 2);
138  ge->SetMarkerColor(kRed + 2);
139  ge->SetFillColor(kRed - 9);
140  ge->SetLineWidth(3);
141  ge->SetLineStyle(kDotted);
142 // ge->Draw("3");
143  ge->Draw("lx");
144 
145  TGraphErrors *ge = ExtractRejCurve(base_dir, kine_config + "_4GeV", ll_config,
146  hist_name, "e+", "pi+");
147  ge->SetLineColor(kBlue + 2);
148  ge->SetMarkerColor(kBlue + 2);
149  ge->SetFillColor(kBlue - 9);
150  ge->SetLineWidth(3);
151 // ge->Draw("3");
152  ge->Draw("lx");
153  TGraphErrors *ge = ExtractRejCurve(base_dir, kine_config + "_4GeV", ll_config,
154  hist_name, "e+", "kaon+");
155 
156  ge->SetLineColor(kBlue + 2);
157  ge->SetMarkerColor(kBlue + 2);
158  ge->SetFillColor(kBlue - 9);
159  ge->SetLineWidth(3);
160  ge->SetLineStyle(kDashed);
161 // ge->Draw("3");
162  ge->Draw("lx");
163  TGraphErrors *ge = ExtractRejCurve(base_dir, kine_config + "_4GeV", ll_config,
164  hist_name, "e+", "proton");
165  ge->SetLineColor(kBlue + 2);
166  ge->SetMarkerColor(kBlue + 2);
167  ge->SetFillColor(kBlue - 9);
168  ge->SetLineWidth(3);
169  ge->SetLineStyle(kDotted);
170 // ge->Draw("3");
171  ge->Draw("lx");
172 
173  TGraphErrors *ge = ExtractRejCurve(base_dir, kine_config + "_2GeV", ll_config,
174  hist_name, "e+", "pi+");
175 
176  ge->SetLineColor(kGreen + 3);
177  ge->SetMarkerColor(kGreen + 3);
178  ge->SetFillColor(kGreen - 9);
179  ge->SetLineWidth(3);
180 // ge->Draw("3");
181  ge->Draw("lx");
182  TGraphErrors *ge = ExtractRejCurve(base_dir, kine_config + "_2GeV", ll_config,
183  hist_name, "e+", "kaon+");
184  ge->SetLineColor(kGreen + 3);
185  ge->SetMarkerColor(kGreen + 3);
186  ge->SetFillColor(kGreen - 9);
187  ge->SetLineWidth(3);
188  ge->SetLineStyle(kDashed);
189 // ge->Draw("3");
190  ge->Draw("lx");
191  TGraphErrors *ge = ExtractRejCurve(base_dir, kine_config + "_2GeV", ll_config,
192  hist_name, "e+", "proton");
193  ge->SetLineColor(kGreen + 3);
194  ge->SetMarkerColor(kGreen + 3);
195  ge->SetFillColor(kGreen - 9);
196  ge->SetLineWidth(3);
197  ge->SetLineStyle(kDotted);
198 // ge->Draw("3");
199  ge->Draw("lx");
200 
201  SaveCanvas(c1,
202  base_dir + TString("DrawEcal_Likelihood_Sum_") + TString(c1->GetName()),
203  kFALSE);
204 }
205 
206 void
208  TString base_dir =
209  "../../sPHENIX_work/production_analysis_cemc2x2/emcstudies/pidstudies/spacal2d/fieldmap/",
210  TString kine_config = "eta0", //
211  TString ll_config = "Edep_LL_Distribution_eval_sample", //
212  TString hist_name = "hll_edep_diff", //
213  const double min_eff = 0.85)
214 {
215 
216  TCanvas *c1 = new TCanvas(
217  "RejectionCurve" + kine_config + "_" + ll_config + "_" + hist_name,
218  "RejectionCurve" + kine_config + "_" + ll_config + "_" + hist_name, 900,
219  900);
220  c1->Divide(1, 1);
221  int idx = 1;
222  TPad * p;
223 
224  p = (TPad *) c1->cd(idx++);
225  c1->Update();
226  p->SetLogy();
227 
228  p->DrawFrame(min_eff, 1, 1, 1e3, ";Electron Efficiency;Hadron Rejection");
229 
230  TGraphErrors *ge = ExtractRejCurve(base_dir, kine_config + "_8GeV", ll_config,
231  hist_name);
232 
233  ge->SetLineColor(kRed + 2);
234  ge->SetMarkerColor(kRed + 2);
235  ge->SetFillColor(kRed - 9);
236  ge->SetLineWidth(3);
237 // ge->Draw("3");
238  ge->Draw("lx");
239  TGraphErrors *ge = ExtractRejCurve(base_dir, kine_config + "_8GeV", ll_config,
240  hist_name, "e-", "kaon-");
241 
242  ge->SetLineColor(kRed + 2);
243  ge->SetMarkerColor(kRed + 2);
244  ge->SetFillColor(kRed - 9);
245  ge->SetLineWidth(3);
246  ge->SetLineStyle(kDashed);
247 // ge->Draw("3");
248  ge->Draw("lx");
249  TGraphErrors *ge = ExtractRejCurve(base_dir, kine_config + "_8GeV", ll_config,
250  hist_name, "e-", "anti_proton");
251  ge->SetLineColor(kRed + 2);
252  ge->SetMarkerColor(kRed + 2);
253  ge->SetFillColor(kRed - 9);
254  ge->SetLineWidth(3);
255  ge->SetLineStyle(kDotted);
256 // ge->Draw("3");
257  ge->Draw("lx");
258 
259  TGraphErrors *ge = ExtractRejCurve(base_dir, kine_config + "_4GeV", ll_config,
260  hist_name);
261  ge->SetLineColor(kBlue + 2);
262  ge->SetMarkerColor(kBlue + 2);
263  ge->SetFillColor(kBlue - 9);
264  ge->SetLineWidth(3);
265 // ge->Draw("3");
266  ge->Draw("lx");
267  TGraphErrors *ge = ExtractRejCurve(base_dir, kine_config + "_4GeV", ll_config,
268  hist_name, "e-", "kaon-");
269 
270  ge->SetLineColor(kBlue + 2);
271  ge->SetMarkerColor(kBlue + 2);
272  ge->SetFillColor(kBlue - 9);
273  ge->SetLineWidth(3);
274  ge->SetLineStyle(kDashed);
275 // ge->Draw("3");
276  ge->Draw("lx");
277  TGraphErrors *ge = ExtractRejCurve(base_dir, kine_config + "_4GeV", ll_config,
278  hist_name, "e-", "anti_proton");
279  ge->SetLineColor(kBlue + 2);
280  ge->SetMarkerColor(kBlue + 2);
281  ge->SetFillColor(kBlue - 9);
282  ge->SetLineWidth(3);
283  ge->SetLineStyle(kDotted);
284 // ge->Draw("3");
285  ge->Draw("lx");
286 
287  TGraphErrors *ge = ExtractRejCurve(base_dir, kine_config + "_2GeV", ll_config,
288  hist_name);
289 
290  ge->SetLineColor(kGreen + 3);
291  ge->SetMarkerColor(kGreen + 3);
292  ge->SetFillColor(kGreen - 9);
293  ge->SetLineWidth(3);
294 // ge->Draw("3");
295  ge->Draw("lx");
296  TGraphErrors *ge = ExtractRejCurve(base_dir, kine_config + "_2GeV", ll_config,
297  hist_name, "e-", "kaon-");
298  ge->SetLineColor(kGreen + 3);
299  ge->SetMarkerColor(kGreen + 3);
300  ge->SetFillColor(kGreen - 9);
301  ge->SetLineWidth(3);
302  ge->SetLineStyle(kDashed);
303 // ge->Draw("3");
304  ge->Draw("lx");
305  TGraphErrors *ge = ExtractRejCurve(base_dir, kine_config + "_2GeV", ll_config,
306  hist_name, "e-", "anti_proton");
307  ge->SetLineColor(kGreen + 3);
308  ge->SetMarkerColor(kGreen + 3);
309  ge->SetFillColor(kGreen - 9);
310  ge->SetLineWidth(3);
311  ge->SetLineStyle(kDotted);
312 // ge->Draw("3");
313  ge->Draw("lx");
314 
315  SaveCanvas(c1,
316  base_dir + TString("DrawEcal_Likelihood_Sum_") + TString(c1->GetName()),
317  kFALSE);
318 }
319 
320 void
322  TString base_dir =
323  "../../sPHENIX_work/production_analysis_cemc2x2/emcstudies/pidstudies/spacal2d/fieldmap/",
324  TString kine_config = "eta0", //
325  TString ll_config = "Edep_LL_Distribution_eval_sample", //
326  TString hist_name = "hll_edep_diff", //
327  const double min_eff = 0.85)
328 {
329 
330  TCanvas *c1 = new TCanvas(
331  "RejectionCurve_PiProton" + kine_config + "_" + ll_config + "_"
332  + hist_name,
333  "RejectionCurve_PiProton" + kine_config + "_" + ll_config + "_"
334  + hist_name, 900, 900);
335  c1->Divide(1, 1);
336  int idx = 1;
337  TPad * p;
338 
339  p = (TPad *) c1->cd(idx++);
340  c1->Update();
341  p->SetLogy();
342 
343  p->DrawFrame(min_eff, 10, 1, 1e3, ";Electron Efficiency;Hadron Rejection");
344 
345  TGraphErrors *ge = ExtractRejCurve(base_dir, kine_config + "_8GeV", ll_config,
346  hist_name);
347 
348  ge->SetLineColor(kRed + 2);
349  ge->SetMarkerColor(kRed + 2);
350  ge->SetFillColor(kRed - 9);
351  ge->SetLineWidth(3);
352 // ge->Draw("3");
353  ge->Draw("lx");
354 // TGraphErrors *ge = ExtractRejCurve(base_dir, kine_config + "_8GeV", ll_config,
355 // hist_name, "e-", "kaon-");
356 //
357 // ge->SetLineColor(kRed + 2);
358 // ge->SetMarkerColor(kRed + 2);
359 // ge->SetFillColor(kRed - 9);
360 // ge->SetLineWidth(3);
361 // ge->SetLineStyle(kDashed);
363 // ge->Draw("lx");
364  TGraphErrors *ge = ExtractRejCurve(base_dir, kine_config + "_8GeV", ll_config,
365  hist_name, "e-", "anti_proton");
366  ge->SetLineColor(kRed + 2);
367  ge->SetMarkerColor(kRed + 2);
368  ge->SetFillColor(kRed - 9);
369  ge->SetLineWidth(3);
370  ge->SetLineStyle(kDotted);
371 // ge->Draw("3");
372  ge->Draw("lx");
373 
374  TGraphErrors *ge = ExtractRejCurve(base_dir, kine_config + "_4GeV", ll_config,
375  hist_name);
376  ge->SetLineColor(kBlue + 2);
377  ge->SetMarkerColor(kBlue + 2);
378  ge->SetFillColor(kBlue - 9);
379  ge->SetLineWidth(3);
380 // ge->Draw("3");
381  ge->Draw("lx");
382 // TGraphErrors *ge = ExtractRejCurve(base_dir, kine_config + "_4GeV", ll_config,
383 // hist_name, "e-", "kaon-");
384 //
385 // ge->SetLineColor(kBlue + 2);
386 // ge->SetMarkerColor(kBlue + 2);
387 // ge->SetFillColor(kBlue - 9);
388 // ge->SetLineWidth(3);
389 // ge->SetLineStyle(kDashed);
391 // ge->Draw("lx");
392  TGraphErrors *ge = ExtractRejCurve(base_dir, kine_config + "_4GeV", ll_config,
393  hist_name, "e-", "anti_proton");
394  ge->SetLineColor(kBlue + 2);
395  ge->SetMarkerColor(kBlue + 2);
396  ge->SetFillColor(kBlue - 9);
397  ge->SetLineWidth(3);
398  ge->SetLineStyle(kDotted);
399 // ge->Draw("3");
400  ge->Draw("lx");
401 
402  TGraphErrors *ge = ExtractRejCurve(base_dir, kine_config + "_2GeV", ll_config,
403  hist_name);
404 
405  ge->SetLineColor(kGreen + 3);
406  ge->SetMarkerColor(kGreen + 3);
407  ge->SetFillColor(kGreen - 9);
408  ge->SetLineWidth(3);
409 // ge->Draw("3");
410  ge->Draw("lx");
411 // TGraphErrors *ge = ExtractRejCurve(base_dir, kine_config + "_2GeV", ll_config,
412 // hist_name, "e-", "kaon-");
413 // ge->SetLineColor(kGreen + 3);
414 // ge->SetMarkerColor(kGreen + 3);
415 // ge->SetFillColor(kGreen - 9);
416 // ge->SetLineWidth(3);
417 // ge->SetLineStyle(kDashed);
419 // ge->Draw("lx");
420  TGraphErrors *ge = ExtractRejCurve(base_dir, kine_config + "_2GeV", ll_config,
421  hist_name, "e-", "anti_proton");
422  ge->SetLineColor(kGreen + 3);
423  ge->SetMarkerColor(kGreen + 3);
424  ge->SetFillColor(kGreen - 9);
425  ge->SetLineWidth(3);
426  ge->SetLineStyle(kDotted);
427 // ge->Draw("3");
428  ge->Draw("lx");
429 
430  SaveCanvas(c1,
431  base_dir + TString("DrawEcal_Likelihood_Sum_") + TString(c1->GetName()),
432  kFALSE);
433 }
434 
435 void
437  TString base_dir =
438  "../../sPHENIX_work/production_analysis_cemc2x2/emcstudies/pidstudies/spacal2d/fieldmap/",
439  TString kine_config = "eta0", //
440  TString ll_config = "Edep_LL_Distribution_eval_sample", //
441  TString hist_name = "hll_edep_diff", //
442  const double min_eff = 0.85)
443 {
444 
445  TCanvas *c1 = new TCanvas(
446  "RejectionCurve_PiProtonPos" + kine_config + "_" + ll_config + "_"
447  + hist_name,
448  "RejectionCurve_PiProtonPos" + kine_config + "_" + ll_config + "_"
449  + hist_name, 900, 900);
450  c1->Divide(1, 1);
451  int idx = 1;
452  TPad * p;
453 
454  p = (TPad *) c1->cd(idx++);
455  c1->Update();
456  p->SetLogy();
457 
458  p->DrawFrame(min_eff, 10, 1, 1e3,
459  ";Electron Efficiency;Positively Charged Hadron Rejection");
460 
461  TGraphErrors *ge = ExtractRejCurve(base_dir, kine_config + "_8GeV", ll_config,
462  hist_name, "e+", "pi+");
463 
464  ge->SetLineColor(kRed + 2);
465  ge->SetMarkerColor(kRed + 2);
466  ge->SetFillColor(kRed - 9);
467  ge->SetLineWidth(3);
468 // ge->Draw("3");
469  ge->Draw("lx");
470 // TGraphErrors *ge = ExtractRejCurve(base_dir, kine_config + "_8GeV", ll_config,
471 // hist_name, "e-", "kaon-");
472 //
473 // ge->SetLineColor(kRed + 2);
474 // ge->SetMarkerColor(kRed + 2);
475 // ge->SetFillColor(kRed - 9);
476 // ge->SetLineWidth(3);
477 // ge->SetLineStyle(kDashed);
479 // ge->Draw("lx");
480  TGraphErrors *ge = ExtractRejCurve(base_dir, kine_config + "_8GeV", ll_config,
481  hist_name, "e+", "proton");
482  ge->SetLineColor(kRed + 2);
483  ge->SetMarkerColor(kRed + 2);
484  ge->SetFillColor(kRed - 9);
485  ge->SetLineWidth(3);
486  ge->SetLineStyle(kDotted);
487 // ge->Draw("3");
488  ge->Draw("lx");
489 
490  TGraphErrors *ge = ExtractRejCurve(base_dir, kine_config + "_4GeV", ll_config,
491  hist_name, "e+", "pi+");
492  ge->SetLineColor(kBlue + 2);
493  ge->SetMarkerColor(kBlue + 2);
494  ge->SetFillColor(kBlue - 9);
495  ge->SetLineWidth(3);
496 // ge->Draw("3");
497  ge->Draw("lx");
498 // TGraphErrors *ge = ExtractRejCurve(base_dir, kine_config + "_4GeV", ll_config,
499 // hist_name, "e-", "kaon-");
500 //
501 // ge->SetLineColor(kBlue + 2);
502 // ge->SetMarkerColor(kBlue + 2);
503 // ge->SetFillColor(kBlue - 9);
504 // ge->SetLineWidth(3);
505 // ge->SetLineStyle(kDashed);
507 // ge->Draw("lx");
508  TGraphErrors *ge = ExtractRejCurve(base_dir, kine_config + "_4GeV", ll_config,
509  hist_name, "e+", "proton");
510  ge->SetLineColor(kBlue + 2);
511  ge->SetMarkerColor(kBlue + 2);
512  ge->SetFillColor(kBlue - 9);
513  ge->SetLineWidth(3);
514  ge->SetLineStyle(kDotted);
515 // ge->Draw("3");
516  ge->Draw("lx");
517 
518  TGraphErrors *ge = ExtractRejCurve(base_dir, kine_config + "_2GeV", ll_config,
519  hist_name, "e+", "pi+");
520 
521  ge->SetLineColor(kGreen + 3);
522  ge->SetMarkerColor(kGreen + 3);
523  ge->SetFillColor(kGreen - 9);
524  ge->SetLineWidth(3);
525 // ge->Draw("3");
526  ge->Draw("lx");
527 // TGraphErrors *ge = ExtractRejCurve(base_dir, kine_config + "_2GeV", ll_config,
528 // hist_name, "e-", "kaon-");
529 // ge->SetLineColor(kGreen + 3);
530 // ge->SetMarkerColor(kGreen + 3);
531 // ge->SetFillColor(kGreen - 9);
532 // ge->SetLineWidth(3);
533 // ge->SetLineStyle(kDashed);
535 // ge->Draw("lx");
536  TGraphErrors *ge = ExtractRejCurve(base_dir, kine_config + "_2GeV", ll_config,
537  hist_name, "e+", "proton");
538  ge->SetLineColor(kGreen + 3);
539  ge->SetMarkerColor(kGreen + 3);
540  ge->SetFillColor(kGreen - 9);
541  ge->SetLineWidth(3);
542  ge->SetLineStyle(kDotted);
543 // ge->Draw("3");
544  ge->Draw("lx");
545 
546  SaveCanvas(c1,
547  base_dir + TString("DrawEcal_Likelihood_Sum_") + TString(c1->GetName()),
548  kFALSE);
549 }
550 
551 void
553  TString base_dir =
554  "../../sPHENIX_work/production_analysis_cemc2x2/emcstudies/pidstudies/spacal2d/fieldmap/",
555  TString kine_config = "eta0", //
556  const double min_eff = 0.85)
557 {
558 
559  TCanvas *c1 = new TCanvas("RejectionCurve_RejMethodComparison_" + kine_config,
560  "RejectionCurve_RejMethodComparison_" + kine_config, 900, 900);
561  c1->Divide(1, 1);
562  int idx = 1;
563  TPad * p;
564 
565  p = (TPad *) c1->cd(idx++);
566  c1->Update();
567  p->SetLogy();
568  p->SetGridx(0);
569  p->SetGridy(0);
570 
571  p->DrawFrame(min_eff, 10, 1, 1e3, ";Electron Efficiency;Hadron Rejection");
572  TLine * l = new TLine(0.95, 10, 0.95, 1e3);
573  l->SetLineColor(kGray);
574  l->SetLineWidth(5);
575  l->Draw();
576 
577  TLatex * text = new TLatex(0.85, 1e3 * 1.1,
578  "2-D Proj. SPACAL, e^{-}-#pi^{-} separation @ 0 < #eta < 0.1");
579  text->SetTextAlign(11);
580  text->SetTextSize(0.044);
581  text->SetTextFont(42);
582  text->Draw();
583 
584  TLegend * leg1 = new TLegend(0.12, 0.15, 0.65, 0.4);
585  TLegend * leg2 = new TLegend(0.65, 0.15, 0.85, 0.4);
586 
587  TGraphErrors *ge = new TGraphErrors();
588  ge->SetLineWidth(3);
589  leg1->AddEntry(ge, "EMCal+HCal Likelihood", "lx");
590  TGraphErrors *ge = new TGraphErrors();
591  ge->SetLineWidth(3);
592  ge->SetLineStyle(kDashed);
593  leg1->AddEntry(ge, "EMCal E/p Likelihood", "lx");
594  TGraphErrors *ge = new TGraphErrors();
595  ge->SetLineWidth(3);
596  ge->SetLineStyle(kDotted);
597  leg1->AddEntry(ge, "Cut on min. E/p", "lx");
598 
599  TGraphErrors *ge = ExtractRejCurve(base_dir, kine_config + "_8GeV", //
600  "Edep_LL_Distribution_eval_sample", "hll_edep_diff");
601  ge->SetLineColor(kRed + 2);
602  ge->SetMarkerColor(kRed + 2);
603  ge->SetFillColor(kRed - 9);
604  ge->SetLineWidth(3);
605 // ge->Draw("3");
606  ge->Draw("lx");
607  leg2->AddEntry(ge, "8 GeV/c", "lx");
608  TGraphErrors *ge = ExtractRejCurve(base_dir, kine_config + "_8GeV", //
609  "EP_LL_Distribution_eval_sample", "hll_ep_diff");
610  ge->SetLineColor(kRed + 2);
611  ge->SetMarkerColor(kRed + 2);
612  ge->SetFillColor(kRed - 9);
613  ge->SetLineWidth(3);
614  ge->SetLineStyle(kDashed);
615 // ge->Draw("3");
616  ge->Draw("lx");
617  TGraphErrors *ge = ExtractRejCurve(base_dir, kine_config + "_8GeV", //
618  "Ep_Checks_eval_sample", "hEMCalTrk_get_ep");
619  ge->SetLineColor(kRed + 2);
620  ge->SetMarkerColor(kRed + 2);
621  ge->SetFillColor(kRed - 9);
622  ge->SetLineWidth(3);
623  ge->SetLineStyle(kDotted);
624 // ge->Draw("3");
625  ge->Draw("lx");
626 
627  TGraphErrors *ge = ExtractRejCurve(base_dir, kine_config + "_4GeV", //
628  "Edep_LL_Distribution_eval_sample", "hll_edep_diff");
629  ge->SetLineColor(kBlue + 2);
630  ge->SetMarkerColor(kBlue + 2);
631  ge->SetFillColor(kBlue - 9);
632  ge->SetLineWidth(3);
633 // ge->Draw("3");
634  ge->Draw("lx");
635  leg2->AddEntry(ge, "4 GeV/c", "lx");
636  TGraphErrors *ge = ExtractRejCurve(base_dir, kine_config + "_4GeV", //
637  "EP_LL_Distribution_eval_sample", "hll_ep_diff");
638  ge->SetLineColor(kBlue + 2);
639  ge->SetMarkerColor(kBlue + 2);
640  ge->SetFillColor(kBlue - 9);
641  ge->SetLineWidth(3);
642  ge->SetLineStyle(kDashed);
643 // ge->Draw("3");
644  ge->Draw("lx");
645  TGraphErrors *ge = ExtractRejCurve(base_dir, kine_config + "_4GeV", //
646  "Ep_Checks_eval_sample", "hEMCalTrk_get_ep");
647  ge->SetLineColor(kBlue + 2);
648  ge->SetMarkerColor(kBlue + 2);
649  ge->SetFillColor(kBlue - 9);
650  ge->SetLineWidth(3);
651  ge->SetLineStyle(kDotted);
652 // ge->Draw("3");
653  ge->Draw("lx");
654 //
655  TGraphErrors *ge = ExtractRejCurve(base_dir, kine_config + "_2GeV", //
656  "Edep_LL_Distribution_eval_sample", "hll_edep_diff");
657  ge->SetLineColor(kGreen + 3);
658  ge->SetMarkerColor(kGreen + 3);
659  ge->SetFillColor(kGreen - 9);
660  ge->SetLineWidth(3);
661 // ge->Draw("3");
662  ge->Draw("lx");
663  leg2->AddEntry(ge, "2 GeV/c", "lx");
664  TGraphErrors *ge = ExtractRejCurve(base_dir, kine_config + "_2GeV", //
665  "EP_LL_Distribution_eval_sample", "hll_ep_diff");
666  ge->SetLineColor(kGreen + 3);
667  ge->SetMarkerColor(kGreen + 3);
668  ge->SetFillColor(kGreen - 9);
669  ge->SetLineWidth(3);
670  ge->SetLineStyle(kDashed);
671 // ge->Draw("3");
672  ge->Draw("lx");
673  TGraphErrors *ge = ExtractRejCurve(base_dir, kine_config + "_2GeV", //
674  "Ep_Checks_eval_sample", "hEMCalTrk_get_ep");
675  ge->SetLineColor(kGreen + 3);
676  ge->SetMarkerColor(kGreen + 3);
677  ge->SetFillColor(kGreen - 9);
678  ge->SetLineWidth(3);
679  ge->SetLineStyle(kDotted);
680 // ge->Draw("3");
681  ge->Draw("lx");
682 
683  leg2->Draw();
684  leg1->Draw();
685 
686  SaveCanvas(c1,
687  base_dir + TString("DrawEcal_Likelihood_Sum_") + TString(c1->GetName()));
688 }
689 
690 void
692  TString base_dir =
693  "../../sPHENIX_work/production_analysis_cemc2x2/emcstudies/pidstudies/spacal2d/fieldmap/",
694  //
695  const double min_eff = 0.85)
696 {
697 
698  TCanvas *c1 = new TCanvas("RejectionCurve_ppSummary",
699  "RejectionCurve_ppSummary", 900, 900);
700  c1->Divide(1, 1);
701  int idx = 1;
702  TPad * p;
703 
704  p = (TPad *) c1->cd(idx++);
705  c1->Update();
706  p->SetLogy();
707  p->SetGridx(0);
708  p->SetGridy(0);
709 
710  p->DrawFrame(min_eff, 5, 1, 1e3,
711  ";Electron Efficiency;Negatively Charged Hadron Rejection");
712  TLine * l = new TLine(0.95, 5, 0.95, 1e3);
713  l->SetLineColor(kGray);
714  l->SetLineWidth(5);
715  l->Draw();
716 
717  TLatex * text = new TLatex(0.85, 1e3 * 1.1,
718  "2-D Proj. SPACAL, e^{-}-h^{-} separation in p+p");
719  text->SetTextAlign(11);
720  text->SetTextSize(0.044);
721  text->SetTextFont(42);
722  text->Draw();
723 
724  TLegend * leg1 = new TLegend(0.12, 0.15, 0.42, 0.4);
725  TLegend * leg2 = new TLegend(0.42, 0.15, 0.67, 0.4);
726 
727  TGraphErrors *ge = new TGraphErrors();
728  ge->SetLineWidth(3);
729  leg1->AddEntry(ge, "0.0 < #eta < 0.1", "lx");
730  TGraphErrors *ge = new TGraphErrors();
731  ge->SetLineWidth(3);
732  ge->SetLineStyle(kDashed);
733  leg1->AddEntry(ge, "0.9 < #eta < 1.0", "lx");
734 // TGraphErrors *ge = new TGraphErrors();
735 // ge->SetLineWidth(3);
736 // ge->SetLineStyle(kDotted);
737 // leg1->AddEntry(ge, "Cut on min. E/p", "lx");
738 
739  TString kine_config = "eta0";
740  const double pt_over_p = 0.998;
741 
742  TGraphErrors *ge_pi = ExtractRejCurve(base_dir, kine_config + "_8GeV", //
743  "Edep_LL_Distribution_eval_sample", "hll_edep_diff", "e-", "pi-");
744 // TGraphErrors *ge_kaon = ExtractRejCurve(base_dir, kine_config + "_8GeV", //
745 // "Edep_LL_Distribution_eval_sample", "hll_edep_diff");
746  TGraphErrors *ge_anti_proton = ExtractRejCurve(base_dir,
747  kine_config + "_8GeV", //
748  "Edep_LL_Distribution_eval_sample", "hll_edep_diff", "e-", "anti_proton");
749  TGraphErrors *ge = MergeRejCurve(ge_pi,
750  1 + GetHPiRatio(8 * pt_over_p, "kaon-", "pp"), ge_anti_proton,
751  GetHPiRatio(8 * pt_over_p, "anti_proton", "pp"));
752  ge->SetLineColor(kRed + 2);
753  ge->SetMarkerColor(kRed + 2);
754  ge->SetFillColor(kRed - 9);
755  ge->SetLineWidth(3);
756 // ge->Draw("3");
757  ge->Draw("lx");
758  leg2->AddEntry(ge, "8 GeV/c", "lx");
759 
760  TGraphErrors *ge_pi = ExtractRejCurve(base_dir, kine_config + "_4GeV", //
761  "Edep_LL_Distribution_eval_sample", "hll_edep_diff", "e-", "pi-");
762 // TGraphErrors *ge_kaon = ExtractRejCurve(base_dir, kine_config + "_8GeV", //
763 // "Edep_LL_Distribution_eval_sample", "hll_edep_diff");
764  TGraphErrors *ge_anti_proton = ExtractRejCurve(base_dir,
765  kine_config + "_4GeV", //
766  "Edep_LL_Distribution_eval_sample", "hll_edep_diff", "e-", "anti_proton");
767  TGraphErrors *ge = MergeRejCurve(ge_pi,
768  1 + GetHPiRatio(4 * pt_over_p, "kaon-", "pp"), ge_anti_proton,
769  GetHPiRatio(4 * pt_over_p, "anti_proton", "pp"));
770  ge->SetLineColor(kBlue + 2);
771  ge->SetMarkerColor(kBlue + 2);
772  ge->SetFillColor(kBlue - 9);
773  ge->SetLineWidth(3);
774  // ge->Draw("3");
775  ge->Draw("lx");
776  leg2->AddEntry(ge, "4 GeV/c", "lx");
777 
778  TGraphErrors *ge_pi = ExtractRejCurve(base_dir, kine_config + "_2GeV", //
779  "Edep_LL_Distribution_eval_sample", "hll_edep_diff", "e-", "pi-");
780 // TGraphErrors *ge_kaon = ExtractRejCurve(base_dir, kine_config + "_8GeV", //
781 // "Edep_LL_Distribution_eval_sample", "hll_edep_diff");
782  TGraphErrors *ge_anti_proton = ExtractRejCurve(base_dir,
783  kine_config + "_2GeV", //
784  "Edep_LL_Distribution_eval_sample", "hll_edep_diff", "e-", "anti_proton");
785  TGraphErrors *ge = MergeRejCurve(ge_pi,
786  1 + GetHPiRatio(2 * pt_over_p, "kaon-", "pp"), ge_anti_proton,
787  GetHPiRatio(2 * pt_over_p, "anti_proton", "pp"));
788  ge->SetLineColor(kGreen + 3);
789  ge->SetMarkerColor(kGreen + 3);
790  ge->SetFillColor(kGreen - 9);
791  ge->SetLineWidth(3);
792  // ge->Draw("3");
793  ge->Draw("lx");
794  leg2->AddEntry(ge, "2 GeV/c", "lx");
795 
796  TString kine_config = "eta0.90";
797  const double pt_over_p = 0.673;
798 
799  TGraphErrors *ge_pi = ExtractRejCurve(base_dir, kine_config + "_8GeV", //
800  "Edep_LL_Distribution_eval_sample", "hll_edep_diff", "e-", "pi-");
801 // TGraphErrors *ge_kaon = ExtractRejCurve(base_dir, kine_config + "_8GeV", //
802 // "Edep_LL_Distribution_eval_sample", "hll_edep_diff");
803  TGraphErrors *ge_anti_proton = ExtractRejCurve(base_dir,
804  kine_config + "_8GeV", //
805  "Edep_LL_Distribution_eval_sample", "hll_edep_diff", "e-", "anti_proton");
806  TGraphErrors *ge = MergeRejCurve(ge_pi,
807  1 + GetHPiRatio(8 * pt_over_p, "kaon-", "pp"), ge_anti_proton,
808  GetHPiRatio(8 * pt_over_p, "anti_proton", "pp"));
809  ge->SetLineColor(kRed + 2);
810  ge->SetMarkerColor(kRed + 2);
811  ge->SetFillColor(kRed - 9);
812  ge->SetLineWidth(3);
813 // ge->Draw("3");
814  ge->SetLineStyle(kDashed);
815  ge->Draw("lx");
816 
817  TGraphErrors *ge_pi = ExtractRejCurve(base_dir, kine_config + "_4GeV", //
818  "Edep_LL_Distribution_eval_sample", "hll_edep_diff", "e-", "pi-");
819 // TGraphErrors *ge_kaon = ExtractRejCurve(base_dir, kine_config + "_8GeV", //
820 // "Edep_LL_Distribution_eval_sample", "hll_edep_diff");
821  TGraphErrors *ge_anti_proton = ExtractRejCurve(base_dir,
822  kine_config + "_4GeV", //
823  "Edep_LL_Distribution_eval_sample", "hll_edep_diff", "e-", "anti_proton");
824  TGraphErrors *ge = MergeRejCurve(ge_pi,
825  1 + GetHPiRatio(4 * pt_over_p, "kaon-", "pp"), ge_anti_proton,
826  GetHPiRatio(4 * pt_over_p, "anti_proton", "pp"));
827  ge->SetLineColor(kBlue + 2);
828  ge->SetMarkerColor(kBlue + 2);
829  ge->SetFillColor(kBlue - 9);
830  ge->SetLineWidth(3);
831  // ge->Draw("3");
832  ge->SetLineStyle(kDashed);
833  ge->Draw("lx");
834 
835  TGraphErrors *ge_pi = ExtractRejCurve(base_dir, kine_config + "_2GeV", //
836  "Edep_LL_Distribution_eval_sample", "hll_edep_diff", "e-", "pi-");
837 // TGraphErrors *ge_kaon = ExtractRejCurve(base_dir, kine_config + "_8GeV", //
838 // "Edep_LL_Distribution_eval_sample", "hll_edep_diff");
839  TGraphErrors *ge_anti_proton = ExtractRejCurve(base_dir,
840  kine_config + "_2GeV", //
841  "Edep_LL_Distribution_eval_sample", "hll_edep_diff", "e-", "anti_proton");
842  TGraphErrors *ge = MergeRejCurve(ge_pi,
843  1 + GetHPiRatio(2 * pt_over_p, "kaon-", "pp"), ge_anti_proton,
844  GetHPiRatio(2 * pt_over_p, "anti_proton", "pp"));
845  ge->SetLineColor(kGreen + 3);
846  ge->SetMarkerColor(kGreen + 3);
847  ge->SetFillColor(kGreen - 9);
848  ge->SetLineWidth(3);
849  // ge->Draw("3");
850  ge->SetLineStyle(kDashed);
851  ge->Draw("lx");
852 
853  leg2->Draw();
854  leg1->Draw();
855 
856  SaveCanvas(c1,
857  base_dir + TString("DrawEcal_Likelihood_Sum_") + TString(c1->GetName()));
858 }
859 
860 void
862  TString base_dir =
863  "../../sPHENIX_work/production_analysis_cemc2x2/emcstudies/pidstudies/spacal2d/fieldmap/",
864  //
865  const double min_eff = 0.85)
866 {
867 
868  TCanvas *c1 = new TCanvas("RejectionCurve_ppSummaryPos",
869  "RejectionCurve_ppSummaryPos", 900, 900);
870  c1->Divide(1, 1);
871  int idx = 1;
872  TPad * p;
873 
874  p = (TPad *) c1->cd(idx++);
875  c1->Update();
876  p->SetLogy();
877  p->SetGridx(0);
878  p->SetGridy(0);
879 
880  p->DrawFrame(min_eff, 5, 1, 1e3,
881  ";Electron Efficiency;Positively Charged Hadron Rejection");
882  TLine * l = new TLine(0.95, 5, 0.95, 1e3);
883  l->SetLineColor(kGray);
884  l->SetLineWidth(5);
885  l->Draw();
886 
887  TLatex * text = new TLatex(0.85, 1e3 * 1.1,
888  "2-D Proj. SPACAL, e^{+}-h^{+} separation in p+p");
889  text->SetTextAlign(11);
890  text->SetTextSize(0.044);
891  text->SetTextFont(42);
892  text->Draw();
893 
894  TLegend * leg1 = new TLegend(0.12, 0.15, 0.42, 0.4);
895  TLegend * leg2 = new TLegend(0.42, 0.15, 0.67, 0.4);
896 
897  TGraphErrors *ge = new TGraphErrors();
898  ge->SetLineWidth(3);
899  leg1->AddEntry(ge, "0.0 < #eta < 0.1", "lx");
900  TGraphErrors *ge = new TGraphErrors();
901  ge->SetLineWidth(3);
902  ge->SetLineStyle(kDashed);
903  leg1->AddEntry(ge, "0.9 < #eta < 1.0", "lx");
904 // TGraphErrors *ge = new TGraphErrors();
905 // ge->SetLineWidth(3);
906 // ge->SetLineStyle(kDotted);
907 // leg1->AddEntry(ge, "Cut on min. E/p", "lx");
908 
909  TString kine_config = "eta0";
910  const double pt_over_p = 0.998;
911 
912  TGraphErrors *ge_pi = ExtractRejCurve(base_dir, kine_config + "_8GeV", //
913  "Edep_LL_Distribution_eval_sample", "hll_edep_diff", "e+", "pi+");
914 // TGraphErrors *ge_kaon = ExtractRejCurve(base_dir, kine_config + "_8GeV", //
915 // "Edep_LL_Distribution_eval_sample", "hll_edep_diff", "e+", "kaon+");
916  TGraphErrors *ge_anti_proton = ExtractRejCurve(base_dir,
917  kine_config + "_8GeV", //
918  "Edep_LL_Distribution_eval_sample", "hll_edep_diff", "e+", "proton");
919  TGraphErrors *ge = MergeRejCurve(ge_pi,
920  1 + GetHPiRatio(8 * pt_over_p, "kaon+", "pp"), ge_anti_proton,
921  GetHPiRatio(8 * pt_over_p, "proton", "pp"));
922  ge->SetLineColor(kRed + 2);
923  ge->SetMarkerColor(kRed + 2);
924  ge->SetFillColor(kRed - 9);
925  ge->SetLineWidth(3);
926 // ge->Draw("3");
927  ge->Draw("lx");
928  leg2->AddEntry(ge, "8 GeV/c", "lx");
929 
930  TGraphErrors *ge_pi = ExtractRejCurve(base_dir, kine_config + "_4GeV", //
931  "Edep_LL_Distribution_eval_sample", "hll_edep_diff", "e+", "pi+");
932 // TGraphErrors *ge_kaon = ExtractRejCurve(base_dir, kine_config + "_4GeV", //
933 // "Edep_LL_Distribution_eval_sample", "hll_edep_diff", "e+", "kaon+");
934  TGraphErrors *ge_anti_proton = ExtractRejCurve(base_dir,
935  kine_config + "_4GeV", //
936  "Edep_LL_Distribution_eval_sample", "hll_edep_diff", "e+", "proton");
937  TGraphErrors *ge = MergeRejCurve(ge_pi,
938  1 + GetHPiRatio(4 * pt_over_p, "kaon+", "pp"), ge_anti_proton,
939  GetHPiRatio(4 * pt_over_p, "proton", "pp"));
940  ge->SetLineColor(kBlue + 2);
941  ge->SetMarkerColor(kBlue + 2);
942  ge->SetFillColor(kBlue - 9);
943  ge->SetLineWidth(3);
944  // ge->Draw("3");
945  ge->Draw("lx");
946  leg2->AddEntry(ge, "4 GeV/c", "lx");
947 
948  TGraphErrors *ge_pi = ExtractRejCurve(base_dir, kine_config + "_2GeV", //
949  "Edep_LL_Distribution_eval_sample", "hll_edep_diff", "e+", "pi+");
950 // TGraphErrors *ge_kaon = ExtractRejCurve(base_dir, kine_config + "_2GeV", //
951 // "Edep_LL_Distribution_eval_sample", "hll_edep_diff", "e+", "kaon+");
952  TGraphErrors *ge_anti_proton = ExtractRejCurve(base_dir,
953  kine_config + "_2GeV", //
954  "Edep_LL_Distribution_eval_sample", "hll_edep_diff", "e+", "proton");
955  TGraphErrors *ge = MergeRejCurve(ge_pi,
956  1 + GetHPiRatio(2 * pt_over_p, "kaon+", "pp"), ge_anti_proton,
957  GetHPiRatio(2 * pt_over_p, "proton", "pp"));
958  ge->SetLineColor(kGreen + 3);
959  ge->SetMarkerColor(kGreen + 3);
960  ge->SetFillColor(kGreen - 9);
961  ge->SetLineWidth(3);
962  // ge->Draw("3");
963  ge->Draw("lx");
964  leg2->AddEntry(ge, "2 GeV/c", "lx");
965 
966  TString kine_config = "eta0.90";
967  const double pt_over_p = 0.673;
968 
969  TGraphErrors *ge_pi = ExtractRejCurve(base_dir, kine_config + "_8GeV", //
970  "Edep_LL_Distribution_eval_sample", "hll_edep_diff", "e+", "pi+");
971 // TGraphErrors *ge_kaon = ExtractRejCurve(base_dir, kine_config + "_8GeV", //
972 // "Edep_LL_Distribution_eval_sample", "hll_edep_diff", "e+", "kaon+");
973  TGraphErrors *ge_anti_proton = ExtractRejCurve(base_dir,
974  kine_config + "_8GeV", //
975  "Edep_LL_Distribution_eval_sample", "hll_edep_diff", "e+", "proton");
976  TGraphErrors *ge = MergeRejCurve(ge_pi,
977  1 + GetHPiRatio(8 * pt_over_p, "kaon+", "pp"), ge_anti_proton,
978  GetHPiRatio(8 * pt_over_p, "proton", "pp"));
979  ge->SetLineColor(kRed + 2);
980  ge->SetMarkerColor(kRed + 2);
981  ge->SetFillColor(kRed - 9);
982  ge->SetLineWidth(3);
983 // ge->Draw("3");
984  ge->SetLineStyle(kDashed);
985  ge->Draw("lx");
986 
987  TGraphErrors *ge_pi = ExtractRejCurve(base_dir, kine_config + "_4GeV", //
988  "Edep_LL_Distribution_eval_sample", "hll_edep_diff", "e+", "pi+");
989 // TGraphErrors *ge_kaon = ExtractRejCurve(base_dir, kine_config + "_4GeV", //
990 // "Edep_LL_Distribution_eval_sample", "hll_edep_diff", "e+", "kaon+");
991  TGraphErrors *ge_anti_proton = ExtractRejCurve(base_dir,
992  kine_config + "_4GeV", //
993  "Edep_LL_Distribution_eval_sample", "hll_edep_diff", "e+", "proton");
994  TGraphErrors *ge = MergeRejCurve(ge_pi,
995  1 + GetHPiRatio(4 * pt_over_p, "kaon+", "pp"), ge_anti_proton,
996  GetHPiRatio(4 * pt_over_p, "proton", "pp"));
997  ge->SetLineColor(kBlue + 2);
998  ge->SetMarkerColor(kBlue + 2);
999  ge->SetFillColor(kBlue - 9);
1000  ge->SetLineWidth(3);
1001  // ge->Draw("3");
1002  ge->SetLineStyle(kDashed);
1003  ge->Draw("lx");
1004 
1005  TGraphErrors *ge_pi = ExtractRejCurve(base_dir, kine_config + "_2GeV", //
1006  "Edep_LL_Distribution_eval_sample", "hll_edep_diff", "e+", "pi+");
1007 // TGraphErrors *ge_kaon = ExtractRejCurve(base_dir, kine_config + "_2GeV", //
1008 // "Edep_LL_Distribution_eval_sample", "hll_edep_diff", "e+", "kaon+");
1009  TGraphErrors *ge_anti_proton = ExtractRejCurve(base_dir,
1010  kine_config + "_2GeV", //
1011  "Edep_LL_Distribution_eval_sample", "hll_edep_diff", "e+", "proton");
1012  TGraphErrors *ge = MergeRejCurve(ge_pi,
1013  1 + GetHPiRatio(2 * pt_over_p, "kaon+", "pp"), ge_anti_proton,
1014  GetHPiRatio(2 * pt_over_p, "proton", "pp"));
1015  ge->SetLineColor(kGreen + 3);
1016  ge->SetMarkerColor(kGreen + 3);
1017  ge->SetFillColor(kGreen - 9);
1018  ge->SetLineWidth(3);
1019  // ge->Draw("3");
1020  ge->SetLineStyle(kDashed);
1021  ge->Draw("lx");
1022 
1023  leg2->Draw();
1024  leg1->Draw();
1025 
1026  SaveCanvas(c1,
1027  base_dir + TString("DrawEcal_Likelihood_Sum_") + TString(c1->GetName()));
1028 }
1029 
1030 void
1032  TString base_dir =
1033  "../../sPHENIX_work/production_analysis_cemc2x2/embedding/emcstudies/pidstudies/spacal2d/fieldmap/",
1034  TString label = "2-D Proj. SPACAL, e^{-} VS h^{-} in Au+Au 10%C", //
1035  const double min_eff = 0.6)
1036 {
1037 
1038  TCanvas *c1 = new TCanvas("RejectionCurve_AuAuSummary",
1039  "RejectionCurve_AuAuSummary", 900, 900);
1040  c1->Divide(1, 1);
1041  int idx = 1;
1042  TPad * p;
1043 
1044  p = (TPad *) c1->cd(idx++);
1045  c1->Update();
1046  p->SetLogy();
1047  p->SetGridx(0);
1048  p->SetGridy(0);
1049 
1050  p->DrawFrame(min_eff, 1, 1, 1e3,
1051  ";Electron Efficiency;Negatively Charged Hadron Rejection");
1052  TLine * l = new TLine(0.9, 1, 0.9, 1e3);
1053  l->SetLineColor(kGray);
1054  l->SetLineWidth(5);
1055  l->Draw();
1056 
1057  TLatex * text = new TLatex(0.6, 1e3 * 1.2, label);
1058  text->SetTextAlign(11);
1059  text->SetTextSize(0.044);
1060  text->SetTextFont(42);
1061  text->Draw();
1062 
1063  TLegend * leg1 = new TLegend(0.12, 0.15, 0.42, 0.4);
1064  TLegend * leg2 = new TLegend(0.42, 0.15, 0.67, 0.4);
1065 
1066  TGraphErrors *ge = new TGraphErrors();
1067  ge->SetLineWidth(3);
1068  leg1->AddEntry(ge, "0.0 < #eta < 0.1", "lx");
1069  TGraphErrors *ge = new TGraphErrors();
1070  ge->SetLineWidth(3);
1071  ge->SetLineStyle(kDashed);
1072  leg1->AddEntry(ge, "0.9 < #eta < 1.0", "lx");
1073 // TGraphErrors *ge = new TGraphErrors();
1074 // ge->SetLineWidth(3);
1075 // ge->SetLineStyle(kDotted);
1076 // leg1->AddEntry(ge, "Cut on min. E/p", "lx");
1077 
1078  TString kine_config = "eta0";
1079  const double pt_over_p = 0.998;
1080 
1081  TGraphErrors *ge_pi = ExtractRejCurve(base_dir, kine_config + "_8GeV", //
1082  "Edep_LL_Distribution_eval_sample", "hll_edep_diff", "e-", "pi-");
1083  TGraphErrors *ge_kaon = ExtractRejCurve(base_dir, kine_config + "_8GeV", //
1084  "Edep_LL_Distribution_eval_sample", "hll_edep_diff", "e-", "kaon-");
1085  TGraphErrors *ge_anti_proton = ExtractRejCurve(base_dir,
1086  kine_config + "_8GeV", //
1087  "Edep_LL_Distribution_eval_sample", "hll_edep_diff", "e-", "anti_proton");
1088  TGraphErrors *ge = MergeRejCurve(ge_pi, 1, ge_kaon,
1089  GetHPiRatio(8, "kaon-", "AuAu10%C"), ge_anti_proton,
1090  GetHPiRatio(8, "anti_proton", "AuAu10%C"));
1091  ge->SetLineColor(kRed + 2);
1092  ge->SetMarkerColor(kRed + 2);
1093  ge->SetFillColor(kRed - 9);
1094  ge->SetLineWidth(3);
1095 // ge->Draw("3");
1096  ge->Draw("lx");
1097 
1098  ge->SetName("MergeExtractRejCurve_" + kine_config + "_8GeV");
1099  leg2->AddEntry(ge, "8 GeV/c", "lx");
1100 
1101  TGraphErrors *ge_pi = ExtractRejCurve(base_dir, kine_config + "_4GeV", //
1102  "Edep_LL_Distribution_eval_sample", "hll_edep_diff", "e-", "pi-");
1103  TGraphErrors *ge_kaon = ExtractRejCurve(base_dir, kine_config + "_8GeV", //
1104  "Edep_LL_Distribution_eval_sample", "hll_edep_diff", "e-", "kaon-");
1105  TGraphErrors *ge_anti_proton = ExtractRejCurve(base_dir,
1106  kine_config + "_4GeV", //
1107  "Edep_LL_Distribution_eval_sample", "hll_edep_diff", "e-", "anti_proton");
1108  TGraphErrors *ge = MergeRejCurve(ge_pi, 1, ge_kaon,
1109  GetHPiRatio(4, "kaon-", "AuAu10%C"), ge_anti_proton,
1110  GetHPiRatio(4, "anti_proton", "AuAu10%C"));
1111  ge->SetLineColor(kBlue + 2);
1112  ge->SetMarkerColor(kBlue + 2);
1113  ge->SetFillColor(kBlue - 9);
1114  ge->SetLineWidth(3);
1115  // ge->Draw("3");
1116  ge->Draw("lx");
1117  ge->SetName("MergeExtractRejCurve_" + kine_config + "_4GeV");
1118  leg2->AddEntry(ge, "4 GeV/c", "lx");
1119 
1120  TGraphErrors *ge_pi = ExtractRejCurve(base_dir, kine_config + "_2GeV", //
1121  "Edep_LL_Distribution_eval_sample", "hll_edep_diff", "e-", "pi-");
1122  TGraphErrors *ge_kaon = ExtractRejCurve(base_dir, kine_config + "_8GeV", //
1123  "Edep_LL_Distribution_eval_sample", "hll_edep_diff", "e-", "kaon-");
1124  TGraphErrors *ge_anti_proton = ExtractRejCurve(base_dir,
1125  kine_config + "_2GeV", //
1126  "Edep_LL_Distribution_eval_sample", "hll_edep_diff", "e-", "anti_proton");
1127  TGraphErrors *ge = MergeRejCurve(ge_pi, 1, ge_kaon,
1128  GetHPiRatio(2, "kaon-", "AuAu10%C"), ge_anti_proton,
1129  GetHPiRatio(2, "anti_proton", "AuAu10%C"));
1130  ge->SetLineColor(kGreen + 3);
1131  ge->SetMarkerColor(kGreen + 3);
1132  ge->SetFillColor(kGreen - 9);
1133  ge->SetLineWidth(3);
1134  // ge->Draw("3");
1135  ge->Draw("lx");
1136  ge->SetName("MergeExtractRejCurve_" + kine_config + "_2GeV");
1137  leg2->AddEntry(ge, "2 GeV/c", "lx");
1138 
1139  TString kine_config = "eta0.90";
1140  const double pt_over_p = 0.673;
1141 
1142  TGraphErrors *ge_pi = ExtractRejCurve(base_dir, kine_config + "_8GeV", //
1143  "Edep_LL_Distribution_eval_sample", "hll_edep_diff", "e-", "pi-");
1144  TGraphErrors *ge_kaon = ExtractRejCurve(base_dir, kine_config + "_8GeV", //
1145  "Edep_LL_Distribution_eval_sample", "hll_edep_diff", "e-", "kaon-");
1146  TGraphErrors *ge_anti_proton = ExtractRejCurve(base_dir,
1147  kine_config + "_8GeV", //
1148  "Edep_LL_Distribution_eval_sample", "hll_edep_diff", "e-", "anti_proton");
1149  TGraphErrors *ge = MergeRejCurve(ge_pi, 1, ge_kaon,
1150  GetHPiRatio(8, "kaon-", "AuAu10%C"), ge_anti_proton,
1151  GetHPiRatio(8, "anti_proton", "AuAu10%C"));
1152  ge->SetLineColor(kRed + 2);
1153  ge->SetMarkerColor(kRed + 2);
1154  ge->SetFillColor(kRed - 9);
1155  ge->SetLineWidth(3);
1156 // ge->Draw("3");
1157  ge->SetLineStyle(kDashed);
1158  ge->SetName("MergeExtractRejCurve_" + kine_config + "_8GeV");
1159  ge->Draw("lx");
1160 
1161  TGraphErrors *ge_pi = ExtractRejCurve(base_dir, kine_config + "_4GeV", //
1162  "Edep_LL_Distribution_eval_sample", "hll_edep_diff", "e-", "pi-");
1163  TGraphErrors *ge_kaon = ExtractRejCurve(base_dir, kine_config + "_8GeV", //
1164  "Edep_LL_Distribution_eval_sample", "hll_edep_diff", "e-", "kaon-");
1165  TGraphErrors *ge_anti_proton = ExtractRejCurve(base_dir,
1166  kine_config + "_4GeV", //
1167  "Edep_LL_Distribution_eval_sample", "hll_edep_diff", "e-", "anti_proton");
1168  TGraphErrors *ge = MergeRejCurve(ge_pi, 1, ge_kaon,
1169  GetHPiRatio(4, "kaon-", "AuAu10%C"), ge_anti_proton,
1170  GetHPiRatio(4, "anti_proton", "AuAu10%C"));
1171  ge->SetLineColor(kBlue + 2);
1172  ge->SetMarkerColor(kBlue + 2);
1173  ge->SetFillColor(kBlue - 9);
1174  ge->SetLineWidth(3);
1175  // ge->Draw("3");
1176  ge->SetLineStyle(kDashed);
1177  ge->SetName("MergeExtractRejCurve_" + kine_config + "_4GeV");
1178  ge->Draw("lx");
1179 
1180  TGraphErrors *ge_pi = ExtractRejCurve(base_dir, kine_config + "_2GeV", //
1181  "Edep_LL_Distribution_eval_sample", "hll_edep_diff", "e-", "pi-");
1182  TGraphErrors *ge_kaon = ExtractRejCurve(base_dir, kine_config + "_8GeV", //
1183  "Edep_LL_Distribution_eval_sample", "hll_edep_diff", "e-", "kaon-");
1184  TGraphErrors *ge_anti_proton = ExtractRejCurve(base_dir,
1185  kine_config + "_2GeV", //
1186  "Edep_LL_Distribution_eval_sample", "hll_edep_diff", "e-", "anti_proton");
1187  TGraphErrors *ge = MergeRejCurve(ge_pi, 1, ge_kaon,
1188  GetHPiRatio(2, "kaon-", "AuAu10%C"), ge_anti_proton,
1189  GetHPiRatio(2, "anti_proton", "AuAu10%C"));
1190  ge->SetLineColor(kGreen + 3);
1191  ge->SetMarkerColor(kGreen + 3);
1192  ge->SetFillColor(kGreen - 9);
1193  ge->SetLineWidth(3);
1194  // ge->Draw("3");
1195  ge->SetLineStyle(kDashed);
1196  ge->SetName("MergeExtractRejCurve_" + kine_config + "_2GeV");
1197  ge->Draw("lx");
1198 
1199  leg2->Draw();
1200  leg1->Draw();
1201 
1202  SaveCanvas(c1,
1203  base_dir + TString("DrawEcal_Likelihood_Sum_") + TString(c1->GetName()));
1204 }
1205 
1206 void
1208  TString base_dir =
1209  "../../sPHENIX_work/production_analysis_cemc2x2/embedding/emcstudies/pidstudies/spacal2d/fieldmap/",
1210  TString label = "2-D Proj. SPACAL, e^{-} VS h^{+} in Au+Au 10%C", //
1211  const double min_eff = 0.6)
1212 {
1213 
1214  TCanvas *c1 = new TCanvas("RejectionCurve_AuAuSummaryPos",
1215  "RejectionCurve_AuAuSummaryPos: " + label, 900, 900);
1216  c1->Divide(1, 1);
1217  int idx = 1;
1218  TPad * p;
1219 
1220  p = (TPad *) c1->cd(idx++);
1221  c1->Update();
1222  p->SetLogy();
1223  p->SetGridx(0);
1224  p->SetGridy(0);
1225 
1226  p->DrawFrame(min_eff, 1, 1, 1e3,
1227  ";Electron Efficiency;Positively Charged Hadron Rejection");
1228  TLine * l = new TLine(0.9, 1, 0.9, 1e3);
1229  l->SetLineColor(kGray);
1230  l->SetLineWidth(5);
1231  l->Draw();
1232 
1233  TLatex * text = new TLatex(0.6, 1e3 * 1.2, label);
1234  text->SetTextAlign(11);
1235  text->SetTextSize(0.044);
1236  text->SetTextFont(42);
1237  text->Draw();
1238 
1239  TLegend * leg1 = new TLegend(0.12, 0.15, 0.42, 0.4);
1240  TLegend * leg2 = new TLegend(0.42, 0.15, 0.67, 0.4);
1241 
1242  TGraphErrors *ge = new TGraphErrors();
1243  ge->SetLineWidth(3);
1244  leg1->AddEntry(ge, "0.0 < #eta < 0.1", "lx");
1245  TGraphErrors *ge = new TGraphErrors();
1246  ge->SetLineWidth(3);
1247  ge->SetLineStyle(kDashed);
1248  leg1->AddEntry(ge, "0.9 < #eta < 1.0", "lx");
1249 // TGraphErrors *ge = new TGraphErrors();
1250 // ge->SetLineWidth(3);
1251 // ge->SetLineStyle(kDotted);
1252 // leg1->AddEntry(ge, "Cut on min. E/p", "lx");
1253 
1254  TString kine_config = "eta0";
1255  const double pt_over_p = 0.998;
1256 
1257  TGraphErrors *ge_pi = ExtractRejCurve(base_dir, kine_config + "_8GeV", //
1258  "Edep_LL_Distribution_eval_sample", "hll_edep_diff", "e+", "pi+");
1259  TGraphErrors *ge_kaon = ExtractRejCurve(base_dir, kine_config + "_8GeV", //
1260  "Edep_LL_Distribution_eval_sample", "hll_edep_diff", "e+", "kaon+");
1261  TGraphErrors *ge_anti_proton = ExtractRejCurve(base_dir,
1262  kine_config + "_8GeV", //
1263  "Edep_LL_Distribution_eval_sample", "hll_edep_diff", "e+", "proton");
1264  TGraphErrors *ge = MergeRejCurve(ge_pi, 1, ge_kaon,
1265  GetHPiRatio(8, "kaon+", "AuAu10%C"), ge_anti_proton,
1266  GetHPiRatio(8, "proton", "AuAu10%C"));
1267  ge->SetLineColor(kRed + 2);
1268  ge->SetMarkerColor(kRed + 2);
1269  ge->SetFillColor(kRed - 9);
1270  ge->SetLineWidth(3);
1271 // ge->Draw("3");
1272  ge->SetName("MergeExtractRejCurve_" + kine_config + "_8GeV");
1273  ge->Draw("lx");
1274  leg2->AddEntry(ge, "8 GeV/c", "lx");
1275 
1276  TGraphErrors *ge_pi = ExtractRejCurve(base_dir, kine_config + "_4GeV", //
1277  "Edep_LL_Distribution_eval_sample", "hll_edep_diff", "e+", "pi+");
1278  TGraphErrors *ge_kaon = ExtractRejCurve(base_dir, kine_config + "_8GeV", //
1279  "Edep_LL_Distribution_eval_sample", "hll_edep_diff", "e+", "kaon+");
1280  TGraphErrors *ge_anti_proton = ExtractRejCurve(base_dir,
1281  kine_config + "_4GeV", //
1282  "Edep_LL_Distribution_eval_sample", "hll_edep_diff", "e+", "proton");
1283  TGraphErrors *ge = MergeRejCurve(ge_pi, 1, ge_kaon,
1284  GetHPiRatio(4, "kaon+", "AuAu10%C"), ge_anti_proton,
1285  GetHPiRatio(4, "proton", "AuAu10%C"));
1286  ge->SetLineColor(kBlue + 2);
1287  ge->SetMarkerColor(kBlue + 2);
1288  ge->SetFillColor(kBlue - 9);
1289  ge->SetLineWidth(3);
1290  // ge->Draw("3");
1291  ge->SetName("MergeExtractRejCurve_" + kine_config + "_4GeV");
1292  ge->Draw("lx");
1293  leg2->AddEntry(ge, "4 GeV/c", "lx");
1294 
1295  TGraphErrors *ge_pi = ExtractRejCurve(base_dir, kine_config + "_2GeV", //
1296  "Edep_LL_Distribution_eval_sample", "hll_edep_diff", "e+", "pi+");
1297  TGraphErrors *ge_kaon = ExtractRejCurve(base_dir, kine_config + "_8GeV", //
1298  "Edep_LL_Distribution_eval_sample", "hll_edep_diff", "e+", "kaon+");
1299  TGraphErrors *ge_anti_proton = ExtractRejCurve(base_dir,
1300  kine_config + "_2GeV", //
1301  "Edep_LL_Distribution_eval_sample", "hll_edep_diff", "e+", "proton");
1302  TGraphErrors *ge = MergeRejCurve(ge_pi, 1, ge_kaon,
1303  GetHPiRatio(2, "kaon+", "AuAu10%C"), ge_anti_proton,
1304  GetHPiRatio(2, "proton", "AuAu10%C"));
1305  ge->SetLineColor(kGreen + 3);
1306  ge->SetMarkerColor(kGreen + 3);
1307  ge->SetFillColor(kGreen - 9);
1308  ge->SetLineWidth(3);
1309  // ge->Draw("3");
1310  ge->Draw("lx");
1311  ge->SetName("MergeExtractRejCurve_" + kine_config + "_2GeV");
1312  leg2->AddEntry(ge, "2 GeV/c", "lx");
1313 
1314  TString kine_config = "eta0.90";
1315  const double pt_over_p = 0.673;
1316 
1317  TGraphErrors *ge_pi = ExtractRejCurve(base_dir, kine_config + "_8GeV", //
1318  "Edep_LL_Distribution_eval_sample", "hll_edep_diff", "e+", "pi+");
1319  TGraphErrors *ge_kaon = ExtractRejCurve(base_dir, kine_config + "_8GeV", //
1320  "Edep_LL_Distribution_eval_sample", "hll_edep_diff", "e+", "kaon+");
1321  TGraphErrors *ge_anti_proton = ExtractRejCurve(base_dir,
1322  kine_config + "_8GeV", //
1323  "Edep_LL_Distribution_eval_sample", "hll_edep_diff", "e+", "proton");
1324  TGraphErrors *ge = MergeRejCurve(ge_pi, 1, ge_kaon,
1325  GetHPiRatio(8, "kaon+", "AuAu10%C"), ge_anti_proton,
1326  GetHPiRatio(8, "proton", "AuAu10%C"));
1327  ge->SetLineColor(kRed + 2);
1328  ge->SetMarkerColor(kRed + 2);
1329  ge->SetFillColor(kRed - 9);
1330  ge->SetLineWidth(3);
1331 // ge->Draw("3");
1332  ge->SetLineStyle(kDashed);
1333  ge->SetName("MergeExtractRejCurve_" + kine_config + "_8GeV");
1334  ge->Draw("lx");
1335 
1336  TGraphErrors *ge_pi = ExtractRejCurve(base_dir, kine_config + "_4GeV", //
1337  "Edep_LL_Distribution_eval_sample", "hll_edep_diff", "e+", "pi+");
1338  TGraphErrors *ge_kaon = ExtractRejCurve(base_dir, kine_config + "_8GeV", //
1339  "Edep_LL_Distribution_eval_sample", "hll_edep_diff", "e+", "kaon+");
1340  TGraphErrors *ge_anti_proton = ExtractRejCurve(base_dir,
1341  kine_config + "_4GeV", //
1342  "Edep_LL_Distribution_eval_sample", "hll_edep_diff", "e+", "proton");
1343  TGraphErrors *ge = MergeRejCurve(ge_pi, 1, ge_kaon,
1344  GetHPiRatio(4, "kaon+", "AuAu10%C"), ge_anti_proton,
1345  GetHPiRatio(4, "proton", "AuAu10%C"));
1346  ge->SetLineColor(kBlue + 2);
1347  ge->SetMarkerColor(kBlue + 2);
1348  ge->SetFillColor(kBlue - 9);
1349  ge->SetLineWidth(3);
1350  // ge->Draw("3");
1351  ge->SetLineStyle(kDashed);
1352  ge->SetName("MergeExtractRejCurve_" + kine_config + "_4GeV");
1353  ge->Draw("lx");
1354 
1355  TGraphErrors *ge_pi = ExtractRejCurve(base_dir, kine_config + "_2GeV", //
1356  "Edep_LL_Distribution_eval_sample", "hll_edep_diff", "e+", "pi+");
1357  TGraphErrors *ge_kaon = ExtractRejCurve(base_dir, kine_config + "_8GeV", //
1358  "Edep_LL_Distribution_eval_sample", "hll_edep_diff", "e+", "kaon+");
1359  TGraphErrors *ge_anti_proton = ExtractRejCurve(base_dir,
1360  kine_config + "_2GeV", //
1361  "Edep_LL_Distribution_eval_sample", "hll_edep_diff", "e+", "proton");
1362  TGraphErrors *ge = MergeRejCurve(ge_pi, 1, ge_kaon,
1363  GetHPiRatio(2, "kaon+", "AuAu10%C"), ge_anti_proton,
1364  GetHPiRatio(2, "proton", "AuAu10%C"));
1365  ge->SetLineColor(kGreen + 3);
1366  ge->SetMarkerColor(kGreen + 3);
1367  ge->SetFillColor(kGreen - 9);
1368  ge->SetLineWidth(3);
1369  // ge->Draw("3");
1370  ge->SetLineStyle(kDashed);
1371  ge->SetName("MergeExtractRejCurve_" + kine_config + "_2GeV");
1372  ge->Draw("lx");
1373 
1374  leg2->Draw();
1375  leg1->Draw();
1376 
1377  SaveCanvas(c1,
1378  base_dir + TString("DrawEcal_Likelihood_Sum_") + TString(c1->GetName()));
1379 }
1380 
1381 TGraph *
1382 rejection_ratio(TFile * f_2d, TFile * f_1d, TString graph_name)
1383 {
1384  cout << "rejection_ratio - processing " << graph_name << endl;
1385 
1386  TGraph * g_2d = (TGraph *) f_2d->GetObjectChecked(graph_name, "TGraph");
1387  assert(g_2d);
1388  TGraph * g_1d = (TGraph *) f_1d->GetObjectChecked(graph_name, "TGraph");
1389  assert(g_1d);
1390 
1391  assert(g_1d -> GetN() == g_2d -> GetN());
1392 
1393  double xs[10000] =
1394  { 0 };
1395  double ys[10000] =
1396  { 0 };
1397 
1398 // for (int i = 0; i < g_2d->GetN(); i++)
1399 // {
1400 //
1401 // (g_r->GetY())[i] = (g_2d->GetY())[i] / (g_1d->GetY())[i];
1402 //
1405 //
1406 // }
1407 
1408  int i = 0;
1409  for (double x = 0.6; x < 0.99; x += 0.01)
1410  {
1411  xs[i] = x;
1412 
1413  ys[i] = g_2d->Eval(x) / g_1d->Eval(x);
1414 
1415  cout << "At " << xs[i] << " -> " << g_2d->Eval(x) << "/"
1416  << g_1d->Eval(x) << " = " << ys[i] << endl;
1417  i++;
1418  }
1419 
1420  TGraph * g_r = new TGraph(i, xs, ys);
1421  g_r->SetName(TString(g_1d->GetName()) + TString("_RejRatio"));
1422 
1423  g_r->SetLineStyle(g_2d->GetLineStyle());
1424 
1425  g_r->SetLineColor(g_2d->GetLineColor());
1426  g_r->SetLineWidth(g_2d->GetLineWidth());
1427 
1428  return g_r;
1429 }
1430 
1431 void
1433 {
1434 
1435  TString base_dir =
1436  "../../sPHENIX_work/production_analysis_cemc2x2/embedding/emcstudies/pidstudies/";
1437  TString label = "1D VS 2D rejection ratio, e^{-} VS h^{-} in Au+Au 10%C"; //
1438  const double min_eff = 0.6;
1439 
1440  TFile * f_2d =
1441  new TFile(
1442  base_dir
1443  + "/spacal2d/fieldmap/DrawEcal_Likelihood_Sum_RejectionCurve_AuAuSummary.root");
1444  assert(f_2d -> IsOpen());
1445  TFile * f_1d =
1446  new TFile(
1447  base_dir
1448  + "/spacal1d/fieldmap/DrawEcal_Likelihood_Sum_RejectionCurve_AuAuSummary.root");
1449  assert(f_1d -> IsOpen());
1450 
1451  TCanvas *c1 = new TCanvas("RejectionCurve_AuAuSummary_Compare",
1452  "RejectionCurve_AuAuSummary_Compare", 900, 900);
1453  c1->Divide(1, 1);
1454  int idx = 1;
1455  TPad * p;
1456 
1457  p = (TPad *) c1->cd(idx++);
1458  c1->Update();
1459 // p->SetLogy();
1460  p->SetGridx(0);
1461  p->SetGridy(0);
1462 
1463  p->DrawFrame(min_eff, .5, 1, 1.5,
1464  ";Electron Efficiency;h^{-} Rejection Ratio, (2D proj.)/(1D proj.)");
1465  TLine * l = new TLine(min_eff, 1, 1, 1);
1466  l->SetLineColor(kGray);
1467  l->SetLineWidth(2);
1468  l->Draw();
1469 
1470  TLatex * text = new TLatex(0.6, 1.5 +0.03, label);
1471  text->SetTextAlign(11);
1472  text->SetTextSize(0.044);
1473  text->SetTextFont(42);
1474  text->Draw();
1475 
1476  TLegend * leg1 = new TLegend(0.12, 0.15, 0.42, 0.4);
1477  TLegend * leg2 = new TLegend(0.42, 0.15, 0.67, 0.4);
1478 
1479  TGraph *ge = new TGraphErrors();
1480  ge->SetLineWidth(3);
1481  leg1->AddEntry(ge, "0.0 < #eta < 0.1", "lx");
1482  TGraph *ge = new TGraphErrors();
1483  ge->SetLineWidth(3);
1484  ge->SetLineStyle(kDashed);
1485  leg1->AddEntry(ge, "0.9 < #eta < 1.0", "lx");
1486 // TGraphErrors *ge = new TGraphErrors();
1487 // ge->SetLineWidth(3);
1488 // ge->SetLineStyle(kDotted);
1489 // leg1->AddEntry(ge, "Cut on min. E/p", "lx");
1490 
1491  TString kine_config = "eta0";
1492 
1493  TString name = ("MergeExtractRejCurve_" + kine_config + "_8GeV");
1494  TGraph * ge = rejection_ratio(f_2d, f_1d, name);
1495 
1496 // ge->Draw("lx");
1497 // leg2->AddEntry(ge, "8 GeV/c", "lx");
1498 
1499  TString name = ("MergeExtractRejCurve_" + kine_config + "_4GeV");
1500  TGraph * ge = rejection_ratio(f_2d, f_1d, name);
1501  ge->Draw("lx");
1502  leg2->AddEntry(ge, "4 GeV/c", "lx");
1503 
1504  TString name = ("MergeExtractRejCurve_" + kine_config + "_2GeV");
1505  TGraph * ge = rejection_ratio(f_2d, f_1d, name);
1506  ge->Draw("lx");
1507  leg2->AddEntry(ge, "2 GeV/c", "lx");
1508 
1509  TString kine_config = "eta0.90";
1510 
1511  TString name = ("MergeExtractRejCurve_" + kine_config + "_8GeV");
1512  TGraph * ge = rejection_ratio(f_2d, f_1d, name);
1513 // ge->Draw("lx");
1514 
1515  TString name = ("MergeExtractRejCurve_" + kine_config + "_4GeV");
1516  TGraph * ge = rejection_ratio(f_2d, f_1d, name);
1517  ge->Draw("lx");
1518 
1519  TString name = ("MergeExtractRejCurve_" + kine_config + "_2GeV");
1520  TGraph * ge = rejection_ratio(f_2d, f_1d, name);
1521  ge->Draw("lx");
1522 
1523  leg2->Draw();
1524  leg1->Draw();
1525 
1526  SaveCanvas(c1,
1527  base_dir + TString("DrawEcal_Likelihood_Sum_") + TString(c1->GetName()));
1528 }
1529 
1530 void
1532 {
1533 
1534  TString base_dir =
1535  "../../sPHENIX_work/production_analysis_cemc2x2/embedding/emcstudies/pidstudies/";
1536  TString base_dir2 =
1537  "../../sPHENIX_work/production_analysis/embedding/emcstudies/pidstudies/";
1538  TString label = "2x2-Ganging rej. ratio, e^{-} VS h^{-} in Au+Au 10%C"; //
1539  const double min_eff = 0.6;
1540 
1541  TFile * f_2d =
1542  new TFile(
1543  base_dir
1544  + "/spacal2d/fieldmap/DrawEcal_Likelihood_Sum_RejectionCurve_AuAuSummary.root");
1545  assert(f_2d -> IsOpen());
1546  TFile * f_1d =
1547  new TFile(
1548  base_dir2
1549  + "/spacal2d/fieldmap/DrawEcal_Likelihood_Sum_RejectionCurve_AuAuSummary.root");
1550  assert(f_1d -> IsOpen());
1551 
1552  TCanvas *c1 = new TCanvas("RejectionCurve_AuAuSummary_Compare2",
1553  "RejectionCurve_AuAuSummary_Compare2", 900, 900);
1554  c1->Divide(1, 1);
1555  int idx = 1;
1556  TPad * p;
1557 
1558  p = (TPad *) c1->cd(idx++);
1559  c1->Update();
1560 // p->SetLogy();
1561  p->SetGridx(0);
1562  p->SetGridy(0);
1563 
1564  p->DrawFrame(min_eff, .0, 1, 1.1,
1565  ";Electron Efficiency;h^{-} Rejection Ratio, (2x2 Ganging)/(Nominal)");
1566  TLine * l = new TLine(min_eff, 1, 1, 1);
1567  l->SetLineColor(kGray);
1568  l->SetLineWidth(2);
1569  l->Draw();
1570 
1571  TLatex * text = new TLatex(0.6, 1.1 +0.03, label);
1572  text->SetTextAlign(11);
1573  text->SetTextSize(0.044);
1574  text->SetTextFont(42);
1575  text->Draw();
1576 
1577  TLegend * leg1 = new TLegend(0.12, 0.15, 0.42, 0.4);
1578  TLegend * leg2 = new TLegend(0.42, 0.15, 0.67, 0.4);
1579 
1580  TGraph *ge = new TGraphErrors();
1581  ge->SetLineWidth(3);
1582  leg1->AddEntry(ge, "0.0 < #eta < 0.1", "lx");
1583  TGraph *ge = new TGraphErrors();
1584  ge->SetLineWidth(3);
1585  ge->SetLineStyle(kDashed);
1586  leg1->AddEntry(ge, "0.9 < #eta < 1.0", "lx");
1587 
1588  TString kine_config = "eta0";
1589 
1590  TString name = ("MergeExtractRejCurve_" + kine_config + "_8GeV");
1591  TGraph * ge = rejection_ratio(f_2d, f_1d, name);
1592 
1593  ge->Draw("lx");
1594  leg2->AddEntry(ge, "8 GeV/c", "lx");
1595 
1596  TString name = ("MergeExtractRejCurve_" + kine_config + "_4GeV");
1597  TGraph * ge = rejection_ratio(f_2d, f_1d, name);
1598  ge->Draw("lx");
1599  leg2->AddEntry(ge, "4 GeV/c", "lx");
1600 
1601  TString name = ("MergeExtractRejCurve_" + kine_config + "_2GeV");
1602  TGraph * ge = rejection_ratio(f_2d, f_1d, name);
1603  ge->Draw("lx");
1604  leg2->AddEntry(ge, "2 GeV/c", "lx");
1605 
1606  TString kine_config = "eta0.90";
1607 
1608  TString name = ("MergeExtractRejCurve_" + kine_config + "_8GeV");
1609  TGraph * ge = rejection_ratio(f_2d, f_1d, name);
1610  ge->Draw("lx");
1611 
1612  TString name = ("MergeExtractRejCurve_" + kine_config + "_4GeV");
1613  TGraph * ge = rejection_ratio(f_2d, f_1d, name);
1614  ge->Draw("lx");
1615 
1616  TString name = ("MergeExtractRejCurve_" + kine_config + "_2GeV");
1617  TGraph * ge = rejection_ratio(f_2d, f_1d, name);
1618  ge->Draw("lx");
1619 
1620  leg2->Draw();
1621  leg1->Draw();
1622 
1623  SaveCanvas(c1,
1624  base_dir + TString("DrawEcal_Likelihood_Sum_") + TString(c1->GetName()));
1625 }
1626 
1627 void
1629  TString base_dir =
1630  "../../sPHENIX_work/production_analysis_cemc2x2/emcstudies/pidstudies/spacal2d/fieldmap/",
1631  TString kine_config = "eta0", //
1632  const double min_eff = 0.85)
1633 {
1634 
1635  TCanvas *c1 = new TCanvas(
1636  "RejectionCurve_RejMethodComparison_AntiProton_" + kine_config,
1637  "RejectionCurve_RejMethodComparison_AntiProton_" + kine_config, 900, 900);
1638  c1->Divide(1, 1);
1639  int idx = 1;
1640  TPad * p;
1641 
1642  p = (TPad *) c1->cd(idx++);
1643  c1->Update();
1644  p->SetLogy();
1645  p->SetGridx(0);
1646  p->SetGridy(0);
1647 
1648  p->DrawFrame(min_eff, 1, 1, 1e3, ";Electron Efficiency;Hadron Rejection");
1649  TLine * l = new TLine(0.95, 1, 0.95, 1e3);
1650  l->SetLineColor(kGray);
1651  l->SetLineWidth(5);
1652  l->Draw();
1653 
1654  TLatex * text = new TLatex(0.85, 1e3 * 1.2,
1655  "2-D Proj. SPACAL, e^{-}-#bar{p} separation @ 0 < #eta < 0.1");
1656  text->SetTextAlign(11);
1657  text->SetTextSize(0.044);
1658  text->SetTextFont(42);
1659  text->Draw();
1660 
1661  TLegend * leg1 = new TLegend(0.12, 0.15, 0.65, 0.4);
1662  TLegend * leg2 = new TLegend(0.65, 0.15, 0.85, 0.4);
1663 
1664  TGraphErrors *ge = new TGraphErrors();
1665  ge->SetLineWidth(3);
1666  leg1->AddEntry(ge, "EMCal+HCal Likelihood", "lx");
1667  TGraphErrors *ge = new TGraphErrors();
1668  ge->SetLineWidth(3);
1669  ge->SetLineStyle(kDashed);
1670  leg1->AddEntry(ge, "EMCal E/p Likelihood", "lx");
1671  TGraphErrors *ge = new TGraphErrors();
1672  ge->SetLineWidth(3);
1673  ge->SetLineStyle(kDotted);
1674  leg1->AddEntry(ge, "Cut on min. E/p", "lx");
1675 
1676  TGraphErrors *ge = ExtractRejCurve(base_dir, kine_config + "_8GeV", //
1677  "Edep_LL_Distribution_eval_sample", "hll_edep_diff", "e-", "anti_proton");
1678  ge->SetLineColor(kRed + 2);
1679  ge->SetMarkerColor(kRed + 2);
1680  ge->SetFillColor(kRed - 9);
1681  ge->SetLineWidth(3);
1682 // ge->Draw("3");
1683  ge->Draw("lx");
1684  leg2->AddEntry(ge, "8 GeV/c", "lx");
1685  TGraphErrors *ge = ExtractRejCurve(base_dir, kine_config + "_8GeV", //
1686  "EP_LL_Distribution_eval_sample", "hll_ep_diff", "e-", "anti_proton");
1687  ge->SetLineColor(kRed + 2);
1688  ge->SetMarkerColor(kRed + 2);
1689  ge->SetFillColor(kRed - 9);
1690  ge->SetLineWidth(3);
1691  ge->SetLineStyle(kDashed);
1692 // ge->Draw("3");
1693  ge->Draw("lx");
1694  TGraphErrors *ge = ExtractRejCurve(base_dir, kine_config + "_8GeV", //
1695  "Ep_Checks_eval_sample", "hEMCalTrk_get_ep", "e-", "anti_proton");
1696  ge->SetLineColor(kRed + 2);
1697  ge->SetMarkerColor(kRed + 2);
1698  ge->SetFillColor(kRed - 9);
1699  ge->SetLineWidth(3);
1700  ge->SetLineStyle(kDotted);
1701 // ge->Draw("3");
1702  ge->Draw("lx");
1703 
1704  TGraphErrors *ge = ExtractRejCurve(base_dir, kine_config + "_4GeV", //
1705  "Edep_LL_Distribution_eval_sample", "hll_edep_diff", "e-", "anti_proton");
1706  ge->SetLineColor(kBlue + 2);
1707  ge->SetMarkerColor(kBlue + 2);
1708  ge->SetFillColor(kBlue - 9);
1709  ge->SetLineWidth(3);
1710 // ge->Draw("3");
1711  ge->Draw("lx");
1712  leg2->AddEntry(ge, "4 GeV/c", "lx");
1713  TGraphErrors *ge = ExtractRejCurve(base_dir, kine_config + "_4GeV", //
1714  "EP_LL_Distribution_eval_sample", "hll_ep_diff", "e-", "anti_proton");
1715  ge->SetLineColor(kBlue + 2);
1716  ge->SetMarkerColor(kBlue + 2);
1717  ge->SetFillColor(kBlue - 9);
1718  ge->SetLineWidth(3);
1719  ge->SetLineStyle(kDashed);
1720 // ge->Draw("3");
1721  ge->Draw("lx");
1722  TGraphErrors *ge = ExtractRejCurve(base_dir, kine_config + "_4GeV", //
1723  "Ep_Checks_eval_sample", "hEMCalTrk_get_ep", "e-", "anti_proton");
1724  ge->SetLineColor(kBlue + 2);
1725  ge->SetMarkerColor(kBlue + 2);
1726  ge->SetFillColor(kBlue - 9);
1727  ge->SetLineWidth(3);
1728  ge->SetLineStyle(kDotted);
1729 // ge->Draw("3");
1730  ge->Draw("lx");
1731 //
1732  TGraphErrors *ge = ExtractRejCurve(base_dir, kine_config + "_2GeV", //
1733  "Edep_LL_Distribution_eval_sample", "hll_edep_diff", "e-", "anti_proton");
1734  ge->SetLineColor(kGreen + 3);
1735  ge->SetMarkerColor(kGreen + 3);
1736  ge->SetFillColor(kGreen - 9);
1737  ge->SetLineWidth(3);
1738 // ge->Draw("3");
1739  ge->Draw("lx");
1740  leg2->AddEntry(ge, "2 GeV/c", "lx");
1741  TGraphErrors *ge = ExtractRejCurve(base_dir, kine_config + "_2GeV", //
1742  "EP_LL_Distribution_eval_sample", "hll_ep_diff", "e-", "anti_proton");
1743  ge->SetLineColor(kGreen + 3);
1744  ge->SetMarkerColor(kGreen + 3);
1745  ge->SetFillColor(kGreen - 9);
1746  ge->SetLineWidth(3);
1747  ge->SetLineStyle(kDashed);
1748 // ge->Draw("3");
1749  ge->Draw("lx");
1750  TGraphErrors *ge = ExtractRejCurve(base_dir, kine_config + "_2GeV", //
1751  "Ep_Checks_eval_sample", "hEMCalTrk_get_ep", "e-", "anti_proton");
1752  ge->SetLineColor(kGreen + 3);
1753  ge->SetMarkerColor(kGreen + 3);
1754  ge->SetFillColor(kGreen - 9);
1755  ge->SetLineWidth(3);
1756  ge->SetLineStyle(kDotted);
1757 // ge->Draw("3");
1758  ge->Draw("lx");
1759 
1760  leg2->Draw();
1761  leg1->Draw();
1762 
1763  SaveCanvas(c1,
1764  base_dir + TString("DrawEcal_Likelihood_Sum_") + TString(c1->GetName()));
1765 }
1766 
1767 void
1769  TString base_dir =
1770  "../../sPHENIX_work/production_analysis_cemc2x2/emcstudies/pidstudies/spacal2d/fieldmap/",
1771  TString kine_config = "eta0", //
1772  const double min_eff = 0.85)
1773 {
1774 
1775  TCanvas *c1 = new TCanvas("RejectionCurve_PIDComparison_" + kine_config,
1776  "RejectionCurve_PIDComparison_" + kine_config, 900, 900);
1777  c1->Divide(1, 1);
1778  int idx = 1;
1779  TPad * p;
1780 
1781  p = (TPad *) c1->cd(idx++);
1782  c1->Update();
1783  p->SetLogy();
1784  p->SetGridx(0);
1785  p->SetGridy(0);
1786 
1787  p->DrawFrame(min_eff, 10, 1, 1e3, ";Electron Efficiency;Hadron Rejection");
1788  TLine * l = new TLine(0.95, 10, 0.95, 1e3);
1789  l->SetLineColor(kGray);
1790  l->SetLineWidth(5);
1791  l->Draw();
1792 
1793  TLatex * text = new TLatex(0.85, 1e3 * 1.1,
1794  "2-D Proj. SPACAL, e^{-}-#pi^{-} separation @ 0 < #eta < 0.1");
1795  text->SetTextAlign(11);
1796  text->SetTextSize(0.044);
1797  text->SetTextFont(42);
1798  text->Draw();
1799 
1800  TLegend * leg1 = new TLegend(0.12, 0.15, 0.65, 0.4);
1801  TLegend * leg2 = new TLegend(0.65, 0.15, 0.85, 0.4);
1802 
1803  TGraphErrors *ge = new TGraphErrors();
1804  ge->SetLineWidth(3);
1805  leg1->AddEntry(ge, "EMCal+HCal Likelihood", "lx");
1806  TGraphErrors *ge = new TGraphErrors();
1807  ge->SetLineWidth(3);
1808  ge->SetLineStyle(kDashed);
1809  leg1->AddEntry(ge, "EMCal E/p Likelihood", "lx");
1810  TGraphErrors *ge = new TGraphErrors();
1811  ge->SetLineWidth(3);
1812  ge->SetLineStyle(kDotted);
1813  leg1->AddEntry(ge, "Cut on min. E/p", "lx");
1814 
1815  TGraphErrors *ge = ExtractRejCurve(base_dir, kine_config + "_8GeV", //
1816  "Edep_LL_Distribution_eval_sample", "hll_edep_diff");
1817  ge->SetLineColor(kRed + 2);
1818  ge->SetMarkerColor(kRed + 2);
1819  ge->SetFillColor(kRed - 9);
1820  ge->SetLineWidth(3);
1821 // ge->Draw("3");
1822  ge->Draw("lx");
1823  leg2->AddEntry(ge, "8 GeV/c", "lx");
1824  TGraphErrors *ge = ExtractRejCurve(base_dir, kine_config + "_8GeV", //
1825  "EP_LL_Distribution_eval_sample", "hll_ep_diff");
1826  ge->SetLineColor(kRed + 2);
1827  ge->SetMarkerColor(kRed + 2);
1828  ge->SetFillColor(kRed - 9);
1829  ge->SetLineWidth(3);
1830  ge->SetLineStyle(kDashed);
1831 // ge->Draw("3");
1832  ge->Draw("lx");
1833  TGraphErrors *ge = ExtractRejCurve(base_dir, kine_config + "_8GeV", //
1834  "Ep_Checks_eval_sample", "hEMCalTrk_get_ep");
1835  ge->SetLineColor(kRed + 2);
1836  ge->SetMarkerColor(kRed + 2);
1837  ge->SetFillColor(kRed - 9);
1838  ge->SetLineWidth(3);
1839  ge->SetLineStyle(kDotted);
1840 // ge->Draw("3");
1841  ge->Draw("lx");
1842 
1843  TGraphErrors *ge = ExtractRejCurve(base_dir, kine_config + "_4GeV", //
1844  "Edep_LL_Distribution_eval_sample", "hll_edep_diff");
1845  ge->SetLineColor(kBlue + 2);
1846  ge->SetMarkerColor(kBlue + 2);
1847  ge->SetFillColor(kBlue - 9);
1848  ge->SetLineWidth(3);
1849 // ge->Draw("3");
1850  ge->Draw("lx");
1851  leg2->AddEntry(ge, "4 GeV/c", "lx");
1852  TGraphErrors *ge = ExtractRejCurve(base_dir, kine_config + "_4GeV", //
1853  "EP_LL_Distribution_eval_sample", "hll_ep_diff");
1854  ge->SetLineColor(kBlue + 2);
1855  ge->SetMarkerColor(kBlue + 2);
1856  ge->SetFillColor(kBlue - 9);
1857  ge->SetLineWidth(3);
1858  ge->SetLineStyle(kDashed);
1859 // ge->Draw("3");
1860  ge->Draw("lx");
1861  TGraphErrors *ge = ExtractRejCurve(base_dir, kine_config + "_4GeV", //
1862  "Ep_Checks_eval_sample", "hEMCalTrk_get_ep");
1863  ge->SetLineColor(kBlue + 2);
1864  ge->SetMarkerColor(kBlue + 2);
1865  ge->SetFillColor(kBlue - 9);
1866  ge->SetLineWidth(3);
1867  ge->SetLineStyle(kDotted);
1868 // ge->Draw("3");
1869  ge->Draw("lx");
1870 //
1871  TGraphErrors *ge = ExtractRejCurve(base_dir, kine_config + "_2GeV", //
1872  "Edep_LL_Distribution_eval_sample", "hll_edep_diff");
1873  ge->SetLineColor(kGreen + 3);
1874  ge->SetMarkerColor(kGreen + 3);
1875  ge->SetFillColor(kGreen - 9);
1876  ge->SetLineWidth(3);
1877 // ge->Draw("3");
1878  ge->Draw("lx");
1879  leg2->AddEntry(ge, "2 GeV/c", "lx");
1880  TGraphErrors *ge = ExtractRejCurve(base_dir, kine_config + "_2GeV", //
1881  "EP_LL_Distribution_eval_sample", "hll_ep_diff");
1882  ge->SetLineColor(kGreen + 3);
1883  ge->SetMarkerColor(kGreen + 3);
1884  ge->SetFillColor(kGreen - 9);
1885  ge->SetLineWidth(3);
1886  ge->SetLineStyle(kDashed);
1887 // ge->Draw("3");
1888  ge->Draw("lx");
1889  TGraphErrors *ge = ExtractRejCurve(base_dir, kine_config + "_2GeV", //
1890  "Ep_Checks_eval_sample", "hEMCalTrk_get_ep");
1891  ge->SetLineColor(kGreen + 3);
1892  ge->SetMarkerColor(kGreen + 3);
1893  ge->SetFillColor(kGreen - 9);
1894  ge->SetLineWidth(3);
1895  ge->SetLineStyle(kDotted);
1896 // ge->Draw("3");
1897  ge->Draw("lx");
1898 
1899  leg2->Draw();
1900  leg1->Draw();
1901 
1902  SaveCanvas(c1,
1903  base_dir + TString("DrawEcal_Likelihood_Sum_") + TString(c1->GetName()));
1904 }
1905 
1906 TGraphErrors *
1908  TString base_dir =
1909  "../../sPHENIX_work/production_analysis_cemc2x2/emcstudies/pidstudies/spacal2d/fieldmap/",
1910  TString kine_config = "eta0_4GeV", //
1911  TString ll_config = "EP_LL_Distribution_ll_sample", //
1912  TString hist_name = "hll_ep_diff", //
1913  TString signal = "e-", TString background = "pi-")
1914 {
1915  TH1F * hll_edep_diff_e = NULL;
1916  TH1F * hll_edep_diff_pi = NULL;
1917  {
1918  TFile * f =
1919  new TFile(
1920  base_dir + "G4Hits_sPHENIX_" + signal + "_" + kine_config
1921  + "-ALL.root_Ana.root.lst_EMCalLikelihood.root_DrawEcal_Likelihood_"
1922  + ll_config + ".root");
1923 
1924  assert(f);
1925 
1926  hll_edep_diff_e = (TH1F *) f->GetObjectChecked(hist_name, "TH1F");
1927 
1928  assert(hll_edep_diff_e);
1929  }
1930 
1931  {
1932  TFile * f =
1933  new TFile(
1934  base_dir + "/G4Hits_sPHENIX_" + background + "_" + kine_config
1935  + "-ALL.root_Ana.root.lst_EMCalLikelihood.root_DrawEcal_Likelihood_"
1936  + ll_config + ".root");
1937 
1938  assert(f);
1939 
1940  hll_edep_diff_pi = (TH1F *) f->GetObjectChecked(hist_name, "TH1F");
1941 
1942  assert(hll_edep_diff_pi);
1943  }
1944  assert(hll_edep_diff_e->GetNbinsX() == hll_edep_diff_pi->GetNbinsX());
1945 
1946  double threshold[10000] =
1947  { 0 };
1948  double eff_e[10000] =
1949  { 0 };
1950  double eff_err_e[10000] =
1951  { 0 };
1952  double rej_pi[10000] =
1953  { 0 };
1954  double rej_err_pi[10000] =
1955  { 0 };
1956 
1957  const double n_e = hll_edep_diff_e->GetSum();
1958  double pass = 0;
1959  int cnt = 0;
1960 
1961  for (int i = hll_edep_diff_e->GetNbinsX(); i >= 1; i--)
1962  {
1963  pass += hll_edep_diff_e->GetBinContent(i);
1964 
1965  const double pp = pass / n_e;
1966  // const double z = 1.96;
1967  const double z = 1.;
1968 
1969  const double A = z
1970  * sqrt(1. / n_e * pp * (1 - pp) + z * z / 4 / n_e / n_e);
1971  const double B = 1 / (1 + z * z / n_e);
1972 
1973  threshold[cnt] = hll_edep_diff_e->GetBinCenter(i);
1974  eff_e[cnt] = (pp + z * z / 2 / n_e) * B;
1975  eff_err_e[cnt] = A * B;
1976 
1977  cnt++;
1978  }
1979 
1980  const double n_pi = hll_edep_diff_pi->GetSum();
1981  double pass = 0;
1982  int cnt = 0;
1983 
1984  for (int i = hll_edep_diff_pi->GetNbinsX(); i >= 1; i--)
1985  {
1986  pass += hll_edep_diff_pi->GetBinContent(i);
1987 
1988  const double pp = pass / n_pi;
1989  // const double z = 1.96;
1990  const double z = 1.;
1991 
1992  const double A = z
1993  * sqrt(1. / n_pi * pp * (1 - pp) + z * z / 4 / n_pi / n_pi);
1994  const double B = 1 / (1 + z * z / n_pi);
1995 
1996  assert(threshold[cnt] == hll_edep_diff_pi->GetBinCenter(i));
1997  rej_pi[cnt] = (pp + z * z / 2 / n_pi) * B;
1998  rej_err_pi[cnt] = A * B;
1999 
2000  // eff -> rej
2001  rej_err_pi[cnt] = 1 / rej_pi[cnt] * (rej_err_pi[cnt] / rej_pi[cnt]);
2002  rej_pi[cnt] = 1 / rej_pi[cnt];
2003 
2004  cnt++;
2005  }
2006 
2007  TGraphErrors * ge = new TGraphErrors(cnt, eff_e, rej_pi, eff_err_e,
2008  rej_err_pi);
2009 
2010  return ge;
2011 
2012 }
2013 
2014 TGraphErrors *
2015 MergeRejCurve(TGraphErrors * ge1, const double weight1, TGraphErrors * ge2,
2016  const double weight2, TGraphErrors * ge3 = NULL, const double weight3 = 0)
2017 {
2018  assert(ge1);
2019 
2020  const double sum_weight = weight1 + weight2 + weight3;
2021  assert(sum_weight>0);
2022 
2023  TGraphErrors * ge = (TGraphErrors *) ge1->Clone("MergeExtractRejCurve");
2024  assert(ge);
2025 
2026  for (int i = 0; i < ge->GetN(); ++i)
2027  {
2028  double pass = 0;
2029 
2030  double pass_err2 = 0;
2031 
2032  if (weight1 != 0)
2033  {
2034  assert(ge1);
2035 // assert(ge1 -> GetN() == ge1 -> GetN());
2036 
2037  const double rej = (ge1->GetY())[i];
2038  const double rej_err = (ge1->GetEY())[i];
2039 
2040  pass += 1 / rej * weight1;
2041  pass_err2 += pow(rej_err / rej * (1 / rej * weight1), 2);
2042  }
2043 
2044  if (weight2 != 0)
2045  {
2046  assert(ge2);
2047  assert(ge2 -> GetN() == ge1 -> GetN());
2048 
2049  const double rej = (ge2->GetY())[i];
2050  const double rej_err = (ge2->GetEY())[i];
2051 
2052  pass += 1 / rej * weight2;
2053  pass_err2 += pow(rej_err / rej * (1 / rej * weight2), 2);
2054  }
2055 
2056  if (weight3 != 0)
2057  {
2058  assert(ge3);
2059  assert(ge3 -> GetN() == ge1 -> GetN());
2060 
2061  const double rej = (ge3->GetY())[i];
2062  const double rej_err = (ge3->GetEY())[i];
2063 
2064  pass += 1 / rej * weight3;
2065  pass_err2 += pow(rej_err / rej * (1 / rej * weight3), 2);
2066  }
2067 
2068  pass /= sum_weight;
2069  pass_err2 /= sum_weight * sum_weight;
2070 
2071  (ge->GetY())[i] = 1. / pass;
2072  (ge->GetEY())[i] = sqrt(pass_err2) / pass * 1. / pass;
2073 
2074  }
2075 
2076  return ge;
2077 }
2078 
2079 double
2080 GetHPiRatio(const double pt, TString hadron, TString collision)
2081 {
2082 // Phys. Rev. C 88, 024906 (2013)
2083 // A.k.a. PHENIX/PPG146
2084 
2085  double pt1 = 0;
2086  double pt2 = 1;
2087  double ratio1 = 0;
2088  double ratio2 = 0;
2089 
2090  if (hadron == "kaon-" && collision == "pp")
2091  {
2092  pt1 = 1;
2093  ratio1 = 0.25;
2094  pt2 = 2;
2095  ratio2 = 0.39;
2096  }
2097  else if (hadron == "kaon-" && collision == "AuAu10%C")
2098  {
2099  pt1 = 1;
2100  ratio1 = 0.3;
2101  pt2 = 4;
2102  ratio2 = 0.7;
2103  }
2104  else if (hadron == "kaon+" && collision == "pp")
2105  {
2106  pt1 = 1;
2107  ratio1 = 0.25;
2108  pt2 = 2;
2109  ratio2 = 0.45;
2110  }
2111  else if (hadron == "kaon+" && collision == "AuAu10%C")
2112  {
2113  pt1 = 1;
2114  ratio1 = 0.32;
2115  pt2 = 4;
2116  ratio2 = 0.9;
2117  }
2118  else
2119 
2120  if (hadron == "proton" && collision == "pp")
2121  {
2122  pt1 = 1.6;
2123  ratio1 = 0.25;
2124  pt2 = 3;
2125  ratio2 = 0.21;
2126  }
2127  else if (hadron == "proton" && collision == "AuAu10%C")
2128  {
2129  pt1 = 2.6;
2130  ratio1 = 0.77;
2131  pt2 = 6;
2132  ratio2 = 0.35;
2133  }
2134  else if (hadron == "anti_proton" && collision == "pp")
2135  {
2136  pt1 = 1.6;
2137  ratio1 = 0.21;
2138  pt2 = 3;
2139  ratio2 = 0.2;
2140  }
2141  else if (hadron == "anti_proton" && collision == "AuAu10%C")
2142  {
2143  pt1 = 2.6;
2144  ratio1 = 0.55;
2145  pt2 = 6;
2146  ratio2 = 0.3;
2147  }
2148  else
2149  {
2150  cout << "GetHPiRatio - invalid inputs!" << endl;
2151  assert(0);
2152  }
2153 
2154  assert(pt>1);
2155  const double ratio = ratio2 * (pt - pt1) / (pt2 - pt1)
2156  + ratio1 * (pt2 - pt) / (pt2 - pt1);
2157  assert(ratio > 0);
2158 
2159  return ratio;
2160 }
2161