]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGGA/PHOSTasks/PHOS_PbPb/macros/DrawPi0Spectrum.C
7e2d5cf01a7c73d5ac2f9b22779cdf854f270130
[u/mrichter/AliRoot.git] / PWGGA / PHOSTasks / PHOS_PbPb / macros / DrawPi0Spectrum.C
1 // Macro for drawing (raw) pi0 spectrum
2 // Uses files produced by MakeMmixPi0.C
3 // author: Yuri Kharlov <Yuri.Kharlov@cern.ch>
4
5 const char *centrality[] = {"0-10%","10-40%","40-80%"};
6
7 DrawPi0Spectrum()
8 {
9   PPRstyle();
10   gStyle->SetOptTitle(0);
11   gStyle->SetPadRightMargin(0.05);
12   gStyle->SetPadTopMargin(0.05);
13   gStyle->SetPadLeftMargin(0.12);
14
15   DrawPi0SpectrumCentral();
16   DrawPi0SpectrumSemiCentral(1);
17   // DrawPi0SpectrumSemiCentral(2);
18
19   // DrawPi0SpectrumCentralTrigger();
20   // DrawPi0SpectrumSemiCentralTrigger(2);
21 }
22
23 //-----------------------------------------------------------------------------
24 DrawPi0SpectrumCentral()
25 {
26   f1=new TFile("LHC11h_Pi0_FitResult.root");
27
28   h1 = (TH1D*)f1->Get("MixAll_cent0_yr2int");
29   h2 = (TH1D*)f1->Get("MixCPV_cent0_yr2int");
30   h3 = (TH1D*)f1->Get("MixDisp_cent0_yr2int");
31
32   Int_t nPt = h1->GetNbinsX();
33   for (Int_t iPt=1; iPt<=nPt; iPt++) {
34     Double_t binWidth = h1->GetBinWidth(iPt);
35     h1->SetBinContent(iPt,h1->GetBinContent(iPt)/binWidth);
36     h1->SetBinError  (iPt,h1->GetBinError  (iPt)/binWidth);
37     h2->SetBinContent(iPt,h2->GetBinContent(iPt)/binWidth);
38     h2->SetBinError  (iPt,h2->GetBinError  (iPt)/binWidth);
39     h3->SetBinContent(iPt,h3->GetBinContent(iPt)/binWidth);
40     h3->SetBinError  (iPt,h3->GetBinError  (iPt)/binWidth);
41   }
42
43   h1->SetXTitle("p_{T} (GeV/c)");
44   h2->SetXTitle("p_{T} (GeV/c)");
45   h3->SetXTitle("p_{T} (GeV/c)");
46   h1->SetYTitle("(1/N_{AA}) dN/p_{T} (GeV/c)^{-1}");
47   h2->SetYTitle("(1/N_{AA}) dN/p_{T} (GeV/c)^{-1}");
48   h3->SetYTitle("(1/N_{AA}) dN/p_{T} (GeV/c)^{-1}");
49   h1->SetMarkerStyle(20);
50   h2->SetMarkerStyle(20);
51   h3->SetMarkerStyle(20);
52   h1->SetMarkerColor(kRed);
53   h2->SetMarkerColor(kBlue);
54   h3->SetMarkerColor(kGreen+2);
55   h1->SetLineColor(kRed);
56   h2->SetLineColor(kBlue);
57   h3->SetLineColor(kGreen+2);
58
59   TH1D *effCPV = (TH1D*)h2->Clone("effCPV");
60   effCPV->Divide(h2,h1,1.,1.,"B");
61   effCPV->SetYTitle("PID/no PID");
62   effCPV->SetMarkerColor(kBlue);
63   effCPV->SetLineColor(kBlue);
64
65   TH1D *effDisp = (TH1D*)h3->Clone("effDisp");
66   effDisp->Divide(h3,h1,1.,1.,"B");
67   effDisp->SetYTitle("PID/no PID");
68   effDisp->SetMarkerColor(kGreen+2);
69   effDisp->SetLineColor(kGreen+2);
70
71   TCanvas *c11 = new TCanvas("c11","c11");
72   gPad->SetGridx();
73   gPad->SetGridy();
74   gPad->SetLogy();
75   h1->Draw();
76   h2->Draw("same");
77   h3->Draw("same");
78   l11 = new TLegend(0.6,0.75,0.89,0.89);
79   l11->SetFillColor(kWhite);
80   l11->SetBorderSize(1);
81   l11->AddEntry(h1,"No PID","lp");
82   l11->AddEntry(h2,"PID=CPV","lp");
83   l11->AddEntry(h3,"PID=Disp","lp");
84   l11->Draw();
85   c11->Print(Form("LHC11h_pi0Spectrum_PIDspectra.eps"));
86
87   TCanvas *c12 = new TCanvas("c12","c12");
88   gPad->SetGridx();
89   gPad->SetGridy();
90   effCPV ->SetAxisRange(0.,1.09,"Y");
91   effCPV ->Draw();
92   effDisp->Draw("same");
93   l12 = new TLegend(0.75,0.80,0.94,0.94);
94   l12->SetFillColor(kWhite);
95   l12->SetBorderSize(1);
96   l12->AddEntry(effCPV ,"PID=CPV","lp");
97   l12->AddEntry(effDisp,"PID=Disp","lp");
98   l12->Draw();
99   c12->Print(Form("LHC11h_pi0Spectrum_PIDeffi.eps"));
100 }
101
102 //-----------------------------------------------------------------------------
103 void DrawPi0SpectrumSemiCentral(const Int_t cent=1)
104 {
105   f1=new TFile("LHC11h_calo_Pi0_FitResult_kPHOSPb_v2.root");
106   f3=new TFile("LHC11h_calo_Pi0_FitResult_kSemiCentral_v2.root");
107
108   h1 = (TH1D*)f1->Get(Form("MixDisp10_cent%d_yr2int",cent));
109   h3 = (TH1D*)f3->Get(Form("MixDisp10_cent%d_yr2",cent));
110
111   TPaveText *txt = new TPaveText(0.6,0.9,0.8,0.99,"NDC");
112   txt->SetFillColor(kWhite);
113   txt->SetBorderSize(1);
114   txt->AddText(Form("Centrality %s",centrality[cent]));
115
116   Int_t nPt = h1->GetNbinsX();
117   for (Int_t iPt=1; iPt<=nPt; iPt++) {
118     Double_t binWidth = h1->GetBinWidth(iPt);
119     h1->SetBinContent(iPt,h1->GetBinContent(iPt)/binWidth);
120     h1->SetBinError  (iPt,h1->GetBinError  (iPt)/binWidth);
121     h3->SetBinContent(iPt,h3->GetBinContent(iPt)/binWidth);
122     h3->SetBinError  (iPt,h3->GetBinError  (iPt)/binWidth);
123   }
124
125   h1->SetXTitle("p_{T} (GeV/c)");
126   h3->SetXTitle("p_{T} (GeV/c)");
127   h1->SetYTitle("(1/N_{AA}) dN/p_{T} (GeV/c)^{-1}");
128   h3->SetYTitle("(1/N_{AA}) dN/p_{T} (GeV/c)^{-1}");
129   h1->SetMarkerStyle(20);
130   h3->SetMarkerStyle(20);
131   h1->SetMarkerColor(kRed);
132   h3->SetMarkerColor(kBlue);
133   h1->SetLineColor(kRed);
134   h3->SetLineColor(kBlue);
135
136   TH1D *ratioSemiCent = (TH1D*)h1->Clone(Form("ratioSemiCent%d",cent));
137   ratioSemiCent->Divide(h3);
138   ratioSemiCent->SetYTitle("kPHOS/kSemiCentral");
139   ratioSemiCent->SetMarkerColor(kBlack);
140   ratioSemiCent->SetLineColor(kBlack);
141   ratioSemiCent->SetAxisRange(0.,150.,"Y");
142   ratioSemiCent->Fit("pol0","Q","",10.,30.);
143   Double_t suppr = ratioSemiCent->GetFunction("pol0")->GetParameter(0);
144   h1->Scale(1./suppr);
145
146   TCanvas *c21 = new TCanvas("c21","c21");
147   gPad->SetLogy();
148   h3->SetMinimum(2e-09);
149   h3->Draw();
150   h1->Draw("same");
151   l21 = new TLegend(0.5,0.75,0.89,0.89);
152   l21->SetFillColor(kWhite);
153   l21->SetBorderSize(1);
154   l21->AddEntry(h1,"PHOS trigger","lp");
155   l21->AddEntry(h3,"SemiCentral trigger","lp");
156   l21->Draw();
157   txt->Draw();
158   c21->Print(Form("LHC11h_pi0Spectrum_SemiCent%d.eps",cent));
159
160   TCanvas *c22 = new TCanvas("c22","c22");
161   ratioSemiCent->DrawClone();
162   txt->Draw();
163   c22->Print(Form("LHC11h_pi0Ratio_SemiCent%d.eps",cent));
164 }
165
166 DrawPi0SpectrumCentralTrigger()
167 {
168   f1=new TFile("out/kCentral/Pi0_FitResult_0.root");
169   f2=new TFile("out/kMB/Pi0_FitResult_0.root");
170   f3=new TFile("out/kPHOSPb/Pi0_FitResult_0.root");
171
172   h1 = (TH1D*)f1->Get("MixCPV_cent0_yr2int");
173   h2 = (TH1D*)f2->Get("MixCPV_cent0_yr2int");
174   h3 = (TH1D*)f3->Get("MixCPV_cent0_yr2int");
175
176   Int_t nPt = h1->GetNbinsX();
177   for (Int_t iPt=1; iPt<=nPt; iPt++) {
178     Double_t binWidth = h1->GetBinWidth(iPt);
179     h1->SetBinContent(iPt,h1->GetBinContent(iPt)/binWidth);
180     h1->SetBinError  (iPt,h1->GetBinError  (iPt)/binWidth);
181     h2->SetBinContent(iPt,h2->GetBinContent(iPt)/binWidth);
182     h2->SetBinError  (iPt,h2->GetBinError  (iPt)/binWidth);
183     h3->SetBinContent(iPt,h3->GetBinContent(iPt)/binWidth);
184     h3->SetBinError  (iPt,h3->GetBinError  (iPt)/binWidth);
185   }
186
187   h1->GetYaxis()->SetRangeUser(10.e**-8, 0.2);
188   h1->SetXTitle("p_{T} (GeV/c)");
189   h2->SetXTitle("p_{T} (GeV/c)");
190   h3->SetXTitle("p_{T} (GeV/c)");
191   h1->SetTitle("Raw production, PID=CPV, centrality: 0-10%");
192   h1->SetYTitle("(1/N_{AA}) dN/dp_{T} (GeV/c)^{-1}");
193   h2->SetYTitle("(1/N_{AA}) dN/dp_{T} (GeV/c)^{-1}");
194   h3->SetYTitle("(1/N_{AA}) dN/dp_{T} (GeV/c)^{-1}");
195   h1->SetMarkerStyle(20);
196   h2->SetMarkerStyle(21);
197   h3->SetMarkerStyle(22);
198   h1->SetMarkerColor(kRed);
199   h2->SetMarkerColor(kBlue);
200   h3->SetMarkerColor(kGreen+2);
201   h1->SetLineColor(kRed);
202   h2->SetLineColor(kBlue);
203   h3->SetLineColor(kGreen+2);
204
205   TH1D *effCPV = (TH1D*)h2->Clone("effCPV");
206   effCPV->Divide(h2,h1,1.,1.,"B");
207   effCPV->SetYTitle("PID/no PID");
208   effCPV->SetMarkerColor(kBlue);
209   effCPV->SetLineColor(kBlue);
210
211   TH1D *effDisp = (TH1D*)h3->Clone("effDisp");
212   effDisp->Divide(h3,h1,1.,1.,"B");
213   effDisp->SetYTitle("PID/no PID");
214   effDisp->SetMarkerColor(kGreen+2);
215   effDisp->SetLineColor(kGreen+2);
216
217   TCanvas *c11 = new TCanvas("c11","c11");
218   gPad->SetGridx();
219   gPad->SetGridy();
220   gPad->SetLogy();
221
222   // TF1* func = new TF1("func", "exp([0]+[1]*x)/x**4", 2, 30);
223   // func->SetLineColor(kRed);
224   // //h1->Fit(func, "", "", 2, 10);
225   // //h1->Fit(func, "+", "", 8, 20);
226   // h1->Fit(func, "+", "", 5, 30);
227
228   // func->SetLineColor(kBlue);
229   // h2->Fit(func, "", "", 2, 13);
230
231   // func->SetLineColor(kGreen+2);
232   // h3->Fit(func, "", "", 10, 25);
233
234
235   h1->Draw();
236   h2->Draw("same");
237   h3->Draw("same");
238   l11 = new TLegend(0.6,0.75,0.89,0.89);
239   l11->SetFillColor(kWhite);
240   l11->SetBorderSize(1);
241   l11->AddEntry(h1,"kCentral","lp");
242   l11->AddEntry(h2,"kMB","lp");
243   l11->AddEntry(h3,"kPHOSPb","lp");
244   l11->Draw();
245   c11->Print(Form("LHC11h_pi0Spectrum_PIDspectra.eps"));
246
247   TCanvas *c12 = new TCanvas("c12","c12");
248   gPad->SetGridx();
249   gPad->SetGridy();
250   effCPV ->SetAxisRange(0.,1.09,"Y");
251   effCPV ->Draw();
252   effDisp->Draw("same");
253   l12 = new TLegend(0.75,0.80,0.94,0.94);
254   l12->SetFillColor(kWhite);
255   l12->SetBorderSize(1);
256   l12->AddEntry(effCPV ,"PID=CPV","lp");
257   l12->AddEntry(effDisp,"PID=Disp","lp");
258   l12->Draw();
259   c12->Print(Form("LHC11h_pi0Spectrum_PIDeffi.eps"));
260 }
261
262
263 void DrawPi0SpectrumSemiCentralTrigger(int cent = 1)
264 {
265   f1=new TFile(Form("out/kSemiCentral/Pi0_FitResult_%d.root", cent));
266   f2=new TFile(Form("out/kMB/Pi0_FitResult_%d.root", cent));
267   f3=new TFile(Form("out/kPHOSPb/Pi0_FitResult_%d.root", cent));
268
269   h1 = (TH1D*)f1->Get(Form("MixCPV_cent%d_yr2int", cent));
270   h2 = (TH1D*)f2->Get(Form("MixCPV_cent%d_yr2int", cent));
271   h3 = (TH1D*)f3->Get(Form("MixCPV_cent%d_yr2int", cent));
272
273   Int_t nPt = h1->GetNbinsX();
274   for (Int_t iPt=1; iPt<=nPt; iPt++) {
275     Double_t binWidth = h1->GetBinWidth(iPt);
276     h1->SetBinContent(iPt,h1->GetBinContent(iPt)/binWidth);
277     h1->SetBinError  (iPt,h1->GetBinError  (iPt)/binWidth);
278     h2->SetBinContent(iPt,h2->GetBinContent(iPt)/binWidth);
279     h2->SetBinError  (iPt,h2->GetBinError  (iPt)/binWidth);
280     h3->SetBinContent(iPt,h3->GetBinContent(iPt)/binWidth);
281     h3->SetBinError  (iPt,h3->GetBinError  (iPt)/binWidth);
282   }
283
284   h1->GetYaxis()->SetRangeUser(10.e**-8, 0.2);
285   h1->SetXTitle("p_{T} (GeV/c)");
286   h2->SetXTitle("p_{T} (GeV/c)");
287   h3->SetXTitle("p_{T} (GeV/c)");
288   h1->SetTitle(Form("Raw production, PID=CPV, centrality: %s", centrality[cent]));
289   h1->SetYTitle("(1/N_{AA}) dN/dp_{T} (GeV/c)^{-1}");
290   h2->SetYTitle("(1/N_{AA}) dN/dp_{T} (GeV/c)^{-1}");
291   h3->SetYTitle("(1/N_{AA}) dN/dp_{T} (GeV/c)^{-1}");
292   h1->SetMarkerStyle(20);
293   h2->SetMarkerStyle(21);
294   h3->SetMarkerStyle(22);
295   h1->SetMarkerColor(kRed);
296   h2->SetMarkerColor(kBlue);
297   h3->SetMarkerColor(kGreen+2);
298   h1->SetLineColor(kRed);
299   h2->SetLineColor(kBlue);
300   h3->SetLineColor(kGreen+2);
301
302   TH1D *effCPV = (TH1D*)h2->Clone("effCPV");
303   effCPV->Divide(h2,h1,1.,1.,"B");
304   effCPV->SetYTitle("PID/no PID");
305   effCPV->SetMarkerColor(kBlue);
306   effCPV->SetLineColor(kBlue);
307
308   TH1D *effDisp = (TH1D*)h3->Clone("effDisp");
309   effDisp->Divide(h3,h1,1.,1.,"B");
310   effDisp->SetYTitle("PID/no PID");
311   effDisp->SetMarkerColor(kGreen+2);
312   effDisp->SetLineColor(kGreen+2);
313
314   TCanvas *c11 = new TCanvas("c11","c11");
315   gPad->SetGridx();
316   gPad->SetGridy();
317   gPad->SetLogy();
318
319   // TF1* func = new TF1("func", "exp([0]+[1]*x)/x**4", 2, 30);
320   // func->SetLineColor(kRed);
321   // //h1->Fit(func, "", "", 2, 10);
322   // //h1->Fit(func, "+", "", 8, 20);
323   // h1->Fit(func, "+", "", 5, 30);
324
325   // func->SetLineColor(kBlue);
326   // h2->Fit(func, "", "", 2, 13);
327
328   // func->SetLineColor(kGreen+2);
329   // h3->Fit(func, "", "", 10, 25);
330
331
332   h1->Draw();
333   h2->Draw("same");
334   h3->Draw("same");
335   l11 = new TLegend(0.6,0.75,0.89,0.89);
336   l11->SetFillColor(kWhite);
337   l11->SetBorderSize(1);
338   l11->AddEntry(h1,"kSemiCentral","lp");
339   l11->AddEntry(h2,"kMB","lp");
340   l11->AddEntry(h3,"kPHOSPb","lp");
341   l11->Draw();
342   c11->Print(Form("LHC11h_pi0Spectrum_PIDspectra.eps"));
343
344   TCanvas *c12 = new TCanvas("c12","c12");
345   gPad->SetGridx();
346   gPad->SetGridy();
347   effCPV ->SetAxisRange(0.,1.09,"Y");
348   effCPV ->Draw();
349   effDisp->Draw("same");
350   l12 = new TLegend(0.75,0.80,0.94,0.94);
351   l12->SetFillColor(kWhite);
352   l12->SetBorderSize(1);
353   l12->AddEntry(effCPV ,"PID=CPV","lp");
354   l12->AddEntry(effDisp,"PID=Disp","lp");
355   l12->Draw();
356   c12->Print(Form("LHC11h_pi0Spectrum_PIDeffi.eps"));
357 }
358
359 //-----------------------------------------------------------------------------
360 PPRstyle()
361 {
362
363   gStyle->SetPalette(1);
364   // gStyle->SetCanvasBorderMode(-1);
365   gStyle->SetCanvasBorderSize(1);
366   gStyle->SetCanvasColor(10);
367
368   gStyle->SetFrameFillColor(10);
369   gStyle->SetFrameBorderSize(1);
370   // gStyle->SetFrameBorderMode(-1);
371   // gStyle->SetFrameLineWidth(1.2);
372   gStyle->SetFrameLineColor(1);
373
374   gStyle->SetHistFillColor(0);
375   gStyle->SetHistLineWidth(2);
376   gStyle->SetHistLineColor(1);
377
378   gStyle->SetPadColor(10);
379   gStyle->SetPadBorderSize(1);
380   // gStyle->SetPadBorderMode(-1);
381
382   gStyle->SetStatColor(10);
383   gStyle->SetTitleColor(kBlack,"X");
384   gStyle->SetTitleColor(kBlack,"Y");
385   gStyle->SetTitleFillColor(kWhite);
386   gStyle->SetStatColor(kWhite);
387
388   gStyle->SetLabelSize(0.04,"X");
389   gStyle->SetLabelSize(0.04,"Y");
390   gStyle->SetLabelSize(0.04,"Z");
391   gStyle->SetTitleSize(0.04,"X");
392   gStyle->SetTitleSize(0.04,"Y");
393   gStyle->SetTitleSize(0.04,"Z");
394   gStyle->SetTitleFont(42,"X");
395   gStyle->SetTitleFont(42,"Y");
396   gStyle->SetTitleFont(42,"X");
397   gStyle->SetLabelFont(42,"X");
398   gStyle->SetLabelFont(42,"Y");
399   gStyle->SetLabelFont(42,"Z");
400   gStyle->SetStatFont(42);
401
402   gStyle->SetTitleOffset(1.0,"X");
403   gStyle->SetTitleOffset(1.2,"Y");
404
405   gStyle->SetOptDate(0);
406   gStyle->SetOptTitle(1);
407   gStyle->SetOptStat(0);
408   gStyle->SetOptFit(0);
409
410 }