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