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.*
6 * Usage: aliroot drawGlobalESDHistograms.C'("HLT-OFFLINE-GLOBAL-comparison.root")'
8 * It saves the canvas with the output histograms in a png file.
11 * @author Camilla.Stokkevag@student.uib.no, Kalliopi.Kanaki@ift.uib.no
14 void drawGlobalESDHistograms(const char* filename="HLT-OFFLINE-GLOBAL-comparison.root"){
16 gROOT->SetStyle("Plain");
17 gStyle->SetPalette(1);
18 gStyle->SetOptStat(10);
20 TFile *f1 = TFile::Open(filename);
21 TList *l1 = (TList*)f1->Get("global_histograms");
24 //=================================================================//
25 //--------------- READ HISTOGRAMS ---------------------------------//
26 //=================================================================//
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");
33 if(h1->GetMaximum() >= h2->GetMaximum()) h2->SetMaximum(1.1*h1->GetMaximum());
34 else h1->SetMaximum(1.1*h2->GetMaximum());
38 TH1F *h3 = l1->FindObject("fDCA_hlt");
39 TH1F *h4 = l1->FindObject("fDCA_off");
40 TH1F *hSG = l1->FindObject("fDCA_hltSG");
41 h3->SetTitle("DCA between track and vertex on XY plane");
42 h3->GetXaxis()->SetTitle("DCAr (cm)");
44 hSG->SetLineColor(kBlue);
45 if(h3->GetMaximum() >= h4->GetMaximum()) h4->SetMaximum(1.1*h3->GetMaximum());
46 else h3->SetMaximum(1.1*h4->GetMaximum());
49 TH1F *h5 = l1->FindObject("fMult_hlt");
50 TH1F *h6 = l1->FindObject("fMult_off");
51 h5->SetTitle("track multiplicity");
53 if(h5->GetMaximum() > h6->GetMaximum()) h6->SetMaximum(1.1*h5->GetMaximum());
54 else h5->SetMaximum(1.1*h6->GetMaximum());
57 TH1F *h7 = l1->FindObject("fCharge_hlt");
58 TH1F *h8 = l1->FindObject("fCharge_off");
59 h7->GetXaxis()->SetTitle("polarity");
60 h7->SetTitle("charge distribution");
62 if(h7->GetMaximum() > h8->GetMaximum()) h8->SetMaximum(1.1*h7->GetMaximum());
63 else h7->SetMaximum(1.1*h8->GetMaximum());
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");
71 if(h9->GetMaximum() > h10->GetMaximum()) h10->SetMaximum(1.1*h9->GetMaximum());
72 else h9->SetMaximum(1.1*h10->GetMaximum());
75 TH1F *h11 = l1->FindObject("fEta_hlt");
76 TH1F *h12 = l1->FindObject("fEta_off");
77 h11->SetTitle("pseudorapidity");
79 if(h11->GetMaximum() > h12->GetMaximum()) h12->SetMaximum(1.1*h11->GetMaximum());
80 else h11->SetMaximum(1.1*h12->GetMaximum());
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");
88 if(h13->GetMaximum() > h14->GetMaximum()) h14->SetMaximum(1.1*h13->GetMaximum());
89 else h13->SetMaximum(1.1*h14->GetMaximum());
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");
96 if(h15->GetMaximum() > h16->GetMaximum()) h16->SetMaximum(1.1*h15->GetMaximum());
97 else h15->SetMaximum(1.1*h16->GetMaximum());
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());
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");
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");
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");
126 //=================================================================//
127 //--------------------- DRAW HISTOGRAMS ---------------------------//
128 //=================================================================//
132 TCanvas *c1 = new TCanvas("c1","HLT vs offline",1300,800);
141 TPaveStats *st1 = (TPaveStats*)h1->FindObject("stats");
142 st1->SetLineColor(0);
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);
153 //======================
155 c1->cd(2)->SetLogy();
162 TPaveStats *st3 = (TPaveStats*)h3->FindObject("stats");
163 st3->SetLineColor(0);
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);
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);
183 //======================
191 TPaveStats *st5 = (TPaveStats*)h5->FindObject("stats");
192 st5->SetLineColor(0);
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);
203 //======================
211 TPaveStats *st7 = (TPaveStats*)h7->FindObject("stats");
212 st7->SetLineColor(0);
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);
223 //======================
231 TPaveStats *st9 = (TPaveStats*)h9->FindObject("stats");
232 st9->SetLineColor(0);
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);
243 //======================
251 TPaveStats *st11 = (TPaveStats*)h11->FindObject("stats");
252 st11->SetLineColor(0);
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);
263 //======================
271 TPaveStats *st13 = (TPaveStats*)h13->FindObject("stats");
272 st13->SetLineColor(0);
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);
283 //======================
291 TPaveStats *st15 = (TPaveStats*)h15->FindObject("stats");
292 st15->SetLineColor(0);
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);
303 //======================
311 TPaveStats *st17 = (TPaveStats*)h17->FindObject("stats");
312 st17->SetLineColor(0);
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);
323 //======================
325 c1->SaveAs("HLT-offline.png");