Transition PWG0 -> PWGUD
[u/mrichter/AliRoot.git] / PWGUD / dNdPt / macros / plots / makeCompInel.C
1 //------------------------------------------------------------------------------
2 // makeCompInel.C
3 //
4 // create figure with MC model comparisons
5 //------------------------------------------------------------------------------
6
7
8
9
10 void makeCompInel()
11 {
12 using namespace std;
13
14 TGraphErrors *graphInelAliceFit = new TGraphErrors(binsInelAlice,ptInelAlice,inelAlice,0,err2InelAlice);
15 graphInelAliceFit->SetMarkerColor(colorAliceFit);
16 graphInelAliceFit->SetLineColor(colorAliceFit);
17 graphInelAliceFit->SetLineWidth(1);
18 graphInelAliceFit->SetMarkerStyle(20);
19
20 TGraphErrors *graphInelAlice     = new TGraphErrors(binsInelAlice,centerPtInelAlice,inelAlice,0,0);
21 graphInelAlice->SetMarkerColor(colorAlice);
22 graphInelAlice->SetLineColor(colorAlice);
23 graphInelAlice->SetMarkerStyle(20);
24
25 TGraphErrors *graphPhojet = new TGraphErrors(binsPhojet,ptPhojet,inelPhojet,errPtPhojet,errInelPhojet);
26 graphPhojet->SetMarkerColor(colorPhojet);
27 graphPhojet->SetLineColor(colorPhojet);
28 graphPhojet->SetMarkerStyle(10);
29 graphPhojet->SetLineWidth(2);
30 graphPhojet->SetLineStyle(1);
31
32 TGraphErrors *graphPythia109 = new TGraphErrors(binsPythia109,ptPythia109,inelPythia109,errPtPythia109,errInelPythia109);
33 graphPythia109->SetMarkerColor(colorPythia109);
34 graphPythia109->SetLineColor(colorPythia109);
35 graphPythia109->SetMarkerStyle(10);
36 graphPythia109->SetLineWidth(2);
37 graphPythia109->SetLineStyle(7);
38
39 TGraphErrors *graphPythia306 = new TGraphErrors(binsPythia306,ptPythia306,inelPythia306,errPtPythia306,errInelPythia306);
40 graphPythia306->SetMarkerColor(colorPythia306);
41 graphPythia306->SetLineColor(colorPythia306);
42 graphPythia306->SetMarkerStyle(10);
43 graphPythia306->SetLineWidth(2);
44 graphPythia306->SetLineStyle(3);
45
46 TGraphErrors *graphPythia320 = new TGraphErrors(binsPythia320,ptPythia320,inelPythia320,errPtPythia320,errInelPythia320);
47 graphPythia320->SetMarkerColor(colorPythia320);
48 graphPythia320->SetLineColor(colorPythia320);
49 graphPythia320->SetMarkerStyle(10);
50 graphPythia320->SetLineWidth(2);
51 graphPythia320->SetLineStyle(9);
52
53 Double_t one[binsInelAlice];  
54 for (Int_t i=0; i < binsInelAlice; i++) { 
55     one[i] = 1.0;
56 }
57
58 TGraphErrors *ratioAliceAlice = new TGraphErrors(binsInelAlice*2);
59 for (int i=0; i < binsInelAlice; i++) {
60    ratioAliceAlice->SetPoint(i*2,lowPtInelAlice[i],1);
61    ratioAliceAlice->SetPointError(i*2,0,relErr2InelAlice[i]);
62    ratioAliceAlice->SetPoint(i*2+1,highPtInelAlice[i],1);   
63    ratioAliceAlice->SetPointError(i*2+1,0,relErr2InelAlice[i]);
64 }
65 //TGraphErrors *ratioAliceAlice = new TGraphErrors(binsInelAlice,centerPtInelAlice,one,0,relErr2InelAlice);
66 ratioAliceAlice->SetFillColor(colorAliceErrors);
67 ratioAliceAlice->SetLineColor(20);
68
69 TGraph *ratioPhojetAlice = new TGraph(binsInelAlice*2);
70 for (int i=0; i < binsInelAlice; i++) {
71    ratioPhojetAlice->SetPoint(i*2,lowPtInelAlice[i],inelPhojet[i+3]/inelAlice[i]);
72    ratioPhojetAlice->SetPoint(i*2+1,highPtInelAlice[i],inelPhojet[i+3]/inelAlice[i]);
73    cout << "inelAlice[" << i << "]           = " << inelAlice[i] <<endl;
74    cout << "centerPtInelAlice[" << i << "]   = " << centerPtInelAlice[i] <<endl;
75    cout << "inelPhojet[" << i+3 << "]          = " << inelPhojet[i+3] <<endl;
76    cout << "ptPhojet[" << i+3 << "]            = " << ptPhojet[i+3] <<endl;
77 }
78 //TGraphErrors *ratioPhojetAlice = divide(graphPhojet,graphInelAlice);
79 ratioPhojetAlice->SetFillColor(colorPhojet);
80 ratioPhojetAlice->SetLineColor(colorPhojet);
81 ratioPhojetAlice->SetLineWidth(2);
82 ratioPhojetAlice->SetLineStyle(1);
83 ratioPhojetAlice->SetMarkerStyle(26);
84 ratioPhojetAlice->SetFillStyle(3354);
85
86
87 TGraph *ratioPythia109Alice = new TGraph(binsInelAlice*2);
88 for (int i=0; i < binsInelAlice; i++) {
89    ratioPythia109Alice->SetPoint(i*2,lowPtInelAlice[i],inelPythia109[i+3]/inelAlice[i]);
90    ratioPythia109Alice->SetPoint(i*2+1,highPtInelAlice[i],inelPythia109[i+3]/inelAlice[i]);
91    cout << "inelAlice[" << i << "]           = " << inelAlice[i] <<endl;
92    cout << "centerPtInelAlice[" << i << "]   = " << centerPtInelAlice[i] <<endl;
93    cout << "inelPythia109[" << i+3 << "]          = " << inelPythia109[i+3] <<endl;
94    cout << "ptPythia109[" << i+3 << "]            = " << ptPythia109[i+3] <<endl;
95 }
96 //TGraphErrors *ratioPythia109Alice = divide(graphPythia109,graphInelAlice);
97 ratioPythia109Alice->SetFillColor(colorPythia109);
98 ratioPythia109Alice->SetLineColor(colorPythia109);
99 ratioPythia109Alice->SetLineWidth(2);
100 ratioPythia109Alice->SetLineStyle(7);
101 ratioPythia109Alice->SetMarkerStyle(26);
102 ratioPythia109Alice->SetFillStyle(3354);
103
104 TGraph *ratioPythia306Alice = new TGraph(binsInelAlice*2);
105 for (int i=0; i < binsInelAlice; i++) {
106    ratioPythia306Alice->SetPoint(i*2,lowPtInelAlice[i],inelPythia306[i+3]/inelAlice[i]);
107    ratioPythia306Alice->SetPoint(i*2+1,highPtInelAlice[i],inelPythia306[i+3]/inelAlice[i]);
108    cout << "inelAlice[" << i << "]           = " << inelAlice[i] <<endl;
109    cout << "centerPtInelAlice[" << i << "]   = " << centerPtInelAlice[i] <<endl;
110    cout << "inelPythia306[" << i+3 << "]          = " << inelPythia306[i+3] <<endl;
111    cout << "ptPythia306[" << i+3 << "]            = " << ptPythia306[i+3] <<endl;
112 }
113 //TGraphErrors *ratioPythia306Alice = divide(graphPythia306,graphInelAlice);
114 ratioPythia306Alice->SetFillColor(colorPythia306);
115 ratioPythia306Alice->SetLineColor(colorPythia306);
116 ratioPythia306Alice->SetLineWidth(2);
117 ratioPythia306Alice->SetLineStyle(3);
118 ratioPythia306Alice->SetMarkerStyle(26);
119 ratioPythia306Alice->SetFillStyle(3354);
120
121 TGraph *ratioPythia320Alice = new TGraph(binsInelAlice*2);
122 for (int i=0; i < binsInelAlice; i++) {
123    ratioPythia320Alice->SetPoint(i*2,lowPtInelAlice[i],inelPythia320[i+3]/inelAlice[i]);
124    ratioPythia320Alice->SetPoint(i*2+1,highPtInelAlice[i],inelPythia320[i+3]/inelAlice[i]);
125    cout << "inelAlice[" << i << "]           = " << inelAlice[i] <<endl;
126    cout << "centerPtInelAlice[" << i << "]   = " << centerPtInelAlice[i] <<endl;
127    cout << "inelPythia320[" << i+3 << "]          = " << inelPythia320[i+3] <<endl;
128    cout << "ptPythia320[" << i+3 << "]            = " << ptPythia320[i+3] <<endl;
129 }
130 //TGraphErrors *ratioPythia320Alice = divide(graphPythia320,graphInelAlice);
131 ratioPythia320Alice->SetFillColor(colorPythia320);
132 ratioPythia320Alice->SetLineColor(colorPythia320);
133 ratioPythia320Alice->SetLineWidth(2);
134 ratioPythia320Alice->SetLineStyle(9);
135 ratioPythia320Alice->SetMarkerStyle(26);
136 ratioPythia320Alice->SetFillStyle(3354);
137
138
139 TCanvas *can5 = new TCanvas("can5","CompInel",520,700);
140
141 TPad *pad5_1 = new TPad("pad5_1","pad5_1",0.0,0.35,1.0,1.0);
142 setAttrib(pad5_1);
143
144 TPad *pad5_2 = new TPad("pad5_2","pad5_2",0.0,0.0,1.0,0.35);
145 setAttrib(pad5_2);
146
147
148 //
149 can5->cd();
150
151 pad5_1->Draw();
152 pad5_1->cd();
153 pad5_1->SetLogx();
154 pad5_1->SetLogy();
155 //all->Draw("AE4");
156
157 TMultiGraph *all = new TMultiGraph("all","");
158
159 all->Add(graphPhojet);
160
161 all->Add(graphPythia109);
162 all->Add(graphPythia306);
163 all->Add(graphPythia320);
164 all->Draw("AXL");
165 all->GetXaxis()->SetLimits(minPt,maxPt);
166 all->GetXaxis()->SetTitle("p_{T} (GeV/c)");
167 all->GetXaxis()->SetTitleOffset(1.6);
168 all->GetYaxis()->SetTitleOffset(1.6);
169 all->GetYaxis()->SetTitle("1/N_{evt} 1/(2#pi p_{T}) (d^{2}N_{ch})/(d#eta dp_{T}) (GeV/c)^{-2}");
170 all->GetXaxis()->SetLimits(minPt,maxPt);
171 all->GetYaxis()->SetRangeUser(5e-8,10);
172 all->GetYaxis()->SetLimits(5e-8,10);
173 setAttrib(all);
174 graphInelAliceFit->Draw("PZ");
175
176 TLegend *l5_1 = new TLegend(0.200,0.03,0.65,0.376);
177 l5_1->SetHeader("pp, INEL, #sqrt{s} = 900 GeV, | #eta | < 0.8");
178 l5_1->AddEntry(graphInelAliceFit,"ALICE data","PL");
179 l5_1->AddEntry(graphPhojet,"PHOJET","L");
180 l5_1->AddEntry(graphPythia109,"PYTHIA D6T (109)","L");
181 l5_1->AddEntry(graphPythia306,"PYTHIA ATLAS-CSC (306)","L");
182 l5_1->AddEntry(graphPythia320,"PYTHIA Perugia0 (320)","L");
183
184 //l1->AddEntry(graphCms,"CMS |#eta|<2.4","LP");
185 //la->AddEntry(graphUA1,"UA1","p");
186 //la->AddEntry(graphCMS,"CMS","p");
187 //la->AddEntry(graphCMSred,"CMS, #eta<0.8","p");
188 //la->AddEntry(graphATLAS,"ATLAS","p");
189 l5_1->SetFillColor(0);
190 l5_1->SetLineColor(0);
191 l5_1->SetTextSize(legendTextSize);
192 l5_1->Draw();
193
194
195 //histo1->GetXaxis()->SetNdivisions(405);
196
197 can5->cd();
198 pad5_2->Draw();
199 pad5_2->cd();
200 pad5_2->SetLogx();
201
202 TMultiGraph *ratios = new TMultiGraph("ratios","");
203
204
205 //ratios->Add(ratioAliceAlice);
206 //ratios->Add(ratioAtlasAlice);
207 ratios->Add(ratioPhojetAlice);
208 ratios->Add(ratioPythia109Alice);
209 ratios->Add(ratioPythia306Alice);
210 ratios->Add(ratioPythia320Alice);
211
212 ratioAliceAlice->Draw("AE3");
213 ratioAliceAlice->SetTitle("");
214 ratioAliceAlice->GetXaxis()->SetLimits(minPt,maxPt);
215 ratioAliceAlice->GetXaxis()->SetTitle("p_{T} (GeV/c)");
216 ratioAliceAlice->GetXaxis()->SetTitleOffset(1.4);
217 ratioAliceAlice->GetYaxis()->SetTitleOffset(0.9);
218 ratioAliceAlice->GetYaxis()->SetTitle("ratio");
219 ratioAliceAlice->GetYaxis()->SetLabelSize(0.07);
220 ratioAliceAlice->GetXaxis()->SetLabelSize(0.07);
221 ratioAliceAlice->GetXaxis()->SetTitleSize(0.07);
222 ratioAliceAlice->GetYaxis()->SetTitleSize(0.07);
223 ratioAliceAlice->GetYaxis()->SetRangeUser(0.3,1.7);
224 ratioAliceAlice->GetYaxis()->SetLimits(0.3,1.7);
225 ratioAliceAlice->GetYaxis()->CenterTitle();
226 setAttrib(ratioAliceAlice);
227 ratioAliceAlice->GetYaxis()->SetLabelOffset(0.023); 
228
229
230 //ratio->SetTitle("ratio ALICE/ATLAS (different #eta)");
231 //ratios->Draw("XL");
232 ratios->Draw("XL");
233 //ratios->GetYaxis()->SetRangeUser(0.41,1.49);
234 //ratios->GetYaxis()->SetLimits(0.41,1.49);
235
236
237 graphInelAlice->SetFillColor(2);
238
239 TGraph* tmpG = new TGraph();
240 tmpG->SetMarkerColor(colorAliceFit);
241 tmpG->SetLineColor(colorAliceFit);
242 tmpG->SetMarkerStyle(10);
243 tmpG->SetLineWidth(2);
244 tmpG->SetLineStyle(1);
245
246 TLegend *l5_2 = new TLegend(0.200,0.759+0.005,0.65,0.973);
247 l5_2->AddEntry(ratioAliceAlice,"ALICE data uncertainties","F");
248 l5_2->AddEntry(tmpG,"MC / data","L");
249 //l2->AddEntry(ratioCmsAlice,"CMS / ALICE","F");
250 l5_2->SetFillColor(0);
251 l5_2->SetLineColor(0);
252 l5_2->SetTextSize(legendTextSize);
253 l5_2->Draw();
254
255
256
257 TF1 *fOne = new TF1("one","1",0.1,20);
258 fOne->SetRange(0.1,20);
259 fOne->SetLineWidth(1);
260 fOne->Draw("SAME");
261 //ratio->GetYaxis()->SetTitle("ratio ALICE/ATLAS"); 
262 /*
263 histo1c->Draw();
264 histo1c->GetXaxis()->SetLabelSize(0.08);
265 histo1c->GetYaxis()->SetLabelSize(0.08);
266 histo1c->GetXaxis()->SetNdivisions(405);
267 histo1c->GetYaxis()->SetNdivisions(405);
268 */
269
270 logoPrelim(can5);
271 }