]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGGA/CaloTrackCorrelations/macros/QA/DrawAnaCaloTrackQA.C
a630777c1bf81b7c85572f6f43e2fbebfc547845
[u/mrichter/AliRoot.git] / PWGGA / CaloTrackCorrelations / macros / QA / DrawAnaCaloTrackQA.C
1 ///////////////////////////////////////////
2 //
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
8 //
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
12 //
13 // Author: Gustavo.Conesa.Balbastre@cern.ch
14 //
15 //
16
17 // Some global variables
18 TList *list = 0;
19 TFile *file = 0;
20 TString histoTag = "";
21 Int_t color[]={kBlack,kRed,kOrange+1,kYellow+1,kGreen+2,kBlue,kCyan+1,kViolet,kMagenta+2,kGray};
22
23 //_______________________________________________________________________
24 void DrawAnaCaloTrackQA(TString listName = "Pi0IM_GammaTrackCorr_EMCAL_default",
25                         TString fileName = "AnalysisResultsQATrain.root",
26                         Bool_t export = kFALSE)
27 {
28
29   printf("Open <%s>; Get List : <%s>; Export list? <%d>\n",fileName.Data(),listName.Data(),export);
30   
31   histoTag = listName;
32   
33   //Access the file and list of histograms, global variables
34   GetFileAndList(fileName, listName, export);
35   
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);
43
44   //Plot basic Calorimeter QA
45   CaloQA();
46
47   //Plot basic Track QA
48   TrackQA();
49
50   //Plot basic Pi0 QA
51   Pi0QA();
52
53   //Plot basic correlation QA
54   CorrelationQA();
55   
56 }
57
58 //___________
59 void CaloQA()
60 {
61   // Basic calorimeter QA histograms
62   
63   TCanvas * ccalo = new TCanvas(Form("CaloHisto_%s",histoTag.Data()),"",1000,1000);
64   ccalo->Divide(2,2);
65   
66   ccalo->cd(1);
67   gPad->SetLogy();
68   
69   TH1F* hCellAmplitude = (TH1F*) GetHisto("QA_hAmplitude");
70   TH1F* hClusterEnergy = (TH1F*) GetHisto("QA_hE");
71   
72   hClusterEnergy->SetTitle("Cluster-cell energy spectra");
73   hClusterEnergy->Sumw2();
74   hClusterEnergy->SetMarkerColor(1);
75   hClusterEnergy->SetMarkerStyle(20);
76   hClusterEnergy->SetAxisRange(0.,50.,"X");
77   hClusterEnergy->Draw();
78   
79   hCellAmplitude->Sumw2();
80   hCellAmplitude->SetMarkerColor(4);
81   hCellAmplitude->SetMarkerStyle(25);
82   hCellAmplitude->Draw("same");
83   
84   TLegend l(0.3,0.7,0.83,0.85);
85   l.SetTextSize(0.04);
86   l.AddEntry(hClusterEnergy,"Cluster (no exotic+non lin)","P");
87   l.AddEntry(hCellAmplitude,"Cell","P");
88   l.SetBorderSize(0);
89   l.SetFillColor(0);
90   l.Draw();
91   
92   
93   ccalo->cd(2);
94   //gPad->SetLogy();
95   
96   TH1F* hRaw  = (TH1F*) GetHisto("AnaPhoton_hCut_0_Open");
97   TH1F* hCorr = (TH1F*) GetHisto("AnaPhoton_hCut_4_NCells");
98   TH1F* hTM   = (TH1F*) GetHisto("AnaPhoton_hCut_7_Matching");
99   TH1F* hShSh = (TH1F*) GetHisto("AnaPhoton_hCut_9_PID");
100   
101   hRaw->Sumw2();
102   
103   hCorr->SetTitle("Ratio after cluster cuts application");
104   hCorr->SetYTitle("Selected clusters / Raw clusters");
105   hCorr->SetTitleOffset(1.5,"Y");
106   hCorr->Sumw2();
107   hCorr->SetMarkerColor(1);
108   hCorr->SetMarkerStyle(20);
109   hCorr->Divide(hRaw);
110   hCorr->SetAxisRange(0.,30.,"X");
111   hCorr->SetMaximum(1);
112   hCorr->SetMinimum(0);
113   hCorr->Draw();
114   
115   hTM  ->Sumw2();
116   hTM  ->SetMarkerColor(2);
117   hTM  ->SetMarkerStyle(21);
118   hTM  ->Divide(hRaw);
119   hTM  ->Draw("same");
120   
121   hShSh->Sumw2();
122   hShSh->SetMarkerColor(4);
123   hShSh->SetMarkerStyle(22);
124   hShSh->Divide(hRaw);
125   hShSh->Draw("same");
126   
127   TLegend l2(0.3,0.7,0.83,0.85);
128   l2.SetTextSize(0.04);
129   l2.AddEntry(hCorr,"No Exotics + non linearity","P");
130   l2.AddEntry(hTM,  "+ Track matching","P");
131   l2.AddEntry(hShSh,"+ #lambda^{2}_{0} < 0.4","P");
132   l2.SetBorderSize(0);
133   l2.SetFillColor(0);
134   l2.Draw();
135   
136   
137   ccalo->cd(3);
138   gPad->SetLogz();
139   
140   TH2F* hClusterTime   = (TH2F*) GetHisto("QA_hClusterTimeEnergy");
141   hClusterTime->SetTitle("Cluster energy vs time");
142   hClusterTime->SetYTitle("time (ns)");
143   hClusterTime->SetAxisRange(300.,900.,"Y");
144   hClusterTime->SetAxisRange(0.,30.,"X");
145   hClusterTime->SetTitleOffset(1.5,"Y");
146   
147   hClusterTime->Draw("colz");
148   
149   ccalo->cd(4);
150   gPad->SetLogz();
151   
152   TH2F* hClusterM02   = (TH2F*) GetHisto("AnaPhoton_hLam0E");
153   hClusterM02->SetTitle("Cluster energy vs #lambda^{2}_{0}");
154   //hClusterM02->SetAxisRange(300.,900.,"Y");
155   hClusterM02->SetAxisRange(0.,30.,"X");
156   hClusterM02->SetTitleOffset(1.5,"Y");
157   hClusterM02->Draw("colz");
158   
159   ccalo->Print(Form("%s_CaloHisto.eps",histoTag.Data()));
160   
161   
162   TCanvas * ccalo2 = new TCanvas(Form("CaloHisto2_%s",histoTag.Data()),"",500,500);
163   ccalo2->Divide(2,2);
164   
165   ccalo2->cd(1);
166   gPad->SetLogz();
167   TH2F* hCellAmpId   = (TH2F*) GetHisto("QA_hAmpId");
168   hCellAmpId->SetTitle("Cell Id vs energy");
169   hCellAmpId->SetYTitle("Cell Id");
170   //hCellAmpId->SetAxisRange(300.,900.,"Y");
171   hCellAmpId->SetAxisRange(0.,30.,"X");
172   hCellAmpId->SetTitleOffset(1.5,"Y");
173   hCellAmpId->Draw("colz");
174   
175   ccalo2->cd(2);
176   
177   TH2F* hCellActivity  = (TH2F*) GetHisto("QA_hGridCells");
178   hCellActivity->SetTitle("Hits per cell (E > 0.2 GeV)");
179   hCellActivity->SetTitleOffset(1.5,"Y");
180   hCellActivity->Draw("colz");
181   
182   ccalo2->cd(3);
183   
184   TH2F* hCellActivity  = (TH2F*) GetHisto("QA_hGridCells");
185   TH2F* hCellActivityE = (TH2F*) GetHisto("QA_hGridCellsE");
186   hCellActivityE->SetTitle("Mean energy per cell (E > 0.2 GeV)");
187   hCellActivityE->Divide(hCellActivity);
188   hCellActivityE->SetTitleOffset(1.5,"Y");
189   hCellActivityE->Draw("colz");
190   
191   ccalo2->cd(4);
192   //gPad->SetLogz();
193   TH2F* hClusterActivity  = (TH2F*) GetHisto("AnaPhoton_hEtaPhi");
194   hClusterActivity->SetTitle("Clusters activity (E > 0.5 GeV)");
195   hClusterActivity->SetTitleOffset(1.5,"Y");
196   hClusterActivity->Draw("colz");
197   
198   ccalo2->Print(Form("%s_CaloHisto2.eps",histoTag.Data()));
199   
200 }
201
202 //____________
203 void TrackQA()
204 {
205   // Basic hybrid tracks histograms
206   
207   TCanvas * ctrack = new TCanvas(Form("TrackHisto_%s",histoTag.Data()),"",1000,500);
208   ctrack->Divide(2,1);
209   
210   ctrack->cd(1);
211   //gPad->SetLogz();
212   TH2F * hTrackEtaPhi = (TH2F*) GetHisto("AnaHadrons_hEtaPhiNegative");
213   hTrackEtaPhi ->Add((TH2F*) GetHisto("AnaHadrons_hEtaPhiNegative"));
214   hTrackEtaPhi ->SetAxisRange(-0.9,0.9,"X");
215   hTrackEtaPhi ->SetTitle("Hybrid tracks #eta vs #phi (p_{T} > 0.2 GeV)");
216   hTrackEtaPhi ->Draw("colz");
217   
218   ctrack->cd(2);
219   //gPad->SetLogy();
220   TH2F * hTrackEtaPhiSPD   = (TH2F*) GetHisto("AnaHadrons_hEtaPhiSPDRefitPt02");
221   TH2F * hTrackEtaPhiNoSPD = (TH2F*) GetHisto("AnaHadrons_hEtaPhiNoSPDRefitPt02");
222   
223   TH1F* hPhiSPD   = (TH1F*)hTrackEtaPhiSPD  ->ProjectionY("hTrackPhiSPD"  ,0,1000);
224   TH1F* hPhiNoSPD = (TH1F*)hTrackEtaPhiNoSPD->ProjectionY("hTrackPhiNoSPD",0,1000);
225   //TH1F* hPhi      = (TH1F*)hTrackEtaPhi     ->ProjectionY("hTrackPhi"     ,0,1000);
226   TH1F* hPhi      = hPhiSPD->Clone("hTrackPhi");
227   hPhi->Add(hPhiNoSPD);
228   hPhi     ->SetTitle("Hybrid track in #phi, composition, p_{T} > 0.2 GeV");
229   hPhi     ->SetLineColor(1);
230   hPhiSPD  ->SetLineColor(2);
231   hPhiNoSPD->SetLineColor(4);
232   
233   hPhi     ->SetMinimum(1);
234   
235   hPhi     ->Draw();
236   hPhiSPD  ->Draw("same");
237   hPhiNoSPD->Draw("same");
238   
239   TLegend l(0.12,0.8,0.4,0.9);
240   l.SetTextSize(0.04);
241   l.AddEntry(hPhi,"Sum","L");
242   l.AddEntry(hPhiSPD  ,"SPD+Refit","L");
243   l.AddEntry(hPhiNoSPD,"No SPD+Refit","L");
244   l.SetBorderSize(0);
245   l.SetFillColor(0);
246   l.Draw();
247 //  ctrack->cd(3);
248 //  gPad->SetLogz();
249 //  
250 //  TH2F* hPtDCAxy = (TH2F*) GetHisto("AnaHadrons_hPtDCAxy");
251 //  hPtDCAxy->SetAxisRange(-1,1,"Y");
252 //  hPtDCAxy->SetAxisRange(0,30,"X");
253 //  hPtDCAxy->Draw("colz");
254 //  
255 //  ctrack->cd(4);
256 //  gPad->SetLogz();
257 //  
258 //  TH2F* hPtDCAz = (TH2F*) GetHisto("AnaHadrons_hPtDCAz");
259 //  hPtDCAz->SetAxisRange(-1,1,"Y");
260 //  hPtDCAz->SetAxisRange(0,30,"X");
261 //  hPtDCAz->Draw("colz");
262   
263   ctrack->Print(Form("%s_TrackHisto.eps",histoTag.Data()));
264   
265 }
266
267 //__________
268 void Pi0QA()
269 {
270   // Basic invariant mass QA
271   
272   TCanvas * cpi0 = new TCanvas(Form("Pi0Histo_%s",histoTag.Data()),"",500,500);
273   cpi0->Divide(2,2);
274   
275   TH2F* hMassE[10];
276   TH2F* hMixMassE[10];
277   for(Int_t icen = 0; icen < 10; icen++)
278   {
279     hMassE   [icen] = (TH2F*) GetHisto(Form("AnaPi0_hRe_cen%d_pidbit0_asy1_dist1",icen));
280     hMixMassE[icen] = (TH2F*) GetHisto(Form("AnaPi0_hMi_cen%d_pidbit0_asy1_dist1",icen));
281   }
282   
283   // 2D Invariant mass vs E, in PbPb from 60 to 100 %, all in pp
284   cpi0->cd(1);
285   gPad->SetLogz();
286   TH2F* h2DMass;
287   
288   if(hMassE[1]) // Plot centrality from 60 to 100%
289   {
290     h2DMass = (TH2F*) hMassE[6]->Clone("h2DMass");
291     for(Int_t icen = 7; icen < 10; icen++) h2DMass->Add(hMassE[icen]);
292     h2DMass->SetTitle("Invariant mass vs pair E, Cen: 60-100%");
293   }
294   else
295   {
296     h2DMass->SetTitle("Invariant mass vs cluster pair E");
297     h2DMass = hMassE[0];
298   }
299   
300   h2DMass->SetTitleOffset(1.6,"Y");
301   h2DMass->SetAxisRange(0.0,0.7,"Y");
302   h2DMass->SetAxisRange(0,30,"X");
303   h2DMass->Draw("colz");
304   
305   // Pi0 Invariant mass projection, in PbPb 6 centrality bins from 0 to 50%, all in pp
306   cpi0->cd(2);
307   TH1F* hMass[10];
308   TH1F* hMix [10];
309   TH1F* hMassEta[10];
310   TH1F* hMassPi0[10];
311   
312   TH1F * hX = (TH1F*) hMassE[0]->ProjectionX("hEPairCen0",0,10000);
313   Int_t binmin = hX->FindBin(2);  // Project histo from 2 GeV pairs
314   Int_t binmax = hX->FindBin(10); // Project histo up to 10 GeV pairs
315   for(Int_t icen = 0; icen < 6; icen++)
316   {
317     if(!hMassE[icen]) continue;
318     
319     hMass[icen] = (TH1F*) hMassE   [icen]->ProjectionY(Form("hMassCen%d",icen),binmin,binmax);
320     hMix [icen] = (TH1F*) hMixMassE[icen]->ProjectionY(Form("hMixCen%d" ,icen),binmin,binmax);
321     hMass[icen]->Sumw2();
322     hMix [icen]->Sumw2();
323     
324     hMassPi0[icen] = (TH1F*) hMass[icen]->Clone(Form("hMassPi0Cen%d",icen));
325     hMassEta[icen] = (TH1F*) hMass[icen]->Clone(Form("hMassEtaCen%d",icen));
326     
327     hMassPi0[icen]->Divide(hMix[icen]);
328     hMassPi0[icen]->Fit("pol0","Q","",0.25,0.35);
329     Float_t scale = 1;
330     if(hMassPi0[icen]->GetFunction("pol0")) scale = hMassPi0[icen]->GetFunction("pol0")->GetParameter(0);
331     //printf("Scale factor %f for cen %d\n",scale,icen);
332     hMassPi0[icen]->Scale(1./scale);
333     hMassPi0[icen]->SetMarkerStyle(24);
334     hMassPi0[icen]->SetMarkerColor(color[icen]);
335     hMassPi0[icen]->SetLineColor(color[icen]);
336     hMassPi0[icen]->SetAxisRange(0.04,0.24);
337     hMassPi0[icen]->SetMarkerSize(0.5);
338     
339     hMassEta[icen]->Rebin(4);
340     hMix    [icen]->Rebin(4);
341     hMassEta[icen]->Divide(hMix[icen]);
342     hMassEta[icen]->SetMarkerStyle(25);
343     hMassEta[icen]->SetMarkerColor(color[icen]);
344     hMassEta[icen]->SetLineColor(color[icen]);
345     hMassEta[icen]->SetAxisRange(0.4,0.9);
346     hMassEta[icen]->SetMarkerSize(0.5);
347     hMassEta[icen]->Scale(1./scale);
348   }
349   
350   //gPad->SetLogy();
351   //gPad->SetGridy();
352   hMassPi0[0]->SetMinimum(0.9);
353   hMassPi0[0]->SetTitleOffset(1.6,"Y");
354   hMassPi0[0]->SetYTitle("Real / Mixed");
355   hMassPi0[0]->SetTitle("#pi^{0} peak, 2 < E_{pair}< 10 GeV");
356   hMassPi0[0]->Draw();
357   
358   if(hMass[1]) // PbPb
359   {
360     hMassPi0[0]->SetMaximum(hMassPi0[5]->GetMaximum()*1.2);
361     hMassPi0[5]->Draw("Hsame");
362     hMassPi0[4]->Draw("Hsame");
363     hMassPi0[3]->Draw("Hsame");
364     hMassPi0[2]->Draw("Hsame");
365     hMassPi0[1]->Draw("Hsame");
366     hMassPi0[0]->Draw("Hsame");
367     //hMass[6]->Draw("Hsame");
368     //hMass[7]->Draw("same");
369     //hMass[8]->Draw("same");
370     //hMass[9]->Draw("same");
371     
372     TLegend l(0.12,0.6,0.4,0.85);
373     l.SetTextSize(0.04);
374     l.AddEntry(hMassPi0[0],"0-10%","P");
375     l.AddEntry(hMassPi0[1],"10-20%","P");
376     l.AddEntry(hMassPi0[2],"20-30%","P");
377     l.AddEntry(hMassPi0[3],"30-40%","P");
378     l.AddEntry(hMassPi0[4],"40-70%","P");
379     l.AddEntry(hMassPi0[5],"50-60%","P");
380     l.SetBorderSize(0);
381     l.SetFillColor(0);
382     l.Draw();
383   }
384   
385   TLine l1(0.04,1,0.24,1);
386   l1.Draw("same");
387   
388   // Pi0 invariant mass per EMCal super module
389   cpi0->cd(3);
390   
391   TH1F* hSM[10];
392   binmin = hX->FindBin(4);  // Project histo from 3 GeV pairs
393   binmax = hX->FindBin(20); // Project histo up to 20 GeV pairs
394   for(Int_t ism = 0; ism < 10; ism++)
395   {
396     TH2F* hTmpSM = (TH2F*) GetHisto(Form("QA_hIM_Mod%d",ism));
397     hSM[ism] = (TH1F*) hTmpSM->ProjectionY(Form("hMassSM%d",ism),binmin,binmax);
398     hSM[ism]->Sumw2();
399     hSM[ism]->SetMarkerStyle(26);
400     hSM[ism]->Rebin(2);
401     //hSM[ism]->Scale(1./hSM[ism]->Integral(0,10000));
402     hSM[ism]->SetMarkerColor(color[ism]);
403     hSM[ism]->SetLineColor(color[ism]);
404     hSM[ism]->SetAxisRange(0.04,0.24);
405     hSM[ism]->SetMarkerSize(0.5);
406   }
407   
408   hSM[0]->SetTitle("#pi^{0} peak in Modules, 4 < E_{pair}< 10 GeV");
409   hSM[0]->SetTitleOffset(1.6,"Y");
410   hSM[0]->Draw("H");
411   
412   TLegend lsm(0.12,0.5,0.35,0.85);
413   lsm.SetTextSize(0.04);
414   lsm.AddEntry(hSM[0],Form("Mod %d",0),"P");
415   
416   for(Int_t ism = 1; ism < 10; ism++)
417   {
418     hSM[ism]->Draw("Hsame");
419     lsm.AddEntry(hSM[ism],Form("Mod %d",ism),"P");
420   }
421   
422   lsm.SetBorderSize(0);
423   lsm.SetFillColor(0);
424   lsm.Draw();
425   
426   // Pi0 Invariant mass projection, in PbPb 6 centrality bins from 0 to 50%, all in pp
427   cpi0->cd(4);
428   
429   //gPad->SetLogy();
430   //gPad->SetGridy();
431   hMassEta[0]->SetMinimum(0.9);
432   hMassEta[0]->SetTitleOffset(1.6,"Y");
433   hMassEta[0]->SetYTitle("Real / Mixed");
434   hMassEta[0]->SetTitle("#eta peak, 2 < E_{pair}< 10 GeV");
435   hMassEta[0]->Draw("H");
436   
437   if(hMass[1]) // PbPb
438   {
439     hMassEta[0]->SetMaximum(hMassEta[5]->GetMaximum()*1.2);
440     hMassEta[5]->Draw("Hsame");
441     hMassEta[4]->Draw("Hsame");
442     hMassEta[3]->Draw("Hsame");
443     hMassEta[2]->Draw("Hsame");
444     hMassEta[1]->Draw("Hsame");
445     hMassEta[0]->Draw("Hsame");
446     
447     
448     TLegend l2(0.12,0.6,0.4,0.85);
449     l2.SetTextSize(0.04);
450     l2.AddEntry(hMassEta[0],"0-10%","P");
451     l2.AddEntry(hMassEta[1],"10-20%","P");
452     l2.AddEntry(hMassEta[2],"20-30%","P");
453     l2.AddEntry(hMassEta[3],"30-40%","P");
454     l2.AddEntry(hMassEta[4],"40-70%","P");
455     l2.AddEntry(hMassEta[5],"50-60%","P");
456     l2.SetBorderSize(0);
457     l2.SetFillColor(0);
458     l2.Draw();
459   }
460   
461   cpi0->Print(Form("%s_Pi0Histo.eps",histoTag.Data()));
462   
463 }
464
465 //__________________
466 void CorrelationQA()
467 {
468
469   TCanvas * cCorrelation = new TCanvas(Form("CorrelationHisto_%s",histoTag.Data()),"",1000,500);
470   cCorrelation->Divide(2,1);
471   
472   Float_t minClusterE = 8;
473   Float_t assocBins[] = {0.5,2.,5.,10.,20.};
474   Int_t nAssocBins = 4;
475   
476   TH1F * hLeading = (TH1F*) GetHisto("AnaPhotonHadronCorr_hPtLeading");
477   Int_t minClusterEBin = hLeading->FindBin(minClusterE);
478   Float_t nTrig = hLeading->Integral(minClusterE,100000);
479   
480   //Azimuthal correlation
481   cCorrelation->cd(1);
482   //gPad->SetLogy();
483   TH1F* hDeltaPhi[4];
484   
485   TLegend l(0.35,0.6,0.83,0.85);
486   l.SetHeader(Form("p_{T,T} > %2.1f GeV/c",minClusterE));
487   l.SetTextSize(0.04);
488   l.SetBorderSize(0);
489   l.SetFillColor(0);
490
491   for(Int_t ibin = 0; ibin < nAssocBins; ibin++ )
492   {
493     TH2F* hDeltaPhiE = (TH2F*) GetHisto(Form("AnaPhotonHadronCorr_hDeltaPhiPtAssocPt%2.1f_%2.1f",assocBins[ibin],assocBins[ibin+1]));
494     hDeltaPhi[ibin]  = (TH1F*) hDeltaPhiE->ProjectionY(Form("DeltaPhi%2.1f",assocBins[ibin]),minClusterEBin,10000);
495     hDeltaPhi[ibin]->Sumw2();
496     hDeltaPhi[ibin]->Rebin(2);
497     hDeltaPhi[ibin]->Scale(1./nTrig);
498
499     hDeltaPhi[ibin]->Fit("pol0","Q","",1,2);
500     Float_t scale = 1;
501     if(hDeltaPhi[ibin]->GetFunction("pol0"))
502     {
503       scale = hDeltaPhi[ibin]->GetFunction("pol0")->GetParameter(0);
504       hDeltaPhi[ibin]->GetFunction("pol0")->SetRange(6,7); // move from plot
505     }
506     hDeltaPhi[ibin]->Scale(1./scale);
507     //printf("ibin %d, scale %f\n",ibin,scale);
508
509     hDeltaPhi[ibin]->SetAxisRange(-1.8,4.1);
510
511     hDeltaPhi[ibin]->SetMarkerStyle(24);
512     hDeltaPhi[ibin]->SetMarkerColor(color[ibin]);
513     hDeltaPhi[ibin]->SetLineColor(color[ibin]);
514     hDeltaPhi[ibin]->SetTitleOffset(1.5,"Y");
515     hDeltaPhi[ibin]->SetYTitle("N_{pairs} / N_{trig} / ZYAM");
516     hDeltaPhi[ibin]->SetTitle("#gamma (#lambda_{0}^{2} < 0.4, neutral cluster) trigger");
517     
518     l.AddEntry(hDeltaPhi[ibin],Form("%2.1f< p_{T,A}< %2.1f GeV/c",assocBins[ibin],assocBins[ibin+1]),"P");
519   }
520   
521   
522   //hDeltaPhi[2]->SetMaximum(hDeltaPhi[2]->GetMaximum()*1.1);
523   //hDeltaPhi[2]->SetMinimum(0.0001);
524   
525    hDeltaPhi[2]->Draw("H");
526    hDeltaPhi[1]->Draw("Hsame");
527    hDeltaPhi[3]->Draw("Hsame");
528    hDeltaPhi[0]->Draw("Hsame");
529   
530   l.Draw("same");
531   
532   
533   // xE correlation
534   cCorrelation->cd(2);
535   gPad->SetLogy();
536   
537   TLegend l2(0.35,0.6,0.83,0.85);
538   l2.SetHeader(Form("p_{T,T} > %2.1f GeV/c",minClusterE));
539   l2.SetTextSize(0.04);
540   l2.SetBorderSize(0);
541   l2.SetFillColor(0);
542   
543   TH2F* hEXE   = (TH2F*) GetHisto("AnaPhotonHadronCorr_hXECharged");
544   TH2F* hEXEUE = (TH2F*) GetHisto("AnaPhotonHadronCorr_hXEUeCharged");
545   
546   TH1F* hXE  = (TH1F*) hEXE->ProjectionY(Form("XE%2.1fGeV",minClusterE),minClusterEBin,10000);
547   hXE->Sumw2();
548   hXE->Rebin(2);
549   hXE->Scale(1./nTrig);
550   hXE->SetAxisRange(0,1);
551   hXE->SetMarkerStyle(24);
552   hXE->SetMarkerColor(1);
553   hXE->SetLineColor(1);
554   hXE->SetTitleOffset(1.5,"Y");
555   hXE->SetYTitle("N_{pairs} / N_{trig}");
556   hXE->SetTitle("#gamma (#lambda_{0}^{2} < 0.4, neutral cluster) trigger");
557   l2.AddEntry(hXE,"raw x_{E}","P");
558   hXE->Draw();
559
560   TH1F* hXEUE  = (TH1F*) hEXEUE->ProjectionY(Form("XEUE%2.1fGeV",minClusterE),minClusterEBin,10000);
561   hXEUE->Sumw2();
562   hXEUE->Rebin(2);
563   hXEUE->Scale(1./nTrig);
564   hXEUE->SetAxisRange(0,1);
565   hXEUE->SetMarkerStyle(25);
566   hXEUE->SetMarkerColor(2);
567   hXEUE->SetLineColor(2);
568   l2.AddEntry(hXEUE,"raw Und. Event x_{E}","P");
569   hXEUE->Draw("same");
570
571   
572   l2.Draw("same");
573
574   
575   cCorrelation->Print(Form("%s_CorrelationHisto.eps",histoTag.Data()));
576
577 }
578
579
580 //____________________________________________________________________
581 void GetFileAndList(TString fileName, TString listName, Bool_t export)
582 {
583   file  = new TFile(fileName,"read");
584   
585   TDirectory * dir = (TDirectory*) file->Get(listName);
586   if(dir)
587   {
588     list = (TList*) dir->Get(listName);
589     if(export)
590     {
591       TFile * outputFile = new TFile("AnalysisResultsList.root","RECREATE");
592       list->Write();
593       outputFile->Close();
594     }
595   }
596 }
597
598 //___________________________________
599 TObject * GetHisto(TString histoName)
600 {
601   // Check if the list is available, if not get the histo directly from file
602   
603   if(list) return list->FindObject(histoName);
604   else     return file->Get       (histoName);
605 }
606