]>
Commit | Line | Data |
---|---|---|
948b38b2 | 1 | /******************************************************************* |
2 | Macro to plot few selected histograms | |
3 | to QA data productions at 0th order | |
4 | Analysis performed with the wagon | |
5 | AddTaskPi0IMGammaCorrQA.C | |
6 | It generates 5 eps plots, each containing 2 to 4 canvases | |
7 | ||
8 | To execute: | |
9 | root -q -b -l DrawAnaCaloTrackQA.C'("Pi0IM_GammaTrackCorr_EMCAL_default","AnalysisResults.root", "eps", 0, "output.root")' | |
10 | ||
11 | The input list name might change depending on the wagon / data type | |
12 | In case output file is too large, possiblity to dump the list content in a sepate file: export = kTRUE | |
13 | ||
14 | Author: Gustavo.Conesa.Balbastre@cern.ch | |
15 | ||
16 | Few Modifications are done by sjena to | |
17 | -- include it in automatic process script | |
18 | -- save objects into file | |
19 | -- dynamically picking the listName | |
20 | ||
21 | *******************************************************************/ | |
22 | ||
23 | ||
24 | // Some global variables | |
25 | TList *list = 0; | |
26 | TFile *file = 0; | |
27 | TString histoTag = ""; | |
28 | Int_t color[]={kBlack,kRed,kOrange+1,kYellow+1,kGreen+2,kBlue,kCyan+1,kViolet,kMagenta+2,kGray}; | |
29 | TString suffix = "eps"; | |
30 | ||
31 | TFile *fout; | |
32 | ||
33 | //_______________________________________________________________________ | |
34 | void processDrawAnaCaloTrackQA(TString listName = "Pi0IM_GammaTrackCorr_EMCAL_defaultCen0_100", | |
35 | TString fileName = "AnalysisResults.root", | |
36 | TString suf = "eps", | |
37 | Bool_t export = kFALSE, | |
38 | const char * outfile = "DrawAnaCaloTrackQA_output.root") { | |
39 | ||
40 | suffix = suf; | |
41 | ||
42 | printf("Open <%s>; Get List : <%s>; Export list? <%d>\n",fileName.Data(),listName.Data(),export); | |
43 | ||
44 | histoTag = listName; | |
45 | ||
46 | cout << histoTag.Data() << endl; | |
47 | ||
48 | //Access the file and list of histograms, global variables | |
49 | Bool_t isOk = GetFileAndList(fileName, listName, export); | |
50 | ||
51 | ||
52 | cout << histoTag.Data() << endl; | |
53 | ||
54 | if(!isOk) { | |
55 | Printf("FATAL: Check file or Input List"); | |
56 | return; | |
57 | } | |
58 | ||
59 | ||
60 | gStyle->SetOptTitle(1); | |
61 | gStyle->SetOptStat(0); | |
62 | gStyle->SetOptFit(000000); | |
63 | gStyle->SetPadRightMargin(0.15); | |
64 | //gStyle->SetPadTopMargin(0.02); | |
65 | //gStyle->SetPadLeftMargin(0.15); | |
66 | gStyle->SetTitleFontSize(0.06); | |
67 | ||
68 | // Added by sjena | |
69 | fout = TFile::Open(outfile,"UPDATE"); | |
70 | fout->ls(); | |
71 | ||
72 | TDirectoryFile *cdd = NULL; | |
73 | cdd = (TDirectoryFile*)fout->Get("GA"); | |
74 | if(!cdd) { | |
75 | Printf("Warning: GA <dir> doesn't exist, creating a new one"); | |
76 | cdd = (TDirectoryFile*)fout->mkdir("GA"); | |
77 | } | |
78 | cdd->cd(); | |
79 | cdd->ls(); | |
80 | ||
81 | ||
82 | ||
83 | //Plot basic Calorimeter QA | |
84 | CaloQA(); | |
85 | ||
86 | //Plot basic Track QA | |
87 | TrackQA(); | |
88 | ||
89 | //Plot basic Pi0 QA | |
90 | Pi0QA(); | |
91 | ||
92 | //Plot basic correlation QA | |
93 | CorrelationQA(); | |
94 | ||
95 | // MC basic QA plots, cluster origins (only if it run on MC) | |
96 | MCQA(); | |
97 | ||
98 | fout->cd(); | |
99 | fout->Close(); | |
100 | ||
101 | } | |
102 | ||
103 | //___________ | |
104 | void CaloQA() | |
105 | { | |
106 | // Basic calorimeter QA histograms | |
107 | ||
108 | TCanvas * ccalo = new TCanvas(Form("CaloHisto_%s",histoTag.Data()),"",1000,1000); | |
109 | ccalo->Divide(2,2); | |
110 | ||
111 | ccalo->cd(1); | |
112 | gPad->SetLogy(); | |
113 | ||
114 | TH1F* hCellAmplitude = (TH1F*) GetHisto("QA_hAmplitude"); | |
115 | TH1F* hClusterEnergy = (TH1F*) GetHisto("QA_hE"); | |
116 | ||
117 | hClusterEnergy->SetYTitle("entries"); | |
118 | hClusterEnergy->SetTitle("Cluster-cell energy spectra"); | |
119 | hClusterEnergy->Sumw2(); | |
120 | hClusterEnergy->SetMarkerColor(1); | |
121 | hClusterEnergy->SetMarkerStyle(20); | |
122 | hClusterEnergy->SetAxisRange(0.,50.,"X"); | |
123 | hClusterEnergy->Draw(); | |
124 | // SaveHisto(hClusterEnergy); | |
125 | ||
126 | ||
127 | hCellAmplitude->Sumw2(); | |
128 | hCellAmplitude->SetMarkerColor(4); | |
129 | hCellAmplitude->SetMarkerStyle(25); | |
130 | hCellAmplitude->Draw("same"); | |
131 | // SaveHisto(hCellAmplitude); | |
132 | ||
133 | ||
134 | ||
135 | ||
136 | TLegend l(0.25,0.7,0.83,0.85); | |
137 | l.SetTextSize(0.04); | |
138 | l.AddEntry(hClusterEnergy,"Cluster (no exotic+non lin.)","P"); | |
139 | l.AddEntry(hCellAmplitude,"Cell","P"); | |
140 | l.SetBorderSize(0); | |
141 | l.SetFillColor(0); | |
142 | l.Draw(); | |
143 | ||
144 | ||
145 | ccalo->cd(2); | |
146 | //gPad->SetLogy(); | |
147 | ||
148 | TH1F* hRaw = (TH1F*) GetHisto("AnaPhoton_hCut_0_Open"); | |
149 | TH1F* hCorr = (TH1F*) GetHisto("AnaPhoton_hCut_4_NCells"); | |
150 | TH1F* hTM = (TH1F*) GetHisto("AnaPhoton_hCut_7_Matching"); | |
151 | TH1F* hShSh = (TH1F*) GetHisto("AnaPhoton_hCut_9_PID"); | |
152 | ||
153 | hRaw->Sumw2(); | |
154 | ||
155 | hCorr->SetTitle("Ratio after cluster cuts application"); | |
156 | hCorr->SetYTitle("Selected clusters / Raw clusters"); | |
157 | hCorr->SetTitleOffset(1.5,"Y"); | |
158 | hCorr->Sumw2(); | |
159 | hCorr->SetMarkerColor(1); | |
160 | hCorr->SetMarkerStyle(20); | |
161 | hCorr->Divide(hRaw); | |
162 | hCorr->SetAxisRange(0.,30.,"X"); | |
163 | hCorr->SetMaximum(1.1); | |
164 | hCorr->SetMinimum(0); | |
165 | hCorr->Draw(); | |
166 | // SaveHisto(hCorr); | |
167 | ||
168 | hTM ->Sumw2(); | |
169 | hTM ->SetMarkerColor(2); | |
170 | hTM ->SetMarkerStyle(21); | |
171 | hTM ->Divide(hRaw); | |
172 | hTM ->Draw("same"); | |
173 | // SaveHisto(hTM); | |
174 | ||
175 | ||
176 | hShSh->Sumw2(); | |
177 | hShSh->SetMarkerColor(4); | |
178 | hShSh->SetMarkerStyle(22); | |
179 | hShSh->Divide(hRaw); | |
180 | hShSh->Draw("same"); | |
181 | // SaveHisto(hShSh); | |
182 | ||
183 | ||
184 | TLegend l2(0.45,0.8,0.95,0.93); | |
185 | l2.SetTextSize(0.04); | |
186 | l2.AddEntry(hCorr,"No Exotics + non lin.","P"); | |
187 | l2.AddEntry(hTM, "+ Track matching","P"); | |
188 | l2.AddEntry(hShSh,"+ #lambda^{2}_{0} < 0.4","P"); | |
189 | l2.SetBorderSize(0); | |
190 | l2.SetFillColor(0); | |
191 | l2.Draw(); | |
192 | ||
193 | ||
194 | // Plot track-matching residuals | |
195 | // first test did not have this histogram, add protection | |
196 | TH2F* hTrackMatchResEtaPhi = (TH2F*) GetHisto("QA_hTrackMatchedDEtaDPhi"); | |
197 | if(hTrackMatchResEtaPhi) | |
198 | { | |
199 | ccalo->cd(3); | |
200 | gPad->SetLogz(); | |
201 | ||
202 | hTrackMatchResEtaPhi->SetAxisRange(-0.025,0.025,"X"); | |
203 | hTrackMatchResEtaPhi->SetAxisRange(-0.025,0.025,"Y"); | |
204 | hTrackMatchResEtaPhi->SetTitleOffset(1.5,"Y"); | |
205 | hTrackMatchResEtaPhi->SetTitle("Track-cluster residual #Delta #phi vs #Delta #eta, E > 0.5 GeV"); | |
206 | hTrackMatchResEtaPhi->SetXTitle("#Delta #eta"); | |
207 | hTrackMatchResEtaPhi->SetYTitle("#Delta #phi"); | |
208 | hTrackMatchResEtaPhi->SetZTitle("entries"); | |
209 | hTrackMatchResEtaPhi->Draw("colz"); | |
210 | // SaveHisto(hTrackMatchResEtaPhi); | |
211 | ||
212 | ccalo->cd(4); | |
213 | gPad->SetLogy(); | |
214 | ||
215 | TH2F* h2TrackMatchResEtaNeg = (TH2F*) GetHisto("QA_hTrackMatchedDEta"); | |
216 | TH2F* h2TrackMatchResEtaPos = (TH2F*) GetHisto("QA_hTrackMatchedDEtaPos"); | |
217 | TH2F* h2TrackMatchResPhiNeg = (TH2F*) GetHisto("QA_hTrackMatchedDPhi"); | |
218 | TH2F* h2TrackMatchResPhiPos = (TH2F*) GetHisto("QA_hTrackMatchedDPhiPos"); | |
219 | ||
220 | h2TrackMatchResEtaNeg->Add(h2TrackMatchResEtaPos,-1); | |
221 | h2TrackMatchResPhiNeg->Add(h2TrackMatchResPhiPos,-1); | |
222 | ||
223 | Float_t binMin = hCorr->FindBin(0.5); | |
224 | TH1F* hTrackMatchResEtaNeg = (TH1F*) h2TrackMatchResEtaNeg->ProjectionY("TMProjEtaNeg",binMin, 1000); | |
225 | TH1F* hTrackMatchResEtaPos = (TH1F*) h2TrackMatchResEtaPos->ProjectionY("TMProjEtaPos",binMin, 1000); | |
226 | TH1F* hTrackMatchResPhiNeg = (TH1F*) h2TrackMatchResPhiNeg->ProjectionY("TMProjPhiNeg",binMin, 1000); | |
227 | TH1F* hTrackMatchResPhiPos = (TH1F*) h2TrackMatchResPhiPos->ProjectionY("TMProjPhiPos",binMin, 1000); | |
228 | ||
229 | hTrackMatchResEtaNeg->SetXTitle("#Delta #eta, #Delta #phi"); | |
230 | hTrackMatchResEtaNeg->SetYTitle("entries"); | |
231 | hTrackMatchResEtaNeg->SetTitle("Track-cluster residuals, E > 1 GeV"); | |
232 | hTrackMatchResEtaNeg->SetAxisRange(-0.05,0.05,"X"); | |
233 | hTrackMatchResEtaNeg->Sumw2(); | |
234 | hTrackMatchResEtaNeg->SetMarkerStyle(25); | |
235 | hTrackMatchResEtaNeg->SetMarkerColor(2); | |
236 | hTrackMatchResEtaNeg->Draw(""); | |
237 | ||
238 | hTrackMatchResEtaPos->Sumw2(); | |
239 | hTrackMatchResEtaPos->SetMarkerStyle(25); | |
240 | hTrackMatchResEtaPos->SetMarkerColor(4); | |
241 | hTrackMatchResEtaPos->Draw("same"); | |
242 | ||
243 | hTrackMatchResPhiNeg->Sumw2(); | |
244 | hTrackMatchResPhiNeg->SetMarkerStyle(24); | |
245 | hTrackMatchResPhiNeg->SetMarkerColor(2); | |
246 | hTrackMatchResPhiNeg->Draw("same"); | |
247 | ||
248 | hTrackMatchResPhiPos->Sumw2(); | |
249 | hTrackMatchResPhiPos->SetMarkerStyle(24); | |
250 | hTrackMatchResPhiPos->SetMarkerColor(4); | |
251 | hTrackMatchResPhiPos->Draw("same"); | |
252 | ||
253 | TLine l0(0,hTrackMatchResEtaNeg->GetMinimum(),0,hTrackMatchResEtaNeg->GetMaximum()*1.2); | |
254 | l0.Draw("same"); | |
255 | ||
256 | TLegend l3(0.55,0.7,0.83,0.85); | |
257 | l3.SetTextSize(0.04); | |
258 | l3.AddEntry(hTrackMatchResEtaNeg,"#Delta #eta, Negative","P"); | |
259 | l3.AddEntry(hTrackMatchResEtaPos,"#Delta #eta, Positive","P"); | |
260 | l3.AddEntry(hTrackMatchResPhiNeg,"#Delta #phi, Negative","P"); | |
261 | l3.AddEntry(hTrackMatchResPhiPos,"#Delta #phi, Positive","P"); | |
262 | l3.SetBorderSize(0); | |
263 | l3.SetFillColor(0); | |
264 | l3.Draw(); | |
265 | } | |
266 | ccalo->SaveAs(Form("fig_ga_%s_CaloHisto.%s",histoTag.Data(),suffix.Data())); | |
267 | ||
268 | ||
269 | ||
270 | TCanvas * ccalo2 = new TCanvas(Form("CaloHisto2_%s",histoTag.Data()),"",500,500); | |
271 | ccalo2->Divide(2,2); | |
272 | ||
273 | ccalo2->cd(3); | |
274 | // gPad->SetLogz(); | |
275 | // TH2F* hCellAmpId = (TH2F*) GetHisto("QA_hAmpId"); | |
276 | // hCellAmpId->SetTitle("Cell Id vs energy"); | |
277 | // hCellAmpId->SetYTitle("Cell Id"); | |
278 | // //hCellAmpId->SetAxisRange(300.,900.,"Y"); | |
279 | // hCellAmpId->SetAxisRange(0.,30.,"X"); | |
280 | // hCellAmpId->SetTitleOffset(1.5,"Y"); | |
281 | // hCellAmpId->Draw("colz"); | |
282 | ||
283 | gPad->SetLogz(); | |
284 | ||
285 | TH2F* hClusterTime = (TH2F*) GetHisto("QA_hClusterTimeEnergy"); | |
286 | hClusterTime->SetTitle("Cluster energy vs time"); | |
287 | hClusterTime->SetYTitle("time (ns)"); | |
288 | hClusterTime->SetAxisRange(300.,900.,"Y"); | |
289 | hClusterTime->SetAxisRange(0.,30.,"X"); | |
290 | hClusterTime->SetTitleOffset(1.5,"Y"); | |
291 | hClusterTime->Draw("colz"); | |
292 | ||
293 | ccalo2->cd(1); | |
294 | ||
295 | TH2F* hCellActivity = (TH2F*) GetHisto("QA_hGridCells"); | |
296 | hCellActivity->SetTitle("Hits per cell (E > 0.2 GeV)"); | |
297 | hCellActivity->SetTitleOffset(1.5,"Y"); | |
298 | hCellActivity->Draw("colz"); | |
299 | ||
300 | ccalo2->cd(2); | |
301 | ||
302 | TH2F* hCellActivity = (TH2F*) GetHisto("QA_hGridCells"); | |
303 | TH2F* hCellActivityE = (TH2F*) GetHisto("QA_hGridCellsE"); | |
304 | hCellActivityE->SetTitle("Mean energy per cell (E > 0.2 GeV)"); | |
305 | hCellActivityE->Divide(hCellActivity); | |
306 | hCellActivityE->SetTitleOffset(1.5,"Y"); | |
307 | hCellActivityE->Draw("colz"); | |
308 | ||
309 | ccalo2->cd(4); | |
310 | //gPad->SetLogz(); | |
311 | TH2F* hClusterActivity = (TH2F*) GetHisto("AnaPhoton_hEtaPhi"); | |
312 | hClusterActivity->SetTitle("Clusters activity (E > 0.5 GeV)"); | |
313 | hClusterActivity->SetTitleOffset(1.5,"Y"); | |
314 | hClusterActivity->Draw("colz"); | |
315 | ||
316 | ccalo2->SaveAs(Form("fig_ga_%s_CaloHisto2.%s",histoTag.Data(), suffix.Data())); | |
317 | ||
318 | ||
319 | } | |
320 | ||
321 | //____________ | |
322 | void TrackQA() | |
323 | { | |
324 | // Basic hybrid tracks histograms | |
325 | ||
326 | TCanvas * ctrack = new TCanvas(Form("TrackHisto_%s",histoTag.Data()),"",1000,500); | |
327 | ctrack->Divide(2,1); | |
328 | ||
329 | ctrack->cd(1); | |
330 | //gPad->SetLogz(); | |
331 | TH2F * hTrackEtaPhi = (TH2F*) GetHisto("AnaHadrons_hEtaPhiNegative"); | |
332 | hTrackEtaPhi ->Add((TH2F*) GetHisto("AnaHadrons_hEtaPhiNegative")); | |
333 | hTrackEtaPhi ->SetAxisRange(-0.9,0.9,"X"); | |
334 | hTrackEtaPhi ->SetTitle("Hybrid tracks #eta vs #phi (p_{T} > 0.2 GeV)"); | |
335 | hTrackEtaPhi ->Draw("colz"); | |
336 | ||
337 | ctrack->cd(2); | |
338 | //gPad->SetLogy(); | |
339 | TH2F * hTrackEtaPhiSPD = (TH2F*) GetHisto("AnaHadrons_hEtaPhiSPDRefitPt02"); | |
340 | TH2F * hTrackEtaPhiNoSPD = (TH2F*) GetHisto("AnaHadrons_hEtaPhiNoSPDRefitPt02"); | |
341 | ||
342 | TH1F* hPhiSPD = (TH1F*)hTrackEtaPhiSPD ->ProjectionY("hTrackPhiSPD" ,0,1000); | |
343 | TH1F* hPhiNoSPD = (TH1F*)hTrackEtaPhiNoSPD->ProjectionY("hTrackPhiNoSPD",0,1000); | |
344 | //TH1F* hPhi = (TH1F*)hTrackEtaPhi ->ProjectionY("hTrackPhi" ,0,1000); | |
345 | TH1F* hPhi = hPhiSPD->Clone("hTrackPhi"); | |
346 | hPhi->Add(hPhiNoSPD); | |
347 | hPhi ->SetTitle("Hybrid track in #phi, composition, p_{T} > 0.2 GeV"); | |
348 | hPhi ->SetLineColor(1); | |
349 | hPhiSPD ->SetLineColor(2); | |
350 | hPhiNoSPD->SetLineColor(4); | |
351 | ||
352 | hPhi ->SetMinimum(1); | |
353 | hPhi ->SetMaximum(hPhi->GetMaximum()*1.2); | |
354 | ||
355 | hPhi ->Draw("H"); | |
356 | hPhiSPD ->Draw("Hsame"); | |
357 | hPhiNoSPD->Draw("Hsame"); | |
358 | ||
359 | TLegend l(0.2,0.75,0.4,0.89); | |
360 | l.SetTextSize(0.04); | |
361 | l.AddEntry(hPhi,"Sum","L"); | |
362 | l.AddEntry(hPhiSPD ,"SPD+Refit","L"); | |
363 | l.AddEntry(hPhiNoSPD,"No SPD+Refit","L"); | |
364 | l.SetBorderSize(0); | |
365 | l.SetFillColor(0); | |
366 | l.Draw(); | |
367 | // ctrack->cd(3); | |
368 | // gPad->SetLogz(); | |
369 | // | |
370 | // TH2F* hPtDCAxy = (TH2F*) GetHisto("AnaHadrons_hPtDCAxy"); | |
371 | // hPtDCAxy->SetAxisRange(-1,1,"Y"); | |
372 | // hPtDCAxy->SetAxisRange(0,30,"X"); | |
373 | // hPtDCAxy->Draw("colz"); | |
374 | // | |
375 | // ctrack->cd(4); | |
376 | // gPad->SetLogz(); | |
377 | // | |
378 | // TH2F* hPtDCAz = (TH2F*) GetHisto("AnaHadrons_hPtDCAz"); | |
379 | // hPtDCAz->SetAxisRange(-1,1,"Y"); | |
380 | // hPtDCAz->SetAxisRange(0,30,"X"); | |
381 | // hPtDCAz->Draw("colz"); | |
382 | ||
383 | ctrack->SaveAs(Form("fig_ga_%s_TrackHisto.%s",histoTag.Data(), suffix.Data())); | |
384 | ||
385 | ||
386 | } | |
387 | ||
388 | //__________ | |
389 | void Pi0QA() | |
390 | { | |
391 | // Basic invariant mass QA | |
392 | ||
393 | TCanvas * cpi0 = new TCanvas(Form("Pi0Histo_%s",histoTag.Data()),"",500,500); | |
394 | cpi0->Divide(2,2); | |
395 | ||
396 | TH2F* hMassE[10]; | |
397 | TH2F* hMixMassE[10]; | |
398 | for(Int_t icen = 0; icen < 10; icen++) | |
399 | { | |
400 | hMassE [icen] = (TH2F*) GetHisto(Form("AnaPi0_hRe_cen%d_pidbit0_asy1_dist1",icen)); | |
401 | hMixMassE[icen] = (TH2F*) GetHisto(Form("AnaPi0_hMi_cen%d_pidbit0_asy1_dist1",icen)); | |
402 | } | |
403 | ||
404 | // 2D Invariant mass vs E, in PbPb from 60 to 100 %, all in pp | |
405 | cpi0->cd(1); | |
406 | gPad->SetLogz(); | |
407 | TH2F* h2DMass; | |
408 | ||
409 | if(hMassE[1]) // Plot centrality from 60 to 100% | |
410 | { | |
411 | h2DMass = (TH2F*) hMassE[6]->Clone("h2DMass"); | |
412 | for(Int_t icen = 7; icen < 10; icen++) h2DMass->Add(hMassE[icen]); | |
413 | h2DMass->SetTitle("Invariant mass vs pair E, Cen: 60-100%"); | |
414 | } | |
415 | else | |
416 | { | |
417 | h2DMass = (TH2F*) hMassE[0]->Clone("hMassProj"); | |
418 | h2DMass->SetTitle("Invariant mass vs cluster pair E"); | |
419 | } | |
420 | ||
421 | h2DMass->SetTitleOffset(1.6,"Y"); | |
422 | h2DMass->SetAxisRange(0.0,0.7,"Y"); | |
423 | h2DMass->SetAxisRange(0,30,"X"); | |
424 | h2DMass->Draw("colz"); | |
425 | ||
426 | // Pi0 Invariant mass projection, in PbPb 6 centrality bins from 0 to 50%, all in pp | |
427 | cpi0->cd(2); | |
428 | TH1F* hMass [10]; | |
429 | TH1F* hMix [10]; | |
430 | TH1F* hMassEta[10]; | |
431 | TH1F* hMassPi0[10]; | |
432 | ||
433 | //Init to 0 | |
434 | for(Int_t icen=0; icen<10; icen++ ) | |
435 | { | |
436 | hMass [icen] = 0; | |
437 | hMix [icen] = 0; | |
438 | hMassEta[icen] = 0; | |
439 | hMassPi0[icen] = 0; | |
440 | } | |
441 | ||
442 | TH1F * hX = (TH1F*) hMassE[0]->ProjectionX("hEPairCen0",0,10000); | |
443 | Int_t binmin = hX->FindBin(2); // Project histo from 2 GeV pairs | |
444 | Int_t binmax = hX->FindBin(10); // Project histo up to 10 GeV pairs | |
445 | Float_t maxPi0 = 0; | |
446 | Float_t maxEta = 0; | |
447 | for(Int_t icen = 0; icen < 6; icen++) | |
448 | { | |
449 | if(!hMassE[icen]) continue; | |
450 | ||
451 | hMass[icen] = (TH1F*) hMassE [icen]->ProjectionY(Form("hMassCen%d",icen),binmin,binmax); | |
452 | hMix [icen] = (TH1F*) hMixMassE[icen]->ProjectionY(Form("hMixCen%d" ,icen),binmin,binmax); | |
453 | hMass[icen]->Sumw2(); | |
454 | hMix [icen]->Sumw2(); | |
455 | ||
456 | hMassPi0[icen] = (TH1F*) hMass[icen]->Clone(Form("hMassPi0Cen%d",icen)); | |
457 | hMassEta[icen] = (TH1F*) hMass[icen]->Clone(Form("hMassEtaCen%d",icen)); | |
458 | ||
459 | hMassPi0[icen]->Divide(hMix[icen]); | |
460 | hMassPi0[icen]->Fit("pol0","Q","",0.25,0.35); | |
461 | Float_t scale = 1; | |
462 | if(hMassPi0[icen]->GetFunction("pol0")) scale = hMassPi0[icen]->GetFunction("pol0")->GetParameter(0); | |
463 | //printf("Scale factor %f for cen %d\n",scale,icen); | |
464 | hMassPi0[icen]->Scale(1./scale); | |
465 | hMassPi0[icen]->SetMarkerStyle(24); | |
466 | hMassPi0[icen]->SetMarkerColor(color[icen]); | |
467 | hMassPi0[icen]->SetLineColor(color[icen]); | |
468 | hMassPi0[icen]->SetAxisRange(0.04,0.24); | |
469 | hMassPi0[icen]->SetMarkerSize(0.5); | |
470 | ||
471 | hMassEta[icen]->Rebin(4); | |
472 | hMix [icen]->Rebin(4); | |
473 | hMassEta[icen]->Divide(hMix[icen]); | |
474 | hMassEta[icen]->SetMarkerStyle(25); | |
475 | hMassEta[icen]->SetMarkerColor(color[icen]); | |
476 | hMassEta[icen]->SetLineColor(color[icen]); | |
477 | hMassEta[icen]->SetAxisRange(0.4,0.9); | |
478 | hMassEta[icen]->SetMarkerSize(0.5); | |
479 | hMassEta[icen]->Scale(1./scale); | |
480 | ||
481 | if(maxEta < hMassEta[icen]->GetMaximum()) maxEta = hMassEta[icen]->GetMaximum(); | |
482 | if(maxPi0 < hMassPi0[icen]->GetMaximum()) maxPi0 = hMassPi0[icen]->GetMaximum(); | |
483 | } | |
484 | ||
485 | //gPad->SetLogy(); | |
486 | //gPad->SetGridy(); | |
487 | hMassPi0[0]->SetMinimum(0.8); | |
488 | hMassPi0[0]->SetTitleOffset(1.6,"Y"); | |
489 | hMassPi0[0]->SetYTitle("Real / Mixed"); | |
490 | hMassPi0[0]->SetTitle("#pi^{0} peak, 2 < E_{pair}< 10 GeV"); | |
491 | hMassPi0[0]->Draw(); | |
492 | ||
493 | if(hMass[1]) // PbPb | |
494 | { | |
495 | hMassPi0[0]->SetMaximum(maxPi0*1.2); | |
496 | hMassPi0[5]->Draw("Hsame"); | |
497 | hMassPi0[4]->Draw("Hsame"); | |
498 | hMassPi0[3]->Draw("Hsame"); | |
499 | hMassPi0[2]->Draw("Hsame"); | |
500 | hMassPi0[1]->Draw("Hsame"); | |
501 | hMassPi0[0]->Draw("Hsame"); | |
502 | //hMass[6]->Draw("Hsame"); | |
503 | //hMass[7]->Draw("same"); | |
504 | //hMass[8]->Draw("same"); | |
505 | //hMass[9]->Draw("same"); | |
506 | ||
507 | TLegend l(0.12,0.6,0.4,0.85); | |
508 | l.SetTextSize(0.04); | |
509 | l.AddEntry(hMassPi0[0],"0-10%","P"); | |
510 | l.AddEntry(hMassPi0[1],"10-20%","P"); | |
511 | l.AddEntry(hMassPi0[2],"20-30%","P"); | |
512 | l.AddEntry(hMassPi0[3],"30-40%","P"); | |
513 | l.AddEntry(hMassPi0[4],"40-70%","P"); | |
514 | l.AddEntry(hMassPi0[5],"50-60%","P"); | |
515 | l.SetBorderSize(0); | |
516 | l.SetFillColor(0); | |
517 | l.Draw(); | |
518 | } | |
519 | ||
520 | TLine l1(0.04,1,0.24,1); | |
521 | l1.Draw("same"); | |
522 | ||
523 | // Pi0 invariant mass per EMCal super module | |
524 | cpi0->cd(3); | |
525 | ||
526 | TH1F* hSM [10]; | |
527 | TH1F* hMixSM[10]; | |
528 | binmin = hX->FindBin(4); // Project histo from 3 GeV pairs | |
529 | binmax = hX->FindBin(20); // Project histo up to 20 GeV pairs | |
530 | Float_t maxSM = 0; | |
531 | ||
532 | for(Int_t ism = 0; ism < 10; ism++) | |
533 | { | |
534 | TH2F* hTmpSM = (TH2F*) GetHisto(Form("AnaPi0_hReMod_%d",ism)); | |
535 | if(!hTmpSM) hTmpSM = (TH2F*) GetHisto(Form("QA_hIM_Mod%d",ism)); | |
536 | ||
537 | hSM[ism] = (TH1F*) hTmpSM->ProjectionY(Form("hMassSM%d",ism),binmin,binmax); | |
538 | hSM[ism]->Sumw2(); | |
539 | hSM[ism]->SetMarkerStyle(26); | |
540 | hSM[ism]->Rebin(2); | |
541 | //hSM[ism]->Scale(1./hSM[ism]->Integral(0,10000)); | |
542 | hSM[ism]->SetMarkerColor(color[ism]); | |
543 | hSM[ism]->SetLineColor(color[ism]); | |
544 | hSM[ism]->SetMarkerSize(0.5); | |
545 | ||
546 | TH2F* hTmpMixSM = (TH2F*) GetHisto(Form("AnaPi0_hMiMod_%d",ism)); | |
547 | if(hTmpMixSM) | |
548 | { | |
549 | hMixSM[ism] = (TH1F*) hTmpMixSM->ProjectionY(Form("hMassMixSM%d",ism),binmin,binmax); | |
550 | hMixSM[ism]->Sumw2(); | |
551 | hMixSM[ism]->Rebin(2); | |
552 | hSM[ism]->Divide(hMixSM[ism]); | |
553 | hSM[ism]->Fit("pol0","Q","",0.25,0.35); | |
554 | Float_t scale = 1; | |
555 | if(hSM[ism]->GetFunction("pol0")) scale = hSM[ism]->GetFunction("pol0")->GetParameter(0); | |
556 | //printf("Scale factor %f for cen %d\n",scale,icen); | |
557 | hSM[ism]->Scale(1./scale); | |
558 | hSM[ism]->SetYTitle("Real / Mixed"); | |
559 | ||
560 | } | |
561 | ||
562 | if(maxSM < hSM[ism]->GetMaximum()) maxSM = hSM[ism]->GetMaximum(); | |
563 | ||
564 | } | |
565 | ||
566 | hSM[0]->SetTitle("#pi^{0} peak in Modules, 4 < E_{pair}< 10 GeV"); | |
567 | hSM[0]->SetTitleOffset(1.6,"Y"); | |
568 | hSM[0]->SetAxisRange(0.04,0.24); | |
569 | hSM[0]->SetMaximum(maxSM*1.2); | |
570 | hSM[0]->SetMinimum(0.8); | |
571 | ||
572 | hSM[0]->Draw("H"); | |
573 | TLegend lsm(0.12,0.5,0.35,0.85); | |
574 | lsm.SetTextSize(0.04); | |
575 | lsm.AddEntry(hSM[0],Form("Mod %d",0),"P"); | |
576 | ||
577 | for(Int_t ism = 1; ism < 10; ism++) | |
578 | { | |
579 | hSM[ism]->Draw("Hsame"); | |
580 | lsm.AddEntry(hSM[ism],Form("Mod %d",ism),"P"); | |
581 | } | |
582 | ||
583 | lsm.SetBorderSize(0); | |
584 | lsm.SetFillColor(0); | |
585 | lsm.Draw(); | |
586 | ||
587 | l1.Draw("same"); | |
588 | ||
589 | // Pi0 Invariant mass projection, in PbPb 6 centrality bins from 0 to 50%, all in pp | |
590 | cpi0->cd(4); | |
591 | ||
592 | //gPad->SetLogy(); | |
593 | //gPad->SetGridy(); | |
594 | hMassEta[0]->SetMinimum(0.8); | |
595 | hMassEta[0]->SetTitleOffset(1.6,"Y"); | |
596 | hMassEta[0]->SetYTitle("Real / Mixed"); | |
597 | hMassEta[0]->SetTitle("#eta peak, 2 < E_{pair}< 10 GeV"); | |
598 | hMassEta[0]->Draw("H"); | |
599 | ||
600 | if(hMass[1]) // PbPb | |
601 | { | |
602 | hMassEta[0]->SetMaximum(maxEta*1.2); | |
603 | hMassEta[5]->Draw("Hsame"); | |
604 | hMassEta[4]->Draw("Hsame"); | |
605 | hMassEta[3]->Draw("Hsame"); | |
606 | hMassEta[2]->Draw("Hsame"); | |
607 | hMassEta[1]->Draw("Hsame"); | |
608 | hMassEta[0]->Draw("Hsame"); | |
609 | ||
610 | ||
611 | TLegend l2(0.12,0.6,0.4,0.85); | |
612 | l2.SetTextSize(0.04); | |
613 | l2.AddEntry(hMassEta[0],"0-10%","P"); | |
614 | l2.AddEntry(hMassEta[1],"10-20%","P"); | |
615 | l2.AddEntry(hMassEta[2],"20-30%","P"); | |
616 | l2.AddEntry(hMassEta[3],"30-40%","P"); | |
617 | l2.AddEntry(hMassEta[4],"40-70%","P"); | |
618 | l2.AddEntry(hMassEta[5],"50-60%","P"); | |
619 | l2.SetBorderSize(0); | |
620 | l2.SetFillColor(0); | |
621 | l2.Draw(); | |
622 | } | |
623 | ||
624 | cpi0->SaveAs(Form("fig_ga_%s_Pi0Histo.%s",histoTag.Data(),suffix.Data())); | |
625 | ||
626 | ||
627 | } | |
628 | ||
629 | //__________________ | |
630 | void CorrelationQA() | |
631 | { | |
632 | ||
633 | TCanvas * cCorrelation = new TCanvas(Form("CorrelationHisto_%s",histoTag.Data()),"",1000,500); | |
634 | cCorrelation->Divide(2,1); | |
635 | ||
636 | Float_t minClusterE = 8; | |
637 | Float_t assocBins[] = {0.5,2.,5.,10.,20.}; | |
638 | Int_t nAssocBins = 4; | |
639 | ||
640 | TH1F * hLeading = (TH1F*) GetHisto("AnaPhotonHadronCorr_hPtLeading"); | |
641 | Int_t minClusterEBin = hLeading->FindBin(minClusterE); | |
642 | Float_t nTrig = hLeading->Integral(minClusterE,100000); | |
643 | ||
644 | //Azimuthal correlation | |
645 | cCorrelation->cd(1); | |
646 | gPad->SetLogy(); | |
647 | TH1F* hDeltaPhi[4]; | |
648 | ||
649 | TLegend l(0.35,0.6,0.83,0.85); | |
650 | l.SetHeader(Form("p_{T,T} > %2.1f GeV/c",minClusterE)); | |
651 | l.SetTextSize(0.04); | |
652 | l.SetBorderSize(0); | |
653 | l.SetFillColor(0); | |
654 | ||
655 | for(Int_t ibin = 0; ibin < nAssocBins; ibin++ ) | |
656 | { | |
657 | TH2F* hDeltaPhiE = (TH2F*) GetHisto(Form("AnaPhotonHadronCorr_hDeltaPhiPtAssocPt%2.1f_%2.1f",assocBins[ibin],assocBins[ibin+1])); | |
658 | hDeltaPhi[ibin] = (TH1F*) hDeltaPhiE->ProjectionY(Form("DeltaPhi%2.1f",assocBins[ibin]),minClusterEBin,10000); | |
659 | hDeltaPhi[ibin]->Sumw2(); | |
660 | hDeltaPhi[ibin]->Rebin(2); | |
661 | hDeltaPhi[ibin]->Scale(1./nTrig); | |
662 | ||
663 | hDeltaPhi[ibin]->Fit("pol0","Q","",1,2); | |
664 | Float_t scale = 1; | |
665 | if(hDeltaPhi[ibin]->GetFunction("pol0")) | |
666 | { | |
667 | scale = hDeltaPhi[ibin]->GetFunction("pol0")->GetParameter(0); | |
668 | hDeltaPhi[ibin]->GetFunction("pol0")->SetRange(6,7); // move from plot | |
669 | } | |
670 | hDeltaPhi[ibin]->Scale(1./scale); | |
671 | //printf("ibin %d, scale %f\n",ibin,scale); | |
672 | ||
673 | hDeltaPhi[ibin]->SetAxisRange(-1.6,4.7); | |
674 | ||
675 | hDeltaPhi[ibin]->SetMarkerStyle(24); | |
676 | hDeltaPhi[ibin]->SetMarkerColor(color[ibin]); | |
677 | hDeltaPhi[ibin]->SetLineColor(color[ibin]); | |
678 | hDeltaPhi[ibin]->SetTitleOffset(1.5,"Y"); | |
679 | hDeltaPhi[ibin]->SetYTitle("N_{pairs} / N_{trig} / ZYAM"); | |
680 | hDeltaPhi[ibin]->SetTitle("#gamma (#lambda_{0}^{2} < 0.4, neutral cluster) trigger"); | |
681 | ||
682 | l.AddEntry(hDeltaPhi[ibin],Form("%2.1f< p_{T,A}< %2.1f GeV/c",assocBins[ibin],assocBins[ibin+1]),"P"); | |
683 | } | |
684 | ||
685 | ||
686 | hDeltaPhi[2]->SetMaximum(hDeltaPhi[2]->GetMaximum()*10); | |
687 | hDeltaPhi[2]->SetMinimum(0.8); | |
688 | ||
689 | hDeltaPhi[2]->Draw("H"); | |
690 | hDeltaPhi[1]->Draw("Hsame"); | |
691 | hDeltaPhi[3]->Draw("Hsame"); | |
692 | hDeltaPhi[0]->Draw("Hsame"); | |
693 | ||
694 | l.Draw("same"); | |
695 | ||
696 | ||
697 | // xE correlation | |
698 | cCorrelation->cd(2); | |
699 | gPad->SetLogy(); | |
700 | ||
701 | TLegend l2(0.35,0.6,0.83,0.85); | |
702 | l2.SetHeader(Form("p_{T,T} > %2.1f GeV/c",minClusterE)); | |
703 | l2.SetTextSize(0.04); | |
704 | l2.SetBorderSize(0); | |
705 | l2.SetFillColor(0); | |
706 | ||
707 | TH2F* hEXE = (TH2F*) GetHisto("AnaPhotonHadronCorr_hXECharged"); | |
708 | TH2F* hEXEUE = (TH2F*) GetHisto("AnaPhotonHadronCorr_hXEUeCharged"); | |
709 | ||
710 | TH1F* hXE = (TH1F*) hEXE->ProjectionY(Form("XE%2.1fGeV",minClusterE),minClusterEBin,10000); | |
711 | hXE->Sumw2(); | |
712 | hXE->Rebin(2); | |
713 | hXE->Scale(1./nTrig); | |
714 | hXE->SetAxisRange(0,1); | |
715 | hXE->SetMarkerStyle(24); | |
716 | hXE->SetMarkerColor(1); | |
717 | hXE->SetLineColor(1); | |
718 | hXE->SetTitleOffset(1.5,"Y"); | |
719 | hXE->SetYTitle("N_{pairs} / N_{trig}"); | |
720 | hXE->SetTitle("#gamma (#lambda_{0}^{2} < 0.4, neutral cluster) trigger"); | |
721 | l2.AddEntry(hXE,"raw x_{E}","P"); | |
722 | hXE->Draw(); | |
723 | ||
724 | TH1F* hXEUE = (TH1F*) hEXEUE->ProjectionY(Form("XEUE%2.1fGeV",minClusterE),minClusterEBin,10000); | |
725 | hXEUE->Sumw2(); | |
726 | hXEUE->Rebin(2); | |
727 | hXEUE->Scale(1./nTrig); | |
728 | hXEUE->SetAxisRange(0,1); | |
729 | hXEUE->SetMarkerStyle(25); | |
730 | hXEUE->SetMarkerColor(2); | |
731 | hXEUE->SetLineColor(2); | |
732 | l2.AddEntry(hXEUE,"raw Und. Event x_{E}","P"); | |
733 | hXEUE->Draw("same"); | |
734 | ||
735 | ||
736 | l2.Draw("same"); | |
737 | ||
738 | ||
739 | cCorrelation->SaveAs(Form("fig_ga_%s_CorrelationHisto.%s",histoTag.Data(),suffix.Data())); | |
740 | ||
741 | ||
742 | } | |
743 | ||
744 | //___________ | |
745 | void MCQA() | |
746 | { | |
747 | // Basic calorimeter QA histograms | |
748 | ||
749 | TH2F* h2ClusterPho = (TH2F*) GetHisto("QA_hRecoMCE_Photon_Match0"); // not track-matched | |
750 | TH2F* h2ClusterPi0 = (TH2F*) GetHisto("QA_hRecoMCE_Pi0_Match0"); // not track-matched | |
751 | TH2F* h2ClusterEta = (TH2F*) GetHisto("QA_hRecoMCE_Eta_Match0"); // not track-matched | |
752 | TH2F* h2ClusterEle = (TH2F*) GetHisto("QA_hRecoMCE_Electron_Match1"); // Track-matched | |
753 | ||
754 | if(!h2ClusterPho) return; | |
755 | ||
756 | ||
757 | TH1F* hPrimPho = (TH1F*) GetHisto("QA_hGenMCAccE_Photon"); | |
758 | TH1F* hPrimPi0 = (TH1F*) GetHisto("QA_hGenMCAccE_Pi0"); | |
759 | TH1F* hPrimEta = (TH1F*) GetHisto("QA_hGenMCAccE_Eta"); | |
760 | ||
761 | TCanvas * cmc = new TCanvas(Form("MCHisto_%s",histoTag.Data()),"",1000,1000); | |
762 | cmc->Divide(2,2); | |
763 | ||
764 | cmc->cd(1); | |
765 | gPad->SetLogy(); | |
766 | ||
767 | TH1F* hClusterPho = (TH1F*) h2ClusterPho->ProjectionX("ClusterPho",0,1000); | |
768 | TH1F* hClusterPi0 = (TH1F*) h2ClusterPi0->ProjectionX("ClusterPi0",0,1000); | |
769 | TH1F* hClusterEta = (TH1F*) h2ClusterEta->ProjectionX("ClusterEta",0,1000); | |
770 | ||
771 | hClusterPho->SetTitle("Cluster origin spectra, primary spectra in Calo acceptance"); | |
772 | hClusterPho->Sumw2(); | |
773 | hClusterPho->SetMarkerColor(1); | |
774 | hClusterPho->SetMarkerStyle(20); | |
775 | hClusterPho->SetAxisRange(0.,50.,"X"); | |
776 | hClusterPho->SetXTitle("E_{rec,gen} (GeV)"); | |
777 | hClusterPho->Draw(""); | |
778 | ||
779 | hClusterPi0->Sumw2(); | |
780 | hClusterPi0->SetMarkerColor(4); | |
781 | hClusterPi0->SetMarkerStyle(21); | |
782 | hClusterPi0->Draw("same"); | |
783 | ||
784 | hClusterEta->Sumw2(); | |
785 | hClusterEta->SetMarkerColor(2); | |
786 | hClusterEta->SetMarkerStyle(22); | |
787 | hClusterEta->Draw("same"); | |
788 | ||
789 | hPrimPho->Sumw2(); | |
790 | hPrimPho->SetMarkerColor(1); | |
791 | hPrimPho->SetMarkerStyle(24); | |
792 | hPrimPho->Draw("same"); | |
793 | ||
794 | hPrimPi0->Sumw2(); | |
795 | hPrimPi0->SetMarkerColor(4); | |
796 | hPrimPi0->SetMarkerStyle(25); | |
797 | hPrimPi0->Draw("same"); | |
798 | ||
799 | hPrimEta->Sumw2(); | |
800 | hPrimEta->SetMarkerColor(2); | |
801 | hPrimEta->SetMarkerStyle(26); | |
802 | hPrimEta->Draw("same"); | |
803 | ||
804 | TLegend l(0.45,0.6,0.83,0.89); | |
805 | l.SetTextSize(0.04); | |
806 | l.AddEntry(hClusterPho,"#gamma cluster","P"); | |
807 | l.AddEntry(hClusterPi0,"#pi^{0} (merged) cluster","P"); | |
808 | l.AddEntry(hClusterEta,"#eta (merged) cluster","P"); | |
809 | l.AddEntry(hPrimPho,"#gamma generated","P"); | |
810 | l.AddEntry(hPrimPi0,"#pi^{0} generated","P"); | |
811 | l.AddEntry(hPrimEta,"#eta generated","P"); | |
812 | l.SetBorderSize(0); | |
813 | l.SetFillColor(0); | |
814 | l.Draw(); | |
815 | ||
816 | ||
817 | cmc->cd(2); | |
818 | gPad->SetLogy(); | |
819 | TH1F* hRatPho = (TH1F*) hClusterPho->Clone("hGenRecoPho"); | |
820 | TH1F* hRatPi0 = (TH1F*) hClusterPi0->Clone("hGenRecoPi0"); | |
821 | TH1F* hRatEta = (TH1F*) hClusterEta->Clone("hGenRecoEta"); | |
822 | ||
823 | hRatPho->Divide(hPrimPho); | |
824 | hRatPi0->Divide(hPrimPi0); | |
825 | hRatEta->Divide(hPrimEta); | |
826 | ||
827 | hRatPho->SetTitle("Reconstructed cluster / Generated particle in Calo acc."); | |
828 | hRatPho->SetYTitle("Ratio"); | |
829 | hRatPho->SetXTitle("E(GeV)"); | |
830 | hRatPho->SetMinimum(1e-3); | |
831 | hRatPho->SetMaximum(10); | |
832 | hRatPho->Draw(""); | |
833 | hRatPi0->Draw("same"); | |
834 | hRatEta->Draw("same"); | |
835 | ||
836 | TLegend l2(0.15,0.7,0.3,0.85); | |
837 | l2.SetTextSize(0.04); | |
838 | l2.AddEntry(hRatPho,"#gamma","P"); | |
839 | l2.AddEntry(hRatPi0,"#pi^{0}","P"); | |
840 | l2.AddEntry(hRatEta,"#eta","P"); | |
841 | l2.SetBorderSize(0); | |
842 | l2.SetFillColor(0); | |
843 | l2.Draw(); | |
844 | ||
845 | cmc->cd(3); | |
846 | //gPad->SetLogy(); | |
847 | ||
848 | TH2F* h2PrimPhoPhi = (TH2F*) GetHisto("AnaPhoton_hPhiPrim_MCPhoton"); | |
849 | TH2F* h2PrimPi0Phi = (TH2F*) GetHisto("AnaPi0_hPrimPi0Phi"); | |
850 | TH2F* h2PrimEtaPhi = (TH2F*) GetHisto("AnaPi0_hPrimEtaPhi"); | |
851 | ||
852 | Int_t binMin = hPrimPho->FindBin(3); | |
853 | ||
854 | TH1F* hPrimPhoPhi = (TH1F*) h2PrimPhoPhi->ProjectionY("PrimPhoPhi",binMin,1000); | |
855 | TH1F* hPrimPi0Phi = (TH1F*) h2PrimPi0Phi->ProjectionY("PrimPi0Phi",binMin,1000); | |
856 | TH1F* hPrimEtaPhi = (TH1F*) h2PrimEtaPhi->ProjectionY("PrimEtaPhi",binMin,1000); | |
857 | ||
858 | hPrimPhoPhi->Scale(1./hPrimPhoPhi->Integral(0,1000)); | |
859 | hPrimPi0Phi->Scale(1./hPrimPi0Phi->Integral(0,1000)); | |
860 | hPrimEtaPhi->Scale(1./hPrimEtaPhi->Integral(0,1000)); | |
861 | ||
862 | Float_t maxPhi = hPrimPhoPhi->GetMaximum(); | |
863 | if(maxPhi < hPrimPi0Phi->GetMaximum()) maxPhi = hPrimPi0Phi->GetMaximum(); | |
864 | if(maxPhi < hPrimEtaPhi->GetMaximum()) maxPhi = hPrimEtaPhi->GetMaximum(); | |
865 | ||
866 | Float_t minPhi = hPrimPhoPhi->GetMinimum(); | |
867 | if(minPhi > hPrimPi0Phi->GetMinimum()) minPhi = hPrimPi0Phi->GetMinimum(); | |
868 | if(minPhi > hPrimEtaPhi->GetMinimum()) minPhi = hPrimEtaPhi->GetMinimum(); | |
869 | ||
870 | hPrimPi0Phi->SetMaximum(maxPhi*1.1); | |
871 | hPrimPi0Phi->SetMinimum(minPhi); | |
872 | TGaxis::SetMaxDigits(3); | |
873 | ||
874 | hPrimPi0Phi->SetYTitle("1/total entries dN/d#phi"); | |
875 | hPrimPi0Phi->SetTitle("Generated particles #phi for E > 3 GeV"); | |
876 | hPrimPi0Phi->SetTitleOffset(1.6,"Y"); | |
877 | hPrimPi0Phi->Sumw2(); | |
878 | hPrimPi0Phi->SetMarkerColor(4); | |
879 | hPrimPi0Phi->SetMarkerStyle(21); | |
880 | hPrimPi0Phi->Draw(""); | |
881 | ||
882 | hPrimPhoPhi->Sumw2(); | |
883 | hPrimPhoPhi->SetMarkerColor(1); | |
884 | hPrimPhoPhi->SetMarkerStyle(20); | |
885 | Float_t scale = TMath::RadToDeg(); | |
886 | ScaleXaxis(hPrimPhoPhi, TMath::RadToDeg()); | |
887 | hPrimPhoPhi->Draw("same"); | |
888 | ||
889 | ||
890 | hPrimEtaPhi->Sumw2(); | |
891 | hPrimEtaPhi->SetMarkerColor(2); | |
892 | hPrimEtaPhi->SetMarkerStyle(22); | |
893 | hPrimEtaPhi->Draw("same"); | |
894 | ||
895 | cmc->cd(4); | |
896 | //gPad->SetLogy(); | |
897 | ||
898 | TH2F* h2PrimPhoEta = (TH2F*) GetHisto("AnaPhoton_hYPrim_MCPhoton"); | |
899 | TH2F* h2PrimPi0Eta = (TH2F*) GetHisto("AnaPi0_hPrimPi0Rapidity"); | |
900 | TH2F* h2PrimEtaEta = (TH2F*) GetHisto("AnaPi0_hPrimEtaRapidity"); | |
901 | ||
902 | Int_t binMin = hPrimPho->FindBin(3); | |
903 | ||
904 | TH1F* hPrimPhoEta = (TH1F*) h2PrimPhoEta->ProjectionY("PrimPhoEta",binMin,1000); | |
905 | TH1F* hPrimPi0Eta = (TH1F*) h2PrimPi0Eta->ProjectionY("PrimPi0Eta",binMin,1000); | |
906 | TH1F* hPrimEtaEta = (TH1F*) h2PrimEtaEta->ProjectionY("PrimEtaEta",binMin,1000); | |
907 | ||
908 | hPrimPhoEta->Scale(1./hPrimPhoEta->Integral(0,1000)); | |
909 | hPrimPi0Eta->Scale(1./hPrimPi0Eta->Integral(0,1000)); | |
910 | hPrimEtaEta->Scale(1./hPrimEtaEta->Integral(0,1000)); | |
911 | ||
912 | Float_t maxEta = hPrimPhoEta->GetMaximum(); | |
913 | if(maxEta < hPrimPi0Eta->GetMaximum()) maxEta = hPrimPi0Eta->GetMaximum(); | |
914 | if(maxEta < hPrimEtaEta->GetMaximum()) maxEta = hPrimEtaEta->GetMaximum(); | |
915 | ||
916 | Float_t minEta = hPrimPhoEta->GetMinimum(); | |
917 | if(minEta > hPrimPi0Eta->GetMinimum()) minEta = hPrimPi0Eta->GetMinimum(); | |
918 | if(minEta > hPrimEtaEta->GetMinimum()) minEta = hPrimEtaEta->GetMinimum(); | |
919 | ||
920 | hPrimPi0Eta->SetMaximum(maxEta*1.1); | |
921 | hPrimPi0Eta->SetMinimum(minEta); | |
922 | TGaxis::SetMaxDigits(3); | |
923 | ||
924 | hPrimPi0Eta->SetYTitle("1/total entries dN/d#eta"); | |
925 | hPrimPi0Eta->SetTitle("Generated particles #eta for E > 3 GeV"); | |
926 | hPrimPi0Eta->SetTitleOffset(1.6,"Y"); | |
927 | hPrimPi0Eta->Sumw2(); | |
928 | hPrimPi0Eta->SetMarkerColor(4); | |
929 | hPrimPi0Eta->SetMarkerStyle(21); | |
930 | hPrimPi0Eta->Draw(""); | |
931 | ||
932 | hPrimPhoEta->Sumw2(); | |
933 | hPrimPhoEta->SetMarkerColor(1); | |
934 | hPrimPhoEta->SetMarkerStyle(20); | |
935 | Float_t scale = TMath::RadToDeg(); | |
936 | hPrimPhoEta->Draw("same"); | |
937 | ||
938 | hPrimEtaEta->Sumw2(); | |
939 | hPrimEtaEta->SetMarkerColor(2); | |
940 | hPrimEtaEta->SetMarkerStyle(22); | |
941 | hPrimEtaEta->Draw("same"); | |
942 | ||
943 | cmc->SaveAs(Form("fig_ga_%s_MCHisto.%s",histoTag.Data(),suffix.Data())); | |
944 | ||
945 | ||
946 | ||
947 | ||
948 | ||
949 | } | |
950 | ||
951 | ||
952 | //____________________________________________________________________ | |
953 | Bool_t GetFileAndList(TString fileName, TString listNameNN, Bool_t export) | |
954 | { | |
955 | file = new TFile(fileName,"read"); | |
956 | ||
957 | Printf("\n\n\n"); | |
958 | ||
959 | if(!file) { | |
960 | Printf("FATAL:The file is not Available >>>>> Provide the correct input file"); | |
961 | Printf("FATAL: %s => Not Available", fileName.Data()); | |
962 | return kFALSE; | |
963 | } | |
964 | ||
965 | // file->ls(); | |
966 | ||
967 | TString listName; | |
968 | TList *keylist = file->GetListOfKeys(); | |
969 | for(Int_t i = 0; i < keylist->GetEntries(); i++) { | |
970 | ||
971 | TKey *lk = (TKey *)keylist->At(i); | |
972 | TString listNN = lk->GetName(); | |
973 | if(listNN.Contains(listNameNN.Data())) { | |
974 | listName = lk->GetName(); | |
975 | cout << listName.Data() <<endl; | |
976 | } | |
977 | } | |
978 | ||
979 | histoTag = listName; | |
980 | ||
981 | //return; | |
982 | ||
983 | TDirectory * dir = (TDirectory*) file->Get(listName); | |
984 | if(!dir) { | |
985 | Printf("FATAL:The listName is not Available <<<<<<>>>>> Provide the correct input List"); | |
986 | Printf("FATAL: %s => Not Available", listName.Data()); | |
987 | return kFALSE; | |
988 | } | |
989 | ||
990 | dir->ls(); | |
991 | ||
992 | if(dir) | |
993 | { | |
994 | list = (TList*) dir->Get(listName); | |
995 | if(export) | |
996 | { | |
997 | TFile * outputFile = new TFile("AnalysisResultsList.root","RECREATE"); | |
998 | list->Write(); | |
999 | outputFile->Close(); | |
1000 | } | |
1001 | } | |
1002 | ||
1003 | return kTRUE; | |
1004 | ||
1005 | } | |
1006 | ||
1007 | ||
1008 | void SaveHisto(TObject* histo){ | |
1009 | if(histo){ | |
1010 | histo->Write(Form("fig_ga_%s",histo->GetName())); | |
1011 | } | |
1012 | else Printf("Object not Available"); | |
1013 | } | |
1014 | ||
1015 | //___________________________________ | |
1016 | TObject * GetHisto(TString histoName) | |
1017 | { | |
1018 | // Check if the list is available, if not get the histo directly from file | |
1019 | ||
1020 | if(list) { | |
1021 | // (list->FindObject(histoName))->Write(Form("fig_ga_%s",histoName.Data())); | |
1022 | ||
1023 | SaveHisto(list->FindObject(histoName)); | |
1024 | return list->FindObject(histoName); | |
1025 | } | |
1026 | ||
1027 | else { | |
1028 | // (file->Get(histoName))->Write(Form("fig_ga_%s",histoName.Data())); | |
1029 | SaveHisto(file->Get(histoName)); | |
1030 | return file->Get (histoName); | |
1031 | } | |
1032 | } | |
1033 | ||
1034 | //___________________________________________________ | |
1035 | void ScaleAxis(TAxis *a, Double_t scale) | |
1036 | { | |
1037 | if (!a) return; // just a precaution | |
1038 | if (a->GetXbins()->GetSize()) | |
1039 | { | |
1040 | // an axis with variable bins | |
1041 | // note: bins must remain in increasing order, hence the "Scale" | |
1042 | // function must be strictly (monotonically) increasing | |
1043 | TArrayD X(*(a->GetXbins())); | |
1044 | for(Int_t i = 0; i < X.GetSize(); i++) X[i] = scale*X[i]; | |
1045 | a->Set((X.GetSize() - 1), X.GetArray()); // new Xbins | |
1046 | } | |
1047 | else | |
1048 | { | |
1049 | // an axis with fix bins | |
1050 | // note: we modify Xmin and Xmax only, hence the "Scale" function | |
1051 | // must be linear (and Xmax must remain greater than Xmin) | |
1052 | a->Set(a->GetNbins(), | |
1053 | scale*a->GetXmin(), // new Xmin | |
1054 | scale*a->GetXmax()); // new Xmax | |
1055 | } | |
1056 | return; | |
1057 | } | |
1058 | ||
1059 | //___________________________________________________ | |
1060 | void ScaleXaxis(TH1 *h, Double_t scale) | |
1061 | { | |
1062 | if (!h) return; // just a precaution | |
1063 | ScaleAxis(h->GetXaxis(), scale); | |
1064 | return; | |
1065 | } | |
1066 | ||
1067 |