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->SetYTitle("entries");
75 hClusterEnergy->SetTitle("Cluster-cell energy spectra");
76 hClusterEnergy->Sumw2();
77 hClusterEnergy->SetMarkerColor(1);
78 hClusterEnergy->SetMarkerStyle(20);
79 hClusterEnergy->SetAxisRange(0.,50.,"X");
80 hClusterEnergy->Draw();
82 hCellAmplitude->Sumw2();
83 hCellAmplitude->SetMarkerColor(4);
84 hCellAmplitude->SetMarkerStyle(25);
85 hCellAmplitude->Draw("same");
87 TLegend l(0.25,0.7,0.83,0.85);
89 l.AddEntry(hClusterEnergy,"Cluster (no exotic+non lin.)","P");
90 l.AddEntry(hCellAmplitude,"Cell","P");
99 TH1F* hRaw = (TH1F*) GetHisto("AnaPhoton_hCut_0_Open");
100 TH1F* hCorr = (TH1F*) GetHisto("AnaPhoton_hCut_4_NCells");
101 TH1F* hTM = (TH1F*) GetHisto("AnaPhoton_hCut_7_Matching");
102 TH1F* hShSh = (TH1F*) GetHisto("AnaPhoton_hCut_9_PID");
106 hCorr->SetTitle("Ratio after cluster cuts application");
107 hCorr->SetYTitle("Selected clusters / Raw clusters");
108 hCorr->SetTitleOffset(1.5,"Y");
110 hCorr->SetMarkerColor(1);
111 hCorr->SetMarkerStyle(20);
113 hCorr->SetAxisRange(0.,30.,"X");
114 hCorr->SetMaximum(1.1);
115 hCorr->SetMinimum(0);
119 hTM ->SetMarkerColor(2);
120 hTM ->SetMarkerStyle(21);
125 hShSh->SetMarkerColor(4);
126 hShSh->SetMarkerStyle(22);
130 TLegend l2(0.45,0.8,0.95,0.93);
131 l2.SetTextSize(0.04);
132 l2.AddEntry(hCorr,"No Exotics + non lin.","P");
133 l2.AddEntry(hTM, "+ Track matching","P");
134 l2.AddEntry(hShSh,"+ #lambda^{2}_{0} < 0.4","P");
140 // Plot track-matching residuals
141 // first test did not have this histogram, add protection
142 TH2F* hTrackMatchResEtaPhi = (TH2F*) GetHisto("QA_hTrackMatchedDEtaDPhi");
143 if(hTrackMatchResEtaPhi)
148 hTrackMatchResEtaPhi->SetAxisRange(-0.025,0.025,"X");
149 hTrackMatchResEtaPhi->SetAxisRange(-0.025,0.025,"Y");
150 hTrackMatchResEtaPhi->SetTitleOffset(1.5,"Y");
151 hTrackMatchResEtaPhi->SetTitle("Track-cluster residual #Delta #phi vs #Delta #eta, E > 0.5 GeV");
152 hTrackMatchResEtaPhi->SetXTitle("#Delta #eta");
153 hTrackMatchResEtaPhi->SetYTitle("#Delta #phi");
154 hTrackMatchResEtaPhi->SetZTitle("entries");
155 hTrackMatchResEtaPhi->Draw("colz");
160 TH2F* h2TrackMatchResEtaNeg = (TH2F*) GetHisto("QA_hTrackMatchedDEta");
161 TH2F* h2TrackMatchResEtaPos = (TH2F*) GetHisto("QA_hTrackMatchedDEtaPos");
162 TH2F* h2TrackMatchResPhiNeg = (TH2F*) GetHisto("QA_hTrackMatchedDPhi");
163 TH2F* h2TrackMatchResPhiPos = (TH2F*) GetHisto("QA_hTrackMatchedDPhiPos");
165 h2TrackMatchResEtaNeg->Add(h2TrackMatchResEtaPos,-1);
166 h2TrackMatchResPhiNeg->Add(h2TrackMatchResPhiPos,-1);
168 Float_t binMin = hCorr->FindBin(0.5);
169 TH1F* hTrackMatchResEtaNeg = (TH1F*) h2TrackMatchResEtaNeg->ProjectionY("TMProjEtaNeg",binMin, 1000);
170 TH1F* hTrackMatchResEtaPos = (TH1F*) h2TrackMatchResEtaPos->ProjectionY("TMProjEtaPos",binMin, 1000);
171 TH1F* hTrackMatchResPhiNeg = (TH1F*) h2TrackMatchResPhiNeg->ProjectionY("TMProjPhiNeg",binMin, 1000);
172 TH1F* hTrackMatchResPhiPos = (TH1F*) h2TrackMatchResPhiPos->ProjectionY("TMProjPhiPos",binMin, 1000);
174 hTrackMatchResEtaNeg->SetXTitle("#Delta #eta, #Delta #phi");
175 hTrackMatchResEtaNeg->SetYTitle("entries");
176 hTrackMatchResEtaNeg->SetTitle("Track-cluster residuals, E > 1 GeV");
177 hTrackMatchResEtaNeg->SetAxisRange(-0.05,0.05,"X");
178 hTrackMatchResEtaNeg->Sumw2();
179 hTrackMatchResEtaNeg->SetMarkerStyle(25);
180 hTrackMatchResEtaNeg->SetMarkerColor(2);
181 hTrackMatchResEtaNeg->Draw("");
183 hTrackMatchResEtaPos->Sumw2();
184 hTrackMatchResEtaPos->SetMarkerStyle(25);
185 hTrackMatchResEtaPos->SetMarkerColor(4);
186 hTrackMatchResEtaPos->Draw("same");
188 hTrackMatchResPhiNeg->Sumw2();
189 hTrackMatchResPhiNeg->SetMarkerStyle(24);
190 hTrackMatchResPhiNeg->SetMarkerColor(2);
191 hTrackMatchResPhiNeg->Draw("same");
193 hTrackMatchResPhiPos->Sumw2();
194 hTrackMatchResPhiPos->SetMarkerStyle(24);
195 hTrackMatchResPhiPos->SetMarkerColor(4);
196 hTrackMatchResPhiPos->Draw("same");
198 TLine l0(0,hTrackMatchResEtaNeg->GetMinimum(),0,hTrackMatchResEtaNeg->GetMaximum()*1.2);
201 TLegend l3(0.55,0.7,0.83,0.85);
202 l3.SetTextSize(0.04);
203 l3.AddEntry(hTrackMatchResEtaNeg,"#Delta #eta, Negative","P");
204 l3.AddEntry(hTrackMatchResEtaPos,"#Delta #eta, Positive","P");
205 l3.AddEntry(hTrackMatchResPhiNeg,"#Delta #phi, Negative","P");
206 l3.AddEntry(hTrackMatchResPhiPos,"#Delta #phi, Positive","P");
211 ccalo->Print(Form("%s_CaloHisto.eps",histoTag.Data()));
214 TCanvas * ccalo2 = new TCanvas(Form("CaloHisto2_%s",histoTag.Data()),"",500,500);
219 // TH2F* hCellAmpId = (TH2F*) GetHisto("QA_hAmpId");
220 // hCellAmpId->SetTitle("Cell Id vs energy");
221 // hCellAmpId->SetYTitle("Cell Id");
222 // //hCellAmpId->SetAxisRange(300.,900.,"Y");
223 // hCellAmpId->SetAxisRange(0.,30.,"X");
224 // hCellAmpId->SetTitleOffset(1.5,"Y");
225 // hCellAmpId->Draw("colz");
229 TH2F* hClusterTime = (TH2F*) GetHisto("QA_hClusterTimeEnergy");
230 hClusterTime->SetTitle("Cluster energy vs time");
231 hClusterTime->SetYTitle("time (ns)");
232 hClusterTime->SetAxisRange(300.,900.,"Y");
233 hClusterTime->SetAxisRange(0.,30.,"X");
234 hClusterTime->SetTitleOffset(1.5,"Y");
235 hClusterTime->Draw("colz");
239 TH2F* hCellActivity = (TH2F*) GetHisto("QA_hGridCells");
240 hCellActivity->SetTitle("Hits per cell (E > 0.2 GeV)");
241 hCellActivity->SetTitleOffset(1.5,"Y");
242 hCellActivity->Draw("colz");
246 TH2F* hCellActivity = (TH2F*) GetHisto("QA_hGridCells");
247 TH2F* hCellActivityE = (TH2F*) GetHisto("QA_hGridCellsE");
248 hCellActivityE->SetTitle("Mean energy per cell (E > 0.2 GeV)");
249 hCellActivityE->Divide(hCellActivity);
250 hCellActivityE->SetTitleOffset(1.5,"Y");
251 hCellActivityE->Draw("colz");
255 TH2F* hClusterActivity = (TH2F*) GetHisto("AnaPhoton_hEtaPhi");
256 hClusterActivity->SetTitle("Clusters activity (E > 0.5 GeV)");
257 hClusterActivity->SetTitleOffset(1.5,"Y");
258 hClusterActivity->Draw("colz");
260 ccalo2->Print(Form("%s_CaloHisto2.eps",histoTag.Data()));
267 // Basic hybrid tracks histograms
269 TCanvas * ctrack = new TCanvas(Form("TrackHisto_%s",histoTag.Data()),"",1000,500);
274 TH2F * hTrackEtaPhi = (TH2F*) GetHisto("AnaHadrons_hEtaPhiNegative");
275 hTrackEtaPhi ->Add((TH2F*) GetHisto("AnaHadrons_hEtaPhiNegative"));
276 hTrackEtaPhi ->SetAxisRange(-0.9,0.9,"X");
277 hTrackEtaPhi ->SetTitle("Hybrid tracks #eta vs #phi (p_{T} > 0.2 GeV)");
278 hTrackEtaPhi ->Draw("colz");
282 TH2F * hTrackEtaPhiSPD = (TH2F*) GetHisto("AnaHadrons_hEtaPhiSPDRefitPt02");
283 TH2F * hTrackEtaPhiNoSPD = (TH2F*) GetHisto("AnaHadrons_hEtaPhiNoSPDRefitPt02");
285 TH1F* hPhiSPD = (TH1F*)hTrackEtaPhiSPD ->ProjectionY("hTrackPhiSPD" ,0,1000);
286 TH1F* hPhiNoSPD = (TH1F*)hTrackEtaPhiNoSPD->ProjectionY("hTrackPhiNoSPD",0,1000);
287 //TH1F* hPhi = (TH1F*)hTrackEtaPhi ->ProjectionY("hTrackPhi" ,0,1000);
288 TH1F* hPhi = hPhiSPD->Clone("hTrackPhi");
289 hPhi->Add(hPhiNoSPD);
290 hPhi ->SetTitle("Hybrid track in #phi, composition, p_{T} > 0.2 GeV");
291 hPhi ->SetLineColor(1);
292 hPhiSPD ->SetLineColor(2);
293 hPhiNoSPD->SetLineColor(4);
295 hPhi ->SetMinimum(1);
296 hPhi ->SetMaximum(hPhi->GetMaximum()*1.2);
299 hPhiSPD ->Draw("Hsame");
300 hPhiNoSPD->Draw("Hsame");
302 TLegend l(0.2,0.75,0.4,0.89);
304 l.AddEntry(hPhi,"Sum","L");
305 l.AddEntry(hPhiSPD ,"SPD+Refit","L");
306 l.AddEntry(hPhiNoSPD,"No SPD+Refit","L");
313 // TH2F* hPtDCAxy = (TH2F*) GetHisto("AnaHadrons_hPtDCAxy");
314 // hPtDCAxy->SetAxisRange(-1,1,"Y");
315 // hPtDCAxy->SetAxisRange(0,30,"X");
316 // hPtDCAxy->Draw("colz");
321 // TH2F* hPtDCAz = (TH2F*) GetHisto("AnaHadrons_hPtDCAz");
322 // hPtDCAz->SetAxisRange(-1,1,"Y");
323 // hPtDCAz->SetAxisRange(0,30,"X");
324 // hPtDCAz->Draw("colz");
326 ctrack->Print(Form("%s_TrackHisto.eps",histoTag.Data()));
333 // Basic invariant mass QA
335 TCanvas * cpi0 = new TCanvas(Form("Pi0Histo_%s",histoTag.Data()),"",500,500);
340 for(Int_t icen = 0; icen < 10; icen++)
342 hMassE [icen] = (TH2F*) GetHisto(Form("AnaPi0_hRe_cen%d_pidbit0_asy1_dist1",icen));
343 hMixMassE[icen] = (TH2F*) GetHisto(Form("AnaPi0_hMi_cen%d_pidbit0_asy1_dist1",icen));
346 // 2D Invariant mass vs E, in PbPb from 60 to 100 %, all in pp
351 if(hMassE[1]) // Plot centrality from 60 to 100%
353 h2DMass = (TH2F*) hMassE[6]->Clone("h2DMass");
354 for(Int_t icen = 7; icen < 10; icen++) h2DMass->Add(hMassE[icen]);
355 h2DMass->SetTitle("Invariant mass vs pair E, Cen: 60-100%");
359 h2DMass = (TH2F*) hMassE[0]->Clone("hMassProj");
360 h2DMass->SetTitle("Invariant mass vs cluster pair E");
363 h2DMass->SetTitleOffset(1.6,"Y");
364 h2DMass->SetAxisRange(0.0,0.7,"Y");
365 h2DMass->SetAxisRange(0,30,"X");
366 h2DMass->Draw("colz");
368 // Pi0 Invariant mass projection, in PbPb 6 centrality bins from 0 to 50%, all in pp
376 for(Int_t icen=0; icen<10; icen++ )
384 TH1F * hX = (TH1F*) hMassE[0]->ProjectionX("hEPairCen0",0,10000);
385 Int_t binmin = hX->FindBin(2); // Project histo from 2 GeV pairs
386 Int_t binmax = hX->FindBin(10); // Project histo up to 10 GeV pairs
389 for(Int_t icen = 0; icen < 6; icen++)
391 if(!hMassE[icen]) continue;
393 hMass[icen] = (TH1F*) hMassE [icen]->ProjectionY(Form("hMassCen%d",icen),binmin,binmax);
394 hMix [icen] = (TH1F*) hMixMassE[icen]->ProjectionY(Form("hMixCen%d" ,icen),binmin,binmax);
395 hMass[icen]->Sumw2();
396 hMix [icen]->Sumw2();
398 hMassPi0[icen] = (TH1F*) hMass[icen]->Clone(Form("hMassPi0Cen%d",icen));
399 hMassEta[icen] = (TH1F*) hMass[icen]->Clone(Form("hMassEtaCen%d",icen));
401 hMassPi0[icen]->Divide(hMix[icen]);
402 hMassPi0[icen]->Fit("pol0","Q","",0.25,0.35);
404 if(hMassPi0[icen]->GetFunction("pol0")) scale = hMassPi0[icen]->GetFunction("pol0")->GetParameter(0);
405 //printf("Scale factor %f for cen %d\n",scale,icen);
406 hMassPi0[icen]->Scale(1./scale);
407 hMassPi0[icen]->SetMarkerStyle(24);
408 hMassPi0[icen]->SetMarkerColor(color[icen]);
409 hMassPi0[icen]->SetLineColor(color[icen]);
410 hMassPi0[icen]->SetAxisRange(0.04,0.24);
411 hMassPi0[icen]->SetMarkerSize(0.5);
413 hMassEta[icen]->Rebin(4);
414 hMix [icen]->Rebin(4);
415 hMassEta[icen]->Divide(hMix[icen]);
416 hMassEta[icen]->SetMarkerStyle(25);
417 hMassEta[icen]->SetMarkerColor(color[icen]);
418 hMassEta[icen]->SetLineColor(color[icen]);
419 hMassEta[icen]->SetAxisRange(0.4,0.9);
420 hMassEta[icen]->SetMarkerSize(0.5);
421 hMassEta[icen]->Scale(1./scale);
423 if(maxEta < hMassEta[icen]->GetMaximum()) maxEta = hMassEta[icen]->GetMaximum();
424 if(maxPi0 < hMassPi0[icen]->GetMaximum()) maxPi0 = hMassPi0[icen]->GetMaximum();
429 hMassPi0[0]->SetMinimum(0.8);
430 hMassPi0[0]->SetTitleOffset(1.6,"Y");
431 hMassPi0[0]->SetYTitle("Real / Mixed");
432 hMassPi0[0]->SetTitle("#pi^{0} peak, 2 < E_{pair}< 10 GeV");
437 hMassPi0[0]->SetMaximum(maxPi0*1.2);
438 hMassPi0[5]->Draw("Hsame");
439 hMassPi0[4]->Draw("Hsame");
440 hMassPi0[3]->Draw("Hsame");
441 hMassPi0[2]->Draw("Hsame");
442 hMassPi0[1]->Draw("Hsame");
443 hMassPi0[0]->Draw("Hsame");
444 //hMass[6]->Draw("Hsame");
445 //hMass[7]->Draw("same");
446 //hMass[8]->Draw("same");
447 //hMass[9]->Draw("same");
449 TLegend l(0.12,0.6,0.4,0.85);
451 l.AddEntry(hMassPi0[0],"0-10%","P");
452 l.AddEntry(hMassPi0[1],"10-20%","P");
453 l.AddEntry(hMassPi0[2],"20-30%","P");
454 l.AddEntry(hMassPi0[3],"30-40%","P");
455 l.AddEntry(hMassPi0[4],"40-70%","P");
456 l.AddEntry(hMassPi0[5],"50-60%","P");
462 TLine l1(0.04,1,0.24,1);
465 // Pi0 invariant mass per EMCal super module
470 binmin = hX->FindBin(4); // Project histo from 3 GeV pairs
471 binmax = hX->FindBin(20); // Project histo up to 20 GeV pairs
474 for(Int_t ism = 0; ism < 10; ism++)
476 TH2F* hTmpSM = (TH2F*) GetHisto(Form("AnaPi0_hReMod_%d",ism));
477 if(!hTmpSM) hTmpSM = (TH2F*) GetHisto(Form("QA_hIM_Mod%d",ism));
479 hSM[ism] = (TH1F*) hTmpSM->ProjectionY(Form("hMassSM%d",ism),binmin,binmax);
481 hSM[ism]->SetMarkerStyle(26);
483 //hSM[ism]->Scale(1./hSM[ism]->Integral(0,10000));
484 hSM[ism]->SetMarkerColor(color[ism]);
485 hSM[ism]->SetLineColor(color[ism]);
486 hSM[ism]->SetMarkerSize(0.5);
488 TH2F* hTmpMixSM = (TH2F*) GetHisto(Form("AnaPi0_hMiMod_%d",ism));
491 hMixSM[ism] = (TH1F*) hTmpMixSM->ProjectionY(Form("hMassMixSM%d",ism),binmin,binmax);
492 hMixSM[ism]->Sumw2();
493 hMixSM[ism]->Rebin(2);
494 hSM[ism]->Divide(hMixSM[ism]);
495 hSM[ism]->Fit("pol0","Q","",0.25,0.35);
497 if(hSM[ism]->GetFunction("pol0")) scale = hSM[ism]->GetFunction("pol0")->GetParameter(0);
498 //printf("Scale factor %f for cen %d\n",scale,icen);
499 hSM[ism]->Scale(1./scale);
500 hSM[ism]->SetYTitle("Real / Mixed");
504 if(maxSM < hSM[ism]->GetMaximum()) maxSM = hSM[ism]->GetMaximum();
508 hSM[0]->SetTitle("#pi^{0} peak in Modules, 4 < E_{pair}< 10 GeV");
509 hSM[0]->SetTitleOffset(1.6,"Y");
510 hSM[0]->SetAxisRange(0.04,0.24);
511 hSM[0]->SetMaximum(maxSM*1.2);
512 hSM[0]->SetMinimum(0.8);
515 TLegend lsm(0.12,0.5,0.35,0.85);
516 lsm.SetTextSize(0.04);
517 lsm.AddEntry(hSM[0],Form("Mod %d",0),"P");
519 for(Int_t ism = 1; ism < 10; ism++)
521 hSM[ism]->Draw("Hsame");
522 lsm.AddEntry(hSM[ism],Form("Mod %d",ism),"P");
525 lsm.SetBorderSize(0);
531 // Pi0 Invariant mass projection, in PbPb 6 centrality bins from 0 to 50%, all in pp
536 hMassEta[0]->SetMinimum(0.8);
537 hMassEta[0]->SetTitleOffset(1.6,"Y");
538 hMassEta[0]->SetYTitle("Real / Mixed");
539 hMassEta[0]->SetTitle("#eta peak, 2 < E_{pair}< 10 GeV");
540 hMassEta[0]->Draw("H");
544 hMassEta[0]->SetMaximum(maxEta*1.2);
545 hMassEta[5]->Draw("Hsame");
546 hMassEta[4]->Draw("Hsame");
547 hMassEta[3]->Draw("Hsame");
548 hMassEta[2]->Draw("Hsame");
549 hMassEta[1]->Draw("Hsame");
550 hMassEta[0]->Draw("Hsame");
553 TLegend l2(0.12,0.6,0.4,0.85);
554 l2.SetTextSize(0.04);
555 l2.AddEntry(hMassEta[0],"0-10%","P");
556 l2.AddEntry(hMassEta[1],"10-20%","P");
557 l2.AddEntry(hMassEta[2],"20-30%","P");
558 l2.AddEntry(hMassEta[3],"30-40%","P");
559 l2.AddEntry(hMassEta[4],"40-70%","P");
560 l2.AddEntry(hMassEta[5],"50-60%","P");
566 cpi0->Print(Form("%s_Pi0Histo.eps",histoTag.Data()));
574 TCanvas * cCorrelation = new TCanvas(Form("CorrelationHisto_%s",histoTag.Data()),"",1000,500);
575 cCorrelation->Divide(2,1);
577 Float_t minClusterE = 8;
578 Float_t assocBins[] = {0.5,2.,5.,10.,20.};
579 Int_t nAssocBins = 4;
581 TH1F * hLeading = (TH1F*) GetHisto("AnaPhotonHadronCorr_hPtLeading");
582 Int_t minClusterEBin = hLeading->FindBin(minClusterE);
583 Float_t nTrig = hLeading->Integral(minClusterE,100000);
585 //Azimuthal correlation
590 TLegend l(0.35,0.6,0.83,0.85);
591 l.SetHeader(Form("p_{T,T} > %2.1f GeV/c",minClusterE));
596 for(Int_t ibin = 0; ibin < nAssocBins; ibin++ )
598 TH2F* hDeltaPhiE = (TH2F*) GetHisto(Form("AnaPhotonHadronCorr_hDeltaPhiPtAssocPt%2.1f_%2.1f",assocBins[ibin],assocBins[ibin+1]));
599 hDeltaPhi[ibin] = (TH1F*) hDeltaPhiE->ProjectionY(Form("DeltaPhi%2.1f",assocBins[ibin]),minClusterEBin,10000);
600 hDeltaPhi[ibin]->Sumw2();
601 hDeltaPhi[ibin]->Rebin(2);
602 hDeltaPhi[ibin]->Scale(1./nTrig);
604 hDeltaPhi[ibin]->Fit("pol0","Q","",1,2);
606 if(hDeltaPhi[ibin]->GetFunction("pol0"))
608 scale = hDeltaPhi[ibin]->GetFunction("pol0")->GetParameter(0);
609 hDeltaPhi[ibin]->GetFunction("pol0")->SetRange(6,7); // move from plot
611 hDeltaPhi[ibin]->Scale(1./scale);
612 //printf("ibin %d, scale %f\n",ibin,scale);
614 hDeltaPhi[ibin]->SetAxisRange(-1.6,4.7);
616 hDeltaPhi[ibin]->SetMarkerStyle(24);
617 hDeltaPhi[ibin]->SetMarkerColor(color[ibin]);
618 hDeltaPhi[ibin]->SetLineColor(color[ibin]);
619 hDeltaPhi[ibin]->SetTitleOffset(1.5,"Y");
620 hDeltaPhi[ibin]->SetYTitle("N_{pairs} / N_{trig} / ZYAM");
621 hDeltaPhi[ibin]->SetTitle("#gamma (#lambda_{0}^{2} < 0.4, neutral cluster) trigger");
623 l.AddEntry(hDeltaPhi[ibin],Form("%2.1f< p_{T,A}< %2.1f GeV/c",assocBins[ibin],assocBins[ibin+1]),"P");
627 hDeltaPhi[2]->SetMaximum(hDeltaPhi[2]->GetMaximum()*10);
628 hDeltaPhi[2]->SetMinimum(0.8);
630 hDeltaPhi[2]->Draw("H");
631 hDeltaPhi[1]->Draw("Hsame");
632 hDeltaPhi[3]->Draw("Hsame");
633 hDeltaPhi[0]->Draw("Hsame");
642 TLegend l2(0.35,0.6,0.83,0.85);
643 l2.SetHeader(Form("p_{T,T} > %2.1f GeV/c",minClusterE));
644 l2.SetTextSize(0.04);
648 TH2F* hEXE = (TH2F*) GetHisto("AnaPhotonHadronCorr_hXECharged");
649 TH2F* hEXEUE = (TH2F*) GetHisto("AnaPhotonHadronCorr_hXEUeCharged");
651 TH1F* hXE = (TH1F*) hEXE->ProjectionY(Form("XE%2.1fGeV",minClusterE),minClusterEBin,10000);
654 hXE->Scale(1./nTrig);
655 hXE->SetAxisRange(0,1);
656 hXE->SetMarkerStyle(24);
657 hXE->SetMarkerColor(1);
658 hXE->SetLineColor(1);
659 hXE->SetTitleOffset(1.5,"Y");
660 hXE->SetYTitle("N_{pairs} / N_{trig}");
661 hXE->SetTitle("#gamma (#lambda_{0}^{2} < 0.4, neutral cluster) trigger");
662 l2.AddEntry(hXE,"raw x_{E}","P");
665 TH1F* hXEUE = (TH1F*) hEXEUE->ProjectionY(Form("XEUE%2.1fGeV",minClusterE),minClusterEBin,10000);
668 hXEUE->Scale(1./nTrig);
669 hXEUE->SetAxisRange(0,1);
670 hXEUE->SetMarkerStyle(25);
671 hXEUE->SetMarkerColor(2);
672 hXEUE->SetLineColor(2);
673 l2.AddEntry(hXEUE,"raw Und. Event x_{E}","P");
680 cCorrelation->Print(Form("%s_CorrelationHisto.eps",histoTag.Data()));
687 // Basic calorimeter QA histograms
689 TH2F* h2ClusterPho = (TH2F*) GetHisto("QA_hRecoMCE_Photon_Match0"); // not track-matched
690 TH2F* h2ClusterPi0 = (TH2F*) GetHisto("QA_hRecoMCE_Pi0_Match0"); // not track-matched
691 TH2F* h2ClusterEta = (TH2F*) GetHisto("QA_hRecoMCE_Eta_Match0"); // not track-matched
692 TH2F* h2ClusterEle = (TH2F*) GetHisto("QA_hRecoMCE_Electron_Match1"); // Track-matched
694 if(!h2ClusterPho) return;
697 TH1F* hPrimPho = (TH1F*) GetHisto("QA_hGenMCAccE_Photon");
698 TH1F* hPrimPi0 = (TH1F*) GetHisto("QA_hGenMCAccE_Pi0");
699 TH1F* hPrimEta = (TH1F*) GetHisto("QA_hGenMCAccE_Eta");
701 TCanvas * cmc = new TCanvas(Form("MCHisto_%s",histoTag.Data()),"",1000,1000);
707 TH1F* hClusterPho = (TH1F*) h2ClusterPho->ProjectionX("ClusterPho",0,1000);
708 TH1F* hClusterPi0 = (TH1F*) h2ClusterPi0->ProjectionX("ClusterPi0",0,1000);
709 TH1F* hClusterEta = (TH1F*) h2ClusterEta->ProjectionX("ClusterEta",0,1000);
711 hClusterPho->SetTitle("Cluster origin spectra, primary spectra in Calo acceptance");
712 hClusterPho->Sumw2();
713 hClusterPho->SetMarkerColor(1);
714 hClusterPho->SetMarkerStyle(20);
715 hClusterPho->SetAxisRange(0.,50.,"X");
716 hClusterPho->SetXTitle("E_{rec,gen} (GeV)");
717 hClusterPho->Draw("");
719 hClusterPi0->Sumw2();
720 hClusterPi0->SetMarkerColor(4);
721 hClusterPi0->SetMarkerStyle(21);
722 hClusterPi0->Draw("same");
724 hClusterEta->Sumw2();
725 hClusterEta->SetMarkerColor(2);
726 hClusterEta->SetMarkerStyle(22);
727 hClusterEta->Draw("same");
730 hPrimPho->SetMarkerColor(1);
731 hPrimPho->SetMarkerStyle(24);
732 hPrimPho->Draw("same");
735 hPrimPi0->SetMarkerColor(4);
736 hPrimPi0->SetMarkerStyle(25);
737 hPrimPi0->Draw("same");
740 hPrimEta->SetMarkerColor(2);
741 hPrimEta->SetMarkerStyle(26);
742 hPrimEta->Draw("same");
744 TLegend l(0.45,0.6,0.83,0.89);
746 l.AddEntry(hClusterPho,"#gamma cluster","P");
747 l.AddEntry(hClusterPi0,"#pi^{0} (merged) cluster","P");
748 l.AddEntry(hClusterEta,"#eta (merged) cluster","P");
749 l.AddEntry(hPrimPho,"#gamma generated","P");
750 l.AddEntry(hPrimPi0,"#pi^{0} generated","P");
751 l.AddEntry(hPrimEta,"#eta generated","P");
759 TH1F* hRatPho = (TH1F*) hClusterPho->Clone("hGenRecoPho");
760 TH1F* hRatPi0 = (TH1F*) hClusterPi0->Clone("hGenRecoPi0");
761 TH1F* hRatEta = (TH1F*) hClusterEta->Clone("hGenRecoEta");
763 hRatPho->Divide(hPrimPho);
764 hRatPi0->Divide(hPrimPi0);
765 hRatEta->Divide(hPrimEta);
767 hRatPho->SetTitle("Reconstructed cluster / Generated particle in Calo acc.");
768 hRatPho->SetYTitle("Ratio");
769 hRatPho->SetXTitle("E(GeV)");
770 hRatPho->SetMinimum(1e-3);
771 hRatPho->SetMaximum(10);
773 hRatPi0->Draw("same");
774 hRatEta->Draw("same");
776 TLegend l2(0.15,0.7,0.3,0.85);
777 l2.SetTextSize(0.04);
778 l2.AddEntry(hRatPho,"#gamma","P");
779 l2.AddEntry(hRatPi0,"#pi^{0}","P");
780 l2.AddEntry(hRatEta,"#eta","P");
788 TH2F* h2PrimPhoPhi = (TH2F*) GetHisto("AnaPhoton_hPhiPrim_MCPhoton");
789 TH2F* h2PrimPi0Phi = (TH2F*) GetHisto("AnaPi0_hPrimPi0Phi");
790 TH2F* h2PrimEtaPhi = (TH2F*) GetHisto("AnaPi0_hPrimEtaPhi");
792 Int_t binMin = hPrimPho->FindBin(3);
794 TH1F* hPrimPhoPhi = (TH1F*) h2PrimPhoPhi->ProjectionY("PrimPhoPhi",binMin,1000);
795 TH1F* hPrimPi0Phi = (TH1F*) h2PrimPi0Phi->ProjectionY("PrimPi0Phi",binMin,1000);
796 TH1F* hPrimEtaPhi = (TH1F*) h2PrimEtaPhi->ProjectionY("PrimEtaPhi",binMin,1000);
798 hPrimPhoPhi->Scale(1./hPrimPhoPhi->Integral(0,1000));
799 hPrimPi0Phi->Scale(1./hPrimPi0Phi->Integral(0,1000));
800 hPrimEtaPhi->Scale(1./hPrimEtaPhi->Integral(0,1000));
802 Float_t maxPhi = hPrimPhoPhi->GetMaximum();
803 if(maxPhi < hPrimPi0Phi->GetMaximum()) maxPhi = hPrimPi0Phi->GetMaximum();
804 if(maxPhi < hPrimEtaPhi->GetMaximum()) maxPhi = hPrimEtaPhi->GetMaximum();
806 Float_t minPhi = hPrimPhoPhi->GetMinimum();
807 if(minPhi > hPrimPi0Phi->GetMinimum()) minPhi = hPrimPi0Phi->GetMinimum();
808 if(minPhi > hPrimEtaPhi->GetMinimum()) minPhi = hPrimEtaPhi->GetMinimum();
810 hPrimPi0Phi->SetMaximum(maxPhi*1.1);
811 hPrimPi0Phi->SetMinimum(minPhi);
812 TGaxis::SetMaxDigits(3);
814 hPrimPi0Phi->SetYTitle("1/total entries dN/d#phi");
815 hPrimPi0Phi->SetTitle("Generated particles #phi for E > 3 GeV");
816 hPrimPi0Phi->SetTitleOffset(1.6,"Y");
817 hPrimPi0Phi->Sumw2();
818 hPrimPi0Phi->SetMarkerColor(4);
819 hPrimPi0Phi->SetMarkerStyle(21);
820 hPrimPi0Phi->Draw("");
822 hPrimPhoPhi->Sumw2();
823 hPrimPhoPhi->SetMarkerColor(1);
824 hPrimPhoPhi->SetMarkerStyle(20);
825 Float_t scale = TMath::RadToDeg();
826 ScaleXaxis(hPrimPhoPhi, TMath::RadToDeg());
827 hPrimPhoPhi->Draw("same");
830 hPrimEtaPhi->Sumw2();
831 hPrimEtaPhi->SetMarkerColor(2);
832 hPrimEtaPhi->SetMarkerStyle(22);
833 hPrimEtaPhi->Draw("same");
838 TH2F* h2PrimPhoEta = (TH2F*) GetHisto("AnaPhoton_hYPrim_MCPhoton");
839 TH2F* h2PrimPi0Eta = (TH2F*) GetHisto("AnaPi0_hPrimPi0Rapidity");
840 TH2F* h2PrimEtaEta = (TH2F*) GetHisto("AnaPi0_hPrimEtaRapidity");
842 Int_t binMin = hPrimPho->FindBin(3);
844 TH1F* hPrimPhoEta = (TH1F*) h2PrimPhoEta->ProjectionY("PrimPhoEta",binMin,1000);
845 TH1F* hPrimPi0Eta = (TH1F*) h2PrimPi0Eta->ProjectionY("PrimPi0Eta",binMin,1000);
846 TH1F* hPrimEtaEta = (TH1F*) h2PrimEtaEta->ProjectionY("PrimEtaEta",binMin,1000);
848 hPrimPhoEta->Scale(1./hPrimPhoEta->Integral(0,1000));
849 hPrimPi0Eta->Scale(1./hPrimPi0Eta->Integral(0,1000));
850 hPrimEtaEta->Scale(1./hPrimEtaEta->Integral(0,1000));
852 Float_t maxEta = hPrimPhoEta->GetMaximum();
853 if(maxEta < hPrimPi0Eta->GetMaximum()) maxEta = hPrimPi0Eta->GetMaximum();
854 if(maxEta < hPrimEtaEta->GetMaximum()) maxEta = hPrimEtaEta->GetMaximum();
856 Float_t minEta = hPrimPhoEta->GetMinimum();
857 if(minEta > hPrimPi0Eta->GetMinimum()) minEta = hPrimPi0Eta->GetMinimum();
858 if(minEta > hPrimEtaEta->GetMinimum()) minEta = hPrimEtaEta->GetMinimum();
860 hPrimPi0Eta->SetMaximum(maxEta*1.1);
861 hPrimPi0Eta->SetMinimum(minEta);
862 TGaxis::SetMaxDigits(3);
864 hPrimPi0Eta->SetYTitle("1/total entries dN/d#eta");
865 hPrimPi0Eta->SetTitle("Generated particles #eta for E > 3 GeV");
866 hPrimPi0Eta->SetTitleOffset(1.6,"Y");
867 hPrimPi0Eta->Sumw2();
868 hPrimPi0Eta->SetMarkerColor(4);
869 hPrimPi0Eta->SetMarkerStyle(21);
870 hPrimPi0Eta->Draw("");
872 hPrimPhoEta->Sumw2();
873 hPrimPhoEta->SetMarkerColor(1);
874 hPrimPhoEta->SetMarkerStyle(20);
875 Float_t scale = TMath::RadToDeg();
876 hPrimPhoEta->Draw("same");
878 hPrimEtaEta->Sumw2();
879 hPrimEtaEta->SetMarkerColor(2);
880 hPrimEtaEta->SetMarkerStyle(22);
881 hPrimEtaEta->Draw("same");
883 cmc->Print(Form("%s_MCHisto.eps",histoTag.Data()));
891 //____________________________________________________________________
892 void GetFileAndList(TString fileName, TString listName, Bool_t export)
894 file = new TFile(fileName,"read");
896 TDirectory * dir = (TDirectory*) file->Get(listName);
899 list = (TList*) dir->Get(listName);
902 TFile * outputFile = new TFile("AnalysisResultsList.root","RECREATE");
909 //___________________________________
910 TObject * GetHisto(TString histoName)
912 // Check if the list is available, if not get the histo directly from file
914 if(list) return list->FindObject(histoName);
915 else return file->Get (histoName);
918 //___________________________________________________
919 void ScaleAxis(TAxis *a, Double_t scale)
921 if (!a) return; // just a precaution
922 if (a->GetXbins()->GetSize())
924 // an axis with variable bins
925 // note: bins must remain in increasing order, hence the "Scale"
926 // function must be strictly (monotonically) increasing
927 TArrayD X(*(a->GetXbins()));
928 for(Int_t i = 0; i < X.GetSize(); i++) X[i] = scale*X[i];
929 a->Set((X.GetSize() - 1), X.GetArray()); // new Xbins
933 // an axis with fix bins
934 // note: we modify Xmin and Xmax only, hence the "Scale" function
935 // must be linear (and Xmax must remain greater than Xmin)
936 a->Set(a->GetNbins(),
937 scale*a->GetXmin(), // new Xmin
938 scale*a->GetXmax()); // new Xmax
943 //___________________________________________________
944 void ScaleXaxis(TH1 *h, Double_t scale)
946 if (!h) return; // just a precaution
947 ScaleAxis(h->GetXaxis(), scale);