Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Cone_Plots.C
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file Cone_Plots.C
1 #include <iostream>
2 #include <fstream>
3 #include <vector>
4 #include <utility>
5 
6 #include "sPhenixStyle.h"
7 #include "sPhenixStyle.C"
8 
9 using namespace std;
10 
11 
12 Int_t Cone_Plots()
13 {
14 
15  TString infile = "../macro/output.root";
16  TString outputfile = "ConePlots.root";
17 
19  TH1::SetDefaultSumw2();
20  TH2::SetDefaultSumw2();
21 
22  // open input file
23  TFile fin(infile.Data(), "READ");
24  if(!fin.IsOpen())
25  {
26  std::cout << "Error: could not open input file" << std::endl;
27  return -1;
28  }
29  TTree *tree = (TTree*)fin.Get("T");
30  if(!tree)
31  {
32  std::cout << "Error: could not find tree" << std::endl;
33  return -1;
34  }
35 
36  int event = 0;
37  int seed = 0;
38  int centrality = 0;
39  float weight = 0;
40  float rho_area = 0;
41  float rho_area_sigma = 0;
42  float rho_mult = 0;
43  float rho_mult_sigma = 0;
44  float cone_area = 0;
45  int cone_nclustered = 0;
46  float cone_pt_raw = 0;
47  float cone_pt_iter_sub = 0;
48  float randomized_cone_pt_raw = 0;
49  float randomized_cone_pt_iter_sub = 0;
50  float avoid_leading_cone_pt_raw = 0;
51  float avoid_leading_cone_pt_iter_sub = 0;
52 
53  tree->SetBranchAddress("event", &event);
54  tree->SetBranchAddress("seed", &seed);
55  tree->SetBranchAddress("centrality", &centrality);
56  tree->SetBranchAddress("weight", &weight);
57  tree->SetBranchAddress("rho_area", &rho_area);
58  tree->SetBranchAddress("rho_area_sigma", &rho_area_sigma);
59  tree->SetBranchAddress("rho_mult", &rho_mult);
60  tree->SetBranchAddress("rho_mult_sigma", &rho_mult_sigma);
61  tree->SetBranchAddress("cone_area", &cone_area);
62  tree->SetBranchAddress("cone_nclustered", &cone_nclustered);
63  tree->SetBranchAddress("cone_pt_raw", &cone_pt_raw);
64  tree->SetBranchAddress("cone_pt_iter_sub", &cone_pt_iter_sub);
65  tree->SetBranchAddress("randomized_cone_pt_raw", &randomized_cone_pt_raw);
66  tree->SetBranchAddress("randomized_cone_pt_iter_sub", &randomized_cone_pt_iter_sub);
67  tree->SetBranchAddress("avoid_leading_cone_pt_raw", &avoid_leading_cone_pt_raw);
68  tree->SetBranchAddress("avoid_leading_cone_pt_iter_sub", &avoid_leading_cone_pt_iter_sub);
69 
70 
71  const int resp_N = 200;
72  double resp_bins[resp_N+1];
73  for(int i = 0; i < resp_N+1; i++){
74  resp_bins[i] = -15 + (65.0/resp_N * i);
75  }
76 
77  const double cent_bins[] = {0, 10, 30, 50, 80, 100}; //the first bin is for inclusive in centrality/pp events
78  const int cent_N = sizeof(cent_bins)/sizeof(double) - 1;
79 
80  // set up resolution histogram
81  TH2D * h2_reso_pt_area = new TH2D("h2_reso_pt_area", "", resp_N, resp_bins, cent_N, cent_bins);
82  TH1D * h1_reso_pt_area = new TH1D("h1_reso_pt_area", "", cent_N, cent_bins);
83 
84  TH2D * h2_reso_pt_mult = new TH2D("h2_reso_pt_mult", "", resp_N, resp_bins, cent_N, cent_bins);
85  TH1D * h1_reso_pt_mult = new TH1D("h1_reso_pt_mult", "", cent_N, cent_bins);
86 
87  TH2D * h2_reso_pt_iter_sub = new TH2D("h2_reso_pt_iter_sub", "", resp_N, resp_bins, cent_N, cent_bins);
88  TH1D * h1_reso_pt_iter_sub = new TH1D("h1_reso_pt_iter_sub", "", cent_N, cent_bins);
89 
90  TH2D * h2_reso_pt_area_randomized = new TH2D("h2_reso_pt_area_randomized", "", resp_N, resp_bins, cent_N, cent_bins);
91  TH1D * h1_reso_pt_area_randomized = new TH1D("h1_reso_pt_area_randomized", "", cent_N, cent_bins);
92 
93  TH2D * h2_reso_pt_mult_randomized = new TH2D("h2_reso_pt_mult_randomized", "", resp_N, resp_bins, cent_N, cent_bins);
94  TH1D * h1_reso_pt_mult_randomized = new TH1D("h1_reso_pt_mult_randomized", "", cent_N, cent_bins);
95 
96  TH2D * h2_reso_pt_iter_sub_randomized = new TH2D("h2_reso_pt_iter_sub_randomized", "", resp_N, resp_bins, cent_N, cent_bins);
97  TH1D * h1_reso_pt_iter_sub_randomized = new TH1D("h1_reso_pt_iter_sub_randomized", "", cent_N, cent_bins);
98 
99  // set up resolution histogram
100  TH2D * h2_reso_pt_area_avoidleading = new TH2D("h2_reso_pt_area_avoidleading", "", resp_N, resp_bins, cent_N, cent_bins);
101  TH1D * h1_reso_pt_area_avoidleading = new TH1D("h1_reso_pt_area_avoidleading", "", cent_N, cent_bins);
102 
103  TH2D * h2_reso_pt_mult_avoidleading = new TH2D("h2_reso_pt_mult_avoidleading", "", resp_N, resp_bins, cent_N, cent_bins);
104  TH1D * h1_reso_pt_mult_avoidleading = new TH1D("h1_reso_pt_mult_avoidleading", "", cent_N, cent_bins);
105 
106  TH2D * h2_reso_pt_iter_sub_avoidleading = new TH2D("h2_reso_pt_iter_sub_avoidleading", "", resp_N, resp_bins, cent_N, cent_bins);
107  TH1D * h1_reso_pt_iter_sub_avoidleading = new TH1D("h1_reso_pt_iter_sub_avoidleading", "", cent_N, cent_bins);
108 
109 
110  // get number of entries
111  int nEntries = tree->GetEntries();
112  for (int iEvent = 0; iEvent < nEntries; iEvent++){
113  // get entry
114  tree->GetEntry(iEvent);
115  // fill resolution histograms
116  float pt_area = cone_pt_raw - rho_area * cone_area;
117  float pt_mult = cone_pt_raw - rho_mult * cone_nclustered;
118  float pt_iter_sub = cone_pt_iter_sub;
119 
120  float pt_area_randomized = randomized_cone_pt_raw - rho_area * cone_area;
121  float pt_mult_randomized = randomized_cone_pt_raw - rho_mult * cone_nclustered;
122  float pt_iter_sub_randomized = randomized_cone_pt_iter_sub;
123 
124  float pt_area_avoidleading = avoid_leading_cone_pt_raw - rho_area * cone_area;
125  float pt_mult_avoidleading = avoid_leading_cone_pt_raw - rho_mult * cone_nclustered;
126  float pt_iter_sub_avoidleading = avoid_leading_cone_pt_iter_sub;
127 
128  h2_reso_pt_area->Fill(pt_area, centrality);
129  h2_reso_pt_mult->Fill(pt_mult, centrality);
130  h2_reso_pt_iter_sub->Fill(pt_iter_sub, centrality);
131  // h2_reso_pt_area->Fill(pt_area, -1);
132  // h2_reso_pt_mult->Fill(pt_mult, -1);
133  // h2_reso_pt_iter_sub->Fill(pt_iter_sub, -1);
134 
135  h2_reso_pt_area_randomized->Fill(pt_area_randomized, centrality);
136  h2_reso_pt_mult_randomized->Fill(pt_mult_randomized, centrality);
137  h2_reso_pt_iter_sub_randomized->Fill(pt_iter_sub_randomized, centrality);
138  // h2_reso_pt_area_randomized->Fill(pt_area_randomized, -1);
139  // h2_reso_pt_mult_randomized->Fill(pt_mult_randomized, -1);
140  // h2_reso_pt_iter_sub_randomized->Fill(pt_iter_sub_randomized, -1);
141 
142  h2_reso_pt_area_avoidleading->Fill(pt_area_avoidleading, centrality);
143  h2_reso_pt_mult_avoidleading->Fill(pt_mult_avoidleading, centrality);
144  h2_reso_pt_iter_sub_avoidleading->Fill(pt_iter_sub_avoidleading, centrality);
145  // h2_reso_pt_area_avoidleading->Fill(pt_area_avoidleading, -1);
146  // h2_reso_pt_mult_avoidleading->Fill(pt_mult_avoidleading, -1);
147  // h2_reso_pt_iter_sub_avoidleading->Fill(pt_iter_sub_avoidleading, -1);
148  }
149 
150 
151  // create output file
152  TFile * fout = new TFile(outputfile.Data(), "RECREATE");
153 
154  TCanvas * c = new TCanvas("c", "c", 800, 600);
155  for(int icent = 0; icent < cent_N; ++icent)
156  {
157 
158  h2_reso_pt_area->GetYaxis()->SetRange(icent+1,icent+1);
159  TH1D * h_temp = (TH1D*)h2_reso_pt_area->ProjectionX();
160  h_temp->GetXaxis()->SetTitle("#delta p_{T} = p_{T}^{reco} - #rho A");
161  h_temp->GetYaxis()->SetTitle("Counts");
162  // fit
163  TF1 *func = new TF1("func","gaus",-15, 60);
164  h_temp->Fit(func,"Q","",-15, 60);
165  h_temp->Fit(func,"Q","",func->GetParameter(1)-2*func->GetParameter(2),func->GetParameter(1)+2*func->GetParameter(2));
166  func->SetLineColor(kRed);
167 
168 
169  // draw
170  c->cd();
171  gPad->SetLeftMargin(0.15);
172  gPad->SetRightMargin(0.05);
173  gPad->SetBottomMargin(0.05);
174  gPad->SetTopMargin(0.05);
175  h_temp->Draw();
176  func->Draw("SAME");
177  c->Update();
178  c->SaveAs(Form("plots/area_cent%.0f-%.0f.png", cent_bins[icent], cent_bins[icent+1]));
179 
180  h1_reso_pt_area->SetBinContent(icent+1, func->GetParameter(2));
181 
182  }
183 
184  for(int icent = 0; icent < cent_N; ++icent)
185  {
186 
187  h2_reso_pt_mult->GetYaxis()->SetRange(icent+1,icent+1);
188  TH1D * h_temp = (TH1D*)h2_reso_pt_mult->ProjectionX();
189  h_temp->GetXaxis()->SetTitle("#delta p_{T} = p_{T}^{reco} - #rho M");
190  h_temp->GetYaxis()->SetTitle("Counts");
191  // fit
192  TF1 *func = new TF1("func","gaus",-15, 60);
193  h_temp->Fit(func,"Q","",-15, 60);
194  h_temp->Fit(func,"Q","",func->GetParameter(1)-2*func->GetParameter(2),func->GetParameter(1)+2*func->GetParameter(2));
195  func->SetLineColor(kRed);
196 
197 
198  // draw
199  c->cd();
200  gPad->SetLeftMargin(0.15);
201  gPad->SetRightMargin(0.05);
202  gPad->SetBottomMargin(0.05);
203  gPad->SetTopMargin(0.05);
204  h_temp->Draw();
205  func->Draw("SAME");
206  c->Update();
207  c->SaveAs(Form("plots/mult_cent%.0f-%.0f.png", cent_bins[icent], cent_bins[icent+1]));
208 
209  h1_reso_pt_mult->SetBinContent(icent+1, func->GetParameter(2));
210 
211  }
212 
213  for(int icent = 0; icent < cent_N; ++icent)
214  {
215 
216  h2_reso_pt_iter_sub->GetYaxis()->SetRange(icent+1,icent+1);
217  TH1D * h_temp = (TH1D*)h2_reso_pt_iter_sub->ProjectionX();
218  h_temp->GetXaxis()->SetTitle("#delta p_{T} = p_{T}^{Iter}");
219  h_temp->GetYaxis()->SetTitle("Counts");
220  // fit
221  TF1 *func = new TF1("func","gaus",-15, 60);
222  h_temp->Fit(func,"Q","",-15, 60);
223  h_temp->Fit(func,"Q","",func->GetParameter(1)-2*func->GetParameter(2),func->GetParameter(1)+2*func->GetParameter(2));
224  func->SetLineColor(kRed);
225 
226 
227  // draw
228  c->cd();
229  gPad->SetLeftMargin(0.15);
230  gPad->SetRightMargin(0.05);
231  gPad->SetBottomMargin(0.05);
232  gPad->SetTopMargin(0.05);
233  h_temp->Draw();
234  func->Draw("SAME");
235  c->Update();
236  c->SaveAs(Form("plots/iter_sub_cent%.0f-%.0f.png", cent_bins[icent], cent_bins[icent+1]));
237 
238  h1_reso_pt_iter_sub->SetBinContent(icent+1, func->GetParameter(2));
239 
240  }
241 
242  for(int icent = 0; icent < cent_N; ++icent)
243  {
244 
245  h2_reso_pt_area_randomized->GetYaxis()->SetRange(icent+1,icent+1);
246  TH1D * h_temp = (TH1D*)h2_reso_pt_area_randomized->ProjectionX();
247  h_temp->GetXaxis()->SetTitle("#delta p_{T} = p_{T}^{reco, randomized} - #rho A");
248  h_temp->GetYaxis()->SetTitle("Counts");
249  // fit
250  TF1 *func = new TF1("func","gaus",-15, 60);
251  h_temp->Fit(func,"Q","",-15, 60);
252  h_temp->Fit(func,"Q","",func->GetParameter(1)-2*func->GetParameter(2),func->GetParameter(1)+2*func->GetParameter(2));
253  func->SetLineColor(kRed);
254 
255 
256  // draw
257  c->cd();
258  gPad->SetLeftMargin(0.15);
259  gPad->SetRightMargin(0.05);
260  gPad->SetBottomMargin(0.05);
261  gPad->SetTopMargin(0.05);
262  h_temp->Draw();
263  func->Draw("SAME");
264  c->Update();
265  c->SaveAs(Form("plots/area_randomized_cent%.0f-%.0f.png", cent_bins[icent], cent_bins[icent+1]));
266 
267  h1_reso_pt_area_randomized->SetBinContent(icent+1, func->GetParameter(2));
268 
269  }
270 
271  for(int icent = 0; icent < cent_N; ++icent)
272  {
273 
274  h2_reso_pt_mult_randomized->GetYaxis()->SetRange(icent+1,icent+1);
275  TH1D * h_temp = (TH1D*)h2_reso_pt_mult_randomized->ProjectionX();
276  h_temp->GetXaxis()->SetTitle("#delta p_{T} = p_{T}^{reco, randomized} - #rho M");
277  h_temp->GetYaxis()->SetTitle("Counts");
278  // fit
279  TF1 *func = new TF1("func","gaus",-15, 60);
280  h_temp->Fit(func,"Q","",-15, 60);
281  h_temp->Fit(func,"Q","",func->GetParameter(1)-2*func->GetParameter(2),func->GetParameter(1)+2*func->GetParameter(2));
282  func->SetLineColor(kRed);
283 
284 
285  // draw
286  c->cd();
287  gPad->SetLeftMargin(0.15);
288  gPad->SetRightMargin(0.05);
289  gPad->SetBottomMargin(0.05);
290  gPad->SetTopMargin(0.05);
291  h_temp->Draw();
292  func->Draw("SAME");
293  c->Update();
294  c->SaveAs(Form("plots/mult_randomized_cent%.0f-%.0f.png", cent_bins[icent], cent_bins[icent+1]));
295 
296  h1_reso_pt_mult_randomized->SetBinContent(icent+1, func->GetParameter(2));
297 
298  }
299 
300  for(int icent = 0; icent < cent_N; ++icent)
301  {
302 
303  h2_reso_pt_iter_sub_randomized->GetYaxis()->SetRange(icent+1,icent+1);
304  TH1D * h_temp = (TH1D*)h2_reso_pt_iter_sub_randomized->ProjectionX();
305  h_temp->GetXaxis()->SetTitle("#delta p_{T} = p_{T}^{reco, randomized} - #rho M");
306  h_temp->GetYaxis()->SetTitle("Counts");
307  // fit
308  TF1 *func = new TF1("func","gaus",-15, 60);
309  h_temp->Fit(func,"Q","",-15, 60);
310  h_temp->Fit(func,"Q","",func->GetParameter(1)-2*func->GetParameter(2),func->GetParameter(1)+2*func->GetParameter(2));
311  func->SetLineColor(kRed);
312 
313 
314  // draw
315  c->cd();
316  gPad->SetLeftMargin(0.15);
317  gPad->SetRightMargin(0.05);
318  gPad->SetBottomMargin(0.05);
319  gPad->SetTopMargin(0.05);
320  h_temp->Draw();
321  func->Draw("SAME");
322  c->Update();
323  c->SaveAs(Form("plots/iter_sub_randomized_cent%.0f-%.0f.png", cent_bins[icent], cent_bins[icent+1]));
324 
325  h1_reso_pt_iter_sub_randomized->SetBinContent(icent+1, func->GetParameter(2));
326 
327  }
328 
329  for(int icent = 0; icent < cent_N; ++icent)
330  {
331 
332  h2_reso_pt_area_avoidleading->GetYaxis()->SetRange(icent+1,icent+1);
333  TH1D * h_temp = (TH1D*)h2_reso_pt_area_avoidleading->ProjectionX();
334  h_temp->GetXaxis()->SetTitle("#delta p_{T} = p_{T}^{reco, avoidleading} - #rho A");
335  h_temp->GetYaxis()->SetTitle("Counts");
336  // fit
337  TF1 *func = new TF1("func","gaus",-15, 60);
338  h_temp->Fit(func,"Q","",-15, 60);
339  h_temp->Fit(func,"Q","",func->GetParameter(1)-2*func->GetParameter(2),func->GetParameter(1)+2*func->GetParameter(2));
340  func->SetLineColor(kRed);
341 
342 
343  // draw
344  c->cd();
345  gPad->SetLeftMargin(0.15);
346  gPad->SetRightMargin(0.05);
347  gPad->SetBottomMargin(0.05);
348  gPad->SetTopMargin(0.05);
349  h_temp->Draw();
350  func->Draw("SAME");
351  c->Update();
352  c->SaveAs(Form("plots/area_avoidleading_cent%.0f-%.0f.png", cent_bins[icent], cent_bins[icent+1]));
353 
354  h1_reso_pt_area_avoidleading->SetBinContent(icent+1, func->GetParameter(2));
355 
356  }
357 
358  for(int icent = 0; icent < cent_N; ++icent)
359  {
360 
361  h2_reso_pt_mult_avoidleading->GetYaxis()->SetRange(icent+1,icent+1);
362  TH1D * h_temp = (TH1D*)h2_reso_pt_mult_avoidleading->ProjectionX();
363  h_temp->GetXaxis()->SetTitle("#delta p_{T} = p_{T}^{reco, avoidleading} - #rho M");
364  h_temp->GetYaxis()->SetTitle("Counts");
365  // fit
366  TF1 *func = new TF1("func","gaus",-15, 60);
367  h_temp->Fit(func,"Q","",-15, 60);
368  h_temp->Fit(func,"Q","",func->GetParameter(1)-2*func->GetParameter(2),func->GetParameter(1)+2*func->GetParameter(2));
369  func->SetLineColor(kRed);
370 
371 
372  // draw
373  c->cd();
374  gPad->SetLeftMargin(0.15);
375  gPad->SetRightMargin(0.05);
376  gPad->SetBottomMargin(0.05);
377  gPad->SetTopMargin(0.05);
378  h_temp->Draw();
379  func->Draw("SAME");
380  c->Update();
381  c->SaveAs(Form("plots/mult_avoidleading_cent%.0f-%.0f.png", cent_bins[icent], cent_bins[icent+1]));
382 
383  h1_reso_pt_mult_avoidleading->SetBinContent(icent+1, func->GetParameter(2));
384 
385  }
386 
387  for(int icent = 0; icent < cent_N; ++icent)
388  {
389 
390  h2_reso_pt_iter_sub_avoidleading->GetYaxis()->SetRange(icent+1,icent+1);
391  TH1D * h_temp = (TH1D*)h2_reso_pt_iter_sub_avoidleading->ProjectionX();
392  h_temp->GetXaxis()->SetTitle("#delta p_{T} = p_{T}^{reco, avoidleading} - #rho M");
393  h_temp->GetYaxis()->SetTitle("Counts");
394  // fit
395  TF1 *func = new TF1("func","gaus",-15, 60);
396  h_temp->Fit(func,"Q","",-15, 60);
397  h_temp->Fit(func,"Q","",func->GetParameter(1)-2*func->GetParameter(2),func->GetParameter(1)+2*func->GetParameter(2));
398  func->SetLineColor(kRed);
399 
400 
401  // draw
402  c->cd();
403  gPad->SetLeftMargin(0.15);
404  gPad->SetRightMargin(0.05);
405  gPad->SetBottomMargin(0.05);
406  gPad->SetTopMargin(0.05);
407  h_temp->Draw();
408  func->Draw("SAME");
409  c->Update();
410  c->SaveAs(Form("plots/iter_sub_avoidleading_cent%.0f-%.0f.png", cent_bins[icent], cent_bins[icent+1]));
411 
412  h1_reso_pt_iter_sub_avoidleading->SetBinContent(icent+1, func->GetParameter(2));
413 
414  }
415 
416 
417  TCanvas *c1 = new TCanvas("c1","c1");
418  // gPad->SetLogy();
419 
420  TLegend *leg = new TLegend(.2,.7,.55,.9);
421  leg->SetFillStyle(0);
422  leg->AddEntry("","#it{#bf{sPHENIX}} Internal","");
423  leg->AddEntry("","Au+Au #sqrt{s_{NN}}=200 GeV","");
424  leg->AddEntry("","Random Cone #it{R} = 0.4, |#eta| < 0.4","");
425  leg->AddEntry("","p_{T, hard} = 30 GeV. Dijet sim.");
426 
427  TLegend *cleg = new TLegend(.6,.75,.9,.9);
428  cleg->SetFillStyle(0);
429  int colors[] = {1,2,4};
430 
431  h1_reso_pt_area->SetLineColor(colors[0]);
432  h1_reso_pt_area->SetMarkerColor(colors[0]);
433  h1_reso_pt_area->Draw();
434  cleg->AddEntry(h1_reso_pt_area,"Area","l");
435  h1_reso_pt_mult->SetLineColor(colors[1]);
436  h1_reso_pt_mult->SetMarkerColor(colors[1]);
437  h1_reso_pt_mult->Draw("SAME");
438  cleg->AddEntry(h1_reso_pt_mult,"Mult","l");
439  h1_reso_pt_iter_sub->SetLineColor(colors[2]);
440  h1_reso_pt_iter_sub->SetMarkerColor(colors[2]);
441  h1_reso_pt_iter_sub->Draw("SAME");
442  cleg->AddEntry(h1_reso_pt_iter_sub,"Iter","l");
443  cleg->Draw();
444  // leg->Draw();
445  c1->SaveAs("plots/cent_reso.png");
446 
447  TCanvas *c2 = new TCanvas("c2","c2");
448  // gPad->SetLogy();
449 
450  cleg->Clear();
451  h1_reso_pt_area_randomized->SetLineColor(colors[0]);
452  h1_reso_pt_area_randomized->SetMarkerColor(colors[0]);
453  h1_reso_pt_area_randomized->Draw();
454  cleg->AddEntry(h1_reso_pt_area_randomized,"Area","l");
455  h1_reso_pt_mult_randomized->SetLineColor(colors[1]);
456  h1_reso_pt_mult_randomized->SetMarkerColor(colors[1]);
457  h1_reso_pt_mult_randomized->Draw("SAME");
458  cleg->AddEntry(h1_reso_pt_mult_randomized,"Multiplicity","l");
459  h1_reso_pt_iter_sub_randomized->SetLineColor(colors[2]);
460  h1_reso_pt_iter_sub_randomized->SetMarkerColor(colors[2]);
461  h1_reso_pt_iter_sub_randomized->Draw("SAME");
462  cleg->AddEntry(h1_reso_pt_iter_sub_randomized,"Iterative Subtraction","l");
463  cleg->Draw();
464  // leg->Draw();
465  c2->SaveAs("plots/cent_reso_randomized.png");
466 
467  TCanvas *c3 = new TCanvas("c3","c3");
468  // gPad->SetLogy();
469 
470  cleg->Clear();
471  h1_reso_pt_area_avoidleading->SetLineColor(colors[0]);
472  h1_reso_pt_area_avoidleading->SetMarkerColor(colors[0]);
473  h1_reso_pt_area_avoidleading->Draw();
474  cleg->AddEntry(h1_reso_pt_area_avoidleading,"Area","l");
475  h1_reso_pt_mult_avoidleading->SetLineColor(colors[1]);
476  h1_reso_pt_mult_avoidleading->SetMarkerColor(colors[1]);
477  h1_reso_pt_mult_avoidleading->Draw("SAME");
478  cleg->AddEntry(h1_reso_pt_mult_avoidleading,"Multiplicity","l");
479  h1_reso_pt_iter_sub_avoidleading->SetLineColor(colors[2]);
480  h1_reso_pt_iter_sub_avoidleading->SetMarkerColor(colors[2]);
481  h1_reso_pt_iter_sub_avoidleading->Draw("SAME");
482  cleg->AddEntry(h1_reso_pt_iter_sub_avoidleading,"Iterative Subtraction","l");
483  cleg->Draw();
484  // leg->Draw();
485  c3->SaveAs("plots/cent_reso_avoidleading.png");
486 
487  TCanvas *c4 = new TCanvas("c4","c4");
488  // gPad->SetLogy();
489 
490  cleg->Clear();
491  h1_reso_pt_area->SetLineColor(colors[0]);
492  h1_reso_pt_area->SetMarkerColor(colors[0]);
493 
494 
495  h1_reso_pt_area_randomized->SetLineColor(colors[1]);
496  h1_reso_pt_area_randomized->SetMarkerColor(colors[1]);
497  h1_reso_pt_area_randomized->Draw();
498  h1_reso_pt_area->Draw("SAME");
499  cleg->AddEntry(h1_reso_pt_area,"RC","l");
500  cleg->AddEntry(h1_reso_pt_area_randomized,"Randomized","l");
501  h1_reso_pt_area_avoidleading->SetLineColor(colors[2]);
502  h1_reso_pt_area_avoidleading->SetMarkerColor(colors[2]);
503  h1_reso_pt_area_avoidleading->Draw("SAME");
504  cleg->AddEntry(h1_reso_pt_area_avoidleading,"Avoid Leading","l");
505  cleg->Draw();
506  // leg->Draw();
507  c4->SaveAs("plots/cent_reso_area.png");
508 
509  TCanvas *c5 = new TCanvas("c5","c5");
510  // gPad->SetLogy();
511 
512  cleg->Clear();
513  h1_reso_pt_mult->SetLineColor(colors[0]);
514  h1_reso_pt_mult->SetMarkerColor(colors[0]);
515  h1_reso_pt_mult_randomized->SetLineColor(colors[1]);
516  h1_reso_pt_mult_randomized->SetMarkerColor(colors[1]);
517  h1_reso_pt_mult_randomized->Draw();
518  h1_reso_pt_mult->Draw("SAME");
519  cleg->AddEntry(h1_reso_pt_mult,"RC","l");
520  cleg->AddEntry(h1_reso_pt_mult_randomized,"Randomized","l");
521  h1_reso_pt_mult_avoidleading->SetLineColor(colors[2]);
522  h1_reso_pt_mult_avoidleading->SetMarkerColor(colors[2]);
523  h1_reso_pt_mult_avoidleading->Draw("SAME");
524  cleg->AddEntry(h1_reso_pt_mult_avoidleading,"Avoid Leading","l");
525  cleg->Draw();
526 
527  // leg->Draw();
528  c5->SaveAs("plots/cent_reso_mult.png");
529 
530  TCanvas *c6 = new TCanvas("c6","c6");
531  // gPad->SetLogy();
532 
533  cleg->Clear();
534  h1_reso_pt_iter_sub->SetLineColor(colors[0]);
535  h1_reso_pt_iter_sub->SetMarkerColor(colors[0]);
536 
537  h1_reso_pt_iter_sub_randomized->SetLineColor(colors[1]);
538  h1_reso_pt_iter_sub_randomized->SetMarkerColor(colors[1]);
539  h1_reso_pt_iter_sub_randomized->Draw();
540  h1_reso_pt_iter_sub->Draw("SAME");
541  cleg->AddEntry(h1_reso_pt_iter_sub,"RC","l");
542  cleg->AddEntry(h1_reso_pt_iter_sub_randomized,"Randomized","l");
543  h1_reso_pt_iter_sub_avoidleading->SetLineColor(colors[2]);
544 
545  h1_reso_pt_iter_sub_avoidleading->SetMarkerColor(colors[2]);
546  h1_reso_pt_iter_sub_avoidleading->Draw("SAME");
547  cleg->AddEntry(h1_reso_pt_iter_sub_avoidleading,"Avoid Leading","l");
548  cleg->Draw();
549  // leg->Draw();
550  c6->SaveAs("plots/cent_reso_iter_sub.png");
551 
552 
553  // write histograms to file
554  fout->cd();
555  h2_reso_pt_area->Write();
556  h1_reso_pt_area->Write();
557  h2_reso_pt_mult->Write();
558  h1_reso_pt_mult->Write();
559  h2_reso_pt_iter_sub->Write();
560  h1_reso_pt_iter_sub->Write();
561 
562  h2_reso_pt_area_randomized->Write();
563  h1_reso_pt_area_randomized->Write();
564  h2_reso_pt_mult_randomized->Write();
565  h1_reso_pt_mult_randomized->Write();
566  h2_reso_pt_iter_sub_randomized->Write();
567  h1_reso_pt_iter_sub_randomized->Write();
568 
569  h2_reso_pt_area_avoidleading->Write();
570  h1_reso_pt_area_avoidleading->Write();
571  h2_reso_pt_mult_avoidleading->Write();
572  h1_reso_pt_mult_avoidleading->Write();
573  h2_reso_pt_iter_sub_avoidleading->Write();
574  h1_reso_pt_iter_sub_avoidleading->Write();
575 
576  // close output file
577  fout->Close();
578 
579  // close input file
580  fin.Close();
581 
582 
583  return 0;
584 
585 
586 
587 }
588