]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGHF/hfe/AliAnalysisTaskElecHadronCorrel.cxx
Yvonne for the TPC-TOF MB pPb analysis
[u/mrichter/AliRoot.git] / PWGHF / hfe / AliAnalysisTaskElecHadronCorrel.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 ////////////////////////////////////////////////////////////////////////
18 //                                                                    //
19 //  Task for Heavy Flavour Electron-Hadron DeltaPhi Correlation       //
20 //  Non-Photonic Electron identified with Invariant mass              //
21 //  analysis methos in function  SelectPhotonicElectron               //
22 //  DeltaPhi calculated in function  ElectronHadCorrel                // 
23 //                                                                    //
24 //  Author: Deepa Thomas (Utrecht University)                         //
25 //                                                                    //
26 ////////////////////////////////////////////////////////////////////////
27
28 #include "TChain.h"
29 #include "TTree.h"
30 #include "TH2F.h"
31 #include "TMath.h"
32 #include "TCanvas.h"
33 #include "THnSparse.h"
34 #include "TLorentzVector.h"
35 #include "TString.h"
36 #include "TFile.h"
37
38 #include "AliAnalysisTask.h"
39 #include "AliAnalysisManager.h"
40
41 #include "AliESDEvent.h"
42 #include "AliESDHandler.h"
43 #include "AliAODEvent.h"
44 #include "AliAODHandler.h"
45
46 #include "AliAnalysisTaskElecHadronCorrel.h"
47 #include "TGeoGlobalMagField.h"
48 #include "AliLog.h"
49 #include "AliAnalysisTaskSE.h"
50 #include "TRefArray.h"
51 #include "TVector.h"
52
53 #include "AliESDInputHandler.h"
54 #include "AliAODInputHandler.h"
55 #include "AliESDpid.h"
56 #include "AliAODPid.h"
57 #include "AliESDtrackCuts.h"
58 #include "AliPhysicsSelection.h"
59 #include "AliCentralitySelectionTask.h"
60 #include "AliESDCaloCluster.h"
61 #include "AliAODCaloCluster.h"
62 #include "AliESDCaloTrigger.h"
63 #include "AliEMCALRecoUtils.h"
64 #include "AliEMCALGeometry.h"
65 #include "AliGeomManager.h"
66 #include "stdio.h"
67 #include "TGeoManager.h"
68 #include "iostream"
69 #include "fstream"
70
71 #include "AliEventPoolManager.h"
72
73 #include "AliCentrality.h"
74 #include "AliMagF.h"
75
76 #include "AliKFParticle.h"
77 #include "AliKFVertex.h"
78 #include "AliSelectNonHFE.h"
79
80 #include "AliPID.h"
81 #include "AliPIDResponse.h"
82 #include "AliHFEcontainer.h"
83 #include "AliHFEcuts.h"
84 #include "AliHFEpid.h"
85 #include "AliHFEpidBase.h"
86 #include "AliHFEpidQAmanager.h"
87 #include "AliHFEtools.h"
88 #include "AliCFContainer.h"
89 #include "AliCFManager.h"
90 #include "AliVEvent.h"
91 #include "AliStack.h"
92 #include "AliMCEvent.h"
93 #include "TProfile.h"
94 #include "AliESDVZERO.h"
95 #include "AliAODVZERO.h"
96 #include "TVector3.h"
97 #include "TRandom2.h"
98
99   ClassImp(AliAnalysisTaskElecHadronCorrel)
100 ClassImp(AliehDPhiBasicParticle)  
101   //________________________________________________________________________
102   AliAnalysisTaskElecHadronCorrel::AliAnalysisTaskElecHadronCorrel(const char *name) 
103   : AliAnalysisTaskSE(name)
104   ,fVevent(0)  
105   ,fESD(0)
106   ,fAOD(0)
107   ,fGeom(0)
108   ,fpidResponse(0)
109   ,fOutputList(0)
110   ,fTrackCuts1(new AliESDtrackCuts)
111   ,fTrackCuts2(new AliESDtrackCuts)
112   ,fCuts(0)
113   ,fIdentifiedAsOutInz(kFALSE)
114   ,fPassTheEventCut(kFALSE)
115   ,fRejectKinkMother(kFALSE)
116   ,fVz(0.0)
117   ,fCFM(0)      
118   ,fPID(0)
119   ,fPIDqa(0)           
120   ,fInvmassCut(0.01)    
121   ,fCentrality(0)
122   ,fCentralityMin(0)
123   ,fCentralityMax(0)
124   ,fkCentralityMethod(0)  
125   ,fTPCnsigEleMin(-2)                                                          
126   ,fTPCnsigEleMax(2)                                                          
127   ,fTPCnsigHadMin(-10)                                                          
128   ,fTPCnsigHadMax(-3.5)                                                          
129   ,fM02CutMin(0.03)                                                              
130   ,fM02CutMax(0.5)                                                              
131   ,fM20CutMin(0.03)                                                              
132   ,fM20CutMax(0.3)
133   ,fDispCutMin(0)                                                             
134   ,fDispCutMax(1)                                                             
135   ,fEovPMin(0.8)                                                                
136   ,fEovPMax(1.2)
137   ,fTriggerCentral(kTRUE) 
138   ,fTriggerMB(kTRUE) 
139   ,fTPCNClsHad(80)  
140   ,fAssoEleITSref(kTRUE)  
141   ,fAssoElecTPCNCls(80)  
142   ,fNonHFE(0)  
143   ,fPoolMgr(0x0)  
144     ,fNoEvents(0)
145     //  ,fTrkpt(0)
146     ,fTrkEovPAft(0)      
147     //  ,fTrkEovPBefHad(0)       
148     // ,fdEdxBef(0)      
149   ,fSemiIncElecDphi(0)  
150   ,fSemiIncElecDphi1(0)         
151   ,fSemiIncElecDphi2(0)         
152   ,fSemiIncElecDphi3(0)         
153   ,fSemiIncElecDphi4(0)         
154   ,fPhotElecDphi(0)     
155   ,fPhotElecDphi1(0)    
156   ,fPhotElecDphi2(0)    
157   ,fPhotElecDphi3(0)    
158   ,fPhotElecDphi4(0)    
159   ,fInclusiveElecDphi(0)        
160   ,fInclusiveElecDphi1(0)       
161   ,fInclusiveElecDphi2(0)       
162   ,fInclusiveElecDphi3(0)       
163   ,fInclusiveElecDphi4(0)       
164   ,fInclusiveElecDphiEtaFS(0)
165   ,fInclusiveElecDphiEtaFS1(0)
166   ,fInclusiveElecDphiEtaFS2(0)
167   ,fInclusiveElecDphiEtaFS3(0)
168   ,fInclusiveElecDphiEtaFS4(0)
169   ,fDphiULSMassLow(0)   
170   ,fDphiULSMassLow1(0)  
171   ,fDphiULSMassLow2(0)  
172   ,fDphiULSMassLow3(0)  
173   ,fDphiULSMassLow4(0)  
174   ,fDphiLSMassLow(0)
175   ,fDphiLSMassLow1(0)
176   ,fDphiLSMassLow2(0)
177   ,fDphiLSMassLow3(0)
178   ,fDphiLSMassLow4(0)
179   ,fDphiULSMassLowNoPartner(0)   
180   ,fDphiULSMassLowNoPartner1(0)   
181   ,fDphiULSMassLowNoPartner2(0)   
182   ,fDphiULSMassLowNoPartner3(0)   
183   ,fDphiULSMassLowNoPartner4(0)   
184   ,fDphiLSMassLowNoPartner(0)
185   ,fDphiLSMassLowNoPartner1(0)
186   ,fDphiLSMassLowNoPartner2(0)
187   ,fDphiLSMassLowNoPartner3(0)
188   ,fDphiLSMassLowNoPartner4(0)
189   ,fPhotoElecPt(0)
190   ,fSemiInclElecPt(0)
191   ,fInclusiveElecPt(0)
192   ,fULSElecPt(0)
193   ,fLSElecPt(0)  
194   ,fDCAMetPhotElecDphi(0)
195   ,fDCAMetPhotElecDphi1(0)
196   ,fDCAMetPhotElecDphi2(0)
197   ,fDCAMetPhotElecDphi3(0)
198   ,fDCAMetPhotElecDphi4(0)
199   ,fDCAMetDphiULSMassLow(0)
200   ,fDCAMetDphiULSMassLow1(0)
201   ,fDCAMetDphiULSMassLow2(0)
202   ,fDCAMetDphiULSMassLow3(0)
203   ,fDCAMetDphiULSMassLow4(0)
204   ,fDCAMetDphiLSMassLow(0)
205   ,fDCAMetDphiLSMassLow1(0)
206   ,fDCAMetDphiLSMassLow2(0)
207   ,fDCAMetDphiLSMassLow3(0)
208   ,fDCAMetDphiLSMassLow4(0)
209   ,fDCAMetDphiULSMassLowNoPartner(0)
210   ,fDCAMetDphiULSMassLowNoPartner1(0)
211   ,fDCAMetDphiULSMassLowNoPartner2(0)
212   ,fDCAMetDphiULSMassLowNoPartner3(0)
213   ,fDCAMetDphiULSMassLowNoPartner4(0)
214   ,fDCAMetDphiLSMassLowNoPartner(0)
215   ,fDCAMetDphiLSMassLowNoPartner1(0)
216   ,fDCAMetDphiLSMassLowNoPartner2(0)
217   ,fDCAMetDphiLSMassLowNoPartner3(0)
218   ,fDCAMetDphiLSMassLowNoPartner4(0)
219   ,fDCAMetPhotoElecPt(0)
220   ,fDCAMetULSElecPt(0)
221   ,fDCAMetLSElecPt(0)
222   ,fSemiIncElecDphiEta1(0)
223   ,fSemiIncElecDphiEta11(0)
224   ,fSemiIncElecDphiEta12(0)
225   ,fSemiIncElecDphiEta13(0)
226   ,fSemiIncElecDphiEta14(0)
227   ,fPhotElecDphiEta1(0)
228   ,fPhotElecDphiEta11(0)
229   ,fPhotElecDphiEta12(0)
230   ,fPhotElecDphiEta13(0)
231   ,fPhotElecDphiEta14(0)
232   ,fInclusiveElecDphiEta1(0)
233   ,fInclusiveElecDphiEta11(0)
234   ,fInclusiveElecDphiEta12(0)
235   ,fInclusiveElecDphiEta13(0)
236   ,fInclusiveElecDphiEta14(0)
237   ,fDphiULSMassLowEta1(0)
238   ,fDphiULSMassLowEta11(0)
239   ,fDphiULSMassLowEta12(0)
240   ,fDphiULSMassLowEta13(0)
241   ,fDphiULSMassLowEta14(0)
242   ,fDphiLSMassLowEta1(0)
243   ,fDphiLSMassLowEta11(0)
244   ,fDphiLSMassLowEta12(0)
245   ,fDphiLSMassLowEta13(0)
246   ,fDphiLSMassLowEta14(0)
247   ,fDphiULSMassLowNoPartnerEta1(0)
248   ,fDphiULSMassLowNoPartnerEta11(0)
249   ,fDphiULSMassLowNoPartnerEta12(0)
250   ,fDphiULSMassLowNoPartnerEta13(0)
251   ,fDphiULSMassLowNoPartnerEta14(0)
252   ,fDphiLSMassLowNoPartnerEta1(0)
253   ,fDphiLSMassLowNoPartnerEta11(0)
254   ,fDphiLSMassLowNoPartnerEta12(0)
255   ,fDphiLSMassLowNoPartnerEta13(0)
256   ,fDphiLSMassLowNoPartnerEta14(0)
257   ,fSemiIncElecDphiEta2(0)
258   ,fSemiIncElecDphiEta21(0)
259   ,fSemiIncElecDphiEta22(0)
260   ,fSemiIncElecDphiEta23(0)
261   ,fSemiIncElecDphiEta24(0)
262   ,fPhotElecDphiEta2(0)
263   ,fPhotElecDphiEta21(0)
264   ,fPhotElecDphiEta22(0)
265   ,fPhotElecDphiEta23(0)
266   ,fPhotElecDphiEta24(0)
267   ,fInclusiveElecDphiEta2(0)
268   ,fInclusiveElecDphiEta21(0)
269   ,fInclusiveElecDphiEta22(0)
270   ,fInclusiveElecDphiEta23(0)
271   ,fInclusiveElecDphiEta24(0)
272   ,fDphiULSMassLowEta2(0)
273   ,fDphiULSMassLowEta21(0)
274   ,fDphiULSMassLowEta22(0)
275   ,fDphiULSMassLowEta23(0)
276   ,fDphiULSMassLowEta24(0)
277   ,fDphiLSMassLowEta2(0)
278   ,fDphiLSMassLowEta21(0)
279   ,fDphiLSMassLowEta22(0)
280   ,fDphiLSMassLowEta23(0)
281   ,fDphiLSMassLowEta24(0)
282   ,fDphiULSMassLowNoPartnerEta2(0)
283   ,fDphiULSMassLowNoPartnerEta21(0)
284   ,fDphiULSMassLowNoPartnerEta22(0)
285   ,fDphiULSMassLowNoPartnerEta23(0)
286   ,fDphiULSMassLowNoPartnerEta24(0)
287   ,fDphiLSMassLowNoPartnerEta2(0)
288   ,fDphiLSMassLowNoPartnerEta21(0)
289   ,fDphiLSMassLowNoPartnerEta22(0)
290   ,fDphiLSMassLowNoPartnerEta23(0)
291     ,fDphiLSMassLowNoPartnerEta24(0)
292     // ,fTrackPtBefTrkCuts(0)    
293     // ,fTrackPtAftTrkCuts(0)
294     ,fTPCnsigma(0)
295     // ,fNCellv1(0)
296     // ,fClsEv1(0)
297     // ,fNClusv1(0)
298     ,fInvmassLS1(0)       
299     // ,fInvmassLS2(0)       
300     // ,fInvmassLS3(0)       
301     // ,fInvmassLS4(0)       
302     // ,fInvmassLS5(0)       
303     ,fInvmassULS1(0)
304     ,fDCAMetInvmassLS1(0)
305     ,fDCAMetInvmassULS1(0)
306     // ,fInvmassULS2(0)
307     // ,fInvmassULS3(0)
308     // ,fInvmassULS4(0)
309     // ,fInvmassULS5(0)
310   ,fcentrality(0)     
311   ,fElecPhi(0)  
312   ,fElecPhiTPChalf(0)
313     ,fElecPhiPt(0)  
314     //  ,fElecPhiTPC(0)  
315     //  ,fElecPhiTPCEovP(0)  
316   ,fHadronPhi(0)  
317   ,fHadronPhiTPChalf(0)  
318     ,fHadronPhiPt(0)  
319     /*  ,fTrackHFEcuts(0)
320         ,fTrakPhiSPD1(0)
321         ,fTrakPhiSPD2(0)
322         ,fTrakPhiSPDOr(0)
323         ,fTrakPhiSPDAnd(0)
324         ,fTrackHFEcutsITS(0)  
325      */
326   ,fNoMixedEvents(0)
327   ,fMixStat(0)       
328   ,fMixStat1(0)        
329   ,fMixedIncElecDphi(0)  
330   ,fMixedIncElecDphi1(0)  
331   ,fMixedIncElecDphi2(0)  
332   ,fMixedIncElecDphi3(0)  
333   ,fMixedIncElecDphi4(0)  
334   ,fMixedPhotElecDphi(0)
335   ,fMixedPhotElecDphi1(0)
336   ,fMixedPhotElecDphi2(0)
337   ,fMixedPhotElecDphi3(0)
338   ,fMixedPhotElecDphi4(0)
339   ,fMixedSemiIncElecDphi(0)  
340   ,fMixedSemiIncElecDphi1(0)  
341   ,fMixedSemiIncElecDphi2(0)  
342   ,fMixedSemiIncElecDphi3(0)  
343   ,fMixedSemiIncElecDphi4(0)  
344   ,fMixedDphiULSMassLow(0)  
345   ,fMixedDphiULSMassLow1(0)  
346   ,fMixedDphiULSMassLow2(0)  
347   ,fMixedDphiULSMassLow3(0)  
348   ,fMixedDphiULSMassLow4(0)  
349   ,fMixedDphiLSMassLow(0)  
350   ,fMixedDphiLSMassLow1(0)  
351   ,fMixedDphiLSMassLow2(0)  
352   ,fMixedDphiLSMassLow3(0)  
353   ,fMixedDphiLSMassLow4(0)  
354   ,fDCAMetMixedPhotElecDphi(0)
355   ,fDCAMetMixedPhotElecDphi1(0)
356   ,fDCAMetMixedPhotElecDphi2(0)
357   ,fDCAMetMixedPhotElecDphi3(0)
358   ,fDCAMetMixedPhotElecDphi4(0)
359   ,fDCAMetMixedDphiULSMassLow(0)
360   ,fDCAMetMixedDphiULSMassLow1(0)
361   ,fDCAMetMixedDphiULSMassLow2(0)
362   ,fDCAMetMixedDphiULSMassLow3(0)
363   ,fDCAMetMixedDphiULSMassLow4(0)
364   ,fDCAMetMixedDphiLSMassLow(0)
365   ,fDCAMetMixedDphiLSMassLow1(0)
366   ,fDCAMetMixedDphiLSMassLow2(0)
367   ,fDCAMetMixedDphiLSMassLow3(0)
368   ,fDCAMetMixedDphiLSMassLow4(0)
369   ,fHadronPt(0)  
370   ,fCentralityPass(0)
371   ,fCentralityNoPass(0)
372   ,fHadronDphi(0)
373   ,fHadronDphi1(0)
374   ,fHadronDphi2(0)
375   ,fHadronDphi3(0)
376   ,fHadronDphi4(0)
377   ,fPiPt(0)  
378   ,fHadronDphiNoSS(0)
379   ,fHadronDphiNoSS1(0)
380   ,fHadronDphiNoSS2(0)
381   ,fHadronDphiNoSS3(0)
382   ,fHadronDphiNoSS4(0)
383   ,fPiPtNoSS(0)
384   ,fEovPWoSS(0)  
385   ,fEovPWSS(0)  
386   ,fEovPHadWoSS(0)  
387   ,fEovPHadWSS(0)  
388   ,fHadronDphiEta1(0)   
389   ,fHadronDphiEta11(0)  
390   ,fHadronDphiEta12(0)  
391   ,fHadronDphiEta13(0)  
392   ,fHadronDphiEta14(0)  
393   ,fHadronDphiNoSSEta1(0)   
394   ,fHadronDphiNoSSEta11(0)  
395   ,fHadronDphiNoSSEta12(0)  
396   ,fHadronDphiNoSSEta13(0)  
397   ,fHadronDphiNoSSEta14(0)  
398   ,fHadronDphiEta2(0)  
399   ,fHadronDphiEta21(0) 
400   ,fHadronDphiEta22(0) 
401   ,fHadronDphiEta23(0) 
402   ,fHadronDphiEta24(0) 
403   ,fHadronDphiNoSSEta2(0)   
404   ,fHadronDphiNoSSEta21(0)  
405   ,fHadronDphiNoSSEta22(0)  
406   ,fHadronDphiNoSSEta23(0)  
407     ,fHadronDphiNoSSEta24(0)
408     //,fSparseElectron(0)  
409     //  ,fvalueElectron(0)   
410 {
411   //Named constructor
412
413   fPID = new AliHFEpid("hfePid");
414   //fvalueElectron = new Double_t[6];
415
416   // Define input and output slots here
417   // Input slot #0 works with a TChain
418   DefineInput(0, TChain::Class());
419   // Output slot #0 id reserved by the base class for AOD
420   // Output slot #1 writes into a TH1 container
421   // DefineOutput(1, TH1I::Class());
422   DefineOutput(1, TList::Class());
423   //  DefineOutput(3, TTree::Class());
424 }
425
426 //________________________________________________________________________
427 AliAnalysisTaskElecHadronCorrel::AliAnalysisTaskElecHadronCorrel() 
428   : AliAnalysisTaskSE("DefaultAnalysis_AliAnalysisElecHadCorrel")
429   ,fVevent(0)  
430   ,fESD(0)
431   ,fAOD(0)
432   ,fGeom(0)  
433   ,fpidResponse(0)  
434   ,fOutputList(0)
435   ,fTrackCuts1(new AliESDtrackCuts)
436   ,fTrackCuts2(new AliESDtrackCuts)
437   ,fCuts(0)
438   ,fIdentifiedAsOutInz(kFALSE)
439   ,fPassTheEventCut(kFALSE)
440   ,fRejectKinkMother(kFALSE)
441   ,fVz(0.0)
442   ,fCFM(0)      
443   ,fPID(0)       
444   ,fPIDqa(0)           
445   ,fInvmassCut(0.01)    
446   ,fCentrality(0)
447   ,fCentralityMin(0)
448   ,fCentralityMax(0)
449   ,fkCentralityMethod(0)  
450   ,fTPCnsigEleMin(-2)                                                                     
451   ,fTPCnsigEleMax(2)                                                                      
452   ,fTPCnsigHadMin(-10)                                                          
453   ,fTPCnsigHadMax(-3.5)                                                                   
454   ,fM02CutMin(0.03)                                                                       
455   ,fM02CutMax(0.5)                                                                        
456   ,fM20CutMin(0.03)                                                                       
457   ,fM20CutMax(0.3)
458   ,fDispCutMin(0)                                                                         
459   ,fDispCutMax(1)                                                                         
460   ,fEovPMin(0.8)                                                                          
461   ,fEovPMax(1.2)
462   ,fTriggerCentral(kTRUE) 
463   ,fTriggerMB(kTRUE) 
464   ,fTPCNClsHad(80)  
465   ,fAssoEleITSref(kTRUE)  
466   ,fAssoElecTPCNCls(80)  
467   ,fNonHFE(0)  
468   ,fPoolMgr(0x0)    
469     ,fNoEvents(0)
470     //  ,fTrkpt(0)
471     ,fTrkEovPAft(0)      
472     //  ,fTrkEovPBefHad(0)       
473     //  ,fdEdxBef(0)     
474   ,fSemiIncElecDphi(0)  
475   ,fSemiIncElecDphi1(0)         
476   ,fSemiIncElecDphi2(0)         
477   ,fSemiIncElecDphi3(0)         
478   ,fSemiIncElecDphi4(0)         
479   ,fPhotElecDphi(0)     
480   ,fPhotElecDphi1(0)    
481   ,fPhotElecDphi2(0)    
482   ,fPhotElecDphi3(0)    
483   ,fPhotElecDphi4(0)    
484   ,fInclusiveElecDphi(0)        
485   ,fInclusiveElecDphi1(0)       
486   ,fInclusiveElecDphi2(0)       
487   ,fInclusiveElecDphi3(0)       
488   ,fInclusiveElecDphi4(0)       
489   ,fInclusiveElecDphiEtaFS(0)
490   ,fInclusiveElecDphiEtaFS1(0)
491   ,fInclusiveElecDphiEtaFS2(0)
492   ,fInclusiveElecDphiEtaFS3(0)
493   ,fInclusiveElecDphiEtaFS4(0)
494   ,fDphiULSMassLow(0)   
495   ,fDphiULSMassLow1(0)  
496   ,fDphiULSMassLow2(0)  
497   ,fDphiULSMassLow3(0)  
498   ,fDphiULSMassLow4(0)  
499   ,fDphiLSMassLow(0)
500   ,fDphiLSMassLow1(0)
501   ,fDphiLSMassLow2(0)
502   ,fDphiLSMassLow3(0)
503   ,fDphiLSMassLow4(0)
504   ,fDphiULSMassLowNoPartner(0)   
505   ,fDphiULSMassLowNoPartner1(0)   
506   ,fDphiULSMassLowNoPartner2(0)   
507   ,fDphiULSMassLowNoPartner3(0)   
508   ,fDphiULSMassLowNoPartner4(0)   
509   ,fDphiLSMassLowNoPartner(0)
510   ,fDphiLSMassLowNoPartner1(0)
511   ,fDphiLSMassLowNoPartner2(0)
512   ,fDphiLSMassLowNoPartner3(0)
513   ,fDphiLSMassLowNoPartner4(0)
514   ,fPhotoElecPt(0)
515   ,fSemiInclElecPt(0)
516   ,fInclusiveElecPt(0)
517   ,fULSElecPt(0)
518   ,fLSElecPt(0)  
519   ,fDCAMetPhotElecDphi(0)
520   ,fDCAMetPhotElecDphi1(0)
521   ,fDCAMetPhotElecDphi2(0)
522   ,fDCAMetPhotElecDphi3(0)
523   ,fDCAMetPhotElecDphi4(0)
524   ,fDCAMetDphiULSMassLow(0)
525   ,fDCAMetDphiULSMassLow1(0)
526   ,fDCAMetDphiULSMassLow2(0)
527   ,fDCAMetDphiULSMassLow3(0)
528   ,fDCAMetDphiULSMassLow4(0)
529   ,fDCAMetDphiLSMassLow(0)
530   ,fDCAMetDphiLSMassLow1(0)
531   ,fDCAMetDphiLSMassLow2(0)
532   ,fDCAMetDphiLSMassLow3(0)
533   ,fDCAMetDphiLSMassLow4(0)
534   ,fDCAMetDphiULSMassLowNoPartner(0)
535   ,fDCAMetDphiULSMassLowNoPartner1(0)
536   ,fDCAMetDphiULSMassLowNoPartner2(0)
537   ,fDCAMetDphiULSMassLowNoPartner3(0)
538   ,fDCAMetDphiULSMassLowNoPartner4(0)
539   ,fDCAMetDphiLSMassLowNoPartner(0)
540   ,fDCAMetDphiLSMassLowNoPartner1(0)
541   ,fDCAMetDphiLSMassLowNoPartner2(0)
542   ,fDCAMetDphiLSMassLowNoPartner3(0)
543   ,fDCAMetDphiLSMassLowNoPartner4(0)
544   ,fDCAMetPhotoElecPt(0)
545   ,fDCAMetULSElecPt(0)
546   ,fDCAMetLSElecPt(0)
547   ,fSemiIncElecDphiEta1(0)
548   ,fSemiIncElecDphiEta11(0)
549   ,fSemiIncElecDphiEta12(0)
550   ,fSemiIncElecDphiEta13(0)
551   ,fSemiIncElecDphiEta14(0)
552   ,fPhotElecDphiEta1(0)
553   ,fPhotElecDphiEta11(0)
554   ,fPhotElecDphiEta12(0)
555   ,fPhotElecDphiEta13(0)
556   ,fPhotElecDphiEta14(0)
557   ,fInclusiveElecDphiEta1(0)
558   ,fInclusiveElecDphiEta11(0)
559   ,fInclusiveElecDphiEta12(0)
560   ,fInclusiveElecDphiEta13(0)
561   ,fInclusiveElecDphiEta14(0)
562   ,fDphiULSMassLowEta1(0)
563   ,fDphiULSMassLowEta11(0)
564   ,fDphiULSMassLowEta12(0)
565   ,fDphiULSMassLowEta13(0)
566   ,fDphiULSMassLowEta14(0)
567   ,fDphiLSMassLowEta1(0)
568   ,fDphiLSMassLowEta11(0)
569   ,fDphiLSMassLowEta12(0)
570   ,fDphiLSMassLowEta13(0)
571   ,fDphiLSMassLowEta14(0)
572   ,fDphiULSMassLowNoPartnerEta1(0)
573   ,fDphiULSMassLowNoPartnerEta11(0)
574   ,fDphiULSMassLowNoPartnerEta12(0)
575   ,fDphiULSMassLowNoPartnerEta13(0)
576   ,fDphiULSMassLowNoPartnerEta14(0)
577   ,fDphiLSMassLowNoPartnerEta1(0)
578   ,fDphiLSMassLowNoPartnerEta11(0)
579   ,fDphiLSMassLowNoPartnerEta12(0)
580   ,fDphiLSMassLowNoPartnerEta13(0)
581   ,fDphiLSMassLowNoPartnerEta14(0)
582   ,fSemiIncElecDphiEta2(0)
583   ,fSemiIncElecDphiEta21(0)
584   ,fSemiIncElecDphiEta22(0)
585   ,fSemiIncElecDphiEta23(0)
586   ,fSemiIncElecDphiEta24(0)
587   ,fPhotElecDphiEta2(0)
588   ,fPhotElecDphiEta21(0)
589   ,fPhotElecDphiEta22(0)
590   ,fPhotElecDphiEta23(0)
591   ,fPhotElecDphiEta24(0)
592   ,fInclusiveElecDphiEta2(0)
593   ,fInclusiveElecDphiEta21(0)
594   ,fInclusiveElecDphiEta22(0)
595   ,fInclusiveElecDphiEta23(0)
596   ,fInclusiveElecDphiEta24(0)
597   ,fDphiULSMassLowEta2(0)
598   ,fDphiULSMassLowEta21(0)
599   ,fDphiULSMassLowEta22(0)
600   ,fDphiULSMassLowEta23(0)
601   ,fDphiULSMassLowEta24(0)
602   ,fDphiLSMassLowEta2(0)
603   ,fDphiLSMassLowEta21(0)
604   ,fDphiLSMassLowEta22(0)
605   ,fDphiLSMassLowEta23(0)
606   ,fDphiLSMassLowEta24(0)
607   ,fDphiULSMassLowNoPartnerEta2(0)
608   ,fDphiULSMassLowNoPartnerEta21(0)
609   ,fDphiULSMassLowNoPartnerEta22(0)
610   ,fDphiULSMassLowNoPartnerEta23(0)
611   ,fDphiULSMassLowNoPartnerEta24(0)
612   ,fDphiLSMassLowNoPartnerEta2(0)
613   ,fDphiLSMassLowNoPartnerEta21(0)
614   ,fDphiLSMassLowNoPartnerEta22(0)
615   ,fDphiLSMassLowNoPartnerEta23(0)
616     ,fDphiLSMassLowNoPartnerEta24(0)
617     //  ,fTrackPtBefTrkCuts(0)   
618     //  ,fTrackPtAftTrkCuts(0)            
619     ,fTPCnsigma(0)      
620     //  ,fNCellv1(0)  
621     //  ,fClsEv1(0)
622     //  ,fNClusv1(0)
623     ,fInvmassLS1(0)   
624     //  ,fInvmassLS2(0)   
625     //  ,fInvmassLS3(0)   
626     //  ,fInvmassLS4(0)   
627     //  ,fInvmassLS5(0)   
628     ,fInvmassULS1(0)  
629     //  ,fInvmassULS2(0)  
630     //  ,fInvmassULS3(0)  
631     //  ,fInvmassULS4(0)  
632     //  ,fInvmassULS5(0)  
633   ,fDCAMetInvmassLS1(0)
634   ,fDCAMetInvmassULS1(0)
635   ,fcentrality(0)     
636   ,fElecPhi(0)
637   ,fElecPhiTPChalf(0)  
638     ,fElecPhiPt(0)
639     //  ,fElecPhiTPC(0)
640     //  ,fElecPhiTPCEovP(0)  
641   ,fHadronPhi(0)
642   ,fHadronPhiTPChalf(0)
643     ,fHadronPhiPt(0)
644     /*  ,fTrackHFEcuts(0)
645         ,fTrakPhiSPD1(0)
646         ,fTrakPhiSPD2(0)
647         ,fTrakPhiSPDOr(0)
648         ,fTrakPhiSPDAnd(0)
649         ,fTrackHFEcutsITS(0)  
650      */
651   ,fNoMixedEvents(0)
652   ,fMixStat(0)      
653   ,fMixStat1(0)     
654   ,fMixedIncElecDphi(0)  
655   ,fMixedIncElecDphi1(0)  
656   ,fMixedIncElecDphi2(0)  
657   ,fMixedIncElecDphi3(0)  
658   ,fMixedIncElecDphi4(0)  
659   ,fMixedPhotElecDphi(0)
660   ,fMixedPhotElecDphi1(0)
661   ,fMixedPhotElecDphi2(0)
662   ,fMixedPhotElecDphi3(0)
663   ,fMixedPhotElecDphi4(0)
664   ,fMixedSemiIncElecDphi(0)
665   ,fMixedSemiIncElecDphi1(0)
666   ,fMixedSemiIncElecDphi2(0)
667   ,fMixedSemiIncElecDphi3(0)
668   ,fMixedSemiIncElecDphi4(0)
669   ,fMixedDphiULSMassLow(0) 
670   ,fMixedDphiULSMassLow1(0) 
671   ,fMixedDphiULSMassLow2(0) 
672   ,fMixedDphiULSMassLow3(0) 
673   ,fMixedDphiULSMassLow4(0) 
674   ,fMixedDphiLSMassLow(0)      
675   ,fMixedDphiLSMassLow1(0)      
676   ,fMixedDphiLSMassLow2(0)      
677   ,fMixedDphiLSMassLow3(0)      
678   ,fMixedDphiLSMassLow4(0)      
679   ,fDCAMetMixedPhotElecDphi(0)
680   ,fDCAMetMixedPhotElecDphi1(0)
681   ,fDCAMetMixedPhotElecDphi2(0)
682   ,fDCAMetMixedPhotElecDphi3(0)
683   ,fDCAMetMixedPhotElecDphi4(0)
684   ,fDCAMetMixedDphiULSMassLow(0)
685   ,fDCAMetMixedDphiULSMassLow1(0)
686   ,fDCAMetMixedDphiULSMassLow2(0)
687   ,fDCAMetMixedDphiULSMassLow3(0)
688   ,fDCAMetMixedDphiULSMassLow4(0)
689   ,fDCAMetMixedDphiLSMassLow(0)
690   ,fDCAMetMixedDphiLSMassLow1(0)
691   ,fDCAMetMixedDphiLSMassLow2(0)
692   ,fDCAMetMixedDphiLSMassLow3(0)
693   ,fDCAMetMixedDphiLSMassLow4(0)
694   ,fHadronPt(0)  
695   ,fCentralityPass(0)
696   ,fCentralityNoPass(0)
697   ,fHadronDphi(0)
698   ,fHadronDphi1(0)
699   ,fHadronDphi2(0)
700   ,fHadronDphi3(0)
701   ,fHadronDphi4(0)
702   ,fPiPt(0)
703   ,fHadronDphiNoSS(0)
704   ,fHadronDphiNoSS1(0)
705   ,fHadronDphiNoSS2(0)
706   ,fHadronDphiNoSS3(0)
707   ,fHadronDphiNoSS4(0)
708   ,fPiPtNoSS(0)
709   ,fEovPWoSS(0)
710   ,fEovPWSS(0) 
711   ,fEovPHadWoSS(0)
712   ,fEovPHadWSS(0) 
713   ,fHadronDphiEta1(0)   
714   ,fHadronDphiEta11(0)  
715   ,fHadronDphiEta12(0)  
716   ,fHadronDphiEta13(0)  
717   ,fHadronDphiEta14(0)  
718   ,fHadronDphiNoSSEta1(0)   
719   ,fHadronDphiNoSSEta11(0)  
720   ,fHadronDphiNoSSEta12(0)  
721   ,fHadronDphiNoSSEta13(0)  
722   ,fHadronDphiNoSSEta14(0)  
723   ,fHadronDphiEta2(0)  
724   ,fHadronDphiEta21(0) 
725   ,fHadronDphiEta22(0) 
726   ,fHadronDphiEta23(0) 
727   ,fHadronDphiEta24(0) 
728   ,fHadronDphiNoSSEta2(0)   
729   ,fHadronDphiNoSSEta21(0)  
730   ,fHadronDphiNoSSEta22(0)  
731   ,fHadronDphiNoSSEta23(0)  
732     ,fHadronDphiNoSSEta24(0)
733     //,fSparseElectron(0)  
734     //  ,fvalueElectron(0)  
735 {
736   //Default constructor
737   fPID = new AliHFEpid("hfePid");
738   //fvalueElectron = new Double_t[6];
739
740   // Constructor
741   // Define input and output slots here
742   // Input slot #0 works with a TChain
743   DefineInput(0, TChain::Class());
744   // Output slot #0 id reserved by the base class for AOD
745   // Output slot #1 writes into a TH1 container
746   // DefineOutput(1, TH1I::Class());
747   DefineOutput(1, TList::Class());
748   //DefineOutput(3, TTree::Class());
749 }
750 //_________________________________________
751
752 AliAnalysisTaskElecHadronCorrel::~AliAnalysisTaskElecHadronCorrel()
753 {
754   //Destructor 
755
756   delete fOutputList;
757   delete fGeom;
758   delete fPID;
759   delete fCFM;
760   delete fPIDqa;
761   delete fTrackCuts1;
762   delete fTrackCuts2;
763   //  delete fSparseElectron;
764   //  delete []fvalueElectron;
765 }
766 //_________________________________________
767
768 void AliAnalysisTaskElecHadronCorrel::UserExec(Option_t*)
769 {
770   //Main loop
771   //Called for each event
772
773   // create pointer to event
774   fAOD = dynamic_cast<AliAODEvent*>(InputEvent());
775   fESD = dynamic_cast<AliESDEvent*>(InputEvent());
776
777   if(!(fESD || fAOD)){
778     printf("ERROR: fESD & fAOD not available\n");
779     return;
780   }
781   fVevent = dynamic_cast<AliVEvent*>(InputEvent());
782   if (!fVevent) {
783     printf("ERROR: fVEvent not available\n");
784     return;
785   }
786
787   if(!fCuts){
788     AliError("HFE cuts not available");
789     return;
790   }
791
792   if(!fPID->IsInitialized()){ 
793     // Initialize PID with the given run number
794     AliWarning("PID not initialised, get from Run no");
795
796     if(IsAODanalysis())fPID->InitializePID(fAOD->GetRunNumber());
797     else fPID->InitializePID(fESD->GetRunNumber());
798   }
799
800
801   if(fTriggerMB && fTriggerCentral){
802     // trigger selection
803     if(!(((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected() & (AliVEvent::kCentral))) return;
804   }
805
806   if(fTriggerMB && !fTriggerCentral){
807     // trigger selection
808     if(!(((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected() & (AliVEvent::kSemiCentral))) return;
809   }
810
811   if(!fTriggerMB){
812     // trigger selection
813     if(!(((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected() & (AliVEvent::kEMCEGA))) return;
814   }
815   // centrality selection 
816   //  SetCentralityParameters(0., 7., fkCentralityMethod);
817   Bool_t pass = kFALSE; 
818   CheckCentrality(fVevent,pass);
819   if(!pass)return;
820
821   Int_t fNOtrks =  fVevent->GetNumberOfTracks();
822   const AliVVertex *pVtx = fVevent->GetPrimaryVertex();
823
824   Double_t pVtxZ = -999;
825   pVtxZ = pVtx->GetZ();
826
827   if(TMath::Abs(pVtxZ)>10) return;
828   fNoEvents->Fill(0);
829
830   if(fNOtrks<2) return;
831
832   fpidResponse = fInputHandler->GetPIDResponse();
833   if(!fpidResponse){
834     AliDebug(1, "Using default PID Response");
835     fpidResponse = AliHFEtools::GetDefaultPID(kFALSE, fInputEvent->IsA() == AliAODEvent::Class()); 
836   }
837
838   fPID->SetPIDResponse(fpidResponse);
839
840   fCFM->SetRecEventInfo(fVevent);
841
842   AliCentrality *fCentrality2 = (AliCentrality*)fAOD->GetCentrality();
843   Double_t centvalue1 = fCentrality2->GetCentralityPercentile(fkCentralityMethod);
844
845   //Event mixing
846   AliEventPool* pool;
847   pool = fPoolMgr->GetEventPool(centvalue1, pVtxZ); // Get the buffer associated with the current centrality and z-vtx
848   if (!pool)
849   {
850     AliFatal(Form("No pool found for centrality = %f, zVtx = %f", centvalue1, pVtxZ));     
851     return;
852   }
853   // Look for kink mother for AOD
854   Int_t numberofvertices = fAOD->GetNumberOfVertices();
855   Double_t listofmotherkink[numberofvertices];
856   Int_t numberofmotherkink = 0;
857   if(IsAODanalysis()){
858     for(Int_t ivertex=0; ivertex < numberofvertices; ivertex++) {
859       AliAODVertex *aodvertex = fAOD->GetVertex(ivertex);
860       if(!aodvertex) continue;
861       if(aodvertex->GetType()==AliAODVertex::kKink) {
862         AliAODTrack *mother = (AliAODTrack *) aodvertex->GetParent();
863         if(!mother) continue;
864         Int_t idmother = mother->GetID();
865         listofmotherkink[numberofmotherkink] = idmother;
866         numberofmotherkink++;
867       }
868     }
869   }
870
871   // Track loop 
872   for (Int_t iTracks = 0; iTracks < fVevent->GetNumberOfTracks(); iTracks++) {
873     AliVParticle* Vtrack = fVevent->GetTrack(iTracks);
874     if (!Vtrack) {
875       printf("ERROR: Could not receive track %d\n", iTracks);
876       continue;
877     }
878     AliVTrack *track = dynamic_cast<AliVTrack*>(Vtrack);
879     AliESDtrack *etrack = dynamic_cast<AliESDtrack*>(Vtrack);
880     AliAODTrack *atrack = dynamic_cast<AliAODTrack*>(Vtrack);
881
882     if(!track && !etrack && !atrack) continue;
883
884     if(IsAODanalysis())
885       if(atrack){
886         if(!atrack->TestFilterMask(AliAODTrack::kTrkGlobalNoDCA)) continue;
887       }
888     if(track->Pt()<1) continue;
889
890     // fTrackPtBefTrkCuts->Fill(track->Pt());           
891
892     // RecKine: ITSTPC cuts  
893     if(!ProcessCutStep(AliHFEcuts::kStepRecKineITSTPC, track)) continue;
894
895     // Reject kink mother
896     if(fRejectKinkMother) { // Quick and dirty fix to reject both kink mothers and daughters
897       if(IsAODanalysis()){
898         Bool_t kinkmotherpass = kTRUE;
899         for(Int_t kinkmother = 0; kinkmother < numberofmotherkink; kinkmother++) {
900           if(track->GetID() == listofmotherkink[kinkmother]) {
901             kinkmotherpass = kFALSE;
902             continue;
903           }
904         }
905         if(!kinkmotherpass) continue;
906       }
907       else{
908         if(etrack->GetKinkIndex(0) != 0) continue;
909       }
910     }
911     // RecPrim
912     //     if(!ProcessCutStep(AliHFEcuts::kStepRecPrim, track)) continue; //gives warning for AOD, so not using
913
914     // HFE cuts: TPC PID cleanup
915     if(!ProcessCutStep(AliHFEcuts::kStepHFEcutsTPC, track)) continue;
916
917     // fTrackHFEcuts->Fill(track->Phi());
918
919     // HFEcuts: ITS layers cuts
920     if(!ProcessCutStep(AliHFEcuts::kStepHFEcutsITS, track)) continue;
921
922     //     fTrackHFEcutsITS->Fill(track->Phi());
923     //fTrackPtAftTrkCuts->Fill(track->Pt());            
924
925     Double_t fClsE = -999, p = -999, fEovP=-999, pt = -999, dEdx=-999, fTPCnSigma=0;
926     pt = track->Pt();
927     p = track->P();
928     dEdx = track->GetTPCsignal();
929     fTPCnSigma = fPID->GetPIDResponse() ? fPID->GetPIDResponse()->NumberOfSigmasTPC(track, AliPID::kElectron) : 1000;
930
931     if(pt<2) continue;
932     //TPC electron phi
933     // if(fTPCnSigma >= -2 && fTPCnSigma <= 2){
934     //       fElecPhiTPC->Fill(track->Phi());
935     // }
936
937     //eta cut (-0.7,0.7)
938     if(track->Eta() < -0.7 || track->Eta() > 0.7) continue;
939
940     // Track extrapolation to EMCAL
941     Int_t fClsId = track->GetEMCALcluster();
942     if(fClsId <0) continue;
943     AliVCluster *cluster = fVevent->GetCaloCluster(fClsId);
944     if(!cluster->IsEMCAL()) continue;
945     if(TMath::Abs(cluster->GetTrackDx())>0.05 || TMath::Abs(cluster->GetTrackDz())>0.05) continue;    
946     //     fdEdxBef->Fill(p,dEdx);
947     fTPCnsigma->Fill(p,fTPCnSigma);
948
949     //     fTrkpt->Fill(pt);
950     fClsE = cluster->E();
951     fEovP = fClsE/p;
952
953     //--------THnsparse---------
954     //fvalueElectron[0] = pt;
955     //fvalueElectron[1] = fTPCnSigma;
956     //fvalueElectron[2] = fEovP;
957     //fvalueElectron[3] = cluster->GetM20();
958     //fvalueElectron[4] = cluster->GetM02();
959     //fvalueElectron[5] = cluster->GetDispersion();
960
961     //fSparseElectron->Fill(fvalueElectron);
962
963     //----------------
964     //EovP distribution for Had
965     if((fTPCnSigma > fTPCnsigHadMin) && (fTPCnSigma < fTPCnsigHadMax)) fEovPHadWoSS->Fill(pt,fEovP);
966     if(((fTPCnSigma > fTPCnsigHadMin) && (fTPCnSigma < fTPCnsigHadMax)) && ((cluster->GetM20()> fM20CutMin) && (cluster->GetM20()< fM20CutMax)) &&  ((cluster->GetM02()> fM02CutMin) && (cluster->GetM02()< fM02CutMax)) && ((cluster->GetDispersion()< fDispCutMax))) fEovPHadWSS->Fill(pt,fEovP);
967
968     //Dphi distribution hadrons with shower shape cuts
969     if(((fTPCnSigma > fTPCnsigHadMin) && (fTPCnSigma < fTPCnsigHadMax)) && ((cluster->GetM20()> fM20CutMin) && (cluster->GetM20()< fM20CutMax)) &&  ((cluster->GetM02()> fM02CutMin) && (cluster->GetM02()< fM02CutMax)) && ((cluster->GetDispersion()< fDispCutMax))&&(fEovP >= fEovPMin && fEovP <= fEovPMax)){
970       ElectronHadCorrel(iTracks, track, fHadronDphi, fHadronDphi1,fHadronDphi2,fHadronDphi3,fHadronDphi4);
971       ElectronHadCorrelEtaBins(iTracks, track, fHadronDphiEta1, fHadronDphiEta11,fHadronDphiEta12,fHadronDphiEta13,fHadronDphiEta14,fHadronDphiEta2, fHadronDphiEta21,fHadronDphiEta22,fHadronDphiEta23,fHadronDphiEta24);
972       fPiPt->Fill(pt);
973     }
974
975     //Dphi distribution hadrons without shower shape cuts
976     if((fTPCnSigma > fTPCnsigHadMin) && (fTPCnSigma < fTPCnsigHadMax)&&(fEovP >= fEovPMin && fEovP <= fEovPMax)){
977       ElectronHadCorrel(iTracks, track, fHadronDphiNoSS, fHadronDphiNoSS1,fHadronDphiNoSS2,fHadronDphiNoSS3,fHadronDphiNoSS4);
978       ElectronHadCorrelEtaBins(iTracks, track, fHadronDphiNoSSEta1, fHadronDphiNoSSEta11,fHadronDphiNoSSEta12,fHadronDphiNoSSEta13,fHadronDphiNoSSEta14,fHadronDphiNoSSEta2, fHadronDphiNoSSEta21,fHadronDphiNoSSEta22,fHadronDphiNoSSEta23,fHadronDphiNoSSEta24);
979       fPiPtNoSS->Fill(pt);
980     }
981
982     //Electron id with TPC
983     if(fTPCnSigma < fTPCnsigEleMin || fTPCnSigma > fTPCnsigEleMax) continue;
984     fEovPWoSS->Fill(pt,fEovP);
985     //   fElecPhiTPCEovP->Fill(track->Phi());
986
987     //Electron id with shower shape  
988     if(cluster->GetM20()< fM20CutMin || cluster->GetM20()> fM20CutMax || cluster->GetM02()< fM02CutMin || cluster->GetM02()> fM02CutMax || cluster->GetDispersion()> fDispCutMax) continue;
989     fEovPWSS->Fill(pt,fEovP);
990
991     //Electron id with E/p
992     if(fEovP < fEovPMin || fEovP > fEovPMax) continue;
993
994     fTrkEovPAft->Fill(pt,fEovP);
995     fElecPhi->Fill(track->Phi());
996     fElecPhiPt->Fill(track->Phi(),track->Pt());
997     if (track->Eta() >0 && track->Eta() <0.7) fElecPhiTPChalf->Fill(track->Phi());
998
999     HadronInfo(iTracks);
1000
1001     Bool_t fFlagPhotonicElec = kFALSE;
1002     // select photonic electron
1003     SelectPhotonicElectron(iTracks,track,fFlagPhotonicElec);
1004     SelectPhotonicElectronDCAMet(iTracks,track,fpidResponse);
1005
1006     //Inclusive electron-hadron correlation
1007     ElectronHadCorrel(iTracks, track, fInclusiveElecDphi, fInclusiveElecDphi1,fInclusiveElecDphi2,fInclusiveElecDphi3,fInclusiveElecDphi4);
1008     fInclusiveElecPt->Fill(pt);
1009     MixedEvent(track,fMixedIncElecDphi, fMixedIncElecDphi1,fMixedIncElecDphi2, fMixedIncElecDphi3, fMixedIncElecDphi4);
1010
1011     //Dphi in Eta bins
1012     ElectronHadCorrelEtaBins(iTracks, track, fInclusiveElecDphiEta1, fInclusiveElecDphiEta11,fInclusiveElecDphiEta12,fInclusiveElecDphiEta13,fInclusiveElecDphiEta14,fInclusiveElecDphiEta2, fInclusiveElecDphiEta21,fInclusiveElecDphiEta22,fInclusiveElecDphiEta23,fInclusiveElecDphiEta24);
1013
1014     //Inclusive electron-hadron correlation far eta side
1015     ElectronHadCorrelEtaFarSide(iTracks, track, fInclusiveElecDphiEtaFS, fInclusiveElecDphiEtaFS1,fInclusiveElecDphiEtaFS2,fInclusiveElecDphiEtaFS3,fInclusiveElecDphiEtaFS4);
1016     MixedEvent(track,fMixedIncElecDphi, fMixedIncElecDphi1,fMixedIncElecDphi2, fMixedIncElecDphi3, fMixedIncElecDphi4);
1017
1018     // photonic electron
1019     if(fFlagPhotonicElec){
1020       //Electron hadron correlation
1021       ElectronHadCorrel(iTracks, track, fPhotElecDphi,fPhotElecDphi1,fPhotElecDphi2,fPhotElecDphi3,fPhotElecDphi4);
1022       fPhotoElecPt->Fill(pt);
1023       MixedEvent(track,fMixedPhotElecDphi, fMixedPhotElecDphi1,fMixedPhotElecDphi2, fMixedPhotElecDphi3, fMixedPhotElecDphi4);
1024
1025       //Dphi in Eta bins
1026       ElectronHadCorrelEtaBins(iTracks, track, fPhotElecDphiEta1,fPhotElecDphiEta11,fPhotElecDphiEta12,fPhotElecDphiEta13,fPhotElecDphiEta14,fPhotElecDphiEta2,fPhotElecDphiEta21,fPhotElecDphiEta22,fPhotElecDphiEta23,fPhotElecDphiEta24);
1027     }
1028
1029     // Semi inclusive electron 
1030     if(!fFlagPhotonicElec){
1031       //Electron hadron correlation
1032       ElectronHadCorrel(iTracks, track, fSemiIncElecDphi, fSemiIncElecDphi1,fSemiIncElecDphi2,fSemiIncElecDphi3,fSemiIncElecDphi4);
1033       fSemiInclElecPt->Fill(pt);
1034       MixedEvent(track,fMixedSemiIncElecDphi,fMixedSemiIncElecDphi1,fMixedSemiIncElecDphi2, fMixedSemiIncElecDphi3, fMixedSemiIncElecDphi4);
1035
1036       //Dphi in Eta bins
1037       ElectronHadCorrelEtaBins(iTracks, track, fSemiIncElecDphiEta1, fSemiIncElecDphiEta11,fSemiIncElecDphiEta12,fSemiIncElecDphiEta13,fSemiIncElecDphiEta14,fSemiIncElecDphiEta2, fSemiIncElecDphiEta21,fSemiIncElecDphiEta22,fSemiIncElecDphiEta23,fSemiIncElecDphiEta24);
1038     }
1039   }
1040   /*   //EMC clusters  
1041        Int_t clsNo = fVevent->GetNumberOfCaloClusters();
1042        fNClusv1->Fill(clsNo); 
1043        for(Int_t iclus=0; iclus<clsNo ; iclus++){ 
1044        AliVCluster* clus = fVevent->GetCaloCluster(iclus);
1045        if(!clus->IsEMCAL()) continue; 
1046        fNCellv1->Fill(clus->GetNCells());
1047        fClsEv1->Fill(clus->E());  
1048        }
1049    */
1050
1051   TObjArray* tracksClone = CloneAndReduceTrackList();
1052   tracksClone->SetOwner();
1053   pool->UpdatePool(tracksClone);
1054
1055   PostData(1, fOutputList);
1056 }
1057 //_________________________________________
1058 void AliAnalysisTaskElecHadronCorrel::UserCreateOutputObjects()
1059 {
1060   //Create histograms
1061
1062   AliDebug(3, "Creating Output Objects");
1063   // Automatic determination of the analysis mode
1064   AliVEventHandler *inputHandler = dynamic_cast<AliVEventHandler *>(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler());
1065   if(!TString(inputHandler->IsA()->GetName()).CompareTo("AliAODInputHandler")){
1066     SetAODAnalysis();
1067   } else {
1068     SetESDAnalysis();
1069   }
1070   printf("Analysis Mode: %s Analysis\n", IsAODanalysis() ? "AOD" : "ESD");
1071
1072   //--------Initialize PID
1073   fPID->SetHasMCData(kFALSE);
1074   if(!fPID->GetNumberOfPIDdetectors()) 
1075   {
1076     fPID->AddDetector("TPC", 0);
1077     fPID->AddDetector("EMCAL", 1);
1078   }
1079
1080   fPID->SortDetectors(); 
1081   fPIDqa = new AliHFEpidQAmanager();
1082   fPIDqa->Initialize(fPID);
1083
1084   //--------Initialize correction Framework and Cuts
1085   fCFM = new AliCFManager;
1086   const Int_t kNcutSteps = AliHFEcuts::kNcutStepsMCTrack + AliHFEcuts::kNcutStepsRecTrack + AliHFEcuts::kNcutStepsDETrack;
1087   fCFM->SetNStepParticle(kNcutSteps);
1088   for(Int_t istep = 0; istep < kNcutSteps; istep++)
1089     fCFM->SetParticleCutsList(istep, NULL);
1090
1091   if(!fCuts){
1092     AliWarning("Cuts not available. Default cuts will be used");
1093     fCuts = new AliHFEcuts;
1094     fCuts->CreateStandardCuts();
1095   }
1096
1097   if(IsAODanalysis()) fCuts->SetAOD(); 
1098   fCuts->Initialize(fCFM);
1099
1100   //Mixed event initialising
1101   Int_t trackDepth = 2000;
1102   Int_t poolsize   = 1000;
1103
1104   Int_t nCentralityBins  = 5;
1105   Int_t nCentralityBinsSC  = 6;
1106   Int_t nZvtxBins  = 4;
1107   Double_t CentralityBins[6];
1108   Double_t CentralityBinsSC[7];
1109   Double_t vertexBins[5];
1110   if(fTriggerCentral)
1111   {
1112     CentralityBins[0] = 0;
1113     CentralityBins[1] = 2;
1114     CentralityBins[2] = 4;
1115     CentralityBins[3] = 6;
1116     CentralityBins[4] = 8;
1117     CentralityBins[5] = 10;
1118
1119     vertexBins[0] = -10;
1120     vertexBins[1] = -5;
1121     vertexBins[2] = 0;
1122     vertexBins[3] = 5;
1123     vertexBins[4] = 10;
1124     fPoolMgr = new AliEventPoolManager(poolsize, trackDepth, nCentralityBins, (Double_t*) CentralityBins, nZvtxBins, (Double_t*) vertexBins);
1125   }
1126
1127   if(!fTriggerCentral)                                                                     
1128   { 
1129     CentralityBinsSC[0] = 20;  
1130     CentralityBinsSC[1] = 25;  
1131     CentralityBinsSC[2] = 30;  
1132     CentralityBinsSC[3] = 35;  
1133     CentralityBinsSC[4] = 40;  
1134     CentralityBinsSC[5] = 45;  
1135     CentralityBinsSC[6] = 50;  
1136
1137     vertexBins[0] = -10;
1138     vertexBins[1] = -5;
1139     vertexBins[2] = 0;
1140     vertexBins[3] = 5;
1141     vertexBins[4] = 10;
1142     fPoolMgr = new AliEventPoolManager(poolsize, trackDepth, nCentralityBinsSC, (Double_t*) CentralityBinsSC, nZvtxBins, (Double_t*) vertexBins);
1143   }
1144
1145
1146   //---------Output Tlist
1147   fOutputList = new TList();
1148   fOutputList->SetOwner();
1149   fOutputList->Add(fPIDqa->MakeList("PIDQA"));
1150
1151   fNoEvents = new TH1F("fNoEvents","",1,0,1) ;
1152   fOutputList->Add(fNoEvents);
1153
1154   fcentrality = new TH1F("fcentrality","centrality", 100,0,100);
1155   fOutputList->Add(fcentrality);
1156
1157   //  fTrkpt = new TH1F("fTrkpt","track pt",1000,0,50);
1158   //  fOutputList->Add(fTrkpt);
1159
1160   //  fTrackPtBefTrkCuts = new TH1F("fTrackPtBefTrkCuts","track pt before track cuts",1000,0,50);
1161   //  fOutputList->Add(fTrackPtBefTrkCuts);
1162
1163   //  fTrackPtAftTrkCuts = new TH1F("fTrackPtAftTrkCuts","track pt after track cuts",1000,0,50);
1164   //  fOutputList->Add(fTrackPtAftTrkCuts);
1165
1166   fTPCnsigma = new TH2F("fTPCnsigma", "TPC - n sigma",1000,0,50,200,-10,10);
1167   fOutputList->Add(fTPCnsigma);
1168
1169   fTrkEovPAft = new TH2F("fTrkEovPAft","track E/p after HFE pid",1000,0,50,100,0,2);
1170   fOutputList->Add(fTrkEovPAft);
1171
1172   //  fTrkEovPBefHad = new TH2F("fTrkEovPBefHad","track E/p for TPCnsig < 3.5",1000,0,50,100,0,2);
1173   //  fOutputList->Add(fTrkEovPBefHad);
1174
1175   //  fdEdxBef = new TH2F("fdEdxBef","track dEdx vs p before HFE pid",1000,0,50,150,0,150);
1176   //  fOutputList->Add(fdEdxBef);
1177
1178   fElecPhi = new TH1F("fElecPhi", "Electron phi",1000,0,6.28);
1179   fOutputList->Add(fElecPhi);
1180
1181   fElecPhiPt = new TH2F("fElecPhiPt", "Electron phi vs pt; Electron phi; pt (GeV/c)",1000,0,6.28,1000,0,100);
1182   fOutputList->Add(fElecPhiPt);
1183
1184   fElecPhiTPChalf = new TH1F("fElecPhiTPChalf", "Electron phi for 0<eta<0.7",1000,0,6.28);                            
1185   fOutputList->Add(fElecPhiTPChalf);
1186
1187   /*  fElecPhiTPC = new TH1F("fElecPhiTPC", "Electron phi after TPC cut",1000,0,6.28);
1188       fOutputList->Add(fElecPhiTPC);
1189
1190       fElecPhiTPCEovP = new TH1F("fElecPhiTPCEovP", "Electron phi after TPC and E/p cut",1000,0,6.28);
1191       fOutputList->Add(fElecPhiTPCEovP);
1192    */
1193   fHadronPhi = new TH1F("fHadronPhi", "Hadron phi",1000,0,6.28);
1194   fOutputList->Add(fHadronPhi);
1195
1196   fHadronPhiTPChalf = new TH1F("fHadronPhiTPChalf", "Hadron phi for 0<eta<0.9",1000,0,6.28);                          
1197   fOutputList->Add(fHadronPhiTPChalf);
1198
1199   fHadronPhiPt = new TH2F("fHadronPhiPt", "Hadron phi vs pt; hadron phi; pt (GeV/c)",1000,0,6.28,1000,0,100);
1200   fOutputList->Add(fHadronPhiPt);
1201
1202   /*
1203      fTrackHFEcuts = new TH1F("fTrackHFEcuts","Track phi for HFE cuts",1000,0,6.28);
1204      fOutputList->Add(fTrackHFEcuts);
1205
1206      fTrakPhiSPD1 = new TH1F("fTrakPhiSPD1","Track phi for hit in SPD layer 1",1000,0,6.28);
1207      fOutputList->Add(fTrakPhiSPD1);
1208
1209      fTrakPhiSPD2 = new TH1F("fTrakPhiSPD2","Track phi for hit in SPD layer 2",1000,0,6.28);
1210      fOutputList->Add(fTrakPhiSPD2);
1211
1212      fTrakPhiSPDOr = new TH1F("fTrakPhiSPDOr","Track phi for hit in any SPD layer",1000,0,6.28);
1213      fOutputList->Add(fTrakPhiSPDOr);
1214
1215      fTrakPhiSPDAnd = new TH1F("fTrakPhiSPDAnd","Track phi for hit in both SPD layer",1000,0,6.28);
1216      fOutputList->Add(fTrakPhiSPDAnd);
1217
1218      fTrackHFEcutsITS = new TH1F("fTrackHFEcutsITS","Track phi for HFE cuts + ITS HFE cuts",1000,0,6.28);
1219      fOutputList->Add(fTrackHFEcutsITS);
1220    */
1221   fSemiIncElecDphi = new TH2F("fSemiIncElecDphi", "Semi Inclusive elec-had Dphi correlation",200,0,20,100,-1.57,4.71);
1222   fOutputList->Add(fSemiIncElecDphi);
1223
1224   fSemiIncElecDphi1 = new TH2F("fSemiIncElecDphi1", "Semi Inclusive elec-had Dphi correlation for 2<pt^{asso}<4",200,0,20,100,-1.57,4.71);
1225   fOutputList->Add(fSemiIncElecDphi1);
1226
1227   fSemiIncElecDphi2 = new TH2F("fSemiIncElecDphi2", "Semi Inclusive elec-had Dphi correlation for 4<pt^{asso}<6",200,0,20,100,-1.57,4.71);
1228   fOutputList->Add(fSemiIncElecDphi2);
1229
1230   fSemiIncElecDphi3 = new TH2F("fSemiIncElecDphi3", "Semi Inclusive elec-had Dphi correlation for 6<pt^{asso}<8",200,0,20,100,-1.57,4.71);
1231   fOutputList->Add(fSemiIncElecDphi3);
1232
1233   fSemiIncElecDphi4 = new TH2F("fSemiIncElecDphi4", "Semi Inclusive elec-had Dphi correlation for 4<pt^{asso}<10",200,0,20,100,-1.57,4.71);
1234   fOutputList->Add(fSemiIncElecDphi4);
1235
1236   fPhotElecDphi = new TH2F("fPhotElecDphi", "Photon elec-had Dphi correlation",200,0,20,100,-1.57,4.71);
1237   fOutputList->Add(fPhotElecDphi);
1238
1239   fPhotElecDphi1 = new TH2F("fPhotElecDphi1", "Photon elec-had Dphi correlation for 2<pt^{asso}<4",200,0,20,100,-1.57,4.71);
1240   fOutputList->Add(fPhotElecDphi1);
1241
1242   fPhotElecDphi2 = new TH2F("fPhotElecDphi2", "Photon elec-had Dphi correlation for 4<pt^{asso}<6",200,0,20,100,-1.57,4.71);
1243   fOutputList->Add(fPhotElecDphi2);
1244
1245   fPhotElecDphi3 = new TH2F("fPhotElecDphi3", "Photon elec-had Dphi correlation for 6<pt^{asso}<8",200,0,20,100,-1.57,4.71);
1246   fOutputList->Add(fPhotElecDphi3);
1247
1248   fPhotElecDphi4 = new TH2F("fPhotElecDphi4", "Photon elec-had Dphi correlation for 4<pt^{asso}<10",200,0,20,100,-1.57,4.71);
1249   fOutputList->Add(fPhotElecDphi4);
1250
1251   fInclusiveElecDphi = new TH2F("fInclusiveElecDphi", "Inclusive elec-had Dphi correlation",200,0,20,100,-1.57,4.71);
1252   fOutputList->Add(fInclusiveElecDphi);
1253
1254   fInclusiveElecDphi1 = new TH2F("fInclusiveElecDphi1", "Inclusive elec-had Dphi correlation for 2<pt^{asso}<4",200,0,20,100,-1.57,4.71);
1255   fOutputList->Add(fInclusiveElecDphi1);
1256
1257   fInclusiveElecDphi2 = new TH2F("fInclusiveElecDphi2", "Inclusive elec-had Dphi correlation for 4<pt^{asso}<6",200,0,20,100,-1.57,4.71);
1258   fOutputList->Add(fInclusiveElecDphi2);
1259
1260   fInclusiveElecDphi3 = new TH2F("fInclusiveElecDphi3", "Inclusive elec-had Dphi correlation for 6<pt^{asso}<8",200,0,20,100,-1.57,4.71);
1261   fOutputList->Add(fInclusiveElecDphi3);
1262
1263   fInclusiveElecDphi4 = new TH2F("fInclusiveElecDphi4", "Inclusive elec-had Dphi correlation for 4<pt^{asso}<10",200,0,20,100,-1.57,4.71);
1264   fOutputList->Add(fInclusiveElecDphi4);
1265
1266   fInclusiveElecDphiEtaFS = new TH2F("fInclusiveElecDphiEtaFS", "Inclusive elec-had Dphi correlation (hadron 1<eta<1.6)",200,0,20,100,-1.57,4.71);
1267   fOutputList->Add(fInclusiveElecDphiEtaFS);
1268
1269   fInclusiveElecDphiEtaFS1 = new TH2F("fInclusiveElecDphiEtaFS1", "Inclusive elec-had Dphi correlation for 2<pt^{asso}<4 (hadron 1<eta<1.6)",200,0,20,100,-1.57,4.71);
1270   fOutputList->Add(fInclusiveElecDphiEtaFS1);
1271
1272   fInclusiveElecDphiEtaFS2 = new TH2F("fInclusiveElecDphiEtaFS2", "Inclusive elec-had Dphi correlation for 4<pt^{asso}<6 (hadron 1<eta<1.6)",200,0,20,100,-1.57,4.71);
1273   fOutputList->Add(fInclusiveElecDphiEtaFS2);
1274
1275   fInclusiveElecDphiEtaFS3 = new TH2F("fInclusiveElecDphiEtaFS3", "Inclusive elec-had Dphi correlation for 6<pt^{asso}<8 (hadron 1<eta<1.6)",200,0,20,100,-1.57,4.71);
1276   fOutputList->Add(fInclusiveElecDphiEtaFS3);
1277
1278   fInclusiveElecDphiEtaFS4 = new TH2F("fInclusiveElecDphiEtaFS4", "Inclusive elec-had Dphi correlation for 4<pt^{asso}<10 (hadron 1<eta<1.6)",200,0,20,100,-1.57,4.71);
1279   fOutputList->Add(fInclusiveElecDphiEtaFS4);
1280
1281   fDphiULSMassLow = new TH2F("fDphiULSMassLow", "e-h Dphi ULS, mass<cut",200,0,20,100,-1.57,4.71);
1282   fOutputList->Add(fDphiULSMassLow);
1283   fDphiULSMassLow1 = new TH2F("fDphiULSMassLow1", "e-h Dphi ULS, mass<cut for 2<pt^{asso}<4",200,0,20,100,-1.57,4.71);
1284   fOutputList->Add(fDphiULSMassLow1);
1285   fDphiULSMassLow2 = new TH2F("fDphiULSMassLow2", "e-h Dphi ULS, mass<cut for 4<pt^{asso}<6",200,0,20,100,-1.57,4.71);
1286   fOutputList->Add(fDphiULSMassLow2);
1287   fDphiULSMassLow3 = new TH2F("fDphiULSMassLow3", "e-h Dphi ULS, mass<cut for 6<pt^{asso}<8",200,0,20,100,-1.57,4.71);
1288   fOutputList->Add(fDphiULSMassLow3);
1289   fDphiULSMassLow4 = new TH2F("fDphiULSMassLow4", "e-h Dphi ULS, mass<cut for 4<pt^{asso}<10",200,0,20,100,-1.57,4.71);
1290   fOutputList->Add(fDphiULSMassLow4);
1291   fDphiLSMassLow = new TH2F("fDphiLSMassLow", "e-h Dphi LS, mass<cut",200,0,20,100,-1.57,4.71);
1292   fOutputList->Add(fDphiLSMassLow);
1293   fDphiLSMassLow1 = new TH2F("fDphiLSMassLow1", "e-h Dphi LS, mass<cut for 2<pt^{asso}<4",200,0,20,100,-1.57,4.71);
1294   fOutputList->Add(fDphiLSMassLow1);
1295   fDphiLSMassLow2 = new TH2F("fDphiLSMassLow2", "e-h Dphi LS, mass<cut for 4<pt^{asso}<6",200,0,20,100,-1.57,4.71);
1296   fOutputList->Add(fDphiLSMassLow2);
1297   fDphiLSMassLow3 = new TH2F("fDphiLSMassLow3", "e-h Dphi LS, mass<cut for 6<pt^{asso}<8",200,0,20,100,-1.57,4.71);
1298   fOutputList->Add(fDphiLSMassLow3);
1299   fDphiLSMassLow4 = new TH2F("fDphiLSMassLow4", "e-h Dphi LS, mass<cut for 8<pt^{asso}<10",200,0,20,100,-1.57,4.71);
1300   fOutputList->Add(fDphiLSMassLow4);
1301   fDphiULSMassLowNoPartner = new TH2F("fDphiULSMassLowNoPartner", "e-h Dphi ULS with no partner, mass<mass cut,",200,0,20,100,-1.57,4.71);
1302   fOutputList->Add(fDphiULSMassLowNoPartner);
1303   fDphiULSMassLowNoPartner1 = new TH2F("fDphiULSMassLowNoPartner1", "e-h Dphi ULS with no partner, mass<mass cut for 2<pt^{asso}<4,",200,0,20,100,-1.57,4.71);
1304   fOutputList->Add(fDphiULSMassLowNoPartner1);
1305   fDphiULSMassLowNoPartner2 = new TH2F("fDphiULSMassLowNoPartner2", "e-h Dphi ULS with no partner, mass<mass cut for 4<pt^{asso}<6,",200,0,20,100,-1.57,4.71);
1306   fOutputList->Add(fDphiULSMassLowNoPartner2);
1307   fDphiULSMassLowNoPartner3 = new TH2F("fDphiULSMassLowNoPartner3", "e-h Dphi ULS with no partner, mass<mass cut for 6<pt^{asso}<8,",200,0,20,100,-1.57,4.71);
1308   fOutputList->Add(fDphiULSMassLowNoPartner3);
1309   fDphiULSMassLowNoPartner4 = new TH2F("fDphiULSMassLowNoPartner4", "e-h Dphi ULS with no partner, mass<mass cut for 4<pt^{asso}<10,",200,0,20,100,-1.57,4.71);
1310   fOutputList->Add(fDphiULSMassLowNoPartner4);
1311   fDphiLSMassLowNoPartner = new TH2F("fDphiLSMassLowNoPartner", "e-h Dphi LS with no partner, mass<mass cut",200,0,20,100,-1.57,4.71);
1312   fOutputList->Add(fDphiLSMassLowNoPartner);
1313   fDphiLSMassLowNoPartner1 = new TH2F("fDphiLSMassLowNoPartner1", "e-h Dphi LS with no partner, mass<mass cut for 2<pt^{asso}<4,",200,0,20,100,-1.57,4.71);
1314   fOutputList->Add(fDphiLSMassLowNoPartner1);                                            
1315   fDphiLSMassLowNoPartner2 = new TH2F("fDphiLSMassLowNoPartner2", "e-h Dphi LS with no partner, mass<mass cut for 4<pt^{asso}<6,",200,0,20,100,-1.57,4.71);
1316   fOutputList->Add(fDphiLSMassLowNoPartner2);
1317   fDphiLSMassLowNoPartner3 = new TH2F("fDphiLSMassLowNoPartner3", "e-h Dphi LS with no partner, mass<mass cut for 6<pt^{asso}<8,",200,0,20,100,-1.57,4.71);
1318   fOutputList->Add(fDphiLSMassLowNoPartner3);
1319   fDphiLSMassLowNoPartner4 = new TH2F("fDphiLSMassLowNoPartner4", "e-h Dphi LS with no partner, mass<mass cut for 4<pt^{asso}<10,",200,0,20,100,-1.57,4.71);
1320   fOutputList->Add(fDphiLSMassLowNoPartner4);
1321   fPhotoElecPt = new TH1F("fPhotoElecPt", "photonic electron pt",1000,0,100);
1322   fOutputList->Add(fPhotoElecPt);
1323   fSemiInclElecPt = new TH1F("fSemiInclElecPt", "Semi-inclusive electron pt",1000,0,100);
1324   fOutputList->Add(fSemiInclElecPt);
1325   fInclusiveElecPt = new TH1F("fInclElecPt", "Inclusive electron pt",1000,0,100);
1326   fOutputList->Add(fInclusiveElecPt);
1327   fULSElecPt = new TH1F("fULSElecPt", "ULS electron pt",1000,0,100);
1328   fOutputList->Add(fULSElecPt);
1329   fLSElecPt = new TH1F("fLSElecPt", "LS electron pt",1000,0,100);
1330   fOutputList->Add(fLSElecPt);
1331
1332   fDCAMetPhotElecDphi = new TH2F("fDCAMetPhotElecDphi", "Photon elec-had Dphi correlation DCA method",200,0,20,100,-1.57,4.71);
1333   fOutputList->Add(fDCAMetPhotElecDphi);
1334   fDCAMetPhotElecDphi1 = new TH2F("fDCAMetPhotElecDphi1", "Photon elec-had Dphi correlation DCA method for 2<pt^{asso}<4",200,0,20,100,-1.57,4.71);
1335   fOutputList->Add(fDCAMetPhotElecDphi1);
1336   fDCAMetPhotElecDphi2 = new TH2F("fDCAMetPhotElecDphi2", "Photon elec-had Dphi correlation DCA method for 4<pt^{asso}<6",200,0,20,100,-1.57,4.71);
1337   fOutputList->Add(fDCAMetPhotElecDphi2);
1338   fDCAMetPhotElecDphi3 = new TH2F("fDCAMetPhotElecDphi3", "Photon elec-had Dphi correlation DCA method for 6<pt^{asso}<8",200,0,20,100,-1.57,4.71);
1339   fOutputList->Add(fDCAMetPhotElecDphi3);
1340   fDCAMetPhotElecDphi4 = new TH2F("fDCAMetPhotElecDphi4", "Photon elec-had Dphi correlation DCA method for 4<pt^{asso}<10",200,0,20,100,-1.57,4.71);
1341   fOutputList->Add(fDCAMetPhotElecDphi4);
1342   fDCAMetDphiULSMassLow = new TH2F("fDCAMetDphiULSMassLow", "e-h Dphi ULS, mass<cut",200,0,20,100,-1.57,4.71);
1343   fOutputList->Add(fDCAMetDphiULSMassLow);
1344   fDCAMetDphiULSMassLow1 = new TH2F("fDCAMetDphiULSMassLow1", "e-h Dphi ULS, mass<cut for 2<pt^{asso}<4",200,0,20,100,-1.57,4.71);
1345   fOutputList->Add(fDCAMetDphiULSMassLow1);
1346   fDCAMetDphiULSMassLow2 = new TH2F("fDCAMetDphiULSMassLow2", "e-h Dphi ULS, mass<cut for 4<pt^{asso}<6",200,0,20,100,-1.57,4.71);
1347   fOutputList->Add(fDCAMetDphiULSMassLow2);
1348   fDCAMetDphiULSMassLow3 = new TH2F("fDCAMetDphiULSMassLow3", "e-h Dphi ULS, mass<cut for 6<pt^{asso}<8",200,0,20,100,-1.57,4.71);
1349   fOutputList->Add(fDCAMetDphiULSMassLow3);
1350   fDCAMetDphiULSMassLow4 = new TH2F("fDCAMetDphiULSMassLow4", "e-h Dphi ULS, mass<cut for 4<pt^{asso}<10",200,0,20,100,-1.57,4.71);
1351   fOutputList->Add(fDCAMetDphiULSMassLow4);
1352   fDCAMetDphiLSMassLow = new TH2F("fDCAMetDphiLSMassLow", "e-h Dphi LS, mass<cut",200,0,20,100,-1.57,4.71);
1353   fOutputList->Add(fDCAMetDphiLSMassLow);
1354   fDCAMetDphiLSMassLow1 = new TH2F("fDCAMetDphiLSMassLow1", "e-h Dphi LS, mass<cut for 2<pt^{asso}<4",200,0,20,100,-1.57,4.71);
1355   fOutputList->Add(fDCAMetDphiLSMassLow1);
1356   fDCAMetDphiLSMassLow2 = new TH2F("fDCAMetDphiLSMassLow2", "e-h Dphi LS, mass<cut for 4<pt^{asso}<6",200,0,20,100,-1.57,4.71);
1357   fOutputList->Add(fDCAMetDphiLSMassLow2);
1358   fDCAMetDphiLSMassLow3 = new TH2F("fDCAMetDphiLSMassLow3", "e-h Dphi LS, mass<cut for 6<pt^{asso}<8",200,0,20,100,-1.57,4.71);
1359   fOutputList->Add(fDCAMetDphiLSMassLow3);
1360   fDCAMetDphiLSMassLow4 = new TH2F("fDCAMetDphiLSMassLow4", "e-h Dphi LS, mass<cut for 8<pt^{asso}<10",200,0,20,100,-1.57,4.71);
1361   fOutputList->Add(fDCAMetDphiLSMassLow4);
1362   fDCAMetDphiULSMassLowNoPartner = new TH2F("fDCAMetDphiULSMassLowNoPartner", "e-h Dphi ULS with no partner, mass<mass cut,",200,0,20,100,-1.57,4.71);
1363   fOutputList->Add(fDCAMetDphiULSMassLowNoPartner);
1364   fDCAMetDphiULSMassLowNoPartner1 = new TH2F("fDCAMetDphiULSMassLowNoPartner1", "e-h Dphi ULS with no partner, mass<mass cut for 2<pt^{asso}<4,",200,0,20,100,-1.57,4.71);
1365   fOutputList->Add(fDCAMetDphiULSMassLowNoPartner1);
1366   fDCAMetDphiULSMassLowNoPartner2 = new TH2F("fDCAMetDphiULSMassLowNoPartner2", "e-h Dphi ULS with no partner, mass<mass cut for 4<pt^{asso}<6,",200,0,20,100,-1.57,4.71);
1367   fOutputList->Add(fDCAMetDphiULSMassLowNoPartner2);
1368   fDCAMetDphiULSMassLowNoPartner3 = new TH2F("fDCAMetDphiULSMassLowNoPartner3", "e-h Dphi ULS with no partner, mass<mass cut for 6<pt^{asso}<8,",200,0,20,100,-1.57,4.71);
1369   fOutputList->Add(fDCAMetDphiULSMassLowNoPartner3);
1370   fDCAMetDphiULSMassLowNoPartner4 = new TH2F("fDCAMetDphiULSMassLowNoPartner4", "e-h Dphi ULS with no partner, mass<mass cut for 4<pt^{asso}<10,",200,0,20,100,-1.57,4.71);
1371   fOutputList->Add(fDCAMetDphiULSMassLowNoPartner4);
1372   fDCAMetDphiLSMassLowNoPartner = new TH2F("fDCAMetDphiLSMassLowNoPartner", "e-h Dphi LS with no partner, mass<mass cut",200,0,20,100,-1.57,4.71);
1373   fOutputList->Add(fDCAMetDphiLSMassLowNoPartner);
1374   fDCAMetDphiLSMassLowNoPartner1 = new TH2F("fDCAMetDphiLSMassLowNoPartner1", "e-h Dphi LS with no partner, mass<mass cut for 2<pt^{asso}<4,",200,0,20,100,-1.57,4.71);
1375   fOutputList->Add(fDCAMetDphiLSMassLowNoPartner1);
1376   fDCAMetDphiLSMassLowNoPartner2 = new TH2F("fDCAMetDphiLSMassLowNoPartner2", "e-h Dphi LS with no partner, mass<mass cut for 4<pt^{asso}<6,",200,0,20,100,-1.57,4.71);
1377   fOutputList->Add(fDCAMetDphiLSMassLowNoPartner2);
1378   fDCAMetDphiLSMassLowNoPartner3 = new TH2F("fDCAMetDphiLSMassLowNoPartner3", "e-h Dphi LS with no partner, mass<mass cut for 6<pt^{asso}<8,",200,0,20,100,-1.57,4.71);
1379   fOutputList->Add(fDCAMetDphiLSMassLowNoPartner3);
1380   fDCAMetDphiLSMassLowNoPartner4 = new TH2F("fDCAMetDphiLSMassLowNoPartner4", "e-h Dphi LS with no partner, mass<mass cut for 4<pt^{asso}<10,",200,0,20,100,-1.57,4.71);
1381   fOutputList->Add(fDCAMetDphiLSMassLowNoPartner4);
1382   fDCAMetPhotoElecPt = new TH1F("fDCAMetPhotoElecPt", "photonic electron pt",1000,0,100);
1383   fOutputList->Add(fDCAMetPhotoElecPt);
1384   fDCAMetULSElecPt = new TH1F("fDCAMetULSElecPt", "ULS electron pt",1000,0,100);
1385   fOutputList->Add(fDCAMetULSElecPt);
1386   fDCAMetLSElecPt = new TH1F("fDCAMetLSElecPt", "LS electron pt",1000,0,100);
1387   fOutputList->Add(fDCAMetLSElecPt);
1388
1389   fSemiIncElecDphiEta1 = new TH2F("fSemiIncElecDphiEta1", "Semi Inclusive elec-had Dphi correlation for |Eta < 0.8|",200,0,20,100,-1.57,4.71);
1390   fOutputList->Add(fSemiIncElecDphiEta1);
1391   fSemiIncElecDphiEta11 = new TH2F("fSemiIncElecDphiEta11", "Semi Inclusive elec-had Dphi correlation for 2<pt^{asso}<4 for |Eta < 0.8|",200,0,20,100,-1.57,4.71);
1392   fOutputList->Add(fSemiIncElecDphiEta11);
1393   fSemiIncElecDphiEta12 = new TH2F("fSemiIncElecDphiEta12", "Semi Inclusive elec-had Dphi correlation for 4<pt^{asso}<6 for |Eta < 0.8|",200,0,20,100,-1.57,4.71);
1394   fOutputList->Add(fSemiIncElecDphiEta12);
1395   fSemiIncElecDphiEta13 = new TH2F("fSemiIncElecDphiEta13", "Semi Inclusive elec-had Dphi correlation for 6<pt^{asso}<8 for |Eta < 0.8|",200,0,20,100,-1.57,4.71);
1396   fOutputList->Add(fSemiIncElecDphiEta13);
1397   fSemiIncElecDphiEta14 = new TH2F("fSemiIncElecDphiEta14", "Semi Inclusive elec-had Dphi correlation for 4<pt^{asso}<10 for |Eta < 0.8|",200,0,20,100,-1.57,4.71);
1398   fOutputList->Add(fSemiIncElecDphiEta14);
1399   fPhotElecDphiEta1 = new TH2F("fPhotElecDphiEta1", "Photon elec-had Dphi correlation for |Eta < 0.8|",200,0,20,100,-1.57,4.71);
1400   fOutputList->Add(fPhotElecDphiEta1);
1401   fPhotElecDphiEta11 = new TH2F("fPhotElecDphiEta11", "Photon elec-had Dphi correlation for 2<pt^{asso}<4 for |Eta < 0.8|",200,0,20,100,-1.57,4.71);
1402   fOutputList->Add(fPhotElecDphiEta11);
1403   fPhotElecDphiEta12 = new TH2F("fPhotElecDphiEta12", "Photon elec-had Dphi correlation for 4<pt^{asso}<6 for |Eta < 0.8|",200,0,20,100,-1.57,4.71);
1404   fOutputList->Add(fPhotElecDphiEta12);
1405   fPhotElecDphiEta13 = new TH2F("fPhotElecDphiEta13", "Photon elec-had Dphi correlation for 6<pt^{asso}<8 for |Eta < 0.8|",200,0,20,100,-1.57,4.71);
1406   fOutputList->Add(fPhotElecDphiEta13);
1407   fPhotElecDphiEta14 = new TH2F("fPhotElecDphiEta14", "Photon elec-had Dphi correlation for 4<pt^{asso}<10 for |Eta < 0.8|",200,0,20,100,-1.57,4.71);
1408   fOutputList->Add(fPhotElecDphiEta14);
1409   fInclusiveElecDphiEta1 = new TH2F("fInclusiveElecDphiEta1", "Inclusive elec-had Dphi correlation for |Eta < 0.8|",200,0,20,100,-1.57,4.71);
1410   fOutputList->Add(fInclusiveElecDphiEta1);
1411   fInclusiveElecDphiEta11 = new TH2F("fInclusiveElecDphiEta11", "Inclusive elec-had Dphi correlation for 2<pt^{asso}<4 for |Eta < 0.8|",200,0,20,100,-1.57,4.71);
1412   fOutputList->Add(fInclusiveElecDphiEta11);
1413   fInclusiveElecDphiEta12 = new TH2F("fInclusiveElecDphiEta12", "Inclusive elec-had Dphi correlation for 4<pt^{asso}<6 for |Eta < 0.8|",200,0,20,100,-1.57,4.71);
1414   fOutputList->Add(fInclusiveElecDphiEta12);
1415   fInclusiveElecDphiEta13 = new TH2F("fInclusiveElecDphiEta13", "Inclusive elec-had Dphi correlation for 6<pt^{asso}<8 for |Eta < 0.8|",200,0,20,100,-1.57,4.71);
1416   fOutputList->Add(fInclusiveElecDphiEta13);
1417   fInclusiveElecDphiEta14 = new TH2F("fInclusiveElecDphiEta14", "Inclusive elec-had Dphi correlation for 4<pt^{asso}<10 for |Eta < 0.8|",200,0,20,100,-1.57,4.71);
1418   fOutputList->Add(fInclusiveElecDphiEta14);
1419   fDphiULSMassLowEta1 = new TH2F("fDphiULSMassLowEta1", "e-h Dphi ULS, mass<cut for |Eta < 0.8|",200,0,20,100,-1.57,4.71);
1420   fOutputList->Add(fDphiULSMassLowEta1);
1421   fDphiULSMassLowEta11 = new TH2F("fDphiULSMassLowEta11", "e-h Dphi ULS, mass<cut for 2<pt^{asso}<4 for |Eta < 0.8|",200,0,20,100,-1.57,4.71);
1422   fOutputList->Add(fDphiULSMassLowEta11);
1423   fDphiULSMassLowEta12 = new TH2F("fDphiULSMassLowEta12", "e-h Dphi ULS, mass<cut for 4<pt^{asso}<6 for |Eta < 0.8|",200,0,20,100,-1.57,4.71);
1424   fOutputList->Add(fDphiULSMassLowEta12);
1425   fDphiULSMassLowEta13 = new TH2F("fDphiULSMassLowEta13", "e-h Dphi ULS, mass<cut for 6<pt^{asso}<8 for |Eta < 0.8|",200,0,20,100,-1.57,4.71);
1426   fOutputList->Add(fDphiULSMassLowEta13);
1427   fDphiULSMassLowEta14 = new TH2F("fDphiULSMassLowEta14", "e-h Dphi ULS, mass<cut for 4<pt^{asso}<10 for |Eta < 0.8|",200,0,20,100,-1.57,4.71);
1428   fOutputList->Add(fDphiULSMassLowEta14);
1429   fDphiLSMassLowEta1 = new TH2F("fDphiLSMassLowEta1", "e-h Dphi LS, mass<cut for |Eta < 0.8|",200,0,20,100,-1.57,4.71);
1430   fOutputList->Add(fDphiLSMassLowEta1);
1431   fDphiLSMassLowEta11 = new TH2F("fDphiLSMassLowEta11", "e-h Dphi LS, mass<cut for 2<pt^{asso}<4 for |Eta < 0.8|",200,0,20,100,-1.57,4.71);
1432   fOutputList->Add(fDphiLSMassLowEta11);
1433   fDphiLSMassLowEta12 = new TH2F("fDphiLSMassLowEta12", "e-h Dphi LS, mass<cut for 4<pt^{asso}<6 for |Eta < 0.8|",200,0,20,100,-1.57,4.71);
1434   fOutputList->Add(fDphiLSMassLowEta12);
1435   fDphiLSMassLowEta13 = new TH2F("fDphiLSMassLowEta13", "e-h Dphi LS, mass<cut for 6<pt^{asso}<8 for |Eta < 0.8|",200,0,20,100,-1.57,4.71);
1436   fOutputList->Add(fDphiLSMassLowEta13);
1437   fDphiLSMassLowEta14 = new TH2F("fDphiLSMassLowEta14", "e-h Dphi LS, mass<cut for 8<pt^{asso}<10 for |Eta < 0.8|",200,0,20,100,-1.57,4.71);
1438   fOutputList->Add(fDphiLSMassLowEta14);
1439   fDphiULSMassLowNoPartnerEta1 = new TH2F("fDphiULSMassLowNoPartnerEta1", "e-h Dphi ULS with no partner, mass<mass cut, for |Eta < 0.8|",200,0,20,100,-1.57,4.71);
1440   fOutputList->Add(fDphiULSMassLowNoPartnerEta1);
1441   fDphiULSMassLowNoPartnerEta11 = new TH2F("fDphiULSMassLowNoPartnerEta11", "e-h Dphi ULS with no partner, mass<mass cut for 2<pt^{asso}<4, for |Eta < 0.8|",200,0,20,100,-1.57,4.71);
1442   fOutputList->Add(fDphiULSMassLowNoPartnerEta11);
1443   fDphiULSMassLowNoPartnerEta12 = new TH2F("fDphiULSMassLowNoPartnerEta12", "e-h Dphi ULS with no partner, mass<mass cut for 4<pt^{asso}<6, for |Eta < 0.8|",200,0,20,100,-1.57,4.71);
1444   fOutputList->Add(fDphiULSMassLowNoPartnerEta12);
1445   fDphiULSMassLowNoPartnerEta13 = new TH2F("fDphiULSMassLowNoPartnerEta13", "e-h Dphi ULS with no partner, mass<mass cut for 6<pt^{asso}<8, for |Eta < 0.8|",200,0,20,100,-1.57,4.71);
1446   fOutputList->Add(fDphiULSMassLowNoPartnerEta13);
1447   fDphiULSMassLowNoPartnerEta14 = new TH2F("fDphiULSMassLowNoPartnerEta14", "e-h Dphi ULS with no partner, mass<mass cut for 4<pt^{asso}<10, for |Eta < 0.8|",200,0,20,100,-1.57,4.71);
1448   fOutputList->Add(fDphiULSMassLowNoPartnerEta14);
1449   fDphiLSMassLowNoPartnerEta1 = new TH2F("fDphiLSMassLowNoPartnerEta1", "e-h Dphi LS with no partner, mass<mass cut, for |Eta < 0.8|",200,0,20,100,-1.57,4.71);
1450   fOutputList->Add(fDphiLSMassLowNoPartnerEta1);
1451   fDphiLSMassLowNoPartnerEta11 = new TH2F("fDphiLSMassLowNoPartnerEta11", "e-h Dphi LS with no partner, mass<mass cut for 2<pt^{asso}<4, for |Eta < 0.8|",200,0,20,100,-1.57,4.71);
1452   fOutputList->Add(fDphiLSMassLowNoPartnerEta11);
1453   fDphiLSMassLowNoPartnerEta12 = new TH2F("fDphiLSMassLowNoPartnerEta12", "e-h Dphi LS with no partner, mass<mass cut for 4<pt^{asso}<6, for |Eta < 0.8|",200,0,20,100,-1.57,4.71);
1454   fOutputList->Add(fDphiLSMassLowNoPartnerEta12);
1455   fDphiLSMassLowNoPartnerEta13 = new TH2F("fDphiLSMassLowNoPartnerEta13", "e-h Dphi LS with no partner, mass<mass cut for 6<pt^{asso}<8, for |Eta < 0.8|",200,0,20,100,-1.57,4.71);
1456   fOutputList->Add(fDphiLSMassLowNoPartnerEta13);
1457   fDphiLSMassLowNoPartnerEta14 = new TH2F("fDphiLSMassLowNoPartnerEta14", "e-h Dphi LS with no partner, mass<mass cut for 4<pt^{asso}<10, for |Eta < 0.8|",200,0,20,100,-1.57,4.71);
1458   fOutputList->Add(fDphiLSMassLowNoPartnerEta14);
1459
1460   fSemiIncElecDphiEta2 = new TH2F("fSemiIncElecDphiEta2", "Semi Inclusive elec-had Dphi correlation for |Eta > 0.8|",200,0,20,100,-1.57,4.71);
1461   fOutputList->Add(fSemiIncElecDphiEta2);
1462   fSemiIncElecDphiEta21 = new TH2F("fSemiIncElecDphiEta21", "Semi Inclusive elec-had Dphi correlation for 2<pt^{asso}<4 for |Eta > 0.8|",200,0,20,100,-1.57,4.71);
1463   fOutputList->Add(fSemiIncElecDphiEta21);
1464   fSemiIncElecDphiEta22 = new TH2F("fSemiIncElecDphiEta22", "Semi Inclusive elec-had Dphi correlation for 4<pt^{asso}<6 for |Eta > 0.8|",200,0,20,100,-1.57,4.71);
1465   fOutputList->Add(fSemiIncElecDphiEta22);
1466   fSemiIncElecDphiEta23 = new TH2F("fSemiIncElecDphiEta23", "Semi Inclusive elec-had Dphi correlation for 6<pt^{asso}<8 for |Eta > 0.8|",200,0,20,100,-1.57,4.71);
1467   fOutputList->Add(fSemiIncElecDphiEta23);
1468   fSemiIncElecDphiEta24 = new TH2F("fSemiIncElecDphiEta24", "Semi Inclusive elec-had Dphi correlation for 4<pt^{asso}<10 for |Eta > 0.8|",200,0,20,100,-1.57,4.71);
1469   fOutputList->Add(fSemiIncElecDphiEta24);
1470   fPhotElecDphiEta2 = new TH2F("fPhotElecDphiEta2", "Photon elec-had Dphi correlation for |Eta > 0.8|",200,0,20,100,-1.57,4.71);
1471   fOutputList->Add(fPhotElecDphiEta2);
1472   fPhotElecDphiEta21 = new TH2F("fPhotElecDphiEta21", "Photon elec-had Dphi correlation for 2<pt^{asso}<4 for |Eta > 0.8|",200,0,20,100,-1.57,4.71);
1473   fOutputList->Add(fPhotElecDphiEta21);
1474   fPhotElecDphiEta22 = new TH2F("fPhotElecDphiEta22", "Photon elec-had Dphi correlation for 4<pt^{asso}<6 for |Eta > 0.8|",200,0,20,100,-1.57,4.71);
1475   fOutputList->Add(fPhotElecDphiEta22);
1476   fPhotElecDphiEta23 = new TH2F("fPhotElecDphiEta23", "Photon elec-had Dphi correlation for 6<pt^{asso}<8 for |Eta > 0.8|",200,0,20,100,-1.57,4.71);
1477   fOutputList->Add(fPhotElecDphiEta23);
1478   fPhotElecDphiEta24 = new TH2F("fPhotElecDphiEta24", "Photon elec-had Dphi correlation for 4<pt^{asso}<10 for |Eta > 0.8|",200,0,20,100,-1.57,4.71);
1479   fOutputList->Add(fPhotElecDphiEta24);
1480   fInclusiveElecDphiEta2 = new TH2F("fInclusiveElecDphiEta2", "Inclusive elec-had Dphi correlation for |Eta > 0.8|",200,0,20,100,-1.57,4.71);
1481   fOutputList->Add(fInclusiveElecDphiEta2);
1482   fInclusiveElecDphiEta21 = new TH2F("fInclusiveElecDphiEta21", "Inclusive elec-had Dphi correlation for 2<pt^{asso}<4 for |Eta > 0.8|",200,0,20,100,-1.57,4.71);
1483   fOutputList->Add(fInclusiveElecDphiEta21);
1484   fInclusiveElecDphiEta22 = new TH2F("fInclusiveElecDphiEta22", "Inclusive elec-had Dphi correlation for 4<pt^{asso}<6 for |Eta > 0.8|",200,0,20,100,-1.57,4.71);
1485   fOutputList->Add(fInclusiveElecDphiEta22);
1486   fInclusiveElecDphiEta23 = new TH2F("fInclusiveElecDphiEta23", "Inclusive elec-had Dphi correlation for 6<pt^{asso}<8 for |Eta > 0.8|",200,0,20,100,-1.57,4.71);
1487   fOutputList->Add(fInclusiveElecDphiEta23);
1488   fInclusiveElecDphiEta24 = new TH2F("fInclusiveElecDphiEta24", "Inclusive elec-had Dphi correlation for 4<pt^{asso}<10 for |Eta > 0.8|",200,0,20,100,-1.57,4.71);
1489   fOutputList->Add(fInclusiveElecDphiEta24);
1490   fDphiULSMassLowEta2 = new TH2F("fDphiULSMassLowEta2", "e-h Dphi ULS, mass<cut for |Eta > 0.8|",200,0,20,100,-1.57,4.71);
1491   fOutputList->Add(fDphiULSMassLowEta2);
1492   fDphiULSMassLowEta21 = new TH2F("fDphiULSMassLowEta21", "e-h Dphi ULS, mass<cut for 2<pt^{asso}<4 for |Eta > 0.8|",200,0,20,100,-1.57,4.71);
1493   fOutputList->Add(fDphiULSMassLowEta21);
1494   fDphiULSMassLowEta22 = new TH2F("fDphiULSMassLowEta22", "e-h Dphi ULS, mass<cut for 4<pt^{asso}<6 for |Eta > 0.8|",200,0,20,100,-1.57,4.71);
1495   fOutputList->Add(fDphiULSMassLowEta22);
1496   fDphiULSMassLowEta23 = new TH2F("fDphiULSMassLowEta23", "e-h Dphi ULS, mass<cut for 6<pt^{asso}<8 for |Eta > 0.8|",200,0,20,100,-1.57,4.71);
1497   fOutputList->Add(fDphiULSMassLowEta23);
1498   fDphiULSMassLowEta24 = new TH2F("fDphiULSMassLowEta24", "e-h Dphi ULS, mass<cut for 4<pt^{asso}<10 for |Eta > 0.8|",200,0,20,100,-1.57,4.71);
1499   fOutputList->Add(fDphiULSMassLowEta24);
1500   fDphiLSMassLowEta2 = new TH2F("fDphiLSMassLowEta2", "e-h Dphi LS, mass<cut for |Eta > 0.8|",200,0,20,100,-1.57,4.71);
1501   fOutputList->Add(fDphiLSMassLowEta2);
1502   fDphiLSMassLowEta21 = new TH2F("fDphiLSMassLowEta21", "e-h Dphi LS, mass<cut for 2<pt^{asso}<4 for |Eta > 0.8|",200,0,20,100,-1.57,4.71);
1503   fOutputList->Add(fDphiLSMassLowEta21);
1504   fDphiLSMassLowEta22 = new TH2F("fDphiLSMassLowEta22", "e-h Dphi LS, mass<cut for 4<pt^{asso}<6 for |Eta > 0.8|",200,0,20,100,-1.57,4.71);
1505   fOutputList->Add(fDphiLSMassLowEta22);
1506   fDphiLSMassLowEta23 = new TH2F("fDphiLSMassLowEta23", "e-h Dphi LS, mass<cut for 6<pt^{asso}<8 for |Eta > 0.8|",200,0,20,100,-1.57,4.71);
1507   fOutputList->Add(fDphiLSMassLowEta23);
1508   fDphiLSMassLowEta24 = new TH2F("fDphiLSMassLowEta24", "e-h Dphi LS, mass<cut for 4<pt^{asso}<10 for |Eta > 0.8|",200,0,20,100,-1.57,4.71);
1509   fOutputList->Add(fDphiLSMassLowEta24);  
1510   fDphiULSMassLowNoPartnerEta2 = new TH2F("fDphiULSMassLowNoPartnerEta2", "e-h Dphi ULS with no partner, mass<mass cut, for |Eta > 0.8|",200,0,20,100,-1.57,4.71);
1511   fOutputList->Add(fDphiULSMassLowNoPartnerEta2);
1512   fDphiULSMassLowNoPartnerEta21 = new TH2F("fDphiULSMassLowNoPartnerEta21", "e-h Dphi ULS with no partner, mass<mass cut for 2<pt^{asso}<4, for |Eta > 0.8|",200,0,20,100,-1.57,4.71);
1513   fOutputList->Add(fDphiULSMassLowNoPartnerEta21);
1514   fDphiULSMassLowNoPartnerEta22 = new TH2F("fDphiULSMassLowNoPartnerEta22", "e-h Dphi ULS with no partner, mass<mass cut for 4<pt^{asso}<6, for |Eta > 0.8|",200,0,20,100,-1.57,4.71);
1515   fOutputList->Add(fDphiULSMassLowNoPartnerEta22);
1516   fDphiULSMassLowNoPartnerEta23 = new TH2F("fDphiULSMassLowNoPartnerEta23", "e-h Dphi ULS with no partner, mass<mass cut for 6<pt^{asso}<8, for |Eta > 0.8|",200,0,20,100,-1.57,4.71);
1517   fOutputList->Add(fDphiULSMassLowNoPartnerEta23);
1518   fDphiULSMassLowNoPartnerEta24 = new TH2F("fDphiULSMassLowNoPartnerEta24", "e-h Dphi ULS with no partner, mass<mass cut for 4<pt^{asso}<10, for |Eta > 0.8|",200,0,20,100,-1.57,4.71);
1519   fOutputList->Add(fDphiULSMassLowNoPartnerEta24);
1520   fDphiLSMassLowNoPartnerEta2 = new TH2F("fDphiLSMassLowNoPartnerEta2", "e-h Dphi LS with no partner, mass<mass cut, for |Eta > 0.8|",200,0,20,100,-1.57,4.71);
1521   fOutputList->Add(fDphiLSMassLowNoPartnerEta2);
1522   fDphiLSMassLowNoPartnerEta21 = new TH2F("fDphiLSMassLowNoPartnerEta21", "e-h Dphi LS with no partner, mass<mass cut for 2<pt^{asso}<4, for |Eta > 0.8|",200,0,20,100,-1.57,4.71);  
1523   fOutputList->Add(fDphiLSMassLowNoPartnerEta21);
1524   fDphiLSMassLowNoPartnerEta22 = new TH2F("fDphiLSMassLowNoPartnerEta22", "e-h Dphi LS with no partner, mass<mass cut for 4<pt^{asso}<6, for |Eta > 0.8|",200,0,20,100,-1.57,4.71);
1525   fOutputList->Add(fDphiLSMassLowNoPartnerEta22);  
1526   fDphiLSMassLowNoPartnerEta23 = new TH2F("fDphiLSMassLowNoPartnerEta23", "e-h Dphi LS with no partner, mass<mass cut for 6<pt^{asso}<8, for |Eta > 0.8|",200,0,20,100,-1.57,4.71);
1527   fOutputList->Add(fDphiLSMassLowNoPartnerEta23);
1528   fDphiLSMassLowNoPartnerEta24 = new TH2F("fDphiLSMassLowNoPartnerEta24", "e-h Dphi LS with no partner, mass<mass cut for 4<pt^{asso}<10, for |Eta > 0.8|",200,0,20,100,-1.57,4.71);  
1529   fOutputList->Add(fDphiLSMassLowNoPartnerEta24);
1530
1531   /*  fNCellv1 = new TH1F("fNCellv1","Ncell in clus (v1); NCell; count",100,0,100) ;
1532       fOutputList->Add(fNCellv1);
1533
1534       fClsEv1 = new TH1F("fClsEv1", "Clus E(v1); Cls E; count",1000,0,100); 
1535       fOutputList->Add(fClsEv1); 
1536
1537       fNClusv1 = new TH1F("fNClusv1","Nclus in event (v1); NClus; count",500,0,500) ; 
1538       fOutputList->Add(fNClusv1);
1539    */
1540   fInvmassLS1 = new TH1F("fInvmassLS1", "Inv mass of LS (e,e) for pt^{e}>2; mass(GeV/c^2); counts;", 1000,0,1.0);
1541   fOutputList->Add(fInvmassLS1);
1542
1543   fInvmassULS1 = new TH1F("fInvmassULS1", "Inv mass of ULS (e,e) for pt^{e}>2; mass(GeV/c^2); counts;", 1000,0,1.0);
1544   fOutputList->Add(fInvmassULS1);
1545
1546   fDCAMetInvmassLS1 = new TH1F("fDCAMetInvmassLS1", "Inv mass of LS (e,e) for pt^{e}>2; mass(GeV/c^2); counts;", 1000,0,1.0);
1547   fOutputList->Add(fDCAMetInvmassLS1);
1548
1549   fDCAMetInvmassULS1 = new TH1F("fDCAMetInvmassULS1", "Inv mass of ULS (e,e) for pt^{e}>2; mass(GeV/c^2); counts;", 1000,0,1.0);
1550   fOutputList->Add(fDCAMetInvmassULS1);
1551   /*
1552      fInvmassLS2 = new TH1F("fInvmassLS2", "Inv mass of LS (e,e) for pt^{e}>1; mass(GeV/c^2); counts;", 1000,0,1.0);
1553      fOutputList->Add(fInvmassLS2);
1554
1555      fInvmassULS2 = new TH1F("fInvmassULS2", "Inv mass of ULS (e,e) for pt^{e}>1; mass(GeV/c^2); counts;", 1000,0,1.0);
1556      fOutputList->Add(fInvmassULS2);
1557
1558      fInvmassLS3 = new TH1F("fInvmassLS3", "Inv mass of LS (e,e) for pt^{e}>2; mass(GeV/c^2); counts;", 1000,0,1.0);
1559      fOutputList->Add(fInvmassLS3);                                                          
1560
1561      fInvmassULS3 = new TH1F("fInvmassULS3", "Inv mass of ULS (e,e) for pt^{e}>2; mass(GeV/c^2); counts;", 1000,0,1.0);
1562      fOutputList->Add(fInvmassULS3);
1563
1564      fInvmassLS4 = new TH1F("fInvmassLS4", "Inv mass of LS (e,e) for pt^{e}>3; mass(GeV/c^2); counts;", 1000,0,1.0);
1565      fOutputList->Add(fInvmassLS4);  
1566
1567      fInvmassULS4 = new TH1F("fInvmassULS4", "Inv mass of ULS (e,e) for pt^{e}>3; mass(GeV/c^2); counts;", 1000,0,1.0);
1568      fOutputList->Add(fInvmassULS4);
1569
1570      fInvmassLS5 = new TH1F("fInvmassLS5", "Inv mass of LS (e,e) for pt^{e}>4; mass(GeV/c^2); counts;", 1000,0,1.0);
1571      fOutputList->Add(fInvmassLS5);  
1572
1573      fInvmassULS5 = new TH1F("fInvmassULS5", "Inv mass of ULS (e,e) for pt^{e}>4; mass(GeV/c^2); counts;", 1000,0,1.0);
1574      fOutputList->Add(fInvmassULS5);
1575    */
1576   fNoMixedEvents = new TH1F("fNoMixedEvents","",1,0,1) ;
1577   fOutputList->Add(fNoMixedEvents);
1578
1579   fMixStat = new TH2F("fMixStat","no of events in pool  vs Centrality;Nevent in pool;Centrality",200,0,200,5,0,10);
1580   fOutputList->Add(fMixStat);                                                             
1581
1582   fMixStat1 = new TH2F("fMixStat1","no of events in pool  vs zvtx;Nevents in pool;zvtx",200,0,200,4,-10,10);
1583   fOutputList->Add(fMixStat1);
1584
1585   fMixedIncElecDphi = new TH2F("fMixedIncElecDphi", "Mixed event - Inclusive elec-had Dphi correlation",200,0,20,100,-1.57,4.71);
1586   fOutputList->Add(fMixedIncElecDphi);
1587
1588   fMixedIncElecDphi1 = new TH2F("fMixedIncElecDphi1", "Mixed event - Inclusive elec-had Dphi correlation 2<pt<4",200,0,20,100,-1.57,4.71);
1589   fOutputList->Add(fMixedIncElecDphi1);
1590
1591   fMixedIncElecDphi2 = new TH2F("fMixedIncElecDphi2", "Mixed event - Inclusive elec-had Dphi correlation 4<pt<6",200,0,20,100,-1.57,4.71);
1592   fOutputList->Add(fMixedIncElecDphi2);
1593
1594   fMixedIncElecDphi3 = new TH2F("fMixedIncElecDphi3", "Mixed event - Inclusive elec-had Dphi correlation 6<pt<8",200,0,20,100,-1.57,4.71);
1595   fOutputList->Add(fMixedIncElecDphi3);
1596
1597   fMixedIncElecDphi4 = new TH2F("fMixedIncElecDphi4", "Mixed event - Inclusive elec-had Dphi correlation 4<pt<10",200,0,20,100,-1.57,4.71);
1598   fOutputList->Add(fMixedIncElecDphi4);
1599
1600   fMixedSemiIncElecDphi = new TH2F("fMixedSemiIncElecDphi", "Mixed event - Semi Inclusive elec-had Dphi correlation",200,0,20,100,-1.57,4.71);
1601   fOutputList->Add(fMixedSemiIncElecDphi);
1602
1603   fMixedSemiIncElecDphi1 = new TH2F("fMixedSemiIncElecDphi1", "Mixed event - Semi Inclusive elec-had Dphi correlation 2<pt<4",200,0,20,100,-1.57,4.71);
1604   fOutputList->Add(fMixedSemiIncElecDphi1);
1605
1606   fMixedSemiIncElecDphi2 = new TH2F("fMixedSemiIncElecDphi2", "Mixed event - Semi Inclusive elec-had Dphi correlation 4<pt<6",200,0,20,100,-1.57,4.71);
1607   fOutputList->Add(fMixedSemiIncElecDphi2);
1608
1609   fMixedSemiIncElecDphi3 = new TH2F("fMixedSemiIncElecDphi3", "Mixed event - Semi Inclusive elec-had Dphi correlation 6<pt<8",200,0,20,100,-1.57,4.71);
1610   fOutputList->Add(fMixedSemiIncElecDphi3);
1611
1612   fMixedSemiIncElecDphi4 = new TH2F("fMixedSemiIncElecDphi4", "Mixed event - Semi Inclusive elec-had Dphi correlation 4<pt<10",200,0,20,100,-1.57,4.71);
1613   fOutputList->Add(fMixedSemiIncElecDphi4);
1614
1615   fMixedPhotElecDphi = new TH2F("fMixedPhotElecDphi", "Mixed event - Photo elec-had Dphi correlation",200,0,20,100,-1.57,4.71);
1616   fOutputList->Add(fMixedPhotElecDphi);
1617
1618   fMixedPhotElecDphi1 = new TH2F("fMixedPhotElecDphi1", "Mixed event - Photo elec-had Dphi correlation 2<pt<4",200,0,20,100,-1.57,4.71);
1619   fOutputList->Add(fMixedPhotElecDphi1);
1620
1621   fMixedPhotElecDphi2 = new TH2F("fMixedPhotElecDphi2", "Mixed event - Photo elec-had Dphi correlation 4<pt<6",200,0,20,100,-1.57,4.71);
1622   fOutputList->Add(fMixedPhotElecDphi2);
1623
1624   fMixedPhotElecDphi3 = new TH2F("fMixedPhotElecDphi3", "Mixed event - Photo elec-had Dphi correlation 6<pt<8",200,0,20,100,-1.57,4.71);
1625   fOutputList->Add(fMixedPhotElecDphi3);
1626
1627   fMixedPhotElecDphi4 = new TH2F("fMixedPhotElecDphi4", "Mixed event - Photo elec-had Dphi correlation 4<pt<10",200,0,20,100,-1.57,4.71);
1628   fOutputList->Add(fMixedPhotElecDphi4);
1629
1630   fMixedDphiULSMassLow = new TH2F("fMixedDphiULSMassLow", "Mixed event - ULS mass < cut elec-had Dphi correlation",200,0,20,100,-1.57,4.71);
1631   fOutputList->Add(fMixedDphiULSMassLow);
1632
1633   fMixedDphiULSMassLow1 = new TH2F("fMixedDphiULSMassLow1", "Mixed event - ULS mass < cut elec-had Dphi correlation 2<pt<4",200,0,20,100,-1.57,4.71);
1634   fOutputList->Add(fMixedDphiULSMassLow1);
1635
1636   fMixedDphiULSMassLow2 = new TH2F("fMixedDphiULSMassLow2", "Mixed event - ULS mass < cut elec-had Dphi correlation 4<pt<6",200,0,20,100,-1.57,4.71);
1637   fOutputList->Add(fMixedDphiULSMassLow2);
1638
1639   fMixedDphiULSMassLow3 = new TH2F("fMixedDphiULSMassLow3", "Mixed event - ULS mass < cut elec-had Dphi correlation 6<pt<8",200,0,20,100,-1.57,4.71);
1640   fOutputList->Add(fMixedDphiULSMassLow3);
1641
1642   fMixedDphiULSMassLow4 = new TH2F("fMixedDphiULSMassLow4", "Mixed event - ULS mass < cut elec-had Dphi correlation 4<pt<10",200,0,20,100,-1.57,4.71);
1643   fOutputList->Add(fMixedDphiULSMassLow4);
1644
1645   fMixedDphiLSMassLow = new TH2F("fMixedDphiLSMassLow", "Mixed event - LS mass < cut elec-had Dphi correlation",200,0,20,100,-1.57,4.71);
1646   fOutputList->Add(fMixedDphiLSMassLow);
1647
1648   fMixedDphiLSMassLow1 = new TH2F("fMixedDphiLSMassLow1", "Mixed event - LS mass < cut elec-had Dphi correlation 2<pt<4",200,0,20,100,-1.57,4.71);
1649   fOutputList->Add(fMixedDphiLSMassLow1);
1650
1651   fMixedDphiLSMassLow2 = new TH2F("fMixedDphiLSMassLow2", "Mixed event - LS mass < cut elec-had Dphi correlation 4<pt<6",200,0,20,100,-1.57,4.71);
1652   fOutputList->Add(fMixedDphiLSMassLow2);
1653
1654   fMixedDphiLSMassLow3 = new TH2F("fMixedDphiLSMassLow3", "Mixed event - LS mass < cut elec-had Dphi correlation 6<pt<8",200,0,20,100,-1.57,4.71);
1655   fOutputList->Add(fMixedDphiLSMassLow3);
1656
1657   fMixedDphiLSMassLow4 = new TH2F("fMixedDphiLSMassLow4", "Mixed event - LS mass < cut elec-had Dphi correlation 4<pt<10",200,0,20,100,-1.57,4.71);
1658   fOutputList->Add(fMixedDphiLSMassLow4);
1659
1660   fDCAMetMixedPhotElecDphi = new TH2F("fDCAMetMixedPhotElecDphi", "Mixed event - Photo elec-had Dphi correlation",200,0,20,100,-1.57,4.71);
1661   fOutputList->Add(fDCAMetMixedPhotElecDphi);
1662
1663   fDCAMetMixedPhotElecDphi1 = new TH2F("fDCAMetMixedPhotElecDphi1", "Mixed event - Photo elec-had Dphi correlation 2<pt<4",200,0,20,100,-1.57,4.71);
1664   fOutputList->Add(fDCAMetMixedPhotElecDphi1);
1665
1666   fDCAMetMixedPhotElecDphi2 = new TH2F("fDCAMetMixedPhotElecDphi2", "Mixed event - Photo elec-had Dphi correlation 4<pt<6",200,0,20,100,-1.57,4.71);
1667   fOutputList->Add(fDCAMetMixedPhotElecDphi2);
1668
1669   fDCAMetMixedPhotElecDphi3 = new TH2F("fDCAMetMixedPhotElecDphi3", "Mixed event - Photo elec-had Dphi correlation 6<pt<8",200,0,20,100,-1.57,4.71);
1670   fOutputList->Add(fDCAMetMixedPhotElecDphi3);
1671
1672   fDCAMetMixedPhotElecDphi4 = new TH2F("fDCAMetMixedPhotElecDphi4", "Mixed event - Photo elec-had Dphi correlation 4<pt<10",200,0,20,100,-1.57,4.71);
1673   fOutputList->Add(fDCAMetMixedPhotElecDphi4);
1674
1675   fDCAMetMixedDphiULSMassLow = new TH2F("fDCAMetMixedDphiULSMassLow", "Mixed event - ULS mass < cut elec-had Dphi correlation",200,0,20,100,-1.57,4.71);
1676   fOutputList->Add(fDCAMetMixedDphiULSMassLow);
1677
1678   fDCAMetMixedDphiULSMassLow1 = new TH2F("fDCAMetMixedDphiULSMassLow1", "Mixed event - ULS mass < cut elec-had Dphi correlation 2<pt<4",200,0,20,100,-1.57,4.71);
1679   fOutputList->Add(fDCAMetMixedDphiULSMassLow1);
1680
1681   fDCAMetMixedDphiULSMassLow2 = new TH2F("fDCAMetMixedDphiULSMassLow2", "Mixed event - ULS mass < cut elec-had Dphi correlation 4<pt<6",200,0,20,100,-1.57,4.71);
1682   fOutputList->Add(fDCAMetMixedDphiULSMassLow2);
1683
1684   fDCAMetMixedDphiULSMassLow3 = new TH2F("fDCAMetMixedDphiULSMassLow3", "Mixed event - ULS mass < cut elec-had Dphi correlation 6<pt<8",200,0,20,100,-1.57,4.71);
1685   fOutputList->Add(fDCAMetMixedDphiULSMassLow3);
1686
1687   fDCAMetMixedDphiULSMassLow4 = new TH2F("fDCAMetMixedDphiULSMassLow4", "Mixed event - ULS mass < cut elec-had Dphi correlation 4<pt<10",200,0,20,100,-1.57,4.71);
1688   fOutputList->Add(fDCAMetMixedDphiULSMassLow4);
1689
1690   fDCAMetMixedDphiLSMassLow = new TH2F("fDCAMetMixedDphiLSMassLow", "Mixed event - LS mass < cut elec-had Dphi correlation",200,0,20,100,-1.57,4.71);
1691   fOutputList->Add(fDCAMetMixedDphiLSMassLow);
1692
1693   fDCAMetMixedDphiLSMassLow1 = new TH2F("fDCAMetMixedDphiLSMassLow1", "Mixed event - LS mass < cut elec-had Dphi correlation 2<pt<4",200,0,20,100,-1.57,4.71);
1694   fOutputList->Add(fDCAMetMixedDphiLSMassLow1);
1695
1696   fDCAMetMixedDphiLSMassLow2 = new TH2F("fDCAMetMixedDphiLSMassLow2", "Mixed event - LS mass < cut elec-had Dphi correlation 4<pt<6",200,0,20,100,-1.57,4.71);
1697   fOutputList->Add(fDCAMetMixedDphiLSMassLow2);
1698
1699   fDCAMetMixedDphiLSMassLow3 = new TH2F("fDCAMetMixedDphiLSMassLow3", "Mixed event - LS mass < cut elec-had Dphi correlation 6<pt<8",200,0,20,100,-1.57,4.71);
1700   fOutputList->Add(fDCAMetMixedDphiLSMassLow3);
1701
1702   fDCAMetMixedDphiLSMassLow4 = new TH2F("fDCAMetMixedDphiLSMassLow4", "Mixed event - LS mass < cut elec-had Dphi correlation 4<pt<10",200,0,20,100,-1.57,4.71);
1703   fOutputList->Add(fDCAMetMixedDphiLSMassLow4);
1704
1705   fHadronPt = new TH1F("fHadronPt","hadron pt distribution",1000,0,100);
1706   fOutputList->Add(fHadronPt);
1707
1708   fCentralityPass = new TH1F("fCentralityPass", "Centrality Pass", 101, -1, 100);
1709   fOutputList->Add(fCentralityPass);
1710
1711   fCentralityNoPass = new TH1F("fCentralityNoPass", "Centrality No Pass", 101, -1, 100);
1712   fOutputList->Add(fCentralityNoPass);
1713
1714   fHadronDphi = new TH2F("fHadronDphi", "Hadron-had Dphi correlation",200,0,20,64,-1.57,4.71);
1715   fOutputList->Add(fHadronDphi);
1716
1717   fHadronDphi1 = new TH2F("fHadronDphi1", "Hadron-had Dphi correlation for 2<pt^{asso}<4",200,0,20,64,-1.57,4.71);
1718   fOutputList->Add(fHadronDphi1);
1719
1720   fHadronDphi2 = new TH2F("fHadronDphi2", "Hadron-had Dphi correlation for 4<pt^{asso}<6",200,0,20,64,-1.57,4.71);
1721   fOutputList->Add(fHadronDphi2);
1722
1723   fHadronDphi3 = new TH2F("fHadronDphi3", "Hadron-had Dphi correlation for 6<pt^{asso}<8",200,0,20,64,-1.57,4.71);
1724   fOutputList->Add(fHadronDphi3);
1725
1726   fHadronDphi4 = new TH2F("fHadronDphi4", "Hadron-had Dphi correlation for 4<pt^{asso}<10",200,0,20,64,-1.57,4.71);
1727   fOutputList->Add(fHadronDphi4);
1728
1729   fPiPt = new TH1F("fPiPt","Pi (-10 <TPC nsig < -3.5) pt distribution",1000,0,100);
1730   fOutputList->Add(fPiPt);
1731
1732   fHadronDphiNoSS = new TH2F("fHadronDphiNoSS", "Hadron-had Dphi correlation (NoSS cuts)",200,0,20,100,-1.57,4.71);
1733   fOutputList->Add(fHadronDphiNoSS);
1734
1735   fHadronDphiNoSS1 = new TH2F("fHadronDphiNoSS1", "Hadron-had Dphi correlation (NoSS cuts) for 2<pt^{asso}<4",200,0,20,100,-1.57,4.71);
1736   fOutputList->Add(fHadronDphiNoSS1);
1737
1738   fHadronDphiNoSS2 = new TH2F("fHadronDphiNoSS2", "Hadron-had Dphi correlation (NoSS cuts) for 4<pt^{asso}<6",200,0,20,100,-1.57,4.71);
1739   fOutputList->Add(fHadronDphiNoSS2);
1740
1741   fHadronDphiNoSS3 = new TH2F("fHadronDphiNoSS3", "Hadron-had Dphi correlation (NoSS cuts) for 6<pt^{asso}<8",200,0,20,100,-1.57,4.71);
1742   fOutputList->Add(fHadronDphiNoSS3);
1743
1744   fHadronDphiNoSS4 = new TH2F("fHadronDphiNoSS4", "Hadron-had Dphi correlation (NoSS cuts) for 4<pt^{asso}<10",200,0,20,100,-1.57,4.71);
1745   fOutputList->Add(fHadronDphiNoSS4);
1746
1747   fPiPtNoSS = new TH1F("fPiPtNoSS","Pi (-10 <TPC nsig < -3.5) (NoSS cuts) pt distribution",1000,0,100);
1748   fOutputList->Add(fPiPtNoSS);
1749
1750   fEovPWoSS = new TH2F("fEovPWoSS","E/p distribution without SS cuts",1000,0,50,100,0,2);
1751   fOutputList->Add(fEovPWoSS);
1752
1753   fEovPWSS = new TH2F("fEovPWSS","E/p distribution with SS cuts",1000,0,50,100,0,2);
1754   fOutputList->Add(fEovPWSS);
1755
1756   fEovPHadWoSS = new TH2F("fEovPHadWoSS","E/p distribution for hadrons without SS cuts",1000,0,50,100,0,2);
1757   fOutputList->Add(fEovPHadWoSS);
1758
1759   fEovPHadWSS = new TH2F("fEovPHadWSS","E/p distribution for hadrons with SS cuts",1000,0,50,100,0,2);
1760   fOutputList->Add(fEovPHadWSS);
1761
1762   fHadronDphiEta1 = new TH2F("fHadronDphiEta1", "Hadron-had Dphi correlation for |Eta <1|",200,0,20,100,-1.57,4.71);
1763   fOutputList->Add(fHadronDphiEta1);
1764   fHadronDphiEta11 = new TH2F("fHadronDphiEta11", "Hadron-had Dphi correlation for 2<pt^{asso}<4 for |Eta <1|",200,0,20,100,-1.57,4.71);
1765   fOutputList->Add(fHadronDphiEta11);
1766   fHadronDphiEta12 = new TH2F("fHadronDphiEta12", "Hadron-had Dphi correlation for 4<pt^{asso}<6 for |Eta <1|",200,0,20,100,-1.57,4.71);
1767   fOutputList->Add(fHadronDphiEta12);
1768   fHadronDphiEta13 = new TH2F("fHadronDphiEta13", "Hadron-had Dphi correlation for 6<pt^{asso}<8 for |Eta <1|",200,0,20,100,-1.57,4.71);
1769   fOutputList->Add(fHadronDphiEta13);
1770   fHadronDphiEta14 = new TH2F("fHadronDphiEta14", "Hadron-had Dphi correlation for 8<pt^{asso}<10 for |Eta <1|",200,0,20,100,-1.57,4.71);
1771   fOutputList->Add(fHadronDphiEta14);
1772
1773   fHadronDphiNoSSEta1 = new TH2F("fHadronDphiNoSSEta1", "Hadron-had DphiNoSS correlation for |Eta <1|",200,0,20,100,-1.57,4.71);
1774   fOutputList->Add(fHadronDphiNoSSEta1);
1775   fHadronDphiNoSSEta11 = new TH2F("fHadronDphiNoSSEta11", "Hadron-had DphiNoSS correlation for 2<pt^{asso}<4 for |Eta <1|",200,0,20,100,-1.57,4.71);
1776   fOutputList->Add(fHadronDphiNoSSEta11);
1777   fHadronDphiNoSSEta12 = new TH2F("fHadronDphiNoSSEta12", "Hadron-had DphiNoSS correlation for 4<pt^{asso}<6 for |Eta <1|",200,0,20,100,-1.57,4.71);
1778   fOutputList->Add(fHadronDphiNoSSEta12);
1779   fHadronDphiNoSSEta13 = new TH2F("fHadronDphiNoSSEta13", "Hadron-had DphiNoSS correlation for 6<pt^{asso}<8 for |Eta <1|",200,0,20,100,-1.57,4.71);
1780   fOutputList->Add(fHadronDphiNoSSEta13);
1781   fHadronDphiNoSSEta14 = new TH2F("fHadronDphiNoSSEta14", "Hadron-had DphiNoSS correlation for 4<pt^{asso}<10 for |Eta <1|",200,0,20,100,-1.57,4.71);
1782   fOutputList->Add(fHadronDphiNoSSEta14);
1783
1784   fHadronDphiEta2 = new TH2F("fHadronDphiEta2", "Hadron-had Dphi correlation for |Eta >1|",200,0,20,100,-1.57,4.71);
1785   fOutputList->Add(fHadronDphiEta2);
1786   fHadronDphiEta21 = new TH2F("fHadronDphiEta21", "Hadron-had Dphi correlation for 2<pt^{asso}<4 for |Eta >1|",200,0,20,100,-1.57,4.71);
1787   fOutputList->Add(fHadronDphiEta21);
1788   fHadronDphiEta22 = new TH2F("fHadronDphiEta22", "Hadron-had Dphi correlation for 4<pt^{asso}<6 for |Eta >1|",200,0,20,100,-1.57,4.71);
1789   fOutputList->Add(fHadronDphiEta22);
1790   fHadronDphiEta23 = new TH2F("fHadronDphiEta23", "Hadron-had Dphi correlation for 6<pt^{asso}<8 for |Eta >1|",200,0,20,100,-1.57,4.71);
1791   fOutputList->Add(fHadronDphiEta23);
1792   fHadronDphiEta24 = new TH2F("fHadronDphiEta24", "Hadron-had Dphi correlation for 4<pt^{asso}<10 for |Eta >1|",200,0,20,100,-1.57,4.71);
1793   fOutputList->Add(fHadronDphiEta24);
1794
1795   fHadronDphiNoSSEta2 = new TH2F("fHadronDphiNoSSEta2", "Hadron-had DphiNoSS correlation for |Eta >1|",200,0,20,100,-1.57,4.71);
1796   fOutputList->Add(fHadronDphiNoSSEta2);
1797   fHadronDphiNoSSEta21 = new TH2F("fHadronDphiNoSSEta21", "Hadron-had DphiNoSS correlation for 2<pt^{asso}<4 for |Eta >1|",200,0,20,100,-1.57,4.71);
1798   fOutputList->Add(fHadronDphiNoSSEta21);
1799   fHadronDphiNoSSEta22 = new TH2F("fHadronDphiNoSSEta22", "Hadron-had DphiNoSS correlation for 4<pt^{asso}<6 for |Eta >1|",200,0,20,100,-1.57,4.71);
1800   fOutputList->Add(fHadronDphiNoSSEta22);
1801   fHadronDphiNoSSEta23 = new TH2F("fHadronDphiNoSSEta23", "Hadron-had DphiNoSS correlation for 6<pt^{asso}<8 for |Eta >1|",200,0,20,100,-1.57,4.71);
1802   fOutputList->Add(fHadronDphiNoSSEta23);
1803   fHadronDphiNoSSEta24 = new TH2F("fHadronDphiNoSSEta24", "Hadron-had DphiNoSS correlation for 4<pt^{asso}<10 for |Eta >1|",200,0,20,100,-1.57,4.71);
1804   fOutputList->Add(fHadronDphiNoSSEta24);
1805
1806
1807   //  Int_t binsv1[6]={500,200,50,50,50,50}; //pt, TPCnsig, E/p, M20, M02, dispersion 
1808   //  Double_t xminv1[6]={0,-10,0,0,0,0};
1809   //  Double_t xmaxv1[6]={25,10,2,2,2,2};
1810   //  fSparseElectron = new THnSparseD ("Electron","Electron",6,binsv1,xminv1,xmaxv1);
1811   //  fOutputList->Add(fSparseElectron);
1812
1813   PostData(1,fOutputList);
1814 }
1815
1816 //________________________________________________________________________
1817 void AliAnalysisTaskElecHadronCorrel::Terminate(Option_t *)
1818 {
1819   // Info("Terminate");
1820   AliAnalysisTaskSE::Terminate();
1821 }
1822
1823 //________________________________________________________________________
1824 Bool_t AliAnalysisTaskElecHadronCorrel::ProcessCutStep(Int_t cutStep, AliVParticle *track)
1825 {
1826   // Check single track cuts for a given cut step
1827   const Int_t kMCOffset = AliHFEcuts::kNcutStepsMCTrack;
1828   if(!fCFM->CheckParticleCuts(cutStep + kMCOffset, track)) return kFALSE;
1829   return kTRUE;
1830 }
1831
1832 //_________________________________________
1833 void AliAnalysisTaskElecHadronCorrel::SelectPhotonicElectronDCAMet(Int_t itrack, AliVTrack *track, AliPIDResponse *pidResponse)
1834 {
1835     //Identify non-heavy flavour electrons using Invariant mass method using DCA method
1836   fNonHFE = new AliSelectNonHFE();
1837   fNonHFE->SetAODanalysis(kTRUE);
1838   fNonHFE->SetInvariantMassCut(fInvmassCut);
1839   fNonHFE->SetAlgorithm("DCA"); //KF
1840   fNonHFE->SetPIDresponse(pidResponse);
1841   fNonHFE->SetTrackCuts(-3,3);
1842
1843   fNonHFE->SetHistMassBack(fDCAMetInvmassLS1);
1844   fNonHFE->SetHistMass(fDCAMetInvmassULS1);
1845
1846   fNonHFE->FindNonHFE(itrack,track,fVevent);
1847
1848   Int_t *fULSPartner = fNonHFE->GetPartnersULS();
1849   Int_t *fLSPartner = fNonHFE->GetPartnersLS();
1850   Int_t fNULS = fNonHFE->GetNULS();
1851   Int_t fNLS = fNonHFE->GetNLS();
1852
1853   if(fNonHFE->IsULS()){
1854     for(Int_t k =0; k< fNonHFE->GetNULS(); k++){
1855       fDCAMetULSElecPt->Fill(track->Pt());
1856
1857       ElectronHadCorrel(itrack,track,fDCAMetDphiULSMassLow, fDCAMetDphiULSMassLow1,fDCAMetDphiULSMassLow2,fDCAMetDphiULSMassLow3,fDCAMetDphiULSMassLow4);
1858
1859       ElectronHadCorrelNoPartnerDCAMet(itrack,track, fULSPartner, fNULS,fDCAMetDphiULSMassLowNoPartner, fDCAMetDphiULSMassLowNoPartner1,fDCAMetDphiULSMassLowNoPartner2,fDCAMetDphiULSMassLowNoPartner3,fDCAMetDphiULSMassLowNoPartner4);
1860
1861       MixedEvent(track,fDCAMetMixedDphiULSMassLow,fDCAMetMixedDphiULSMassLow1,fDCAMetMixedDphiULSMassLow2, fDCAMetMixedDphiULSMassLow3, fDCAMetMixedDphiULSMassLow4);
1862     }
1863   }
1864
1865   if(fNonHFE->IsLS()){
1866     for(Int_t k=0; k < fNonHFE->GetNLS(); k++){
1867       fDCAMetLSElecPt->Fill(track->Pt());
1868
1869       ElectronHadCorrel(itrack,track,fDCAMetDphiLSMassLow,fDCAMetDphiLSMassLow1,fDCAMetDphiLSMassLow2,fDCAMetDphiLSMassLow3,fDCAMetDphiLSMassLow4);
1870
1871       ElectronHadCorrelNoPartnerDCAMet(itrack,track,fLSPartner, fNLS,fDCAMetDphiLSMassLowNoPartner, fDCAMetDphiLSMassLowNoPartner1,fDCAMetDphiLSMassLowNoPartner2,fDCAMetDphiLSMassLowNoPartner3,fDCAMetDphiLSMassLowNoPartner4);
1872
1873       MixedEvent(track,fDCAMetMixedDphiLSMassLow,fDCAMetMixedDphiLSMassLow1,fDCAMetMixedDphiLSMassLow2, fDCAMetMixedDphiLSMassLow3, fDCAMetMixedDphiLSMassLow4);
1874     }
1875   }
1876 }
1877 //_________________________________________
1878 void AliAnalysisTaskElecHadronCorrel::SelectPhotonicElectron(Int_t itrack, AliVTrack *track, Bool_t &fFlagPhotonicElec)
1879 {
1880   //Identify non-heavy flavour electrons using Invariant mass method
1881
1882   fTrackCuts1->SetAcceptKinkDaughters(kFALSE);
1883   fTrackCuts1->SetRequireTPCRefit(kTRUE);
1884   fTrackCuts1->SetRequireITSRefit(fAssoEleITSref);
1885   fTrackCuts1->SetEtaRange(-0.9,0.9);
1886   fTrackCuts1->SetRequireSigmaToVertex(kTRUE);
1887   fTrackCuts1->SetMaxChi2PerClusterTPC(4);
1888   fTrackCuts1->SetMinNClustersTPC(fAssoElecTPCNCls);
1889   fTrackCuts1->SetMaxDCAToVertexZ(3.2);
1890   fTrackCuts1->SetMaxDCAToVertexXY(2.4);
1891   fTrackCuts1->SetDCAToVertex2D(kTRUE);
1892
1893   Bool_t flagPhotonicElec = kFALSE;
1894
1895   for(Int_t jTracks = 0; jTracks<fVevent->GetNumberOfTracks(); jTracks++){
1896     AliVParticle* VtrackAsso = fVevent->GetTrack(jTracks);
1897     if (!VtrackAsso) {
1898       printf("ERROR: Could not receive track %d\n", jTracks);
1899       continue;
1900     }
1901
1902     AliVTrack *trackAsso = dynamic_cast<AliVTrack*>(VtrackAsso);
1903     if(!trackAsso) continue;
1904
1905     //track cuts applied
1906     if(IsAODanalysis()) { 
1907       AliAODTrack *atrackAsso = dynamic_cast<AliAODTrack*>(VtrackAsso);
1908       if(!atrackAsso) continue;
1909       if(!atrackAsso->TestFilterMask(AliAODTrack::kTrkTPCOnly)) continue;
1910       if(atrackAsso->GetTPCNcls() < fAssoElecTPCNCls) continue;
1911       if(!(atrackAsso->GetStatus()&AliESDtrack::kTPCrefit)) continue;
1912
1913       if(fAssoEleITSref){
1914         if(!(atrackAsso->GetStatus()&AliESDtrack::kITSrefit)) continue;
1915       }
1916     }
1917     else{
1918       AliESDtrack *etrackAsso = dynamic_cast<AliESDtrack*>(VtrackAsso);
1919       if(!etrackAsso) continue;
1920       if(!fTrackCuts1->AcceptTrack(etrackAsso)) continue;
1921     }
1922
1923     if(jTracks==itrack) continue;
1924
1925     Double_t dEdxAsso = -999., ptAsso=-999., nsigma=-999.0;
1926     Double_t mass=-999., width = -999;
1927     Bool_t fFlagLS=kFALSE, fFlagULS=kFALSE;
1928
1929     dEdxAsso = trackAsso->GetTPCsignal();
1930     nsigma = fPID->GetPIDResponse() ? fPID->GetPIDResponse()->NumberOfSigmasTPC(trackAsso, AliPID::kElectron) : 1000;
1931     ptAsso = trackAsso->Pt();
1932     Int_t chargeAsso = trackAsso->Charge();
1933     Int_t charge = track->Charge();
1934
1935     if(ptAsso <0.3) continue;
1936     if(trackAsso->Eta()<-0.9 || trackAsso->Eta()>0.9) continue;
1937     if(nsigma < -3 || nsigma > 3) continue;
1938
1939     Int_t fPDGe1 = 11; Int_t fPDGe2 = 11;
1940     if(charge>0) fPDGe1 = -11;
1941     if(chargeAsso>0) fPDGe2 = -11;
1942
1943     if(charge == chargeAsso) fFlagLS = kTRUE;
1944     if(charge != chargeAsso) fFlagULS = kTRUE;
1945
1946     AliKFParticle::SetField(fVevent->GetMagneticField());
1947
1948     AliKFParticle ge1 = AliKFParticle(*track, fPDGe1);
1949     AliKFParticle ge2 = AliKFParticle(*trackAsso, fPDGe2);
1950     AliKFParticle recg(ge1, ge2);
1951
1952     if(recg.GetNDF()<1) continue;
1953     Double_t chi2recg = recg.GetChi2()/recg.GetNDF();
1954     if(TMath::Sqrt(TMath::Abs(chi2recg))>3.) continue;
1955
1956     Int_t MassCorrect;
1957     MassCorrect = recg.GetMass(mass,width);
1958
1959     if(fFlagLS) {
1960       if(track->Pt()>2)fInvmassLS1->Fill(mass);
1961       // if(track->Pt()> 1) fInvmassLS2->Fill(mass);
1962       // if(track->Pt()>2) fInvmassLS3->Fill(mass);
1963       // if(track->Pt()>3) fInvmassLS4->Fill(mass);
1964       // if(track->Pt()>4) fInvmassLS5->Fill(mass);
1965     }
1966     if(fFlagULS) {
1967       if(track->Pt()>2)fInvmassULS1->Fill(mass);
1968       //if(track->Pt() >1) fInvmassULS2->Fill(mass);
1969       //if(track->Pt() >2) fInvmassULS3->Fill(mass);
1970       //if(track->Pt() >3) fInvmassULS4->Fill(mass);
1971       //if(track->Pt() >4) fInvmassULS5->Fill(mass);
1972     }
1973
1974     if(mass<fInvmassCut){
1975       if(fFlagULS)
1976       {
1977         ElectronHadCorrel(itrack,track,fDphiULSMassLow, fDphiULSMassLow1,fDphiULSMassLow2,fDphiULSMassLow3,fDphiULSMassLow4);
1978         ElectronHadCorrelEtaBins(itrack,track,fDphiULSMassLowEta1, fDphiULSMassLowEta11,fDphiULSMassLowEta12,fDphiULSMassLowEta13,fDphiULSMassLowEta14,fDphiULSMassLowEta2, fDphiULSMassLowEta21,fDphiULSMassLowEta22,fDphiULSMassLowEta23,fDphiULSMassLowEta24);
1979         fULSElecPt->Fill(track->Pt());
1980         MixedEvent(track,fMixedDphiULSMassLow,fMixedDphiULSMassLow1,fMixedDphiULSMassLow2, fMixedDphiULSMassLow3, fMixedDphiULSMassLow4);
1981       }
1982       if(fFlagLS)
1983       {
1984         ElectronHadCorrel(itrack,track,fDphiLSMassLow,fDphiLSMassLow1,fDphiLSMassLow2,fDphiLSMassLow3,fDphiLSMassLow4);
1985         ElectronHadCorrelEtaBins(itrack,track,fDphiLSMassLowEta1, fDphiLSMassLowEta11,fDphiLSMassLowEta12,fDphiLSMassLowEta13,fDphiLSMassLowEta14,fDphiLSMassLowEta2, fDphiLSMassLowEta21,fDphiLSMassLowEta22,fDphiLSMassLowEta23,fDphiLSMassLowEta24);
1986         fLSElecPt->Fill(track->Pt());
1987         MixedEvent(track,fMixedDphiLSMassLow,fMixedDphiLSMassLow1,fMixedDphiLSMassLow2, fMixedDphiLSMassLow3, fMixedDphiLSMassLow4);
1988       }
1989       if(fFlagLS){
1990         ElectronHadCorrelNoPartner(itrack,jTracks,track,fDphiLSMassLowNoPartner, fDphiLSMassLowNoPartner1,fDphiLSMassLowNoPartner2,fDphiLSMassLowNoPartner3,fDphiLSMassLowNoPartner4);
1991         ElectronHadCorrelEtaBinsNoPartner(itrack,jTracks,track,fDphiLSMassLowNoPartnerEta1, fDphiLSMassLowNoPartnerEta11,fDphiLSMassLowNoPartnerEta12,fDphiLSMassLowNoPartnerEta13,fDphiLSMassLowNoPartnerEta14,fDphiLSMassLowNoPartnerEta2, fDphiLSMassLowNoPartnerEta21,fDphiLSMassLowNoPartnerEta22,fDphiLSMassLowNoPartnerEta23,fDphiLSMassLowNoPartnerEta24);
1992       }
1993       if(fFlagULS) {
1994         ElectronHadCorrelNoPartner(itrack,jTracks,track,fDphiULSMassLowNoPartner, fDphiULSMassLowNoPartner1,fDphiULSMassLowNoPartner2,fDphiULSMassLowNoPartner3,fDphiULSMassLowNoPartner4);
1995         ElectronHadCorrelEtaBinsNoPartner(itrack,jTracks,track,fDphiULSMassLowNoPartnerEta1, fDphiULSMassLowNoPartnerEta11,fDphiULSMassLowNoPartnerEta12,fDphiULSMassLowNoPartnerEta13,fDphiULSMassLowNoPartnerEta14,fDphiULSMassLowNoPartnerEta2, fDphiULSMassLowNoPartnerEta21,fDphiULSMassLowNoPartnerEta22,fDphiULSMassLowNoPartnerEta23,fDphiULSMassLowNoPartnerEta24);
1996       }
1997     }
1998
1999     if(mass<fInvmassCut && fFlagULS && !flagPhotonicElec){
2000       flagPhotonicElec = kTRUE;
2001     }
2002     //   }
2003
2004 }
2005 fFlagPhotonicElec = flagPhotonicElec;
2006 }
2007 //_________________________________________
2008 void AliAnalysisTaskElecHadronCorrel::ElectronHadCorrel(Int_t itrack, AliVTrack *track, TH2F *DphiPt, TH2F *DphiPt1,TH2F *DphiPt2,TH2F *DphiPt3,TH2F *DphiPt4)
2009 {
2010   //Construct Delta Phi between electrons and hadrons
2011
2012   fTrackCuts2->SetAcceptKinkDaughters(kFALSE);
2013   fTrackCuts2->SetRequireTPCRefit(kTRUE);
2014   fTrackCuts2->SetRequireITSRefit(kTRUE);
2015   fTrackCuts2->SetEtaRange(-0.9,0.9);
2016   fTrackCuts2->SetRequireSigmaToVertex(kTRUE);
2017   fTrackCuts2->SetMaxChi2PerClusterTPC(4);
2018   fTrackCuts2->SetMinNClustersTPC(fTPCNClsHad);
2019   fTrackCuts2->SetMaxDCAToVertexZ(3.2);
2020   fTrackCuts2->SetMaxDCAToVertexXY(2.4);
2021   fTrackCuts2->SetDCAToVertex2D(kTRUE);
2022
2023   for(Int_t ktracks = 0; ktracks<fVevent->GetNumberOfTracks(); ktracks++){
2024     AliVParticle* VtrackHad = fVevent->GetTrack(ktracks);
2025     if (!VtrackHad) {
2026       printf("ERROR: Could not receive track %d\n", ktracks);
2027       continue;
2028     }
2029
2030     AliVTrack *trackHad = dynamic_cast<AliVTrack*>(VtrackHad);
2031     if(!trackHad) continue;
2032
2033     if(IsAODanalysis()) {
2034       AliAODTrack *atrackHad = dynamic_cast<AliAODTrack*>(VtrackHad);
2035       if(!atrackHad) continue;
2036       if(!atrackHad->TestFilterMask(AliAODTrack::kTrkTPCOnly)) continue;
2037       if((!(atrackHad->GetStatus()&AliESDtrack::kITSrefit)|| (!(atrackHad->GetStatus()&AliESDtrack::kTPCrefit)))) continue;
2038       if(atrackHad->GetTPCNcls() < fTPCNClsHad) continue; 
2039     }
2040     else{   
2041       AliESDtrack *etrackHad = dynamic_cast<AliESDtrack*>(VtrackHad); 
2042       if(!etrackHad) continue;
2043       if(!fTrackCuts2->AcceptTrack(etrackHad)) continue; 
2044     }
2045
2046     if(ktracks == itrack) continue; //do not select the same electron
2047
2048     Double_t ptHad= -999, pHad=-999., dEdxHad = -999;
2049     Double_t ptEle = -999;
2050     Double_t phiEle = -999, phiHad = -999, Dphi = -999;
2051     Double_t pi = 3.14;
2052
2053     dEdxHad = trackHad->GetTPCsignal();
2054     ptHad = trackHad->Pt();
2055     pHad = trackHad->P();
2056     ptEle = track->Pt();
2057
2058     //    if(ptHad <2) continue;
2059     if(ptHad > ptEle) continue;
2060     if(trackHad->Eta()<-0.9 || trackHad->Eta()>0.9) continue;
2061
2062     phiEle = track->Phi();
2063     phiHad = trackHad->Phi();
2064     Dphi = phiEle - phiHad;
2065     if (Dphi > 3*pi/2)
2066       Dphi = Dphi - 2*pi;
2067     if (Dphi < -pi/2)
2068       Dphi = Dphi + 2*pi;
2069
2070     if(ptHad>2) DphiPt->Fill(ptEle,Dphi);
2071     if(ptHad>2 && ptHad<4) DphiPt1->Fill(ptEle,Dphi);
2072     if(ptHad>4 && ptHad<6) DphiPt2->Fill(ptEle,Dphi);
2073     if(ptHad>6 && ptHad<8) DphiPt3->Fill(ptEle,Dphi);
2074     if(ptHad>4 && ptHad<10) DphiPt4->Fill(ptEle,Dphi);
2075
2076   }
2077 }
2078 //_________________________________________
2079 void AliAnalysisTaskElecHadronCorrel::ElectronHadCorrelNoPartner(Int_t itrack,Int_t jtrack, AliVTrack *track, TH2F *DphiPtNew, TH2F *DphiPtNew1,TH2F *DphiPtNew2,TH2F *DphiPtNew3,TH2F *DphiPtNew4)
2080 {
2081   //Construct Delta Phi between electrons and hadrons for electrons from invariant mass calculation excluding associated track
2082
2083   fTrackCuts2->SetAcceptKinkDaughters(kFALSE);
2084   fTrackCuts2->SetRequireTPCRefit(kTRUE);
2085   fTrackCuts2->SetRequireITSRefit(kTRUE);
2086   fTrackCuts2->SetEtaRange(-0.9,0.9);
2087   fTrackCuts2->SetRequireSigmaToVertex(kTRUE);
2088   fTrackCuts2->SetMaxChi2PerClusterTPC(4);
2089   fTrackCuts2->SetMinNClustersTPC(fTPCNClsHad);
2090   fTrackCuts2->SetMaxDCAToVertexZ(3.2);
2091   fTrackCuts2->SetMaxDCAToVertexXY(2.4);
2092   fTrackCuts2->SetDCAToVertex2D(kTRUE);
2093
2094   for(Int_t ktracks = 0; ktracks<fVevent->GetNumberOfTracks(); ktracks++){
2095     AliVParticle* VtrackHad = fVevent->GetTrack(ktracks);
2096     if (!VtrackHad) {
2097       printf("ERROR: Could not receive track %d\n", ktracks);
2098       continue;
2099     }
2100
2101     AliVTrack *trackHad = dynamic_cast<AliVTrack*>(VtrackHad);
2102       if(!trackHad) continue;
2103
2104     if(IsAODanalysis()) {
2105       AliAODTrack *atrackHad = dynamic_cast<AliAODTrack*>(VtrackHad);
2106       if(!atrackHad) continue;
2107       if(!atrackHad->TestFilterMask(AliAODTrack::kTrkTPCOnly)) continue;
2108       if((!(atrackHad->GetStatus()&AliESDtrack::kITSrefit)|| (!(atrackHad->GetStatus()&AliESDtrack::kTPCrefit)))) continue;
2109       if(atrackHad->GetTPCNcls() < fTPCNClsHad) continue; 
2110     }
2111     else{   
2112       AliESDtrack *etrackHad = dynamic_cast<AliESDtrack*>(VtrackHad); 
2113       if(!etrackHad) continue;
2114       if(!fTrackCuts2->AcceptTrack(etrackHad)) continue; 
2115     }
2116
2117     if(ktracks == itrack || ktracks == jtrack) continue; //do not select the same electron and associated track from inv mass cal
2118
2119     Double_t ptHad= -999, pHad=-999., dEdxHad = -999;
2120     Double_t ptEle = -999;
2121     Double_t phiEle = -999, phiHad = -999, Dphi = -999;
2122     Double_t pi = 3.14;
2123
2124     dEdxHad = trackHad->GetTPCsignal();
2125     ptHad = trackHad->Pt();
2126     pHad = trackHad->P();
2127     ptEle = track->Pt();
2128
2129     //    if(ptHad <2) continue;
2130     if(ptHad > ptEle) continue;
2131     if(trackHad->Eta()<-0.9 || trackHad->Eta()>0.9) continue;
2132
2133     phiEle = track->Phi();
2134     phiHad = trackHad->Phi();
2135     Dphi = phiEle - phiHad;
2136     if (Dphi > 3*pi/2)
2137       Dphi = Dphi - 2*pi;
2138     if (Dphi < -pi/2)
2139       Dphi = Dphi + 2*pi;
2140
2141     if(ptHad>2) DphiPtNew->Fill(ptEle,Dphi);
2142     if(ptHad>2 && ptHad<4) DphiPtNew1->Fill(ptEle,Dphi);
2143     if(ptHad>4 && ptHad<6) DphiPtNew2->Fill(ptEle,Dphi);
2144     if(ptHad>6 && ptHad<8) DphiPtNew3->Fill(ptEle,Dphi);
2145     if(ptHad>4 && ptHad<10) DphiPtNew4->Fill(ptEle,Dphi);
2146   }
2147 }
2148 //_________________________________________
2149 void AliAnalysisTaskElecHadronCorrel::ElectronHadCorrelNoPartnerDCAMet(Int_t itrack,AliVTrack *track,Int_t * AssoList, Int_t NAsso, TH2F *DphiPtNew, TH2F *DphiPtNew1,TH2F *DphiPtNew2,TH2F *DphiPtNew3,TH2F *DphiPtNew4)
2150 {
2151   //Construct Delta Phi between electrons and hadrons for electrons from invariant mass calculation excluding associated track
2152
2153   fTrackCuts2->SetAcceptKinkDaughters(kFALSE);
2154   fTrackCuts2->SetRequireTPCRefit(kTRUE);
2155   fTrackCuts2->SetRequireITSRefit(kTRUE);
2156   fTrackCuts2->SetEtaRange(-0.9,0.9);
2157   fTrackCuts2->SetRequireSigmaToVertex(kTRUE);
2158   fTrackCuts2->SetMaxChi2PerClusterTPC(4);
2159   fTrackCuts2->SetMinNClustersTPC(fTPCNClsHad);
2160   fTrackCuts2->SetMaxDCAToVertexZ(3.2);
2161   fTrackCuts2->SetMaxDCAToVertexXY(2.4);
2162   fTrackCuts2->SetDCAToVertex2D(kTRUE);
2163
2164   for(Int_t ktracks = 0; ktracks<fVevent->GetNumberOfTracks(); ktracks++){
2165     AliVParticle* VtrackHad = fVevent->GetTrack(ktracks);
2166     if (!VtrackHad) {
2167       printf("ERROR: Could not receive track %d\n", ktracks);
2168       continue;
2169     }
2170
2171     AliVTrack *trackHad = dynamic_cast<AliVTrack*>(VtrackHad);
2172     if(!trackHad) continue;
2173
2174     if(IsAODanalysis()) {
2175       AliAODTrack *atrackHad = dynamic_cast<AliAODTrack*>(VtrackHad);
2176       if(!atrackHad) continue;
2177       if(!atrackHad->TestFilterMask(AliAODTrack::kTrkTPCOnly)) continue;
2178       if((!(atrackHad->GetStatus()&AliESDtrack::kITSrefit)|| (!(atrackHad->GetStatus()&AliESDtrack::kTPCrefit)))) continue;
2179       if(atrackHad->GetTPCNcls() < fTPCNClsHad) continue;
2180     }
2181     else{
2182       AliESDtrack *etrackHad = dynamic_cast<AliESDtrack*>(VtrackHad);
2183       if(!etrackHad) continue;
2184       if(!fTrackCuts2->AcceptTrack(etrackHad)) continue;
2185     }
2186     
2187     if(ktracks == itrack ) continue; //do not select the same electron and associated track from inv mass cal
2188     Bool_t IsPartner = kFALSE;
2189     //Check if this track is a Non-HFE partner
2190     for(Int_t i = 0; i < NAsso; i++)
2191     {
2192       if(AssoList[i]==ktracks) IsPartner=kTRUE;
2193     }
2194     if(IsPartner) continue;
2195
2196     Double_t ptHad= -999, pHad=-999., dEdxHad = -999;
2197     Double_t ptEle = -999;
2198     Double_t phiEle = -999, phiHad = -999, Dphi = -999;
2199     Double_t pi = 3.14;
2200
2201     dEdxHad = trackHad->GetTPCsignal();
2202     ptHad = trackHad->Pt();
2203     pHad = trackHad->P();
2204     ptEle = track->Pt();
2205
2206     //    if(ptHad <2) continue;
2207     if(ptHad > ptEle) continue;
2208     if(trackHad->Eta()<-0.9 || trackHad->Eta()>0.9) continue;
2209
2210     phiEle = track->Phi();
2211     phiHad = trackHad->Phi();
2212     Dphi = phiEle - phiHad;
2213     if (Dphi > 3*pi/2)
2214       Dphi = Dphi - 2*pi;
2215     if (Dphi < -pi/2)
2216       Dphi = Dphi + 2*pi;
2217
2218     if(ptHad>2) DphiPtNew->Fill(ptEle,Dphi);
2219     if(ptHad>2 && ptHad<4) DphiPtNew1->Fill(ptEle,Dphi);
2220     if(ptHad>4 && ptHad<6) DphiPtNew2->Fill(ptEle,Dphi);
2221     if(ptHad>6 && ptHad<8) DphiPtNew3->Fill(ptEle,Dphi);
2222     if(ptHad>4 && ptHad<10) DphiPtNew4->Fill(ptEle,Dphi);
2223   }
2224 }
2225
2226
2227 //_________________________________________
2228 void AliAnalysisTaskElecHadronCorrel::ElectronHadCorrelEtaFarSide(Int_t itrack, AliVTrack *track, TH2F *DphiPt, TH2F *DphiPt1,TH2F *DphiPt2,TH2F *DphiPt3,TH2F *DphiPt4)
2229 {
2230   //Construct Delta Phi between electrons and hadrons for 1<eta(had)<1.6
2231
2232   fTrackCuts2->SetAcceptKinkDaughters(kFALSE);
2233   fTrackCuts2->SetRequireTPCRefit(kTRUE);
2234   fTrackCuts2->SetRequireITSRefit(kTRUE);
2235   fTrackCuts2->SetEtaRange(-0.9,0.9);
2236   fTrackCuts2->SetRequireSigmaToVertex(kTRUE);
2237   fTrackCuts2->SetMaxChi2PerClusterTPC(4);
2238   fTrackCuts2->SetMinNClustersTPC(fTPCNClsHad);
2239   fTrackCuts2->SetMaxDCAToVertexZ(3.2);
2240   fTrackCuts2->SetMaxDCAToVertexXY(2.4);
2241   fTrackCuts2->SetDCAToVertex2D(kTRUE);
2242
2243   for(Int_t ktracks = 0; ktracks<fVevent->GetNumberOfTracks(); ktracks++){
2244     AliVParticle* VtrackHad = fVevent->GetTrack(ktracks);
2245     if (!VtrackHad) {
2246       printf("ERROR: Could not receive track %d\n", ktracks);
2247       continue;
2248     }
2249     AliVTrack *trackHad = dynamic_cast<AliVTrack*>(VtrackHad);
2250     if(!trackHad) continue;
2251
2252     if(IsAODanalysis()) {
2253       AliAODTrack *atrackHad = dynamic_cast<AliAODTrack*>(VtrackHad);
2254       if(!atrackHad) continue;
2255       if(!atrackHad->TestFilterMask(AliAODTrack::kTrkTPCOnly)) continue;
2256       if((!(atrackHad->GetStatus()&AliESDtrack::kITSrefit)|| (!(atrackHad->GetStatus()&AliESDtrack::kTPCrefit)))) continue;
2257       if(atrackHad->GetTPCNcls() < fTPCNClsHad) continue;
2258     }
2259     else{
2260       AliESDtrack *etrackHad = dynamic_cast<AliESDtrack*>(VtrackHad);
2261       if(!etrackHad) continue;
2262       if(!fTrackCuts2->AcceptTrack(etrackHad)) continue;
2263     }
2264
2265     if(ktracks == itrack) continue; //do not select the same electron
2266
2267     Double_t ptHad= -999, pHad=-999., dEdxHad = -999;
2268     Double_t ptEle = -999;
2269     Double_t phiEle = -999, phiHad = -999, Dphi = -999;
2270     Double_t pi = 3.14;
2271
2272     dEdxHad = trackHad->GetTPCsignal();
2273     ptHad = trackHad->Pt();
2274     pHad = trackHad->P();
2275     ptEle = track->Pt();
2276
2277     //    if(ptHad <2) continue;
2278     if(ptHad > ptEle) continue;
2279     if(trackHad->Eta()<1 || trackHad->Eta()>1.6) continue;
2280
2281     phiEle = track->Phi();
2282     phiHad = trackHad->Phi();
2283     Dphi = phiEle - phiHad;
2284     if (Dphi > 3*pi/2)
2285       Dphi = Dphi - 2*pi;
2286     if (Dphi < -pi/2)
2287       Dphi = Dphi + 2*pi;
2288
2289     if(ptHad>2) DphiPt->Fill(ptEle,Dphi);
2290     if(ptHad>2 && ptHad<4) DphiPt1->Fill(ptEle,Dphi);
2291     if(ptHad>4 && ptHad<6) DphiPt2->Fill(ptEle,Dphi);
2292     if(ptHad>6 && ptHad<8) DphiPt3->Fill(ptEle,Dphi);
2293     if(ptHad>4 && ptHad<10) DphiPt4->Fill(ptEle,Dphi);
2294
2295   }
2296 }
2297 //_________________________________________
2298 void AliAnalysisTaskElecHadronCorrel::ElectronHadCorrelEtaBins(Int_t itrack, AliVTrack *track, TH2F *DphiPtEta1, TH2F *DphiPtEta11,TH2F *DphiPtEta12,TH2F *DphiPtEta13,TH2F *DphiPtEta14,TH2F *DphiPtEta2, TH2F *DphiPtEta21,TH2F *DphiPtEta22,TH2F *DphiPtEta23,TH2F *DphiPtEta24)
2299 {
2300   //Construct Delta Phi between electrons and hadrons in different Eta bins
2301
2302   fTrackCuts2->SetAcceptKinkDaughters(kFALSE);
2303   fTrackCuts2->SetRequireTPCRefit(kTRUE);
2304   fTrackCuts2->SetRequireITSRefit(kTRUE);
2305   fTrackCuts2->SetEtaRange(-0.9,0.9);
2306   fTrackCuts2->SetRequireSigmaToVertex(kTRUE);
2307   fTrackCuts2->SetMaxChi2PerClusterTPC(4);
2308   fTrackCuts2->SetMinNClustersTPC(fTPCNClsHad);
2309   fTrackCuts2->SetMaxDCAToVertexZ(3.2);
2310   fTrackCuts2->SetMaxDCAToVertexXY(2.4);
2311   fTrackCuts2->SetDCAToVertex2D(kTRUE);
2312
2313   for(Int_t ktracks = 0; ktracks<fVevent->GetNumberOfTracks(); ktracks++){
2314     AliVParticle* VtrackHad = fVevent->GetTrack(ktracks);
2315     if (!VtrackHad) {
2316       printf("ERROR: Could not receive track %d\n", ktracks);
2317       continue;
2318     }
2319
2320     AliVTrack *trackHad = dynamic_cast<AliVTrack*>(VtrackHad);
2321     if(!trackHad) continue;
2322
2323     if(IsAODanalysis()) {
2324       AliAODTrack *atrackHad = dynamic_cast<AliAODTrack*>(VtrackHad);
2325       if(!atrackHad) continue;
2326       if(!atrackHad->TestFilterMask(AliAODTrack::kTrkTPCOnly)) continue;
2327       if((!(atrackHad->GetStatus()&AliESDtrack::kITSrefit)|| (!(atrackHad->GetStatus()&AliESDtrack::kTPCrefit)))) continue;
2328       if(atrackHad->GetTPCNcls() < fTPCNClsHad) continue;
2329     }
2330     else{
2331       AliESDtrack *etrackHad = dynamic_cast<AliESDtrack*>(VtrackHad);
2332       if(!etrackHad) continue;
2333       if(!fTrackCuts2->AcceptTrack(etrackHad)) continue;
2334     }
2335
2336     if(ktracks == itrack) continue; //do not select the same electron
2337
2338     Double_t ptHad= -999, pHad=-999., dEdxHad = -999;
2339     Double_t ptEle = -999;
2340     Double_t phiEle = -999, phiHad = -999, Dphi = -999;
2341     Double_t etaEle = -999, etaHad=-999, DEta=-999;
2342     Double_t pi = 3.14;
2343
2344     dEdxHad = trackHad->GetTPCsignal();
2345     ptHad = trackHad->Pt();
2346     pHad = trackHad->P();
2347     ptEle = track->Pt();
2348
2349     //    if(ptHad <2) continue;
2350     if(ptHad > ptEle) continue;
2351     if(trackHad->Eta()<-0.9 || trackHad->Eta()>0.9) continue;
2352
2353     phiEle = track->Phi();
2354     phiHad = trackHad->Phi();
2355     Dphi = phiEle - phiHad;
2356
2357     if (Dphi > 3*pi/2)
2358       Dphi = Dphi - 2*pi;
2359     if (Dphi < -pi/2)
2360       Dphi = Dphi + 2*pi;
2361
2362     etaEle = track->Eta();
2363     etaHad = trackHad->Eta();
2364     DEta = etaEle - etaHad;
2365
2366     if(TMath::Abs(DEta)<0.8){
2367       if(ptHad>2) DphiPtEta1->Fill(ptEle,Dphi);
2368       if(ptHad>2 && ptHad<4) DphiPtEta11->Fill(ptEle,Dphi);
2369       if(ptHad>4 && ptHad<6) DphiPtEta12->Fill(ptEle,Dphi);
2370       if(ptHad>6 && ptHad<8) DphiPtEta13->Fill(ptEle,Dphi);
2371       if(ptHad>4 && ptHad<10) DphiPtEta14->Fill(ptEle,Dphi);
2372     }
2373
2374     if(TMath::Abs(DEta)>0.8){
2375       if(ptHad>2) DphiPtEta2->Fill(ptEle,Dphi);
2376       if(ptHad>2 && ptHad<4) DphiPtEta21->Fill(ptEle,Dphi);
2377       if(ptHad>4 && ptHad<6) DphiPtEta22->Fill(ptEle,Dphi);
2378       if(ptHad>6 && ptHad<8) DphiPtEta23->Fill(ptEle,Dphi);
2379       if(ptHad>4 && ptHad<10) DphiPtEta24->Fill(ptEle,Dphi);
2380     }
2381   }
2382 }
2383 //_________________________________________
2384 void AliAnalysisTaskElecHadronCorrel::ElectronHadCorrelEtaBinsNoPartner(Int_t itrack,Int_t jtrack, AliVTrack *track, TH2F *DphiPtEta1, TH2F *DphiPtEta11,TH2F *DphiPtEta12,TH2F *DphiPtEta13,TH2F *DphiPtEta14,TH2F *DphiPtEta2, TH2F *DphiPtEta21,TH2F *DphiPtEta22,TH2F *DphiPtEta23,TH2F *DphiPtEta24)
2385 {
2386   //Construct Delta Phi between electrons and hadrons in different Eta bins (exclude associated track)
2387
2388   fTrackCuts2->SetAcceptKinkDaughters(kFALSE);
2389   fTrackCuts2->SetRequireTPCRefit(kTRUE);
2390   fTrackCuts2->SetRequireITSRefit(kTRUE);
2391   fTrackCuts2->SetEtaRange(-0.9,0.9);
2392   fTrackCuts2->SetRequireSigmaToVertex(kTRUE);
2393   fTrackCuts2->SetMaxChi2PerClusterTPC(4);
2394   fTrackCuts2->SetMinNClustersTPC(fTPCNClsHad);
2395   fTrackCuts2->SetMaxDCAToVertexZ(3.2);
2396   fTrackCuts2->SetMaxDCAToVertexXY(2.4);
2397   fTrackCuts2->SetDCAToVertex2D(kTRUE);
2398
2399   for(Int_t ktracks = 0; ktracks<fVevent->GetNumberOfTracks(); ktracks++){
2400     AliVParticle* VtrackHad = fVevent->GetTrack(ktracks);
2401     if (!VtrackHad) {
2402       printf("ERROR: Could not receive track %d\n", ktracks);
2403       continue;
2404     }
2405
2406     AliVTrack *trackHad = dynamic_cast<AliVTrack*>(VtrackHad);
2407     if(!trackHad) continue;
2408
2409     if(IsAODanalysis()) {
2410       AliAODTrack *atrackHad = dynamic_cast<AliAODTrack*>(VtrackHad);
2411       if(!atrackHad) continue;
2412       if(!atrackHad->TestFilterMask(AliAODTrack::kTrkTPCOnly)) continue;
2413       if((!(atrackHad->GetStatus()&AliESDtrack::kITSrefit)|| (!(atrackHad->GetStatus()&AliESDtrack::kTPCrefit)))) continue;
2414       if(atrackHad->GetTPCNcls() < fTPCNClsHad) continue;
2415     }
2416     else{
2417       AliESDtrack *etrackHad = dynamic_cast<AliESDtrack*>(VtrackHad);
2418       if(!etrackHad) continue;
2419       if(!fTrackCuts2->AcceptTrack(etrackHad)) continue;
2420     }
2421
2422     if(ktracks == itrack || ktracks == jtrack) continue; //do not select the same electron and associated track from inv mass cal
2423
2424     Double_t ptHad= -999, pHad=-999., dEdxHad = -999;
2425     Double_t ptEle = -999;
2426     Double_t phiEle = -999, phiHad = -999, Dphi = -999;
2427     Double_t etaEle = -999, etaHad=-999, DEta=-999;
2428     Double_t pi = 3.14;
2429
2430     dEdxHad = trackHad->GetTPCsignal();
2431     ptHad = trackHad->Pt();
2432     pHad = trackHad->P();
2433     ptEle = track->Pt();
2434
2435     //    if(ptHad <2) continue;
2436     if(ptHad > ptEle) continue;
2437     if(trackHad->Eta()<-0.9 || trackHad->Eta()>0.9) continue;
2438
2439     phiEle = track->Phi();
2440     phiHad = trackHad->Phi();
2441     Dphi = phiEle - phiHad;
2442
2443     if (Dphi > 3*pi/2)
2444       Dphi = Dphi - 2*pi;
2445     if (Dphi < -pi/2)
2446       Dphi = Dphi + 2*pi;
2447
2448     etaEle = track->Eta();
2449     etaHad = trackHad->Eta();
2450     DEta = etaEle - etaHad;
2451
2452     if(TMath::Abs(DEta)<0.8){
2453       if(ptHad>2) DphiPtEta1->Fill(ptEle,Dphi);
2454       if(ptHad>2 && ptHad<4) DphiPtEta11->Fill(ptEle,Dphi);
2455       if(ptHad>4 && ptHad<6) DphiPtEta12->Fill(ptEle,Dphi);
2456       if(ptHad>6 && ptHad<8) DphiPtEta13->Fill(ptEle,Dphi);
2457       if(ptHad>4 && ptHad<10) DphiPtEta14->Fill(ptEle,Dphi);
2458     }
2459
2460     if(TMath::Abs(DEta)>0.8){
2461       if(ptHad>2) DphiPtEta2->Fill(ptEle,Dphi);
2462       if(ptHad>2 && ptHad<4) DphiPtEta21->Fill(ptEle,Dphi);
2463       if(ptHad>4 && ptHad<6) DphiPtEta22->Fill(ptEle,Dphi);
2464       if(ptHad>6 && ptHad<8) DphiPtEta23->Fill(ptEle,Dphi);
2465       if(ptHad>4 && ptHad<10) DphiPtEta24->Fill(ptEle,Dphi);
2466     }
2467   }
2468 }
2469
2470 //_________________________________________
2471 void AliAnalysisTaskElecHadronCorrel::MixedEvent(AliVTrack *track, TH2F *DphiPt, TH2F *DphiPt1,TH2F *DphiPt2, TH2F *DphiPt3, TH2F *DphiPt4)
2472 {
2473
2474   const AliAODVertex *pVtx = fAOD->GetPrimaryVertex();
2475   Double_t zVtx;
2476   zVtx = pVtx->GetZ();
2477
2478   AliCentrality *fCentrality1 = (AliCentrality*)fVevent->GetCentrality();
2479   Double_t centvalue = fCentrality1->GetCentralityPercentile(fkCentralityMethod);
2480
2481   AliEventPool* pool;
2482   pool = fPoolMgr->GetEventPool(centvalue, zVtx); // Get the buffer associated with the current centrality and z-vtx
2483   if (!pool)
2484   {
2485     AliFatal(Form("No pool found for centrality = %f, zVtx = %f", centvalue, zVtx));
2486     return;
2487   }
2488   //  pool->PrintInfo();
2489   if (pool->GetCurrentNEvents() >= 5) // start mixing when 5 events are in the buffer
2490   {
2491     Int_t nMix = pool->GetCurrentNEvents();
2492     fNoMixedEvents->Fill(0);
2493     fMixStat->Fill(pool->GetCurrentNEvents(),centvalue);
2494     fMixStat1->Fill(pool->GetCurrentNEvents(),zVtx);
2495
2496     // cout << "nMix = " << nMix << " tracks in pool = " << pool->NTracksInPool() << endl;
2497     for (Int_t jMix=0; jMix<nMix; jMix++)  // mix with each event in the buffer
2498     {
2499       TObjArray* bgTracks = pool->GetEvent(jMix);
2500       for (Int_t i=0;i<bgTracks->GetEntriesFast(); i++)
2501       {
2502         AliVParticle* mixtrk = (AliVParticle*) bgTracks->At(i);
2503
2504         Double_t mixtrkPhi = -999;
2505         Double_t ptEle = -999;
2506         Double_t phiEle = -999, Dphi = -999;
2507         Double_t pi = 3.14;
2508         Double_t ptmixtrk = -999;
2509
2510         ptEle = track->Pt();
2511         ptmixtrk = mixtrk->Pt();
2512         if(ptmixtrk > ptEle) continue;
2513
2514         mixtrkPhi = mixtrk->Phi();
2515         phiEle = track->Phi();
2516         Dphi = phiEle - mixtrkPhi;
2517
2518         if (Dphi > 3*pi/2)
2519           Dphi = Dphi - 2*pi;
2520         if (Dphi < -pi/2)
2521           Dphi = Dphi + 2*pi;
2522         if(ptmixtrk>2) DphiPt->Fill(ptEle,Dphi);
2523         if(ptmixtrk>2 && ptmixtrk<4) DphiPt1->Fill(ptEle,Dphi);
2524         if(ptmixtrk>4 && ptmixtrk<6) DphiPt2->Fill(ptEle,Dphi);
2525         if(ptmixtrk>6 && ptmixtrk<8) DphiPt3->Fill(ptEle,Dphi);
2526         if(ptmixtrk>4 && ptmixtrk<10) DphiPt4->Fill(ptEle,Dphi);
2527       }
2528     }
2529   }
2530 }
2531
2532 //___________________________________________
2533 TObjArray*  AliAnalysisTaskElecHadronCorrel::CloneAndReduceTrackList()
2534 {
2535   // clones a track list by using AliehDPhiBasicParticle which uses much less memory (used for event mixing)
2536
2537   fTrackCuts2->SetAcceptKinkDaughters(kFALSE);
2538   fTrackCuts2->SetRequireTPCRefit(kTRUE);
2539   fTrackCuts2->SetRequireITSRefit(kTRUE);
2540   fTrackCuts2->SetEtaRange(-0.9,0.9);
2541   fTrackCuts2->SetRequireSigmaToVertex(kTRUE);
2542   fTrackCuts2->SetMaxChi2PerClusterTPC(3.5);
2543   fTrackCuts2->SetMinNClustersTPC(fTPCNClsHad);
2544   fTrackCuts2->SetMaxDCAToVertexZ(3.2);
2545   fTrackCuts2->SetMaxDCAToVertexXY(2.4);
2546   fTrackCuts2->SetDCAToVertex2D(kTRUE);
2547
2548   TObjArray* tracksClone = new TObjArray;
2549   tracksClone->SetOwner(kTRUE);
2550
2551   for(Int_t ktracks = 0; ktracks<fVevent->GetNumberOfTracks(); ktracks++){
2552     AliVParticle* Vtrack = fVevent->GetTrack(ktracks);
2553     if (!Vtrack) {
2554       printf("ERROR: Could not receive track %d\n", ktracks);
2555       continue;
2556     }
2557
2558     AliVTrack *track = dynamic_cast<AliVTrack*>(Vtrack);
2559     if(!track) continue;
2560
2561     if(IsAODanalysis()) {
2562       AliAODTrack *atrack = dynamic_cast<AliAODTrack*>(Vtrack);
2563       if(!atrack) continue;
2564       if(!atrack->TestFilterMask(AliAODTrack::kTrkTPCOnly)) continue;
2565       if((!(atrack->GetStatus()&AliESDtrack::kITSrefit)|| (!(atrack->GetStatus()&AliESDtrack::kTPCrefit)))) continue;
2566       if(atrack->GetTPCNcls() < fTPCNClsHad) continue;
2567     }
2568     else{
2569       AliESDtrack *etrack = dynamic_cast<AliESDtrack*>(Vtrack);
2570       if(!etrack) continue;
2571       if(!fTrackCuts2->AcceptTrack(etrack)) continue;
2572     }
2573
2574     //   if(ktracks == iTrack) continue;
2575     Double_t eta=-999,ptHad= -999, pHad=-999., phi=-999.0;
2576     Int_t label=-9999, id=-999;
2577     eta = track->Eta();
2578     ptHad = track->Pt();
2579     pHad = track->P();
2580     phi= track->Phi();
2581     label= track->GetLabel();
2582     id=track->GetID();
2583
2584     if(track->Eta()<-0.9 || track->Eta()>0.9) continue;
2585     if(ptHad <2) continue;
2586
2587     AliVParticle* particle = (AliVParticle*) fVevent->GetTrack(ktracks);
2588     tracksClone->Add(new AliehDPhiBasicParticle(particle->Eta(), particle->Phi(), particle->Pt(), particle->Charge()));
2589
2590   }
2591   return tracksClone;
2592 }
2593
2594 //___________________________________________
2595 void AliAnalysisTaskElecHadronCorrel::HadronInfo(Int_t itrack)
2596 {
2597   //Hadron information
2598
2599   fTrackCuts2->SetAcceptKinkDaughters(kFALSE);                                           
2600   fTrackCuts2->SetRequireTPCRefit(kTRUE);                                                
2601   fTrackCuts2->SetRequireITSRefit(kTRUE);                                                
2602   fTrackCuts2->SetEtaRange(-0.9,0.9);
2603   fTrackCuts2->SetRequireSigmaToVertex(kTRUE);                                           
2604   fTrackCuts2->SetMaxChi2PerClusterTPC(4);                                             
2605   fTrackCuts2->SetMinNClustersTPC(fTPCNClsHad);                                                   
2606   fTrackCuts2->SetMaxDCAToVertexZ(3.2);
2607   fTrackCuts2->SetMaxDCAToVertexXY(2.4);
2608   fTrackCuts2->SetDCAToVertex2D(kTRUE);
2609
2610   for(Int_t ktracks = 0; ktracks<fVevent->GetNumberOfTracks(); ktracks++){                  
2611     AliVParticle* VtrackHad = fVevent->GetTrack(ktracks);                                     
2612     if (!VtrackHad) {
2613       printf("ERROR: Could not receive track %d\n", ktracks);                            
2614       continue;                                                                          
2615     }
2616
2617     AliVTrack *trackHad = dynamic_cast<AliVTrack*>(VtrackHad);
2618     if(!trackHad) continue;
2619
2620     if(IsAODanalysis()) {
2621       AliAODTrack *atrackHad = dynamic_cast<AliAODTrack*>(VtrackHad);
2622       if(!atrackHad) continue;
2623       if(!atrackHad->TestFilterMask(AliAODTrack::kTrkTPCOnly)) continue;
2624       if((!(atrackHad->GetStatus()&AliESDtrack::kITSrefit)|| (!(atrackHad->GetStatus()&AliESDtrack::kTPCrefit)))) continue;
2625       if(atrackHad->GetTPCNcls() < fTPCNClsHad) continue; 
2626     }
2627     else{   
2628       AliESDtrack *etrackHad = dynamic_cast<AliESDtrack*>(VtrackHad); 
2629       if(!etrackHad) continue;
2630       if(!fTrackCuts2->AcceptTrack(etrackHad)) continue; 
2631     }
2632
2633     if(ktracks == itrack) continue; //do not select the same electron
2634
2635     Double_t ptHad= -999;
2636     ptHad = trackHad->Pt();
2637
2638     if(trackHad->Eta()<-0.9 || trackHad->Eta()>0.9) continue;
2639     // cout << "pt had = " << ptHad <<endl;
2640
2641     if(ptHad<2) continue;
2642
2643     fHadronPhi->Fill(trackHad->Phi());
2644     fHadronPhiPt->Fill(trackHad->Phi(),ptHad);
2645     if (trackHad->Eta() >0 && trackHad->Eta() <0.9) fHadronPhiTPChalf->Fill(trackHad->Phi());
2646
2647     fHadronPt->Fill(ptHad);
2648   }
2649 }
2650 //_________________________________________
2651 void AliAnalysisTaskElecHadronCorrel::CheckCentrality(AliVEvent* event, Bool_t &centralitypass)
2652 {
2653   // Check if event is within the set centrality range. Falls back to V0 centrality determination if no method is set
2654   if (!fkCentralityMethod) AliFatal("No centrality method set! FATAL ERROR!");
2655   fCentrality = event->GetCentrality()->GetCentralityPercentile(fkCentralityMethod);
2656   // cout << "Centrality evaluated-------------------------: " << fCentrality <<endl;
2657
2658   if ((fCentrality <= fCentralityMin) || (fCentrality > fCentralityMax))
2659   {
2660     fCentralityNoPass->Fill(fCentrality);
2661     //  cout << "--------------Fill no pass-------------------------"<<endl;
2662     centralitypass = kFALSE;
2663   }else
2664   {
2665     fCentralityPass->Fill(fCentrality);
2666     //  cout << "--------------Fill pass-------------------------"<<endl;
2667     centralitypass = kTRUE;
2668   }
2669
2670 }
2671 //_____________________________________________________________________________
2672 void AliAnalysisTaskElecHadronCorrel::SetCentralityParameters(Double_t CentralityMin, Double_t CentralityMax, const char* CentralityMethod)
2673 {
2674   // Set a centrality range ]min, max] and define the method to use for centrality selection
2675   fCentralityMin = CentralityMin;
2676   fCentralityMax = CentralityMax;
2677   fkCentralityMethod = CentralityMethod;
2678 }