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