]>
Commit | Line | Data |
---|---|---|
0740807a | 1 | // $Id$ |
2 | /* | |
3 | * Plotting macro for comparing offline- and HLT- ESD trees from | |
4 | * HLT-OFFLINE-GLOBAL-comparison.root produced using $ALICE_ROOT/HLT/QA/tasks/AliAnalysisTaskHLT.* | |
5 | * | |
6 | * Usage: aliroot drawGlobalESDHistograms.C'("HLT-OFFLINE-GLOBAL-comparison.root")' | |
7 | * | |
8 | * It saves the canvas with the output histograms in a png file. | |
9 | * | |
10 | * @ingroup alihlt_qa | |
11 | * @author Camilla.Stokkevag@student.uib.no, Kalliopi.Kanaki@ift.uib.no | |
12 | */ | |
13 | ||
14 | void drawGlobalESDHistograms(const char* filename="HLT-OFFLINE-GLOBAL-comparison.root"){ | |
15 | ||
16 | gROOT->SetStyle("Plain"); | |
17 | gStyle->SetPalette(1); | |
18 | gStyle->SetOptStat(10); | |
69c78ecd | 19 | gStyle->SetTitleX(gStyle->GetPadLeftMargin()); |
0740807a | 20 | |
fa315f9c | 21 | TFile *f1 = TFile::Open(filename); |
22 | if(!f1 || f1->IsZombie()) { | |
23 | printf("file %s does not exist or there is an error opening it\n", filename); | |
24 | return; | |
25 | } | |
26 | ||
0740807a | 27 | TList *l1 = (TList*)f1->Get("global_histograms"); |
fa315f9c | 28 | if(!l1){ |
29 | printf("No list %s contained in your input file\n", l1->GetName()); | |
30 | return; | |
31 | } | |
0740807a | 32 | |
33 | ||
34 | //=================================================================// | |
35 | //--------------- READ HISTOGRAMS ---------------------------------// | |
36 | //=================================================================// | |
37 | ||
38 | TH1F *h1 = l1->FindObject("fNcluster_hlt"); | |
39 | TH1F *h2 = l1->FindObject("fNcluster_off"); | |
40 | h1->SetTitle("cluster distribution"); | |
69c78ecd | 41 | h1->GetXaxis()->SetTitle("TPC clusters per track"); |
0740807a | 42 | h2->SetLineColor(2); |
43 | if(h1->GetMaximum() >= h2->GetMaximum()) h2->SetMaximum(1.1*h1->GetMaximum()); | |
44 | else h1->SetMaximum(1.1*h2->GetMaximum()); | |
45 | ||
46 | ||
47 | ||
3a510b95 | 48 | TH1F *h3 = l1->FindObject("fDCA_hlt"); |
49 | TH1F *h4 = l1->FindObject("fDCA_off"); | |
104ab5fb | 50 | TH1F *hSG = l1->FindObject("fDCA_hltSG"); |
0740807a | 51 | h3->SetTitle("DCA between track and vertex on XY plane"); |
52 | h3->GetXaxis()->SetTitle("DCAr (cm)"); | |
53 | h4->SetLineColor(2); | |
3a510b95 | 54 | hSG->SetLineColor(kBlue); |
0740807a | 55 | if(h3->GetMaximum() >= h4->GetMaximum()) h4->SetMaximum(1.1*h3->GetMaximum()); |
56 | else h3->SetMaximum(1.1*h4->GetMaximum()); | |
57 | ||
58 | ||
59 | TH1F *h5 = l1->FindObject("fMult_hlt"); | |
60 | TH1F *h6 = l1->FindObject("fMult_off"); | |
61 | h5->SetTitle("track multiplicity"); | |
62 | h6->SetLineColor(2); | |
63 | if(h5->GetMaximum() > h6->GetMaximum()) h6->SetMaximum(1.1*h5->GetMaximum()); | |
64 | else h5->SetMaximum(1.1*h6->GetMaximum()); | |
65 | ||
66 | ||
67 | TH1F *h7 = l1->FindObject("fCharge_hlt"); | |
68 | TH1F *h8 = l1->FindObject("fCharge_off"); | |
69 | h7->GetXaxis()->SetTitle("polarity"); | |
70 | h7->SetTitle("charge distribution"); | |
71 | h8->SetLineColor(2); | |
72 | if(h7->GetMaximum() > h8->GetMaximum()) h8->SetMaximum(1.1*h7->GetMaximum()); | |
73 | else h7->SetMaximum(1.1*h8->GetMaximum()); | |
74 | ||
75 | ||
76 | TH1F *h9 = l1->FindObject("fMomentum_hlt"); | |
77 | TH1F *h10 = l1->FindObject("fMomentum_off"); | |
78 | h9->GetXaxis()->SetTitle("p_{t} (GeV/c)"); | |
79 | h9->SetTitle("transverse momentum"); | |
80 | h10->SetLineColor(2); | |
81 | if(h9->GetMaximum() > h10->GetMaximum()) h10->SetMaximum(1.1*h9->GetMaximum()); | |
82 | else h9->SetMaximum(1.1*h10->GetMaximum()); | |
83 | ||
84 | ||
85 | TH1F *h11 = l1->FindObject("fEta_hlt"); | |
86 | TH1F *h12 = l1->FindObject("fEta_off"); | |
87 | h11->SetTitle("pseudorapidity"); | |
69c78ecd | 88 | h11->GetXaxis()->SetTitle("#eta"); |
0740807a | 89 | h12->SetLineColor(2); |
90 | if(h11->GetMaximum() > h12->GetMaximum()) h12->SetMaximum(1.1*h11->GetMaximum()); | |
91 | else h11->SetMaximum(1.1*h12->GetMaximum()); | |
92 | ||
93 | ||
94 | TH1F *h13 = l1->FindObject("fXvertex_hlt"); | |
95 | TH1F *h14 = l1->FindObject("fXvertex_off"); | |
69c78ecd | 96 | h13->GetXaxis()->SetTitle("x (cm)"); |
97 | h13->SetTitle("x of primary vertex"); | |
0740807a | 98 | h14->SetLineColor(2); |
99 | if(h13->GetMaximum() > h14->GetMaximum()) h14->SetMaximum(1.1*h13->GetMaximum()); | |
100 | else h13->SetMaximum(1.1*h14->GetMaximum()); | |
101 | ||
102 | TH1F *h15 = l1->FindObject("fYvertex_hlt"); | |
103 | TH1F *h16 = l1->FindObject("fYvertex_off"); | |
69c78ecd | 104 | h15->GetXaxis()->SetTitle("y (cm)"); |
105 | h15->SetTitle("y of primary vertex"); | |
0740807a | 106 | h16->SetLineColor(2); |
107 | if(h15->GetMaximum() > h16->GetMaximum()) h16->SetMaximum(1.1*h15->GetMaximum()); | |
108 | else h15->SetMaximum(1.1*h16->GetMaximum()); | |
109 | ||
110 | TH1F *h17 = l1->FindObject("fZvertex_hlt"); | |
111 | TH1F *h18 = l1->FindObject("fZvertex_off"); | |
69c78ecd | 112 | h17->GetXaxis()->SetTitle("z (cm)"); |
113 | h17->SetTitle("z of primary vertex"); | |
0740807a | 114 | h18->SetLineColor(2); |
115 | if(h17->GetMaximum() > h18->GetMaximum()) h18->SetMaximum(1.1*h17->GetMaximum()); | |
116 | else h17->SetMaximum(1.1*h18->GetMaximum()); | |
117 | ||
118 | ||
119 | // TH2F *h15 = l1->FindObject("fXYvertex_off"); | |
120 | // h15->GetXaxis()->SetTitle("X (cm)"); | |
121 | // h15->GetYaxis()->SetTitle("Y (cm)"); | |
122 | // h15->SetTitle("XY primary vertex Offline"); | |
123 | // | |
124 | // TH2F *h16 = l1->FindObject("fXYvertex_hlt"); | |
125 | // h16->GetXaxis()->SetTitle("X (cm)"); | |
126 | // h16->GetYaxis()->SetTitle("Y (cm)"); | |
127 | // h16->SetTitle("XY of primary vertex HLT"); | |
128 | ||
129 | TLegend *leg1 = new TLegend(0.6,0.6,0.8,0.8); | |
130 | leg1->SetFillColor(10); | |
131 | leg1->SetLineColor(10); | |
132 | leg1->AddEntry(h1,"HLT", "l"); | |
133 | leg1->AddEntry(h2,"OFF", "l"); | |
134 | ||
135 | ||
136 | ||
137 | //=================================================================// | |
138 | //--------------------- DRAW HISTOGRAMS ---------------------------// | |
139 | //=================================================================// | |
140 | ||
141 | ||
142 | ||
143 | TCanvas *c1 = new TCanvas("c1","HLT vs offline",1300,800); | |
144 | c1->Divide(3,3); | |
145 | ||
146 | c1->cd(1); | |
147 | h1->Draw(); | |
148 | h2->Draw("sames"); | |
149 | leg1->Draw("same"); | |
150 | ||
151 | gPad->Update(); | |
152 | TPaveStats *st1 = (TPaveStats*)h1->FindObject("stats"); | |
153 | st1->SetLineColor(0); | |
154 | ||
155 | gPad->Update(); | |
156 | TPaveStats *st2 = (TPaveStats*)h2->FindObject("stats"); | |
157 | st2->SetY1NDC(st1->GetY1NDC()-0.05); | |
158 | st2->SetY2NDC(st1->GetY2NDC()-0.05); | |
159 | st2->SetLineColor(0); | |
160 | st2->SetTextColor(h2->GetLineColor()); | |
161 | st2->SetFillStyle(0); | |
162 | st2->Draw(); | |
163 | ||
164 | //====================== | |
165 | ||
166 | c1->cd(2)->SetLogy(); | |
167 | h3->Draw(); | |
168 | h4->Draw("sames"); | |
3a510b95 | 169 | hSG->Draw("sames"); |
0740807a | 170 | leg1->Draw("same"); |
171 | ||
172 | gPad->Update(); | |
173 | TPaveStats *st3 = (TPaveStats*)h3->FindObject("stats"); | |
174 | st3->SetLineColor(0); | |
175 | ||
176 | gPad->Update(); | |
177 | TPaveStats *st4 = (TPaveStats*)h4->FindObject("stats"); | |
178 | st4->SetY1NDC(st3->GetY1NDC()-0.05); | |
179 | st4->SetY2NDC(st3->GetY2NDC()-0.05); | |
180 | st4->SetLineColor(0); | |
181 | st4->SetTextColor(h4->GetLineColor()); | |
182 | st4->SetFillStyle(0); | |
183 | st4->Draw(); | |
3a510b95 | 184 | |
185 | gPad->Update(); | |
186 | TPaveStats *stSG = (TPaveStats*)hSG->FindObject("stats"); | |
187 | stSG->SetY1NDC(st4->GetY1NDC()-0.05); | |
188 | stSG->SetY2NDC(st4->GetY2NDC()-0.05); | |
189 | stSG->SetLineColor(0); | |
190 | stSG->SetTextColor(hSG->GetLineColor()); | |
191 | stSG->SetFillStyle(0); | |
192 | stSG->Draw(); | |
0740807a | 193 | |
194 | //====================== | |
195 | ||
196 | c1->cd(3); | |
197 | h5->Draw(); | |
198 | h6->Draw("sames"); | |
199 | leg1->Draw("same"); | |
200 | ||
201 | gPad->Update(); | |
202 | TPaveStats *st5 = (TPaveStats*)h5->FindObject("stats"); | |
203 | st5->SetLineColor(0); | |
204 | ||
205 | gPad->Update(); | |
206 | TPaveStats *st6 = (TPaveStats*)h6->FindObject("stats"); | |
207 | st6->SetY1NDC(st5->GetY1NDC()-0.05); | |
208 | st6->SetY2NDC(st5->GetY2NDC()-0.05); | |
209 | st6->SetLineColor(0); | |
210 | st6->SetTextColor(h6->GetLineColor()); | |
211 | st6->SetFillStyle(0); | |
212 | st6->Draw(); | |
213 | ||
214 | //====================== | |
215 | ||
216 | c1->cd(4); | |
217 | h7->Draw(); | |
218 | h8->Draw("sames"); | |
219 | leg1->Draw("same"); | |
220 | ||
221 | gPad->Update(); | |
222 | TPaveStats *st7 = (TPaveStats*)h7->FindObject("stats"); | |
223 | st7->SetLineColor(0); | |
224 | ||
225 | gPad->Update(); | |
226 | TPaveStats *st8 = (TPaveStats*)h8->FindObject("stats"); | |
227 | st8->SetY1NDC(st7->GetY1NDC()-0.05); | |
228 | st8->SetY2NDC(st7->GetY2NDC()-0.05); | |
229 | st8->SetLineColor(0); | |
230 | st8->SetTextColor(h8->GetLineColor()); | |
231 | st8->SetFillStyle(0); | |
232 | st8->Draw(); | |
233 | ||
234 | //====================== | |
235 | ||
104ab5fb | 236 | c1->cd(5)->SetLogy(); |
0740807a | 237 | h9->Draw(); |
238 | h10->Draw("sames"); | |
239 | leg1->Draw("same"); | |
240 | ||
241 | gPad->Update(); | |
242 | TPaveStats *st9 = (TPaveStats*)h9->FindObject("stats"); | |
243 | st9->SetLineColor(0); | |
244 | ||
245 | gPad->Update(); | |
246 | TPaveStats *st10 = (TPaveStats*)h10->FindObject("stats"); | |
247 | st10->SetY1NDC(st9->GetY1NDC()-0.05); | |
248 | st10->SetY2NDC(st9->GetY2NDC()-0.05); | |
249 | st10->SetLineColor(0); | |
250 | st10->SetTextColor(h10->GetLineColor()); | |
251 | st10->SetFillStyle(0); | |
252 | st10->Draw(); | |
253 | ||
254 | //====================== | |
255 | ||
256 | c1->cd(6); | |
257 | h11->Draw(); | |
258 | h12->Draw("sames"); | |
259 | leg1->Draw("same"); | |
260 | ||
261 | gPad->Update(); | |
262 | TPaveStats *st11 = (TPaveStats*)h11->FindObject("stats"); | |
263 | st11->SetLineColor(0); | |
264 | ||
265 | gPad->Update(); | |
266 | TPaveStats *st12 = (TPaveStats*)h12->FindObject("stats"); | |
267 | st12->SetY1NDC(st11->GetY1NDC()-0.05); | |
268 | st12->SetY2NDC(st11->GetY2NDC()-0.05); | |
269 | st12->SetLineColor(0); | |
270 | st12->SetTextColor(h12->GetLineColor()); | |
271 | st12->SetFillStyle(0); | |
272 | st12->Draw(); | |
273 | ||
274 | //====================== | |
275 | ||
276 | c1->cd(7); | |
277 | h13->Draw(); | |
278 | h14->Draw("sames"); | |
279 | leg1->Draw("same"); | |
280 | ||
281 | gPad->Update(); | |
282 | TPaveStats *st13 = (TPaveStats*)h13->FindObject("stats"); | |
283 | st13->SetLineColor(0); | |
284 | ||
285 | gPad->Update(); | |
286 | TPaveStats *st14 = (TPaveStats*)h14->FindObject("stats"); | |
287 | st14->SetY1NDC(st13->GetY1NDC()-0.05); | |
288 | st14->SetY2NDC(st13->GetY2NDC()-0.05); | |
289 | st14->SetLineColor(0); | |
290 | st14->SetTextColor(h14->GetLineColor()); | |
291 | st14->SetFillStyle(0); | |
292 | st14->Draw(); | |
293 | ||
294 | //====================== | |
295 | ||
296 | c1->cd(8); | |
297 | h15->Draw(); | |
298 | h16->Draw("sames"); | |
299 | leg1->Draw("same"); | |
300 | ||
301 | gPad->Update(); | |
302 | TPaveStats *st15 = (TPaveStats*)h15->FindObject("stats"); | |
303 | st15->SetLineColor(0); | |
304 | ||
305 | gPad->Update(); | |
306 | TPaveStats *st16 = (TPaveStats*)h16->FindObject("stats"); | |
307 | st16->SetY1NDC(st15->GetY1NDC()-0.05); | |
308 | st16->SetY2NDC(st15->GetY2NDC()-0.05); | |
309 | st16->SetLineColor(0); | |
310 | st16->SetTextColor(h16->GetLineColor()); | |
311 | st16->SetFillStyle(0); | |
312 | st16->Draw(); | |
313 | ||
314 | //====================== | |
315 | ||
316 | c1->cd(9); | |
317 | h17->Draw(); | |
318 | h18->Draw("sames"); | |
319 | leg1->Draw("same"); | |
320 | ||
321 | gPad->Update(); | |
322 | TPaveStats *st17 = (TPaveStats*)h17->FindObject("stats"); | |
323 | st17->SetLineColor(0); | |
324 | ||
325 | gPad->Update(); | |
326 | TPaveStats *st18 = (TPaveStats*)h18->FindObject("stats"); | |
327 | st18->SetY1NDC(st17->GetY1NDC()-0.05); | |
328 | st18->SetY2NDC(st17->GetY2NDC()-0.05); | |
329 | st18->SetLineColor(0); | |
330 | st18->SetTextColor(h18->GetLineColor()); | |
331 | st18->SetFillStyle(0); | |
332 | st18->Draw(); | |
333 | ||
334 | //====================== | |
335 | ||
336 | c1->SaveAs("HLT-offline.png"); | |
0740807a | 337 | } |