]>
Commit | Line | Data |
---|---|---|
d54ebd3d | 1 | //-*- Mode: C++ -*- |
2 | ||
3 | // Make Hists for trigger efficiency studies | |
4 | // Author: Jochen Thaeder <jochen@thaeder.de> | |
5 | ||
6 | #include "TROOT.h" | |
7 | #include "TStyle.h" | |
8 | #include "TSystem.h" | |
9 | #include "TFile.h" | |
10 | #include "TCanvas.h" | |
11 | #include "TObjArray.h" | |
12 | #include "TLegend.h" | |
13 | #include "TH1.h" | |
14 | #include "TString.h" | |
15 | #include "TMath.h" | |
16 | #include "TLine.h" | |
17 | ||
18 | // ---------------------------------------------------------------------- | |
19 | // -- Static Variablen -- | |
20 | // ---------------------------------------------------------------------- | |
21 | TObjArray* fObjArray = NULL; | |
22 | ||
23 | Int_t fgImgIdx = 0; | |
24 | ||
25 | const Int_t fgkNTrigger = 10; | |
26 | ||
27 | const Double_t fgkTriggerPt[fgkNTrigger] = {1.0, 2.0, 2.5, 3.0, 5.0, 7.0, 10.0, 1000., 1001., 1002.}; | |
28 | ||
29 | Char_t *fgkTrigger[fgkNTrigger] = { | |
30 | "p_{t}> 1.0", "p_{t}> 2.0", "p_{t}> 2.5", | |
31 | "p_{t}> 3.0", "p_{t}> 5.0", "p_{t}> 7", | |
32 | "p_{t}> 10.", | |
33 | "S1", "S2", "S3" | |
34 | }; | |
35 | ||
36 | const Int_t fgkNSelectionCuts = 5; | |
37 | Char_t *fgkSelectionCuts[fgkNSelectionCuts] = { | |
38 | "All Events", | |
39 | "AliPhysSel", | |
40 | "AliPhysSel - PrimVertex", | |
41 | "AliPhysSel - PrimVertex - Track (OFF)", | |
42 | "AliPhysSel - PrimVertex - Track (HLT)", | |
43 | }; | |
44 | ||
45 | Char_t *fgkSelectionCutsMC[fgkNSelectionCuts] = { | |
46 | "AllEvents", | |
47 | "AliPhysSel", | |
48 | "AliPhysSel - PrimVertex - Charged Primary", | |
49 | "AliPhysSel - PrimVertex - Track (MC)", | |
50 | "AliPhysSel - PrimVertex - Track (MC)", | |
51 | }; | |
52 | ||
53 | Char_t *fgkSelectionCutsRatioMC[fgkNSelectionCuts] = { | |
54 | "AllEvents", | |
55 | "AliPhysSel", | |
56 | "AliPhysSel - PrimVertex - Charged Primary", | |
57 | "AliPhysSel - PrimVertex - Track (OFF)/ Track (MC)", | |
58 | "AliPhysSel - PrimVertex - Track (HLT)/ Track (MC)", | |
59 | }; | |
60 | ||
61 | // ---------------------------------------------------------------------- | |
62 | // -- Main Function -- | |
63 | // ---------------------------------------------------------------------- | |
64 | ||
65 | void readTrigger(const Char_t* folder = "../.."); | |
66 | ||
67 | // ---------------------------------------------------------------------- | |
68 | // -- Canvas Functions -- | |
69 | // ---------------------------------------------------------------------- | |
70 | ||
71 | void CanvasTrigger(); | |
72 | void CanvasTriggerFactors(); | |
73 | void CanvasTriggerFactorsBackup(); | |
74 | ||
75 | void CreateCanvasCuts(); | |
76 | ||
77 | void CreateCanvasDistributions( Int_t maxLayer = 99, Int_t draw = 2, Int_t data = 2, Int_t minLayer=0); | |
78 | // draw 0 : pt || draw 1 : mult || draw 2 : both | |
79 | // data 0 : OFF || data 1 : MC || data 2 : both | |
80 | ||
81 | // ---------------------------------------------------------------------- | |
82 | // -- Helper Functions -- | |
83 | // ---------------------------------------------------------------------- | |
84 | ||
85 | void SetHist(TH1F* hist, Int_t hType, Char_t* dataType, Char_t* histType, Float_t minY, Float_t maxY ); | |
86 | ||
87 | void DivideHist(TH1F* h0, TH1F* h1, TH1F* h2); | |
88 | void FillReduxHistograms( TH1F* hN, TH1F* hRedux); | |
89 | void FillReduxHistogramsPt( TH1F* hN, TH1F* hRedux, TH1F* hReduxW); | |
90 | ||
91 | void FillRatioHistograms( TH1F* hN, TH1F* hF, TH1F* hRatio); | |
92 | void FillRatioHistogramsPt( TH1F* hN, TH1F* hF, TH1F* hRatio); | |
93 | ||
94 | // ---------------------------------------------------------------------- | |
95 | // -- Draw Functions -- | |
96 | // ---------------------------------------------------------------------- | |
97 | ||
98 | void DrawHistogramTrigger( TCanvas* canvas, Int_t idx, TH1* hist, Int_t iLayer, Bool_t bLogY); | |
99 | void DrawHistogram( TCanvas* canvas, Int_t idx, TH1* hist, Int_t iLayer, | |
100 | Bool_t bScale, Bool_t bLogY, Bool_t bLogX); | |
101 | ||
102 | //####################################################################### | |
103 | void readTrigger(const Char_t* folder) { | |
104 | ||
105 | gStyle->SetPalette(1); | |
106 | gROOT->SetStyle("Plain"); | |
107 | ||
108 | TString path(folder); | |
109 | path += "/jthaeder_trigger.root"; | |
110 | ||
111 | TFile *f = new TFile(path.Data()); | |
112 | ||
113 | // ---------------------------------------------------------------------------- | |
114 | ||
115 | fObjArray = static_cast<TObjArray*>(f->Get("jthaeder_trigger")); | |
116 | ||
117 | // == SHOW =================== | |
118 | CanvasTriggerFactors(); | |
119 | CreateCanvasDistributions( 7, 0, 2, 0 ); | |
120 | ||
121 | // CreateCanvasDistributions( 10, 1, 0, 7 ); | |
122 | // == SHOW =================== | |
123 | ||
124 | // == BACKUP ================= | |
125 | #if 1 | |
126 | CanvasTriggerFactorsBackup(); | |
127 | CanvasTrigger(); | |
128 | CreateCanvasCuts(); | |
129 | #endif | |
130 | // == BACKUP ================= | |
131 | } | |
132 | ||
133 | // ---------------------------------------------------------------------- | |
134 | // -- Canvas Functions -- | |
135 | // ---------------------------------------------------------------------- | |
136 | ||
137 | //####################################################################### | |
138 | void CanvasTrigger() { | |
139 | ||
140 | TCanvas *cTrigger = new TCanvas("cTrigger", "Trigger Events", 10, 10, 1400, 800); | |
141 | cTrigger->Divide(2,3); | |
142 | ||
143 | // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- | |
144 | ||
145 | TLegend* leg = new TLegend(0.60, 0.12, 0.89, 0.37, "Event Selection"); | |
146 | leg->AddEntry(static_cast<TH1F*>(fObjArray->FindObject("fNOFFTriggered")), "OFF Trig - All Events","LP"); | |
147 | leg->AddEntry(static_cast<TH1F*>(fObjArray->FindObject("fNOFFTriggeredSel")), "OFF Trig - AliPhysSel - OFF PrimVertex","LP"); | |
148 | leg->AddEntry(static_cast<TH1F*>(fObjArray->FindObject("fNHLTTriggered")), "HLT Trig - All Events","LP"); | |
149 | leg->AddEntry(static_cast<TH1F*>(fObjArray->FindObject("fNHLTTriggeredSel")), "HLT Trig - AliPhysSel - HLT PrimVertex","LP"); | |
150 | leg->AddEntry(static_cast<TH1F*>(fObjArray->FindObject("fNMCTriggered")), "MC Trig - All Events","LP"); | |
151 | leg->AddEntry(static_cast<TH1F*>(fObjArray->FindObject("fNMCTriggeredSel")), "MC Trig - AliPhysSel - MC PrimVertex","LP"); | |
152 | leg->SetFillColor(kWhite); | |
153 | ||
154 | TLegend* legW = new TLegend(0.60, 0.12, 0.89, 0.37, "Event Selection"); | |
155 | legW->AddEntry(static_cast<TH1F*>(fObjArray->FindObject("fNOFFTriggered")), "OFF Trig - All Events","LP"); | |
156 | legW->AddEntry(static_cast<TH1F*>(fObjArray->FindObject("fNOFFTriggeredSel")), "OFF Trig - AliPhysSel - OFF PrimVertex","LP"); | |
157 | legW->AddEntry(static_cast<TH1F*>(fObjArray->FindObject("fNHLTTriggered")), "HLT Trig - All Events","LP"); | |
158 | legW->AddEntry(static_cast<TH1F*>(fObjArray->FindObject("fNHLTTriggeredSel")), "HLT Trig - AliPhysSel - HLT PrimVertex","LP"); | |
159 | legW->SetFillColor(kWhite); | |
160 | ||
161 | // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- | |
162 | ||
163 | TH1F *hOFF = static_cast<TH1F*>(fObjArray->FindObject("fNOFFTriggered")); | |
164 | ||
165 | hOFF->SetTitle("Triggered Events"); | |
166 | hOFF->SetAxisRange(0,fgkNTrigger); | |
167 | hOFF->SetMinimum(1); | |
168 | ||
169 | hOFF->GetXaxis()->SetBinLabel(1, "Total N events"); | |
170 | hOFF->GetXaxis()->SetBinLabel(fgkNTrigger+2, "Total N events"); | |
171 | for ( Int_t ii=2 ; ii <= fgkNTrigger+1 ; ii++ ) { | |
172 | hOFF->GetXaxis()->SetBinLabel(ii, fgkTrigger[ii-2]); | |
173 | hOFF->GetXaxis()->SetBinLabel(ii+fgkNTrigger+1, fgkTrigger[ii-2]); | |
174 | } | |
175 | ||
176 | DrawHistogramTrigger(cTrigger, 1, static_cast<TH1F*>(fObjArray->FindObject("fNOFFTriggered")), 0, kTRUE); | |
177 | DrawHistogramTrigger(cTrigger, 1, static_cast<TH1F*>(fObjArray->FindObject("fNOFFTriggeredSel")), 1, kTRUE); | |
178 | DrawHistogramTrigger(cTrigger, 1, static_cast<TH1F*>(fObjArray->FindObject("fNHLTTriggered")), 2, kTRUE); | |
179 | DrawHistogramTrigger(cTrigger, 1, static_cast<TH1F*>(fObjArray->FindObject("fNHLTTriggeredSel")), 3, kTRUE); | |
180 | DrawHistogramTrigger(cTrigger, 1, static_cast<TH1F*>(fObjArray->FindObject("fNMCTriggered")), 4, kTRUE); | |
181 | DrawHistogramTrigger(cTrigger, 1, static_cast<TH1F*>(fObjArray->FindObject("fNMCTriggeredSel")), 5, kTRUE); | |
182 | leg->Draw(); | |
183 | ||
184 | // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- | |
185 | ||
186 | TH1F* h1Clone = static_cast<TH1F*>(fObjArray->FindObject("fNOFFTriggered")->Clone()); | |
187 | h1Clone->SetAxisRange(fgkNTrigger+1,2*(fgkNTrigger+1)); | |
188 | h1Clone->GetYaxis()->SetTitle("N Events * N Tracks"); | |
189 | ||
190 | TString title(h1Clone->GetTitle()); | |
191 | title += " - weighted nTracks"; | |
192 | h1Clone->SetTitle(title); | |
193 | ||
194 | DrawHistogramTrigger(cTrigger, 2, h1Clone, 0, kTRUE); | |
195 | DrawHistogramTrigger(cTrigger, 2, static_cast<TH1F*>(fObjArray->FindObject("fNOFFTriggeredSel")), 1, kTRUE); | |
196 | DrawHistogramTrigger(cTrigger, 2, static_cast<TH1F*>(fObjArray->FindObject("fNHLTTriggered")), 2, kTRUE); | |
197 | DrawHistogramTrigger(cTrigger, 2, static_cast<TH1F*>(fObjArray->FindObject("fNHLTTriggeredSel")), 3, kTRUE); | |
198 | legW->Draw(); | |
199 | ||
200 | // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- | |
201 | // --------------------------------------------------------------- | |
202 | // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- | |
203 | ||
204 | TLegend* legF = new TLegend(0.65, 0.12, 0.89, 0.32, "Event Selection"); | |
205 | legF->AddEntry(static_cast<TH1F*>(fObjArray->FindObject("fNHLTFakeToOFF")), | |
206 | "HLT Trig vs OFF - All Events","LP"); | |
207 | legF->AddEntry(static_cast<TH1F*>(fObjArray->FindObject("fNHLTFakeToOFFSel")), | |
208 | "HLT Trig vs OFF - AliPhysSel - OFF PrimVertex","LP"); | |
209 | ||
210 | legF->AddEntry(static_cast<TH1F*>(fObjArray->FindObject("fNHLTFakeToMC")), | |
211 | "HLT Trig vs MC - All Events","LP"); | |
212 | legF->AddEntry(static_cast<TH1F*>(fObjArray->FindObject("fNHLTFakeToMCSel")), | |
213 | "HLT Trig vs MC - AliPhysSel - OFF PrimVertex","LP"); | |
214 | ||
215 | legF->AddEntry(static_cast<TH1F*>(fObjArray->FindObject("fNOFFFakeToMC")), | |
216 | "OFF Trig vs MC - AllEvents","LP"); | |
217 | legF->AddEntry(static_cast<TH1F*>(fObjArray->FindObject("fNOFFFakeToMCSel")), | |
218 | "OFF Trig vs MC - AliPhysSel - OFF PrimVertex","LP"); | |
219 | ||
220 | legF->SetFillColor(kWhite); | |
221 | ||
222 | // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- | |
223 | ||
224 | TH1F* hFake = static_cast<TH1F*>(fObjArray->FindObject("fNHLTFakeToOFF")); | |
225 | hFake->SetAxisRange(1,fgkNTrigger); | |
226 | hFake->SetAxisRange(1, 1e5,"Y"); | |
227 | hFake->GetYaxis()->SetTitle("N Events #left(HLT_{Triggered} && ! [OFF|MC]_{Triggered}#right)"); | |
228 | ||
229 | for ( Int_t ii=2 ; ii <= fgkNTrigger+1 ; ii++ ) { | |
230 | hFake->GetXaxis()->SetBinLabel(ii, fgkTrigger[ii-2]); | |
231 | hFake->GetXaxis()->SetBinLabel(ii+fgkNTrigger+1, fgkTrigger[ii-2]); | |
232 | } | |
233 | ||
234 | DrawHistogramTrigger(cTrigger, 3, hFake, 0, kTRUE); | |
235 | DrawHistogramTrigger(cTrigger, 3, static_cast<TH1F*>(fObjArray->FindObject("fNHLTFakeToOFFSel")), 1, kTRUE); | |
236 | DrawHistogramTrigger(cTrigger, 3, static_cast<TH1F*>(fObjArray->FindObject("fNHLTFakeToMC")), 2, kTRUE); | |
237 | DrawHistogramTrigger(cTrigger, 3, static_cast<TH1F*>(fObjArray->FindObject("fNHLTFakeToMCSel")), 3, kTRUE); | |
238 | DrawHistogramTrigger(cTrigger, 3, static_cast<TH1F*>(fObjArray->FindObject("fNOFFFakeToMC")), 4, kTRUE); | |
239 | DrawHistogramTrigger(cTrigger, 3, static_cast<TH1F*>(fObjArray->FindObject("fNOFFFakeToMCSel")), 5, kTRUE); | |
240 | legF->Draw(); | |
241 | ||
242 | // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- | |
243 | ||
244 | TH1F* h2Clone = static_cast<TH1F*>(hFake->Clone()); | |
245 | h2Clone->SetAxisRange(fgkNTrigger+2,2*(fgkNTrigger+1)); | |
246 | h2Clone->SetAxisRange(1, 1e6, "Y"); | |
247 | h2Clone->GetYaxis()->SetTitle("N Events * N Tracks"); | |
248 | ||
249 | TString titleF(h2Clone->GetTitle()); | |
250 | titleF += " - weighted nTracks"; | |
251 | h2Clone->SetTitle(titleF); | |
252 | ||
253 | DrawHistogramTrigger(cTrigger, 4, h2Clone, 0, kTRUE); | |
254 | DrawHistogramTrigger(cTrigger, 4, static_cast<TH1F*>(fObjArray->FindObject("fNHLTFakeToOFFSel")), 1, kTRUE); | |
255 | DrawHistogramTrigger(cTrigger, 4, static_cast<TH1F*>(fObjArray->FindObject("fNHLTFakeToMC")), 2, kTRUE); | |
256 | DrawHistogramTrigger(cTrigger, 4, static_cast<TH1F*>(fObjArray->FindObject("fNHLTFakeToMCSel")), 3, kTRUE); | |
257 | DrawHistogramTrigger(cTrigger, 4, static_cast<TH1F*>(fObjArray->FindObject("fNOFFFakeToMC")), 4, kTRUE); | |
258 | DrawHistogramTrigger(cTrigger, 4, static_cast<TH1F*>(fObjArray->FindObject("fNOFFFakeToMCSel")), 5, kTRUE); | |
259 | ||
260 | legF->Draw(); | |
261 | ||
262 | // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- | |
263 | // --------------------------------------------------------------- | |
264 | // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- | |
265 | ||
266 | TLegend* legM = new TLegend(0.65, 0.12, 0.89, 0.32, "Event Selection"); | |
267 | legM->AddEntry(static_cast<TH1F*>(fObjArray->FindObject("fNHLTMissToOFF")), | |
268 | "HLT Trig vs OFF - All Events","LP"); | |
269 | legM->AddEntry(static_cast<TH1F*>(fObjArray->FindObject("fNHLTMissToOFFSel")), | |
270 | "HLT Trig vs OFF - AliPhysSel - OFF PrimVertex","LP"); | |
271 | ||
272 | legM->AddEntry(static_cast<TH1F*>(fObjArray->FindObject("fNHLTMissToMC")), | |
273 | "HLT Trig vs MC - All Events","LP"); | |
274 | legM->AddEntry(static_cast<TH1F*>(fObjArray->FindObject("fNHLTMissToMCSel")), | |
275 | "HLT Trig vs MC - AliPhysSel - OFF PrimVertex","LP"); | |
276 | ||
277 | legM->AddEntry(static_cast<TH1F*>(fObjArray->FindObject("fNOFFMissToMC")), | |
278 | "OFF Trig vs MC - All Events","LP"); | |
279 | legM->AddEntry(static_cast<TH1F*>(fObjArray->FindObject("fNOFFMissToMCSel")), | |
280 | "OFF Trig vs MC - AliPhysSel - OFF PrimVertex","LP"); | |
281 | ||
282 | legM->SetFillColor(kWhite); | |
283 | ||
284 | // --- --- --- --- --- --- - | |
285 | ||
286 | TH1F* hMiss = static_cast<TH1F*>(fObjArray->FindObject("fNHLTMissToOFF")); | |
287 | hMiss->SetAxisRange(1,fgkNTrigger); | |
288 | hMiss->SetAxisRange(1, 1e4, "Y"); | |
289 | hMiss->GetYaxis()->SetTitle("N Events #left(!HLT_{Triggered} && [OFF|MC]_{Triggered}#right)"); | |
290 | ||
291 | for ( Int_t ii=2 ; ii <= fgkNTrigger+1 ; ii++ ) { | |
292 | hMiss->GetXaxis()->SetBinLabel(ii, fgkTrigger[ii-2]); | |
293 | hMiss->GetXaxis()->SetBinLabel(ii+fgkNTrigger+1, fgkTrigger[ii-2]); | |
294 | } | |
295 | ||
296 | DrawHistogramTrigger(cTrigger, 5, hMiss, 0, kTRUE); | |
297 | DrawHistogramTrigger(cTrigger, 5, static_cast<TH1F*>(fObjArray->FindObject("fNHLTMissToOFFSel")), 1, kTRUE); | |
298 | DrawHistogramTrigger(cTrigger, 5, static_cast<TH1F*>(fObjArray->FindObject("fNHLTMissToMC")), 2, kTRUE); | |
299 | DrawHistogramTrigger(cTrigger, 5, static_cast<TH1F*>(fObjArray->FindObject("fNHLTMissToMCSel")), 3, kTRUE); | |
300 | DrawHistogramTrigger(cTrigger, 5, static_cast<TH1F*>(fObjArray->FindObject("fNOFFMissToMC")), 4, kTRUE); | |
301 | DrawHistogramTrigger(cTrigger, 5, static_cast<TH1F*>(fObjArray->FindObject("fNOFFMissToMCSel")), 5, kTRUE); | |
302 | ||
303 | legM->Draw(); | |
304 | ||
305 | // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- | |
306 | ||
307 | TH1F* h3Clone = static_cast<TH1F*>(fObjArray->FindObject("fNHLTMissToOFF")->Clone()); | |
308 | h3Clone->SetAxisRange(fgkNTrigger+2,2*(fgkNTrigger+1)); | |
309 | h3Clone->SetAxisRange(1, 1e6, "Y"); | |
310 | h3Clone->GetYaxis()->SetTitle("N Events * N Tracks"); | |
311 | ||
312 | TString titleM(h3Clone->GetTitle()); | |
313 | titleM += " - weighted nTracks"; | |
314 | h3Clone->SetTitle(titleM); | |
315 | ||
316 | DrawHistogramTrigger(cTrigger, 6, h3Clone, 0, kTRUE); | |
317 | DrawHistogramTrigger(cTrigger, 6, static_cast<TH1F*>(fObjArray->FindObject("fNHLTMissToOFFSel")), 1, kTRUE); | |
318 | DrawHistogramTrigger(cTrigger, 6, static_cast<TH1F*>(fObjArray->FindObject("fNHLTMissToMC")), 2, kTRUE); | |
319 | DrawHistogramTrigger(cTrigger, 6, static_cast<TH1F*>(fObjArray->FindObject("fNHLTMissToMCSel")), 3, kTRUE); | |
320 | DrawHistogramTrigger(cTrigger, 6, static_cast<TH1F*>(fObjArray->FindObject("fNOFFMissToMC")), 4, kTRUE); | |
321 | DrawHistogramTrigger(cTrigger, 6, static_cast<TH1F*>(fObjArray->FindObject("fNOFFMissToMCSel")), 5, kTRUE); | |
322 | ||
323 | legM->Draw(); | |
324 | ||
325 | cTrigger->SaveAs(Form("TriggerHists_%d_B.png",++fgImgIdx)); | |
326 | } | |
327 | // === === === === === === === === === === === === === === === === | |
328 | // =============================================================== | |
329 | // === === === === === === === === === === === === === === === === | |
330 | ||
331 | //####################################################################### | |
332 | void CanvasTriggerFactorsBackup() { | |
333 | ||
334 | TCanvas *cTriggerFB = new TCanvas("cTriggerFB", "Reduction - Purity - Efficiency", 10, 10, 1400, 800); | |
335 | cTriggerFB->Divide(3,3); | |
336 | ||
337 | // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- | |
338 | ||
339 | Float_t maxLine = 0.9; | |
340 | Float_t minLine = 0.8; | |
341 | ||
342 | TLine* line1 = new TLine(0.,maxLine,fgkNTrigger,maxLine); | |
343 | line1->SetLineStyle(2); | |
344 | line1->SetLineColor(kGreen); | |
345 | ||
346 | TLine* line2 = new TLine(0.,minLine,fgkNTrigger,minLine); | |
347 | line2->SetLineStyle(2); | |
348 | line2->SetLineColor(kRed); | |
349 | ||
350 | ||
351 | // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- | |
352 | TH1F* hOFFReduxB = new TH1F("hOFFReduxB", | |
353 | "Reduction Factors;;Reduction #left(#frac{N Events_{Triggered}}{N Events_{Total}}#right)", | |
354 | 2*fgkNTrigger, 0., static_cast<Double_t>(2*fgkNTrigger)); | |
355 | TH1F* hOFFReduxBS = new TH1F("hOFFReduxBS", "", 2*fgkNTrigger, 0., static_cast<Double_t>(2*fgkNTrigger)); | |
356 | TH1F* hHLTReduxB = new TH1F("hHLTReduxB", "", 2*fgkNTrigger, 0., static_cast<Double_t>(2*fgkNTrigger)); | |
357 | TH1F* hHLTReduxBS = new TH1F("hHLTReduxBS", "", 2*fgkNTrigger, 0., static_cast<Double_t>(2*fgkNTrigger)); | |
358 | TH1F* hMCReduxB = new TH1F("hMCReduxB", "", 2*fgkNTrigger, 0., static_cast<Double_t>(2*fgkNTrigger)); | |
359 | TH1F* hMCReduxBS = new TH1F("hMCReduxBS", "", 2*fgkNTrigger, 0., static_cast<Double_t>(2*fgkNTrigger)); | |
360 | ||
361 | FillReduxHistograms(static_cast<TH1F*>(fObjArray->FindObject("fNOFFTriggered")), hOFFReduxB); | |
362 | FillReduxHistograms(static_cast<TH1F*>(fObjArray->FindObject("fNOFFTriggeredSel")), hOFFReduxBS); | |
363 | FillReduxHistograms(static_cast<TH1F*>(fObjArray->FindObject("fNHLTTriggered")), hHLTReduxB); | |
364 | FillReduxHistograms(static_cast<TH1F*>(fObjArray->FindObject("fNHLTTriggeredSel")), hHLTReduxBS); | |
365 | FillReduxHistograms(static_cast<TH1F*>(fObjArray->FindObject("fNMCTriggered")), hMCReduxB); | |
366 | FillReduxHistograms(static_cast<TH1F*>(fObjArray->FindObject("fNMCTriggeredSel")), hMCReduxBS); | |
367 | ||
368 | TLegend* legR = new TLegend(0.65, 0.12, 0.89, 0.37, "Event Selection"); | |
369 | legR->AddEntry(hOFFReduxB, "OFF Trig - All Events","LP"); | |
370 | legR->AddEntry(hOFFReduxBS, "OFF Trig - AliPhysSel - OFF PrimVertex","LP"); | |
371 | legR->AddEntry(hHLTReduxB, "HLT Trig - All Events","LP"); | |
372 | legR->AddEntry(hHLTReduxBS,"HLT Trig - AliPhysSel - OFF PrimVertex","LP"); | |
373 | legR->AddEntry(hMCReduxB, "MC Trig - All Events","LP"); | |
374 | legR->AddEntry(hMCReduxBS,"MC Trig - AliPhysSel - OFF PrimVertex","LP"); | |
375 | legR->SetFillColor(kWhite); | |
376 | ||
377 | // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- | |
378 | hOFFReduxB->SetAxisRange(0,fgkNTrigger-1); | |
379 | ||
380 | for ( Int_t ii=1 ; ii <= fgkNTrigger ; ii++ ) { | |
381 | hOFFReduxB->GetXaxis()->SetBinLabel(ii, fgkTrigger[ii-1]); | |
382 | hOFFReduxB->GetXaxis()->SetBinLabel(ii+fgkNTrigger, fgkTrigger[ii-1]); | |
383 | } | |
384 | ||
385 | DrawHistogramTrigger(cTriggerFB, 1, hOFFReduxB, 0, kTRUE); | |
386 | DrawHistogramTrigger(cTriggerFB, 1, hOFFReduxBS, 1, kTRUE); | |
387 | DrawHistogramTrigger(cTriggerFB, 1, hHLTReduxB, 2, kTRUE); | |
388 | DrawHistogramTrigger(cTriggerFB, 1, hHLTReduxBS, 3, kTRUE); | |
389 | DrawHistogramTrigger(cTriggerFB, 1, hMCReduxB, 4, kTRUE); | |
390 | DrawHistogramTrigger(cTriggerFB, 1, hMCReduxBS, 5, kTRUE); | |
391 | legR->Draw(); | |
392 | ||
393 | // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- | |
394 | ||
395 | TH1F* hOFFRClone = static_cast<TH1F*>(hOFFReduxB->Clone()); | |
396 | hOFFRClone->SetAxisRange(fgkNTrigger,2*(fgkNTrigger)); | |
397 | ||
398 | TString titleR(hOFFRClone->GetTitle()); | |
399 | titleR += " - weighted nTracks"; | |
400 | hOFFRClone->SetTitle(titleR); | |
401 | ||
402 | DrawHistogramTrigger(cTriggerFB, 2, hOFFRClone, 0, kTRUE); | |
403 | DrawHistogramTrigger(cTriggerFB, 2, hOFFReduxBS, 1, kTRUE); | |
404 | DrawHistogramTrigger(cTriggerFB, 2, hHLTReduxB, 2, kTRUE); | |
405 | DrawHistogramTrigger(cTriggerFB, 2, hHLTReduxBS, 3, kTRUE); | |
406 | DrawHistogramTrigger(cTriggerFB, 2, hMCReduxB, 4, kTRUE); | |
407 | DrawHistogramTrigger(cTriggerFB, 2, hMCReduxBS, 5, kTRUE); | |
408 | legR->Draw(); | |
409 | ||
410 | // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- | |
411 | // --------------------------------------------------------------- | |
412 | // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- | |
413 | ||
414 | TH1F* hOFFPurityHLTB = new TH1F("hOFFPurityHLTB", "HLT Trigger Purity vs OFF", 2*fgkNTrigger, 0., static_cast<Double_t>(2*fgkNTrigger)); | |
415 | hOFFPurityHLTB->GetYaxis()->SetTitle("Purity #left(#frac{HLT_{Triggered} - HLT_{Fake}}{HLT_{Triggered}}#right)"); | |
416 | TH1F* hOFFPurityHLTBS = new TH1F("hOFFPurityHLTBS", "", 2*fgkNTrigger, 0., static_cast<Double_t>(2*fgkNTrigger)); | |
417 | ||
418 | TH1F* hMCPurityHLTB = new TH1F("hMCPurityHLTB", "HLT Trigger Purity vs MC", 2*fgkNTrigger, 0., static_cast<Double_t>(2*fgkNTrigger)); | |
419 | hMCPurityHLTB->GetYaxis()->SetTitle("Purity #left(#frac{HLT_{Triggered} - HLT_{Fake}}{HLT_{Triggered}}#right)"); | |
420 | TH1F* hMCPurityHLTBS = new TH1F("hMCPurityHLTBS", "", 2*fgkNTrigger, 0., static_cast<Double_t>(2*fgkNTrigger)); | |
421 | ||
422 | TH1F* hMCPurityOFFB = new TH1F("hMCPurityOFFB", "OFF Trigger Purity vs MC", 2*fgkNTrigger, 0., static_cast<Double_t>(2*fgkNTrigger)); | |
423 | hMCPurityOFFB->GetYaxis()->SetTitle("Purity #left(#frac{OFF_{Triggered} - OFF_{Fake}}{OFF_{Triggered}}#right)"); | |
424 | TH1F* hMCPurityOFFBS = new TH1F("hMCPurityOFFBS", "", 2*fgkNTrigger, 0., static_cast<Double_t>(2*fgkNTrigger)); | |
425 | ||
426 | FillRatioHistograms(static_cast<TH1F*>(fObjArray->FindObject("fNHLTTriggered")), | |
427 | static_cast<TH1F*>(fObjArray->FindObject("fNHLTFakeToOFF")), hOFFPurityHLTB); | |
428 | FillRatioHistograms(static_cast<TH1F*>(fObjArray->FindObject("fNHLTTriggeredSel")), | |
429 | static_cast<TH1F*>(fObjArray->FindObject("fNHLTFakeToOFFSel")), hOFFPurityHLTBS); | |
430 | ||
431 | FillRatioHistograms(static_cast<TH1F*>(fObjArray->FindObject("fNHLTTriggered")), | |
432 | static_cast<TH1F*>(fObjArray->FindObject("fNHLTFakeToMC")), hMCPurityHLTB); | |
433 | FillRatioHistograms(static_cast<TH1F*>(fObjArray->FindObject("fNHLTTriggeredSel")), | |
434 | static_cast<TH1F*>(fObjArray->FindObject("fNHLTFakeToMCSel")), hMCPurityHLTBS); | |
435 | ||
436 | FillRatioHistograms(static_cast<TH1F*>(fObjArray->FindObject("fNOFFTriggered")), | |
437 | static_cast<TH1F*>(fObjArray->FindObject("fNOFFFakeToMC")), hMCPurityOFFB); | |
438 | FillRatioHistograms(static_cast<TH1F*>(fObjArray->FindObject("fNOFFTriggeredSel")), | |
439 | static_cast<TH1F*>(fObjArray->FindObject("fNOFFFakeToMCSel")), hMCPurityOFFBS); | |
440 | ||
441 | TLegend* legPH = new TLegend(0.65, 0.72, 0.89, 0.87, "Event Selection"); | |
442 | legPH->AddEntry(hOFFPurityHLTB, "HLT Trig - All Events","LP"); | |
443 | legPH->AddEntry(hOFFPurityHLTBS,"HLT Trig - AliPhysSel - OFF PrimVertex","LP"); | |
444 | legPH->SetFillColor(kWhite); | |
445 | ||
446 | TLegend* legPO = new TLegend(0.65, 0.72, 0.89, 0.87, "Event Selection"); | |
447 | legPO->AddEntry(hMCPurityOFFB, "OFF Trig - All Events","LP"); | |
448 | legPO->AddEntry(hMCPurityOFFBS,"OFF Trig - AliPhysSel - OFF PrimVertex","LP"); | |
449 | legPO->SetFillColor(kWhite); | |
450 | ||
451 | // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- | |
452 | ||
453 | hOFFPurityHLTB->SetAxisRange(0,fgkNTrigger-1); | |
454 | hOFFPurityHLTB->SetAxisRange(0., 1.2, "Y"); | |
455 | ||
456 | for ( Int_t ii=1 ; ii <= fgkNTrigger ; ii++ ){ | |
457 | hOFFPurityHLTB->GetXaxis()->SetBinLabel(ii, fgkTrigger[ii-1]); | |
458 | hOFFPurityHLTB->GetXaxis()->SetBinLabel(ii+fgkNTrigger, fgkTrigger[ii-1]); | |
459 | } | |
460 | ||
461 | DrawHistogramTrigger(cTriggerFB, 4, hOFFPurityHLTB, 0, kFALSE); | |
462 | DrawHistogramTrigger(cTriggerFB, 4, hOFFPurityHLTBS, 1, kFALSE); | |
463 | line1->Draw(); | |
464 | line2->Draw(); | |
465 | legPH->Draw(); | |
466 | ||
467 | // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- | |
468 | ||
469 | hMCPurityHLTB->SetAxisRange(0,fgkNTrigger-1); | |
470 | hMCPurityHLTB->SetAxisRange(0., 1.2, "Y"); | |
471 | ||
472 | for ( Int_t ii=1 ; ii <= fgkNTrigger ; ii++ ){ | |
473 | hMCPurityHLTB->GetXaxis()->SetBinLabel(ii, fgkTrigger[ii-1]); | |
474 | hMCPurityHLTB->GetXaxis()->SetBinLabel(ii+fgkNTrigger, fgkTrigger[ii-1]); | |
475 | } | |
476 | ||
477 | DrawHistogramTrigger(cTriggerFB, 5, hMCPurityHLTB, 0, kFALSE); | |
478 | DrawHistogramTrigger(cTriggerFB, 5, hMCPurityHLTBS, 1, kFALSE); | |
479 | line1->Draw(); | |
480 | line2->Draw(); | |
481 | legPH->Draw(); | |
482 | ||
483 | // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- | |
484 | ||
485 | hMCPurityOFFB->SetAxisRange(0,fgkNTrigger-1); | |
486 | hMCPurityOFFB->SetAxisRange(0., 1.2, "Y"); | |
487 | ||
488 | for ( Int_t ii=1 ; ii <= fgkNTrigger ; ii++ ){ | |
489 | hMCPurityOFFB->GetXaxis()->SetBinLabel(ii, fgkTrigger[ii-1]); | |
490 | hMCPurityOFFB->GetXaxis()->SetBinLabel(ii+fgkNTrigger, fgkTrigger[ii-1]); | |
491 | } | |
492 | ||
493 | DrawHistogramTrigger(cTriggerFB, 6, hMCPurityOFFB, 0, kFALSE); | |
494 | DrawHistogramTrigger(cTriggerFB, 6, hMCPurityOFFBS, 1, kFALSE); | |
495 | line1->Draw(); | |
496 | line2->Draw(); | |
497 | legPH->Draw(); | |
498 | ||
499 | // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- | |
500 | // --------------------------------------------------------------- | |
501 | // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- | |
502 | ||
503 | TH1F* hOFFEffHLTB = new TH1F("hOFFEffHLTB", "HLT Trigger Efficiency vs OFF", 2*fgkNTrigger, 0., static_cast<Double_t>(2*fgkNTrigger)); | |
504 | hOFFEffHLTB->GetYaxis()->SetTitle("Efficiency #left(#frac{OFF_{Triggered} - HLT_{Miss}}{OFF_{Triggered}}#right)"); | |
505 | TH1F* hOFFEffHLTBS = new TH1F("hOFFEffHLTBS", "", 2*fgkNTrigger, 0., static_cast<Double_t>(2*fgkNTrigger)); | |
506 | ||
507 | TH1F* hMCEffHLTB = new TH1F("hMCEffHLTB", "HLT Trigger Efficiency vs MC", 2*fgkNTrigger, 0., static_cast<Double_t>(2*fgkNTrigger)); | |
508 | hMCEffHLTB->GetYaxis()->SetTitle("Efficiency #left(#frac{MC_{Triggered} - HLT_{Miss}}{MC_{Triggered}}#right)"); | |
509 | TH1F* hMCEffHLTBS = new TH1F("hMCEffHLTBS", "", 2*fgkNTrigger, 0., static_cast<Double_t>(2*fgkNTrigger)); | |
510 | ||
511 | TH1F* hMCEffOFFB = new TH1F("hMCEffOFFB", "OFF Trigger Efficiency vs MC", 2*fgkNTrigger, 0., static_cast<Double_t>(2*fgkNTrigger)); | |
512 | hMCEffOFFB->GetYaxis()->SetTitle("Efficiency #left(#frac{MC_{Triggered} - OFF_{Miss}}{MC_{Triggered}}#right)"); | |
513 | TH1F* hMCEffOFFBS = new TH1F("hMCEffOFFBS", "", 2*fgkNTrigger, 0., static_cast<Double_t>(2*fgkNTrigger)); | |
514 | ||
515 | ||
516 | FillRatioHistograms(static_cast<TH1F*>(fObjArray->FindObject("fNOFFTriggered")), | |
517 | static_cast<TH1F*>(fObjArray->FindObject("fNHLTMissToOFF")), hOFFEffHLTB); | |
518 | FillRatioHistograms(static_cast<TH1F*>(fObjArray->FindObject("fNOFFTriggeredSel")), | |
519 | static_cast<TH1F*>(fObjArray->FindObject("fNHLTMissToOFFSel")), hOFFEffHLTBS); | |
520 | ||
521 | FillRatioHistograms(static_cast<TH1F*>(fObjArray->FindObject("fNMCTriggered")), | |
522 | static_cast<TH1F*>(fObjArray->FindObject("fNHLTMissToMC")), hMCEffHLTB); | |
523 | FillRatioHistograms(static_cast<TH1F*>(fObjArray->FindObject("fNMCTriggeredSel")), | |
524 | static_cast<TH1F*>(fObjArray->FindObject("fNHLTMissToMCSel")), hMCEffHLTBS); | |
525 | ||
526 | FillRatioHistograms(static_cast<TH1F*>(fObjArray->FindObject("fNMCTriggered")), | |
527 | static_cast<TH1F*>(fObjArray->FindObject("fNOFFMissToMC")), hMCEffOFFB); | |
528 | FillRatioHistograms(static_cast<TH1F*>(fObjArray->FindObject("fNMCTriggeredSel")), | |
529 | static_cast<TH1F*>(fObjArray->FindObject("fNOFFMissToMCSel")), hMCEffOFFBS); | |
530 | ||
531 | ||
532 | TLegend* legEH = new TLegend(0.65, 0.70, 0.89, 0.85, "Event Selection"); | |
533 | legEH->AddEntry(hOFFEffHLTB, "HLT Trig - All Events","LP"); | |
534 | legEH->AddEntry(hOFFEffHLTBS,"HLT Trig - AliPhysSel - OFF PrimVertex","LP"); | |
535 | legEH->SetFillColor(kWhite); | |
536 | ||
537 | TLegend* legEO = new TLegend(0.65, 0.70, 0.89, 0.85, "Event Selection"); | |
538 | legEO->AddEntry(hMCEffOFFB, "OFF Trig - All Events","LP"); | |
539 | legEO->AddEntry(hMCEffOFFBS,"OFF Trig - AliPhysSel - OFF PrimVertex","LP"); | |
540 | legEO->SetFillColor(kWhite); | |
541 | ||
542 | // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- | |
543 | ||
544 | hOFFEffHLTB->SetAxisRange(0,fgkNTrigger-1); | |
545 | hOFFEffHLTB->SetAxisRange(0., 1.2, "Y"); | |
546 | ||
547 | for ( Int_t ii=1 ; ii <= fgkNTrigger ; ii++ ){ | |
548 | hOFFEffHLTB->GetXaxis()->SetBinLabel(ii, fgkTrigger[ii-1]); | |
549 | hOFFEffHLTB->GetXaxis()->SetBinLabel(ii+fgkNTrigger, fgkTrigger[ii-1]); | |
550 | } | |
551 | ||
552 | DrawHistogramTrigger(cTriggerFB, 7, hOFFEffHLTB, 0, kFALSE); | |
553 | DrawHistogramTrigger(cTriggerFB, 7, hOFFEffHLTBS, 1, kFALSE); | |
554 | line1->Draw(); | |
555 | line2->Draw(); | |
556 | legEH->Draw(); | |
557 | ||
558 | // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- | |
559 | ||
560 | hMCEffHLTB->SetAxisRange(0,fgkNTrigger-1); | |
561 | hMCEffHLTB->SetAxisRange(0., 1.2, "Y"); | |
562 | ||
563 | for ( Int_t ii=1 ; ii <= fgkNTrigger ; ii++ ){ | |
564 | hMCEffHLTB->GetXaxis()->SetBinLabel(ii, fgkTrigger[ii-1]); | |
565 | hMCEffHLTB->GetXaxis()->SetBinLabel(ii+fgkNTrigger, fgkTrigger[ii-1]); | |
566 | } | |
567 | ||
568 | DrawHistogramTrigger(cTriggerFB, 8, hMCEffHLTB, 0, kFALSE); | |
569 | DrawHistogramTrigger(cTriggerFB, 8, hMCEffHLTBS, 1, kFALSE); | |
570 | line1->Draw(); | |
571 | line2->Draw(); | |
572 | legEH->Draw(); | |
573 | ||
574 | // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- | |
575 | ||
576 | hMCEffOFFB->SetAxisRange(0,fgkNTrigger-1); | |
577 | hMCEffOFFB->SetAxisRange(0., 1.2, "Y"); | |
578 | ||
579 | for ( Int_t ii=1 ; ii <= fgkNTrigger ; ii++ ){ | |
580 | hMCEffOFFB->GetXaxis()->SetBinLabel(ii, fgkTrigger[ii-1]); | |
581 | hMCEffOFFB->GetXaxis()->SetBinLabel(ii+fgkNTrigger, fgkTrigger[ii-1]); | |
582 | } | |
583 | ||
584 | DrawHistogramTrigger(cTriggerFB, 9, hMCEffOFFB, 0, kFALSE); | |
585 | DrawHistogramTrigger(cTriggerFB, 9, hMCEffOFFBS, 1, kFALSE); | |
586 | line1->Draw(); | |
587 | line2->Draw(); | |
588 | legEO->Draw(); | |
589 | ||
590 | cTriggerFB->SaveAs(Form("TriggerHists_%d_B.png",++fgImgIdx)); | |
591 | ||
592 | for ( Int_t ii=1 ; ii <= fgkNTrigger ; ii++ ){ | |
593 | if (fgkTriggerPt[ii-1] > 20. ) | |
594 | continue; | |
595 | ||
596 | printf("=================================\n"); | |
597 | printf(" Trigger Pt %.2f GeV/c \n", fgkTriggerPt[ii-1]); | |
598 | printf("=================================\n"); | |
599 | printf(" - HLT Redux Factor : %.2f - %.2f Hz (1500 Hz) - %.2f Hz (800 Hz) \n", | |
600 | hHLTReduxB->GetBinContent(ii), 1500/hHLTReduxB->GetBinContent(ii), 800/hHLTReduxB->GetBinContent(ii) ); | |
601 | printf(" - OFF Redux Factor : %.2f - %.2f Hz (1500 Hz) - %.2f Hz (800 Hz) \n", | |
602 | hOFFReduxB->GetBinContent(ii), 1500/hOFFReduxB->GetBinContent(ii), 800/hOFFReduxB->GetBinContent(ii) ); | |
603 | printf(" - MC Redux Factor : %.2f - %.2f Hz (1500 Hz) - %.2f Hz (800 Hz) \n", | |
604 | hMCReduxB->GetBinContent(ii), 1500/hMCReduxB->GetBinContent(ii), 800/hMCReduxB->GetBinContent(ii) ); | |
605 | printf("---------------------------------\n"); | |
606 | printf(" - HLT Purity vs OFF : %.3f | HLT Eff vs OFF : %.3f \n", hOFFPurityHLTB->GetBinContent(ii),hOFFEffHLTB->GetBinContent(ii)); | |
607 | printf(" - HLT Purity vs MC : %.3f | HLT Eff vs MC : %.3f \n", hMCPurityHLTB->GetBinContent(ii), hMCEffHLTB->GetBinContent(ii) ); | |
608 | printf(" - OFF Purity vs MC : %.3f | OFF Eff vs MC : %.3f \n", hMCPurityOFFB->GetBinContent(ii), hMCEffOFFB->GetBinContent(ii) ); | |
609 | } | |
610 | ||
611 | for ( Int_t ii=1 ; ii <= fgkNTrigger ; ii++ ){ | |
612 | if (fgkTriggerPt[ii-1] < 20. ) | |
613 | continue; | |
614 | ||
615 | printf("=================================\n"); | |
616 | printf(" Trigger Scenario %.0f \n", fgkTriggerPt[ii-1]-1000+1); | |
617 | printf("=================================\n"); | |
618 | printf(" - HLT Redux Factor : %.2f - %.2f Hz (1500 Hz) - %.2f Hz (800 Hz) \n", | |
619 | hHLTReduxB->GetBinContent(ii), 1500/hHLTReduxB->GetBinContent(ii), 800/hHLTReduxB->GetBinContent(ii) ); | |
620 | printf(" - OFF Redux Factor : %.2f - %.2f Hz (1500 Hz) - %.2f Hz (800 Hz) \n", | |
621 | hOFFReduxB->GetBinContent(ii), 1500/hOFFReduxB->GetBinContent(ii), 800/hOFFReduxB->GetBinContent(ii) ); | |
622 | printf(" - MC Redux Factor : %.2f - %.2f Hz (1500 Hz) - %.2f Hz (800 Hz) \n", | |
623 | hMCReduxB->GetBinContent(ii), 1500/hMCReduxB->GetBinContent(ii), 800/hMCReduxB->GetBinContent(ii) ); | |
624 | printf("---------------------------------\n"); | |
625 | printf(" - HLT Purity vs OFF : %.3f | HLT Eff vs OFF : %.3f \n", hOFFPurityHLTB->GetBinContent(ii),hOFFEffHLTB->GetBinContent(ii)); | |
626 | printf(" - HLT Purity vs MC : %.3f | HLT Eff vs MC : %.3f \n", hMCPurityHLTB->GetBinContent(ii), hMCEffHLTB->GetBinContent(ii) ); | |
627 | printf(" - OFF Purity vs MC : %.3f | OFF Eff vs MC : %.3f \n", hMCPurityOFFB->GetBinContent(ii), hMCEffOFFB->GetBinContent(ii) ); | |
628 | } | |
629 | ||
630 | ||
631 | return; | |
632 | } | |
633 | ||
634 | //####################################################################### | |
635 | void CanvasTriggerFactors() { | |
636 | ||
637 | TCanvas *cTriggerR = new TCanvas("cTriggerR", "Reduction Factors", 10, 10, 1400, 800); | |
638 | cTriggerR->Divide(1,2); | |
639 | ||
640 | TCanvas *cTriggerEP = new TCanvas("cTriggerEP", "Purity - Efficiency", 10, 10, 1400, 800); | |
641 | cTriggerEP->Divide(3,2); | |
642 | ||
643 | // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- | |
644 | ||
645 | Float_t ptMin = -0.25; | |
646 | Float_t ptMax = 12.75; | |
647 | Int_t nBins = 26; | |
648 | ||
649 | Float_t maxLine = 0.9; | |
650 | Float_t minLine = 0.8; | |
651 | ||
652 | // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- | |
653 | ||
654 | TLine* line1 = new TLine(0.,maxLine,ptMax,maxLine); | |
655 | line1->SetLineStyle(2); | |
656 | line1->SetLineColor(kGreen); | |
657 | ||
658 | TLine* line2 = new TLine(0.,minLine,ptMax,minLine); | |
659 | line2->SetLineStyle(2); | |
660 | line2->SetLineColor(kRed); | |
661 | ||
662 | // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- | |
663 | ||
664 | TH1F* hOFFRedux = new TH1F("hOFFRedux", "Reduction Factors", nBins, ptMin, ptMax); | |
665 | hOFFRedux->GetXaxis()->SetTitle("p_{t} (GeV/c)"); | |
666 | hOFFRedux->GetYaxis()->SetTitle("Reduction #left(#frac{N Events_{Total}}{N Events_{Triggered}}#right)"); | |
667 | ||
668 | TH1F* hOFFReduxS = new TH1F("hOFFReduxS", "", nBins, ptMin, ptMax); | |
669 | TH1F* hHLTRedux = new TH1F("hHLTRedux", "", nBins, ptMin, ptMax); | |
670 | TH1F* hHLTReduxS = new TH1F("hHLTReduxS", "", nBins, ptMin, ptMax); | |
671 | TH1F* hMCRedux = new TH1F("hMCRedux", "", nBins, ptMin, ptMax); | |
672 | TH1F* hMCReduxS = new TH1F("hMCReduxS", "", nBins, ptMin, ptMax); | |
673 | ||
674 | TH1F* hOFFReduxW = new TH1F("hOFFReduxW", "Reduction Factors - weighted nTracks", nBins, ptMin, ptMax); | |
675 | hOFFReduxW->GetXaxis()->SetTitle("p_{t} (GeV/c)"); | |
676 | hOFFReduxW->GetYaxis()->SetTitle("Reduction #left(#frac{N Events_{Total}}{N Events_{Triggered}}#right)"); | |
677 | ||
678 | TH1F* hOFFReduxWS = new TH1F("hOFFReduxWS", "", nBins, ptMin, ptMax); | |
679 | TH1F* hHLTReduxW = new TH1F("hHLTReduxW", "", nBins, ptMin, ptMax); | |
680 | TH1F* hHLTReduxWS = new TH1F("hHLTReduxWS", "", nBins, ptMin, ptMax); | |
681 | TH1F* hMCReduxW = new TH1F("hMCReduxW", "", nBins, ptMin, ptMax); | |
682 | TH1F* hMCReduxWS = new TH1F("hMCReduxWS", "", nBins, ptMin, ptMax); | |
683 | ||
684 | FillReduxHistogramsPt(static_cast<TH1F*>(fObjArray->FindObject("fNOFFTriggered")), hOFFRedux, hOFFReduxW); | |
685 | FillReduxHistogramsPt(static_cast<TH1F*>(fObjArray->FindObject("fNOFFTriggeredSel")), hOFFReduxS, hOFFReduxWS); | |
686 | FillReduxHistogramsPt(static_cast<TH1F*>(fObjArray->FindObject("fNHLTTriggered")), hHLTRedux, hHLTReduxW); | |
687 | FillReduxHistogramsPt(static_cast<TH1F*>(fObjArray->FindObject("fNHLTTriggeredSel")), hHLTReduxS, hHLTReduxWS); | |
688 | FillReduxHistogramsPt(static_cast<TH1F*>(fObjArray->FindObject("fNMCTriggered")), hMCRedux, hMCReduxW); | |
689 | FillReduxHistogramsPt(static_cast<TH1F*>(fObjArray->FindObject("fNMCTriggeredSel")), hMCReduxS, hMCReduxWS); | |
690 | ||
691 | // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- | |
692 | ||
693 | TLegend* legR = new TLegend(0.65, 0.12, 0.89, 0.37, "Event Selection"); | |
694 | legR->AddEntry(hOFFRedux, "OFF Trig - All Events","LP"); | |
695 | legR->AddEntry(hOFFReduxS,"OFF Trig - AliPhysSel - OFF PrimVertex","LP"); | |
696 | legR->AddEntry(hHLTRedux, "HLT Trig - All Events","LP"); | |
697 | legR->AddEntry(hHLTReduxS,"HLT Trig - AliPhysSel - OFF PrimVertex","LP"); | |
698 | legR->AddEntry(hMCRedux, "MC Trig - All Events","LP"); | |
699 | legR->AddEntry(hMCReduxS, "MC Trig - AliPhysSel - OFF PrimVertex","LP"); | |
700 | legR->SetFillColor(kWhite); | |
701 | ||
702 | // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- | |
703 | ||
704 | DrawHistogramTrigger(cTriggerR, 1, hOFFRedux, 0, kTRUE); | |
705 | DrawHistogramTrigger(cTriggerR, 1, hOFFReduxS, 1, kTRUE); | |
706 | DrawHistogramTrigger(cTriggerR, 1, hHLTRedux, 2, kTRUE); | |
707 | DrawHistogramTrigger(cTriggerR, 1, hHLTReduxS, 3, kTRUE); | |
708 | DrawHistogramTrigger(cTriggerR, 1, hMCRedux, 4, kTRUE); | |
709 | DrawHistogramTrigger(cTriggerR, 1, hMCReduxS, 5, kTRUE); | |
710 | legR->Draw(); | |
711 | ||
712 | DrawHistogramTrigger(cTriggerR, 2, hOFFReduxW, 0, kTRUE); | |
713 | DrawHistogramTrigger(cTriggerR, 2, hOFFReduxWS, 1, kTRUE); | |
714 | DrawHistogramTrigger(cTriggerR, 2, hHLTReduxW, 2, kTRUE); | |
715 | DrawHistogramTrigger(cTriggerR, 2, hHLTReduxWS, 3, kTRUE); | |
716 | DrawHistogramTrigger(cTriggerR, 2, hMCReduxW, 4, kTRUE); | |
717 | DrawHistogramTrigger(cTriggerR, 2, hMCReduxWS, 5, kTRUE); | |
718 | legR->Draw(); | |
719 | ||
720 | // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- | |
721 | // --------------------------------------------------------------- | |
722 | // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- | |
723 | ||
724 | TH1F* hOFFPurityHLT = new TH1F("hOFFPurityHLT", "HLT Trigger Purity vs OFF", nBins, ptMin, ptMax); | |
725 | hOFFPurityHLT->GetXaxis()->SetTitle("p_{t} (GeV/c)"); | |
726 | hOFFPurityHLT->GetYaxis()->SetTitle("Purity #left(#frac{HLT_{Triggered} - HLT_{Fake}}{HLT_{Triggered}}#right)"); | |
727 | hOFFPurityHLT->SetMinimum(0.0); | |
728 | hOFFPurityHLT->SetMaximum(1.2); | |
729 | TH1F* hOFFPurityHLTS = new TH1F("hOFFPurityHLTS", "", nBins, ptMin, ptMax); | |
730 | ||
731 | TH1F* hMCPurityHLT = new TH1F("hMCPurityHLT", "HLT Trigger Purity vs MC", nBins, ptMin, ptMax); | |
732 | hMCPurityHLT->GetXaxis()->SetTitle("p_{t} (GeV/c)"); | |
733 | hMCPurityHLT->GetYaxis()->SetTitle("Purity #left(#frac{HLT_{Triggered} - HLT_{Fake}}{HLT_{Triggered}}#right)"); | |
734 | hMCPurityHLT->SetMinimum(0.0); | |
735 | hMCPurityHLT->SetMaximum(1.2); | |
736 | TH1F* hMCPurityHLTS = new TH1F("hMCPurityHLTS", "", nBins, ptMin, ptMax); | |
737 | ||
738 | TH1F* hMCPurityOFF = new TH1F("hMCPurityOFF", "OFF Trigger Purity vs MC", nBins, ptMin, ptMax); | |
739 | hMCPurityOFF->GetXaxis()->SetTitle("p_{t} (GeV/c)"); | |
740 | hMCPurityOFF->GetYaxis()->SetTitle("Purity #left(#frac{OFF_{Triggered} - OFF_{Fake}}{OFF_{Triggered}}#right)"); | |
741 | hMCPurityOFF->SetMinimum(0.0); | |
742 | hMCPurityOFF->SetMaximum(1.2); | |
743 | TH1F* hMCPurityOFFS = new TH1F("hMCPurityOFFS", "", nBins, ptMin, ptMax); | |
744 | ||
745 | ||
746 | FillRatioHistogramsPt(static_cast<TH1F*>(fObjArray->FindObject("fNHLTTriggered")), | |
747 | static_cast<TH1F*>(fObjArray->FindObject("fNHLTFakeToOFF")), hOFFPurityHLT); | |
748 | ||
749 | FillRatioHistogramsPt(static_cast<TH1F*>(fObjArray->FindObject("fNHLTTriggeredSel")), | |
750 | static_cast<TH1F*>(fObjArray->FindObject("fNHLTFakeToOFFSel")), hOFFPurityHLTS); | |
751 | ||
752 | FillRatioHistogramsPt(static_cast<TH1F*>(fObjArray->FindObject("fNHLTTriggered")), | |
753 | static_cast<TH1F*>(fObjArray->FindObject("fNHLTFakeToMC")), hMCPurityHLT); | |
754 | ||
755 | FillRatioHistogramsPt(static_cast<TH1F*>(fObjArray->FindObject("fNHLTTriggeredSel")), | |
756 | static_cast<TH1F*>(fObjArray->FindObject("fNHLTFakeToMCSel")), hMCPurityHLTS); | |
757 | ||
758 | FillRatioHistogramsPt(static_cast<TH1F*>(fObjArray->FindObject("fNOFFTriggered")), | |
759 | static_cast<TH1F*>(fObjArray->FindObject("fNOFFFakeToMC")), hMCPurityOFF); | |
760 | ||
761 | FillRatioHistogramsPt(static_cast<TH1F*>(fObjArray->FindObject("fNOFFTriggeredSel")), | |
762 | static_cast<TH1F*>(fObjArray->FindObject("fNOFFFakeToMCSel")), hMCPurityOFFS); | |
763 | ||
764 | // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- | |
765 | ||
766 | TLegend* legPH = new TLegend(0.65, 0.72, 0.89, 0.87, "Event Selection"); | |
767 | legPH->AddEntry(hOFFPurityHLT, "HLT Trig - All Events","LP"); | |
768 | legPH->AddEntry(hOFFPurityHLTS,"HLT Trig - AliPhysSel - OFF PrimVertex","LP"); | |
769 | legPH->SetFillColor(kWhite); | |
770 | ||
771 | TLegend* legPO = new TLegend(0.65, 0.72, 0.89, 0.87, "Event Selection"); | |
772 | legPO->AddEntry(hMCPurityOFF, "OFF Trig - All Events","LP"); | |
773 | legPO->AddEntry(hMCPurityOFFS,"OFF Trig - AliPhysSel - OFF PrimVertex","LP"); | |
774 | legPO->SetFillColor(kWhite); | |
775 | ||
776 | // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- | |
777 | ||
778 | DrawHistogramTrigger(cTriggerEP, 1, hOFFPurityHLT, 0, kFALSE); | |
779 | DrawHistogramTrigger(cTriggerEP, 1, hOFFPurityHLTS, 1, kFALSE); | |
780 | line1->Draw(); | |
781 | line2->Draw(); | |
782 | legPH->Draw(); | |
783 | ||
784 | // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- | |
785 | ||
786 | DrawHistogramTrigger(cTriggerEP, 2, hMCPurityHLT, 0, kFALSE); | |
787 | DrawHistogramTrigger(cTriggerEP, 2, hMCPurityHLTS, 1, kFALSE); | |
788 | line1->Draw(); | |
789 | line2->Draw(); | |
790 | legPH->Draw(); | |
791 | ||
792 | // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- | |
793 | ||
794 | DrawHistogramTrigger(cTriggerEP, 3, hMCPurityOFF, 0, kFALSE); | |
795 | DrawHistogramTrigger(cTriggerEP, 3, hMCPurityOFFS, 1, kFALSE); | |
796 | line1->Draw(); | |
797 | line2->Draw(); | |
798 | legPO->Draw(); | |
799 | ||
800 | // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- | |
801 | // --------------------------------------------------------------- | |
802 | // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- | |
803 | ||
804 | TH1F* hOFFEffHLT = new TH1F("hOFFEffHLT", "HLT Trigger Efficiency vs OFF", nBins, ptMin, ptMax); | |
805 | hOFFEffHLT->GetXaxis()->SetTitle("p_{t} (GeV/c)"); | |
806 | hOFFEffHLT->GetYaxis()->SetTitle("Efficiency #left(#frac{OFF_{Triggered} - HLT_{Miss}}{OFF_{Triggered}}#right)"); | |
807 | hOFFEffHLT->SetMinimum(0.0); | |
808 | hOFFEffHLT->SetMaximum(1.2); | |
809 | TH1F* hOFFEffHLTS = new TH1F("hOFFEffHLTS", "", nBins, ptMin, ptMax); | |
810 | ||
811 | TH1F* hMCEffHLT = new TH1F("hMCEffHLT","HLT Trigger Efficiency vs MC", nBins, ptMin, ptMax); | |
812 | hMCEffHLT->GetXaxis()->SetTitle("p_{t} (GeV/c)"); | |
813 | hMCEffHLT->GetYaxis()->SetTitle("Efficiency #left(#frac{MC_{Triggered} - HLT_{Miss}}{MC_{Triggered}}#right)"); | |
814 | hMCEffHLT->SetMinimum(0.0); | |
815 | hMCEffHLT->SetMaximum(1.2); | |
816 | TH1F* hMCEffHLTS = new TH1F("hMCEffHLTS", "", nBins, ptMin, ptMax); | |
817 | ||
818 | TH1F* hMCEffOFF = new TH1F("hMCEffOFF","OFF Trigger Efficiency vs MC", nBins, ptMin, ptMax); | |
819 | hMCEffOFF->GetXaxis()->SetTitle("p_{t} (GeV/c)"); | |
820 | hMCEffOFF->GetYaxis()->SetTitle("Efficiency #left(#frac{MC_{Triggered} - OFF_{Miss}}{MC_{Triggered}}#right)"); | |
821 | hMCEffOFF->SetMinimum(0.0); | |
822 | hMCEffOFF->SetMaximum(1.2); | |
823 | TH1F* hMCEffOFFS = new TH1F("hMCEffOFFS", "", nBins, ptMin, ptMax); | |
824 | ||
825 | // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- | |
826 | ||
827 | FillRatioHistogramsPt(static_cast<TH1F*>(fObjArray->FindObject("fNOFFTriggered")), | |
828 | static_cast<TH1F*>(fObjArray->FindObject("fNHLTMissToOFF")), hOFFEffHLT); | |
829 | ||
830 | FillRatioHistogramsPt(static_cast<TH1F*>(fObjArray->FindObject("fNOFFTriggeredSel")), | |
831 | static_cast<TH1F*>(fObjArray->FindObject("fNHLTMissToOFFSel")), hOFFEffHLTS); | |
832 | ||
833 | FillRatioHistogramsPt(static_cast<TH1F*>(fObjArray->FindObject("fNMCTriggered")), | |
834 | static_cast<TH1F*>(fObjArray->FindObject("fNHLTMissToMC")), hMCEffHLT); | |
835 | ||
836 | FillRatioHistogramsPt(static_cast<TH1F*>(fObjArray->FindObject("fNMCTriggeredSel")), | |
837 | static_cast<TH1F*>(fObjArray->FindObject("fNHLTMissToMCSel")), hMCEffHLTS); | |
838 | ||
839 | FillRatioHistogramsPt(static_cast<TH1F*>(fObjArray->FindObject("fNMCTriggered")), | |
840 | static_cast<TH1F*>(fObjArray->FindObject("fNOFFMissToMC")), hMCEffOFF); | |
841 | ||
842 | FillRatioHistogramsPt(static_cast<TH1F*>(fObjArray->FindObject("fNMCTriggeredSel")), | |
843 | static_cast<TH1F*>(fObjArray->FindObject("fNOFFMissToMCSel")), hMCEffOFFS); | |
844 | ||
845 | // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- | |
846 | ||
847 | TLegend* legEH = new TLegend(0.65, 0.70, 0.89, 0.85, "Event Selection"); | |
848 | legEH->AddEntry(hOFFEffHLT, "HLT Trig - All Events","LP"); | |
849 | legEH->AddEntry(hOFFEffHLTS,"HLT Trig - AliPhysSel - OFF PrimVertex","LP"); | |
850 | legEH->SetFillColor(kWhite); | |
851 | ||
852 | TLegend* legEO = new TLegend(0.65, 0.70, 0.89, 0.85, "Event Selection"); | |
853 | legEO->AddEntry(hMCEffOFF, "OFF Trig - All Events","LP"); | |
854 | legEO->AddEntry(hMCEffOFFS,"OFF Trig - AliPhysSel - OFF PrimVertex","LP"); | |
855 | legEO->SetFillColor(kWhite); | |
856 | ||
857 | // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- | |
858 | ||
859 | DrawHistogramTrigger(cTriggerEP, 4, hOFFEffHLT, 0, kFALSE); | |
860 | DrawHistogramTrigger(cTriggerEP, 4, hOFFEffHLTS, 1, kFALSE); | |
861 | line1->Draw(); | |
862 | line2->Draw(); | |
863 | legEH->Draw(); | |
864 | ||
865 | // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- | |
866 | ||
867 | DrawHistogramTrigger(cTriggerEP, 5, hMCEffHLT, 0, kFALSE); | |
868 | DrawHistogramTrigger(cTriggerEP, 5, hMCEffHLTS, 1, kFALSE); | |
869 | line1->Draw(); | |
870 | line2->Draw(); | |
871 | legEH->Draw(); | |
872 | ||
873 | // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- | |
874 | ||
875 | DrawHistogramTrigger(cTriggerEP, 6, hMCEffOFF, 0, kFALSE); | |
876 | DrawHistogramTrigger(cTriggerEP, 6, hMCEffOFFS, 1, kFALSE); | |
877 | line1->Draw(); | |
878 | line2->Draw(); | |
879 | legEO->Draw(); | |
880 | ||
881 | cTriggerR->SaveAs(Form("TriggerHists_%d.png",++fgImgIdx)); | |
882 | cTriggerEP->SaveAs(Form("TriggerHists_%d.png",++fgImgIdx)); | |
883 | ||
884 | return; | |
885 | } | |
886 | ||
887 | //####################################################################### | |
888 | void CreateCanvasCuts() { | |
889 | ||
890 | Char_t * type[] = {"MC","OFF","HLT","HLT/MC","HLT/OFF","OFF/MC", | |
891 | "MC","OFF","HLT","HLT/MC","HLT/OFF","OFF/MC" }; | |
892 | Char_t * histType[] = {"Pt","Mult"}; | |
893 | ||
894 | Float_t ptXMin = 0.3; | |
895 | Float_t ptXMax = 20.; | |
896 | Float_t ptYMin = 1.; | |
897 | Float_t ptYMax = 1e6; | |
898 | ||
899 | Float_t multXMin = 3.; | |
900 | Float_t multXMax = 50.; | |
901 | Float_t multYMin = 1.; | |
902 | Float_t multYMax = 1e5; | |
903 | ||
904 | Int_t maxPads = 12; | |
905 | Int_t iMax = 2; | |
906 | ||
907 | // ---------------------------------------------------------------------------- | |
908 | ||
909 | TCanvas *cEvCuts = new TCanvas("cEvCuts", "Pt Event Selection - Cut Studies", 10, 10, 1400, 800); | |
910 | cEvCuts->Divide(3,2); | |
911 | ||
912 | TCanvas *cTrCuts = new TCanvas("cTrCuts", "Pt Track Selection - Cut Studies", 10, 10, 1400, 800); | |
913 | cTrCuts->Divide(3,2); | |
914 | ||
915 | TCanvas *cEvCuts2 = new TCanvas("cEvCuts2", "Mult Event Selection - Cut Studies", 10, 10, 1400, 800); | |
916 | cEvCuts2->Divide(3,2); | |
917 | ||
918 | TCanvas *cTrCuts2 = new TCanvas("cTrCuts2", "Mult Track Selection - Cut Studies", 10, 10, 1400, 800); | |
919 | cTrCuts2->Divide(3,2); | |
920 | ||
921 | // ---------------------------------------------------------------------------- | |
922 | ||
923 | TLegend* legEvCuts[maxPads]; | |
924 | TLegend* legTrCuts[maxPads]; | |
925 | ||
926 | for ( Int_t idx=0; idx < maxPads; idx++ ) { | |
927 | ||
928 | if ( idx < maxPads/2) { // -- Pt | |
929 | ||
930 | if ( idx >= 3 && idx < 6) { // ratio | |
931 | legEvCuts[idx] = new TLegend(0.14, 0.75, 0.55, 0.88, | |
932 | Form("Event Selection - P_{t} Cut Studies (%s)", type[idx])); | |
933 | ||
934 | legTrCuts[idx] = new TLegend(0.14, 0.75, 0.55, 0.88, | |
935 | Form("Track Selection - P_{t} Cut Studies (%s)", type[idx])); | |
936 | } | |
937 | else { | |
938 | legEvCuts[idx] = new TLegend(0.14, 0.16, 0.55, 0.29, | |
939 | Form("Event Selection - P_{t} Cut Studies (%s)", type[idx])); | |
940 | ||
941 | legTrCuts[idx] = new TLegend(0.14, 0.16, 0.55, 0.29, | |
942 | Form("Track Selection - P_{t} Cut Studies (%s)", type[idx])); | |
943 | } | |
944 | ||
945 | legEvCuts[idx]->SetFillColor(kWhite); | |
946 | legTrCuts[idx]->SetFillColor(kWhite); | |
947 | } | |
948 | else { // -- Multiplicity | |
949 | legEvCuts[idx] = new TLegend(0.48, 0.75, 0.89, 0.88, | |
950 | Form("Event Selection - Multiplicity Cut Studies (%s)", type[idx])); | |
951 | legEvCuts[idx]->SetFillColor(kWhite); | |
952 | ||
953 | legTrCuts[idx] = new TLegend(0.48, 0.75, 0.89, 0.88, | |
954 | Form("Track Selection - Multiplicity Cut Studies (%s)", type[idx])); | |
955 | legTrCuts[idx]->SetFillColor(kWhite); | |
956 | } | |
957 | } | |
958 | ||
959 | // ---------------------------------------------------------------------------- | |
960 | ||
961 | for ( Int_t hType = 0; hType < 2; hType++ ) { | |
962 | ||
963 | TCanvas* can = NULL; | |
964 | TCanvas* can2 = NULL; | |
965 | if ( hType == 0 ) { | |
966 | can = cEvCuts; | |
967 | can2 = cEvCuts2; | |
968 | } | |
969 | else if ( hType == 1 ) { | |
970 | can = cTrCuts; | |
971 | can2 = cTrCuts2; | |
972 | } | |
973 | ||
974 | for ( Int_t ipad=1; ipad <= maxPads; ipad++ ) { | |
975 | ||
976 | Int_t pad = ipad; | |
977 | ||
978 | // -- Legends | |
979 | TLegend* leg = NULL; | |
980 | if ( hType == 0 ) | |
981 | leg = legEvCuts[pad-1]; | |
982 | else if ( hType == 1 ) | |
983 | leg = legTrCuts[pad-1]; | |
984 | ||
985 | // -- Pt / Multiplicity | |
986 | Bool_t xLog = kTRUE; | |
987 | Int_t hIdx = 0; | |
988 | Float_t xMin, xMax, yMin, yMax; | |
989 | if ( ipad <= maxPads/2 ) { // -- Pt | |
990 | hIdx = 0; | |
991 | xLog = kTRUE; | |
992 | xMin = ptXMin; | |
993 | xMax = ptXMax; | |
994 | yMin = ptYMin; | |
995 | yMax = ptYMax; | |
996 | } | |
997 | else { // -- Multiplicity | |
998 | hIdx = 1; | |
999 | xLog = kFALSE; | |
1000 | pad = ipad - maxPads/2; | |
1001 | can = can2; | |
1002 | xMin = multXMin; | |
1003 | xMax = multXMax; | |
1004 | yMin = multYMin; | |
1005 | yMax = multYMax; | |
1006 | } | |
1007 | ||
1008 | // ---------------------------------------------------------------------------- | |
1009 | ||
1010 | for ( Int_t idx = 0; idx <= iMax; idx++ ) { | |
1011 | ||
1012 | Int_t iIdx = idx; | |
1013 | if ( hType == 1 ) // -- Track selection | |
1014 | iIdx = idx+2; | |
1015 | ||
1016 | TH1F* hO = static_cast<TH1F*>(fObjArray->FindObject(Form("fHistOFF%s_%d", histType[hIdx],iIdx))); | |
1017 | TH1F* hH = static_cast<TH1F*>(fObjArray->FindObject(Form("fHistHLT%s_%d", histType[hIdx], iIdx))); | |
1018 | TH1F* hM = static_cast<TH1F*>(fObjArray->FindObject(Form("fHistMC%s_%d", histType[hIdx], iIdx))); | |
1019 | ||
1020 | if ( hType == 0 ) { // Event selection | |
1021 | hO->SetTitle(Form("OFF %s Distribution - Event Selection", histType[hIdx])); | |
1022 | hH->SetTitle(Form("HLT %s Distribution - Event Selection", histType[hIdx])); | |
1023 | hM->SetTitle(Form("MC %s Distribution - Event Selection", histType[hIdx])); | |
1024 | } | |
1025 | else { | |
1026 | hO->SetTitle(Form("OFF %s Distribution - Track Selection", histType[hIdx])); | |
1027 | hH->SetTitle(Form("HLT %s Distribution - Track Selection", histType[hIdx])); | |
1028 | hM->SetTitle(Form("MC %s Distribution - Track Selection", histType[hIdx])); | |
1029 | } | |
1030 | ||
1031 | hO->SetAxisRange(xMin, xMax); | |
1032 | hH->SetAxisRange(xMin, xMax); | |
1033 | hM->SetAxisRange(xMin, xMax); | |
1034 | hO->SetAxisRange(yMin, yMax, "Y"); | |
1035 | hH->SetAxisRange(yMin, yMax, "Y"); | |
1036 | hM->SetAxisRange(yMin, yMax, "Y"); | |
1037 | ||
1038 | if (pad == 1 || pad == 7) { | |
1039 | DrawHistogram(can, pad, hM, idx, kFALSE, kTRUE, xLog); | |
1040 | leg->AddEntry(hM, fgkSelectionCutsMC[iIdx],"L"); | |
1041 | leg->Draw(); | |
1042 | } | |
1043 | else if (pad == 2 || pad == 8 ) { | |
1044 | DrawHistogram(can, pad, hO, idx, kFALSE, kTRUE, xLog); | |
1045 | leg->AddEntry(hO, fgkSelectionCuts[iIdx],"L"); | |
1046 | leg->Draw(); | |
1047 | } | |
1048 | else if (pad == 3 || pad == 9 ) { | |
1049 | DrawHistogram(can, pad, hH, idx, kFALSE, kTRUE, xLog); | |
1050 | leg->AddEntry(hH, fgkSelectionCuts[iIdx],"L"); | |
1051 | leg->Draw(); | |
1052 | } | |
1053 | else if (pad == 4 || pad == 10 ) { | |
1054 | ||
1055 | TH1F* hClone0= static_cast<TH1F*>(hH->Clone()); | |
1056 | DivideHist(hClone0, hH, hM); | |
1057 | ||
1058 | if (hIdx == 0) | |
1059 | SetHist(hClone0, hType, type[pad-1], histType[hIdx], 0., 3.); | |
1060 | else | |
1061 | SetHist(hClone0, hType, type[pad-1], histType[hIdx], 0., 10.); | |
1062 | ||
1063 | DrawHistogram(can, pad, hClone0, idx, kFALSE, kFALSE, xLog); | |
1064 | leg->AddEntry(hClone0, fgkSelectionCutsRatioMC[iIdx],"L"); | |
1065 | leg->Draw(); | |
1066 | } | |
1067 | else if (pad == 5 || pad == 11 ) { | |
1068 | ||
1069 | TH1F* hClone1= static_cast<TH1F*>(hH->Clone()); | |
1070 | DivideHist(hClone1, hH, hO); | |
1071 | ||
1072 | if (hIdx == 0) | |
1073 | SetHist(hClone1, hType, type[pad-1], histType[hIdx], 0., 3.); | |
1074 | else | |
1075 | SetHist(hClone1, hType, type[pad-1], histType[hIdx], 0., 10.); | |
1076 | ||
1077 | DrawHistogram(can, pad, hClone1, idx, kFALSE, kFALSE, xLog); | |
1078 | leg->AddEntry(hClone1, fgkSelectionCuts[iIdx],"L"); | |
1079 | leg->Draw(); | |
1080 | } | |
1081 | else if (pad == 6 || pad == 12 ) { | |
1082 | ||
1083 | TH1F* hClone2= static_cast<TH1F*>(hO->Clone()); | |
1084 | DivideHist(hClone2, hO, hM); | |
1085 | ||
1086 | if (hIdx == 0) | |
1087 | SetHist(hClone2, hType, type[pad-1], histType[hIdx], 0., 3.); | |
1088 | else | |
1089 | SetHist(hClone2, hType, type[pad-1], histType[hIdx], 0., 10.); | |
1090 | ||
1091 | DrawHistogram(can, pad, hClone2, idx, kFALSE, kFALSE, xLog); | |
1092 | leg->AddEntry(hClone2, fgkSelectionCutsRatioMC[iIdx],"L"); | |
1093 | leg->Draw(); | |
1094 | } | |
1095 | } // for ( Int_t idx = 0; idx <=2; idx++ ) { | |
1096 | } // for ( Int_t pad=1; pad <=4; pad++ ) { | |
1097 | } // for ( Int_t hType = 0; hType < 4; hType++ ) { | |
1098 | ||
1099 | ||
1100 | if (cEvCuts) cEvCuts->SaveAs(Form("TriggerHists_Cuts_%d_B.png",++fgImgIdx)); | |
1101 | if (cEvCuts2) cEvCuts2->SaveAs(Form("TriggerHists_Cuts_%d_B.png",++fgImgIdx)); | |
1102 | if (cTrCuts) cTrCuts->SaveAs(Form("TriggerHists_Cuts_%d_B.png",++fgImgIdx)); | |
1103 | if (cTrCuts2) cTrCuts2->SaveAs(Form("TriggerHists_Cuts_%d_B.png",++fgImgIdx)); | |
1104 | ||
1105 | return; | |
1106 | } | |
1107 | ||
1108 | //####################################################################### | |
1109 | void CreateCanvasDistributions( Int_t maxLayer, Int_t draw, Int_t data, Int_t minLayer ) { | |
1110 | ||
1111 | Float_t maxLine = 0.9; | |
1112 | Float_t minLine = 0.8; | |
1113 | ||
1114 | Int_t compHist = 3; | |
1115 | Float_t ptMin = 0.3; | |
1116 | Float_t ptMax = 40.; | |
1117 | ||
1118 | Char_t * type[] = {"MC","OFF","HLT"}; | |
1119 | Char_t * histType[] = {"Pt","Mult"}; | |
1120 | ||
1121 | // ---------------------------------------------------------------------------- | |
1122 | ||
1123 | TCanvas *cSpectra = NULL; | |
1124 | TCanvas *cSpectraEff = NULL; | |
1125 | TCanvas *cMult = NULL; | |
1126 | TCanvas *cMultEff = NULL; | |
1127 | ||
1128 | TLegend* legPt[6]; | |
1129 | TLegend* legPtEff[6]; | |
1130 | TLegend* legMult[6]; | |
1131 | TLegend* legMultEff[6]; | |
1132 | ||
1133 | // ---------------------------------------------------------------------------- | |
1134 | Int_t canvasRows = 1; | |
1135 | ||
1136 | if ( data == 2 ) | |
1137 | canvasRows = 2; | |
1138 | ||
1139 | if ( draw == 0 || draw == 2 ) { | |
1140 | cSpectra = new TCanvas("cSpectra", "Triggered - P_{t} Distributions", 10, 10, 1400, 800); | |
1141 | cSpectra->Divide(3,canvasRows); | |
1142 | ||
1143 | cSpectraEff = new TCanvas("cSpectraEff", "Triggered - P_{t} Efficiencies", 10, 10, 1400, 800); | |
1144 | cSpectraEff->Divide(3,canvasRows); | |
1145 | } | |
1146 | ||
1147 | if ( draw == 1 || draw == 2 ) { | |
1148 | cMult = new TCanvas("cMult", "Triggered - Multiplicity Distributions", 10, 10, 1400, 800); | |
1149 | cMult->Divide(3,canvasRows); | |
1150 | ||
1151 | cMultEff = new TCanvas("cMultEff", "Triggered - Multiplicity Efficiencies", 10, 10, 1400, 800); | |
1152 | cMultEff->Divide(3,canvasRows); | |
1153 | } | |
1154 | ||
1155 | // ---------------------------------------------------------------------------- | |
1156 | for ( Int_t hType = 0; hType < 2; hType++ ) { | |
1157 | ||
1158 | if ( hType != draw && draw != 2) | |
1159 | continue; | |
1160 | ||
1161 | for ( Int_t pad=1; pad <=6; pad++ ) { | |
1162 | ||
1163 | if ( data == 0 && pad > 3 ) | |
1164 | continue; | |
1165 | ||
1166 | if ( data == 1 && pad < 4 ) | |
1167 | continue; | |
1168 | ||
1169 | TCanvas* can = NULL; | |
1170 | TCanvas* canEff = NULL; | |
1171 | ||
1172 | TLegend* leg = NULL; | |
1173 | TLegend* legEff = NULL; | |
1174 | ||
1175 | Bool_t xLog = kTRUE; | |
1176 | Char_t* trigType = ""; | |
1177 | Char_t* dataType = "OFF"; | |
1178 | ||
1179 | Int_t iIdx = 0; | |
1180 | Int_t layer = 0; | |
1181 | ||
1182 | if ( pad == 1 || pad == 4 ) { | |
1183 | iIdx = 0; | |
1184 | trigType = "MC"; | |
1185 | } | |
1186 | else if ( pad == 2 || pad == 5 ) { | |
1187 | iIdx = 1; | |
1188 | trigType = "OFF"; | |
1189 | } | |
1190 | else if ( pad == 3 || pad == 6 ) { | |
1191 | iIdx = 2; | |
1192 | trigType = "HLT"; | |
1193 | } | |
1194 | else | |
1195 | continue; | |
1196 | ||
1197 | if ( pad > 3 ) | |
1198 | dataType = "MC"; | |
1199 | ||
1200 | if ( hType == 0 ) { | |
1201 | can = cSpectra; | |
1202 | canEff = cSpectraEff; | |
1203 | leg = legPt[pad-1]; | |
1204 | legEff = legPtEff[pad-1]; | |
1205 | xLog = kTRUE; | |
1206 | } | |
1207 | else if ( hType == 1 ) { | |
1208 | can = cMult; | |
1209 | canEff = cMultEff; | |
1210 | leg = legMult[pad-1]; | |
1211 | legEff = legMultEff[pad-1]; | |
1212 | xLog = kFALSE; | |
1213 | } | |
1214 | ||
1215 | TH1F * hcp = static_cast<TH1F*>(fObjArray->FindObject(Form("fHist%s%s_%d", dataType, | |
1216 | histType[hType],compHist))); | |
1217 | ||
1218 | if ( hType == 0 ) | |
1219 | hcp->SetAxisRange(ptMin, ptMax); | |
1220 | ||
1221 | hcp->SetMinimum(10); | |
1222 | ||
1223 | DrawHistogram(can, pad, hcp, layer, kFALSE, kFALSE, xLog); | |
1224 | ||
1225 | leg = new TLegend(0.58, 0.70, 0.88, 0.88, Form("Trigger Selection: %s Tracks",type[iIdx])); | |
1226 | leg->AddEntry(hcp, "Track Selection","L"); | |
1227 | leg->SetFillColor(kWhite); | |
1228 | ||
1229 | legEff = new TLegend(0.15, 0.70, 0.45, 0.88, Form("Trigger Selection: %s Tracks",type[iIdx])); | |
1230 | legEff->SetFillColor(kWhite); | |
1231 | ||
1232 | // -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- | |
1233 | ++layer; | |
1234 | ||
1235 | for ( Int_t idx= 0; idx < fgkNTrigger; idx++ ) { | |
1236 | ||
1237 | if ( idx >= maxLayer ) | |
1238 | continue; | |
1239 | ||
1240 | if ( idx < minLayer ) | |
1241 | continue; | |
1242 | ||
1243 | Int_t iter = idx; | |
1244 | ||
1245 | TH1F *hist = static_cast<TH1F*>(fObjArray->FindObject(Form("fHist%s_%sTriggered_%s_%d", | |
1246 | dataType, histType[hType], trigType, iter))); | |
1247 | ||
1248 | if ( hType == 0 ) | |
1249 | hist->SetAxisRange(ptMin, ptMax); | |
1250 | DrawHistogram(can, pad, hist, layer, kFALSE, kTRUE, xLog); | |
1251 | ||
1252 | leg->AddEntry(hist, fgkTrigger[iter],"L"); | |
1253 | leg->Draw(); | |
1254 | ||
1255 | // ------------------------------------------------ | |
1256 | ||
1257 | TH1F *eff = static_cast<TH1F*>(hist->Clone()); | |
1258 | DivideHist(eff,hist,hcp); | |
1259 | if ( hType == 0 ) | |
1260 | eff->SetAxisRange(ptMin, ptMax); | |
1261 | ||
1262 | eff->SetAxisRange(0., 1.4, "Y"); | |
1263 | eff->SetTitle(Form("%s Trigger Efficiency - applied on %s data", type[iIdx], dataType)); | |
1264 | eff->GetYaxis()->SetTitle(Form("%s Trigger Efficiecy", type[iIdx])); | |
1265 | ||
1266 | DrawHistogram(canEff, pad, eff, layer-1, kFALSE, kFALSE, xLog); | |
1267 | legEff->AddEntry(eff, fgkTrigger[iter],"L"); | |
1268 | legEff->Draw(); | |
1269 | ||
1270 | // ------------------------------------------------ | |
1271 | ||
1272 | // -- Draw line at maxLine | |
1273 | if ( idx == minLayer ){ | |
1274 | ||
1275 | Float_t max = 50.; | |
1276 | if ( hType == 0) | |
1277 | max = ptMax; | |
1278 | ||
1279 | TLine* line = NULL; | |
1280 | line = new TLine(0.,maxLine,max,maxLine); | |
1281 | line->SetLineStyle(2); | |
1282 | line->SetLineColor(kGreen); | |
1283 | line->Draw(); | |
1284 | ||
1285 | TLine* line2 = NULL; | |
1286 | line2 = new TLine(0.,minLine,max,minLine); | |
1287 | line2->SetLineStyle(2); | |
1288 | line2->SetLineColor(kRed); | |
1289 | line2->Draw(); | |
1290 | } | |
1291 | ||
1292 | // ------------------------------------------------ | |
1293 | ||
1294 | ++layer; | |
1295 | } // for ( Int_t idx= 0; idx < 3; idx++ ) { | |
1296 | ||
1297 | } // for ( Int_t pad=1; pad <=6; pad++ ) { | |
1298 | ||
1299 | } // for ( Int_t hType = 0; hType < 2; hType++ ) { | |
1300 | ||
1301 | ||
1302 | if (cSpectra) cSpectra->SaveAs(Form("TriggerHists_Pt_%d.png",++fgImgIdx)); | |
1303 | if (cSpectraEff) cSpectraEff->SaveAs(Form("TriggerHists_PtEff_%d.png",++fgImgIdx)); | |
1304 | ||
1305 | if (cMult) cMult->SaveAs(Form("TriggerHists_Mult_%d_B.png",++fgImgIdx)); | |
1306 | if (cMultEff) cMultEff->SaveAs(Form("TriggerHists_MultEff_%d_B.png",++fgImgIdx)); | |
1307 | ||
1308 | return; | |
1309 | } | |
1310 | ||
1311 | // ---------------------------------------------------------------------- | |
1312 | // -- Helper Functions -- | |
1313 | // ---------------------------------------------------------------------- | |
1314 | ||
1315 | //####################################################################### | |
1316 | void SetHist(TH1F* hist, Int_t hType, Char_t* dataType, Char_t* histType, Float_t minY, Float_t maxY ) { | |
1317 | ||
1318 | if (hType == 0) | |
1319 | hist->SetTitle(Form("Ratio %s - %s Distribution - Event Selection", dataType, histType)); | |
1320 | else | |
1321 | hist->SetTitle(Form("Ratio %s - %s Distribution - Track Selection", dataType, histType)); | |
1322 | ||
1323 | hist->SetAxisRange(minY, maxY, "Y"); | |
1324 | hist->GetYaxis()->SetTitle(Form("Ratio %s", dataType)); | |
1325 | } | |
1326 | ||
1327 | //####################################################################### | |
1328 | void DivideHist(TH1F* h0, TH1F* h1, TH1F* h2) { | |
1329 | // Divides h1 / h2, does proper error handling and saves in h0 | |
1330 | ||
1331 | for(Int_t iBin=1; iBin < h0->GetXaxis()->GetNbins(); iBin++) { | |
1332 | Float_t hist1Content = h1->GetBinContent(iBin); | |
1333 | Float_t hist1Error = h1->GetBinError(iBin); | |
1334 | Float_t hist2Content = h2->GetBinContent(iBin); | |
1335 | Float_t hist2Error = h2->GetBinError(iBin); | |
1336 | ||
1337 | if ( hist1Content == 0. && hist1Content == 0. ){ | |
1338 | h0->SetBinContent(iBin, 1.); | |
1339 | h0->SetBinError(iBin, 0.); | |
1340 | } | |
1341 | ||
1342 | if(hist1Content<=0.0) continue; | |
1343 | if(hist2Content<=0.0) continue; | |
1344 | ||
1345 | Float_t ratio = hist1Content/hist2Content; | |
1346 | Float_t relError1 = hist1Error/hist1Content; | |
1347 | Float_t relError2 = hist2Error/hist2Content; | |
1348 | Float_t error = ratio*TMath::Sqrt(relError1*relError1+relError2*relError2); | |
1349 | ||
1350 | h0->SetBinContent(iBin, ratio); | |
1351 | h0->SetBinError(iBin, error); | |
1352 | } | |
1353 | ||
1354 | return; | |
1355 | } | |
1356 | ||
1357 | //####################################################################### | |
1358 | void FillIntegrated(TH1F* hist, TH1F* histInt ) { | |
1359 | // see header file for class documentation | |
1360 | ||
1361 | Double_t oldBin = 0.; | |
1362 | for ( Int_t idx = 0; idx < hist->GetNbinsX() ; ++idx ){ | |
1363 | histInt->SetBinContent(idx, hist->GetBinContent(idx) + oldBin); | |
1364 | oldBin = hist->GetBinContent(idx) + oldBin; | |
1365 | } | |
1366 | histInt->SetEntries(hist->GetNbinsX()); | |
1367 | ||
1368 | return; | |
1369 | } | |
1370 | ||
1371 | //####################################################################### | |
1372 | void FillReduxHistograms( TH1F* hN, TH1F* hRedux ) { | |
1373 | ||
1374 | Float_t base = hN->GetBinContent(1); | |
1375 | Float_t baseRelErr = hN->GetBinError(1) / base; | |
1376 | ||
1377 | for ( Int_t idx = 2; idx <= 2*(fgkNTrigger+1) ; ++idx ){ | |
1378 | ||
1379 | Int_t bin = idx-1; | |
1380 | if ( idx == fgkNTrigger+2 ) { | |
1381 | base = hN->GetBinContent(fgkNTrigger+2); | |
1382 | baseRelErr = hN->GetBinError(fgkNTrigger+2) / base; | |
1383 | continue; | |
1384 | } | |
1385 | else if( idx > fgkNTrigger+2 ) | |
1386 | bin = idx-2; | |
1387 | ||
1388 | Float_t cont = hN->GetBinContent(idx); | |
1389 | ||
1390 | if (cont <=0.) continue; | |
1391 | Float_t contRelErr = hN->GetBinError(idx) / cont; | |
1392 | ||
1393 | Float_t ratio = base / cont; | |
1394 | Float_t error = ratio * TMath::Sqrt(contRelErr*contRelErr + baseRelErr*baseRelErr); | |
1395 | ||
1396 | hRedux->SetBinContent(bin, ratio); | |
1397 | hRedux->SetBinError(bin, error); | |
1398 | } | |
1399 | ||
1400 | return; | |
1401 | } | |
1402 | ||
1403 | //####################################################################### | |
1404 | void FillReduxHistogramsPt( TH1F* hN, TH1F* hRedux, TH1F* hReduxW ) { | |
1405 | ||
1406 | Float_t base = hN->GetBinContent(1); | |
1407 | Float_t baseRelErr = hN->GetBinError(1) / base; | |
1408 | ||
1409 | TH1F* hist = hRedux; | |
1410 | Int_t trgIdx = 0; | |
1411 | ||
1412 | for ( Int_t idx = 2; idx <= 2*(fgkNTrigger+1) ; ++idx ){ | |
1413 | ||
1414 | if ( idx == fgkNTrigger+2 ) { | |
1415 | base = hN->GetBinContent(fgkNTrigger+2); | |
1416 | baseRelErr = hN->GetBinError(fgkNTrigger+2) / base; | |
1417 | hist = hReduxW; | |
1418 | trgIdx = 0; | |
1419 | continue; | |
1420 | } | |
1421 | ||
1422 | if ( fgkTriggerPt[trgIdx] > 100. ) { | |
1423 | ++trgIdx; | |
1424 | continue; | |
1425 | } | |
1426 | ||
1427 | Int_t nbin = hist->FindBin(fgkTriggerPt[trgIdx]); | |
1428 | ++trgIdx; | |
1429 | ||
1430 | Float_t cont = hN->GetBinContent(idx); | |
1431 | ||
1432 | if (cont <=0.) continue; | |
1433 | Float_t contRelErr = hN->GetBinError(idx) / cont; | |
1434 | ||
1435 | Float_t ratio = base / cont; | |
1436 | Float_t error = ratio * TMath::Sqrt(contRelErr*contRelErr + baseRelErr*baseRelErr); | |
1437 | ||
1438 | hist->SetBinContent(nbin, ratio); | |
1439 | hist->SetBinError(nbin, error); | |
1440 | } | |
1441 | ||
1442 | return; | |
1443 | } | |
1444 | ||
1445 | //####################################################################### | |
1446 | void FillRatioHistograms( TH1F* hN, TH1F* hF, TH1F* hRatio ) { | |
1447 | ||
1448 | for ( Int_t idx = 2; idx <= 2*(fgkNTrigger+1) ; ++idx ){ | |
1449 | ||
1450 | Int_t bin = idx-1; | |
1451 | if ( idx == fgkNTrigger+2 ) | |
1452 | continue; | |
1453 | else if( idx > fgkNTrigger+2 ) | |
1454 | bin = idx-2; | |
1455 | ||
1456 | Float_t h1Cont = hF->GetBinContent(idx); | |
1457 | Float_t h2Cont = hN->GetBinContent(idx); | |
1458 | ||
1459 | if ( h2Cont <= 0. || h1Cont <= 0. ) continue; | |
1460 | ||
1461 | Float_t h1RelErr = hF->GetBinError(idx) / h1Cont; | |
1462 | Float_t h2RelErr = hN->GetBinError(idx) / h2Cont; | |
1463 | ||
1464 | Float_t ratio = (h2Cont - h1Cont) / h2Cont ; | |
1465 | Float_t error = h1Cont / h2Cont * TMath::Sqrt(h1RelErr*h2RelErr + h1RelErr*h2RelErr); | |
1466 | ||
1467 | hRatio->SetBinContent(bin, ratio); | |
1468 | hRatio->SetBinError(bin, error); | |
1469 | } | |
1470 | ||
1471 | return; | |
1472 | } | |
1473 | ||
1474 | //####################################################################### | |
1475 | void FillRatioHistogramsPt( TH1F* hN, TH1F* hF, TH1F* hRatio ) { | |
1476 | ||
1477 | Int_t trgIdx = 0; | |
1478 | ||
1479 | for ( Int_t idx = 2; idx < fgkNTrigger+2 ; ++idx ){ | |
1480 | ||
1481 | Int_t nbin = hRatio->FindBin(fgkTriggerPt[trgIdx]); | |
1482 | ++trgIdx; | |
1483 | ||
1484 | Float_t h1Cont = hF->GetBinContent(idx); | |
1485 | Float_t h2Cont = hN->GetBinContent(idx); | |
1486 | ||
1487 | if ( h2Cont <= 0. || h1Cont <= 0. ) continue; | |
1488 | ||
1489 | Float_t h1RelErr = hF->GetBinError(idx) / h1Cont; | |
1490 | Float_t h2RelErr = hN->GetBinError(idx) / h2Cont; | |
1491 | ||
1492 | Float_t ratio = (h2Cont - h1Cont) / h2Cont ; | |
1493 | Float_t error = h1Cont / h2Cont * TMath::Sqrt(h1RelErr*h2RelErr + h1RelErr*h2RelErr); | |
1494 | ||
1495 | hRatio->SetBinContent(nbin, ratio); | |
1496 | hRatio->SetBinError(nbin, error); | |
1497 | } | |
1498 | ||
1499 | return; | |
1500 | } | |
1501 | ||
1502 | // ---------------------------------------------------------------------- | |
1503 | // -- Draw Functions -- | |
1504 | // ---------------------------------------------------------------------- | |
1505 | ||
1506 | //####################################################################### | |
1507 | void DrawHistogramTrigger( TCanvas* canvas, Int_t idx, TH1* hist, Int_t iLayer, Bool_t bLogY) { | |
1508 | // see header file for class documentation | |
1509 | ||
1510 | if ( hist == NULL ) | |
1511 | return; | |
1512 | ||
1513 | TVirtualPad* pad = canvas->cd(idx); | |
1514 | ||
1515 | if ( bLogY && hist->GetEntries() != 0 ) | |
1516 | pad->SetLogy(); | |
1517 | ||
1518 | pad->SetGridy(); | |
1519 | pad->SetGridx(); | |
1520 | ||
1521 | switch(iLayer) { | |
1522 | case 0 : | |
1523 | hist->SetLineColor(kBlack); | |
1524 | hist->SetMarkerStyle(20); | |
1525 | hist->SetMarkerColor(kBlack); | |
1526 | break;; | |
1527 | case 1 : | |
1528 | hist->SetLineColor(kBlack-6); | |
1529 | hist->SetMarkerStyle(24); | |
1530 | hist->SetMarkerColor(kBlack-6); | |
1531 | break;; | |
1532 | case 2 : | |
1533 | hist->SetLineColor(kBlue); | |
1534 | hist->SetMarkerStyle(21); | |
1535 | hist->SetMarkerColor(kBlue); | |
1536 | break;; | |
1537 | case 3 : | |
1538 | hist->SetLineColor(kBlue-6); | |
1539 | hist->SetMarkerStyle(25); | |
1540 | hist->SetMarkerColor(kBlue-6); | |
1541 | break;; | |
1542 | case 4 : | |
1543 | hist->SetLineColor(kGreen); | |
1544 | hist->SetMarkerStyle(22); | |
1545 | hist->SetMarkerColor(kGreen); | |
1546 | break;; | |
1547 | case 5 : | |
1548 | hist->SetLineColor(kGreen-6); | |
1549 | hist->SetMarkerStyle(26); | |
1550 | hist->SetMarkerColor(kGreen-6); | |
1551 | break;; | |
1552 | } | |
1553 | ||
1554 | hist->SetStats(kFALSE); | |
1555 | ||
1556 | if ( !iLayer ) | |
1557 | hist->Draw("E"); | |
1558 | else | |
1559 | hist->Draw("E,SAME"); | |
1560 | ||
1561 | return; | |
1562 | } | |
1563 | ||
1564 | //####################################################################### | |
1565 | void DrawHistogram( TCanvas* canvas, Int_t idx, TH1* hist, Int_t iLayer, | |
1566 | Bool_t bScale, Bool_t bLogY, Bool_t bLogX) { | |
1567 | // Draw histogram and set pad properties | |
1568 | ||
1569 | if ( hist == NULL ) | |
1570 | return; | |
1571 | ||
1572 | TVirtualPad* pad = canvas->cd(idx); | |
1573 | ||
1574 | if ( bScale ) | |
1575 | hist->Scale( 1./hist->GetBinWidth(0) ); | |
1576 | ||
1577 | if ( bLogY && hist->GetEntries() != 0 ) | |
1578 | pad->SetLogy(); | |
1579 | ||
1580 | if ( bLogX && hist->GetEntries() != 0 ) | |
1581 | pad->SetLogx(); | |
1582 | ||
1583 | pad->SetGridy(); | |
1584 | pad->SetGridx(); | |
1585 | ||
1586 | if ( !strcmp(canvas->GetName(),"cEvCuts") || !strcmp(canvas->GetName(),"cEvCuts2") ) { | |
1587 | switch(iLayer) { | |
1588 | case 0 : hist->SetLineColor(kRed); break;; | |
1589 | case 1 : hist->SetLineColor(kBlue); break;; | |
1590 | case 2 : hist->SetLineColor(kBlack); break;; | |
1591 | case 3 : hist->SetLineColor(kBlack); break;; | |
1592 | } | |
1593 | } | |
1594 | else if ( !strcmp(canvas->GetName(),"cTrCuts") || !strcmp(canvas->GetName(),"cTrCuts2") ) { | |
1595 | switch(iLayer) { | |
1596 | case 0 : hist->SetLineColor(kBlack); break;; | |
1597 | case 1 : hist->SetLineColor(kBlue); break;; | |
1598 | case 2 : hist->SetLineColor(kGreen); break;; | |
1599 | case 3 : hist->SetLineColor(kRed); break;; | |
1600 | case 4 : hist->SetLineColor(kBlue-6); break;; | |
1601 | case 5 : hist->SetLineColor(kGreen-6); break;; | |
1602 | case 6 : hist->SetLineColor(kRed-6); break;; | |
1603 | } | |
1604 | ||
1605 | } | |
1606 | else { | |
1607 | switch(iLayer) { | |
1608 | case 0 : hist->SetLineColor(kBlack); break;; | |
1609 | case 1 : hist->SetLineColor(kBlue); break;; | |
1610 | case 2 : hist->SetLineColor(kGreen); break;; | |
1611 | case 3 : hist->SetLineColor(kRed); break;; | |
1612 | case 4 : hist->SetLineColor(kOrange); break;; | |
1613 | case 5 : hist->SetLineColor(kBlue-6); break;; | |
1614 | case 6 : hist->SetLineColor(kGreen-6); break;; | |
1615 | case 7 : hist->SetLineColor(kRed-6); break;; | |
1616 | } | |
1617 | } | |
1618 | ||
1619 | hist->SetStats(kFALSE); | |
1620 | ||
1621 | if ( !iLayer ) | |
1622 | hist->Draw("E"); | |
1623 | else | |
1624 | hist->Draw("E,SAME"); | |
1625 | ||
1626 | return; | |
1627 | } |