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