Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DrawPrototype2ShowerCalib_Sum.C
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file DrawPrototype2ShowerCalib_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 <TLatex.h>
17 #include <TGraphErrors.h>
18 #include <cassert>
19 #include "SaveCanvas.C"
20 #include "SetOKStyle.C"
21 using namespace std;
22 
23 //#include "Prototype2_DSTReader.h"
24 
25 TCut event_sel;
26 TString cuts;
27 TFile * _file0 = NULL;
28 TTree * T = NULL;
29 
30 class lin_res
31 {
32 public:
33  TString name;
34  TGraphErrors * linearity;
35  TGraphErrors * resolution;
36  TF1 * f_res;
37 };
38 
39 void
41 )
42 {
43 
44  SetOKStyle();
45  gStyle->SetOptStat(0);
46  gStyle->SetOptFit(1111);
47  gStyle->SetPadGridX(0);
48  gStyle->SetPadGridY(0);
49  TVirtualFitter::SetDefaultFitter("Minuit2");
50 
51  gSystem->Load("libPrototype2.so");
52  gSystem->Load("libProto2ShowCalib.so");
53 
56  RejectionCompare(12);
57 
58 // LineShapeCompare(4, "QGSP_BERT_HP");
59 // LineShapeCompare(8, "QGSP_BERT_HP");
61 // LineShapeCompare(8, "QGSP_BERT");
62 // LineShapeCompare(8, "FTFP_BERT_HP");
63 // LineShapeCompare(8, "FTFP_BERT");
64 
65 // LineShapeCompare_Electron(4, "QGSP_BERT_HP");
66 // LineShapeCompare_Electron(8, "QGSP_BERT_HP");
67 // LineShapeCompare_Electron(12, "QGSP_BERT_HP");
68 
69 // LineShapeCompare(8, "BirkConst0.151");
70 // LineShapeCompare(8, "BirkConst0.18");
71 // LineShapeCompare_Electron(8, "BirkConst0.151");
72 
73 }
74 
75 double
76 GetMu2Pi(const double E)
77 {
78  double mu2pi = 0;
79  if (E == 4)
80  {
81  mu2pi = 0.02 / 0.105;
82  }
83 
84  else if (E == 8)
85  {
86  mu2pi = 0.02 / 0.28;
87  }
88 
89  else if (E == 12)
90  {
91  mu2pi = 0.04 / 0.48;
92  }
93  else
94  {
95  cout << "GetMu2Pi - missing mu2pi data!!" << endl;
96  assert(0);
97  }
98 
99  return mu2pi;
100 }
101 
102 void
103 RejectionCompare(const double E = 4)
104 {
105 
106  double mu2pi = GetMu2Pi(E);
107 
108  TString energy(Form("%.0f", E));
109 
110  TString data_file(
111  "/phenix/u/jinhuang/links/sPHENIX_work/Prototype_2016/ShowerCalib/Tilt0.lst_EMCalCalib.root_DrawPrototype2ShowerCalib_LineShapeData_Neg"
112  + energy + "GeV_quality_h12345_v34567_col2_row2.root");
113 
114  TFile * fdata = new TFile(data_file);
115  assert(fdata->IsOpen());
116 
117  TFile * fmu =
118  new TFile(
119  "/phenix/u/jinhuang/links/sPHENIX_work/Prototype_2016/EMCal_sim/./0Degree_1Col_LightCollectionSeanStoll/Prototype_mu-_"
120  + energy
121  + "_SegALL_EMCalCalib.root_DrawPrototype2ShowerCalib_LineShapeSim_0DegreeRot_h5_v5_col2_row2.root");
122  assert(fmu->IsOpen());
123  cout << "Processing " << fmu->GetName() << endl;
124 
125  TH1F * h_5x5sum_c2_sum_mu = fmu->Get("h_5x5sum_c2_sum")->Clone(
126  "h_5x5sum_c2_sum_mu");
127 
128  int idx = 1;
129  TPad * p;
130 
131  TH1F * h_5x5sum_c2_h = fdata->Get("h_5x5sum_c2_h");
132 
133  TH1F * h_5x5sum_c2_sum_data_sub_mu = h_5x5sum_c2_h->Clone(
134  "h_5x5sum_c2_sum_data_sub_mu");
135 
136  cout << "h_5x5sum_c2_sum_data->GetNbinsX() = "
137  << h_5x5sum_c2_sum_data_sub_mu->GetNbinsX() << endl;
138  cout << "h_5x5sum_c2_sum_mu->GetNbinsX() = "
139  << h_5x5sum_c2_sum_mu->GetNbinsX() << endl;
140 
141  assert(
142  h_5x5sum_c2_sum_data_sub_mu->GetNbinsX()
143  == h_5x5sum_c2_sum_mu->GetNbinsX());
144 
145  const double muon_count = h_5x5sum_c2_sum_data_sub_mu->GetSum()
146  * (mu2pi / (1 + mu2pi));
147  h_5x5sum_c2_sum_data_sub_mu->Add(h_5x5sum_c2_sum_mu,
148  -muon_count / h_5x5sum_c2_sum_mu->GetSum());
149 
150  TGraphErrors * ge_data = Distribution2Efficiency(h_5x5sum_c2_sum_data_sub_mu);
151  ge_data->SetFillColor(kGray);
152  ge_data->SetLineWidth(3);
153 
154  TGraphErrors * ge_pi_QGSP_BERT_HP = GetSimRejCurve("QGSP_BERT_HP", energy,
155  "pi-");
156  TGraphErrors * ge_kaon_QGSP_BERT_HP = GetSimRejCurve("QGSP_BERT_HP", energy,
157  "kaon-");
158 
159  ge_pi_QGSP_BERT_HP->SetLineColor(kBlue);
160  ge_kaon_QGSP_BERT_HP->SetLineColor(kCyan + 3);
161 
162  TGraphErrors * ge_pi_FTFP_BERT_HP = GetSimRejCurve("FTFP_BERT_HP", energy,
163  "pi-");
164  TGraphErrors * ge_kaon_FTFP_BERT_HP = GetSimRejCurve("FTFP_BERT_HP", energy,
165  "kaon-");
166 
167  ge_pi_FTFP_BERT_HP->SetLineColor(kBlue);
168  ge_kaon_FTFP_BERT_HP->SetLineColor(kCyan + 3);
169  ge_pi_FTFP_BERT_HP->SetLineStyle(kDashed);
170  ge_kaon_FTFP_BERT_HP->SetLineStyle(kDashed);
171 
172  TGraphErrors * ge_pi_BirkConst18 = GetSimRejCurve("BirkConst0.18", energy,
173  "pi-");
174  TGraphErrors * ge_kaon_BirkConst18 = GetSimRejCurve("BirkConst0.18", energy,
175  "kaon-");
176 
177  ge_pi_BirkConst18->SetLineColor(kBlue);
178  ge_kaon_BirkConst18->SetLineColor(kCyan + 3);
179  ge_pi_BirkConst18->SetLineStyle(9);
180  ge_kaon_BirkConst18->SetLineStyle(9);
181 
182 // new TCanvas;
183 // h_5x5sum_c2_sum_data_sub_mu->Draw();
184 // h_5x5sum_c2_sum_mu->Draw("same");
185 
186  TGraphErrors * ge_ref = ge_pi_QGSP_BERT_HP->Clone("ge_ref");
187 
188  for (int i = 0; i < ge_ref->GetN(); ++i)
189  {
190  (ge_ref->GetY())[i] = ((ge_pi_QGSP_BERT_HP->GetY())[i]
191  + (ge_kaon_QGSP_BERT_HP->GetY())[i]) / 2.;
192  }
193 
194  TText * t;
195  TCanvas *c1 = new TCanvas("RejectionCompare_" + energy + "GeV_",
196  "RejectionCompare_" + energy + "GeV_", 800, 1000);
197 
198  c1->Divide(1, 2);
199 
200  p = (TPad *) c1->cd(idx++);
201  c1->Update();
202  p->SetLogy();
203 
204  p->SetBottomMargin(0.03);
205 
206  TH1 * hframe = p->DrawFrame(0, 5e-4, E * 1, 1);
207  hframe->SetTitle(
208  Form(
209  ";;1/(Hadron Rejection)",
210  E));
211  hframe->GetXaxis()->SetLabelSize(.06);
212  hframe->GetXaxis()->SetTitleSize(.06);
213  hframe->GetYaxis()->SetLabelSize(.06);
214  hframe->GetYaxis()->SetTitleSize(.06);
215  hframe->GetYaxis()->SetTitleOffset(0.8);
216 
217  ge_data->Draw("p3");
218  ge_data->Draw("lX");
219 
220  ge_pi_QGSP_BERT_HP->Draw("lX");
221  ge_kaon_QGSP_BERT_HP->Draw("lX");
222  ge_pi_FTFP_BERT_HP->Draw("lX");
223  ge_kaon_FTFP_BERT_HP->Draw("lX");
224  ge_pi_BirkConst18->Draw("lX");
225  ge_kaon_BirkConst18->Draw("lX");
226 
227  TLegend * leg = new TLegend(.12, .05, .72, .5);
228  leg->SetHeader(Form("Beam momentum = -%.0f GeV/c",E));
229  leg->AddEntry(ge_data, "T-1044 non-e^{-} Data - Muon Sim.", "fl");
230  leg->AddEntry(ge_pi_QGSP_BERT_HP, "\pi^{-}, QGSP_BERT_HP (Default)", "l");
231  leg->AddEntry(ge_kaon_QGSP_BERT_HP, "K^{-}, QGSP_BERT_HP (Default)", "l");
232  leg->AddEntry(ge_pi_FTFP_BERT_HP, "\pi^{-}, FTFP_BERT_HP", "l");
233  leg->AddEntry(ge_kaon_FTFP_BERT_HP, "K^{-}, FTFP_BERT_HP", "l");
234  leg->AddEntry(ge_pi_BirkConst18, "\pi^{-}, k_{B} = 0.18 mm/MeV", "l");
235  leg->AddEntry(ge_kaon_BirkConst18, "K^{-}, k_{B} = 0.18 mm/MeV", "l");
236 
237  leg->Draw();
238 
239  p = (TPad *) c1->cd(idx++);
240  c1->Update();
241 // p->SetLogy();
242  p->SetTopMargin(0);
243 
244  TH1 * hframe =
245  p->DrawFrame(0, 0, E * 1, 2);
246  hframe->SetTitle(
247  Form(
248  ";Minimal cut on 5x5 Cluster Energy (GeV/c);Ratio of 1/(Hadron Rejection) and Ref.",
249  E));
250  hframe->GetXaxis()->SetLabelSize(.06);
251  hframe->GetXaxis()->SetTitleSize(.06);
252  hframe->GetYaxis()->SetLabelSize(.06);
253  hframe->GetYaxis()->SetTitleSize(.06);
254  hframe->GetYaxis()->SetTitleOffset(0.8);
255 
256  TGraphErrors * ge_data_ratio = GetTGraphRatio(ge_data, ge_ref);
257 
258  ge_data_ratio->Draw("p3");
259  ge_data_ratio->Draw("lX");
260 
261  GetTGraphRatio(ge_pi_QGSP_BERT_HP, ge_ref)->Draw("lX");
262  GetTGraphRatio(ge_kaon_QGSP_BERT_HP, ge_ref)->Draw("lX");
263  GetTGraphRatio(ge_pi_FTFP_BERT_HP, ge_ref)->Draw("lX");
264  GetTGraphRatio(ge_kaon_FTFP_BERT_HP, ge_ref)->Draw("lX");
265  GetTGraphRatio(ge_pi_BirkConst18, ge_ref)->Draw("lX");
266  GetTGraphRatio(ge_kaon_BirkConst18, ge_ref)->Draw("lX");
267 
268  SaveCanvas(c1,
269  data_file + "_DrawPrototype2ShowerCalib_Sum" + TString(c1->GetName()),
270  kTRUE);
271 }
272 
273 TGraphErrors *
274 GetSimRejCurve(const TString physics_lst, const TString energy,
275  const TString particle)
276 {
277  const TString filename =
278  "/phenix/u/jinhuang/links/sPHENIX_work/Prototype_2016/EMCal_sim/./0Degree_1Col_LightCollectionSeanStoll_"
279  + physics_lst + "/Prototype_" + particle + "_" + energy
280  + "_SegALL_EMCalCalib.root_DrawPrototype2ShowerCalib_LineShapeSim_0DegreeRot_h5_v5_col2_row2.root";
281  cout << "GetSimRejCurve - processing " << filename << endl;
282 
283  TFile * f = new TFile(filename);
284  assert(f->IsOpen());
285 
286  TGraphErrors * ge = Distribution2Efficiency(
287  (TH1F *) f->Get("h_5x5sum_c2_sum"));
288 // ge->SetLineColor(kBlue);
289  ge->SetLineWidth(3);
290 
291  return ge;
292 }
293 
294 void
295 LineShapeCompare(const double E = 4, //
296  const TString physics_lst = "QGSP_BERT_HP")
297 {
298 
299  double mu2pi = GetMu2Pi(E);
300 
301  TString energy(Form("%.0f", E));
302 
303  TText * t;
304  TCanvas *c1 = new TCanvas("LineShapeCompare_" + energy + "GeV_" + physics_lst,
305  "LineShapeCompare_" + energy + "GeV_" + physics_lst, 1000, 650);
306 
307  int idx = 1;
308  TPad * p;
309 
310  p = (TPad *) c1->cd(idx++);
311  c1->Update();
312  p->SetLogy();
313 
314  TString data_file(
315  "/phenix/u/jinhuang/links/sPHENIX_work/Prototype_2016/ShowerCalib/Tilt0.lst_EMCalCalib.root_DrawPrototype2ShowerCalib_LineShapeData_Neg"
316  + energy + "GeV_quality_h12345_v34567_col2_row2.root");
317 
318  TFile * fdata = new TFile(data_file);
319  assert(fdata->IsOpen());
320 
321  TH1F * h_5x5sum_c2_sum_data = fdata->Get("h_5x5sum_c2_h3")->Clone(
322  "h_5x5sum_c2_sum_data");
323  assert(h_5x5sum_c2_sum_data);
324 
325  h_5x5sum_c2_sum_data->Scale(1. / h_5x5sum_c2_sum_data->GetSum());
326  h_5x5sum_c2_sum_data->SetLineColor(kBlack);
327 // h_5x5sum_c2_sum_data->SetLineStyle(kDashed);
328 
329  h_5x5sum_c2_sum_data->Draw();
330 
331  TFile * fpi =
332  new TFile(
333  "/phenix/u/jinhuang/links/sPHENIX_work/Prototype_2016/EMCal_sim/./0Degree_1Col_LightCollectionSeanStoll_"
334  + physics_lst + "/Prototype_pi-_" + energy
335  + "_SegALL_EMCalCalib.root_DrawPrototype2ShowerCalib_LineShapeSim_0DegreeRot_h5_v5_col2_row2.root");
336  assert(fpi->IsOpen());
337 
338  TH1F * h_5x5sum_c2_sum_pi = fpi->Get("h_5x5sum_c2_sum")->Clone(
339  "h_5x5sum_c2_sum_pi");
340  assert(h_5x5sum_c2_sum_pi);
341 
342  h_5x5sum_c2_sum_pi->Scale((1. / (1 + mu2pi)) / h_5x5sum_c2_sum_pi->GetSum());
343  h_5x5sum_c2_sum_pi->SetLineColor(kBlue);
344 // h_5x5sum_c2_sum_pi->SetLineStyle(kDashed);
345 
346  h_5x5sum_c2_sum_pi->Draw("same");
347 
348  TFile * fkaon =
349  new TFile(
350  "/phenix/u/jinhuang/links/sPHENIX_work/Prototype_2016/EMCal_sim/./0Degree_1Col_LightCollectionSeanStoll_"
351  + physics_lst + "/Prototype_kaon-_" + energy
352  + "_SegALL_EMCalCalib.root_DrawPrototype2ShowerCalib_LineShapeSim_0DegreeRot_h5_v5_col2_row2.root");
353  assert(fkaon->IsOpen());
354 
355  TH1F * h_5x5sum_c2_sum_kaon = fkaon->Get("h_5x5sum_c2_sum")->Clone(
356  "h_5x5sum_c2_sum_kaon");
357  assert(h_5x5sum_c2_sum_kaon);
358 
359  h_5x5sum_c2_sum_kaon->Scale(
360  (1. / (1 + mu2pi)) / h_5x5sum_c2_sum_kaon->GetSum());
361  h_5x5sum_c2_sum_kaon->SetLineColor(kCyan + 3);
362 // h_5x5sum_c2_sum_pi->SetLineStyle(kDashed);
363 
364  h_5x5sum_c2_sum_kaon->Draw("same");
365 
366  TFile * fmu =
367  new TFile(
368  "/phenix/u/jinhuang/links/sPHENIX_work/Prototype_2016/EMCal_sim/./0Degree_1Col_LightCollectionSeanStoll_"
369  + physics_lst + "/Prototype_mu-_" + energy
370  + "_SegALL_EMCalCalib.root_DrawPrototype2ShowerCalib_LineShapeSim_0DegreeRot_h5_v5_col2_row2.root");
371  assert(fmu->IsOpen());
372  cout << "Processing " << fmu->GetName() << endl;
373 
374  TH1F * h_5x5sum_c2_sum_mu = fmu->Get("h_5x5sum_c2_sum")->Clone(
375  "h_5x5sum_c2_sum_mu");
376  assert(h_5x5sum_c2_sum_mu);
377 
378  h_5x5sum_c2_sum_mu->Scale(
379  (mu2pi / (1 + mu2pi)) / h_5x5sum_c2_sum_mu->GetSum());
380  h_5x5sum_c2_sum_mu->SetLineColor(kBlack);
381 // h_5x5sum_c2_sum_pi->SetLineStyle(kDashed);
382 
383  h_5x5sum_c2_sum_mu->Draw("same");
384 
385  c1->Update();
386 
387  SaveCanvas(c1,
388  data_file + "_DrawPrototype2ShowerCalib_Sum" + TString(c1->GetName()),
389  kTRUE);
390 
391 }
392 
393 void
394 LineShapeCompare_Electron(const double E = 4, //
395  const TString physics_lst = "QGSP_BERT_HP")
396 {
397 
398  TString energy(Form("%.0f", E));
399 
400  TText * t;
401  TCanvas *c1 = new TCanvas(
402  "LineShapeCompare_Electron_" + energy + "GeV_" + physics_lst,
403  "LineShapeCompare_Electron_" + energy + "GeV_" + physics_lst, 1000, 650);
404 
405  int idx = 1;
406  TPad * p;
407 
408  p = (TPad *) c1->cd(idx++);
409  c1->Update();
410  p->SetLogy();
411 
412  TString data_file(
413  "/phenix/u/jinhuang/links/sPHENIX_work/Prototype_2016/ShowerCalib/Tilt0.lst_EMCalCalib.root_DrawPrototype2ShowerCalib_LineShapeData_Neg"
414  + energy + "GeV_quality_h3_v5_col2_row2.root");
415 
416  TFile * fdata = new TFile(data_file);
417  assert(fdata->IsOpen());
418 
419  TH1F * h_5x5sum_c2_sum_data = fdata->Get("h_5x5sum_c2_e");
420  assert(h_5x5sum_c2_sum_data);
421 
422  h_5x5sum_c2_sum_data->Scale(1. / h_5x5sum_c2_sum_data->GetSum());
423  h_5x5sum_c2_sum_data->SetLineColor(kBlack);
424 // h_5x5sum_c2_sum_data->SetLineStyle(kDashed);
425 
426  h_5x5sum_c2_sum_data->Draw();
427 
428  TFile * fe =
429  new TFile(
430  "/phenix/u/jinhuang/links/sPHENIX_work/Prototype_2016/EMCal_sim/./0Degree_1Col_LightCollectionSeanStoll_"
431  + physics_lst + "/Prototype_e-_" + energy
432  + "_SegALL_EMCalCalib.root_DrawPrototype2ShowerCalib_LineShapeSim_0DegreeRot_h1_v1_col2_row2.root");
433  assert(fe->IsOpen());
434 
435  TH1F * h_5x5sum_c2_sum_e = fe->Get("h_5x5sum_c2_sum");
436  assert(h_5x5sum_c2_sum_e);
437 
438  h_5x5sum_c2_sum_e->Scale((0.27 / 0.30) / h_5x5sum_c2_sum_e->GetSum());
439  h_5x5sum_c2_sum_e->SetLineColor(kBlue + 3);
440 // h_5x5sum_c2_sum_e->SetLineStyle(kDashed);
441 
442  h_5x5sum_c2_sum_e->Draw("same");
443 
444  c1->Update();
445 
446  SaveCanvas(c1,
447  data_file + "_DrawPrototype2ShowerCalib_Sum" + TString(c1->GetName()),
448  kTRUE);
449 }
450 
451 TGraphErrors *
452 FitProfile(const TH2 * h2)
453 {
454 
455  TProfile * p2 = h2->ProfileX();
456 
457  int n = 0;
458  double x[1000];
459  double ex[1000];
460  double y[1000];
461  double ey[1000];
462 
463  for (int i = 1; i <= h2->GetNbinsX(); i++)
464  {
465  TH1D * h1 = h2->ProjectionY(Form("htmp_%d", rand()), i, i);
466 
467  if (h1->GetSum() < 30)
468  {
469  cout << "FitProfile - ignore bin " << i << endl;
470  continue;
471  }
472  else
473  {
474  cout << "FitProfile - fit bin " << i << endl;
475  }
476 
477  TF1 fgaus("fgaus", "gaus", -p2->GetBinError(i) * 4,
478  p2->GetBinError(i) * 4);
479 
480  TF1 f2(Form("dgaus"), "gaus + [3]*exp(-0.5*((x-[1])/[4])**2) + [5]",
481  -p2->GetBinError(i) * 4, p2->GetBinError(i) * 4);
482 
483  fgaus.SetParameter(1, p2->GetBinContent(i));
484  fgaus.SetParameter(2, p2->GetBinError(i));
485 
486  h1->Fit(&fgaus, "MQ");
487 
488  f2.SetParameters(fgaus.GetParameter(0) / 2, fgaus.GetParameter(1),
489  fgaus.GetParameter(2), fgaus.GetParameter(0) / 2,
490  fgaus.GetParameter(2) / 4, 0);
491 
492  h1->Fit(&f2, "MQ");
493 
494 // new TCanvas;
495 // h1->Draw();
496 // fgaus.Draw("same");
497 // break;
498 
499  x[n] = p2->GetBinCenter(i);
500  ex[n] = (p2->GetBinCenter(2) - p2->GetBinCenter(1)) / 2;
501  y[n] = fgaus.GetParameter(1);
502  ey[n] = fgaus.GetParError(1);
503 
504 // p2->SetBinContent(i, fgaus.GetParameter(1));
505 // p2->SetBinError(i, fgaus.GetParameter(2));
506 
507  n++;
508  delete h1;
509  }
510 
511  return new TGraphErrors(n, x, y, ex, ey);
512 }
513 
514 TGraphErrors *
515 Distribution2Efficiency(TH1F * hCEMC3_Max)
516 {
517  double threshold[10000] =
518  { 0 };
519  double eff[10000] =
520  { 0 };
521  double eff_err[10000] =
522  { 0 };
523 
524  assert(hCEMC3_Max->GetNbinsX() < 10000);
525 
526  const double n = hCEMC3_Max->GetSum();
527  double pass = 0;
528  int cnt = 0;
529  for (int i = hCEMC3_Max->GetNbinsX(); i >= 1; i--)
530  {
531  pass += hCEMC3_Max->GetBinContent(i);
532 
533  const double pp = pass / n;
534 // const double z = 1.96;
535  const double z = 1.;
536 
537  const double A = z * sqrt(1. / n * pp * (1 - pp) + z * z / 4 / n / n);
538  const double B = 1 / (1 + z * z / n);
539 
540  threshold[cnt] = hCEMC3_Max->GetBinCenter(i);
541  eff[cnt] = (pp + z * z / 2 / n) * B;
542  eff_err[cnt] = A * B;
543 
544 // cout << threshold[cnt] << ": " << "CL " << eff[cnt] << "+/-"
545 // << eff_err[cnt] << endl;
546  cnt++;
547  }
548  TGraphErrors * ge = new TGraphErrors(cnt, threshold, eff, NULL, eff_err);
549  ge->SetName(TString("ge_") + hCEMC3_Max->GetName());
550  return ge;
551 }
552 
553 TGraphErrors *
554 GetTGraphRatio(TGraphErrors *input, TGraphErrors * baseline)
555 {
556  assert(input);
557  assert(baseline);
558 
559  assert(input->GetN() == baseline->GetN());
560 
561  TGraphErrors * ge = input->Clone(TString(input->GetName()) + "_Ratio");
562 
563  for (int i = 0; i < input->GetN(); ++i)
564  {
565  (ge->GetY())[i] /= (baseline->GetY())[i];
566  (ge->GetEY())[i] /= (baseline->GetY())[i];
567  }
568 
569  return ge;
570 }
571