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