]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGGA/CaloTrackCorrelations/AliAnaParticleHadronCorrelation.cxx
Removing some meaningless const (coverity)
[u/mrichter/AliRoot.git] / PWGGA / CaloTrackCorrelations / AliAnaParticleHadronCorrelation.cxx
1 /**************************************************************************
2  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3  *                                                                        *
4  * Author: The ALICE Off-line Project.                                    *
5  * Contributors are mentioned in the code where appropriate.              *
6  *                                                                        *
7  * Permission to use, copy, modify and distribute this software and its   *
8  * documentation strictly for non-commercial purposes is hereby granted   *
9  * without fee, provided that the above copyright notice appears in all   *
10  * copies and that both the copyright notice and this permission notice   *
11  * appear in the supporting documentation. The authors make no claims     *
12  * about the suitability of this software for any purpose. It is          *
13  * provided "as is" without express or implied warranty.                  *
14  **************************************************************************/
15
16 //_________________________________________________________________________
17 // Class for the analysis of particle - hadron correlations
18 // Particle (for example direct gamma) must be found in a previous analysis 
19 //-- Author: Gustavo Conesa (LNF-INFN) 
20
21 //  Modified by Yaxian Mao:
22 // 1. add the UE subtraction for corrlation study
23 // 2. change the correlation variable
24 // 3. Only use leading particle(cluster/track) as trigger for correlation (2010/07/02)
25 // 4. Make decay photon-hadron correlations where decay contribute pi0 mass (2010/09/09)
26 // 5. fill the pout to extract kt at the end, also to study charge asymmetry(2010/10/06) 
27 // 6. Add the possibility for event selection analysis based on vertex and multiplicity bins (10/10/2010)
28 // 7. change the way of delta phi cut for UE study due to memory issue (reduce histograms)
29 // 8. Add the possibility to request the absolute leading particle at the near side or not, set trigger bins, general clean-up (08/2011)
30 //////////////////////////////////////////////////////////////////////////////
31
32
33 // --- ROOT system ---
34 //#include "TClonesArray.h"
35 #include <TClass.h>
36 #include <TMath.h>
37 #include <TH2F.h>
38 #include <TDatabasePDG.h>
39
40 //---- ANALYSIS system ----
41 #include "AliNeutralMesonSelection.h" 
42 #include "AliAnaParticleHadronCorrelation.h" 
43 #include "AliCaloTrackReader.h"
44 #include "AliAODPWG4ParticleCorrelation.h"
45 #include "AliFiducialCut.h"
46 #include "AliVTrack.h"
47 #include "AliVCluster.h"
48 #include "AliMCAnalysisUtils.h"
49 #include "TParticle.h"
50 #include "AliStack.h"
51 #include "AliAODMCParticle.h"
52 #include "AliMixedEvent.h"
53 #include "AliAnalysisManager.h"
54 #include "AliInputEventHandler.h"
55 #include "AliEventplane.h"
56
57 ClassImp(AliAnaParticleHadronCorrelation)
58
59
60 //___________________________________________________________________
61   AliAnaParticleHadronCorrelation::AliAnaParticleHadronCorrelation(): 
62     AliAnaCaloTrackCorrBaseClass(),
63     fMinTriggerPt(0.),   
64     fMaxAssocPt(1000.),             fMinAssocPt(0.),   
65     fDeltaPhiMaxCut(0.),            fDeltaPhiMinCut(0.),   
66     fSelectIsolated(0),             fMakeSeveralUE(0),              
67     fUeDeltaPhiMaxCut(0.),          fUeDeltaPhiMinCut(0.), 
68     fPi0AODBranchName(""),          fNeutralCorr(0),       
69     fPi0Trigger(0),                 fDecayTrigger(0),
70     fMakeAbsoluteLeading(0),        fMakeNearSideLeading(0),      
71     fLeadingTriggerIndex(-1),       fHMPIDCorrelation(0),  fFillBradHisto(0),
72     fNAssocPtBins(0),               fAssocPtBinLimit(),
73     fCorrelVzBin(0),
74     fListMixTrackEvents(),          fListMixCaloEvents(),
75     fUseMixStoredInReader(0),       fFillNeutralEventMixPool(0),
76     fM02MaxCut(0),                  fM02MinCut(0),  
77     fFillPileUpHistograms(0),       
78     //Histograms
79     fhPtInput(0),                   fhPtFidCut(0),
80     fhPtLeading(0),                 fhPtLeadingPileUp(),              
81     fhPtLeadingVzBin(0),            fhPtLeadingBin(0),                 
82     fhPhiLeading(0),                fhEtaLeading(0),   
83     fhPtLeadingMC(),
84     fhPtLeadingCentrality(0),       fhPtLeadingEventPlane(0), 
85     fhLeadingEventPlaneCentrality(0),
86     fhPtLeadingMixed(0),            fhPtLeadingMixedVzBin(0), fhPtLeadingMixedBin(0),              
87     fhPhiLeadingMixed(0),           fhEtaLeadingMixed(0), 
88     fhDeltaPhiDeltaEtaCharged(0),
89     fhPhiCharged(0),                fhEtaCharged(0), 
90     fhDeltaPhiCharged(0),           fhDeltaEtaCharged(0), 
91     fhDeltaPhiChargedPt(0),         fhDeltaPhiUeChargedPt(0), 
92     fhUePart(0),
93     fhXECharged(0),                 fhXEUeCharged(0),
94     fhXEPosCharged(0),              fhXENegCharged(0),
95     fhPtHbpXECharged(0),            fhPtHbpXEUeCharged(0),
96     fhZTCharged(0),                 fhZTUeCharged(0),
97     fhZTPosCharged(0),              fhZTNegCharged(0),
98     fhPtHbpZTCharged(0),            fhPtHbpZTUeCharged(0),
99     fhXEChargedMC(),                fhDeltaPhiChargedMC(),  
100     fhDeltaPhiDeltaEtaChargedPtA3GeV(0),
101     fhDeltaPhiChargedPtA3GeV(0),    fhDeltaEtaChargedPtA3GeV(0),
102     //Pile-Up
103     fhDeltaPhiChargedPileUp(),      fhDeltaEtaChargedPileUp(),
104     fhDeltaPhiChargedPtA3GeVPileUp(), fhDeltaEtaChargedPtA3GeVPileUp(),
105     fhXEChargedPileUp(),            fhXEUeChargedPileUp(),
106     fhZTChargedPileUp(),            fhZTUeChargedPileUp(), 
107     fhPtTrigChargedPileUp(),
108     fhDeltaPhiChargedOtherBC(),     fhDeltaPhiChargedPtA3GeVOtherBC(),
109     fhXEChargedOtherBC(),           fhXEUeChargedOtherBC(),
110     fhZTChargedOtherBC(),           fhZTUeChargedOtherBC(),
111     fhPtTrigChargedOtherBC(),
112     fhDeltaPhiChargedBC0(),         fhDeltaPhiChargedPtA3GeVBC0(),
113     fhXEChargedBC0(),               fhXEUeChargedBC0(),
114     fhZTChargedBC0(),               fhZTUeChargedBC0(),
115     fhPtTrigChargedBC0(),
116     fhDeltaPhiUeLeftCharged(0),     fhDeltaPhiUeRightCharged(0),
117     fhDeltaPhiUeLeftUpCharged(0),   fhDeltaPhiUeRightUpCharged(0),
118     fhDeltaPhiUeLeftDownCharged(0), fhDeltaPhiUeRightDownCharged(0),
119     fhXEUeLeftCharged(0),           fhXEUeRightCharged(0),
120     fhXEUeLeftUpCharged(0),         fhXEUeRightUpCharged(0),
121     fhXEUeLeftDownCharged(0),       fhXEUeRightDownCharged(0),
122     fhPtHbpXEUeLeftCharged(0),      fhPtHbpXEUeRightCharged(0), 
123     fhZTUeLeftCharged(0),           fhZTUeRightCharged(0),
124     fhPtHbpZTUeLeftCharged(0),      fhPtHbpZTUeRightCharged(0), 
125     fhPtTrigPout(0),                fhPtTrigCharged(0),
126     fhTrigDeltaPhiCharged(0x0),     fhTrigDeltaEtaCharged(0x0),
127     fhTrigXECorr(0x0),              fhTrigXEUeCorr(0x0),
128     fhTrigZTCorr(0x0),              fhTrigZTUeCorr(0x0),
129     fhAssocPtBkg(0),                fhDeltaPhiDeltaEtaAssocPtBin(0),
130     fhDeltaPhiAssocPtBin(0),        
131     fhDeltaPhiAssocPtBinDEta08(0),  fhDeltaPhiAssocPtBinDEta0(0),
132     fhDeltaPhiAssocPtBinHMPID(0),   fhDeltaPhiAssocPtBinHMPIDAcc(0),
133     fhDeltaPhiBradAssocPtBin(0),    fhDeltaPhiBrad(0),
134     fhXEAssocPtBin(0),              fhZTAssocPtBin(0),             
135     fhDeltaPhiDeltaEtaNeutral(0), 
136     fhPhiNeutral(0),                fhEtaNeutral(0), 
137     fhDeltaPhiNeutral(0),           fhDeltaEtaNeutral(0),
138     fhDeltaPhiNeutralPt(0),         fhDeltaPhiUeNeutralPt(0), 
139     fhXENeutral(0),                 fhXEUeNeutral(0),
140     fhPtHbpXENeutral(0),            fhPtHbpXEUeNeutral(0),
141     fhZTNeutral(0),                 fhZTUeNeutral(0),
142     fhPtHbpZTNeutral(0),            fhPtHbpZTUeNeutral(0),
143     fhDeltaPhiUeLeftNeutral(0),     fhDeltaPhiUeRightNeutral(0),
144     fhXEUeLeftNeutral(0),           fhXEUeRightNeutral(0),
145     fhPtHbpXEUeLeftNeutral(0),      fhPtHbpXEUeRightNeutral(0),
146     fhZTUeLeftNeutral(0),           fhZTUeRightNeutral(0),
147     fhPtHbpZTUeLeftNeutral(0),      fhPtHbpZTUeRightNeutral(0),
148     fhPtPi0DecayRatio(0),
149     fhDeltaPhiDecayCharged(0),      fhXEDecayCharged(0), fhZTDecayCharged(0), 
150     fhDeltaPhiDecayNeutral(0),      fhXEDecayNeutral(0), fhZTDecayNeutral(0),
151     fhDeltaPhiDecayChargedAssocPtBin(0), 
152     fhXEDecayChargedAssocPtBin(0),  fhZTDecayChargedAssocPtBin(0),                
153     fh2phiLeadingParticle(0x0),     fhMCPtLeading(0),
154     fhMCPhiLeading(0),              fhMCEtaLeading(0),
155     fhMCEtaCharged(0),              fhMCPhiCharged(0), 
156     fhMCDeltaEtaCharged(0),         fhMCDeltaPhiCharged(0x0),
157     fhMCDeltaPhiDeltaEtaCharged(0), fhMCDeltaPhiChargedPt(0),
158     fhMCPtXECharged(0),             fhMCPtXEUeCharged(0),
159     fhMCPtHbpXECharged(0),          fhMCPtHbpXEUeCharged(0),
160     fhMCUePart(0),
161     fhMCPtZTCharged(0),             fhMCPtHbpZTCharged(0),
162     fhMCPtTrigPout(0),              fhMCPtAssocDeltaPhi(0),
163     //Mixing
164     fhNEventsTrigger(0),            
165     fhNtracksAll(0),                fhNtracksTrigger(0),            fhNtracksMB(0),
166     fhNclustersAll(0),              fhNclustersTrigger(0),          fhNclustersMB(0),
167     fhMixDeltaPhiCharged(0),        fhMixDeltaPhiDeltaEtaCharged(0),
168     fhMixXECharged(0),              fhMixHbpXECharged(0),
169     fhMixDeltaPhiChargedAssocPtBin(),
170     fhMixDeltaPhiChargedAssocPtBinDEta08(),
171     fhMixDeltaPhiChargedAssocPtBinDEta0(),
172     fhMixDeltaPhiDeltaEtaChargedAssocPtBin(),
173     fhEventBin(0),                  fhEventMixBin(0)
174
175   //Default Ctor 
176     
177   //Initialize parameters
178   InitParameters();
179   
180   for(Int_t i = 0; i < 7; i++)
181   { 
182     fhPtLeadingMC[i] = 0;
183     fhXEChargedMC[i] = 0;
184     fhDeltaPhiChargedMC[i] = 0;
185   }
186   
187   for(Int_t i = 0; i < 7; i++)
188   {
189     fhPtLeadingPileUp             [i] = 0 ;
190     fhDeltaPhiChargedPileUp       [i] = 0 ; fhDeltaEtaChargedPileUp       [i] = 0 ;
191     fhXEChargedPileUp             [i] = 0 ; fhXEUeChargedPileUp           [i] = 0 ;
192     fhZTChargedPileUp             [i] = 0 ; fhZTUeChargedPileUp           [i] = 0 ;
193     fhPtTrigChargedPileUp         [i] = 0 ;
194     fhDeltaPhiChargedPtA3GeVPileUp[i] = 0 ; fhDeltaEtaChargedPtA3GeVPileUp[i] = 0 ;
195   }
196   
197 }
198
199 //_________________________________________________________________
200 AliAnaParticleHadronCorrelation::~AliAnaParticleHadronCorrelation()
201 {
202   // Remove event containers
203   
204   if(DoOwnMix())
205   {
206     if(fListMixTrackEvents)
207     {      
208       for(Int_t iz=0; iz < GetNZvertBin(); iz++)
209       {
210         for(Int_t ic=0; ic < GetNCentrBin(); ic++)
211         {
212           for(Int_t irp=0; irp<GetNRPBin(); irp++)
213           {
214             Int_t bin = GetEventMixBin(ic, iz, irp);
215             fListMixTrackEvents[bin]->Delete() ;
216             delete fListMixTrackEvents[bin] ;
217           }
218         }
219       }
220     }
221
222     delete[] fListMixTrackEvents;
223
224     if(fListMixCaloEvents)
225     {      
226       for(Int_t iz=0; iz < GetNZvertBin(); iz++)
227       {
228         for(Int_t ic=0; ic < GetNCentrBin(); ic++)
229         {
230           for(Int_t irp=0; irp<GetNRPBin(); irp++)
231           {
232             Int_t bin = GetEventMixBin(ic, iz, irp);
233             fListMixCaloEvents[bin]->Delete() ;
234             delete fListMixCaloEvents[bin] ;
235           }
236         }
237       }
238     }
239   
240     delete[] fListMixCaloEvents;
241     
242   }
243 }
244
245 //______________________________________________________________________________________________________________________________________________________
246 void AliAnaParticleHadronCorrelation::FillChargedAngularCorrelationHistograms(Float_t ptAssoc,  Float_t ptTrig,      Int_t   bin,
247                                                                               Float_t phiAssoc, Float_t phiTrig,     Float_t &     deltaPhi,
248                                                                               Float_t etaAssoc, Float_t etaTrig,  
249                                                                               Bool_t  decay,    Float_t hmpidSignal, Int_t  outTOF,
250                                                                               Int_t nTracks,       Int_t   mcTag)
251 {
252   // Fill angular correlation related histograms
253   
254   Float_t deltaEta    = etaTrig-etaAssoc;
255           deltaPhi    = phiTrig-phiAssoc;
256   Float_t deltaPhiOrg = deltaPhi;
257   
258   if(deltaPhi <= -TMath::PiOver2()) deltaPhi+=TMath::TwoPi();
259   if(deltaPhi > 3*TMath::PiOver2()) deltaPhi-=TMath::TwoPi();
260   
261   fhEtaCharged       ->Fill(ptAssoc,etaAssoc);
262   fhPhiCharged       ->Fill(ptAssoc,phiAssoc);
263   fhDeltaEtaCharged  ->Fill(ptTrig ,deltaEta);
264   fhDeltaPhiCharged  ->Fill(ptTrig ,deltaPhi);
265   fhDeltaPhiChargedPt->Fill(ptAssoc, deltaPhi);
266   fhDeltaPhiDeltaEtaCharged->Fill(deltaPhi, deltaEta);
267   
268   if(ptAssoc > 3 )
269   {
270     fhDeltaEtaChargedPtA3GeV        ->Fill(ptTrig  ,deltaEta);
271     fhDeltaPhiChargedPtA3GeV        ->Fill(ptTrig  ,deltaPhi);
272     fhDeltaPhiDeltaEtaChargedPtA3GeV->Fill(deltaPhi, deltaEta);    
273   }   
274   
275   // Pile up studies
276   
277   if(fFillPileUpHistograms)
278   {
279     if     (outTOF==1)
280     {
281       fhDeltaPhiChargedOtherBC->Fill(ptTrig ,deltaPhi) ;
282       if(ptAssoc > 3 ) fhDeltaPhiChargedPtA3GeVOtherBC->Fill(ptTrig ,deltaPhi) ;
283     }
284     else if(outTOF==0)
285     {
286         fhDeltaPhiChargedBC0->Fill(ptTrig ,deltaPhi) ;
287         if(ptAssoc > 3 ) fhDeltaPhiChargedPtA3GeVBC0->Fill(ptTrig ,deltaPhi) ;
288     }
289     
290     if(GetReader()->IsPileUpFromSPD())               { fhDeltaEtaChargedPileUp[0]->Fill(ptTrig ,deltaEta) ; fhDeltaPhiChargedPileUp[0]->Fill(ptTrig ,deltaPhi) ; }
291     if(GetReader()->IsPileUpFromEMCal())             { fhDeltaEtaChargedPileUp[1]->Fill(ptTrig ,deltaEta) ; fhDeltaPhiChargedPileUp[1]->Fill(ptTrig ,deltaPhi) ; }
292     if(GetReader()->IsPileUpFromSPDOrEMCal())        { fhDeltaEtaChargedPileUp[2]->Fill(ptTrig ,deltaEta) ; fhDeltaPhiChargedPileUp[2]->Fill(ptTrig ,deltaPhi) ; }
293     if(GetReader()->IsPileUpFromSPDAndEMCal())       { fhDeltaEtaChargedPileUp[3]->Fill(ptTrig ,deltaEta) ; fhDeltaPhiChargedPileUp[3]->Fill(ptTrig ,deltaPhi) ; }
294     if(GetReader()->IsPileUpFromSPDAndNotEMCal())    { fhDeltaEtaChargedPileUp[4]->Fill(ptTrig ,deltaEta) ; fhDeltaPhiChargedPileUp[4]->Fill(ptTrig ,deltaPhi) ; }
295     if(GetReader()->IsPileUpFromEMCalAndNotSPD())    { fhDeltaEtaChargedPileUp[5]->Fill(ptTrig ,deltaEta) ; fhDeltaPhiChargedPileUp[5]->Fill(ptTrig ,deltaPhi) ; }
296     if(GetReader()->IsPileUpFromNotSPDAndNotEMCal()) { fhDeltaEtaChargedPileUp[6]->Fill(ptTrig ,deltaEta) ; fhDeltaPhiChargedPileUp[6]->Fill(ptTrig ,deltaPhi) ; }
297     
298
299     
300     if(ptAssoc > 3 )
301     {
302       if(GetReader()->IsPileUpFromSPD())               { fhDeltaEtaChargedPtA3GeVPileUp[0]->Fill(ptTrig ,deltaEta) ; fhDeltaPhiChargedPtA3GeVPileUp[0]->Fill(ptTrig ,deltaPhi) ; }
303       if(GetReader()->IsPileUpFromEMCal())             { fhDeltaEtaChargedPtA3GeVPileUp[1]->Fill(ptTrig ,deltaEta) ; fhDeltaPhiChargedPtA3GeVPileUp[1]->Fill(ptTrig ,deltaPhi) ; }
304       if(GetReader()->IsPileUpFromSPDOrEMCal())        { fhDeltaEtaChargedPtA3GeVPileUp[2]->Fill(ptTrig ,deltaEta) ; fhDeltaPhiChargedPtA3GeVPileUp[2]->Fill(ptTrig ,deltaPhi) ; }
305       if(GetReader()->IsPileUpFromSPDAndEMCal())       { fhDeltaEtaChargedPtA3GeVPileUp[3]->Fill(ptTrig ,deltaEta) ; fhDeltaPhiChargedPtA3GeVPileUp[3]->Fill(ptTrig ,deltaPhi) ; }
306       if(GetReader()->IsPileUpFromSPDAndNotEMCal())    { fhDeltaEtaChargedPtA3GeVPileUp[4]->Fill(ptTrig ,deltaEta) ; fhDeltaPhiChargedPtA3GeVPileUp[4]->Fill(ptTrig ,deltaPhi) ; }
307       if(GetReader()->IsPileUpFromEMCalAndNotSPD())    { fhDeltaEtaChargedPtA3GeVPileUp[5]->Fill(ptTrig ,deltaEta) ; fhDeltaPhiChargedPtA3GeVPileUp[5]->Fill(ptTrig ,deltaPhi) ; }
308       if(GetReader()->IsPileUpFromNotSPDAndNotEMCal()) { fhDeltaEtaChargedPtA3GeVPileUp[6]->Fill(ptTrig ,deltaEta) ; fhDeltaPhiChargedPtA3GeVPileUp[6]->Fill(ptTrig ,deltaPhi) ; }
309     }
310   }
311   
312   if(IsDataMC())
313   {
314     Int_t mcIndex = GetMCTagHistogramIndex(mcTag);
315     fhDeltaPhiChargedMC[mcIndex]->Fill(ptTrig , deltaPhi);
316   }  
317   
318   if(fDecayTrigger && decay) fhDeltaPhiDecayCharged   ->Fill(ptTrig  , deltaPhi);      
319   
320   Double_t  dphiBrad = -100;
321   if(fFillBradHisto)
322   {
323     dphiBrad = atan2(sin(deltaPhiOrg), cos(deltaPhiOrg))/TMath::Pi();//-1 to 1
324     if(TMath::Abs(dphiBrad)>0.325 && TMath::Abs(dphiBrad)<0.475)  //Hardcoded values, BAD, FIXME
325     {
326       fhAssocPtBkg->Fill(ptTrig, ptAssoc);
327     }
328     
329     if(dphiBrad<-1./3) dphiBrad += 2;
330     fhDeltaPhiBrad->Fill(ptTrig, dphiBrad);
331   }
332   
333   // Fill histograms in bins of associated particle pT
334   if(bin>=0)
335   {
336       fhDeltaPhiDeltaEtaAssocPtBin    [bin]->Fill(deltaPhi,deltaEta);
337
338       fhDeltaPhiAssocPtBin            [bin]->Fill(ptTrig, deltaPhi);
339     
340     if(TMath::Abs(deltaEta)> 0.8) 
341       fhDeltaPhiAssocPtBinDEta08      [bin]->Fill(ptTrig, deltaPhi);
342
343     if(TMath::Abs(deltaEta)< 0.01) 
344       fhDeltaPhiAssocPtBinDEta0       [bin]->Fill(ptTrig, deltaPhi);
345     
346     if (fFillBradHisto)
347       fhDeltaPhiBradAssocPtBin        [bin]->Fill(ptTrig, dphiBrad);
348     
349     if(fDecayTrigger && decay)
350       fhDeltaPhiDecayChargedAssocPtBin[bin]->Fill(ptTrig, deltaPhi);      
351     
352     if(fHMPIDCorrelation)
353     {
354       if( hmpidSignal > 0 )
355       {
356         //printf("Track pt %f with HMPID signal %f \n",pt,hmpidSignal);
357         fhDeltaPhiAssocPtBinHMPID[bin]->Fill(ptTrig, deltaPhi);        
358       }
359       
360       if(phiAssoc > 5*TMath::DegToRad() && phiAssoc < 20*TMath::DegToRad())
361       {
362         //printf("Track pt %f in HMPID acceptance phi %f \n ",pt,phi*TMath::RadToDeg() );
363         fhDeltaPhiAssocPtBinHMPIDAcc[bin]->Fill(ptTrig, deltaPhi);        
364       }
365     }
366   }
367   
368   //fill different multiplicity histogram
369   if(DoEventSelect())
370   {
371     for(Int_t im = 0; im<GetMultiBin(); im++)
372     {
373       if(nTracks < ( GetMaxMulti() - GetMinMulti() )/GetMultiBin()*(im+1))
374       {
375         fhTrigDeltaPhiCharged[im]->Fill(ptTrig,deltaPhi);
376         fhTrigDeltaEtaCharged[im]->Fill(ptTrig,deltaEta);
377       }
378     }
379   }  
380 }
381
382 //____________________________________________________________________________________________________________________________________________________
383 Bool_t AliAnaParticleHadronCorrelation::FillChargedMCCorrelationHistograms(Float_t mcAssocPt,      Float_t mcAssocPhi, Float_t mcAssocEta,
384                                                                            Float_t mcTrigPt, Float_t mcTrigPhi,  Float_t mcTrigEta)
385 {
386   // Fill MC histograms independently of AOD or ESD
387   
388   //Select only hadrons in pt range
389   if(mcAssocPt < fMinAssocPt || mcAssocPt > fMaxAssocPt) return kTRUE ; // exclude but continue
390   
391   if(mcAssocPhi < 0) mcAssocPhi+=TMath::TwoPi();    
392   
393   //remove trigger itself for correlation when use charged triggers 
394   if(TMath::Abs(mcAssocPt -mcTrigPt ) < 1e-6 && 
395      TMath::Abs(mcAssocPhi-mcTrigPhi) < 1e-6 && 
396      TMath::Abs(mcAssocEta-mcTrigEta) < 1e-6)            return kTRUE ; // exclude but continue       
397   
398   // Absolute leading?
399   if( fMakeAbsoluteLeading && mcAssocPt > mcTrigPt )     return kFALSE; // jump event
400   
401   //jump out this event if near side associated partile pt larger than trigger
402   if( fMakeNearSideLeading && mcAssocPt > mcTrigPt && 
403      TMath::Abs(mcAssocPhi-mcTrigPhi)<TMath::PiOver2() ) return kFALSE; // jump event
404   
405   Float_t mcdeltaPhi= mcTrigPhi-mcAssocPhi; 
406   if(mcdeltaPhi <= -TMath::PiOver2()) mcdeltaPhi+=TMath::TwoPi();
407   if(mcdeltaPhi > 3*TMath::PiOver2()) mcdeltaPhi-=TMath::TwoPi();            
408   
409   Float_t mcxE    =-mcAssocPt/mcTrigPt*TMath::Cos(mcdeltaPhi);// -(mcAssocPx*pxprim+mcAssocPy*pyprim)/(mcTrigPt*mcTrigPt);  
410   Float_t mchbpXE =-100 ;
411   if(mcxE > 0 ) mchbpXE = TMath::Log(1./mcxE);
412   
413   Float_t mczT    = mcAssocPt/mcTrigPt ;
414   Float_t mchbpZT =-100 ;
415   if(mczT > 0 ) mchbpZT = TMath::Log(1./mczT);
416   
417   //Selection within angular range
418   if( mcdeltaPhi< -TMath::PiOver2())  mcdeltaPhi+=TMath::TwoPi();
419   if( mcdeltaPhi>3*TMath::PiOver2())  mcdeltaPhi-=TMath::TwoPi();              
420   
421   Double_t mcpout = mcAssocPt*TMath::Sin(mcdeltaPhi) ; 
422   
423   if(GetDebug() > 0 )  
424     printf("AliAnaParticleHadronCorrelation::MakeMCChargedCorrelation() - Charged hadron: track Pt %f, track Phi %f, phi trigger %f. Cuts:  delta phi  %2.2f < %2.2f < %2.2f, pT min %2.2f \n",
425            mcAssocPt,mcAssocPhi, mcTrigPhi,fDeltaPhiMinCut, mcdeltaPhi, fDeltaPhiMaxCut, GetMinPt());              
426   
427   // Fill Histograms
428   fhMCEtaCharged     ->Fill(mcAssocPt, mcAssocEta);
429   fhMCPhiCharged     ->Fill(mcAssocPt, mcAssocPhi);
430   fhMCDeltaEtaCharged->Fill(mcTrigPt,    mcTrigEta-mcAssocEta);
431   fhMCDeltaPhiCharged->Fill(mcTrigPt,    mcdeltaPhi);
432   fhMCPtAssocDeltaPhi->Fill(mcAssocPt, mcdeltaPhi);
433   
434   fhMCDeltaPhiDeltaEtaCharged->Fill(mcdeltaPhi,mcTrigEta-mcAssocEta);
435   
436   //delta phi cut for correlation
437   if( (mcdeltaPhi > fDeltaPhiMinCut) && (mcdeltaPhi < fDeltaPhiMaxCut) ) 
438   {
439     fhMCDeltaPhiChargedPt->Fill(mcAssocPt,mcdeltaPhi);
440     fhMCPtXECharged      ->Fill(mcTrigPt,mcxE); 
441     fhMCPtHbpXECharged   ->Fill(mcTrigPt,mchbpXE);
442     fhMCPtZTCharged      ->Fill(mcTrigPt,mczT); 
443     fhMCPtHbpZTCharged   ->Fill(mcTrigPt,mchbpZT);
444     fhMCPtTrigPout       ->Fill(mcTrigPt, mcpout) ;
445   }
446
447   //underlying event
448   if ( (mcdeltaPhi > fUeDeltaPhiMinCut) && (mcdeltaPhi < fUeDeltaPhiMaxCut) )   
449     {
450        Double_t randomphi = gRandom->Uniform(TMath::Pi()/2,3*TMath::Pi()/2);
451        Double_t mcUexE = -(mcAssocPt/mcTrigPt)*TMath::Cos(randomphi);
452   
453        if(mcUexE < 0.) mcUexE = -mcUexE;
454     
455        fhMCPtXEUeCharged->Fill(mcTrigPt,mcUexE);
456        if(mcUexE > 0) fhMCPtHbpXEUeCharged->Fill(mcTrigPt,TMath::Log(1/mcUexE));
457
458        fhMCUePart->Fill(mcTrigPt);
459     }
460   
461   return kTRUE;
462
463
464 //___________________________________________________________________________________________________________________
465 void AliAnaParticleHadronCorrelation::FillChargedMomentumImbalanceHistograms(Float_t ptTrig,   Float_t ptAssoc, 
466                                                                              Float_t xE,       Float_t hbpXE, 
467                                                                              Float_t zT,       Float_t hbpZT, 
468                                                                              Float_t pout,
469                                                                              Int_t   nTracks,  Int_t   charge,
470                                                                              Int_t   bin,      Bool_t  decay,
471                                                                              Int_t   outTOF,   Int_t   mcTag)
472
473 {
474   // Fill mostly momentum imbalance related histograms
475   
476   fhXECharged         ->Fill(ptTrig , xE); 
477   fhPtHbpXECharged    ->Fill(ptTrig , hbpXE);
478   fhZTCharged         ->Fill(ptTrig , zT); 
479   fhPtHbpZTCharged    ->Fill(ptTrig , hbpZT);
480   fhPtTrigPout        ->Fill(ptTrig , pout) ;
481   fhPtTrigCharged     ->Fill(ptTrig , ptAssoc) ;
482   
483   // Pile up studies
484   if(fFillPileUpHistograms) 
485   {
486     if     (outTOF==1)
487     {
488       fhXEChargedOtherBC    ->Fill(ptTrig,xE);
489       fhZTChargedOtherBC    ->Fill(ptTrig,zT);
490       fhPtTrigChargedOtherBC->Fill(ptTrig,ptAssoc);
491     }
492     else if(outTOF==0)
493     {
494       fhXEChargedBC0    ->Fill(ptTrig,xE);
495       fhZTChargedBC0    ->Fill(ptTrig,zT);
496       fhPtTrigChargedBC0->Fill(ptTrig,ptAssoc);
497     }
498
499     if(GetReader()->IsPileUpFromSPD())                { fhXEChargedPileUp[0]->Fill(ptTrig,xE); fhZTChargedPileUp[0]->Fill(ptTrig,zT); fhPtTrigChargedPileUp[0]->Fill(ptTrig,ptAssoc); }
500     if(GetReader()->IsPileUpFromEMCal())              { fhXEChargedPileUp[1]->Fill(ptTrig,xE); fhZTChargedPileUp[1]->Fill(ptTrig,zT); fhPtTrigChargedPileUp[1]->Fill(ptTrig,ptAssoc); }
501     if(GetReader()->IsPileUpFromSPDOrEMCal())         { fhXEChargedPileUp[2]->Fill(ptTrig,xE); fhZTChargedPileUp[2]->Fill(ptTrig,zT); fhPtTrigChargedPileUp[2]->Fill(ptTrig,ptAssoc); }
502     if(GetReader()->IsPileUpFromSPDAndEMCal())        { fhXEChargedPileUp[3]->Fill(ptTrig,xE); fhZTChargedPileUp[3]->Fill(ptTrig,zT); fhPtTrigChargedPileUp[3]->Fill(ptTrig,ptAssoc); }
503     if(GetReader()->IsPileUpFromSPDAndNotEMCal())     { fhXEChargedPileUp[4]->Fill(ptTrig,xE); fhZTChargedPileUp[4]->Fill(ptTrig,zT); fhPtTrigChargedPileUp[4]->Fill(ptTrig,ptAssoc); }
504     if(GetReader()->IsPileUpFromEMCalAndNotSPD())     { fhXEChargedPileUp[5]->Fill(ptTrig,xE); fhZTChargedPileUp[5]->Fill(ptTrig,zT); fhPtTrigChargedPileUp[5]->Fill(ptTrig,ptAssoc); }
505     if(GetReader()->IsPileUpFromNotSPDAndNotEMCal())  { fhXEChargedPileUp[6]->Fill(ptTrig,xE); fhZTChargedPileUp[6]->Fill(ptTrig,zT); fhPtTrigChargedPileUp[6]->Fill(ptTrig,ptAssoc); }
506   }
507   
508   if(IsDataMC())
509   {
510     Int_t mcIndex = GetMCTagHistogramIndex(mcTag);
511     fhXEChargedMC      [mcIndex]->Fill(ptTrig , xE      ); 
512   }  
513   
514   if(fDecayTrigger && decay)
515   {          
516     fhXEDecayCharged->Fill(ptTrig,xE); 
517     fhZTDecayCharged->Fill(ptTrig,zT);
518   } // photon decay pi0/eta trigger        
519   
520   if(bin >= 0 )//away side 
521   {
522     fhXEAssocPtBin[bin]->Fill(ptTrig, xE) ;
523     fhZTAssocPtBin[bin]->Fill(ptTrig, zT) ;
524     
525     if(fDecayTrigger && decay)
526     {          
527       fhXEDecayChargedAssocPtBin[bin]->Fill(ptTrig, xE); 
528       fhZTDecayChargedAssocPtBin[bin]->Fill(ptTrig, zT);
529     }
530   }        
531   
532   if(charge > 0)
533   {
534     fhXEPosCharged->Fill(ptTrig,xE) ;
535     fhZTPosCharged->Fill(ptTrig,zT) ;
536   }
537   else  
538   {
539     fhXENegCharged->Fill(ptTrig,xE) ;
540     fhZTNegCharged->Fill(ptTrig,zT) ;
541   }
542   
543   //fill different multiplicity histogram
544   if(DoEventSelect())
545   {
546     for(Int_t im=0; im<GetMultiBin(); im++)
547     {
548       if(nTracks < ( GetMaxMulti() - GetMinMulti() )/GetMultiBin()*(im+1))
549       {
550         fhTrigXECorr[im]->Fill(ptTrig,xE);
551         fhTrigZTCorr[im]->Fill(ptTrig,zT);
552       }
553     }
554   } //multiplicity events selection
555
556
557 //_______________________________________________________________________________________________________________________
558 void AliAnaParticleHadronCorrelation::FillChargedUnderlyingEventHistograms(Float_t ptTrig,   Float_t ptAssoc,
559                                                                            Float_t deltaPhi, Int_t nTracks, Int_t outTOF)
560 {
561   // Fill underlying event histograms
562   
563   fhDeltaPhiUeChargedPt->Fill(ptAssoc,deltaPhi);
564   
565   Double_t randomphi = gRandom->Uniform(fDeltaPhiMinCut,fDeltaPhiMaxCut);
566   Double_t uexE = -(ptAssoc/ptTrig)*TMath::Cos(randomphi);
567   Double_t uezT =   ptAssoc/ptTrig;
568   
569   if(uexE < 0.) uexE = -uexE;
570     
571   fhXEUeCharged->Fill(ptTrig,uexE);
572   if(uexE > 0) fhPtHbpXEUeCharged->Fill(ptTrig,TMath::Log(1/uexE));
573   
574   fhZTUeCharged->Fill(ptTrig,uezT);
575   if(uexE > 0) fhPtHbpZTUeCharged->Fill(ptTrig,TMath::Log(1/uezT));
576   
577   // Pile up studies
578   
579   if(fFillPileUpHistograms)
580   {
581     if     (outTOF==1)
582     {
583       fhXEUeChargedOtherBC->Fill(ptTrig,uexE);
584       fhZTUeChargedOtherBC->Fill(ptTrig,uezT);
585     }
586     else if(outTOF==0)
587     {
588       fhXEUeChargedBC0->Fill(ptTrig,uexE);
589       fhZTUeChargedBC0->Fill(ptTrig,uezT);
590     }
591     
592     if(GetReader()->IsPileUpFromSPD())               { fhXEUeChargedPileUp[0]->Fill(ptTrig,uexE); fhZTUeChargedPileUp[0]->Fill(ptTrig,uezT);}
593     if(GetReader()->IsPileUpFromEMCal())             { fhXEUeChargedPileUp[1]->Fill(ptTrig,uexE); fhZTUeChargedPileUp[1]->Fill(ptTrig,uezT);}
594     if(GetReader()->IsPileUpFromSPDOrEMCal())        { fhXEUeChargedPileUp[2]->Fill(ptTrig,uexE); fhZTUeChargedPileUp[2]->Fill(ptTrig,uezT);}
595     if(GetReader()->IsPileUpFromSPDAndEMCal())       { fhXEUeChargedPileUp[3]->Fill(ptTrig,uexE); fhZTUeChargedPileUp[3]->Fill(ptTrig,uezT);}
596     if(GetReader()->IsPileUpFromSPDAndNotEMCal())    { fhXEUeChargedPileUp[4]->Fill(ptTrig,uexE); fhZTUeChargedPileUp[4]->Fill(ptTrig,uezT);}
597     if(GetReader()->IsPileUpFromEMCalAndNotSPD())    { fhXEUeChargedPileUp[5]->Fill(ptTrig,uexE); fhZTUeChargedPileUp[5]->Fill(ptTrig,uezT);}
598     if(GetReader()->IsPileUpFromNotSPDAndNotEMCal()) { fhXEUeChargedPileUp[6]->Fill(ptTrig,uexE); fhZTUeChargedPileUp[6]->Fill(ptTrig,uezT);}
599   }
600   
601   if(DoEventSelect())
602   {
603     for(Int_t im=0; im<GetMultiBin(); im++)
604     {
605       if(nTracks < ( GetMaxMulti() - GetMinMulti() )/GetMultiBin()*(im+1))
606       {
607         fhTrigXEUeCorr[im]->Fill(ptTrig,uexE); // xE? CHECK
608         fhTrigZTUeCorr[im]->Fill(ptTrig,uezT); // zT? CHECK
609       }
610     }
611   } //multiplicity events selection
612 }
613
614 //_____________________________________________________________________________________________________
615 void AliAnaParticleHadronCorrelation::FillChargedUnderlyingEventSidesHistograms(Float_t ptTrig, 
616                                                                                 Float_t ptAssoc, 
617                                                                                 Float_t deltaPhi)
618 {
619  // Fill underlying event histograms to the left and right of trigger
620   if((deltaPhi<-fUeDeltaPhiMinCut) || (deltaPhi >2*fUeDeltaPhiMaxCut))
621   {  
622     fhDeltaPhiUeLeftCharged->Fill(ptAssoc,deltaPhi); 
623     Double_t randomphi = gRandom->Uniform(fDeltaPhiMinCut,fDeltaPhiMaxCut);
624     Double_t uexE = -(ptAssoc/ptTrig)*TMath::Cos(randomphi);
625     Double_t uezT =   ptAssoc/ptTrig;
626   
627     if(uexE < 0.) uexE = -uexE;
628     
629     fhXEUeLeftCharged->Fill(ptTrig,uexE);
630     if(uexE > 0) fhPtHbpXEUeLeftCharged->Fill(ptTrig,TMath::Log(1/uexE));
631   
632     fhZTUeLeftCharged->Fill(ptTrig,uezT);
633     if(uexE > 0) fhPtHbpZTUeLeftCharged->Fill(ptTrig,TMath::Log(1/uezT));
634     fhDeltaPhiUeLeftCharged->Fill(ptAssoc, deltaPhi);
635   }
636   
637   if((deltaPhi > fUeDeltaPhiMinCut) && (deltaPhi < fUeDeltaPhiMaxCut))
638   {  
639     fhDeltaPhiUeRightCharged->Fill(ptAssoc,deltaPhi); 
640     Double_t randomphi = gRandom->Uniform(fDeltaPhiMinCut,fDeltaPhiMaxCut);
641     Double_t uexE = -(ptAssoc/ptTrig)*TMath::Cos(randomphi);
642     Double_t uezT =   ptAssoc/ptTrig;
643   
644     if(uexE < 0.) uexE = -uexE;
645     
646     fhXEUeRightCharged->Fill(ptTrig,uexE);
647     if(uexE > 0) fhPtHbpXEUeRightCharged->Fill(ptTrig,TMath::Log(1/uexE));
648   
649     fhZTUeRightCharged->Fill(ptTrig,uezT);
650     if(uexE > 0) fhPtHbpZTUeRightCharged->Fill(ptTrig,TMath::Log(1/uezT));
651     fhDeltaPhiUeRightCharged->Fill(ptAssoc, deltaPhi);
652   }
653
654   if((deltaPhi<-fUeDeltaPhiMinCut) && (deltaPhi >-TMath::Pi()/2))
655   {  
656     fhDeltaPhiUeLeftDownCharged->Fill(ptAssoc,deltaPhi); 
657     Double_t randomphi = gRandom->Uniform(fDeltaPhiMinCut,fDeltaPhiMaxCut);
658     Double_t uexE = -(ptAssoc/ptTrig)*TMath::Cos(randomphi);
659     
660     if(uexE < 0.) uexE = -uexE;
661     
662     fhXEUeLeftDownCharged->Fill(ptTrig,uexE);
663   }
664   
665   if((deltaPhi>2*fUeDeltaPhiMaxCut) && (deltaPhi <3*TMath::Pi()/2))
666   {  
667     fhDeltaPhiUeLeftUpCharged->Fill(ptAssoc,deltaPhi); 
668     Double_t randomphi = gRandom->Uniform(fDeltaPhiMinCut,fDeltaPhiMaxCut);
669     Double_t uexE = -(ptAssoc/ptTrig)*TMath::Cos(randomphi);
670     
671     if(uexE < 0.) uexE = -uexE;
672     
673     fhXEUeLeftUpCharged->Fill(ptTrig,uexE);
674   }
675   
676   if((deltaPhi > TMath::Pi()/2) && (deltaPhi < fUeDeltaPhiMaxCut))
677   {  
678     fhDeltaPhiUeRightUpCharged->Fill(ptAssoc,deltaPhi); 
679     Double_t randomphi = gRandom->Uniform(fDeltaPhiMinCut,fDeltaPhiMaxCut);
680     Double_t uexE = -(ptAssoc/ptTrig)*TMath::Cos(randomphi);
681     
682     if(uexE < 0.) uexE = -uexE;
683     
684     fhXEUeRightUpCharged->Fill(ptTrig,uexE);
685   }
686   
687   if((deltaPhi > fUeDeltaPhiMinCut) && (deltaPhi < TMath::Pi()/2))
688   {  
689     fhDeltaPhiUeRightDownCharged->Fill(ptAssoc,deltaPhi); 
690     Double_t randomphi = gRandom->Uniform(fDeltaPhiMinCut,fDeltaPhiMaxCut);
691     Double_t uexE = -(ptAssoc/ptTrig)*TMath::Cos(randomphi);
692     
693     if(uexE < 0.) uexE = -uexE;
694     
695     fhXEUeRightDownCharged->Fill(ptTrig,uexE);
696   }  
697
698
699 //______________________________________________________________________________________________________________________________
700 void AliAnaParticleHadronCorrelation::FillDecayPhotonCorrelationHistograms(Float_t ptAssoc,     Float_t phiAssoc, 
701                                                                            TLorentzVector mom1, TLorentzVector mom2,
702                                                                            Bool_t bChargedOrNeutral)
703 {
704   // Do correlation with decay photons of triggered pi0 or eta
705   
706   // Calculate the correlation parameters
707   Float_t ptDecay1 = mom1.Pt();
708   Float_t ptDecay2 = mom2.Pt();
709   
710   Float_t zTDecay1 = -100, zTDecay2 = -100;
711   if(ptDecay1) zTDecay1 = ptAssoc/ptDecay1 ;
712   if(ptDecay2) zTDecay2 = ptAssoc/ptDecay2 ;
713   
714   Float_t deltaPhiDecay1 = mom1.Phi()-phiAssoc;
715   if(deltaPhiDecay1< -TMath::PiOver2()) deltaPhiDecay1+=TMath::TwoPi();
716   if(deltaPhiDecay1>3*TMath::PiOver2()) deltaPhiDecay1-=TMath::TwoPi();
717   
718   Float_t deltaPhiDecay2 = mom2.Phi()-phiAssoc;
719   if(deltaPhiDecay2< -TMath::PiOver2()) deltaPhiDecay2+=TMath::TwoPi();
720   if(deltaPhiDecay2>3*TMath::PiOver2()) deltaPhiDecay2-=TMath::TwoPi();
721   
722   Float_t xEDecay1   =-zTDecay1*TMath::Cos(deltaPhiDecay1); // -(px*pxTrig+py*pyTrig)/(ptTrig*ptTrig);
723   Float_t xEDecay2   =-zTDecay2*TMath::Cos(deltaPhiDecay2); // -(px*pxTrig+py*pyTrig)/(ptTrig*ptTrig);
724   
725   if(bChargedOrNeutral) // correlate with charges
726   {
727     fhDeltaPhiDecayCharged->Fill(ptDecay1, deltaPhiDecay1);
728     fhDeltaPhiDecayCharged->Fill(ptDecay2, deltaPhiDecay2);
729     
730     if(GetDebug() > 1) printf("AliAnaParticleHadronCorrelation::FillDecayPhotonHistograms( Charged corr) - deltaPhoton1 = %f, deltaPhoton2 = %f \n", deltaPhiDecay1, deltaPhiDecay2);
731     
732     if( (deltaPhiDecay1 > fDeltaPhiMinCut) && ( deltaPhiDecay1 < fDeltaPhiMaxCut) )
733     {
734       fhZTDecayCharged->Fill(ptDecay1,zTDecay1); 
735       fhXEDecayCharged->Fill(ptDecay1,xEDecay1); 
736     }
737     if( (deltaPhiDecay2 > fDeltaPhiMinCut) && ( deltaPhiDecay2 < fDeltaPhiMaxCut) )
738     {
739       fhZTDecayCharged->Fill(ptDecay2,zTDecay2);
740       fhXEDecayCharged->Fill(ptDecay2,xEDecay2);
741     }
742   }
743   else // correlate with neutrals
744   {
745     fhDeltaPhiDecayCharged->Fill(ptDecay1, deltaPhiDecay1);
746     fhDeltaPhiDecayCharged->Fill(ptDecay2, deltaPhiDecay2);
747     
748     if(GetDebug() > 1) printf("AliAnaParticleHadronCorrelation::FillDecayPhotonHistograms(Neutral corr) - deltaPhoton1 = %f, deltaPhoton2 = %f \n", deltaPhiDecay1, deltaPhiDecay2);
749     
750     if( (deltaPhiDecay1 > fDeltaPhiMinCut) && ( deltaPhiDecay1 < fDeltaPhiMaxCut) )
751     {
752       fhZTDecayCharged->Fill(ptDecay1,zTDecay1); 
753       fhXEDecayCharged->Fill(ptDecay1,xEDecay1); 
754     }
755     if( (deltaPhiDecay2 > fDeltaPhiMinCut) && ( deltaPhiDecay2 < fDeltaPhiMaxCut) )
756     {
757       fhZTDecayCharged->Fill(ptDecay2,zTDecay2);
758       fhXEDecayCharged->Fill(ptDecay2,xEDecay2);
759     }    
760   }
761 }
762
763 //______________________________________________________________________________________________________________________________________________________
764 void AliAnaParticleHadronCorrelation::FillNeutralAngularCorrelationHistograms(Float_t ptAssoc,  Float_t ptTrig,  
765                                                                               Float_t phiAssoc, Float_t phiTrig,  Float_t &     deltaPhi,
766                                                                               Float_t etaAssoc, Float_t etaTrig)
767 {
768   // Fill angular correlation related histograms
769   
770   Float_t deltaEta    = etaTrig-etaAssoc;
771   deltaPhi    = phiTrig-phiAssoc;
772   
773   if(deltaPhi <= -TMath::PiOver2()) deltaPhi+=TMath::TwoPi();
774   if(deltaPhi > 3*TMath::PiOver2()) deltaPhi-=TMath::TwoPi();
775   
776   fhEtaNeutral     ->Fill(ptAssoc,etaAssoc);
777   fhPhiNeutral     ->Fill(ptAssoc,phiAssoc);
778   fhDeltaEtaNeutral->Fill(ptTrig ,deltaEta);
779   fhDeltaPhiNeutral->Fill(ptTrig ,deltaPhi);
780   
781   if(ptAssoc > 2 ) fhDeltaPhiDeltaEtaNeutral->Fill(deltaPhi, deltaEta);
782   
783 }
784
785 //_____________________________________________________________________________________________________________________________
786 void AliAnaParticleHadronCorrelation::FillNeutralUnderlyingEventSidesHistograms(Float_t ptTrig,   Float_t ptAssoc, 
787                                                                                 Float_t xE,       Float_t hbpXE, 
788                                                                                 Float_t zT,       Float_t hbpZT, 
789                                                                                 Float_t deltaPhi)
790 {
791   // Fill underlying event histograms to the left and right of trigger
792   
793   if((deltaPhi<-fUeDeltaPhiMinCut) && (deltaPhi >-fUeDeltaPhiMaxCut))
794   {  
795     fhDeltaPhiUeLeftNeutral->Fill(ptAssoc, deltaPhi);
796     fhXEUeLeftNeutral      ->Fill(ptTrig , xE);
797     fhPtHbpXEUeLeftNeutral ->Fill(ptTrig , hbpXE);
798     fhZTUeLeftNeutral      ->Fill(ptTrig , zT);
799     fhPtHbpZTUeLeftNeutral ->Fill(ptTrig , hbpZT);
800   }
801   
802   if((deltaPhi > fUeDeltaPhiMinCut) && (deltaPhi < fUeDeltaPhiMaxCut))
803   {  
804     fhDeltaPhiUeRightNeutral->Fill(ptAssoc, deltaPhi);
805     fhXEUeRightNeutral      ->Fill(ptTrig , xE);
806     fhPtHbpXEUeRightNeutral ->Fill(ptTrig , hbpXE);
807     fhZTUeRightNeutral      ->Fill(ptTrig , zT);
808     fhPtHbpZTUeRightNeutral ->Fill(ptTrig , hbpZT);
809   }
810
811
812 //_____________________________________________________________
813 void AliAnaParticleHadronCorrelation::FillChargedEventMixPool()
814 {
815   // Mixed event pool filling for tracks
816   
817   //printf("FillChargedEventMixPool for %s\n",GetInputAODName().Data());
818   
819   if(fUseMixStoredInReader && GetReader()->GetLastTracksMixedEvent() == GetEventNumber())
820   {
821     //printf("%s : Pool already filled for this event !!!\n",GetInputAODName().Data());
822     return ; // pool filled previously for another trigger
823   }
824   
825   Int_t nTracks = GetCTSTracks()->GetEntriesFast();
826   
827   fhNtracksAll->Fill(nTracks);
828   
829   AliAnalysisManager   * manager      = AliAnalysisManager::GetAnalysisManager();
830   AliInputEventHandler * inputHandler = dynamic_cast<AliInputEventHandler*>(manager->GetInputEventHandler());
831   
832   if(!inputHandler) return ;
833   
834   if( inputHandler->IsEventSelected( ) & GetReader()->GetEventTriggerMask()    )
835   {
836     fhNtracksTrigger->Fill(nTracks);
837   }
838   
839   // Do mixing only with MB event (or the chosen mask), if not skip
840   if( !(inputHandler->IsEventSelected( ) & GetReader()->GetMixEventTriggerMask()) ) return ;
841   
842   fhNtracksMB->Fill(nTracks);
843   
844   Int_t eventBin = GetEventMixBin();
845   
846   //Check that the bin exists, if not (bad determination of RP, centrality or vz bin) do nothing
847   if(eventBin < 0) return;
848   
849   TObjArray * mixEventTracks = new TObjArray;
850   
851   if(fUseMixStoredInReader) 
852   {
853     fListMixTrackEvents[eventBin] = GetReader()->GetListWithMixedEventsForTracks(eventBin);
854   }
855   
856   if(!fListMixTrackEvents[eventBin]) fListMixTrackEvents[eventBin] = new TList();
857   
858   //printf("%s ***** Pool Event bin : %d - nTracks %d\n",GetInputAODName().Data(),eventBin, GetCTSTracks()->GetEntriesFast());
859   
860   TList * pool = fListMixTrackEvents[eventBin];
861   
862   TVector3 p3;  
863   for(Int_t ipr = 0;ipr < GetCTSTracks()->GetEntriesFast() ; ipr ++ )
864   {
865     AliVTrack * track = (AliVTrack *) (GetCTSTracks()->At(ipr)) ;
866     
867     Double_t mom[3] = {track->Px(),track->Py(),track->Pz()};
868     p3.SetXYZ(mom[0],mom[1],mom[2]);
869     Float_t pt   = p3.Pt();
870     
871     //Select only hadrons in pt range
872     if(pt < fMinAssocPt || pt > fMaxAssocPt) continue ;
873     
874     AliAODPWG4Particle * mixedTrack = new AliAODPWG4Particle(mom[0],mom[1],mom[2],0);
875     mixedTrack->SetDetector("CTS");
876     mixedTrack->SetChargedBit(track->Charge()>0);
877     mixEventTracks->Add(mixedTrack);
878   }
879   
880   //Set the event number where the last event was added, to avoid double pool filling
881   GetReader()->SetLastTracksMixedEvent(GetEventNumber());
882   
883   //printf("Add event to pool with %d tracks \n ",mixEventTracks->GetEntries());
884   pool->AddFirst(mixEventTracks);
885   mixEventTracks = 0;
886   
887   //printf("Pool size %d, max %d\n",pool->GetSize(), GetNMaxEvMix());
888
889   if(pool->GetSize() > GetNMaxEvMix())
890   {//Remove last event
891     TClonesArray * tmp = static_cast<TClonesArray*>(pool->Last()) ;
892     pool->RemoveLast() ;
893     delete tmp ;
894   }
895 }
896
897 //_____________________________________________________________
898 void AliAnaParticleHadronCorrelation::FillNeutralEventMixPool()
899 {
900   // Mixed event pool filling for neutral clusters
901   // Right now only for EMCAL and in isolation case
902   
903   //printf("FillNeutralEventMixPool for %s\n",GetInputAODName().Data());
904   
905   TObjArray * pl = GetEMCALClusters();
906   //if (GetAODObjArrayName.Contains("PHOS") )pl    = GetPHOSClusters();
907   //else                                     pl    = GetEMCALClusters();
908   
909   Int_t nClusters   = pl->GetEntriesFast();
910   fhNclustersAll->Fill(nClusters);
911   
912   if(fUseMixStoredInReader && GetReader()->GetLastCaloMixedEvent() == GetEventNumber())
913   {
914     //printf("%s : Pool already filled for this event !!!\n",GetInputAODName().Data());
915     return ; // pool filled previously for another trigger
916   }
917   
918   AliAnalysisManager   * manager      = AliAnalysisManager::GetAnalysisManager();
919   AliInputEventHandler * inputHandler = dynamic_cast<AliInputEventHandler*>(manager->GetInputEventHandler());
920   
921   if(!inputHandler) return ;
922   
923   if( inputHandler->IsEventSelected( ) & GetReader()->GetEventTriggerMask()    )
924   {
925     fhNclustersTrigger->Fill(nClusters);
926   }
927   
928   // Do mixing only with MB event (or the chosen mask), if not skip
929   if( !(inputHandler->IsEventSelected( ) & GetReader()->GetMixEventTriggerMask()) ) return ;
930   
931   fhNclustersMB->Fill(nClusters);
932   
933   Int_t eventBin = GetEventMixBin();
934   
935   //Check that the bin exists, if not (bad determination of RP, centrality or vz bin) do nothing
936   if(eventBin < 0) return;
937   
938   TObjArray * mixEventCalo = new TObjArray;
939   
940   if(fUseMixStoredInReader) 
941   {
942     fListMixCaloEvents[eventBin] = GetReader()->GetListWithMixedEventsForCalo(eventBin);
943   }
944   
945   if(!fListMixCaloEvents[eventBin]) fListMixCaloEvents[eventBin] = new TList();
946   
947   TList * poolCalo = fListMixCaloEvents[eventBin];
948   
949   TLorentzVector mom;
950
951   for(Int_t ipr = 0;ipr <  nClusters ; ipr ++ )
952   {
953     AliVCluster * calo = (AliVCluster *) (pl->At(ipr)) ;
954   
955     // remove matched clusters
956     if( IsTrackMatched( calo, GetReader()->GetInputEvent() ) ) continue ;
957     
958     //Cluster momentum calculation
959     if(GetReader()->GetDataType() != AliCaloTrackReader::kMC)
960     {
961       calo->GetMomentum(mom,GetVertex(0)) ;
962     }//Assume that come from vertex in straight line
963     else
964     {
965       Double_t vertex[]={0,0,0};
966       calo->GetMomentum(mom,vertex) ;
967     }
968     
969     Float_t pt = mom.Pt();
970     //Select only clusters in pt range
971     if(pt < fMinAssocPt || pt > fMaxAssocPt) continue ;
972     
973     AliAODPWG4Particle * mixedCalo = new AliAODPWG4Particle(mom);
974     mixedCalo->SetDetector("EMCAL");
975     mixEventCalo->Add(mixedCalo);
976   }
977   
978   //Set the event number where the last event was added, to avoid double pool filling
979   GetReader()->SetLastCaloMixedEvent(GetEventNumber());
980   
981   //printf("Add event to pool with %d clusters \n ",mixEventCalo->GetEntries());
982   poolCalo->AddFirst(mixEventCalo);
983   mixEventCalo = 0;
984   
985   //printf("Pool size %d, max %d\n",poolCalo->GetSize(), GetNMaxEvMix());
986   
987   if(poolCalo->GetSize() > GetNMaxEvMix())
988   {//Remove last event
989     TClonesArray * tmp = static_cast<TClonesArray*>(poolCalo->Last()) ;
990     poolCalo->RemoveLast() ;
991     delete tmp ;
992   }  
993 }
994
995 //____________________________________________________________
996 TObjString* AliAnaParticleHadronCorrelation::GetAnalysisCuts()
997 {
998   //Save parameters used for analysis
999   TString parList ; //this will be list of parameters used for this analysis.
1000   const Int_t buffersize = 560;
1001   char onePar[buffersize] ;
1002   
1003   snprintf(onePar,buffersize,"--- AliAnaPaticleHadronCorrelation ---\n") ;
1004   parList+=onePar ;     
1005   snprintf(onePar,buffersize," Pt Trigger > %3.2f ",    fMinTriggerPt) ; 
1006   parList+=onePar ;
1007   snprintf(onePar,buffersize," %3.2f < Pt associated < %3.2f ", fMinAssocPt,   fMaxAssocPt) ; 
1008   parList+=onePar ;
1009   snprintf(onePar,buffersize," %3.2f < Phi trigger particle-Hadron < %3.2f ",    fDeltaPhiMinCut,   fDeltaPhiMaxCut) ; 
1010   parList+=onePar ;
1011   snprintf(onePar,buffersize," %3.2f < Phi trigger particle-UeHadron <  %3.2f ", fUeDeltaPhiMinCut, fUeDeltaPhiMaxCut) ; 
1012   parList+=onePar ;
1013   snprintf(onePar,buffersize,"Isolated Trigger?  %d\n",    fSelectIsolated) ;
1014   parList+=onePar ;
1015   snprintf(onePar,buffersize,"Several UE?  %d\n",          fMakeSeveralUE) ;
1016   parList+=onePar ;
1017   snprintf(onePar,buffersize,"Name of AOD Pi0 Branch %s ", fPi0AODBranchName.Data());
1018   parList+=onePar ;
1019   snprintf(onePar,buffersize,"Do Decay-hadron correlation ?  pi0 %d, decay %d", fPi0Trigger, fDecayTrigger) ;
1020   parList+=onePar ;
1021   snprintf(onePar,buffersize,"Select absolute leading for cluster triggers ? %d or Near Side Leading %d \n", 
1022            fMakeAbsoluteLeading, fMakeNearSideLeading) ;
1023   parList+=onePar ;
1024   snprintf(onePar,buffersize,"Associated particle pt bins  %d: ", fNAssocPtBins) ;
1025   parList+=onePar ;
1026   for (Int_t ibin = 0; ibin<fNAssocPtBins; ibin++) {
1027     snprintf(onePar,buffersize,"bin %d = [%2.1f,%2.1f];", ibin, fAssocPtBinLimit[ibin], fAssocPtBinLimit[ibin+1]) ;
1028   }
1029   parList+=onePar ;
1030   
1031   //Get parameters set in base class.
1032   parList += GetBaseParametersList() ;
1033   
1034   //Get parameters set in FiducialCut class (not available yet)
1035   //parlist += GetFidCut()->GetFidCutParametersList() 
1036   
1037   return new TObjString(parList) ;  
1038   
1039
1040
1041 //________________________________________________________________
1042 TList *  AliAnaParticleHadronCorrelation::GetCreateOutputObjects()
1043 {  
1044   
1045   // Create histograms to be saved in output file and 
1046   // store them in fOutputContainer
1047   
1048   TList * outputContainer = new TList() ; 
1049   outputContainer->SetName("CorrelationHistos") ; 
1050   
1051   Int_t   nptbins = GetHistogramRanges()->GetHistoPtBins(); Int_t  nphibins = GetHistogramRanges()->GetHistoPhiBins(); Int_t   netabins = GetHistogramRanges()->GetHistoEtaBins(); Int_t  ndeltaphibins = GetHistogramRanges()->GetHistoDeltaPhiBins(); Int_t   ndeltaetabins = GetHistogramRanges()->GetHistoDeltaEtaBins();
1052   Float_t ptmax   = GetHistogramRanges()->GetHistoPtMax();  Float_t phimax  = GetHistogramRanges()->GetHistoPhiMax();  Float_t etamax   = GetHistogramRanges()->GetHistoEtaMax(); Float_t deltaphimax  = GetHistogramRanges()->GetHistoDeltaPhiMax();  Float_t deltaetamax   = GetHistogramRanges()->GetHistoDeltaEtaMax();
1053   Float_t ptmin   = GetHistogramRanges()->GetHistoPtMin();  Float_t phimin  = GetHistogramRanges()->GetHistoPhiMin();  Float_t etamin   = GetHistogramRanges()->GetHistoEtaMin(); Float_t deltaphimin  = GetHistogramRanges()->GetHistoDeltaPhiMin();  Float_t deltaetamin   = GetHistogramRanges()->GetHistoDeltaEtaMin();     
1054   
1055   Int_t nMixBins = GetNCentrBin()*GetNZvertBin()*GetNRPBin();
1056   
1057   TString nameMC[]     = {"Photon","Pi0","Pi0Decay","EtaDecay","OtherDecay","Electron","Hadron"};
1058   TString pileUpName[] = {"SPD","EMCAL","SPDOrEMCAL","SPDAndEMCAL","SPDAndNotEMCAL","EMCALAndNotSPD","NotSPDAndNotEMCAL"} ;
1059
1060   // For vz dependent histograms, if option ON
1061   Int_t   nz  = 1  ;
1062   if(fCorrelVzBin) nz = GetNZvertBin();
1063   TString sz  = "" ;
1064   TString tz  = "" ;
1065   
1066   fhPtInput  = new TH1F("hPtInput","p_{T} distribution of input trigger particles", nptbins,ptmin,ptmax); 
1067   fhPtInput->SetXTitle("p_{T}^{trig} (GeV/c)");
1068   outputContainer->Add(fhPtInput);
1069
1070   fhPtFidCut  = new TH1F("hPtFidCut","p_{T} distribution of input trigger particles after fiducial cut", nptbins,ptmin,ptmax); 
1071   fhPtFidCut->SetXTitle("p_{T}^{trig} (GeV/c)");
1072   outputContainer->Add(fhPtFidCut);
1073
1074   fhPtLeading  = new TH1F("hPtLeading","p_{T} distribution of leading particles", nptbins,ptmin,ptmax); 
1075   fhPtLeading->SetXTitle("p_{T}^{trig} (GeV/c)");
1076   outputContainer->Add(fhPtLeading);
1077
1078   if(IsDataMC())
1079   {
1080     for(Int_t i=0; i < 7; i++)
1081     {
1082       fhPtLeadingMC[i]  = new TH1F(Form("hPtLeading_MC%s",nameMC[i].Data()),
1083                                    Form("p_{T} distribution of leading particles, trigger origin is %s",nameMC[i].Data()), 
1084                                    nptbins,ptmin,ptmax); 
1085       fhPtLeadingMC[i]->SetXTitle("p_{T}^{trig} (GeV/c)");
1086       outputContainer->Add(fhPtLeadingMC[i]);
1087     }
1088   }
1089   
1090   if(fCorrelVzBin)
1091   {
1092     fhPtLeadingVzBin  = new TH2F("hPtLeadingVzBin","p_{T} distribution of leading particles vs vz bin", nptbins,ptmin,ptmax,GetNZvertBin(),0,GetNZvertBin()); 
1093     fhPtLeadingVzBin->SetXTitle("p_{T}^{trig} (GeV/c)");
1094     fhPtLeadingVzBin->SetYTitle("v_{z} bin");
1095     outputContainer->Add(fhPtLeadingVzBin);
1096   }
1097   
1098   fhPtLeadingBin  = new TH2F ("hPtLeadingBin","p_{T} distribution of leading particles", nptbins,ptmin,ptmax,nMixBins,0,nMixBins); 
1099   fhPtLeadingBin->SetXTitle("p_{T}^{trig} (GeV/c)");
1100   fhPtLeadingBin->SetYTitle("Bin");
1101   outputContainer->Add(fhPtLeadingBin);
1102
1103   fhPhiLeading  = new TH2F ("hPhiLeading","#phi distribution of leading Particles",nptbins,ptmin,ptmax, nphibins,phimin,phimax); 
1104   fhPhiLeading->SetYTitle("#phi (rad)");
1105   outputContainer->Add(fhPhiLeading);
1106
1107   fhEtaLeading  = new TH2F ("hEtaLeading","#eta distribution of leading",nptbins,ptmin,ptmax, netabins,etamin,etamax); 
1108   fhEtaLeading->SetYTitle("#eta ");  
1109   outputContainer->Add(fhEtaLeading);
1110   
1111   fhPtLeadingCentrality   = new TH2F("hPtLeadingCentrality","Leading particle p_{T} vs centrality",nptbins,ptmin,ptmax,100,0.,100) ;
1112   fhPtLeadingCentrality->SetXTitle("p_{T}^{trig} (GeV/c)");
1113   fhPtLeadingCentrality->SetYTitle("Centrality (%)");
1114   outputContainer->Add(fhPtLeadingCentrality) ;  
1115   
1116   fhPtLeadingEventPlane  = new TH2F("hPtLeadingEventPlane","Leading particle p_{T} vs event plane angle",nptbins,ptmin,ptmax, 100,0.,TMath::Pi()) ;
1117   fhPtLeadingEventPlane->SetXTitle("p_{T}^{trig} (GeV/c)");
1118   fhPtLeadingEventPlane->SetXTitle("EP angle (rad)");
1119   outputContainer->Add(fhPtLeadingEventPlane) ;
1120   
1121   fhLeadingEventPlaneCentrality  = new TH2F("hLeadingEventPlane","Leading particle centrality vs event plane angle",100,0.,100,100,0.,TMath::Pi()) ;
1122   fhLeadingEventPlaneCentrality->SetXTitle("Centrality (%)");
1123   fhLeadingEventPlaneCentrality->SetYTitle("EP angle (rad)");
1124   outputContainer->Add(fhLeadingEventPlaneCentrality) ;
1125   
1126   //Correlation with charged hadrons
1127   if(GetReader()->IsCTSSwitchedOn()) 
1128   {
1129     fhDeltaPhiDeltaEtaCharged  = new TH2F
1130     ("hDeltaPhiDeltaEtaCharged","#eta_{trigger} - #eta_{h^{#pm}} vs #phi_{trigger} - #phi_{h^{#pm}}",
1131     ndeltaphibins ,deltaphimin,deltaphimax,ndeltaetabins,deltaetamin,deltaetamax); 
1132     fhDeltaPhiDeltaEtaCharged->SetXTitle("#Delta #phi (rad)");
1133     fhDeltaPhiDeltaEtaCharged->SetYTitle("#Delta #eta");    
1134     
1135     fhDeltaPhiDeltaEtaChargedPtA3GeV  = new TH2F
1136     ("hDeltaPhiDeltaEtaChargedPtA3GeV","#eta_{trigger} - #eta_{h^{#pm}} vs #phi_{trigger} - #phi_{h^{#pm}, p_{TA}>3 GeV/c}",
1137      ndeltaphibins ,deltaphimin,deltaphimax,ndeltaetabins,deltaetamin,deltaetamax); 
1138     fhDeltaPhiDeltaEtaChargedPtA3GeV->SetXTitle("#Delta #phi (rad)");
1139     fhDeltaPhiDeltaEtaChargedPtA3GeV->SetYTitle("#Delta #eta");    
1140         
1141     fhPhiCharged  = new TH2F
1142     ("hPhiCharged","#phi_{h^{#pm}}  vs p_{T #pm}",
1143      nptbins,ptmin,ptmax,nphibins,phimin,phimax); 
1144     fhPhiCharged->SetYTitle("#phi_{h^{#pm}} (rad)");
1145     fhPhiCharged->SetXTitle("p_{T #pm} (GeV/c)");
1146     
1147     fhEtaCharged  = new TH2F
1148     ("hEtaCharged","#eta_{h^{#pm}}  vs p_{T #pm}",
1149      nptbins,ptmin,ptmax,netabins,etamin,etamax); 
1150     fhEtaCharged->SetYTitle("#eta_{h^{#pm}} (rad)");
1151     fhEtaCharged->SetXTitle("p_{T #pm} (GeV/c)");
1152     
1153     fhDeltaPhiCharged  = new TH2F
1154     ("hDeltaPhiCharged","#phi_{trigger} - #phi_{h^{#pm}} vs p_{T trigger}",
1155      nptbins,ptmin,ptmax, ndeltaphibins ,deltaphimin,deltaphimax);
1156     fhDeltaPhiCharged->SetYTitle("#Delta #phi (rad)");
1157     fhDeltaPhiCharged->SetXTitle("p_{T trigger} (GeV/c)");
1158     
1159     fhDeltaPhiChargedPtA3GeV  = new TH2F
1160     ("hDeltaPhiChargedPtA3GeV","#phi_{trigger} - #phi_{h^{#pm}} vs p_{T trigger}, p_{TA}>3 GeV/c",
1161      nptbins,ptmin,ptmax, ndeltaphibins ,deltaphimin,deltaphimax);
1162     fhDeltaPhiChargedPtA3GeV->SetYTitle("#Delta #phi (rad)");
1163     fhDeltaPhiChargedPtA3GeV->SetXTitle("p_{T trigger} (GeV/c)");
1164     
1165
1166     fhDeltaPhiChargedPt  = new TH2F
1167     ("hDeltaPhiChargedPt","#phi_{trigger} - #phi_{#h^{#pm}} vs p_{T h^{#pm}}",
1168      nptbins,ptmin,ptmax, ndeltaphibins ,deltaphimin,deltaphimax);
1169     fhDeltaPhiChargedPt->SetYTitle("#Delta #phi (rad)");
1170     fhDeltaPhiChargedPt->SetXTitle("p_{T h^{#pm}} (GeV/c)");
1171     
1172     fhDeltaPhiUeChargedPt  = new TH2F
1173     ("hDeltaPhiUeChargedPt","#phi_{trigger} - #phi_{#Ueh^{#pm}} vs p_{T Ueh^{#pm}}",
1174      nptbins,ptmin,ptmax, ndeltaphibins ,deltaphimin,deltaphimax);
1175     fhDeltaPhiUeChargedPt->SetYTitle("#Delta #phi (rad)");
1176     fhDeltaPhiUeChargedPt->SetXTitle("p_{T h^{#pm}} (GeV/c)");
1177     
1178     fhUePart  =  new TH1F("hUePart","UE particles distribution vs pt trig",
1179              nptbins,ptmin,ptmax); 
1180     fhUePart->SetYTitle("dNch");
1181     fhUePart->SetXTitle("p_{T trigger} (GeV/c)");
1182     
1183     
1184     fhDeltaEtaCharged  = new TH2F
1185     ("hDeltaEtaCharged","#eta_{trigger} - #eta_{h^{#pm}} vs p_{T trigger}",
1186      nptbins,ptmin,ptmax,ndeltaetabins,deltaetamin,deltaetamax);  
1187     fhDeltaEtaCharged->SetYTitle("#Delta #eta");
1188     fhDeltaEtaCharged->SetXTitle("p_{T trigger} (GeV/c)");
1189     
1190     fhDeltaEtaChargedPtA3GeV  = new TH2F
1191     ("hDeltaEtaChargedPtA3GeV","#eta_{trigger} - #eta_{h^{#pm}} vs p_{T trigger}, p_{TA}>3 GeV/c",
1192      nptbins,ptmin,ptmax,ndeltaetabins,deltaetamin,deltaetamax);  
1193     fhDeltaEtaChargedPtA3GeV->SetYTitle("#Delta #eta");
1194     fhDeltaEtaChargedPtA3GeV->SetXTitle("p_{T trigger} (GeV/c)");    
1195     
1196     fhXECharged  = 
1197     new TH2F("hXECharged","x_{E} for charged tracks",
1198              nptbins,ptmin,ptmax,200,0.,2.); 
1199     fhXECharged->SetYTitle("x_{E}");
1200     fhXECharged->SetXTitle("p_{T trigger} (GeV/c)");
1201     
1202     fhXEUeCharged  = 
1203     new TH2F("hXEUeCharged","x_{E} for Underlying Event",
1204              nptbins,ptmin,ptmax,200,0.,2.); 
1205     fhXEUeCharged->SetYTitle("x_{E}");
1206     fhXEUeCharged->SetXTitle("p_{T trigger} (GeV/c)");
1207     
1208     fhXEPosCharged  = 
1209     new TH2F("hXEPositiveCharged","x_{E} for positive charged tracks",
1210              nptbins,ptmin,ptmax,200,0.,2.); 
1211     fhXEPosCharged->SetYTitle("x_{E}");
1212     fhXEPosCharged->SetXTitle("p_{T trigger} (GeV/c)");
1213     
1214     fhXENegCharged  = 
1215     new TH2F("hXENegativeCharged","x_{E} for negative charged tracks",
1216              nptbins,ptmin,ptmax,200,0.,2.); 
1217     fhXENegCharged->SetYTitle("x_{E}");
1218     fhXENegCharged->SetXTitle("p_{T trigger} (GeV/c)");
1219     
1220     fhPtHbpXECharged  = 
1221     new TH2F("hHbpXECharged","#xi = ln(1/x_{E}) with charged hadrons",
1222              nptbins,ptmin,ptmax,200,0.,10.); 
1223     fhPtHbpXECharged->SetYTitle("ln(1/x_{E})");
1224     fhPtHbpXECharged->SetXTitle("p_{T trigger} (GeV/c)");
1225     
1226     fhPtHbpXEUeCharged  = 
1227     new TH2F("hHbpXEUeCharged","#xi = ln(1/x_{E}) with charged hadrons,Underlying Event",
1228              nptbins,ptmin,ptmax,200,0.,10.); 
1229     fhPtHbpXEUeCharged->SetYTitle("ln(1/x_{E})");
1230     fhPtHbpXEUeCharged->SetXTitle("p_{T trigger} (GeV/c)");
1231     
1232     fhZTCharged  = 
1233     new TH2F("hZTCharged","z_{T} for charged tracks",
1234              nptbins,ptmin,ptmax,200,0.,2.); 
1235     fhZTCharged->SetYTitle("z_{T}");
1236     fhZTCharged->SetXTitle("p_{T trigger}");
1237     
1238     fhZTUeCharged  = 
1239     new TH2F("hZTUeCharged","z_{T} for Underlying Event",
1240              nptbins,ptmin,ptmax,200,0.,2.); 
1241     fhZTUeCharged->SetYTitle("z_{T}");
1242     fhZTUeCharged->SetXTitle("p_{T trigger} (GeV/c)");
1243     
1244     fhZTPosCharged  = 
1245     new TH2F("hZTPositiveCharged","z_{T} for positive charged tracks",
1246              nptbins,ptmin,ptmax,200,0.,2.); 
1247     fhZTPosCharged->SetYTitle("z_{T}");
1248     fhZTPosCharged->SetXTitle("p_{T trigger} (GeV/c)");
1249     
1250     fhZTNegCharged  = 
1251     new TH2F("hZTNegativeCharged","z_{T} for negative charged tracks",
1252              nptbins,ptmin,ptmax,200,0.,2.); 
1253     fhZTNegCharged->SetYTitle("z_{T}");
1254     fhZTNegCharged->SetXTitle("p_{T trigger} (GeV/c)");
1255     
1256     fhPtHbpZTCharged  = 
1257     new TH2F("hHbpZTCharged","#xi = ln(1/z_{T}) with charged hadrons",
1258              nptbins,ptmin,ptmax,200,0.,10.); 
1259     fhPtHbpZTCharged->SetYTitle("ln(1/z_{T})");
1260     fhPtHbpZTCharged->SetXTitle("p_{T trigger} (GeV/c)");
1261     
1262     fhPtHbpZTUeCharged  = 
1263     new TH2F("hHbpZTUeCharged","#xi = ln(1/z_{T}) with charged hadrons,Underlying Event",
1264              nptbins,ptmin,ptmax,200,0.,10.); 
1265     fhPtHbpZTUeCharged->SetYTitle("ln(1/x_{E})");
1266     fhPtHbpZTUeCharged->SetXTitle("p_{T trigger} (GeV/c)");
1267     
1268     fhPtTrigPout  = 
1269     new TH2F("hPtTrigPout","Pout with triggers",
1270              nptbins,ptmin,ptmax,2*nptbins,-ptmax,ptmax); 
1271     fhPtTrigPout->SetYTitle("p_{out} (GeV/c)");
1272     fhPtTrigPout->SetXTitle("p_{T trigger} (GeV/c)"); 
1273     
1274     fhPtTrigCharged  = 
1275     new TH2F("hPtTrigCharged","trigger and charged tracks pt distribution",
1276              nptbins,ptmin,ptmax,nptbins,ptmin,ptmax); 
1277     fhPtTrigCharged->SetYTitle("p_{T h^{#pm}} (GeV/c)");
1278     fhPtTrigCharged->SetXTitle("p_{T trigger} (GeV/c)");    
1279           
1280     outputContainer->Add(fhDeltaPhiDeltaEtaCharged);
1281     outputContainer->Add(fhDeltaPhiDeltaEtaChargedPtA3GeV);
1282     outputContainer->Add(fhPhiCharged) ;
1283     outputContainer->Add(fhEtaCharged) ;
1284     outputContainer->Add(fhDeltaPhiCharged) ; 
1285     outputContainer->Add(fhDeltaPhiChargedPtA3GeV) ; 
1286     outputContainer->Add(fhDeltaEtaCharged) ;
1287     outputContainer->Add(fhDeltaEtaChargedPtA3GeV) ;
1288     outputContainer->Add(fhDeltaPhiChargedPt) ;
1289     outputContainer->Add(fhDeltaPhiUeChargedPt) ;
1290     outputContainer->Add(fhUePart);
1291
1292     outputContainer->Add(fhXECharged) ;
1293   
1294     if(IsDataMC())
1295     {
1296       for(Int_t i=0; i < 7; i++)
1297       {
1298         
1299         fhDeltaPhiChargedMC[i]  = new TH2F(Form("hDeltaPhiCharged_MC%s",nameMC[i].Data()),
1300                                      Form("#Delta #phi for charged tracks, trigger origin is %s",nameMC[i].Data()),
1301                                      nptbins,ptmin,ptmax,ndeltaphibins ,deltaphimin,deltaphimax); 
1302         fhDeltaPhiChargedMC[i]->SetYTitle("x_{E}");
1303         fhDeltaPhiChargedMC[i]->SetXTitle("p_{T trigger} (GeV/c)");
1304         outputContainer->Add(fhDeltaPhiChargedMC[i]) ;
1305         
1306         fhXEChargedMC[i]  = new TH2F(Form("hXECharged_MC%s",nameMC[i].Data()),
1307                                      Form("x_{E} for charged tracks, trigger origin is %s",nameMC[i].Data()),
1308          nptbins,ptmin,ptmax,200,0.,2.); 
1309         fhXEChargedMC[i]->SetYTitle("x_{E}");
1310         fhXEChargedMC[i]->SetXTitle("p_{T trigger} (GeV/c)");
1311         outputContainer->Add(fhXEChargedMC[i]) ;
1312       }
1313     }
1314   
1315     outputContainer->Add(fhXEPosCharged) ;
1316     outputContainer->Add(fhXENegCharged) ;
1317     outputContainer->Add(fhXEUeCharged) ;
1318     outputContainer->Add(fhPtHbpXECharged) ;
1319     outputContainer->Add(fhPtHbpXEUeCharged) ;
1320
1321     outputContainer->Add(fhZTCharged) ;
1322     outputContainer->Add(fhZTPosCharged) ;
1323     outputContainer->Add(fhZTNegCharged) ;
1324     outputContainer->Add(fhZTUeCharged) ;
1325     outputContainer->Add(fhPtHbpZTCharged) ;
1326     outputContainer->Add(fhPtHbpZTUeCharged) ;
1327     
1328     outputContainer->Add(fhPtTrigPout) ;
1329     outputContainer->Add(fhPtTrigCharged) ;
1330     
1331     if(fFillPileUpHistograms)
1332     {
1333       fhDeltaPhiChargedOtherBC  = new TH2F
1334       ("hDeltaPhiChargedOtherBC","#phi_{trigger} - #phi_{h^{#pm}} vs p_{T trigger}, track BC!=0",
1335        nptbins,ptmin,ptmax, ndeltaphibins ,deltaphimin,deltaphimax);
1336       fhDeltaPhiChargedOtherBC->SetYTitle("#Delta #phi (rad)");
1337       fhDeltaPhiChargedOtherBC->SetXTitle("p_{T trigger} (GeV/c)");
1338       
1339       fhDeltaPhiChargedPtA3GeVOtherBC  = new TH2F
1340       ("hDeltaPhiChargedPtA3GeVOtherBC","#phi_{trigger} - #phi_{h^{#pm}} vs p_{T trigger}, p_{TA}>3 GeV/c, track BC!=0",
1341        nptbins,ptmin,ptmax, ndeltaphibins ,deltaphimin,deltaphimax);
1342       fhDeltaPhiChargedPtA3GeVOtherBC->SetYTitle("#Delta #phi (rad)");
1343       fhDeltaPhiChargedPtA3GeVOtherBC->SetXTitle("p_{T trigger} (GeV/c)");
1344       
1345       fhPtTrigChargedOtherBC  =
1346       new TH2F("hPtTrigChargedOtherBC","trigger and charged tracks pt distribution, track BC!=0",
1347                nptbins,ptmin,ptmax,nptbins,ptmin,ptmax);
1348       fhPtTrigChargedOtherBC->SetYTitle("p_{T h^{#pm}} (GeV/c)");
1349       fhPtTrigChargedOtherBC->SetXTitle("p_{T trigger} (GeV/c)");
1350       
1351       fhXEChargedOtherBC  =
1352       new TH2F("hXEChargedOtherBC","x_{E} for charged tracks, track BC!=0",
1353                nptbins,ptmin,ptmax,200,0.,2.);
1354       fhXEChargedOtherBC->SetYTitle("x_{E}");
1355       fhXEChargedOtherBC->SetXTitle("p_{T trigger} (GeV/c)");
1356       
1357       fhXEUeChargedOtherBC  =
1358       new TH2F("hXEUeChargedOtherBC","x_{E} for Underlying Event, track BC!=0",
1359                nptbins,ptmin,ptmax,200,0.,2.);
1360       fhXEUeChargedOtherBC->SetYTitle("x_{E}");
1361       fhXEUeChargedOtherBC->SetXTitle("p_{T trigger} (GeV/c)");
1362       
1363       fhZTChargedOtherBC  =
1364       new TH2F("hZTChargedOtherBC","z_{T} for charged tracks, track BC!=0",
1365                nptbins,ptmin,ptmax,200,0.,2.);
1366       fhZTChargedOtherBC->SetYTitle("z_{T}");
1367       fhZTChargedOtherBC->SetXTitle("p_{T trigger}");
1368       
1369       fhZTUeChargedOtherBC  =
1370       new TH2F("hZTUeChargedOtherBC","z_{T} for Underlying Event, track BC!=0",
1371                nptbins,ptmin,ptmax,200,0.,2.);
1372       fhZTUeChargedOtherBC->SetYTitle("z_{T}");
1373       fhZTUeChargedOtherBC->SetXTitle("p_{T trigger} (GeV/c)");
1374       
1375       outputContainer->Add(fhDeltaPhiChargedOtherBC) ;
1376       outputContainer->Add(fhDeltaPhiChargedPtA3GeVOtherBC) ;
1377       outputContainer->Add(fhXEChargedOtherBC) ;
1378       outputContainer->Add(fhXEUeChargedOtherBC) ;
1379       outputContainer->Add(fhZTChargedOtherBC) ;
1380       outputContainer->Add(fhZTUeChargedOtherBC) ;
1381       outputContainer->Add(fhPtTrigChargedOtherBC) ;    
1382
1383       fhDeltaPhiChargedBC0  = new TH2F
1384       ("hDeltaPhiChargedBC0","#phi_{trigger} - #phi_{h^{#pm}} vs p_{T trigger}, track BC==0",
1385        nptbins,ptmin,ptmax, ndeltaphibins ,deltaphimin,deltaphimax);
1386       fhDeltaPhiChargedBC0->SetYTitle("#Delta #phi (rad)");
1387       fhDeltaPhiChargedBC0->SetXTitle("p_{T trigger} (GeV/c)");
1388       
1389       fhDeltaPhiChargedPtA3GeVBC0  = new TH2F
1390       ("hDeltaPhiChargedPtA3GeVBC0","#phi_{trigger} - #phi_{h^{#pm}} vs p_{T trigger}, p_{TA}>3 GeV/c, track BC==0",
1391        nptbins,ptmin,ptmax, ndeltaphibins ,deltaphimin,deltaphimax);
1392       fhDeltaPhiChargedPtA3GeVBC0->SetYTitle("#Delta #phi (rad)");
1393       fhDeltaPhiChargedPtA3GeVBC0->SetXTitle("p_{T trigger} (GeV/c)");
1394       
1395       fhPtTrigChargedBC0  =
1396       new TH2F("hPtTrigChargedBC0","trigger and charged tracks pt distribution, track BC==0",
1397                nptbins,ptmin,ptmax,nptbins,ptmin,ptmax);
1398       fhPtTrigChargedBC0->SetYTitle("p_{T h^{#pm}} (GeV/c)");
1399       fhPtTrigChargedBC0->SetXTitle("p_{T trigger} (GeV/c)");
1400       
1401       fhXEChargedBC0  =
1402       new TH2F("hXEChargedBC0","x_{E} for charged tracks, track BC==0",
1403                nptbins,ptmin,ptmax,200,0.,2.);
1404       fhXEChargedBC0->SetYTitle("x_{E}");
1405       fhXEChargedBC0->SetXTitle("p_{T trigger} (GeV/c)");
1406       
1407       fhXEUeChargedBC0  =
1408       new TH2F("hXEUeChargedBC0","x_{E} for Underlying Event, track BC==0",
1409                nptbins,ptmin,ptmax,200,0.,2.);
1410       fhXEUeChargedBC0->SetYTitle("x_{E}");
1411       fhXEUeChargedBC0->SetXTitle("p_{T trigger} (GeV/c)");
1412       
1413       fhZTChargedBC0  =
1414       new TH2F("hZTChargedBC0","z_{T} for charged tracks, track BC==0",
1415                nptbins,ptmin,ptmax,200,0.,2.);
1416       fhZTChargedBC0->SetYTitle("z_{T}");
1417       fhZTChargedBC0->SetXTitle("p_{T trigger}");
1418       
1419       fhZTUeChargedBC0  =
1420       new TH2F("hZTUeChargedBC0","z_{T} for Underlying Event, track BC==0",
1421                nptbins,ptmin,ptmax,200,0.,2.);
1422       fhZTUeChargedBC0->SetYTitle("z_{T}");
1423       fhZTUeChargedBC0->SetXTitle("p_{T trigger} (GeV/c)");
1424       
1425       outputContainer->Add(fhDeltaPhiChargedBC0) ;
1426       outputContainer->Add(fhDeltaPhiChargedPtA3GeVBC0) ;
1427       outputContainer->Add(fhXEChargedBC0) ;
1428       outputContainer->Add(fhXEUeChargedBC0) ;
1429       outputContainer->Add(fhZTChargedBC0) ;
1430       outputContainer->Add(fhZTUeChargedBC0) ;
1431       outputContainer->Add(fhPtTrigChargedBC0) ;
1432
1433       
1434       for(Int_t i = 0 ; i < 7 ; i++)
1435       {
1436         fhPtLeadingPileUp[i]  = new TH1F(Form("hPtLeadingPileUp%s",pileUpName[i].Data()),
1437                                          Form("p_{T} distribution of leading particles, %s Pile-Up event",pileUpName[i].Data()), nptbins,ptmin,ptmax);
1438         fhPtLeadingPileUp[i]->SetXTitle("p_{T}^{trig} (GeV/c)");
1439         outputContainer->Add(fhPtLeadingPileUp[i]);
1440         
1441         fhDeltaPhiChargedPileUp[i]  = new TH2F(Form("hDeltaPhiChargedPileUp%s",pileUpName[i].Data()),
1442                                                     Form("#phi_{trigger} - #phi_{h^{#pm}} vs p_{T trigger}, %s Pile-Up event",pileUpName[i].Data()),
1443          nptbins,ptmin,ptmax, ndeltaphibins ,deltaphimin,deltaphimax);
1444         fhDeltaPhiChargedPileUp[i]->SetYTitle("#Delta #phi (rad)");
1445         fhDeltaPhiChargedPileUp[i]->SetXTitle("p_{T trigger} (GeV/c)");
1446         outputContainer->Add(fhDeltaPhiChargedPileUp[i]) ;
1447         
1448         fhDeltaPhiChargedPtA3GeVPileUp[i]  = new TH2F(Form("hDeltaPhiChargedPtA3GeVPileUp%s",pileUpName[i].Data()),
1449                                                            Form("#phi_{trigger} - #phi_{h^{#pm}} vs p_{T trigger}, p_{TA}>3 GeV/c, %s Pile-Up event",pileUpName[i].Data()),
1450          nptbins,ptmin,ptmax, ndeltaphibins ,deltaphimin,deltaphimax);
1451         fhDeltaPhiChargedPtA3GeVPileUp[i]->SetYTitle("#Delta #phi (rad)");
1452         fhDeltaPhiChargedPtA3GeVPileUp[i]->SetXTitle("p_{T trigger} (GeV/c)");
1453         outputContainer->Add(fhDeltaPhiChargedPtA3GeVPileUp[i]) ;
1454         
1455         fhDeltaEtaChargedPileUp[i]  = new TH2F(Form("hDeltaEtaChargedPileUp%s",pileUpName[i].Data()),
1456                                                     Form("#eta_{trigger} - #eta_{h^{#pm}} vs p_{T trigger}, %s Pile-Up event",pileUpName[i].Data()),
1457          nptbins,ptmin,ptmax,ndeltaetabins,deltaetamin,deltaetamax);  
1458         fhDeltaEtaChargedPileUp[i]->SetYTitle("#Delta #eta");
1459         fhDeltaEtaChargedPileUp[i]->SetXTitle("p_{T trigger} (GeV/c)");
1460         outputContainer->Add(fhDeltaEtaChargedPileUp[i]) ;
1461         
1462         fhDeltaEtaChargedPtA3GeVPileUp[i]  = new TH2F(Form("hDeltaEtaChargedPtA3GeVPileUp%s",pileUpName[i].Data()),
1463                                                            Form("#eta_{trigger} - #eta_{h^{#pm}} vs p_{T trigger}, p_{TA}>3 GeV/c, %s Pile-Up event",pileUpName[i].Data()),
1464          nptbins,ptmin,ptmax,ndeltaetabins,deltaetamin,deltaetamax);  
1465         fhDeltaEtaChargedPtA3GeVPileUp[i]->SetYTitle("#Delta #eta");
1466         fhDeltaEtaChargedPtA3GeVPileUp[i]->SetXTitle("p_{T trigger} (GeV/c)");    
1467         outputContainer->Add(fhDeltaEtaChargedPtA3GeVPileUp[i]) ;
1468         
1469         fhXEChargedPileUp[i]  = new TH2F(Form("hXEChargedPileUp%s",pileUpName[i].Data()),
1470                                               Form("x_{E} for charged tracks, %s Pile-Up event",pileUpName[i].Data()),
1471                  nptbins,ptmin,ptmax,200,0.,2.); 
1472         fhXEChargedPileUp[i]->SetYTitle("x_{E}");
1473         fhXEChargedPileUp[i]->SetXTitle("p_{T trigger} (GeV/c)");
1474         outputContainer->Add(fhXEChargedPileUp[i]) ;
1475         
1476         fhXEUeChargedPileUp[i]  = new TH2F(Form("hXEUeChargedPileUp%s",pileUpName[i].Data()),
1477                                                 Form("x_{E} for Underlying Event, %s Pile-Up event",pileUpName[i].Data()),
1478                  nptbins,ptmin,ptmax,200,0.,2.); 
1479         fhXEUeChargedPileUp[i]->SetYTitle("x_{E}");
1480         fhXEUeChargedPileUp[i]->SetXTitle("p_{T trigger} (GeV/c)");
1481         outputContainer->Add(fhXEUeChargedPileUp[i]) ;
1482         
1483         fhZTChargedPileUp[i]  = new TH2F(Form("hZTChargedPileUp%s",pileUpName[i].Data()),
1484                                               Form("z_{T} for charged tracks, %s Pile-Up event",pileUpName[i].Data()),
1485                  nptbins,ptmin,ptmax,200,0.,2.); 
1486         fhZTChargedPileUp[i]->SetYTitle("z_{T}");
1487         fhZTChargedPileUp[i]->SetXTitle("p_{T trigger} (GeV/c)");
1488         outputContainer->Add(fhZTChargedPileUp[i]) ;
1489         
1490         fhZTUeChargedPileUp[i]  = new TH2F(Form("hZTUeChargedPileUp%s",pileUpName[i].Data()),
1491                                                 Form("z_{T} for Underlying Event, %s Pile-Up event",pileUpName[i].Data()),
1492                  nptbins,ptmin,ptmax,200,0.,2.); 
1493         fhZTUeChargedPileUp[i]->SetYTitle("z_{T}");
1494         fhZTUeChargedPileUp[i]->SetXTitle("p_{T trigger} (GeV/c)");
1495         outputContainer->Add(fhZTUeChargedPileUp[i]) ;
1496         
1497         fhPtTrigChargedPileUp[i]  = new TH2F(Form("hPtTrigChargedPileUp%s",pileUpName[i].Data()),
1498                                                   Form("trigger and charged tracks pt distribution, %s Pile-Up event",pileUpName[i].Data()),
1499                  nptbins,ptmin,ptmax,nptbins,ptmin,ptmax); 
1500         fhPtTrigChargedPileUp[i]->SetYTitle("p_{T h^{#pm}} (GeV/c)");
1501         fhPtTrigChargedPileUp[i]->SetXTitle("p_{T trigger} (GeV/c)");    
1502         outputContainer->Add(fhPtTrigChargedPileUp[i]) ;
1503         
1504       }
1505     }
1506     
1507     if(DoEventSelect())
1508     { 
1509       Int_t nMultiBins = GetMultiBin();
1510       fhTrigDeltaPhiCharged = new TH2F*[nMultiBins] ;
1511       fhTrigDeltaEtaCharged = new TH2F*[nMultiBins] ;
1512       fhTrigXECorr          = new TH2F*[nMultiBins] ;
1513       fhTrigXEUeCorr        = new TH2F*[nMultiBins] ;
1514       fhTrigZTCorr          = new TH2F*[nMultiBins] ;
1515       fhTrigZTUeCorr        = new TH2F*[nMultiBins] ;
1516       
1517       for(Int_t im=0; im<nMultiBins; im++)
1518       {
1519         fhTrigDeltaPhiCharged[im]  = new TH2F 
1520         (Form("hTrigDeltaPhiCharged_%d",im),Form("hTrigDeltaPhiCharged_%d",im), nptbins,ptmin,ptmax, ndeltaphibins ,deltaphimin,deltaphimax); 
1521         fhTrigDeltaPhiCharged[im]->SetXTitle("p_{T trigger} (GeV/c)");
1522         fhTrigDeltaPhiCharged[im]->SetYTitle("#Delta #phi (rad)");
1523         
1524         fhTrigDeltaEtaCharged[im]  = new TH2F 
1525         (Form("hTrigDeltaEtaCharged_%d",im),Form("hTrigDeltaEtaCharged_%d",im), nptbins,ptmin,ptmax, ndeltaetabins ,deltaetamin,deltaetamax); 
1526         fhTrigDeltaEtaCharged[im]->SetXTitle("p_{T trigger} (GeV/c)");
1527         fhTrigDeltaEtaCharged[im]->SetYTitle("#Delta #eta");
1528         
1529         fhTrigXECorr[im]  = new TH2F
1530         (Form("hTrigXEPtCorr_%d",im),Form("hTrigXEPtCorr_%d",im), nptbins,ptmin,ptmax,200,0.,2.); 
1531         fhTrigXECorr[im]->SetYTitle("x_{E trigger h^{#pm}}");
1532         fhTrigXECorr[im]->SetXTitle("p_{T trigger} (GeV/c)");
1533         
1534         fhTrigXEUeCorr[im]  = new TH2F
1535         (Form("hTrigXEPtUeCorr_%d",im),Form("hTrigXEPtUeCorr_%d",im), nptbins,ptmin,ptmax,200,0.,2.); 
1536         fhTrigXEUeCorr[im]->SetYTitle("x_{E trigger h^{#pm}}");
1537         fhTrigXEUeCorr[im]->SetXTitle("p_{T trigger}(GeV/c)");       
1538         
1539         fhTrigZTCorr[im]  = new TH2F
1540         (Form("hTrigZTPtCorr_%d",im),Form("hTrigZTPtCorr_%d",im), nptbins,ptmin,ptmax,200,0.,2.); 
1541         fhTrigZTCorr[im]->SetYTitle("z_{trigger h^{#pm}}");
1542         fhTrigZTCorr[im]->SetXTitle("p_{T trigger} (GeV/c)");
1543         
1544         fhTrigZTUeCorr[im]  = new TH2F
1545         (Form("hTrigZTPtUeCorr_%d",im),Form("hTrigZTPtUeCorr_%d",im), nptbins,ptmin,ptmax,200,0.,2.); 
1546         fhTrigZTUeCorr[im]->SetYTitle("z_{trigger h^{#pm}}");
1547         fhTrigZTUeCorr[im]->SetXTitle("p_{T trigger} (GeV/c)");               
1548         
1549         outputContainer->Add(fhTrigDeltaPhiCharged[im]) ;
1550         outputContainer->Add(fhTrigDeltaEtaCharged[im]) ;
1551         outputContainer->Add(fhTrigXECorr[im]);
1552         outputContainer->Add(fhTrigXEUeCorr[im]);
1553         outputContainer->Add(fhTrigZTCorr[im]);
1554         outputContainer->Add(fhTrigZTUeCorr[im]);
1555       }
1556     }
1557     
1558     if(fFillBradHisto)
1559     {
1560       fhAssocPtBkg        = new TH2F("hAssocPtBkg", " Trigger p_{T} vs associated hadron p_{T} from background",
1561                                      nptbins, ptmin, ptmax,nptbins,ptmin,ptmax);
1562       fhAssocPtBkg->SetXTitle("p_{T trigger} (GeV/c)");
1563       fhAssocPtBkg->SetYTitle("p_{T associated} (GeV/c)");
1564       outputContainer->Add(fhAssocPtBkg) ;
1565       
1566       fhDeltaPhiBrad = new TH2F("hDeltaPhiBrad","atan2(sin(#Delta #phi), cos(#Delta #phi))/#pi vs p_{T trigger} ", 
1567                                 nptbins, ptmin, ptmax,288, -1.0/3.0, 5.0/3.0);
1568       fhDeltaPhiBrad->SetXTitle("p_{T trigger} (GeV/c)");
1569       fhDeltaPhiBrad->SetYTitle("atan2(sin(#Delta #phi), cos(#Delta #phi))/#pi");
1570       outputContainer->Add(fhDeltaPhiBrad) ;
1571     }
1572
1573     fhDeltaPhiDeltaEtaAssocPtBin = new TH2F*[fNAssocPtBins*nz];
1574     fhDeltaPhiAssocPtBin       = new TH2F*[fNAssocPtBins*nz];
1575     fhDeltaPhiAssocPtBinDEta08 = new TH2F*[fNAssocPtBins*nz];
1576     fhDeltaPhiAssocPtBinDEta0  = new TH2F*[fNAssocPtBins*nz];
1577     fhXEAssocPtBin             = new TH2F*[fNAssocPtBins*nz];
1578     fhZTAssocPtBin             = new TH2F*[fNAssocPtBins*nz];
1579     
1580     if(fFillBradHisto)  
1581       fhDeltaPhiBradAssocPtBin = new TH2F*[fNAssocPtBins*nz];
1582     
1583     if(fPi0Trigger || fDecayTrigger)
1584     {
1585       fhDeltaPhiAssocPtBin       = new TH2F*[fNAssocPtBins*nz];
1586       fhDeltaPhiAssocPtBinDEta08 = new TH2F*[fNAssocPtBins*nz];
1587       fhXEAssocPtBin             = new TH2F*[fNAssocPtBins*nz];
1588       fhZTAssocPtBin             = new TH2F*[fNAssocPtBins*nz];
1589       fhXEDecayChargedAssocPtBin = new TH2F*[fNAssocPtBins*nz];
1590       fhZTDecayChargedAssocPtBin = new TH2F*[fNAssocPtBins*nz];
1591       fhDeltaPhiDecayChargedAssocPtBin = new TH2F*[fNAssocPtBins*nz];
1592     }
1593
1594     if(fHMPIDCorrelation)
1595     {
1596       fhDeltaPhiAssocPtBinHMPID   = new TH2F*[fNAssocPtBins*nz];
1597       fhDeltaPhiAssocPtBinHMPIDAcc= new TH2F*[fNAssocPtBins*nz];
1598     }
1599     
1600     for(Int_t i = 0 ; i < fNAssocPtBins ; i++)
1601     {
1602       for(Int_t z = 0 ; z < nz ; z++)
1603       {
1604         Int_t bin = i*nz+z;
1605         
1606         if(fCorrelVzBin)
1607         {
1608           sz = "_vz%d"+z;
1609           tz = ", v_{z} bin "+z;
1610         }
1611         
1612         //printf("iAssoc %d, Vz %d, bin %d - sz %s, tz %s       \n",i,z,bin,sz.Data(),tz.Data());
1613         
1614         fhDeltaPhiDeltaEtaAssocPtBin[bin]  = new TH2F(Form("hDeltaPhiDeltaEtaPtAssocPt%2.1f_%2.1f%s", fAssocPtBinLimit[i], fAssocPtBinLimit[i+1],sz.Data()), 
1615                                                  Form("#Delta #phi vs #Delta #eta for associated p_{T} bin [%2.1f,%2.1f]%s", fAssocPtBinLimit[i], fAssocPtBinLimit[i+1],tz.Data()), 
1616                                                  ndeltaphibins ,deltaphimin,deltaphimax,ndeltaetabins,deltaetamin,deltaetamax); 
1617         fhDeltaPhiDeltaEtaAssocPtBin[bin]->SetXTitle("#Delta #phi (rad)");
1618         fhDeltaPhiDeltaEtaAssocPtBin[bin]->SetYTitle("#Delta #eta");  
1619         
1620         fhDeltaPhiAssocPtBin[bin] = new TH2F(Form("hDeltaPhiPtAssocPt%2.1f_%2.1f%s", fAssocPtBinLimit[i], fAssocPtBinLimit[i+1],sz.Data()), 
1621                                            Form("#Delta #phi vs p_{T trigger} for associated p_{T} bin [%2.1f,%2.1f]%s", fAssocPtBinLimit[i], fAssocPtBinLimit[i+1],tz.Data()), 
1622                                            nptbins, ptmin, ptmax, ndeltaphibins ,deltaphimin,deltaphimax);
1623         fhDeltaPhiAssocPtBin[bin]->SetXTitle("p_{T trigger} (GeV/c)");
1624         fhDeltaPhiAssocPtBin[bin]->SetYTitle("#Delta #phi (rad)");
1625         
1626         fhDeltaPhiAssocPtBinDEta08[bin] = new TH2F(Form("hDeltaPhiDeltaEta0.8PtAssocPt%2.1f_%2.1f%s", fAssocPtBinLimit[i], fAssocPtBinLimit[i+1],sz.Data()), 
1627                                                  Form("#Delta #phi vs p_{T trigger} for associated p_{T} bin [%2.1f,%2.1f]%s, for #Delta #eta > 0.8", fAssocPtBinLimit[i], fAssocPtBinLimit[i+1],tz.Data()), 
1628                                                  nptbins, ptmin, ptmax, ndeltaphibins ,deltaphimin,deltaphimax);
1629         fhDeltaPhiAssocPtBinDEta08[bin]->SetXTitle("p_{T trigger} (GeV/c)");
1630         fhDeltaPhiAssocPtBinDEta08[bin]->SetYTitle("#Delta #phi (rad)");      
1631
1632         fhDeltaPhiAssocPtBinDEta0[bin] = new TH2F(Form("hDeltaPhiDeltaEta0PtAssocPt%2.1f_%2.1f%s", fAssocPtBinLimit[i], fAssocPtBinLimit[i+1],tz.Data()), 
1633                                                    Form("#Delta #phi vs p_{T trigger} for associated p_{T} bin [%2.1f,%2.1f]%s, for #Delta #eta = 0.", fAssocPtBinLimit[i], fAssocPtBinLimit[i+1],tz.Data()), 
1634                                                    nptbins, ptmin, ptmax, ndeltaphibins ,deltaphimin,deltaphimax);
1635         fhDeltaPhiAssocPtBinDEta0[bin]->SetXTitle("p_{T trigger} (GeV/c)");
1636         fhDeltaPhiAssocPtBinDEta0[bin]->SetYTitle("#Delta #phi (rad)");    
1637         
1638         fhXEAssocPtBin[bin]       = new TH2F(Form("hXEAssocPtBin%1.f_%1.f%s", fAssocPtBinLimit[i], fAssocPtBinLimit[i+1],sz.Data()), 
1639                                            Form("x_{E} vs p_{T trigger} for associated p_{T} bin [%2.1f,%2.1f]%s", fAssocPtBinLimit[i], fAssocPtBinLimit[i+1],tz.Data()), 
1640                                            nptbins, ptmin, ptmax,200, 0.0, 2.0);
1641         fhXEAssocPtBin[bin]->SetXTitle("p_{T trigger} (GeV/c)");
1642         fhXEAssocPtBin[bin]->SetYTitle("x_{E}");
1643         
1644         fhZTAssocPtBin[bin]       = new TH2F(Form("hZTAssocPtBin%1.f_%1.f%s", fAssocPtBinLimit[i], fAssocPtBinLimit[i+1],sz.Data()), 
1645                                            Form("z_{T} vs p_{T trigger} for associated p_{T} bin [%2.1f,%2.1f]%s", fAssocPtBinLimit[i], fAssocPtBinLimit[i+1],tz.Data()), 
1646                                            nptbins, ptmin, ptmax,200, 0.0, 2.0);
1647         fhZTAssocPtBin[bin]->SetXTitle("p_{T trigger} (GeV/c)");
1648         fhZTAssocPtBin[bin]->SetYTitle("z_{T}");
1649         
1650         outputContainer->Add(fhDeltaPhiDeltaEtaAssocPtBin[bin]) ;
1651         outputContainer->Add(fhDeltaPhiAssocPtBin[bin]) ;
1652         outputContainer->Add(fhDeltaPhiAssocPtBinDEta08[bin]) ;
1653         outputContainer->Add(fhDeltaPhiAssocPtBinDEta0[bin]) ;
1654         outputContainer->Add(fhXEAssocPtBin[bin]);
1655         outputContainer->Add(fhZTAssocPtBin[bin]);
1656
1657         if(fPi0Trigger || fDecayTrigger) 
1658         {
1659           fhDeltaPhiDecayChargedAssocPtBin[bin] = new TH2F(Form("hDeltaPhiPtDecayChargedAssocPt%2.1f_%2.1f%s", fAssocPtBinLimit[i], fAssocPtBinLimit[i+1],sz.Data()), 
1660                                                          Form("#Delta #phi vs p_{T trigger} tagged as decay for associated p_{T} bin [%2.1f,%2.1f]%s", fAssocPtBinLimit[i], fAssocPtBinLimit[i+1],tz.Data()), 
1661                                                          nptbins, ptmin, ptmax, ndeltaphibins ,deltaphimin,deltaphimax);
1662           fhDeltaPhiDecayChargedAssocPtBin[bin]->SetXTitle("p_{T trigger} (GeV/c)");
1663           fhDeltaPhiDecayChargedAssocPtBin[bin]->SetYTitle("#Delta #phi (rad)");
1664           
1665           fhXEDecayChargedAssocPtBin[bin]       = new TH2F(Form("hXEDecayChargedAssocPtBin%1.f_%1.f%s", fAssocPtBinLimit[i], fAssocPtBinLimit[i+1],sz.Data()), 
1666                                                          Form("x_{E} vs p_{T trigger} tagged as decay for associated p_{T} bin [%2.1f,%2.1f]%s", fAssocPtBinLimit[i], fAssocPtBinLimit[i+1],tz.Data()), 
1667                                                          nptbins, ptmin, ptmax,200, 0.0, 2.0);
1668           fhXEDecayChargedAssocPtBin[bin]->SetXTitle("p_{T trigger} (GeV/c)");
1669           fhXEDecayChargedAssocPtBin[bin]->SetYTitle("x_{E}");
1670           
1671           fhZTDecayChargedAssocPtBin[bin]       = new TH2F(Form("hZTDecayChargedAssocPtBin%1.f_%1.f%s", fAssocPtBinLimit[i], fAssocPtBinLimit[i+1],sz.Data()), 
1672                                                          Form("z_{T} vs p_{T trigger} tagged as decay for associated p_{T} bin [%2.1f,%2.1f]%s", fAssocPtBinLimit[i], fAssocPtBinLimit[i+1],tz.Data()), 
1673                                                          nptbins, ptmin, ptmax,200, 0.0, 2.0);
1674           fhZTDecayChargedAssocPtBin[bin]->SetXTitle("p_{T trigger} (GeV/c)");
1675           fhZTDecayChargedAssocPtBin[bin]->SetYTitle("z_{T}");
1676           
1677           outputContainer->Add(fhDeltaPhiDecayChargedAssocPtBin[bin]) ;
1678           outputContainer->Add(fhXEDecayChargedAssocPtBin[bin]);
1679           outputContainer->Add(fhZTDecayChargedAssocPtBin[bin]);
1680           
1681         }
1682         
1683         if(fFillBradHisto) 
1684         {
1685           fhDeltaPhiBradAssocPtBin[bin] = new TH2F(Form("hDeltaPhiBradPtAssocPt%2.1f_%2.1f%s", fAssocPtBinLimit[i], fAssocPtBinLimit[i+1],sz.Data()), 
1686                                                  Form("atan2(sin(#Delta #phi), cos(#Delta #phi))/#pi vs p_{T trigger} for associated p_{T} bin [%2.1f,%2.1f]%s", fAssocPtBinLimit[i], fAssocPtBinLimit[i+1],tz.Data()), 
1687                                                  nptbins, ptmin, ptmax,288, -1.0/3.0, 5.0/3.0);
1688           fhDeltaPhiBradAssocPtBin[bin]->SetXTitle("p_{T trigger} (GeV/c)");
1689           fhDeltaPhiBradAssocPtBin[bin]->SetYTitle("atan2(sin(#Delta #phi), cos(#Delta #phi))/#pi");
1690           outputContainer->Add(fhDeltaPhiBradAssocPtBin[bin]) ;
1691         }       
1692         
1693         if(fHMPIDCorrelation)
1694         {
1695           fhDeltaPhiAssocPtBinHMPID[bin] = new TH2F(Form("hDeltaPhiPtAssocPt%2.1f_%2.1f%sHMPID", fAssocPtBinLimit[i], fAssocPtBinLimit[i+1],sz.Data()), 
1696                                                   Form("#Delta #phi vs p_{T trigger} for associated p_{T} bin [%2.1f,%2.1f]%s, with track having HMPID signal", fAssocPtBinLimit[i], fAssocPtBinLimit[i+1],tz.Data()), 
1697                                                   nptbins, ptmin, ptmax, ndeltaphibins ,deltaphimin,deltaphimax);
1698           fhDeltaPhiAssocPtBinHMPID[bin]->SetXTitle("p_{T trigger} (GeV/c)" );
1699           fhDeltaPhiAssocPtBinHMPID[bin]->SetYTitle("#Delta #phi (rad)");      
1700           
1701           fhDeltaPhiAssocPtBinHMPIDAcc[bin] = new TH2F(Form("hDeltaPhiPtAssocPt%2.1f_%2.1f%sHMPIDAcc", fAssocPtBinLimit[i], fAssocPtBinLimit[i+1],sz.Data()), 
1702                                                      Form("#Delta #phi vs p_{T trigger} for associated p_{T} bin [%2.1f,%2.1f]%s, with track within 5<phi<20 deg", fAssocPtBinLimit[i], fAssocPtBinLimit[i+1],tz.Data()), 
1703                                                      nptbins, ptmin, ptmax, ndeltaphibins ,deltaphimin,deltaphimax);
1704           fhDeltaPhiAssocPtBinHMPIDAcc[bin]->SetXTitle("p_{T trigger} (GeV/c)");
1705           fhDeltaPhiAssocPtBinHMPIDAcc[bin]->SetYTitle("#Delta #phi (rad)"); 
1706           
1707           outputContainer->Add(fhDeltaPhiAssocPtBinHMPID[bin]) ;
1708           outputContainer->Add(fhDeltaPhiAssocPtBinHMPIDAcc[bin]) ;
1709           
1710         }      
1711       }
1712     }
1713     
1714     if(fPi0Trigger || fDecayTrigger)
1715     {
1716       if(fPi0Trigger)
1717       {
1718         fhPtPi0DecayRatio  = new TH2F
1719         ("hPtPi0DecayRatio","p_{T} of #pi^{0} and the ratio of pt for two decay", 
1720          nptbins,ptmin,ptmax, 100,0.,2.); 
1721         fhPtPi0DecayRatio->SetXTitle("p_{T}^{#pi^{0}} (GeV/c)");
1722         fhPtPi0DecayRatio->SetYTitle("p_{T}^{Decay}/p_{T}^{#pi^{0}}");
1723         outputContainer->Add(fhPtPi0DecayRatio) ; 
1724       }
1725       
1726       fhDeltaPhiDecayCharged  = new TH2F
1727       ("hDeltaPhiDecayCharged","#phi_{Decay} - #phi_{h^{#pm}} vs p_{T Decay}",
1728        nptbins,ptmin,ptmax, ndeltaphibins ,deltaphimin,deltaphimax); 
1729       fhDeltaPhiDecayCharged->SetYTitle("#Delta #phi (rad)");
1730       fhDeltaPhiDecayCharged->SetXTitle("p_{T Decay} (GeV/c)");
1731       
1732       fhXEDecayCharged  = 
1733       new TH2F("hXEDecayCharged","x_{E}  Decay",
1734                nptbins,ptmin,ptmax,200,0.,2.); 
1735       fhXEDecayCharged->SetYTitle("x_{E}");
1736       fhXEDecayCharged->SetXTitle("p_{T decay} (GeV/c)");
1737       
1738       fhZTDecayCharged  = 
1739       new TH2F("hZTDecayCharged","z_{trigger h^{#pm}} = p_{T h^{#pm}} / p_{T Decay}",
1740                nptbins,ptmin,ptmax,200,0.,2.); 
1741       fhZTDecayCharged->SetYTitle("z_{decay h^{#pm}}");
1742       fhZTDecayCharged->SetXTitle("p_{T decay} (GeV/c)");      
1743       
1744       outputContainer->Add(fhDeltaPhiDecayCharged) ; 
1745       outputContainer->Add(fhXEDecayCharged) ;
1746       outputContainer->Add(fhZTDecayCharged) ;
1747     }    
1748     
1749     if(fMakeSeveralUE)
1750     { 
1751       fhDeltaPhiUeLeftCharged  = new TH2F
1752       ("hDeltaPhiUeLeftChargedPt","#phi_{trigger} - #phi_{#Ueh^{#pm}} vs p_{T Ueh^{#pm}} with UE left side range of trigger particles",
1753        nptbins,ptmin,ptmax, ndeltaphibins ,deltaphimin,deltaphimax);
1754       fhDeltaPhiUeLeftCharged->SetYTitle("#Delta #phi (rad)");
1755       fhDeltaPhiUeLeftCharged->SetXTitle("p_{T h^{#pm}} (GeV/c)");
1756       outputContainer->Add(fhDeltaPhiUeLeftCharged) ;
1757       
1758       fhDeltaPhiUeRightCharged  = new TH2F
1759       ("hDeltaPhiUeRightChargedPt","#phi_{trigger} - #phi_{#Ueh^{#pm}} vs p_{T Ueh^{#pm}} with UE right side range of trigger particles",
1760        nptbins,ptmin,ptmax, ndeltaphibins ,deltaphimin,deltaphimax);
1761       fhDeltaPhiUeRightCharged->SetYTitle("#Delta #phi (rad)");
1762       fhDeltaPhiUeRightCharged->SetXTitle("p_{T h^{#pm}} (GeV/c)");
1763       outputContainer->Add(fhDeltaPhiUeRightCharged) ;
1764       
1765       fhDeltaPhiUeLeftUpCharged  = new TH2F
1766       ("hDeltaPhiUeLeftUpChargedPt","#phi_{trigger} - #phi_{#Ueh^{#pm}} vs p_{T Ueh^{#pm}} with UE left Up side range of trigger particles",
1767        nptbins,ptmin,ptmax, ndeltaphibins ,deltaphimin,deltaphimax);
1768       fhDeltaPhiUeLeftUpCharged->SetYTitle("#Delta #phi (rad)");
1769       fhDeltaPhiUeLeftUpCharged->SetXTitle("p_{T h^{#pm}} (GeV/c)");
1770       outputContainer->Add(fhDeltaPhiUeLeftUpCharged) ;
1771       
1772       fhDeltaPhiUeRightUpCharged  = new TH2F
1773       ("hDeltaPhiUeRightUpChargedPt","#phi_{trigger} - #phi_{#Ueh^{#pm}} vs p_{T Ueh^{#pm}} with UE right Up side range of trigger particles",
1774        nptbins,ptmin,ptmax, ndeltaphibins ,deltaphimin,deltaphimax);
1775       fhDeltaPhiUeRightUpCharged->SetYTitle("#Delta #phi (rad)");
1776       fhDeltaPhiUeRightUpCharged->SetXTitle("p_{T h^{#pm}} (GeV/c)");
1777       outputContainer->Add(fhDeltaPhiUeRightUpCharged) ;
1778       
1779       fhDeltaPhiUeLeftDownCharged  = new TH2F
1780       ("hDeltaPhiUeLeftDownChargedPt","#phi_{trigger} - #phi_{#Ueh^{#pm}} vs p_{T Ueh^{#pm}} with UE left Down side range of trigger particles",
1781        nptbins,ptmin,ptmax, ndeltaphibins ,deltaphimin,deltaphimax);
1782       fhDeltaPhiUeLeftDownCharged->SetYTitle("#Delta #phi (rad)");
1783       fhDeltaPhiUeLeftDownCharged->SetXTitle("p_{T h^{#pm}} (GeV/c)");
1784       outputContainer->Add(fhDeltaPhiUeLeftDownCharged) ;
1785       
1786       fhDeltaPhiUeRightDownCharged  = new TH2F
1787       ("hDeltaPhiUeRightDownChargedPt","#phi_{trigger} - #phi_{#Ueh^{#pm}} vs p_{T Ueh^{#pm}} with UE right Down side range of trigger particles",
1788        nptbins,ptmin,ptmax, ndeltaphibins ,deltaphimin,deltaphimax);
1789       fhDeltaPhiUeRightDownCharged->SetYTitle("#Delta #phi (rad)");
1790       fhDeltaPhiUeRightDownCharged->SetXTitle("p_{T h^{#pm}} (GeV/c)");
1791       outputContainer->Add(fhDeltaPhiUeRightDownCharged) ;
1792       
1793       fhXEUeLeftCharged  = 
1794       new TH2F("hXEUeChargedLeft","x_{E} with UE left side of trigger",
1795                nptbins,ptmin,ptmax,200,0.,2.); 
1796       fhXEUeLeftCharged->SetYTitle("x_{E Ueh^{#pm}}");
1797       fhXEUeLeftCharged->SetXTitle("p_{T trigger} (GeV/c)");
1798       outputContainer->Add(fhXEUeLeftCharged) ;
1799       
1800       fhXEUeRightCharged  = 
1801       new TH2F("hXEUeChargedRight","x_{E h^{#pm}} with UE right side of trigger",
1802                nptbins,ptmin,ptmax,200,0.,2.); 
1803       fhXEUeRightCharged->SetYTitle("z_{trigger Ueh^{#pm}}");
1804       fhXEUeRightCharged->SetXTitle("p_{T trigger} (GeV/c)");
1805       outputContainer->Add(fhXEUeRightCharged) ;
1806       
1807       fhXEUeLeftUpCharged  = 
1808       new TH2F("hXEUeChargedLeftUp","x_{E} with UE left Up side of trigger",
1809                nptbins,ptmin,ptmax,200,0.,2.); 
1810       fhXEUeLeftUpCharged->SetYTitle("x_{E Ueh^{#pm}}");
1811       fhXEUeLeftUpCharged->SetXTitle("p_{T trigger} (GeV/c)");
1812       outputContainer->Add(fhXEUeLeftUpCharged) ;
1813       
1814       fhXEUeRightUpCharged  = 
1815       new TH2F("hXEUeChargedRightUp","x_{E h^{#pm}} with UE right Up side of trigger",
1816                nptbins,ptmin,ptmax,200,0.,2.); 
1817       fhXEUeRightUpCharged->SetYTitle("z_{trigger Ueh^{#pm}}");
1818       fhXEUeRightUpCharged->SetXTitle("p_{T trigger} (GeV/c)");
1819       outputContainer->Add(fhXEUeRightUpCharged) ;
1820       
1821       fhXEUeLeftDownCharged  = 
1822       new TH2F("hXEUeChargedLeftDown","x_{E} with UE left Down side of trigger",
1823                nptbins,ptmin,ptmax,200,0.,2.); 
1824       fhXEUeLeftDownCharged->SetYTitle("x_{E Ueh^{#pm}}");
1825       fhXEUeLeftDownCharged->SetXTitle("p_{T trigger} (GeV/c)");
1826       outputContainer->Add(fhXEUeLeftDownCharged) ;
1827       
1828       fhXEUeRightDownCharged  = 
1829       new TH2F("hXEUeChargedRightDown","x_{E h^{#pm}} with UE right Down side of trigger",
1830                nptbins,ptmin,ptmax,200,0.,2.); 
1831       fhXEUeRightDownCharged->SetYTitle("z_{trigger Ueh^{#pm}}");
1832       fhXEUeRightDownCharged->SetXTitle("p_{T trigger} (GeV/c)");
1833       outputContainer->Add(fhXEUeRightDownCharged) ;
1834       
1835       fhPtHbpXEUeLeftCharged  = 
1836       new TH2F("hHbpXEUeChargedLeft","#xi = ln(1/x_{E}) with charged UE left side of trigger",
1837                nptbins,ptmin,ptmax,200,0.,10.); 
1838       fhPtHbpXEUeLeftCharged->SetYTitle("ln(1/x_{E})");
1839       fhPtHbpXEUeLeftCharged->SetXTitle("p_{T trigger} (GeV/c)");
1840       outputContainer->Add(fhPtHbpXEUeLeftCharged) ;
1841       
1842       fhPtHbpXEUeRightCharged  = 
1843       new TH2F("hHbpXEUeChargedRight","#xi = ln(1/x_{E}) with charged UE right side of trigger",
1844                nptbins,ptmin,ptmax,200,0.,10.); 
1845       fhPtHbpXEUeRightCharged->SetYTitle("ln(1/x_{E})");
1846       fhPtHbpXEUeRightCharged->SetXTitle("p_{T trigger} (GeV/c)");
1847       outputContainer->Add(fhPtHbpXEUeRightCharged) ;
1848       
1849       fhZTUeLeftCharged  = 
1850       new TH2F("hZTUeChargedLeft","z_{trigger h^{#pm}} = p_{T Ueh^{#pm}} / p_{T trigger} with UE left side of trigger",
1851                nptbins,ptmin,ptmax,200,0.,2.); 
1852       fhZTUeLeftCharged->SetYTitle("z_{trigger Ueh^{#pm}}");
1853       fhZTUeLeftCharged->SetXTitle("p_{T trigger} (GeV/c)");
1854       outputContainer->Add(fhZTUeLeftCharged) ;
1855       
1856       fhZTUeRightCharged  = 
1857       new TH2F("hZTUeChargedRight","z_{trigger h^{#pm}} = p_{T Ueh^{#pm}} / p_{T trigger} with UE right side of trigger",
1858                nptbins,ptmin,ptmax,200,0.,2.); 
1859       fhZTUeRightCharged->SetYTitle("z_{trigger Ueh^{#pm}}");
1860       fhZTUeRightCharged->SetXTitle("p_{T trigger} (GeV/c)");
1861       outputContainer->Add(fhZTUeRightCharged) ;      
1862       
1863       fhPtHbpZTUeLeftCharged  = 
1864       new TH2F("hHbpZTUeChargedLeft","#xi = ln(1/z_{T}) with charged UE left side of trigger",
1865                nptbins,ptmin,ptmax,200,0.,10.); 
1866       fhPtHbpZTUeLeftCharged->SetYTitle("ln(1/z_{T})");
1867       fhPtHbpZTUeLeftCharged->SetXTitle("p_{T trigger} (GeV/c)");
1868       outputContainer->Add(fhPtHbpZTUeLeftCharged) ;
1869       
1870       fhPtHbpZTUeRightCharged  = 
1871       new TH2F("hHbpZTUeChargedRight","#xi = ln(1/z_{T}) with charged UE right side of trigger",
1872                nptbins,ptmin,ptmax,200,0.,10.); 
1873       fhPtHbpZTUeRightCharged->SetYTitle("ln(1/z_{T})");
1874       fhPtHbpZTUeRightCharged->SetXTitle("p_{T trigger} (GeV/c)");
1875       outputContainer->Add(fhPtHbpZTUeRightCharged) ;
1876       
1877     } 
1878   }  //Correlation with charged hadrons
1879
1880   //Correlation with neutral hadrons
1881   if(fNeutralCorr)
1882   {
1883     fhDeltaPhiDeltaEtaNeutral  = new TH2F
1884     ("hDeltaPhiDeltaEtaNeutral","#phi_{trigger} - #phi_{h^{0}} vs #eta_{trigger} - #eta_{h^{0}}",
1885      ndeltaphibins ,deltaphimin,deltaphimax, ndeltaetabins ,deltaetamin,deltaetamax); 
1886     fhDeltaPhiDeltaEtaNeutral->SetXTitle("#Delta #phi (rad)");
1887     fhDeltaPhiDeltaEtaNeutral->SetYTitle("#Delta #eta");   
1888           
1889     fhPhiNeutral  = new TH2F
1890     ("hPhiNeutral","#phi_{#pi^{0}}  vs p_{T #pi^{0}}",
1891      nptbins,ptmin,ptmax,nphibins,phimin,phimax); 
1892     fhPhiNeutral->SetYTitle("#phi_{#pi^{0}} (rad)");
1893     fhPhiNeutral->SetXTitle("p_{T #pi^{0}} (GeV/c)");
1894     
1895     fhEtaNeutral  = new TH2F
1896     ("hEtaNeutral","#eta_{#pi^{0}}  vs p_{T #pi^{0}}",
1897      nptbins,ptmin,ptmax,netabins,etamin,etamax); 
1898     fhEtaNeutral->SetYTitle("#eta_{#pi^{0}} (rad)");
1899     fhEtaNeutral->SetXTitle("p_{T #pi^{0}} (GeV/c)");
1900     
1901     fhDeltaPhiNeutral  = new TH2F
1902     ("hDeltaPhiNeutral","#phi_{trigger} - #phi_{#pi^{0}} vs p_{T trigger}",
1903      nptbins,ptmin,ptmax,nphibins,phimin,phimax); 
1904     fhDeltaPhiNeutral->SetYTitle("#Delta #phi (rad)");
1905     fhDeltaPhiNeutral->SetXTitle("p_{T trigger} (GeV/c)");
1906     
1907     fhDeltaPhiNeutralPt  = new TH2F
1908     ("hDeltaPhiNeutralPt","#phi_{trigger} - #phi_{#pi^{0}} vs p_{T #pi^{0}}}",
1909      nptbins,ptmin,ptmax, ndeltaphibins ,deltaphimin,deltaphimax); 
1910     fhDeltaPhiNeutralPt->SetYTitle("#Delta #phi (rad)");
1911     fhDeltaPhiNeutralPt->SetXTitle("p_{T h^{0}} (GeV/c)");
1912     
1913     fhDeltaPhiUeNeutralPt  = new TH2F
1914     ("hDeltaPhiUeNeutralPt","#phi_{trigger} - #phi_{#pi^{0}} vs p_{T #pi^{0}}}",
1915      nptbins,ptmin,ptmax, ndeltaphibins ,deltaphimin,deltaphimax); 
1916     fhDeltaPhiUeNeutralPt->SetYTitle("#Delta #phi (rad)");
1917     fhDeltaPhiUeNeutralPt->SetXTitle("p_{T h^{0}} (GeV/c)");
1918     
1919     fhDeltaEtaNeutral  = new TH2F
1920     ("hDeltaEtaNeutral","#eta_{trigger} - #eta_{#pi^{0}} vs p_{T trigger}",
1921      nptbins,ptmin,ptmax, ndeltaetabins ,deltaetamin,deltaetamax);  
1922     fhDeltaEtaNeutral->SetYTitle("#Delta #eta");
1923     fhDeltaEtaNeutral->SetXTitle("p_{T trigger} (GeV/c)");
1924     
1925     fhXENeutral  = 
1926     new TH2F("hXENeutral","x_{E} for #pi^{0} associated",
1927              nptbins,ptmin,ptmax,200,0.,2.); 
1928     fhXENeutral->SetYTitle("x_{E}");
1929     fhXENeutral->SetXTitle("p_{T trigger} (GeV/c)");
1930     
1931     fhXEUeNeutral  = 
1932     new TH2F("hXEUeNeutral","x_{E} for #pi^{0} associated",
1933              nptbins,ptmin,ptmax,200,0.,2.); 
1934     fhXEUeNeutral->SetYTitle("x_{E}");
1935     fhXEUeNeutral->SetXTitle("p_{T trigger} (GeV/c)");
1936     
1937     fhPtHbpXENeutral  = 
1938     new TH2F("hHbpXENeutral","#xi = ln(1/x_{E})for #pi^{0} associated",
1939              nptbins,ptmin,ptmax,200,0.,10.); 
1940     fhPtHbpXENeutral->SetYTitle("ln(1/x_{E})");
1941     fhPtHbpXENeutral->SetXTitle("p_{T trigger} (GeV/c)");
1942     
1943     fhPtHbpXEUeNeutral  = 
1944     new TH2F("hHbpXEUeNeutral","#xi = ln(1/x_{E}) for #pi^{0} associated",
1945              nptbins,ptmin,ptmax,200,0.,10.); 
1946     fhPtHbpXEUeNeutral->SetYTitle("ln(1/x_{E})");
1947     fhPtHbpXEUeNeutral->SetXTitle("p_{T trigger} (GeV/c)");
1948     
1949     fhZTNeutral  = 
1950     new TH2F("hZTNeutral","z_{trigger #pi} = p_{T #pi^{0}} / p_{T trigger} for #pi^{0} associated",
1951              nptbins,ptmin,ptmax,200,0.,2.); 
1952     fhZTNeutral->SetYTitle("z_{trigger #pi^{0}}");
1953     fhZTNeutral->SetXTitle("p_{T trigger} (GeV/c)");
1954     
1955     fhZTUeNeutral  = 
1956     new TH2F("hZTUeNeutral","z_{trigger #pi} = p_{T #pi^{0}} / p_{T trigger} for #pi^{0} associated",
1957              nptbins,ptmin,ptmax,200,0.,2.); 
1958     fhZTUeNeutral->SetYTitle("z_{trigger #pi^{0}}");
1959     fhZTUeNeutral->SetXTitle("p_{T trigger} (GeV/c)");
1960     
1961     fhPtHbpZTNeutral  = 
1962     new TH2F("hHbpZTNeutral","#xi = ln(1/x_{E}) for #pi^{0} associated",
1963              nptbins,ptmin,ptmax,200,0.,10.); 
1964     fhPtHbpZTNeutral->SetYTitle("ln(1/z_{T})");
1965     fhPtHbpZTNeutral->SetXTitle("p_{T trigger}");
1966     
1967     fhPtHbpZTUeNeutral  = 
1968     new TH2F("hHbpZTUeNeutral","#xi = ln(1/x_{E}) for #pi^{0} associated",
1969              nptbins,ptmin,ptmax,200,0.,10.); 
1970     fhPtHbpXEUeNeutral->SetYTitle("ln(1/z_{T})");
1971     fhPtHbpXEUeNeutral->SetXTitle("p_{T trigger} (GeV/c)");    
1972     
1973     outputContainer->Add(fhDeltaPhiDeltaEtaNeutral); 
1974     outputContainer->Add(fhPhiNeutral) ;  
1975     outputContainer->Add(fhEtaNeutral) ;   
1976     outputContainer->Add(fhDeltaPhiNeutral) ; 
1977     outputContainer->Add(fhDeltaPhiNeutralPt) ; 
1978     outputContainer->Add(fhDeltaPhiUeNeutralPt) ; 
1979     outputContainer->Add(fhDeltaEtaNeutral) ; 
1980     outputContainer->Add(fhXENeutral) ;
1981     outputContainer->Add(fhXEUeNeutral) ;  
1982     outputContainer->Add(fhPtHbpXENeutral) ;
1983     outputContainer->Add(fhPtHbpXEUeNeutral) ;    
1984     outputContainer->Add(fhZTNeutral) ;
1985     outputContainer->Add(fhZTUeNeutral) ;  
1986     outputContainer->Add(fhPtHbpZTNeutral) ;
1987     outputContainer->Add(fhPtHbpZTUeNeutral) ;    
1988     
1989     if(fPi0Trigger || fDecayTrigger)
1990     {
1991       fhDeltaPhiDecayNeutral  = new TH2F
1992       ("hDeltaPhiDecayNeutral","#phi_{Decay} - #phi_{h^{0}} vs p_{T Decay}",
1993        nptbins,ptmin,ptmax, ndeltaphibins ,deltaphimin,deltaphimax);  
1994       fhDeltaPhiDecayNeutral->SetYTitle("#Delta #phi (rad)");
1995       fhDeltaPhiDecayNeutral->SetXTitle("p_{T Decay} (GeV/c)");
1996       
1997       fhXEDecayNeutral  = 
1998       new TH2F("hXEDecayNeutral","x_{E} for decay trigger",
1999                nptbins,ptmin,ptmax,200,0.,2.); 
2000       fhXEDecayNeutral->SetYTitle("x_{E}");
2001       fhXEDecayNeutral->SetXTitle("p_{T decay}");
2002       
2003       fhZTDecayNeutral  = 
2004       new TH2F("hZTDecayNeutral","z_{trigger h^{0}} = p_{T h^{0}} / p_{T Decay}",
2005                nptbins,ptmin,ptmax,200,0.,2.); 
2006       fhZTDecayNeutral->SetYTitle("z_{h^{0}}");
2007       fhZTDecayNeutral->SetXTitle("p_{T decay}");      
2008       
2009       outputContainer->Add(fhDeltaPhiDecayNeutral) ; 
2010       outputContainer->Add(fhXEDecayNeutral) ;      
2011       outputContainer->Add(fhZTDecayNeutral) ;
2012
2013     }
2014     
2015     if(fMakeSeveralUE)
2016     { 
2017       fhDeltaPhiUeLeftNeutral  = new TH2F
2018       ("hDeltaPhiUeLeftNeutralPt","#phi_{trigger} - #phi_{#Ueh^{0}} vs p_{T h^{0}} with neutral UE left side range of trigger particles",
2019        nptbins,ptmin,ptmax, ndeltaphibins ,deltaphimin,deltaphimax); 
2020       fhDeltaPhiUeLeftNeutral->SetYTitle("#Delta #phi (rad)");
2021       fhDeltaPhiUeLeftNeutral->SetXTitle("p_{T h^{0}} (GeV/c)");
2022       outputContainer->Add(fhDeltaPhiUeLeftNeutral) ;
2023       
2024       fhDeltaPhiUeRightNeutral  = new TH2F
2025       ("hDeltaPhiUeRightNeutralPt","#phi_{trigger} - #phi_{#Ueh^{0}} vs p_{T Ueh^{0}} with neutral UE right side range of trigger particles",
2026        nptbins,ptmin,ptmax, ndeltaphibins ,deltaphimin,deltaphimax); 
2027       fhDeltaPhiUeRightNeutral->SetYTitle("#Delta #phi (rad)");
2028       fhDeltaPhiUeRightNeutral->SetXTitle("p_{T h^{0}} (GeV/c)");
2029       outputContainer->Add(fhDeltaPhiUeRightNeutral) ;
2030       
2031       fhXEUeLeftNeutral  = 
2032       new TH2F("hXEUeNeutralLeft","x_{E} = p_{T Ueh^{0}} / p_{T trigger} with neutral UE left side of trigger",
2033                nptbins,ptmin,ptmax,140,0.,2.); 
2034       fhXEUeLeftNeutral->SetYTitle("z_{trigger Ueh^{0}}");
2035       fhXEUeLeftNeutral->SetXTitle("p_{T trigger} (GeV/c)");
2036       outputContainer->Add(fhXEUeLeftNeutral) ;
2037       
2038       fhXEUeRightNeutral  = 
2039       new TH2F("hXEUeNeutralRight","x_{E} = p_{T Ueh^{0}} / p_{T trigger} with neutral UE right side of trigger",
2040                nptbins,ptmin,ptmax,200,0.,2.); 
2041       fhXEUeRightNeutral->SetYTitle("z_{trigger Ueh^{0}}");
2042       fhXEUeRightNeutral->SetXTitle("p_{T trigger} (GeV/c)");
2043       outputContainer->Add(fhXEUeRightNeutral) ;
2044       
2045       fhPtHbpXEUeLeftNeutral  = 
2046       new TH2F("hHbpXEUeNeutralLeft","#xi = ln(1/x_{E}) with neutral UE left side of trigger",
2047                nptbins,ptmin,ptmax,200,0.,10.); 
2048       fhPtHbpXEUeLeftNeutral->SetYTitle("ln(1/x_{E})");
2049       fhPtHbpXEUeLeftNeutral->SetXTitle("p_{T trigger} (GeV/c)");
2050       outputContainer->Add(fhPtHbpXEUeLeftNeutral) ;
2051       
2052       fhPtHbpXEUeRightNeutral  = 
2053       new TH2F("hHbpXEUeNeutralRight","#xi = ln(1/x_{E}) with neutral UE right side of trigger",
2054                nptbins,ptmin,ptmax,200,0.,10.); 
2055       fhPtHbpXEUeRightNeutral->SetYTitle("ln(1/x_{E})");
2056       fhPtHbpXEUeRightNeutral->SetXTitle("p_{T trigger} (GeV/c)");
2057       outputContainer->Add(fhPtHbpXEUeRightNeutral) ;
2058       
2059       fhZTUeLeftNeutral  = 
2060       new TH2F("hZTUeNeutralLeft","z_{trigger h^{0}} = p_{T Ueh^{0}} / p_{T trigger} with neutral UE left side of trigger",
2061                nptbins,ptmin,ptmax,140,0.,2.); 
2062       fhZTUeLeftNeutral->SetYTitle("z_{trigger Ueh^{0}}");
2063       fhZTUeLeftNeutral->SetXTitle("p_{T trigger} (GeV/c)");
2064       outputContainer->Add(fhZTUeLeftNeutral) ;
2065       
2066       fhZTUeRightNeutral  = 
2067       new TH2F("hZTUeNeutralRight","z_{trigger h^{0}} = p_{T Ueh^{0}} / p_{T trigger} with neutral UE right side of trigger",
2068                nptbins,ptmin,ptmax,200,0.,2.); 
2069       fhZTUeRightNeutral->SetYTitle("z_{trigger Ueh^{0}}");
2070       fhZTUeRightNeutral->SetXTitle("p_{T trigger} (GeV/c)");
2071       outputContainer->Add(fhZTUeRightNeutral) ;
2072       
2073       fhPtHbpZTUeLeftNeutral  = 
2074       new TH2F("hHbpZTUeNeutralLeft","#xi = ln(1/z_{T}) with neutral UE left side of trigger",
2075                nptbins,ptmin,ptmax,200,0.,10.); 
2076       fhPtHbpZTUeLeftNeutral->SetYTitle("ln(1/z_{T})");
2077       fhPtHbpZTUeLeftNeutral->SetXTitle("p_{T trigger}");
2078       outputContainer->Add(fhPtHbpZTUeLeftNeutral) ;
2079       
2080       fhPtHbpZTUeRightNeutral  = 
2081       new TH2F("hHbpZTUeNeutralRight","#xi = ln(1/z_{T}) with neutral UE right side of trigger",
2082                nptbins,ptmin,ptmax,200,0.,10.); 
2083       fhPtHbpZTUeRightNeutral->SetYTitle("ln(1/z_{T})");
2084       fhPtHbpZTUeRightNeutral->SetXTitle("p_{T trigger}");
2085       outputContainer->Add(fhPtHbpZTUeRightNeutral) ;
2086       
2087     }  
2088         
2089   }//Correlation with neutral hadrons
2090   
2091   //if data is MC, fill more histograms
2092   if(IsDataMC())
2093   {
2094     fh2phiLeadingParticle=new TH2F("h2phiLeadingParticle","#phi resolustion for trigger particles",nptbins,ptmin,ptmax,100,-1,1);
2095     fh2phiLeadingParticle->GetXaxis()->SetTitle("p_{T gen Leading} (GeV/c)");
2096     fh2phiLeadingParticle->GetYaxis()->SetTitle("(#phi_{rec}-#phi_{gen})/#phi_{gen}");
2097
2098     fhMCPtLeading  = new TH1F ("hMCPtLeading","MC : p_{T} distribution of leading particles", nptbins,ptmin,ptmax); 
2099     fhMCPtLeading->SetXTitle("p_{T}^{trig} (GeV/c)");
2100
2101     fhMCPhiLeading  = new TH2F ("hMCPhiLeading","MC : #phi distribution of leading Particles",nptbins,ptmin,ptmax, nphibins,phimin,phimax); 
2102     fhMCPhiLeading->SetYTitle("#phi (rad)");
2103   
2104     fhMCEtaLeading  = new TH2F ("hMCEtaLeading","MC : #eta distribution of leading",nptbins,ptmin,ptmax, netabins,etamin,etamax); 
2105     fhMCEtaLeading->SetYTitle("#eta "); 
2106     
2107     
2108     fhMCEtaCharged  = new TH2F
2109     ("hMCEtaCharged","MC #eta_{h^{#pm}}  vs p_{T #pm}",
2110      nptbins,ptmin,ptmax,netabins,etamin,etamax); 
2111     fhMCEtaCharged->SetYTitle("#eta_{h^{#pm}} (rad)");
2112     fhMCEtaCharged->SetXTitle("p_{T #pm} (GeV/c)");
2113     
2114     fhMCPhiCharged  = new TH2F
2115     ("hMCPhiCharged","#MC phi_{h^{#pm}}  vs p_{T #pm}",
2116      200,ptmin,ptmax,nphibins,phimin,phimax); 
2117     fhMCPhiCharged->SetYTitle("MC #phi_{h^{#pm}} (rad)");
2118     fhMCPhiCharged->SetXTitle("p_{T #pm} (GeV/c)");
2119     
2120     fhMCDeltaPhiDeltaEtaCharged  = new TH2F
2121     ("hMCDeltaPhiDeltaEtaCharged","#MC phi_{trigger} - #phi_{h^{#pm}} vs #eta_{trigger} - #eta_{h^{#pm}}",
2122      140,-2.,5.,200,-2,2); 
2123     fhMCDeltaPhiDeltaEtaCharged->SetXTitle("#Delta #phi (rad)");
2124     fhMCDeltaPhiDeltaEtaCharged->SetYTitle("#Delta #eta");    
2125     
2126     fhMCDeltaEtaCharged  = new TH2F
2127     ("hMCDeltaEtaCharged","MC #eta_{trigger} - #eta_{h^{#pm}} vs p_{T trigger} and p_{T assoc}",
2128      nptbins,ptmin,ptmax,200,-2,2); 
2129     fhMCDeltaEtaCharged->SetYTitle("#Delta #eta");
2130     fhMCDeltaEtaCharged->SetXTitle("p_{T trigger} (GeV/c)");
2131     
2132     fhMCDeltaPhiCharged  = new TH2F
2133     ("hMCDeltaPhiCharged","#phi_{trigger} - #phi_{h^{#pm}} vs p_{T trigger}",
2134      nptbins,ptmin,ptmax,ndeltaphibins ,deltaphimin,deltaphimax); 
2135     fhMCDeltaPhiCharged->SetYTitle("#Delta #phi (rad)");
2136     fhMCDeltaPhiCharged->SetXTitle("p_{T trigger} (GeV/c)");
2137     
2138     fhMCDeltaPhiChargedPt  = new TH2F
2139     ("hMCDeltaPhiChargedPt","MC #phi_{trigger} - #phi_{#h^{#pm}} vs p_{T h^{#pm}}",
2140      nptbins,ptmin,ptmax,ndeltaphibins ,deltaphimin,deltaphimax); 
2141     fhMCDeltaPhiChargedPt->SetYTitle("#Delta #phi (rad)");
2142     fhMCDeltaPhiChargedPt->SetXTitle("p_{T h^{#pm}} (GeV/c)");
2143     
2144     fhMCPtXECharged  = 
2145     new TH2F("hMCPtXECharged","x_{E}",
2146              nptbins,ptmin,ptmax,200,0.,2.); 
2147     fhMCPtXECharged->SetYTitle("x_{E}");
2148     fhMCPtXECharged->SetXTitle("p_{T trigger} (GeV/c)");
2149
2150     fhMCPtXEUeCharged  = 
2151     new TH2F("hMCPtXEUeCharged","x_{E}",
2152              nptbins,ptmin,ptmax,200,0.,2.); 
2153     fhMCPtXEUeCharged->SetYTitle("x_{E}");
2154     fhMCPtXEUeCharged->SetXTitle("p_{T trigger} (GeV/c)");
2155     
2156     fhMCPtHbpXECharged  = 
2157     new TH2F("hMCHbpXECharged","MC #xi = ln(1/x_{E}) with charged hadrons",
2158              nptbins,ptmin,ptmax,200,0.,10.); 
2159     fhMCPtHbpXECharged->SetYTitle("ln(1/x_{E})");
2160     fhMCPtHbpXECharged->SetXTitle("p_{T trigger}");
2161
2162     fhMCPtHbpXEUeCharged =
2163     new TH2F("hMCPtHbpXEUeCharged","#xi = ln(1/x_{E}) with charged hadrons,Underlying Event",
2164              nptbins,ptmin,ptmax,200,0.,10.); 
2165     fhMCPtHbpXEUeCharged->SetYTitle("ln(1/x_{E})");
2166     fhMCPtHbpXEUeCharged->SetXTitle("p_{T trigger} (GeV/c)");
2167
2168     fhMCUePart  = 
2169     new TH1F("hMCUePart","MC UE particles distribution vs pt trig",
2170              nptbins,ptmin,ptmax); 
2171     fhMCUePart->SetYTitle("dNch");
2172     fhMCUePart->SetXTitle("p_{T trigger} (GeV/c)");
2173     
2174     fhMCPtZTCharged  = 
2175     new TH2F("hMCPtZTCharged","z_{T}",
2176              nptbins,ptmin,ptmax,200,0.,2.); 
2177     fhMCPtZTCharged->SetYTitle("z_{T}");
2178     fhMCPtZTCharged->SetXTitle("p_{T trigger} (GeV/c)"); 
2179     
2180     fhMCPtHbpZTCharged  = 
2181     new TH2F("hMCHbpZTCharged","MC #xi = ln(1/z_{T}) with charged hadrons",
2182              nptbins,ptmin,ptmax,200,0.,10.); 
2183     fhMCPtHbpZTCharged->SetYTitle("ln(1/z_{T})");
2184     fhMCPtHbpZTCharged->SetXTitle("p_{T trigger} (GeV/c)");
2185     
2186     fhMCPtTrigPout  = 
2187     new TH2F("hMCPtTrigPout","AOD MC Pout with triggers",
2188              nptbins,ptmin,ptmax,2*nptbins,-ptmax,ptmax); 
2189     fhMCPtTrigPout->SetYTitle("p_{out} (GeV/c)");
2190     fhMCPtTrigPout->SetXTitle("p_{T trigger} (GeV/c)"); 
2191     
2192     fhMCPtAssocDeltaPhi  = 
2193     new TH2F("hMCPtAssocDeltaPhi","AOD MC delta phi with associated charged hadrons",
2194              nptbins,ptmin,ptmax,ndeltaphibins ,deltaphimin,deltaphimax); 
2195     fhMCPtAssocDeltaPhi->SetYTitle("#Delta #phi (rad)");
2196     fhMCPtAssocDeltaPhi->SetXTitle("p_{T trigger} (GeV/c)"); 
2197         
2198     outputContainer->Add(fh2phiLeadingParticle);
2199     outputContainer->Add(fhMCPtLeading);
2200     outputContainer->Add(fhMCPhiLeading);
2201     outputContainer->Add(fhMCEtaLeading);
2202     outputContainer->Add(fhMCDeltaPhiDeltaEtaCharged);
2203     outputContainer->Add(fhMCPhiCharged) ;
2204     outputContainer->Add(fhMCEtaCharged) ;
2205     outputContainer->Add(fhMCDeltaEtaCharged) ;
2206     outputContainer->Add(fhMCDeltaPhiCharged) ; 
2207     
2208     outputContainer->Add(fhMCDeltaPhiChargedPt) ;
2209     outputContainer->Add(fhMCPtXECharged) ;
2210     outputContainer->Add(fhMCPtXEUeCharged) ;
2211     outputContainer->Add(fhMCPtZTCharged) ;
2212     outputContainer->Add(fhMCPtHbpXECharged) ;
2213     outputContainer->Add(fhMCPtHbpXEUeCharged);
2214     outputContainer->Add(fhMCUePart);
2215     outputContainer->Add(fhMCPtHbpZTCharged) ;
2216     outputContainer->Add(fhMCPtTrigPout) ;
2217     outputContainer->Add(fhMCPtAssocDeltaPhi) ;      
2218   } //for MC histogram
2219   
2220   if(DoOwnMix())
2221   {
2222     //create event containers
2223     
2224     if(!fUseMixStoredInReader || (fUseMixStoredInReader && !GetReader()->ListWithMixedEventsForTracksExists())) 
2225     {
2226       Int_t nvz = GetNZvertBin();
2227       Int_t nrp = GetNRPBin();
2228       Int_t nce = GetNCentrBin();
2229       
2230       fListMixTrackEvents= new TList*[nvz*nrp*nce] ;
2231       
2232       for( Int_t ice = 0 ; ice < nce ; ice++ )
2233       {
2234         for( Int_t ivz = 0 ; ivz < nvz ; ivz++ )
2235         {
2236           for( Int_t irp = 0 ; irp < nrp ; irp++ )
2237           {
2238             Int_t bin = GetEventMixBin(ice,ivz,irp); //ic*nvz*nrp+iz*nrp+irp;
2239             
2240             //printf("GetCreateOutputObjects - Bins : cent %d, vz %d, RP %d, event %d/%d\n",
2241             //       ic,iz, irp, bin);
2242             
2243             fListMixTrackEvents[bin] = new TList() ;
2244             fListMixTrackEvents[bin]->SetOwner(kFALSE);
2245           }
2246         }
2247       }    
2248     }
2249     
2250     fhPtLeadingMixed  = new TH1F ("hPtLeadingMixed","p_{T} distribution of leading particles, used for mixing", nptbins,ptmin,ptmax); 
2251     fhPtLeadingMixed->SetXTitle("p_{T}^{trig} (GeV/c)");
2252
2253     if(fCorrelVzBin)
2254     {
2255       fhPtLeadingMixedVzBin  = new TH2F ("hPtLeadingMixedVzBin","p_{T} distribution of leading particles, used for mixing", nptbins,ptmin,ptmax,GetNZvertBin(),0,GetNZvertBin()); 
2256       fhPtLeadingMixedVzBin->SetXTitle("p_{T}^{trig} (GeV/c)");
2257       fhPtLeadingMixedVzBin->SetYTitle("v_{z} bin");
2258       outputContainer->Add(fhPtLeadingMixedVzBin);
2259     }
2260     
2261     fhPtLeadingMixedBin  = new TH2F ("hPtLeadingMixedBin","p_{T} distribution of leading particles vs mixing bin", nptbins,ptmin,ptmax,nMixBins,0,nMixBins); 
2262     fhPtLeadingMixedBin->SetXTitle("p_{T}^{trig} (GeV/c)");
2263     fhPtLeadingMixedBin->SetYTitle("Bin");
2264
2265     fhPhiLeadingMixed  = new TH2F ("hPhiLeadingMixed","#phi distribution of leading Particles, used for mixing",nptbins,ptmin,ptmax, nphibins,phimin,phimax); 
2266     fhPhiLeadingMixed->SetYTitle("#phi (rad)");
2267     
2268     fhEtaLeadingMixed  = new TH2F ("hEtaLeadingMixed","#eta distribution of leading, used for mixing",nptbins,ptmin,ptmax, netabins,etamin,etamax); 
2269     fhEtaLeadingMixed->SetYTitle("#eta ");  
2270     
2271     outputContainer->Add(fhPtLeadingMixed);
2272     outputContainer->Add(fhPtLeadingMixedBin);
2273     outputContainer->Add(fhPhiLeadingMixed);
2274     outputContainer->Add(fhEtaLeadingMixed);
2275     
2276     // Fill the cluster pool only in isolation analysis or if requested
2277     if( ( OnlyIsolated()        ||  fFillNeutralEventMixPool) &&
2278         (!fUseMixStoredInReader || (fUseMixStoredInReader && !GetReader()->ListWithMixedEventsForCaloExists())))
2279     {
2280       Int_t nvz = GetNZvertBin();
2281       Int_t nrp = GetNRPBin();
2282       Int_t nce = GetNCentrBin();
2283       
2284       fListMixCaloEvents= new TList*[nvz*nrp*nce] ;
2285       
2286       for( Int_t ice = 0 ; ice < nce ; ice++ )
2287       {
2288         for( Int_t ivz = 0 ; ivz < nvz ; ivz++ )
2289         {
2290           for( Int_t irp = 0 ; irp < nrp ; irp++ )
2291           {
2292             Int_t bin = GetEventMixBin(ice,ivz,irp); //ic*nvz*nrp+iz*nrp+irp;
2293             
2294             //printf("GetCreateOutputObjects - Bins : cent %d, vz %d, RP %d, event %d/%d\n",
2295             //       ic,iz, irp, bin);
2296             
2297             fListMixCaloEvents[bin] = new TList() ;
2298             fListMixCaloEvents[bin]->SetOwner(kFALSE);
2299           }
2300         }
2301       }    
2302     }
2303     
2304     //Init the list in the reader if not done previously
2305     if(fUseMixStoredInReader)
2306     {
2307       if( !GetReader()->ListWithMixedEventsForTracksExists() ) 
2308         GetReader()->SetListWithMixedEventsForTracks(fListMixTrackEvents);
2309       
2310       if( !GetReader()->ListWithMixedEventsForCaloExists()   ) 
2311         GetReader()->SetListWithMixedEventsForCalo  (fListMixCaloEvents );
2312     }
2313     
2314     fhEventBin=new TH1I("hEventBin","Number of real events per bin(cen,vz,rp)",
2315                         GetNCentrBin()*GetNZvertBin()*GetNRPBin()+1,0, 
2316                         GetNCentrBin()*GetNZvertBin()*GetNRPBin()+1) ;
2317     fhEventBin->SetXTitle("bin");
2318     outputContainer->Add(fhEventBin) ;
2319     
2320     fhEventMixBin=new TH1I("hEventMixBin","Number of events  per bin(cen,vz,rp)",
2321                            GetNCentrBin()*GetNZvertBin()*GetNRPBin()+1,0,
2322                            GetNCentrBin()*GetNZvertBin()*GetNRPBin()+1) ;
2323     fhEventMixBin->SetXTitle("bin");
2324     outputContainer->Add(fhEventMixBin) ;
2325     
2326     fhNtracksAll=new TH1F("hNtracksAll","Number of tracks w/o event trigger",2000,0,2000);
2327     outputContainer->Add(fhNtracksAll);
2328     
2329     fhNtracksTrigger=new TH1F("hNtracksTriggerEvent","Number of tracks w/ event trigger",2000,0,2000);
2330     outputContainer->Add(fhNtracksTrigger);
2331     
2332     fhNtracksMB=new TH1F("hNtracksMBEvent","Number of tracks w/ event trigger kMB",2000,0,2000);
2333     outputContainer->Add(fhNtracksMB);
2334     
2335     if(fFillNeutralEventMixPool || OnlyIsolated())
2336     {
2337       fhNclustersAll=new TH1F("hNclustersAll","Number of clusters w/o event trigger",2000,0,2000);
2338       outputContainer->Add(fhNclustersAll);
2339       
2340       fhNclustersTrigger=new TH1F("hNclustersTriggerEvent","Number of clusters w/ event trigger",2000,0,2000);
2341       outputContainer->Add(fhNclustersTrigger);
2342       
2343       fhNclustersMB=new TH1F("hNclustersMBEvent","Number of clusters w/ event trigger kMB",2000,0,2000);
2344       outputContainer->Add(fhNclustersMB);
2345     }
2346     
2347     fhMixDeltaPhiCharged  = new TH2F
2348     ("hMixDeltaPhiCharged","Mixed event : #phi_{trigger} - #phi_{h^{#pm}} vs p_{T trigger}",
2349      nptbins,ptmin,ptmax,ndeltaphibins ,deltaphimin,deltaphimax); 
2350     fhMixDeltaPhiCharged->SetYTitle("#Delta #phi (rad)");
2351     fhMixDeltaPhiCharged->SetXTitle("p_{T trigger} (GeV/c)");
2352     outputContainer->Add(fhMixDeltaPhiCharged);
2353     
2354     fhMixDeltaPhiDeltaEtaCharged  = new TH2F
2355     ("hMixDeltaPhiDeltaEtaCharged","Mixed event : #phi_{trigger} - #phi_{h^{#pm}} vs #eta_{trigger} - #eta_{h^{#pm}}",
2356      ndeltaphibins ,deltaphimin,deltaphimax,ndeltaetabins ,deltaetamin,deltaetamax); 
2357     fhMixDeltaPhiDeltaEtaCharged->SetXTitle("#Delta #phi (rad)");
2358     fhMixDeltaPhiDeltaEtaCharged->SetYTitle("#Delta #eta");
2359     outputContainer->Add(fhMixDeltaPhiDeltaEtaCharged);
2360     
2361     fhMixXECharged  = 
2362     new TH2F("hMixXECharged","Mixed event : x_{E} for charged tracks",
2363              nptbins,ptmin,ptmax,200,0.,2.); 
2364     fhMixXECharged->SetYTitle("x_{E}");
2365     fhMixXECharged->SetXTitle("p_{T trigger} (GeV/c)");
2366     outputContainer->Add(fhMixXECharged);
2367
2368     fhMixHbpXECharged  = 
2369     new TH2F("hMixHbpXECharged","mixed event : #xi = ln(1/x_{E}) with charged hadrons",
2370              nptbins,ptmin,ptmax,200,0.,10.); 
2371     fhMixHbpXECharged->SetYTitle("ln(1/x_{E})");
2372     fhMixHbpXECharged->SetXTitle("p_{T trigger} (GeV/c)");
2373     outputContainer->Add(fhMixHbpXECharged);
2374
2375     fhMixDeltaPhiChargedAssocPtBin         = new TH2F*[fNAssocPtBins*nz];
2376     fhMixDeltaPhiChargedAssocPtBinDEta08   = new TH2F*[fNAssocPtBins*nz];
2377     fhMixDeltaPhiChargedAssocPtBinDEta0    = new TH2F*[fNAssocPtBins*nz];
2378     fhMixDeltaPhiDeltaEtaChargedAssocPtBin = new TH2F*[fNAssocPtBins*nz];
2379     
2380     for(Int_t i = 0 ; i < fNAssocPtBins ; i++)
2381     {    
2382       for(Int_t z = 0 ; z < nz ; z++)
2383       {
2384         Int_t bin = i*nz+z;
2385         
2386         if(fCorrelVzBin)
2387         {
2388           sz = "_vz%d"+z;
2389           tz = ", v_{z} bin "+z;
2390         }
2391         
2392         //printf("MIX : iAssoc %d, Vz %d, bin %d - sz %s, tz %s \n",i,z,bin,sz.Data(),tz.Data());
2393         
2394         fhMixDeltaPhiChargedAssocPtBin[bin] = new TH2F(Form("hMixDeltaPhiChargedAssocPtBin%2.1f_%2.1f%s", fAssocPtBinLimit[i], fAssocPtBinLimit[i+1],sz.Data()), 
2395                                                      Form("Mixed event #Delta #phi vs p_{T trigger} for associated p_{T} bin [%2.1f,%2.1f]%s", fAssocPtBinLimit[i], fAssocPtBinLimit[i+1],tz.Data()), 
2396                                                      nptbins, ptmin, ptmax,  ndeltaphibins ,deltaphimin,deltaphimax);
2397         fhMixDeltaPhiChargedAssocPtBin[bin]->SetXTitle("p_{T trigger} (GeV/c)");
2398         fhMixDeltaPhiChargedAssocPtBin[bin]->SetYTitle("#Delta #phi (rad)");
2399         
2400         fhMixDeltaPhiChargedAssocPtBinDEta08[bin] = new TH2F(Form("hMixDeltaPhiDeltaEta0.8ChargedAssocPtBin%2.1f_%2.1f%s", fAssocPtBinLimit[i], fAssocPtBinLimit[i+1],sz.Data()), 
2401                                                            Form("Mixed event #Delta #phi vs p_{T trigger} for associated p_{T} bin [%2.1f,%2.1f]%s, for #Delta #eta > 0.8", fAssocPtBinLimit[i], fAssocPtBinLimit[i+1],tz.Data()), 
2402                                                            nptbins, ptmin, ptmax,  ndeltaphibins ,deltaphimin,deltaphimax);
2403         fhMixDeltaPhiChargedAssocPtBinDEta08[bin]->SetXTitle("p_{T trigger} (GeV/c)");
2404         fhMixDeltaPhiChargedAssocPtBinDEta08[bin]->SetYTitle("#Delta #phi (rad)");      
2405         
2406         fhMixDeltaPhiChargedAssocPtBinDEta0[bin] = new TH2F(Form("hMixDeltaPhiDeltaEta0ChargedAssocPtBin%2.1f_%2.1f%s", fAssocPtBinLimit[i], fAssocPtBinLimit[i+1],sz.Data()), 
2407                                                              Form("Mixed event #Delta #phi vs p_{T trigger} for associated p_{T} bin [%2.1f,%2.1f]%s, for #Delta #eta = 0", fAssocPtBinLimit[i], fAssocPtBinLimit[i+1],tz.Data()), 
2408                                                              nptbins, ptmin, ptmax,  ndeltaphibins ,deltaphimin,deltaphimax);
2409         fhMixDeltaPhiChargedAssocPtBinDEta0[bin]->SetXTitle("p_{T trigger} (GeV/c)");
2410         fhMixDeltaPhiChargedAssocPtBinDEta0[bin]->SetYTitle("#Delta #phi (rad)");
2411         
2412         fhMixDeltaPhiDeltaEtaChargedAssocPtBin[bin] = new TH2F(Form("hMixDeltaPhiDeltaEtaChargedAssocPtBin%2.1f_%2.1f%s", fAssocPtBinLimit[i], fAssocPtBinLimit[i+1],sz.Data()), 
2413                                                              Form("Mixed event #Delta #phi vs p_{T trigger} for associated p_{T} bin [%2.1f,%2.1f]%s", fAssocPtBinLimit[i], fAssocPtBinLimit[i+1],tz.Data()), 
2414                                                              ndeltaphibins ,deltaphimin,deltaphimax,ndeltaetabins ,deltaetamin,deltaetamax); 
2415         fhMixDeltaPhiDeltaEtaChargedAssocPtBin[bin]->SetXTitle("#Delta #phi (rad)");
2416         fhMixDeltaPhiDeltaEtaChargedAssocPtBin[bin]->SetYTitle("#Delta #eta");
2417         
2418         outputContainer->Add(fhMixDeltaPhiChargedAssocPtBin[bin]);
2419         outputContainer->Add(fhMixDeltaPhiChargedAssocPtBinDEta08[bin]);
2420         outputContainer->Add(fhMixDeltaPhiChargedAssocPtBinDEta0[bin]);
2421         outputContainer->Add(fhMixDeltaPhiDeltaEtaChargedAssocPtBin[bin]);
2422       }
2423     }          
2424   }
2425   
2426   return outputContainer;
2427   
2428 }
2429
2430 //_________________________________________________________________________________________________
2431 Bool_t AliAnaParticleHadronCorrelation::GetDecayPhotonMomentum(const AliAODPWG4Particle* trigger, 
2432                                                              TLorentzVector & mom1, 
2433                                                              TLorentzVector & mom2)
2434 {
2435   // Get the momentum of the pi0/eta assigned decay photons
2436   // In case of pi0/eta trigger, we may want to check their decay correlation, 
2437   // get their decay children
2438   
2439   Int_t indexPhoton1 = trigger->GetCaloLabel(0);
2440   Int_t indexPhoton2 = trigger->GetCaloLabel(1);
2441   Float_t ptTrig     = trigger->Pt();
2442   
2443   if(indexPhoton1!=-1 || indexPhoton2!=-1) return kFALSE;
2444   
2445   if(GetDebug() > 1) 
2446     printf("AliAnaParticleHadronCorrelation::GetDecayPhotonMomentum() - indexPhoton1 = %d, indexPhoton2 = %d \n", indexPhoton1, indexPhoton2);
2447   
2448   TObjArray * clusters  = 0x0 ;  
2449   if(trigger->GetDetector()=="EMCAL") clusters = GetEMCALClusters() ;
2450   else                                clusters = GetPHOSClusters()  ;
2451   
2452   for(Int_t iclus = 0; iclus < clusters->GetEntriesFast(); iclus++)
2453   {
2454     AliVCluster * photon =  (AliVCluster*) (clusters->At(iclus));       
2455     if(photon->GetID()==indexPhoton1) 
2456     {
2457       photon->GetMomentum(mom1,GetVertex(0)) ;
2458       if(ptTrig) fhPtPi0DecayRatio->Fill(ptTrig, mom1.Pt()/ptTrig);
2459     }
2460     if(photon->GetID()==indexPhoton2) 
2461     {
2462       photon->GetMomentum(mom1,GetVertex(0)) ;
2463       if(ptTrig > 0) fhPtPi0DecayRatio->Fill(ptTrig, mom2.Pt()/ptTrig);
2464     } 
2465     
2466     if(GetDebug() > 1)printf("AliAnaParticleHadronCorrelation::GetDecayPhotonMomentum() - Photon1 = %f, Photon2 = %f \n", mom1.Pt(), mom2.Pt());
2467     
2468   } //cluster loop        
2469   
2470   return kTRUE;
2471   
2472
2473
2474 //_____________________________________________________________
2475 Int_t AliAnaParticleHadronCorrelation::GetMCTagHistogramIndex(Int_t mcTag)
2476 {
2477   // Index of MC histograms depending on MC origin
2478   
2479   if     ( GetMCAnalysisUtils()->CheckTagBit(mcTag,AliMCAnalysisUtils::kMCPrompt) ||        
2480            GetMCAnalysisUtils()->CheckTagBit(mcTag,AliMCAnalysisUtils::kMCFragmentation)) return 0;
2481   else if( GetMCAnalysisUtils()->CheckTagBit(mcTag,AliMCAnalysisUtils::kMCPi0))           return 1;    
2482   else if( GetMCAnalysisUtils()->CheckTagBit(mcTag,AliMCAnalysisUtils::kMCPi0Decay))      return 2;
2483   else if( GetMCAnalysisUtils()->CheckTagBit(mcTag,AliMCAnalysisUtils::kMCEtaDecay))      return 3;
2484   else if( GetMCAnalysisUtils()->CheckTagBit(mcTag,AliMCAnalysisUtils::kMCOtherDecay))    return 4;
2485   else if(!GetMCAnalysisUtils()->CheckTagBit(mcTag,AliMCAnalysisUtils::kMCElectron))      return 5;
2486   else                                                                                    return 6;
2487   
2488 }
2489
2490 //____________________________________________________
2491 void AliAnaParticleHadronCorrelation::InitParameters()
2492 {
2493   
2494   //Initialize the parameters of the analysis.
2495   SetInputAODName("Particle");
2496   SetAODObjArrayName("Hadrons");  
2497   AddToHistogramsName("AnaHadronCorr_");
2498   
2499   SetPtCutRange(0.,300);
2500   fDeltaPhiMinCut       = 1.5 ;
2501   fDeltaPhiMaxCut       = 4.5 ;
2502   fSelectIsolated       = kFALSE;
2503   fMakeSeveralUE        = kFALSE;
2504   fUeDeltaPhiMinCut     = 1. ;
2505   fUeDeltaPhiMaxCut     = 1.5 ;
2506   
2507   fNeutralCorr          = kFALSE ;
2508   fPi0Trigger           = kFALSE ;
2509   fDecayTrigger         = kFALSE ;
2510   fHMPIDCorrelation     = kFALSE ;
2511   
2512   fMakeAbsoluteLeading  = kTRUE;
2513   fMakeNearSideLeading  = kFALSE;
2514
2515   fNAssocPtBins         = 9   ;
2516   fAssocPtBinLimit[0]   = 0.2 ; 
2517   fAssocPtBinLimit[1]   = 0.5 ; 
2518   fAssocPtBinLimit[2]   = 1.0 ; 
2519   fAssocPtBinLimit[3]   = 2.0 ; 
2520   fAssocPtBinLimit[4]   = 3.0 ; 
2521   fAssocPtBinLimit[5]   = 4.0 ; 
2522   fAssocPtBinLimit[6]   = 5.0 ;
2523   fAssocPtBinLimit[7]   = 6.0 ;
2524   fAssocPtBinLimit[8]   = 7.0 ;
2525   fAssocPtBinLimit[9]   = 8.0 ;
2526   fAssocPtBinLimit[10]  = 9.0 ; 
2527   fAssocPtBinLimit[11]  = 10.0 ; 
2528   fAssocPtBinLimit[12]  = 12.0 ; 
2529   fAssocPtBinLimit[13]  = 14.0 ; 
2530   fAssocPtBinLimit[14]  = 16.0 ; 
2531   fAssocPtBinLimit[15]  = 20.0 ; 
2532   fAssocPtBinLimit[16]  = 30.0 ;
2533   fAssocPtBinLimit[17]  = 40.0 ;
2534   fAssocPtBinLimit[18]  = 50.0 ;
2535   fAssocPtBinLimit[19]  = 200.0 ;
2536   
2537   
2538   fUseMixStoredInReader = kTRUE;
2539   
2540   fM02MinCut   = -1 ;
2541   fM02MaxCut   = -1 ;
2542   
2543 }
2544
2545 //__________________________________________________________
2546 void  AliAnaParticleHadronCorrelation::MakeAnalysisFillAOD()  
2547 {  
2548   //Particle-Hadron Correlation Analysis, fill AODs
2549   
2550   if(!GetInputAODBranch())
2551   {
2552     printf("AliAnaParticleHadronCorrelation::MakeAnalysisFillAOD() - No input particles in AOD with name branch < %s >, STOP \n",GetInputAODName().Data());
2553     abort();
2554   }
2555         
2556   if(strcmp(GetInputAODBranch()->GetClass()->GetName(), "AliAODPWG4ParticleCorrelation"))
2557   {
2558     printf("AliAnaParticleHadronCorrelation::MakeAnalysisFillAOD() - Wrong type of AOD object, change AOD class name in input AOD: It should be <AliAODPWG4ParticleCorrelation> and not <%s> \n",GetInputAODBranch()->GetClass()->GetName());
2559     abort();
2560   }
2561         
2562   if(GetDebug() > 1)
2563   {
2564     printf("AliAnaParticleHadronCorrelation::MakeAnalysisFillAOD() - Begin hadron correlation analysis, fill AODs \n");
2565     printf("AliAnaParticleHadronCorrelation::MakeAnalysisFillAOD() - In particle branch aod entries %d\n", GetInputAODBranch()->GetEntriesFast());
2566     printf("AliAnaParticleHadronCorrelation::MakeAnalysisFillAOD() - In CTS aod entries %d\n",   GetCTSTracks()    ->GetEntriesFast());
2567     printf("AliAnaParticleHadronCorrelation::MakeAnalysisFillAOD() - In EMCAL aod entries %d\n", GetEMCALClusters()->GetEntriesFast());
2568     printf("AliAnaParticleHadronCorrelation::MakeAnalysisFillAOD() - In PHOS aod entries %d\n",  GetPHOSClusters() ->GetEntriesFast());
2569   }
2570   
2571   //Get the vertex and check it is not too large in z
2572   Double_t v[3] = {0,0,0}; //vertex ;
2573   GetReader()->GetVertex(v);
2574   if(!GetMixedEvent() && TMath::Abs(v[2]) > GetZvertexCut()) return ;   
2575   
2576   // Fill the pool with tracks if requested
2577   if(DoOwnMix())
2578   {
2579     FillChargedEventMixPool();
2580     if(OnlyIsolated() || fFillNeutralEventMixPool)
2581       FillNeutralEventMixPool();
2582   }
2583   
2584   //Loop on stored AOD particles, find leading trigger
2585   Double_t ptTrig      = fMinTriggerPt ;
2586   fLeadingTriggerIndex = -1 ;
2587   Int_t    naod        = GetInputAODBranch()->GetEntriesFast() ;
2588   for(Int_t iaod = 0; iaod < naod ; iaod++)
2589   {
2590     AliAODPWG4ParticleCorrelation* particle =  (AliAODPWG4ParticleCorrelation*) (GetInputAODBranch()->At(iaod));
2591     
2592     // Vertex cut in case of mixing
2593     Int_t check = CheckMixedEventVertex(particle->GetCaloLabel(0), particle->GetTrackLabel(0));
2594     if(check ==  0) continue;
2595     if(check == -1) return;
2596         
2597     // find the leading particles with highest momentum
2598     if (particle->Pt() > ptTrig) 
2599     {
2600       ptTrig               = particle->Pt() ;
2601       fLeadingTriggerIndex = iaod ;
2602     }
2603   }// finish search of leading trigger particle
2604         
2605   
2606   //Do correlation with leading particle
2607   if(fLeadingTriggerIndex >= 0)
2608   {
2609           
2610     AliAODPWG4ParticleCorrelation* particle =  (AliAODPWG4ParticleCorrelation*) (GetInputAODBranch()->At(fLeadingTriggerIndex));
2611     
2612     //check if the particle is isolated or if we want to take the isolation into account
2613     if(OnlyIsolated() && !particle->IsIsolated()) return;
2614     
2615     //Make correlation with charged hadrons
2616     Bool_t okcharged = kTRUE;
2617     Bool_t okneutral = kTRUE;
2618     if(GetReader()->IsCTSSwitchedOn() )
2619       okcharged = MakeChargedCorrelation(particle, GetCTSTracks(),kFALSE);
2620     
2621     TObjArray * pi0list = (TObjArray*) GetAODBranch(fPi0AODBranchName); //For the future, foresee more possible pi0 lists
2622     if(fNeutralCorr && pi0list && pi0list->GetEntriesFast() > 0)
2623       okneutral = MakeNeutralCorrelation(particle, pi0list,kFALSE);
2624     
2625   }//Correlate leading
2626   
2627   if(GetDebug() > 1) printf("AliAnaParticleHadronCorrelation::MakeAnalysisFillAOD() - End fill AODs \n");
2628   
2629 }
2630
2631 //_________________________________________________________________
2632 void  AliAnaParticleHadronCorrelation::MakeAnalysisFillHistograms()  
2633 {  
2634   //Particle-Hadron Correlation Analysis, fill histograms
2635   
2636   if(!GetInputAODBranch())
2637   {
2638     printf("AliAnaParticleHadronCorrelation::MakeAnalysisFillHistograms() - No input particles in AOD with name branch < %s >, STOP \n",GetInputAODName().Data());
2639     abort();
2640   }
2641   
2642   if(GetDebug() > 1)
2643   {
2644     printf("AliAnaParticleHadronCorrelation::MakeAnalysisFillHistograms() - Begin hadron correlation analysis, fill histograms \n");
2645     printf("AliAnaParticleHadronCorrelation::MakeAnalysisFillHistograms() - In particle branch aod entries %d\n", GetInputAODBranch()->GetEntriesFast());
2646   }
2647     
2648   //Get the vertex and check it is not too large in z
2649   Double_t v[3] = {0,0,0}; //vertex ;
2650   GetReader()->GetVertex(v);
2651   if(!GetMixedEvent() && TMath::Abs(v[2]) > GetZvertexCut()) return ;  
2652   
2653   //Loop on stored AOD particles, find leading
2654   Double_t ptTrig    = fMinTriggerPt;
2655   if(fLeadingTriggerIndex < 0)
2656   {
2657     //Search leading if not done before
2658     Int_t    naod      = GetInputAODBranch()->GetEntriesFast() ;
2659     for(Int_t iaod = 0; iaod < naod ; iaod++)
2660     {    //loop on input trigger AOD file 
2661       AliAODPWG4ParticleCorrelation* particle =  (AliAODPWG4ParticleCorrelation*) (GetInputAODBranch()->At(iaod));
2662
2663       // Vertex cut in case of mixing
2664       Int_t check = CheckMixedEventVertex(particle->GetCaloLabel(0), particle->GetTrackLabel(0));
2665       if(check ==  0) continue;
2666       if(check == -1) return;
2667             
2668       //check if the particle is isolated or if we want to take the isolation into account
2669       if(OnlyIsolated() && !particle->IsIsolated()) continue;
2670       
2671       //find the leading particles with highest momentum
2672       if (particle->Pt() > ptTrig) 
2673       {
2674         ptTrig               = particle->Pt() ;
2675         fLeadingTriggerIndex = iaod ;
2676       }
2677       
2678     }// Finish search of leading trigger particle
2679   }// Search leading if not done before
2680   
2681   if(fLeadingTriggerIndex >= 0 )
2682   { //using trigger particle to do correlations
2683     
2684     AliAODPWG4ParticleCorrelation* particle =  (AliAODPWG4ParticleCorrelation*) (GetInputAODBranch()->At(fLeadingTriggerIndex));
2685
2686     // check if it was a calorimeter cluster and if the SS cut was requested, if so, apply it
2687     Int_t clID1  = particle->GetCaloLabel(0) ;
2688     Int_t clID2  = particle->GetCaloLabel(1) ; // for photon clusters should not be set.
2689     //printf("Leading for for %s: id1 %d, id2 %d, min %f, max %f, det %s\n",
2690     //       GetInputAODName().Data(),clID1,clID2,fM02MinCut,fM02MaxCut,(particle->GetDetector()).Data());
2691
2692     if(clID1 > 0 && clID2 < 0 && fM02MaxCut > 0 && fM02MinCut > 0)
2693     {
2694       Int_t iclus = -1;
2695       TObjArray* clusters = 0x0;
2696       if     (particle->GetDetector() == "EMCAL") clusters = GetEMCALClusters();
2697       else if(particle->GetDetector() == "PHOS" ) clusters = GetPHOSClusters();
2698       
2699       if(clusters)
2700       {
2701         AliVCluster *cluster = FindCluster(clusters,clID1,iclus); 
2702         Float_t m02 = cluster->GetM02();
2703         //printf("\t Check m02 = %2.2f\n",m02);
2704         if(m02 > fM02MaxCut || m02 < fM02MinCut) 
2705         {
2706           //printf("\t \t Not accepted\n");
2707           return;
2708         }
2709       }        
2710     }
2711     
2712     // Check if the particle is isolated or if we want to take the isolation into account
2713     if(OnlyIsolated() && !particle->IsIsolated()) return;
2714     
2715     Float_t pt = particle->Pt();
2716     fhPtInput->Fill(pt);
2717     
2718     // Check if trigger is in fiducial region
2719     if(IsFiducialCutOn())
2720     {
2721       Bool_t in = GetFiducialCut()->IsInFiducialCut(*particle->Momentum(),particle->GetDetector()) ;
2722       if(! in ) return ;
2723     }
2724     
2725     fhPtFidCut->Fill(pt);
2726         
2727     // Make correlation with charged hadrons
2728     Bool_t okcharged = kTRUE;
2729     Bool_t okneutral = kTRUE;
2730     if(GetReader()->IsCTSSwitchedOn() )
2731     {
2732       okcharged = MakeChargedCorrelation(particle, GetCTSTracks(),kTRUE);
2733       if(IsDataMC())
2734       {      
2735         MakeMCChargedCorrelation(particle);
2736       }
2737     }  
2738     
2739     TObjArray * pi0list = (TObjArray*) GetAODBranch(fPi0AODBranchName); //For the future, foresee more possible pi0 lists
2740     if(fNeutralCorr && pi0list)
2741     {
2742       if(pi0list->GetEntriesFast() > 0)
2743         okneutral = MakeNeutralCorrelation(particle, pi0list,kTRUE);
2744     }
2745     
2746     // Fill leading particle histogram if correlation went well and 
2747     // no problem was found, like not absolute leading, or bad vertex in mixing.
2748     if(okcharged && okneutral)
2749     {
2750       fhPtLeading->Fill(pt);
2751       fhPtLeadingBin->Fill(pt,GetEventMixBin());
2752       if(fCorrelVzBin) fhPtLeadingVzBin->Fill(pt,GetEventVzBin());
2753  
2754       if(fFillPileUpHistograms)
2755       {
2756         if(GetReader()->IsPileUpFromSPD())               fhPtLeadingPileUp[0]->Fill(pt);
2757         if(GetReader()->IsPileUpFromEMCal())             fhPtLeadingPileUp[1]->Fill(pt);
2758         if(GetReader()->IsPileUpFromSPDOrEMCal())        fhPtLeadingPileUp[2]->Fill(pt);
2759         if(GetReader()->IsPileUpFromSPDAndEMCal())       fhPtLeadingPileUp[3]->Fill(pt);
2760         if(GetReader()->IsPileUpFromSPDAndNotEMCal())    fhPtLeadingPileUp[4]->Fill(pt);
2761         if(GetReader()->IsPileUpFromEMCalAndNotSPD())    fhPtLeadingPileUp[5]->Fill(pt);
2762         if(GetReader()->IsPileUpFromNotSPDAndNotEMCal()) fhPtLeadingPileUp[6]->Fill(pt);
2763       }
2764       
2765       Float_t phi = particle->Phi();
2766       if(phi<0)phi+=TMath::TwoPi();
2767       fhPhiLeading->Fill(pt, phi);
2768       
2769       fhEtaLeading->Fill(pt, particle->Eta());
2770       //printf("AliAnaParticleHadronCorrelation::MakeAnalysisFillHistograms() - Leading particle : pt %f, eta %f, phi %f\n",particle->Pt(),particle->Eta(),phi);
2771       
2772       if(IsDataMC())
2773       {
2774         Int_t mcIndex = GetMCTagHistogramIndex(particle->GetTag());
2775         fhPtLeadingMC[mcIndex]->Fill(pt);
2776       }        
2777       
2778       Float_t cen = GetEventCentrality();
2779       Float_t ep  = GetEventPlaneAngle();
2780       
2781       fhPtLeadingCentrality        ->Fill(pt,cen);
2782       fhPtLeadingEventPlane        ->Fill(pt,ep);
2783       fhLeadingEventPlaneCentrality->Fill(cen,ep);
2784       
2785     }//ok charged && neutral
2786   }//Aod branch loop
2787   
2788   //Reinit for next event
2789   fLeadingTriggerIndex = -1;
2790   
2791   if(GetDebug() > 1) printf("AliAnaParticleHadronCorrelation::MakeAnalysisFillHistograms() - End fill histograms \n");
2792 }
2793
2794 //___________________________________________________________________________________________________________
2795 Bool_t  AliAnaParticleHadronCorrelation::MakeChargedCorrelation(AliAODPWG4ParticleCorrelation *aodParticle, 
2796                                                                 const TObjArray* pl, Bool_t bFillHisto)
2797 {  
2798   // Charged Hadron Correlation Analysis
2799   if(GetDebug() > 1) 
2800     printf("AliAnaParticleHadronCorrelation::MakeChargedCorrelation() - Make trigger particle - charged hadron correlation \n");
2801     
2802   Float_t phiTrig = aodParticle->Phi();
2803   Float_t etaTrig = aodParticle->Eta();
2804   Float_t ptTrig  = aodParticle->Pt();  
2805   Bool_t   decay  = aodParticle->IsTagged();
2806   Int_t    mcTag  = aodParticle->GetTag();
2807   Double_t bz     = GetReader()->GetInputEvent()->GetMagneticField();
2808
2809   Float_t pt       = -100. ;
2810   Float_t zT       = -100. ; 
2811   Float_t xE       = -100. ; 
2812   Float_t hbpXE    = -100. ; 
2813   Float_t hbpZT    = -100. ; 
2814   Float_t phi      = -100. ;
2815   Float_t eta      = -100. ;
2816   Float_t pout     = -100. ;
2817   Float_t deltaPhi = -100. ;
2818   
2819   TVector3 p3;  
2820   TLorentzVector photonMom ;    
2821   TObjArray * reftracks = 0x0;
2822   Int_t nrefs           = 0;
2823   Int_t nTracks         = GetCTSTracks()->GetEntriesFast() ;
2824   
2825   // Mixed event settings
2826   Int_t evtIndex11   = -1 ; // cluster trigger or pi0 trigger 
2827   Int_t evtIndex12   = -1 ; // pi0 trigger
2828   Int_t evtIndex13   = -1 ; // charged trigger
2829   
2830   Double_t v[3]      = {0,0,0}; //vertex ;
2831   GetReader()->GetVertex(v);
2832   
2833   if (GetMixedEvent()) 
2834   {
2835     evtIndex11 = GetMixedEvent()->EventIndexForCaloCluster(aodParticle->GetCaloLabel(0)) ;
2836     evtIndex12 = GetMixedEvent()->EventIndexForCaloCluster(aodParticle->GetCaloLabel(1)) ;    
2837     evtIndex13 = GetMixedEvent()->EventIndex(aodParticle->GetTrackLabel(0)) ;
2838   }
2839   
2840   // In case of pi0/eta trigger, we may want to check their decay correlation, 
2841   // get their decay children
2842   TLorentzVector decayMom1;
2843   TLorentzVector decayMom2;
2844   Bool_t decayFound = kFALSE;
2845   if(fPi0Trigger && bFillHisto) decayFound = GetDecayPhotonMomentum(aodParticle,decayMom1, decayMom2);
2846
2847   //-----------------------------------------------------------------------
2848   //Track loop, select tracks with good pt, phi and fill AODs or histograms
2849   //-----------------------------------------------------------------------
2850
2851   for(Int_t ipr = 0;ipr < pl->GetEntriesFast() ; ipr ++ )
2852   {
2853     AliVTrack * track = (AliVTrack *) (pl->At(ipr)) ;
2854     
2855     Double_t mom[3] = {track->Px(),track->Py(),track->Pz()};
2856     p3.SetXYZ(mom[0],mom[1],mom[2]);
2857     pt   = p3.Pt();
2858     eta  = p3.Eta();
2859     phi  = p3.Phi() ;
2860     if(phi < 0) phi+=TMath::TwoPi();
2861     
2862     //Select only hadrons in pt range
2863     if(pt < fMinAssocPt || pt > fMaxAssocPt) continue ;
2864     
2865     //remove trigger itself for correlation when use charged triggers    
2866     if( track->GetID() == aodParticle->GetTrackLabel(0) || track->GetID() == aodParticle->GetTrackLabel(1) ||
2867         track->GetID() == aodParticle->GetTrackLabel(2) || track->GetID() == aodParticle->GetTrackLabel(3)   ) 
2868       continue ;
2869     
2870     //jump out this event if near side associated particle pt larger than trigger
2871     if (fMakeNearSideLeading)
2872     {
2873       if(pt > ptTrig && TMath::Abs(phi-phiTrig) < TMath::PiOver2())  return kFALSE;
2874     }
2875     //jump out this event if there is any other particle with pt larger than trigger
2876     else if(fMakeAbsoluteLeading)
2877     {
2878       if(pt > ptTrig)  return kFALSE;
2879     }
2880     
2881     //Only for mixed event
2882     Int_t evtIndex2 = 0 ; 
2883     if (GetMixedEvent()) 
2884     {
2885       evtIndex2 = GetMixedEvent()->EventIndex(track->GetID()) ;
2886       if (evtIndex11 == evtIndex2 || evtIndex12 == evtIndex2 || evtIndex13 == evtIndex2 ) // photon and track from different events
2887         continue ; 
2888       //vertex cut
2889       if (TMath::Abs(GetVertex(evtIndex2)[2]) > GetZvertexCut()) 
2890         return kFALSE;
2891     }    
2892     
2893     // Fill Histograms
2894     if(bFillHisto)
2895     {      
2896
2897       if(GetDebug() > 2 ) 
2898         printf("AliAnaParticleHadronCorrelation::MakeChargedCorrelation() - Selected charge for momentum imbalance: pt %2.2f, phi %2.2f, eta %2.2f \n",pt,phi,eta);
2899             
2900       // Set the pt associated bin for the defined bins
2901       Int_t assocBin   = -1; 
2902       for(Int_t i = 0 ; i < fNAssocPtBins ; i++)
2903       {
2904         if(pt > fAssocPtBinLimit[i] && pt < fAssocPtBinLimit[i+1]) assocBin= i; 
2905       }      
2906       
2907       // Assign to the histogram array a bin corresponding to a combination of pTa and vz bins
2908       Int_t nz = 1;
2909       Int_t vz = 0;
2910       
2911       if(fCorrelVzBin) 
2912       {
2913         nz = GetNZvertBin();
2914         vz = GetEventVzBin();
2915       }
2916       
2917       Int_t bin = assocBin*nz+vz;
2918       
2919       //printf("assoc Bin = %d, vZ bin  = %d, bin = %d \n", assocBin,GetEventVzBin(),bin);
2920       
2921       ULong_t status = track->GetStatus();
2922       Bool_t okTOF = ( (status & AliVTrack::kTOFout) == AliVTrack::kTOFout ) ;
2923       //Double32_t tof = track->GetTOFsignal()*1e-3;
2924       Int_t trackBC = track->GetTOFBunchCrossing(bz);
2925
2926       Int_t outTOF = -1;
2927       if     (okTOF && trackBC!=0) outTOF = 1;
2928       else if(okTOF && trackBC==0) outTOF = 0;
2929       
2930       // Azimuthal Angle
2931       // calculate deltaPhi for later, shift when needed
2932       FillChargedAngularCorrelationHistograms(pt,  ptTrig,  bin, phi, phiTrig,  deltaPhi,
2933                                               eta, etaTrig, decay, track->GetHMPIDsignal(),outTOF,nTracks,mcTag);
2934       
2935       // Imbalance zT/xE/pOut
2936       zT = pt/ptTrig ;
2937       if(zT > 0 ) hbpZT = TMath::Log(1./zT);
2938       else        hbpZT =-100;
2939       
2940       xE   =-pt/ptTrig*TMath::Cos(deltaPhi); // -(px*pxTrig+py*pyTrig)/(ptTrig*ptTrig);
2941       //if(xE <0.)xE =-xE;
2942       if(xE > 0 ) hbpXE = TMath::Log(1./xE); 
2943       else        hbpXE =-100;
2944     
2945       pout = pt*TMath::Sin(deltaPhi) ;
2946       
2947       //delta phi cut for momentum imbalance correlation
2948       if      ( (deltaPhi > fDeltaPhiMinCut)   && (deltaPhi < fDeltaPhiMaxCut)   ) 
2949       {
2950         
2951         FillChargedMomentumImbalanceHistograms(ptTrig, pt, xE, hbpXE, zT, hbpZT, pout, 
2952                                                nTracks, track->Charge(), bin, decay,outTOF,mcTag);
2953         
2954       } 
2955       if ( (deltaPhi > fUeDeltaPhiMinCut) && (deltaPhi < fUeDeltaPhiMaxCut) )
2956       { //UE study
2957         
2958         FillChargedUnderlyingEventHistograms(ptTrig, pt, deltaPhi, nTracks,outTOF);
2959
2960         fhUePart->Fill(ptTrig);
2961         
2962       }
2963       
2964       if(fPi0Trigger && decayFound) 
2965         FillDecayPhotonCorrelationHistograms(pt, phi, decayMom1,decayMom2, kTRUE) ;
2966       
2967       //several UE calculation 
2968       if(fMakeSeveralUE) FillChargedUnderlyingEventSidesHistograms(ptTrig,pt,deltaPhi);
2969       
2970     } //Fill histogram 
2971     else
2972     {
2973       nrefs++;
2974       if(nrefs==1)
2975       {
2976         reftracks = new TObjArray(0);
2977         TString trackname = Form("%s+Tracks", GetAODObjArrayName().Data());
2978         reftracks->SetName(trackname.Data());
2979         reftracks->SetOwner(kFALSE);        
2980       }
2981       
2982       reftracks->Add(track);
2983       
2984     }//aod particle loop
2985   }// track loop
2986   
2987   //Fill AOD with reference tracks, if not filling histograms
2988   if(!bFillHisto && reftracks) 
2989   {
2990     aodParticle->AddObjArray(reftracks);
2991   }
2992
2993   //Own mixed event, add event and remove previous or fill the mixed histograms
2994   if(DoOwnMix() && bFillHisto)
2995   {
2996       MakeChargedMixCorrelation(aodParticle);
2997   }
2998   
2999   return kTRUE;
3000   
3001 }  
3002
3003
3004 //_________________________________________________________________________________________________________
3005 void AliAnaParticleHadronCorrelation::MakeChargedMixCorrelation(AliAODPWG4ParticleCorrelation *aodParticle) 
3006 {  
3007   // Mix current trigger with tracks in another MB event
3008   
3009   if(GetDebug() > 1) printf("AliAnaParticleHadronCorrelationNew::MakeChargedMixCorrelation() - Make trigger particle - charged hadron mixed event correlation \n");
3010   
3011   if(GetMixedEvent()) return;  // This is not the mixed event from general mixing frame
3012   
3013   // Get the event with similar caracteristics
3014   //printf("MakeChargedMixCorrelation for %s\n",GetInputAODName().Data());
3015
3016   AliAnalysisManager   * manager      = AliAnalysisManager::GetAnalysisManager();
3017   
3018   AliInputEventHandler * inputHandler = dynamic_cast<AliInputEventHandler*>(manager->GetInputEventHandler());
3019   
3020   if(!inputHandler) return;
3021   
3022   if(!(inputHandler->IsEventSelected( ) & GetReader()->GetEventTriggerMask())) return;
3023     
3024   // Get the pool, check if it exits
3025   Int_t eventBin = GetEventMixBin();
3026
3027   fhEventBin->Fill(eventBin);
3028   
3029   //Check that the bin exists, if not (bad determination of RP, centrality or vz bin) do nothing
3030   if(eventBin < 0) return;
3031   
3032   TList * pool     = 0;
3033   TList * poolCalo = 0;
3034   if(fUseMixStoredInReader) 
3035   {
3036     pool     = GetReader()->GetListWithMixedEventsForTracks(eventBin);
3037     if(OnlyIsolated() || fFillNeutralEventMixPool) poolCalo = GetReader()->GetListWithMixedEventsForCalo  (eventBin);
3038   }
3039   else
3040   {
3041     pool     = fListMixTrackEvents[eventBin];
3042     if(OnlyIsolated()  || fFillNeutralEventMixPool) poolCalo = fListMixCaloEvents [eventBin];
3043   }
3044   
3045   if(!pool) return ;
3046     
3047   if((OnlyIsolated()  || fFillNeutralEventMixPool ) && !poolCalo &&
3048      (GetIsolationCut()->GetParticleTypeInCone()!=AliIsolationCut::AliIsolationCut::kOnlyCharged)) 
3049     printf("AliAnaParticleHadronCorrelation::MakeChargedMixCorrelation() - Careful, cluster pool not available\n");
3050   
3051   Double_t ptTrig  = aodParticle->Pt();
3052   Double_t etaTrig = aodParticle->Eta();
3053   Double_t phiTrig = aodParticle->Phi();
3054   if(phiTrig < 0.) phiTrig+=TMath::TwoPi();
3055   
3056   if(GetDebug() > 1) 
3057     printf("AliAnaParticleHadronCorrelationNew::MakeChargedMixCorrelation() - Pool bin %d size %d, leading trigger pt=%f, phi=%f, eta=%f\n",
3058            eventBin,pool->GetSize(), ptTrig,phiTrig,etaTrig);
3059   
3060   Double_t ptAssoc  = -999.;
3061   Double_t phiAssoc = -999.;
3062   Double_t etaAssoc = -999.;
3063   Double_t deltaPhi = -999.;
3064   Double_t deltaEta = -999.;
3065   Double_t xE = -999.;
3066   Double_t hbpXE = -999.;
3067       
3068   //Start from first event in pool except if in this same event the pool was filled
3069   Int_t ev0 = 0;
3070   if(GetReader()->GetLastTracksMixedEvent() == GetEventNumber()) ev0 = 1;
3071
3072   for(Int_t ev=ev0; ev < pool->GetSize(); ev++)
3073   {
3074     TObjArray* bgTracks = static_cast<TObjArray*>(pool->At(ev));
3075     TObjArray* bgCalo   = 0;
3076
3077     // Check if the particle is isolated in the mixed event, it not, do not fill the histograms
3078     if(OnlyIsolated() || fFillNeutralEventMixPool)
3079     {
3080       if(pool->GetSize()!=poolCalo->GetSize()) 
3081         printf("AliAnaParticleHadronCorrelationNew::MakeChargedMixCorrelation() - Different size of calo and track pools\n");
3082       
3083       bgCalo = static_cast<TObjArray*>(poolCalo->At(ev));
3084       
3085       if(!bgCalo) 
3086         printf("AliAnaParticleHadronCorrelationNew::MakeChargedMixCorrelation() - Event %d in calo pool not available?\n",ev);
3087       
3088       if(OnlyIsolated() && bgCalo)
3089       {
3090         Int_t n=0; Int_t nfrac = 0; Bool_t isolated = kFALSE; Float_t coneptsum = 0;
3091         GetIsolationCut()->MakeIsolationCut(bgTracks,bgCalo,
3092                                             GetReader(), GetCaloPID(),
3093                                             kFALSE, aodParticle, "", 
3094                                             n,nfrac,coneptsum, isolated);
3095         
3096         //printf("AliAnaParticleHadronCorrelation::MakeChargedMixCorrelation() - Isolated? %d - cone %f, ptthres %f",
3097         //       isolated,GetIsolationCut()->GetConeSize(),GetIsolationCut()->GetPtThreshold());
3098         //if(bgTracks)printf(" - n track %d", bgTracks->GetEntriesFast());
3099         //printf("\n");
3100         
3101         if(!isolated) continue ;
3102       }
3103     }
3104     
3105     fhEventMixBin->Fill(eventBin);
3106     
3107     Int_t nTracks=bgTracks->GetEntriesFast();
3108     //printf("\t Read Pool event %d, nTracks %d\n",ev,nTracks);
3109
3110     //Check if it is leading if mixed event
3111     if(fMakeNearSideLeading || fMakeAbsoluteLeading)
3112     {
3113       Bool_t leading = kTRUE;
3114       for(Int_t jlead = 0;jlead <nTracks; jlead++ )
3115       {
3116         AliAODPWG4Particle *track = (AliAODPWG4Particle*) bgTracks->At(jlead) ;
3117         
3118         ptAssoc  = track->Pt();
3119         phiAssoc = track->Phi() ;
3120         
3121         if(phiAssoc < 0) phiAssoc+=TMath::TwoPi();
3122         if (fMakeNearSideLeading)
3123         {
3124           if(ptAssoc > ptTrig && TMath::Abs(phiAssoc-phiTrig) < TMath::PiOver2())  
3125           {
3126             leading = kFALSE;
3127             break;
3128           }
3129         }
3130         //jump out this event if there is any other particle with pt larger than trigger
3131         else if(fMakeAbsoluteLeading)
3132         {
3133           if(ptAssoc > ptTrig) 
3134           { 
3135             leading = kFALSE;
3136             break;
3137           }
3138         }
3139       }
3140       
3141       if(fFillNeutralEventMixPool && bgCalo)
3142       {
3143         Int_t nClusters=bgCalo->GetEntriesFast();
3144         TLorentzVector mom ;
3145         for(Int_t jlead = 0;jlead <nClusters; jlead++ )
3146         {
3147           AliVCluster *cluster = (AliVCluster*) bgCalo->At(jlead) ;
3148           
3149           Double_t vertex[]={0,0,0}; // assume 0 vertex
3150           cluster->GetMomentum(mom,vertex) ;
3151
3152           ptAssoc  = mom.Pt();
3153           phiAssoc = mom.Phi() ;
3154           
3155           if(phiAssoc < 0) phiAssoc+=TMath::TwoPi();
3156           if (fMakeNearSideLeading)
3157           {
3158             if(ptAssoc > ptTrig && TMath::Abs(phiAssoc-phiTrig) < TMath::PiOver2())
3159             {
3160               leading = kFALSE;
3161               break;
3162             }
3163           }
3164           //jump out this event if there is any other particle with pt larger than trigger
3165           else if(fMakeAbsoluteLeading)
3166           {
3167             if(ptAssoc > ptTrig)
3168             {
3169               leading = kFALSE;
3170               break;
3171             }
3172           }
3173         }
3174       }
3175       
3176       if(!leading) continue; // not leading, check the next event in pool
3177     
3178     }
3179     
3180     fhPtLeadingMixed   ->Fill(ptTrig);
3181     fhPhiLeadingMixed  ->Fill(ptTrig, phiTrig);
3182     fhEtaLeadingMixed  ->Fill(ptTrig, etaTrig);
3183     fhPtLeadingMixedBin->Fill(ptTrig,eventBin);
3184     if(fCorrelVzBin)fhPtLeadingMixedVzBin->Fill(ptTrig, GetEventVzBin());
3185
3186     for(Int_t j1 = 0;j1 <nTracks; j1++ )
3187     {
3188       AliAODPWG4Particle *track = (AliAODPWG4Particle*) bgTracks->At(j1) ;
3189       
3190       if(!track) continue;
3191       
3192       ptAssoc  = track->Pt();
3193       etaAssoc = track->Eta();
3194       phiAssoc = track->Phi() ;
3195       if(phiAssoc < 0) phiAssoc+=TMath::TwoPi();
3196             
3197       if(IsFiducialCutOn())
3198       {
3199         Bool_t in = GetFiducialCut()->IsInFiducialCut(*aodParticle->Momentum(),"CTS") ;
3200         if(!in) continue ;
3201       }
3202       
3203       deltaPhi = phiTrig-phiAssoc;
3204       if(deltaPhi < -TMath::PiOver2())  deltaPhi+=TMath::TwoPi();
3205       if(deltaPhi > 3*TMath::PiOver2()) deltaPhi-=TMath::TwoPi();
3206       deltaEta = etaTrig-etaAssoc;
3207       
3208       if(GetDebug()>0)
3209         printf("AliAnaParticleHadronCorrelationNew::MakeChargedMixCorrelation(): deltaPhi= %f, deltaEta=%f\n",deltaPhi, deltaEta);
3210       
3211       // Set the pt associated bin for the defined bins
3212       Int_t assocBin   = -1; 
3213       for(Int_t i = 0 ; i < fNAssocPtBins ; i++)
3214       {
3215         if(ptAssoc > fAssocPtBinLimit[i] && ptAssoc < fAssocPtBinLimit[i+1]) assocBin= i; 
3216       }      
3217
3218       // Assign to the histogram array a bin corresponding to a combination of pTa and vz bins
3219       Int_t nz = 1;
3220       Int_t vz = 0;
3221       
3222       if(fCorrelVzBin) 
3223       {
3224         nz = GetNZvertBin();
3225         vz = GetEventVzBin();
3226       }
3227       
3228       Int_t bin = assocBin*nz+vz;
3229       
3230       fhMixDeltaPhiCharged        ->Fill(ptTrig,  deltaPhi);
3231       fhMixDeltaPhiDeltaEtaCharged->Fill(deltaPhi, deltaEta);
3232
3233       fhMixDeltaPhiCharged        ->Fill(ptTrig,  deltaPhi);
3234       fhMixDeltaPhiDeltaEtaCharged->Fill(deltaPhi, deltaEta);
3235
3236       xE   =-ptAssoc/ptTrig*TMath::Cos(deltaPhi); // -(px*pxTrig+py*pyTrig)/(ptTrig*ptTrig);
3237       //if(xE <0.)xE =-xE;
3238       if(xE > 0 ) hbpXE = TMath::Log(1./xE); 
3239       else        hbpXE =-100;
3240
3241       if      ( (deltaPhi > fDeltaPhiMinCut)   && (deltaPhi < fDeltaPhiMaxCut)   ) 
3242       {
3243         fhMixXECharged->Fill(ptTrig,xE);
3244         fhMixHbpXECharged->Fill(ptTrig,hbpXE);
3245       }
3246
3247       if(bin < 0) continue ; // this pt bin was not considered
3248       
3249       if(TMath::Abs(deltaEta) > 0.8) 
3250         fhMixDeltaPhiChargedAssocPtBinDEta08  [bin]->Fill(ptTrig,   deltaPhi);
3251       if(TMath::Abs(deltaEta) < 0.01) 
3252         fhMixDeltaPhiChargedAssocPtBinDEta0   [bin]->Fill(ptTrig,   deltaPhi);
3253       
3254         fhMixDeltaPhiChargedAssocPtBin        [bin]->Fill(ptTrig,   deltaPhi);
3255         fhMixDeltaPhiDeltaEtaChargedAssocPtBin[bin]->Fill(deltaPhi, deltaEta);
3256       
3257     } // track loop
3258   } // mixed event loop
3259 }
3260   
3261
3262 //________________________________________________________________________________________________________________
3263 Bool_t  AliAnaParticleHadronCorrelation::MakeNeutralCorrelation(AliAODPWG4ParticleCorrelation * const aodParticle, 
3264                                                                 const TObjArray* pi0list, Bool_t bFillHisto)  
3265 {  
3266   // Neutral Pion Correlation Analysis
3267   if(GetDebug() > 1) printf("AliAnaParticleHadronCorrelation::MakeNeutralCorrelation() - Make trigger particle - pi0 correlation, %d pi0's \n",
3268                             pi0list->GetEntriesFast());
3269   
3270   Int_t evtIndex11 = 0 ; 
3271   Int_t evtIndex12 = 0 ; 
3272   if (GetMixedEvent()) 
3273   {
3274     evtIndex11 = GetMixedEvent()->EventIndexForCaloCluster(aodParticle->GetCaloLabel(0)) ;
3275     evtIndex12 = GetMixedEvent()->EventIndexForCaloCluster(aodParticle->GetCaloLabel(1)) ;    
3276   }  
3277   
3278   Float_t pt   = -100. ;
3279   Float_t zT   = -100. ; 
3280   Float_t phi  = -100. ;
3281   Float_t eta  = -100. ;
3282   Float_t xE   = -100. ; 
3283   Float_t hbpXE= -100. ; 
3284   Float_t hbpZT= -100. ; 
3285
3286   Float_t ptTrig  = aodParticle->Pt();
3287   Float_t phiTrig = aodParticle->Phi();
3288   Float_t etaTrig = aodParticle->Eta();
3289   Float_t deltaPhi= -100. ;
3290
3291   TLorentzVector photonMom ;
3292         
3293   // In case of pi0/eta trigger, we may want to check their decay correlation, 
3294   // get their decay children
3295   TLorentzVector decayMom1;
3296   TLorentzVector decayMom2;
3297   Bool_t decayFound = kFALSE;
3298   if(fPi0Trigger && bFillHisto) decayFound = GetDecayPhotonMomentum(aodParticle,decayMom1, decayMom2);  
3299   
3300   TObjArray * refpi0 = 0x0;
3301   Int_t nrefs        = 0;
3302   
3303   //Loop on stored AOD pi0
3304   
3305   Int_t naod = pi0list->GetEntriesFast();
3306   if(GetDebug() > 0) 
3307     printf("AliAnaParticleHadronCorrelation::MakeNeutralCorrelationFillHistograms() -  aod branch entries %d\n", naod);
3308   
3309   for(Int_t iaod = 0; iaod < naod ; iaod++)
3310   {
3311     AliAODPWG4Particle* pi0 =  (AliAODPWG4Particle*) (pi0list->At(iaod));
3312     
3313     Int_t evtIndex2 = 0 ; 
3314     Int_t evtIndex3 = 0 ; 
3315     if (GetMixedEvent()) 
3316     {
3317       evtIndex2 = GetMixedEvent()->EventIndexForCaloCluster(pi0->GetCaloLabel(0)) ;
3318       evtIndex3 = GetMixedEvent()->EventIndexForCaloCluster(pi0->GetCaloLabel(1)) ;
3319       
3320       if (evtIndex11 == evtIndex2 || evtIndex12 == evtIndex2 || 
3321           evtIndex11 == evtIndex3 || evtIndex12 == evtIndex3) // trigger and pi0 are not from different events
3322         continue ; 
3323     }      
3324
3325     pt  = pi0->Pt();
3326      
3327     if(pt < fMinAssocPt || pt > fMaxAssocPt) continue ;
3328     
3329     //jump out this event if near side associated particle pt larger than trigger
3330     if (fMakeNearSideLeading)
3331     {
3332       if(pt > ptTrig && TMath::Abs(phi-phiTrig) < TMath::PiOver2())  return kFALSE;
3333     }
3334     //jump out this event if there is any other particle with pt larger than trigger
3335     else if(fMakeAbsoluteLeading)
3336     {
3337       if(pt > ptTrig)  return kFALSE;
3338     }
3339     
3340     if(bFillHisto)
3341     {
3342       phi = pi0->Phi() ;
3343       eta = pi0->Eta() ;
3344       
3345       FillNeutralAngularCorrelationHistograms(pt, ptTrig, phi, phiTrig, deltaPhi, eta, etaTrig);
3346       
3347       zT  = pt/ptTrig ;
3348       xE  =-pt/ptTrig*TMath::Cos(deltaPhi); // -(px*pxTrig+py*pyTrig)/(ptTrig*ptTrig);
3349       
3350       //if(xE <0.)xE =-xE;
3351       
3352       hbpXE = -100;
3353       hbpZT = -100;
3354       
3355       if(xE > 0 ) hbpXE = TMath::Log(1./xE); 
3356       if(zT > 0 ) hbpZT = TMath::Log(1./zT); 
3357       
3358       if(fPi0Trigger && decayFound)
3359         FillDecayPhotonCorrelationHistograms(pt, phi, decayMom1,decayMom2,kFALSE) ;
3360       
3361       //delta phi cut for correlation
3362       if( (deltaPhi > fDeltaPhiMinCut) && ( deltaPhi < fDeltaPhiMaxCut) ) 
3363       {
3364         fhDeltaPhiNeutralPt->Fill(pt,deltaPhi);
3365         fhXENeutral        ->Fill(ptTrig,xE); 
3366         fhPtHbpXENeutral   ->Fill(ptTrig,hbpXE); 
3367       }
3368       else if ( (deltaPhi > fUeDeltaPhiMinCut) && (deltaPhi < fUeDeltaPhiMaxCut) )      
3369       {
3370         fhDeltaPhiUeNeutralPt->Fill(pt,deltaPhi);
3371         fhXEUeNeutral        ->Fill(ptTrig,xE);
3372         fhPtHbpXEUeNeutral   ->Fill(ptTrig,hbpXE); 
3373       }
3374       
3375       //several UE calculation 
3376       if(fMakeSeveralUE) FillChargedUnderlyingEventSidesHistograms(ptTrig,pt,deltaPhi);
3377
3378           }
3379     else
3380     {
3381       nrefs++;
3382       if(nrefs==1)
3383       {
3384         refpi0 = new TObjArray(0);
3385         refpi0->SetName(GetAODObjArrayName()+"Pi0s");
3386         refpi0->SetOwner(kFALSE);
3387       }
3388       refpi0->Add(pi0);
3389     }//put references in trigger AOD 
3390     
3391     if(GetDebug() > 2 ) 
3392       printf("AliAnaParticleHadronCorrelation::MakeNeutralCorrelation() - Selected neutral for momentum imbalance: pt %2.2f, phi %2.2f, eta %2.2f \n",pt,phi,eta);
3393     
3394   }//loop
3395   
3396   return kTRUE;
3397 }
3398   
3399 //_________________________________________________________________________________________________________
3400 void  AliAnaParticleHadronCorrelation::MakeMCChargedCorrelation(AliAODPWG4ParticleCorrelation *aodParticle)
3401 {  
3402   // Charged Hadron Correlation Analysis with MC information
3403   
3404   if(GetDebug()>1)
3405     printf("AliAnaParticleHadronCorrelation::MakeMCChargedCorrelation() - Make trigger particle - charged hadron correlation in AOD MC level\n");
3406   
3407   AliStack         * stack        = 0x0 ;
3408   TParticle        * primary      = 0x0 ;   
3409   TClonesArray     * mcparticles0 = 0x0 ;
3410   TClonesArray     * mcparticles  = 0x0 ;
3411   AliAODMCParticle * aodprimary   = 0x0 ; 
3412   
3413   Double_t eprim   = 0 ;
3414   Double_t ptprim  = 0 ;
3415   Double_t phiprim = 0 ;
3416   Double_t etaprim = 0 ;
3417   Int_t    nTracks = 0 ;  
3418   Int_t iParticle  = 0 ;
3419   Double_t charge  = 0.;
3420   
3421   if(GetReader()->ReadStack())
3422   {
3423     nTracks = GetMCStack()->GetNtrack() ;
3424   }
3425   else 
3426   {
3427     nTracks = GetReader()->GetAODMCParticles()->GetEntriesFast() ;
3428   }
3429   //Int_t trackIndex[nTracks];
3430   
3431   Int_t label= aodParticle->GetLabel();
3432   if(label < 0)
3433   {
3434     if(GetDebug() > 0) printf("AliAnaParticleHadronCorrelation::MakeMCChargedCorrelation *** bad label ***:  label %d \n", label);
3435     return;
3436   }  
3437   
3438   if(GetReader()->ReadStack())
3439   {
3440     stack =  GetMCStack() ;
3441     if(!stack) 
3442     {
3443       printf(" AliAnaParticleHadronCorrelation::MakeMCChargedCorrelation- Stack not available, is the MC handler called? STOP\n");
3444       abort();
3445     }
3446     
3447     nTracks=stack->GetNprimary();
3448     if(label >=  stack->GetNtrack()) 
3449     {
3450       if(GetDebug() > 2)  printf("AliAnaParticleHadronCorrelation::MakeMCChargedCorrelation *** large label ***:  label %d, n tracks %d \n", label, stack->GetNtrack());
3451       return ;
3452     }
3453     
3454     primary = stack->Particle(label);
3455     if(!primary)
3456     {
3457       printf("AliAnaParticleHadronCorrelation::MakeMCChargedCorrelation *** no primary ***:  label %d \n", label);   
3458       return;
3459     }
3460     
3461     if(primary)
3462     {
3463       eprim    = primary->Energy();
3464       ptprim   = primary->Pt();
3465       phiprim  = primary->Phi();
3466       etaprim  = primary->Eta();
3467       
3468       if(ptprim < 0.01 || eprim < 0.01) return ;
3469       
3470       for (iParticle = 0 ; iParticle <  nTracks ; iParticle++) 
3471       {
3472         TParticle * particle = stack->Particle(iParticle);
3473         TLorentzVector momentum;
3474         
3475         //keep only final state particles
3476         if(particle->GetStatusCode()!=1) continue ;
3477         
3478         Int_t pdg = particle->GetPdgCode();     
3479         
3480         charge = TDatabasePDG::Instance()->GetParticle(pdg)->Charge();
3481         
3482         particle->Momentum(momentum);   
3483         
3484         //---------- Charged particles ----------------------
3485         if(charge != 0)
3486         {   
3487           //Particles in CTS acceptance
3488           Bool_t inCTS =  GetFiducialCut()->IsInFiducialCut(momentum,"CTS");
3489           
3490           if(TMath::Abs(pdg) == 11 && stack->Particle(particle->GetFirstMother())->GetPdgCode()==22) continue ;
3491           
3492           if(inCTS)
3493           {            
3494             if( label!=iParticle) // avoid trigger particle
3495             {
3496               if(!FillChargedMCCorrelationHistograms(particle->Pt(),particle->Phi(),particle->Eta(),ptprim,phiprim,etaprim)) return;
3497             }
3498           }// in CTS acceptance
3499         }// charged
3500       } //track loop
3501     } //when the leading particles could trace back to MC
3502   } //ESD MC
3503   
3504   else if(GetReader()->ReadAODMCParticles())
3505   {
3506     //Get the list of MC particles
3507     mcparticles0 = GetReader()->GetAODMCParticles(0);
3508     if(!mcparticles0) return;
3509     
3510     if(label >=mcparticles0->GetEntriesFast())
3511     {
3512       if(GetDebug() > 2)  
3513         printf("AliAnaParticleHadronCorrelation::MakeMCChargedCorrelation *** large label ***:  label %d, n tracks %d \n", label,mcparticles0->GetEntriesFast());
3514       return;
3515     }
3516     
3517     //Get the particle
3518     aodprimary = (AliAODMCParticle*) mcparticles0->At(label);
3519     if(!aodprimary)  
3520     {
3521       printf("AliAnaParticleHadronCorrelation::MakeMCChargedCorrelation *** no AOD primary ***:  label %d \n", label);   
3522       return;
3523     }
3524     
3525     if(aodprimary)
3526     {
3527       ptprim  = aodprimary->Pt();
3528       phiprim = aodprimary->Phi();
3529       etaprim = aodprimary->Eta();
3530       eprim   = aodprimary->E();
3531       
3532       Bool_t lead = kFALSE;
3533       
3534       if(ptprim < 0.01 || eprim < 0.01) return ;
3535       
3536       mcparticles= GetReader()->GetAODMCParticles();
3537       for (iParticle = 0; iParticle < nTracks; iParticle++) 
3538       {
3539         AliAODMCParticle *part = (AliAODMCParticle*) mcparticles->At(iParticle);
3540         
3541         if (!part->IsPhysicalPrimary()) continue;        
3542    
3543         Int_t pdg = part->GetPdgCode(); 
3544         charge = TDatabasePDG::Instance()->GetParticle(pdg)->Charge();
3545         TLorentzVector momentum(part->Px(),part->Py(),part->Pz(),part->E());   
3546         
3547         if(charge != 0)
3548         {
3549           if(part->Pt()> GetReader()->GetCTSPtMin())
3550           {
3551             //Particles in CTS acceptance
3552             Bool_t inCTS =  GetFiducialCut()->IsInFiducialCut(momentum,"CTS");
3553             Int_t indexmother=part->GetMother();
3554             
3555             if(indexmother>-1)
3556             {
3557               Int_t mPdg = ((AliAODMCParticle*) mcparticles->At(indexmother)) ->GetPdgCode();
3558               if(TMath::Abs(pdg) == 11 && mPdg == 22) continue;
3559             }
3560             
3561             if(inCTS)
3562             {            
3563               if( label!=iParticle) // avoid trigger particle
3564               {
3565                 if(!FillChargedMCCorrelationHistograms(part->Pt(),part->Phi(),part->Eta(),ptprim,phiprim,etaprim)) return;
3566                 else lead = kTRUE;
3567               }
3568             } // in acceptance
3569           } // min pt cut
3570         } //only charged particles
3571       }  //MC particle loop 
3572       if (lead) 
3573       {
3574         fhMCPtLeading->Fill(ptprim);
3575         fhMCPhiLeading->Fill(ptprim,phiprim);
3576         fhMCEtaLeading->Fill(ptprim,etaprim);
3577       }
3578     } //when the leading particles could trace back to MC
3579   }// AOD MC
3580 }
3581
3582 //_____________________________________________________________________
3583 void AliAnaParticleHadronCorrelation::Print(const Option_t * opt) const
3584 {
3585   
3586   //Print some relevant parameters set for the analysis
3587   if(! opt)
3588     return;
3589   
3590   printf("**** Print %s %s ****\n", GetName(), GetTitle() ) ;
3591   AliAnaCaloTrackCorrBaseClass::Print(" ");
3592   printf("Pt trigger           >  %3.2f\n", fMinTriggerPt) ;
3593   printf("Pt associated hadron <  %3.2f\n", fMaxAssocPt) ; 
3594   printf("Pt associated hadron >  %3.2f\n", fMinAssocPt) ;
3595   printf("Phi trigger particle-Hadron   <  %3.2f\n", fDeltaPhiMaxCut) ; 
3596   printf("Phi trigger particle-Hadron   >  %3.2f\n", fDeltaPhiMinCut) ;
3597   printf("Phi trigger particle-UeHadron <  %3.2f\n", fUeDeltaPhiMaxCut) ; 
3598   printf("Phi trigger particle-UeHadron >  %3.2f\n", fUeDeltaPhiMinCut) ;
3599   printf("Isolated Trigger?  %d\n"     , fSelectIsolated) ;
3600   printf("Several UE?  %d\n"           , fMakeSeveralUE) ;
3601   printf("Name of AOD Pi0 Branch %s \n", fPi0AODBranchName.Data());
3602   printf("Do Decay-hadron correlation ?  %d\n", fPi0Trigger) ;
3603   printf("Select absolute leading for cluster triggers ?  %d or Near Side %d\n", 
3604          fMakeAbsoluteLeading, fMakeNearSideLeading) ;
3605   printf("Trigger pt bins  %d\n", fNAssocPtBins) ;
3606   for (Int_t ibin = 0; ibin<fNAssocPtBins; ibin++) {
3607     printf("\t bin %d = [%2.1f,%2.1f]\n", ibin, fAssocPtBinLimit[ibin], fAssocPtBinLimit[ibin+1]) ;
3608   }
3609   
3610
3611
3612 //____________________________________________________________
3613 void AliAnaParticleHadronCorrelation::SetNAssocPtBins(Int_t n)
3614 {
3615   // Set number of bins
3616   
3617   fNAssocPtBins  = n ; 
3618   
3619   
3620   if(n < 20 && n > 0)
3621   {
3622     fNAssocPtBins  = n ; 
3623   }
3624   else 
3625   {
3626     printf("n = larger than 19 or too small, set to 19 \n");
3627     fNAssocPtBins = 19;
3628   }
3629 }
3630
3631 //______________________________________________________________________________
3632 void AliAnaParticleHadronCorrelation::SetAssocPtBinLimit(Int_t ibin, Float_t pt)
3633
3634   // Set the list of limits for the trigger pt bins
3635   
3636   if(ibin <= fNAssocPtBins || ibin >= 0) 
3637   {
3638     fAssocPtBinLimit[ibin] = pt  ;
3639   }
3640   else 
3641   {
3642     printf("AliAnaParticleHadronCorrelation::SetAssocPtBinLimit() - bin  number too large %d > %d or small, nothing done\n", ibin, fNAssocPtBins) ; 
3643   }
3644 }
3645