1 ///////////////////////////////////////////
3 // Macro to plot few selected histograms
4 // to QA data productions at 0th order
5 // Analysis performed with the wagon
6 // AddTaskPi0IMGammaCorrQA.C
7 // It generates 5 eps plots, each containing 2 to 4 canvases
9 // To execute: root -q -b -l DrawAnaCaloTrackQA.C'("Pi0IM_GammaTrackCorr_EMCAL_default","AnalysisResults.root")'
10 // The input list name might change depending on the wagon / data type
11 // In case output file is too large, possiblity to dump the list content in a sepate file: export = kTRUE
13 // Author: Gustavo.Conesa.Balbastre@cern.ch
17 // Some global variables
20 TString histoTag = "";
21 Int_t color[]={kBlack,kRed,kOrange+1,kYellow+1,kGreen+2,kBlue,kCyan+1,kViolet,kMagenta+2,kGray};
23 //_______________________________________________________________________
24 void DrawAnaCaloTrackQA(TString listName = "Pi0IM_GammaTrackCorr_EMCAL_default",
25 TString fileName = "AnalysisResultsQATrain.root",
26 Bool_t export = kFALSE)
29 printf("Open <%s>; Get List : <%s>; Export list? <%d>\n",fileName.Data(),listName.Data(),export);
33 //Access the file and list of histograms, global variables
34 GetFileAndList(fileName, listName, export);
36 gStyle->SetOptTitle(1);
37 gStyle->SetOptStat(0);
38 gStyle->SetOptFit(000000);
39 gStyle->SetPadRightMargin(0.15);
40 //gStyle->SetPadTopMargin(0.02);
41 //gStyle->SetPadLeftMargin(0.15);
42 gStyle->SetTitleFontSize(0.06);
44 //Plot basic Calorimeter QA
53 //Plot basic correlation QA
56 // MC basic QA plots, cluster origins (only if it run on MC)
63 // Basic calorimeter QA histograms
65 TCanvas * ccalo = new TCanvas(Form("CaloHisto_%s",histoTag.Data()),"",1000,1000);
71 TH1F* hCellAmplitude = (TH1F*) GetHisto("QA_hAmplitude");
72 TH1F* hClusterEnergy = (TH1F*) GetHisto("QA_hE");
74 hClusterEnergy->SetTitle("Cluster-cell energy spectra");
75 hClusterEnergy->Sumw2();
76 hClusterEnergy->SetMarkerColor(1);
77 hClusterEnergy->SetMarkerStyle(20);
78 hClusterEnergy->SetAxisRange(0.,50.,"X");
79 hClusterEnergy->Draw();
81 hCellAmplitude->Sumw2();
82 hCellAmplitude->SetMarkerColor(4);
83 hCellAmplitude->SetMarkerStyle(25);
84 hCellAmplitude->Draw("same");
86 TLegend l(0.3,0.7,0.83,0.85);
88 l.AddEntry(hClusterEnergy,"Cluster (no exotic+non lin)","P");
89 l.AddEntry(hCellAmplitude,"Cell","P");
98 TH1F* hRaw = (TH1F*) GetHisto("AnaPhoton_hCut_0_Open");
99 TH1F* hCorr = (TH1F*) GetHisto("AnaPhoton_hCut_4_NCells");
100 TH1F* hTM = (TH1F*) GetHisto("AnaPhoton_hCut_7_Matching");
101 TH1F* hShSh = (TH1F*) GetHisto("AnaPhoton_hCut_9_PID");
105 hCorr->SetTitle("Ratio after cluster cuts application");
106 hCorr->SetYTitle("Selected clusters / Raw clusters");
107 hCorr->SetTitleOffset(1.5,"Y");
109 hCorr->SetMarkerColor(1);
110 hCorr->SetMarkerStyle(20);
112 hCorr->SetAxisRange(0.,30.,"X");
113 hCorr->SetMaximum(1);
114 hCorr->SetMinimum(0);
118 hTM ->SetMarkerColor(2);
119 hTM ->SetMarkerStyle(21);
124 hShSh->SetMarkerColor(4);
125 hShSh->SetMarkerStyle(22);
129 TLegend l2(0.3,0.7,0.83,0.85);
130 l2.SetTextSize(0.04);
131 l2.AddEntry(hCorr,"No Exotics + non lin. ++","P");
132 l2.AddEntry(hTM, "+ Track matching","P");
133 l2.AddEntry(hShSh,"+ #lambda^{2}_{0} < 0.4","P");
139 // Plot track-matching residuals
140 // first test did not have this histogram, add protection
141 TH2F* hTrackMatchResEtaPhi = (TH2F*) GetHisto("QA_hTrackMatchedDEtaDPhi");
142 if(hTrackMatchResEtaPhi)
147 hTrackMatchResEtaPhi->SetAxisRange(-0.025,0.025,"X");
148 hTrackMatchResEtaPhi->SetAxisRange(-0.025,0.025,"Y");
149 hTrackMatchResEtaPhi->SetTitleOffset(1.5,"Y");
150 hTrackMatchResEtaPhi->SetTitle("Track-cluster residual #Delta #phi vs #Delta #eta, E > 0.5 GeV");
151 hTrackMatchResEtaPhi->Draw("colz");
156 TH2F* h2TrackMatchResEtaNeg = (TH2F*) GetHisto("QA_hTrackMatchedDEta");
157 TH2F* h2TrackMatchResEtaPos = (TH2F*) GetHisto("QA_hTrackMatchedDEtaPos");
158 TH2F* h2TrackMatchResPhiNeg = (TH2F*) GetHisto("QA_hTrackMatchedDPhi");
159 TH2F* h2TrackMatchResPhiPos = (TH2F*) GetHisto("QA_hTrackMatchedDPhiPos");
161 h2TrackMatchResEtaNeg->Add(h2TrackMatchResEtaPos,-1);
162 h2TrackMatchResPhiNeg->Add(h2TrackMatchResPhiPos,-1);
164 Float_t binMin = hCorr->FindBin(0.5);
165 TH1F* hTrackMatchResEtaNeg = (TH1F*) h2TrackMatchResEtaNeg->ProjectionY("TMProjEtaNeg",binMin, 1000);
166 TH1F* hTrackMatchResEtaPos = (TH1F*) h2TrackMatchResEtaPos->ProjectionY("TMProjEtaPos",binMin, 1000);
167 TH1F* hTrackMatchResPhiNeg = (TH1F*) h2TrackMatchResPhiNeg->ProjectionY("TMProjPhiNeg",binMin, 1000);
168 TH1F* hTrackMatchResPhiPos = (TH1F*) h2TrackMatchResPhiPos->ProjectionY("TMProjPhiPos",binMin, 1000);
170 hTrackMatchResEtaNeg->SetTitle("Track-cluster residuals, E > 1 GeV");
171 hTrackMatchResEtaNeg->SetAxisRange(-0.05,0.05,"X");
172 hTrackMatchResEtaNeg->Sumw2();
173 hTrackMatchResEtaNeg->SetMarkerStyle(25);
174 hTrackMatchResEtaNeg->SetMarkerColor(2);
175 hTrackMatchResEtaNeg->Draw("");
177 hTrackMatchResEtaPos->Sumw2();
178 hTrackMatchResEtaPos->SetMarkerStyle(25);
179 hTrackMatchResEtaPos->SetMarkerColor(4);
180 hTrackMatchResEtaPos->Draw("same");
182 hTrackMatchResPhiNeg->Sumw2();
183 hTrackMatchResPhiNeg->SetMarkerStyle(24);
184 hTrackMatchResPhiNeg->SetMarkerColor(2);
185 hTrackMatchResPhiNeg->Draw("same");
187 hTrackMatchResPhiPos->Sumw2();
188 hTrackMatchResPhiPos->SetMarkerStyle(24);
189 hTrackMatchResPhiPos->SetMarkerColor(4);
190 hTrackMatchResPhiPos->Draw("same");
192 TLine l0(0,hTrackMatchResEtaNeg->GetMinimum(),0,hTrackMatchResEtaNeg->GetMaximum()*1.2);
195 TLegend l3(0.55,0.7,0.83,0.85);
196 l3.SetTextSize(0.04);
197 l3.AddEntry(hTrackMatchResEtaNeg,"#Delta #eta, Negative","P");
198 l3.AddEntry(hTrackMatchResEtaPos,"#Delta #eta, Positive","P");
199 l3.AddEntry(hTrackMatchResPhiNeg,"#Delta #phi, Negative","P");
200 l3.AddEntry(hTrackMatchResPhiPos,"#Delta #phi, Positive","P");
205 ccalo->Print(Form("%s_CaloHisto.eps",histoTag.Data()));
208 TCanvas * ccalo2 = new TCanvas(Form("CaloHisto2_%s",histoTag.Data()),"",500,500);
213 // TH2F* hCellAmpId = (TH2F*) GetHisto("QA_hAmpId");
214 // hCellAmpId->SetTitle("Cell Id vs energy");
215 // hCellAmpId->SetYTitle("Cell Id");
216 // //hCellAmpId->SetAxisRange(300.,900.,"Y");
217 // hCellAmpId->SetAxisRange(0.,30.,"X");
218 // hCellAmpId->SetTitleOffset(1.5,"Y");
219 // hCellAmpId->Draw("colz");
223 TH2F* hClusterTime = (TH2F*) GetHisto("QA_hClusterTimeEnergy");
224 hClusterTime->SetTitle("Cluster energy vs time");
225 hClusterTime->SetYTitle("time (ns)");
226 hClusterTime->SetAxisRange(300.,900.,"Y");
227 hClusterTime->SetAxisRange(0.,30.,"X");
228 hClusterTime->SetTitleOffset(1.5,"Y");
229 hClusterTime->Draw("colz");
233 TH2F* hCellActivity = (TH2F*) GetHisto("QA_hGridCells");
234 hCellActivity->SetTitle("Hits per cell (E > 0.2 GeV)");
235 hCellActivity->SetTitleOffset(1.5,"Y");
236 hCellActivity->Draw("colz");
240 TH2F* hCellActivity = (TH2F*) GetHisto("QA_hGridCells");
241 TH2F* hCellActivityE = (TH2F*) GetHisto("QA_hGridCellsE");
242 hCellActivityE->SetTitle("Mean energy per cell (E > 0.2 GeV)");
243 hCellActivityE->Divide(hCellActivity);
244 hCellActivityE->SetTitleOffset(1.5,"Y");
245 hCellActivityE->Draw("colz");
249 TH2F* hClusterActivity = (TH2F*) GetHisto("AnaPhoton_hEtaPhi");
250 hClusterActivity->SetTitle("Clusters activity (E > 0.5 GeV)");
251 hClusterActivity->SetTitleOffset(1.5,"Y");
252 hClusterActivity->Draw("colz");
254 ccalo2->Print(Form("%s_CaloHisto2.eps",histoTag.Data()));
261 // Basic hybrid tracks histograms
263 TCanvas * ctrack = new TCanvas(Form("TrackHisto_%s",histoTag.Data()),"",1000,500);
268 TH2F * hTrackEtaPhi = (TH2F*) GetHisto("AnaHadrons_hEtaPhiNegative");
269 hTrackEtaPhi ->Add((TH2F*) GetHisto("AnaHadrons_hEtaPhiNegative"));
270 hTrackEtaPhi ->SetAxisRange(-0.9,0.9,"X");
271 hTrackEtaPhi ->SetTitle("Hybrid tracks #eta vs #phi (p_{T} > 0.2 GeV)");
272 hTrackEtaPhi ->Draw("colz");
276 TH2F * hTrackEtaPhiSPD = (TH2F*) GetHisto("AnaHadrons_hEtaPhiSPDRefitPt02");
277 TH2F * hTrackEtaPhiNoSPD = (TH2F*) GetHisto("AnaHadrons_hEtaPhiNoSPDRefitPt02");
279 TH1F* hPhiSPD = (TH1F*)hTrackEtaPhiSPD ->ProjectionY("hTrackPhiSPD" ,0,1000);
280 TH1F* hPhiNoSPD = (TH1F*)hTrackEtaPhiNoSPD->ProjectionY("hTrackPhiNoSPD",0,1000);
281 //TH1F* hPhi = (TH1F*)hTrackEtaPhi ->ProjectionY("hTrackPhi" ,0,1000);
282 TH1F* hPhi = hPhiSPD->Clone("hTrackPhi");
283 hPhi->Add(hPhiNoSPD);
284 hPhi ->SetTitle("Hybrid track in #phi, composition, p_{T} > 0.2 GeV");
285 hPhi ->SetLineColor(1);
286 hPhiSPD ->SetLineColor(2);
287 hPhiNoSPD->SetLineColor(4);
289 hPhi ->SetMinimum(1);
292 hPhiSPD ->Draw("Hsame");
293 hPhiNoSPD->Draw("Hsame");
295 TLegend l(0.12,0.8,0.4,0.9);
297 l.AddEntry(hPhi,"Sum","L");
298 l.AddEntry(hPhiSPD ,"SPD+Refit","L");
299 l.AddEntry(hPhiNoSPD,"No SPD+Refit","L");
306 // TH2F* hPtDCAxy = (TH2F*) GetHisto("AnaHadrons_hPtDCAxy");
307 // hPtDCAxy->SetAxisRange(-1,1,"Y");
308 // hPtDCAxy->SetAxisRange(0,30,"X");
309 // hPtDCAxy->Draw("colz");
314 // TH2F* hPtDCAz = (TH2F*) GetHisto("AnaHadrons_hPtDCAz");
315 // hPtDCAz->SetAxisRange(-1,1,"Y");
316 // hPtDCAz->SetAxisRange(0,30,"X");
317 // hPtDCAz->Draw("colz");
319 ctrack->Print(Form("%s_TrackHisto.eps",histoTag.Data()));
326 // Basic invariant mass QA
328 TCanvas * cpi0 = new TCanvas(Form("Pi0Histo_%s",histoTag.Data()),"",500,500);
333 for(Int_t icen = 0; icen < 10; icen++)
335 hMassE [icen] = (TH2F*) GetHisto(Form("AnaPi0_hRe_cen%d_pidbit0_asy1_dist1",icen));
336 hMixMassE[icen] = (TH2F*) GetHisto(Form("AnaPi0_hMi_cen%d_pidbit0_asy1_dist1",icen));
339 // 2D Invariant mass vs E, in PbPb from 60 to 100 %, all in pp
344 if(hMassE[1]) // Plot centrality from 60 to 100%
346 h2DMass = (TH2F*) hMassE[6]->Clone("h2DMass");
347 for(Int_t icen = 7; icen < 10; icen++) h2DMass->Add(hMassE[icen]);
348 h2DMass->SetTitle("Invariant mass vs pair E, Cen: 60-100%");
352 h2DMass = (TH2F*) hMassE[0]->Clone("hMassProj");
353 h2DMass->SetTitle("Invariant mass vs cluster pair E");
356 h2DMass->SetTitleOffset(1.6,"Y");
357 h2DMass->SetAxisRange(0.0,0.7,"Y");
358 h2DMass->SetAxisRange(0,30,"X");
359 h2DMass->Draw("colz");
361 // Pi0 Invariant mass projection, in PbPb 6 centrality bins from 0 to 50%, all in pp
369 for(Int_t icen=0; icen<10; icen++ )
377 TH1F * hX = (TH1F*) hMassE[0]->ProjectionX("hEPairCen0",0,10000);
378 Int_t binmin = hX->FindBin(2); // Project histo from 2 GeV pairs
379 Int_t binmax = hX->FindBin(10); // Project histo up to 10 GeV pairs
382 for(Int_t icen = 0; icen < 6; icen++)
384 if(!hMassE[icen]) continue;
386 hMass[icen] = (TH1F*) hMassE [icen]->ProjectionY(Form("hMassCen%d",icen),binmin,binmax);
387 hMix [icen] = (TH1F*) hMixMassE[icen]->ProjectionY(Form("hMixCen%d" ,icen),binmin,binmax);
388 hMass[icen]->Sumw2();
389 hMix [icen]->Sumw2();
391 hMassPi0[icen] = (TH1F*) hMass[icen]->Clone(Form("hMassPi0Cen%d",icen));
392 hMassEta[icen] = (TH1F*) hMass[icen]->Clone(Form("hMassEtaCen%d",icen));
394 hMassPi0[icen]->Divide(hMix[icen]);
395 hMassPi0[icen]->Fit("pol0","Q","",0.25,0.35);
397 if(hMassPi0[icen]->GetFunction("pol0")) scale = hMassPi0[icen]->GetFunction("pol0")->GetParameter(0);
398 //printf("Scale factor %f for cen %d\n",scale,icen);
399 hMassPi0[icen]->Scale(1./scale);
400 hMassPi0[icen]->SetMarkerStyle(24);
401 hMassPi0[icen]->SetMarkerColor(color[icen]);
402 hMassPi0[icen]->SetLineColor(color[icen]);
403 hMassPi0[icen]->SetAxisRange(0.04,0.24);
404 hMassPi0[icen]->SetMarkerSize(0.5);
406 hMassEta[icen]->Rebin(4);
407 hMix [icen]->Rebin(4);
408 hMassEta[icen]->Divide(hMix[icen]);
409 hMassEta[icen]->SetMarkerStyle(25);
410 hMassEta[icen]->SetMarkerColor(color[icen]);
411 hMassEta[icen]->SetLineColor(color[icen]);
412 hMassEta[icen]->SetAxisRange(0.4,0.9);
413 hMassEta[icen]->SetMarkerSize(0.5);
414 hMassEta[icen]->Scale(1./scale);
416 if(maxEta < hMassEta[icen]->GetMaximum()) maxEta = hMassEta[icen]->GetMaximum();
417 if(maxPi0 < hMassPi0[icen]->GetMaximum()) maxPi0 = hMassPi0[icen]->GetMaximum();
422 hMassPi0[0]->SetMinimum(0.8);
423 hMassPi0[0]->SetTitleOffset(1.6,"Y");
424 hMassPi0[0]->SetYTitle("Real / Mixed");
425 hMassPi0[0]->SetTitle("#pi^{0} peak, 2 < E_{pair}< 10 GeV");
430 hMassPi0[0]->SetMaximum(maxPi0*1.2);
431 hMassPi0[5]->Draw("Hsame");
432 hMassPi0[4]->Draw("Hsame");
433 hMassPi0[3]->Draw("Hsame");
434 hMassPi0[2]->Draw("Hsame");
435 hMassPi0[1]->Draw("Hsame");
436 hMassPi0[0]->Draw("Hsame");
437 //hMass[6]->Draw("Hsame");
438 //hMass[7]->Draw("same");
439 //hMass[8]->Draw("same");
440 //hMass[9]->Draw("same");
442 TLegend l(0.12,0.6,0.4,0.85);
444 l.AddEntry(hMassPi0[0],"0-10%","P");
445 l.AddEntry(hMassPi0[1],"10-20%","P");
446 l.AddEntry(hMassPi0[2],"20-30%","P");
447 l.AddEntry(hMassPi0[3],"30-40%","P");
448 l.AddEntry(hMassPi0[4],"40-70%","P");
449 l.AddEntry(hMassPi0[5],"50-60%","P");
455 TLine l1(0.04,1,0.24,1);
458 // Pi0 invariant mass per EMCal super module
463 binmin = hX->FindBin(4); // Project histo from 3 GeV pairs
464 binmax = hX->FindBin(20); // Project histo up to 20 GeV pairs
467 for(Int_t ism = 0; ism < 10; ism++)
469 TH2F* hTmpSM = (TH2F*) GetHisto(Form("AnaPi0_hReMod_%d",ism));
470 if(!hTmpSM) hTmpSM = (TH2F*) GetHisto(Form("QA_hIM_Mod%d",ism));
472 hSM[ism] = (TH1F*) hTmpSM->ProjectionY(Form("hMassSM%d",ism),binmin,binmax);
474 hSM[ism]->SetMarkerStyle(26);
476 //hSM[ism]->Scale(1./hSM[ism]->Integral(0,10000));
477 hSM[ism]->SetMarkerColor(color[ism]);
478 hSM[ism]->SetLineColor(color[ism]);
479 hSM[ism]->SetMarkerSize(0.5);
481 TH2F* hTmpMixSM = (TH2F*) GetHisto(Form("AnaPi0_hMiMod_%d",ism));
484 hMixSM[ism] = (TH1F*) hTmpMixSM->ProjectionY(Form("hMassMixSM%d",ism),binmin,binmax);
485 hMixSM[ism]->Sumw2();
486 hMixSM[ism]->Rebin(2);
487 hSM[ism]->Divide(hMixSM[ism]);
488 hSM[ism]->Fit("pol0","Q","",0.25,0.35);
490 if(hSM[ism]->GetFunction("pol0")) scale = hSM[ism]->GetFunction("pol0")->GetParameter(0);
491 //printf("Scale factor %f for cen %d\n",scale,icen);
492 hSM[ism]->Scale(1./scale);
493 hSM[ism]->SetYTitle("Real / Mixed");
497 if(maxSM < hSM[ism]->GetMaximum()) maxSM = hSM[ism]->GetMaximum();
501 hSM[0]->SetTitle("#pi^{0} peak in Modules, 4 < E_{pair}< 10 GeV");
502 hSM[0]->SetTitleOffset(1.6,"Y");
503 hSM[0]->SetAxisRange(0.04,0.24);
504 hSM[0]->SetMaximum(maxSM*1.2);
505 hSM[0]->SetMinimum(0.8);
508 TLegend lsm(0.12,0.5,0.35,0.85);
509 lsm.SetTextSize(0.04);
510 lsm.AddEntry(hSM[0],Form("Mod %d",0),"P");
512 for(Int_t ism = 1; ism < 10; ism++)
514 hSM[ism]->Draw("Hsame");
515 lsm.AddEntry(hSM[ism],Form("Mod %d",ism),"P");
518 lsm.SetBorderSize(0);
524 // Pi0 Invariant mass projection, in PbPb 6 centrality bins from 0 to 50%, all in pp
529 hMassEta[0]->SetMinimum(0.8);
530 hMassEta[0]->SetTitleOffset(1.6,"Y");
531 hMassEta[0]->SetYTitle("Real / Mixed");
532 hMassEta[0]->SetTitle("#eta peak, 2 < E_{pair}< 10 GeV");
533 hMassEta[0]->Draw("H");
537 hMassEta[0]->SetMaximum(maxEta*1.2);
538 hMassEta[5]->Draw("Hsame");
539 hMassEta[4]->Draw("Hsame");
540 hMassEta[3]->Draw("Hsame");
541 hMassEta[2]->Draw("Hsame");
542 hMassEta[1]->Draw("Hsame");
543 hMassEta[0]->Draw("Hsame");
546 TLegend l2(0.12,0.6,0.4,0.85);
547 l2.SetTextSize(0.04);
548 l2.AddEntry(hMassEta[0],"0-10%","P");
549 l2.AddEntry(hMassEta[1],"10-20%","P");
550 l2.AddEntry(hMassEta[2],"20-30%","P");
551 l2.AddEntry(hMassEta[3],"30-40%","P");
552 l2.AddEntry(hMassEta[4],"40-70%","P");
553 l2.AddEntry(hMassEta[5],"50-60%","P");
559 cpi0->Print(Form("%s_Pi0Histo.eps",histoTag.Data()));
567 TCanvas * cCorrelation = new TCanvas(Form("CorrelationHisto_%s",histoTag.Data()),"",1000,500);
568 cCorrelation->Divide(2,1);
570 Float_t minClusterE = 8;
571 Float_t assocBins[] = {0.5,2.,5.,10.,20.};
572 Int_t nAssocBins = 4;
574 TH1F * hLeading = (TH1F*) GetHisto("AnaPhotonHadronCorr_hPtLeading");
575 Int_t minClusterEBin = hLeading->FindBin(minClusterE);
576 Float_t nTrig = hLeading->Integral(minClusterE,100000);
578 //Azimuthal correlation
583 TLegend l(0.35,0.6,0.83,0.85);
584 l.SetHeader(Form("p_{T,T} > %2.1f GeV/c",minClusterE));
589 for(Int_t ibin = 0; ibin < nAssocBins; ibin++ )
591 TH2F* hDeltaPhiE = (TH2F*) GetHisto(Form("AnaPhotonHadronCorr_hDeltaPhiPtAssocPt%2.1f_%2.1f",assocBins[ibin],assocBins[ibin+1]));
592 hDeltaPhi[ibin] = (TH1F*) hDeltaPhiE->ProjectionY(Form("DeltaPhi%2.1f",assocBins[ibin]),minClusterEBin,10000);
593 hDeltaPhi[ibin]->Sumw2();
594 hDeltaPhi[ibin]->Rebin(2);
595 hDeltaPhi[ibin]->Scale(1./nTrig);
597 hDeltaPhi[ibin]->Fit("pol0","Q","",1,2);
599 if(hDeltaPhi[ibin]->GetFunction("pol0"))
601 scale = hDeltaPhi[ibin]->GetFunction("pol0")->GetParameter(0);
602 hDeltaPhi[ibin]->GetFunction("pol0")->SetRange(6,7); // move from plot
604 hDeltaPhi[ibin]->Scale(1./scale);
605 //printf("ibin %d, scale %f\n",ibin,scale);
607 hDeltaPhi[ibin]->SetAxisRange(-1.6,4.7);
609 hDeltaPhi[ibin]->SetMarkerStyle(24);
610 hDeltaPhi[ibin]->SetMarkerColor(color[ibin]);
611 hDeltaPhi[ibin]->SetLineColor(color[ibin]);
612 hDeltaPhi[ibin]->SetTitleOffset(1.5,"Y");
613 hDeltaPhi[ibin]->SetYTitle("N_{pairs} / N_{trig} / ZYAM");
614 hDeltaPhi[ibin]->SetTitle("#gamma (#lambda_{0}^{2} < 0.4, neutral cluster) trigger");
616 l.AddEntry(hDeltaPhi[ibin],Form("%2.1f< p_{T,A}< %2.1f GeV/c",assocBins[ibin],assocBins[ibin+1]),"P");
620 hDeltaPhi[2]->SetMaximum(hDeltaPhi[2]->GetMaximum()*10);
621 hDeltaPhi[2]->SetMinimum(0.8);
623 hDeltaPhi[2]->Draw("H");
624 hDeltaPhi[1]->Draw("Hsame");
625 hDeltaPhi[3]->Draw("Hsame");
626 hDeltaPhi[0]->Draw("Hsame");
635 TLegend l2(0.35,0.6,0.83,0.85);
636 l2.SetHeader(Form("p_{T,T} > %2.1f GeV/c",minClusterE));
637 l2.SetTextSize(0.04);
641 TH2F* hEXE = (TH2F*) GetHisto("AnaPhotonHadronCorr_hXECharged");
642 TH2F* hEXEUE = (TH2F*) GetHisto("AnaPhotonHadronCorr_hXEUeCharged");
644 TH1F* hXE = (TH1F*) hEXE->ProjectionY(Form("XE%2.1fGeV",minClusterE),minClusterEBin,10000);
647 hXE->Scale(1./nTrig);
648 hXE->SetAxisRange(0,1);
649 hXE->SetMarkerStyle(24);
650 hXE->SetMarkerColor(1);
651 hXE->SetLineColor(1);
652 hXE->SetTitleOffset(1.5,"Y");
653 hXE->SetYTitle("N_{pairs} / N_{trig}");
654 hXE->SetTitle("#gamma (#lambda_{0}^{2} < 0.4, neutral cluster) trigger");
655 l2.AddEntry(hXE,"raw x_{E}","P");
658 TH1F* hXEUE = (TH1F*) hEXEUE->ProjectionY(Form("XEUE%2.1fGeV",minClusterE),minClusterEBin,10000);
661 hXEUE->Scale(1./nTrig);
662 hXEUE->SetAxisRange(0,1);
663 hXEUE->SetMarkerStyle(25);
664 hXEUE->SetMarkerColor(2);
665 hXEUE->SetLineColor(2);
666 l2.AddEntry(hXEUE,"raw Und. Event x_{E}","P");
673 cCorrelation->Print(Form("%s_CorrelationHisto.eps",histoTag.Data()));
680 // Basic calorimeter QA histograms
682 TH2F* h2ClusterPho = (TH2F*) GetHisto("QA_hRecoMCE_Photon_Match0"); // not track-matched
683 TH2F* h2ClusterPi0 = (TH2F*) GetHisto("QA_hRecoMCE_Pi0_Match0"); // not track-matched
684 TH2F* h2ClusterEta = (TH2F*) GetHisto("QA_hRecoMCE_Eta_Match0"); // not track-matched
685 TH2F* h2ClusterEle = (TH2F*) GetHisto("QA_hRecoMCE_Electron_Match1"); // Track-matched
687 if(!h2ClusterPho) return;
690 TH1F* hPrimPho = (TH1F*) GetHisto("QA_hGenMCAccE_Photon");
691 TH1F* hPrimPi0 = (TH1F*) GetHisto("QA_hGenMCAccE_Pi0");
692 TH1F* hPrimEta = (TH1F*) GetHisto("QA_hGenMCAccE_Eta");
694 TCanvas * cmc = new TCanvas(Form("MCHisto_%s",histoTag.Data()),"",1000,1000);
700 TH1F* hClusterPho = (TH1F*) h2ClusterPho->ProjectionX("ClusterPho",0,1000);
701 TH1F* hClusterPi0 = (TH1F*) h2ClusterPi0->ProjectionX("ClusterPi0",0,1000);
702 TH1F* hClusterEta = (TH1F*) h2ClusterEta->ProjectionX("ClusterEta",0,1000);
704 hClusterPho->SetTitle("Cluster origin spectra, primary spectra in Calo acceptance");
705 hClusterPho->Sumw2();
706 hClusterPho->SetMarkerColor(1);
707 hClusterPho->SetMarkerStyle(20);
708 hClusterPho->SetAxisRange(0.,50.,"X");
709 hClusterPho->SetXTitle("E_{rec,gen} (GeV)");
710 hClusterPho->Draw("");
712 hClusterPi0->Sumw2();
713 hClusterPi0->SetMarkerColor(4);
714 hClusterPi0->SetMarkerStyle(21);
715 hClusterPi0->Draw("same");
717 hClusterEta->Sumw2();
718 hClusterEta->SetMarkerColor(2);
719 hClusterEta->SetMarkerStyle(22);
720 hClusterEta->Draw("same");
723 hPrimPho->SetMarkerColor(1);
724 hPrimPho->SetMarkerStyle(24);
725 hPrimPho->Draw("same");
728 hPrimPi0->SetMarkerColor(4);
729 hPrimPi0->SetMarkerStyle(25);
730 hPrimPi0->Draw("same");
733 hPrimEta->SetMarkerColor(2);
734 hPrimEta->SetMarkerStyle(26);
735 hPrimEta->Draw("same");
737 TLegend l(0.45,0.6,0.83,0.89);
739 l.AddEntry(hClusterPho,"#gamma cluster","P");
740 l.AddEntry(hClusterPi0,"#pi^{0} (merged) cluster","P");
741 l.AddEntry(hClusterEta,"#eta (merged) cluster","P");
742 l.AddEntry(hPrimPho,"#gamma generated","P");
743 l.AddEntry(hPrimPi0,"#pi^{0} generated","P");
744 l.AddEntry(hPrimEta,"#eta generated","P");
752 TH1F* hRatPho = (TH1F*) hClusterPho->Clone("hGenRecoPho");
753 TH1F* hRatPi0 = (TH1F*) hClusterPi0->Clone("hGenRecoPi0");
754 TH1F* hRatEta = (TH1F*) hClusterEta->Clone("hGenRecoEta");
756 hRatPho->Divide(hPrimPho);
757 hRatPi0->Divide(hPrimPi0);
758 hRatEta->Divide(hPrimEta);
760 hRatPho->SetTitle("Reconstructed cluster / Generated particle in Calo acc.");
761 hRatPho->SetYTitle("Ratio");
762 hRatPho->SetXTitle("E(GeV)");
763 hRatPho->SetMinimum(1e-3);
764 hRatPho->SetMaximum(10);
766 hRatPi0->Draw("same");
767 hRatEta->Draw("same");
769 TLegend l2(0.15,0.7,0.3,0.85);
770 l2.SetTextSize(0.04);
771 l2.AddEntry(hRatPho,"#gamma","P");
772 l2.AddEntry(hRatPi0,"#pi^{0}","P");
773 l2.AddEntry(hRatEta,"#eta","P");
781 TH2F* h2PrimPhoPhi = (TH2F*) GetHisto("AnaPhoton_hPhiPrim_MCPhoton");
782 TH2F* h2PrimPi0Phi = (TH2F*) GetHisto("AnaPi0_hPrimPi0Phi");
783 TH2F* h2PrimEtaPhi = (TH2F*) GetHisto("AnaPi0_hPrimEtaPhi");
785 Int_t binMin = hPrimPho->FindBin(3);
787 TH1F* hPrimPhoPhi = (TH1F*) h2PrimPhoPhi->ProjectionY("PrimPhoPhi",binMin,1000);
788 TH1F* hPrimPi0Phi = (TH1F*) h2PrimPi0Phi->ProjectionY("PrimPi0Phi",binMin,1000);
789 TH1F* hPrimEtaPhi = (TH1F*) h2PrimEtaPhi->ProjectionY("PrimEtaPhi",binMin,1000);
791 hPrimPhoPhi->Scale(1./hPrimPhoPhi->Integral(0,1000));
792 hPrimPi0Phi->Scale(1./hPrimPi0Phi->Integral(0,1000));
793 hPrimEtaPhi->Scale(1./hPrimEtaPhi->Integral(0,1000));
795 Float_t maxPhi = hPrimPhoPhi->GetMaximum();
796 if(maxPhi < hPrimPi0Phi->GetMaximum()) maxPhi = hPrimPi0Phi->GetMaximum();
797 if(maxPhi < hPrimEtaPhi->GetMaximum()) maxPhi = hPrimEtaPhi->GetMaximum();
799 Float_t minPhi = hPrimPhoPhi->GetMinimum();
800 if(minPhi > hPrimPi0Phi->GetMinimum()) minPhi = hPrimPi0Phi->GetMinimum();
801 if(minPhi > hPrimEtaPhi->GetMinimum()) minPhi = hPrimEtaPhi->GetMinimum();
803 hPrimPi0Phi->SetMaximum(maxPhi*1.1);
804 hPrimPi0Phi->SetMinimum(minPhi);
805 TGaxis::SetMaxDigits(3);
807 hPrimPi0Phi->SetYTitle("1/total entries dN/d#phi");
808 hPrimPi0Phi->SetTitle("Generated particles #phi for E > 3 GeV");
809 hPrimPi0Phi->SetTitleOffset(1.6,"Y");
810 hPrimPi0Phi->Sumw2();
811 hPrimPi0Phi->SetMarkerColor(4);
812 hPrimPi0Phi->SetMarkerStyle(21);
813 hPrimPi0Phi->Draw("");
815 hPrimPhoPhi->Sumw2();
816 hPrimPhoPhi->SetMarkerColor(1);
817 hPrimPhoPhi->SetMarkerStyle(20);
818 Float_t scale = TMath::RadToDeg();
819 ScaleXaxis(hPrimPhoPhi, TMath::RadToDeg());
820 hPrimPhoPhi->Draw("same");
823 hPrimEtaPhi->Sumw2();
824 hPrimEtaPhi->SetMarkerColor(2);
825 hPrimEtaPhi->SetMarkerStyle(22);
826 hPrimEtaPhi->Draw("same");
831 TH2F* h2PrimPhoEta = (TH2F*) GetHisto("AnaPhoton_hEtaPrim_MCPhoton");
832 TH2F* h2PrimPi0Eta = (TH2F*) GetHisto("AnaPi0_hPrimPi0Rapidity");
833 TH2F* h2PrimEtaEta = (TH2F*) GetHisto("AnaPi0_hPrimEtaRapidity");
835 Int_t binMin = hPrimPho->FindBin(3);
837 TH1F* hPrimPhoEta = (TH1F*) h2PrimPhoEta->ProjectionY("PrimPhoEta",binMin,1000);
838 TH1F* hPrimPi0Eta = (TH1F*) h2PrimPi0Eta->ProjectionY("PrimPi0Eta",binMin,1000);
839 TH1F* hPrimEtaEta = (TH1F*) h2PrimEtaEta->ProjectionY("PrimEtaEta",binMin,1000);
841 hPrimPhoEta->Scale(1./hPrimPhoEta->Integral(0,1000));
842 hPrimPi0Eta->Scale(1./hPrimPi0Eta->Integral(0,1000));
843 hPrimEtaEta->Scale(1./hPrimEtaEta->Integral(0,1000));
845 Float_t maxEta = hPrimPhoEta->GetMaximum();
846 if(maxEta < hPrimPi0Eta->GetMaximum()) maxEta = hPrimPi0Eta->GetMaximum();
847 if(maxEta < hPrimEtaEta->GetMaximum()) maxEta = hPrimEtaEta->GetMaximum();
849 Float_t minEta = hPrimPhoEta->GetMinimum();
850 if(minEta > hPrimPi0Eta->GetMinimum()) minEta = hPrimPi0Eta->GetMinimum();
851 if(minEta > hPrimEtaEta->GetMinimum()) minEta = hPrimEtaEta->GetMinimum();
853 hPrimPi0Eta->SetMaximum(maxEta*1.1);
854 hPrimPi0Eta->SetMinimum(minEta);
855 TGaxis::SetMaxDigits(3);
857 hPrimPi0Eta->SetYTitle("1/total entries dN/d#eta");
858 hPrimPi0Eta->SetTitle("Generated particles #eta for E > 3 GeV");
859 hPrimPi0Eta->SetTitleOffset(1.6,"Y");
860 hPrimPi0Eta->Sumw2();
861 hPrimPi0Eta->SetMarkerColor(4);
862 hPrimPi0Eta->SetMarkerStyle(21);
863 hPrimPi0Eta->Draw("");
865 hPrimPhoEta->Sumw2();
866 hPrimPhoEta->SetMarkerColor(1);
867 hPrimPhoEta->SetMarkerStyle(20);
868 Float_t scale = TMath::RadToDeg();
869 hPrimPhoEta->Draw("same");
871 hPrimEtaEta->Sumw2();
872 hPrimEtaEta->SetMarkerColor(2);
873 hPrimEtaEta->SetMarkerStyle(22);
874 hPrimEtaEta->Draw("same");
876 cmc->Print(Form("%s_MCHisto.eps",histoTag.Data()));
884 //____________________________________________________________________
885 void GetFileAndList(TString fileName, TString listName, Bool_t export)
887 file = new TFile(fileName,"read");
889 TDirectory * dir = (TDirectory*) file->Get(listName);
892 list = (TList*) dir->Get(listName);
895 TFile * outputFile = new TFile("AnalysisResultsList.root","RECREATE");
902 //___________________________________
903 TObject * GetHisto(TString histoName)
905 // Check if the list is available, if not get the histo directly from file
907 if(list) return list->FindObject(histoName);
908 else return file->Get (histoName);
911 //___________________________________________________
912 void ScaleAxis(TAxis *a, Double_t scale)
914 if (!a) return; // just a precaution
915 if (a->GetXbins()->GetSize())
917 // an axis with variable bins
918 // note: bins must remain in increasing order, hence the "Scale"
919 // function must be strictly (monotonically) increasing
920 TArrayD X(*(a->GetXbins()));
921 for(Int_t i = 0; i < X.GetSize(); i++) X[i] = scale*X[i];
922 a->Set((X.GetSize() - 1), X.GetArray()); // new Xbins
926 // an axis with fix bins
927 // note: we modify Xmin and Xmax only, hence the "Scale" function
928 // must be linear (and Xmax must remain greater than Xmin)
929 a->Set(a->GetNbins(),
930 scale*a->GetXmin(), // new Xmin
931 scale*a->GetXmax()); // new Xmax
936 //___________________________________________________
937 void ScaleXaxis(TH1 *h, Double_t scale)
939 if (!h) return; // just a precaution
940 ScaleAxis(h->GetXaxis(), scale);