PWGUD/dNdPt -> PWGLF/SPECTRA/ChargedHadrons/dNdPt
[u/mrichter/AliRoot.git] / PWGLF / SPECTRA / ChargedHadrons / dNdPt / macros / plots / makePlotsAlice3.C
CommitLineData
2803ac99 1//------------------------------------------------------------------------------
2// makePlotsAlice3.C
3//
4// create figure with ALICE INEL data and ratios to mod Hagedorn and powerlaw fit
5// fit ratios in seperate panels
6//------------------------------------------------------------------------------
7
8
9void makePlotsAlice3()
10{
11
12TGraphErrors *graphStatNsdAlice = new TGraphErrors(binsNsdAlice,ptNsdAlice,nsdAlice,0,statNsdAlice);
13graphStatNsdAlice->SetMarkerColor(colorAliceFit);
14graphStatNsdAlice->SetLineColor(colorAliceFit);
15graphStatNsdAlice->SetLineWidth(1);
16graphStatNsdAlice->SetMarkerStyle(20);
17graphStatNsdAlice->SetTitle("");
18
19TGraphErrors *graphStatInelAlice = new TGraphErrors(binsInelAlice,ptInelAlice,inelAlice,0,statInelAlice);
20graphStatInelAlice->SetMarkerColor(colorAliceFit);
21graphStatInelAlice->SetLineColor(colorAliceFit);
22graphStatInelAlice->SetLineWidth(1);
23graphStatInelAlice->SetMarkerStyle(20);
24graphStatInelAlice->SetTitle("");
25
26TGraphErrors *graphSystNsdAlice = new TGraphErrors(binsNsdAlice,centerPtNsdAlice,nsdAlice,0,systNsdAlice);
27graphSystNsdAlice->SetMarkerColor(colorAlice);
28graphSystNsdAlice->SetFillColor(colorAliceErrors);
29graphSystNsdAlice->SetLineColor(20);
30graphSystNsdAlice->SetTitle("");
31graphSystNsdAlice->SetMarkerStyle(20);
32
33TGraphErrors *graphSystInelAlice = new TGraphErrors(binsInelAlice,centerPtInelAlice,inelAlice,0,systInelAlice);
34graphSystInelAlice->SetMarkerColor(colorAlice);
35graphSystInelAlice->SetFillColor(colorAliceErrors);
36graphSystInelAlice->SetLineColor(20);
37graphSystInelAlice->SetTitle("");
38graphSystInelAlice->SetMarkerStyle(20);
39
40
41
42
43
44TCanvas *can23 = new TCanvas("can23","PlotsAlice3_INEL",520,876);
45
46TPad *pad23_1 = new TPad("pad23_1","pad23_1",0.0,425.0/876.0,1.0,1.0);
47setAttrib(pad23_1);
48pad23_1->SetBottomMargin(0);
49//pad23_1->SetTopMargin(0);
50pad23_1->SetBorderSize(0);
51
52
53
54TPad *pad23_2 = new TPad("pad23_2","pad23_2",0.0,(425.0-175.0)/876.0,1.0,425.0/876.0);
55setAttrib(pad23_2);.
56pad23_2->SetTopMargin(0.0);
57pad23_2->SetBottomMargin(0.0);
58pad23_2->SetBorderSize(0);
59
60TPad *pad23_3 = new TPad("pad23_2","pad23_2",0.0,0.0,1.0,(425.0-175.0)/876.0);
61setAttrib(pad23_3);
62pad23_3->SetTopMargin(0.0);
63//pad23_3->SetBottomMargin(0);
64pad23_3->SetBottomMargin(0.30);
65pad23_3->SetBorderSize(0);
66
67
68can23->cd();
69
70pad23_1->Draw();
71pad23_1->cd();
72pad23_1->SetLogx();
73pad23_1->SetLogy();
74
75graphStatInelAlice->Draw("APZ");
76//graphSystInelAlice->Draw("AE3");
77graphStatInelAlice->GetXaxis()->SetLimits(minPt,maxPt);
78graphStatInelAlice->GetXaxis()->SetTitle("p_{T} (GeV/c)");
79graphStatInelAlice->GetXaxis()->SetTitleOffset(1.6);
80graphStatInelAlice->GetYaxis()->SetTitleOffset(1.6);
81graphStatInelAlice->GetYaxis()->SetTitle("1/N_{evt} 1/(2#pi p_{T}) (d^{2}N_{ch})/(d#eta dp_{T}) (GeV/c)^{-2}");
82graphStatInelAlice->GetYaxis()->SetLimits(1.01e-7,10);
83graphStatInelAlice->GetYaxis()->SetRangeUser(1.01e-7,10);
84setAttrib(graphStatInelAlice);
85graphStatInelAlice->GetYaxis()->SetTitleOffset(2.8);
86
87//ptfunction2 = new TF1("ptfunction2","[0]*(1+(sqrt(0.14*0.14+x*x)-0.14)/([1]*[2]))^ ((-1) * [1])",0,12.0);
88ptfunction2 = new TF1("ptfunction2","[0]*(x/sqrt(0.14*0.14+x*x))*(1+(x)/([2]))^((-1) * [1])",0.0,10.0);
89
90powerlaw4 = new TF1("powerlaw4","[0]*x^[1]",0.0,10.0);
91
92ptfunction2->SetParameter(0,54.931915);
93ptfunction2->SetParameter(1,7.931081);
94ptfunction2->SetParameter(2,0.148710);
95ptfunction2->SetLineWidth(2);
96
97graphStatInelAlice->Fit("ptfunction2","MN","",0.0,10.0);
98graphStatInelAlice->Fit("powerlaw4","MN","",3.0,10.0);
99
100ptfunction2->SetLineColor(colorCms);
101powerlaw4->SetLineWidth(2);
102powerlaw4->SetLineColor(colorAtlas);
103
104powerlaw4->SetLineStyle(7); //was 7 for dashed
105powerlaw4->SetRange(1,3);
106powerlaw4->DrawCopy("SAME");
107
108ptfunction2->SetLineStyle(1); //was 7 for dashed
109ptfunction2->SetRange(4,10);
110ptfunction2->DrawCopy("SAME");
111
112powerlaw4->SetLineStyle(7);
113powerlaw4->SetRange(3,10);
114powerlaw4->DrawCopy("SAME");
115
116ptfunction2->SetLineStyle(1);
117ptfunction2->SetRange(0,4);
118ptfunction2->DrawCopy("SAME");
119
120
121
122//TLegend *leg23_1 = new TLegend(0.2,0.145,0.65,0.376);
123TLegend *leg23_1 = new TLegend(0.2,0.03,0.65,0.261);
124leg23_1->SetHeader("pp, INEL, #sqrt{s} = 900 GeV, | #eta | < 0.8");
125//leg23_1->AddEntry("","ALICE pp, INEL","");
126//leg23_1->AddEntry("","#sqrt{s} = 900 GeV, | #eta | < 0.8","");
127//leg23_1->AddEntry("","#LT p_{T} #GT = (469 #pm 1 #pm 12) MeV/c","");
128leg23_1->AddEntry(graphStatInelAlice,"ALICE data","LP");
129leg23_1->AddEntry(ptfunction2,"mod. Hagedorn fit","L");
130leg23_1->AddEntry(powerlaw4,"power law fit, p_{T} > 3 GeV/c","L");
131//leg23_1->AddEntry("","n (3-10 GeV/c) = 6.63 #pm 0.12 #pm 0.01","");
132
133leg23_1->SetFillColor(0);
134leg23_1->SetLineColor(0);
135leg23_1->SetTextSize(legendTextSize);
136leg23_1->Draw();
137/*
138TLegend *leg23_11 = new TLegend(0.2,0.03,0.3,0.088);
139leg23_11->SetFillColor(0);
140leg23_11->SetLineColor(0);
141leg23_11->SetTextSize(legendTextSize);
142leg23_11->AddEntry("","A*p_{T}^{-n}; n = 6.63 #pm 0.12","");
143leg23_11->Draw();
144*/
145
146can23->cd();
147/*
148pad23_11->Draw();
149pad23_11->cd();
150*/
151pad23_2->SetTopMargin(0.0);
152pad23_2->SetBottomMargin(0.0);
153pad23_2->Draw();
154pad23_2->cd();
155pad23_2->SetLogx();
156
157
158Double_t one[binsInelAlice];
159for (Int_t i=0; i < binsInelAlice; i++) {
160 one[i] = 1.0;
161}
162
163TGraphErrors *systInelAlice = new TGraphErrors(binsInelAlice*2);
164for (int i=0; i < binsInelAlice; i++) {
165 systInelAlice->SetPoint(i*2,lowPtInelAlice[i],1);
166 systInelAlice->SetPointError(i*2,0,relSystInelAlice[i]);
167 systInelAlice->SetPoint(i*2+1,highPtInelAlice[i],1);
168 systInelAlice->SetPointError(i*2+1,0,relSystInelAlice[i]);
169}
170//TGraphErrors *ratioAliceAlice = new TGraphErrors(binsInelAlice,centerPtInelAlice,one,0,relErr2InelAlice);
171
172systInelAlice->Draw("AE3");
173systInelAlice->SetFillColor(colorAliceErrors);
174systInelAlice->SetLineColor(colorAliceErrors);
175systInelAlice->SetTitle("");
176systInelAlice->SetLineWidth(0);
177systInelAlice->GetXaxis()->SetLimits(minPt,maxPt);
178systInelAlice->GetXaxis()->SetTitle("p_{T} (GeV/c)");
179systInelAlice->GetXaxis()->SetTitleOffset(1.4);
180systInelAlice->GetYaxis()->SetTitleOffset(0.9);
181systInelAlice->GetYaxis()->SetTitle("fit / data");
182systInelAlice->GetYaxis()->CenterTitle();
183systInelAlice->GetYaxis()->SetLabelSize(0.07);
184systInelAlice->GetXaxis()->SetLabelSize(0.07);
185systInelAlice->GetXaxis()->SetTitleSize(0.07);
186systInelAlice->GetYaxis()->SetTitleSize(0.07);
187systInelAlice->GetYaxis()->SetRangeUser(0.1,1.9);
188systInelAlice->GetYaxis()->SetLimits(0.1,1.9);
189setAttrib(systInelAlice);
190systInelAlice->GetYaxis()->SetNdivisions(505);
191systInelAlice->SetFillColor(colorAliceErrors);
192systInelAlice->SetLineColor(20);
193//systInelAlice->Clone()->Draw("L");
194systInelAlice->GetYaxis()->SetTitleOffset(2.8);
195
196TGraphErrors *ratioFitInelAlice = new TGraphErrors(binsInelAlice);
197for (int i=0; i < binsInelAlice; i++) {
198 if (ptInelAlice[i] > 4.0) break;
199 ratioFitInelAlice->SetPoint(i,ptInelAlice[i],ptfunction2->Eval(ptInelAlice[i])/inelAlice[i]);
200 ratioFitInelAlice->SetPointError(i,0,statInelAlice[i]*ptfunction2->Eval(ptInelAlice[i])/(inelAlice[i]*inelAlice[i]));
201}
202
203TGraphErrors *ratioPFitInelAlice = new TGraphErrors(binsInelAlice);
204for (int i=0; i < binsInelAlice; i++) {
205 ratioPFitInelAlice->SetPoint(i,ptInelAlice[i],powerlaw4->Eval(ptInelAlice[i])/inelAlice[i]);
206 ratioPFitInelAlice->SetPointError(i,0,statInelAlice[i]*powerlaw4->Eval(ptInelAlice[i])/(inelAlice[i]*inelAlice[i]));
207}
208
209TGraphErrors *ratioFitInelAliceNF = new TGraphErrors(binsInelAlice);
210for (int i=0; i < binsInelAlice; i++) {
211 ratioFitInelAliceNF->SetPoint(i,ptInelAlice[i],ptfunction2->Eval(ptInelAlice[i])/inelAlice[i]);
212 ratioFitInelAliceNF->SetPointError(i,0,statInelAlice[i]*ptfunction2->Eval(ptInelAlice[i])/(inelAlice[i]*inelAlice[i]));
213}
214
215TGraphErrors *ratioPFitInelAliceNF = new TGraphErrors(binsInelAlice);
216for (int i=0; i < binsInelAlice; i++) {
217 if (ptInelAlice[i] > 3.0) break;
218 ratioPFitInelAliceNF->SetPoint(i,ptInelAlice[i],powerlaw4->Eval(ptInelAlice[i])/inelAlice[i]);
219 ratioPFitInelAliceNF->SetPointError(i,0,statInelAlice[i]*powerlaw4->Eval(ptInelAlice[i])/(inelAlice[i]*inelAlice[i]));
220}
221
222
223systInelAlice->GetYaxis()->SetLabelOffset(0.023);
224
225setAttrib(ratioFitInelAliceNF);
226ratioFitInelAliceNF->SetLineWidth(1);
227ratioFitInelAliceNF->SetMarkerStyle(20);
228ratioFitInelAliceNF->SetMarkerColor(colorCms);
229ratioFitInelAliceNF->SetLineColor(colorCms);
230ratioFitInelAliceNF->Draw("PZ");
231
232setAttrib(ratioFitInelAlice);
233ratioFitInelAlice->SetLineWidth(1);
234ratioFitInelAlice->SetMarkerStyle(20);
235ratioFitInelAlice->SetMarkerColor(colorCms);
236ratioFitInelAlice->SetLineColor(colorCms);
237ratioFitInelAlice->Draw("PZ");
238
239
240setAttrib(ratioPFitInelAlice);
241ratioPFitInelAlice->SetLineWidth(1);
242ratioPFitInelAlice->SetMarkerStyle(20);
243ratioPFitInelAlice->SetMarkerColor(colorAtlas);
244ratioPFitInelAlice->SetLineColor(colorAtlas);
245//ratioPFitInelAlice->Draw("PZ");
246
247
248
249
250
251TF1 *fOne = new TF1("one","1",0.1,20);
252fOne->SetRange(0.1,20);
253fOne->SetLineWidth(1);
254fOne->Draw("SAME");
255
256TLegend *l23_2 = new TLegend(0.200,0.053,0.65,0.353);
257l23_2->AddEntry(systInelAlice,"ALICE systematic uncertainties","F");
258l23_2->AddEntry(ratioFitInelAlice,"mod. Hagedorn","LP");
259l23_2->SetFillColor(0);
260l23_2->SetLineColor(0);
261l23_2->SetTextSize(legendTextSize);
262l23_2->Draw();
263
264//ratioPFitInelAlice->Draw("PZ");
265
266
267
268can23->cd();
269// pad23_11->cd();
270
271pad23_3->Draw();
272pad23_3->cd();
273pad23_3->SetLogx();
274
275systInelAlice->Draw("AE3");
276systInelAlice->SetFillColor(colorAliceErrors);
277systInelAlice->SetLineColor(colorAliceErrors);
278systInelAlice->SetTitle("");
279systInelAlice->SetLineWidth(0);
280systInelAlice->GetXaxis()->SetLimits(minPt,maxPt);
281systInelAlice->GetXaxis()->SetTitle("p_{T} (GeV/c)");
282systInelAlice->GetXaxis()->SetTitleOffset(3.6);
283systInelAlice->GetYaxis()->SetTitleOffset(0.9);
284systInelAlice->GetYaxis()->SetTitle("fit / data");
285systInelAlice->GetYaxis()->CenterTitle();
286systInelAlice->GetYaxis()->SetLabelSize(0.07);
287systInelAlice->GetXaxis()->SetLabelSize(0.07);
288systInelAlice->GetXaxis()->SetTitleSize(0.07);
289systInelAlice->GetYaxis()->SetTitleSize(0.07);
290systInelAlice->GetYaxis()->SetRangeUser(0.1,1.9);
291systInelAlice->GetYaxis()->SetLimits(0.1,1.9);
292systInelAlice->GetYaxis()->SetNdivisions(505);
293setAttrib(systInelAlice);
294systInelAlice->SetFillColor(colorAliceErrors);
295systInelAlice->SetLineColor(20);
296systInelAlice->GetYaxis()->SetTitleOffset(2.8);
297systInelAlice->GetXaxis()->SetTitleOffset(4.6);
298
299setAttrib(ratioPFitInelAlice);
300ratioPFitInelAlice->SetLineWidth(1);
301ratioPFitInelAlice->SetMarkerStyle(20);
302ratioPFitInelAlice->SetMarkerColor(colorAtlas);
303ratioPFitInelAlice->SetLineColor(colorAtlas);
304ratioPFitInelAlice->Draw("PZ");
305
306setAttrib(ratioPFitInelAliceNF);
307ratioPFitInelAliceNF->SetLineWidth(1);
308ratioPFitInelAliceNF->SetMarkerStyle(20);
309ratioPFitInelAliceNF->SetMarkerColor(kWhite);
310ratioPFitInelAliceNF->SetLineColor(kWhite);
311ratioPFitInelAliceNF->DrawClone("PZ");
312
313setAttrib(ratioPFitInelAliceNF);
314ratioPFitInelAliceNF->SetLineWidth(1);
315ratioPFitInelAliceNF->SetMarkerStyle(24);
316ratioPFitInelAliceNF->SetMarkerColor(colorAtlas);
317ratioPFitInelAliceNF->SetLineColor(colorAtlas);
318ratioPFitInelAliceNF->Draw("PZ");
319
320fOne->Draw("SAME");
321
322
323TLegend *l23_3 = new TLegend(0.200,0.323,0.65,0.537);
324l23_3->AddEntry(systInelAlice,"ALICE systematic uncertainties","F");
325l23_3->AddEntry(ratioPFitInelAlice,"power law","LP");
326l23_3->SetFillColor(0);
327l23_3->SetLineColor(0);
328l23_3->SetTextSize(legendTextSize);
329l23_3->Draw();
330
331logoPrelim(can23);
332}