]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Apply vertex clut in different analysis
authorgconesab <gconesab@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sun, 17 Oct 2010 20:10:47 +0000 (20:10 +0000)
committergconesab <gconesab@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sun, 17 Oct 2010 20:10:47 +0000 (20:10 +0000)
Isolation: Select only leading particles (Yaxian)

15 files changed:
PWG4/PartCorrBase/AliAnaPartCorrBaseClass.cxx
PWG4/PartCorrBase/AliAnaPartCorrBaseClass.h
PWG4/PartCorrBase/AliIsolationCut.cxx
PWG4/PartCorrBase/AliIsolationCut.h
PWG4/PartCorrDep/AliAnaCalorimeterQA.cxx
PWG4/PartCorrDep/AliAnaChargedParticles.cxx
PWG4/PartCorrDep/AliAnaChargedParticles.h
PWG4/PartCorrDep/AliAnaParticleHadronCorrelation.cxx
PWG4/PartCorrDep/AliAnaParticleHadronCorrelation.h
PWG4/PartCorrDep/AliAnaParticleIsolation.cxx
PWG4/PartCorrDep/AliAnaParticleIsolation.h
PWG4/PartCorrDep/AliAnaPhoton.cxx
PWG4/PartCorrDep/AliAnaPi0.cxx
PWG4/PartCorrDep/AliAnaPi0.h
PWG4/PartCorrDep/AliAnaPi0EbE.cxx

index fb02b297591ce05d12a43ded3b819794fb2dbc53..9b685b044d85df243ad863d50ce4fbc6c81374f5 100755 (executable)
@@ -18,6 +18,7 @@
 // Base class for analysis algorithms
 //-- Author: Gustavo Conesa (LNF-INFN) 
 //_________________________________________________________________________
+// --Yaxian Mao: Add the possibality for event selection analysis based on vertex and multiplicity bins (10/10/2010)
   
 
 // --- ROOT system ---
@@ -46,6 +47,8 @@ ClassImp(AliAnaPartCorrBaseClass)
   AliAnaPartCorrBaseClass::AliAnaPartCorrBaseClass() : 
     TObject(), fDataMC(0), fDebug(0), fCheckFidCut(0),
     fCheckCaloPID(0), fRecalculateCaloPID(0), fMinPt(0), fMaxPt(0),
+    fMultiBin(0),fNZvertBin(0),fNrpBin(0),fZvtxCut(0.), fMaxMulti(0),fMinMulti(0),
+    fUseSelectEvent(kFALSE), 
     fReader(0x0), fInputAODBranch(0x0), fInputAODName(""),
     fOutputAODBranch(0x0), fNewAOD(kFALSE),
     fOutputAODName(""), fOutputAODClassName(""),
@@ -155,8 +158,8 @@ AliAnaPartCorrBaseClass::~AliAnaPartCorrBaseClass()
   if(fIC)        delete fIC ;
   if(fMCUtils)   delete fMCUtils ;
   if(fNMS)       delete fNMS ;
-  
-//   printf("--- analysis deleted \n");
+
+  //   printf("--- analysis deleted \n");
 }
 
 //____________________________________________________________________________
@@ -457,7 +460,14 @@ void AliAnaPartCorrBaseClass::InitParameters()
   fRecalculateCaloPID = kFALSE ;
   fMinPt = 0.1  ; //Min pt in particle analysis
   fMaxPt = 300. ; //Max pt in particle analysis
-
+  fMultiBin = 1;
+  fNZvertBin = 1;
+  fNrpBin    = 1;
+  fZvtxCut   = 40;
+  fMaxMulti   = 1000;
+  fMinMulti   = 0;
+  fUseSelectEvent = kFALSE ;
+  
   //fReader    = new AliCaloTrackReader(); //Initialized in maker
   //fCaloUtils = new AliCalorimeterUtils();//Initialized in maker
        
index bea69e4a0c09c3512e5f084e7cfc46f57ae66a73..7bbdbfad1f639c575b6cabe72367e65b70ff0f23 100755 (executable)
@@ -7,7 +7,7 @@
   //_________________________________________________________________________
   // Base class for analysis algorithms
   //-- Author: Gustavo Conesa (INFN-LNF)
-
+//-Add the possibality for event selection analysis based on vertex and multiplicity bins (Yaxian Mao, 10/10/2010)
 #include <cstdlib>
 
   //ROOT
@@ -159,6 +159,25 @@ public:
   virtual void SetMinPt(Float_t pt)           {fMinPt = pt ; }
   virtual void SetPtCutRange(Double_t ptmin, Double_t ptmax)
   {  fMaxPt=ptmax;   fMinPt=ptmin;}
+  //Setters for parameters of event buffers
+  virtual void SetMultiBin(Int_t n=1) {fMultiBin=n ;} //number of bins in Multiplicity  
+  virtual void SetNZvertBin(Int_t n=1) {fNZvertBin=n ;} //number of bins for vertex position
+  virtual void SetNRPBin(Int_t n=1)    {fNrpBin=n ;}    //number of bins in reaction plain  
+  virtual void SetZvertexCut(Float_t zcut=40.){fZvtxCut=zcut ;} //cut on vertex position
+  virtual void SetMultiplicity(Int_t multimin, Int_t multimax) {fMinMulti = multimin ; fMaxMulti = multimax ; }
+  virtual void SwitchOnEventSelection()    {fUseSelectEvent = kTRUE ; }
+  virtual void SwitchOffEventSelection()   {fUseSelectEvent = kFALSE ; } 
+  //Getters for event selection
+  virtual Int_t GetMultiBin()  const       {return fMultiBin ;} //number of bins in Multiplicity 
+  virtual Int_t GetNZvertBin() const       {return fNZvertBin ;} //number of bins in vertex   
+  virtual Int_t GetNRPBin()    const       {return fNrpBin ;}    //number of bins in reaction plain 
+  //Getters for event selection
+  virtual Float_t GetZvertexCut() const {return fZvtxCut ;} //cut on vertex position  
+  virtual Int_t GetMaxMulti()     const {return fMaxMulti  ; }  
+  virtual Int_t GetMinMulti()     const {return fMinMulti  ; }  
+  
+  // Do correlation analysis with different event buffers
+  virtual Bool_t DoEventSelect() const {return fUseSelectEvent ; }
   
   //Histogrammes setters and getters
   //Pt, Energy 
@@ -234,6 +253,14 @@ private:
   Bool_t  fRecalculateCaloPID ; // Recalculate PID or use PID weights in calorimeters
   Float_t fMinPt ;              // Maximum pt of (trigger) particles in the analysis
   Float_t fMaxPt ;              // Minimum pt of (trigger) particles in the analysis
+  Int_t    fMultiBin ;   // Number of bins in event container for multiplicity
+  Int_t    fNZvertBin ;          // Number of bins in event container for vertex position
+  Int_t    fNrpBin ;       // Number of bins in event container for reaction plain
+  Float_t  fZvtxCut ;      // Cut on vertex position  
+  Int_t    fMaxMulti ;              // Maximum multiplicity of particles in the analysis
+  Int_t    fMinMulti ;              // Maximum multiplicity of particles in the analysis
+  Bool_t   fUseSelectEvent ; // Select events based on multiplicity and vertex cuts
+  
        
   AliCaloTrackReader * fReader; // Acces to ESD/AOD/MC data
   
@@ -253,7 +280,6 @@ private:
   AliMCAnalysisUtils       * fMCUtils; //! MonteCarlo Analysis utils 
   AliNeutralMesonSelection * fNMS;     //! Neutral Meson Selection
   AliCalorimeterUtils      * fCaloUtils ; //  Pointer to CalorimeterUtils
-  
 
   //Histograms binning and range    
   Int_t   fHistoPtBins   ;  // Number of bins in pt axis
@@ -272,7 +298,7 @@ private:
   Float_t fHistoAsymMax  ;  // Maximum value of asymmetry histogram range
   Float_t fHistoAsymMin  ;  // Minimum value of asymmetry histogram range
   
-  ClassDef(AliAnaPartCorrBaseClass,9)
+  ClassDef(AliAnaPartCorrBaseClass,10)
 } ;
 
 
index 63408b27d2aa488c46363b9d7f28d0d0a4e3391d..c69842f3cf035687ce2ec749dabf5ef77bcd96c3 100755 (executable)
 //
 //
 //*-- Author: Gustavo Conesa (LNF-INFN) 
+
+//-Yaxian Mao (add the possibility for different IC method with different pt range, 01/10/2010)
+//-Yaxian Mao (check the candidate particle is the leading particle or not at the same hemishere)
+
 //////////////////////////////////////////////////////////////////////////////
   
   
@@ -43,7 +47,7 @@ ClassImp(AliIsolationCut)
 //____________________________________________________________________________
   AliIsolationCut::AliIsolationCut() : 
     TObject(),
-    fConeSize(0.),fPtThreshold(0.), fPtFraction(0.), fICMethod(0),fPartInCone(0)
+    fConeSize(0.),fPtThreshold(0.), fSumPtThreshold(0.), fPtFraction(0.), fICMethod(0),fPartInCone(0)
  
 {
   //default ctor
@@ -113,6 +117,7 @@ void AliIsolationCut::InitParameters()
   
   fConeSize    = 0.4 ; 
   fPtThreshold = 1. ; 
+  fSumPtThreshold = 0.5 ; 
   fPtFraction  = 0.1 ; 
   fPartInCone  = kNeutralAndCharged;
   fICMethod    = kPtThresIC; // 0 pt threshol method, 1 cone pt sum method
@@ -136,13 +141,12 @@ void  AliIsolationCut::MakeIsolationCut(TObjArray * const plCTS,  TObjArray * co
   n = 0 ;
   coneptsum = 0.; 
   isolated = kFALSE;
-  
+
   //Initialize the array with refrences
   TObjArray * refclusters = 0x0;
   TObjArray * reftracks   = 0x0;
   Int_t ntrackrefs   = 0;
   Int_t nclusterrefs = 0;
-  
   //Check charged particles in cone.
   if(plCTS && (fPartInCone==kOnlyCharged || fPartInCone==kNeutralAndCharged)){
     TVector3 p3;
@@ -156,6 +160,17 @@ void  AliIsolationCut::MakeIsolationCut(TObjArray * const plCTS,  TObjArray * co
       phi  = p3.Phi() ;
       if(phi<0) phi+=TMath::TwoPi();
       
+      //only loop the particle at the same side of candidate
+      if(TMath::Abs(phi-phiC)>TMath::PiOver2()) continue ;
+      //if at the same side has particle larger than candidate, then candidate can not be the leading, skip such events
+      if(pt > ptC){
+        n = -1;
+        nfrac = -1;
+        coneptsum = -1;
+        isolated = kFALSE;
+        if(fillAOD && reftracks) reftracks->Clear(); 
+        return ;
+      }
       //Check if there is any particle inside cone with pt larger than  fPtThreshold
       rad = TMath::Sqrt((eta-etaC)*(eta-etaC)+ (phi-phiC)*(phi-phiC));
       
@@ -215,6 +230,21 @@ void  AliIsolationCut::MakeIsolationCut(TObjArray * const plCTS,  TObjArray * co
       eta  = mom.Eta();
       phi  = mom.Phi() ;
       if(phi<0) phi+=TMath::TwoPi();
+      //only loop the particle at the same side of candidate
+      
+      if(TMath::Abs(phi-phiC)>TMath::PiOver2()) continue ;
+      //if at the same side has particle larger than candidate, then candidate can not be the leading, skip such events
+      if(pt > ptC){
+        n = -1;
+        nfrac = -1;
+        coneptsum = -1;
+        isolated = kFALSE;
+        if(fillAOD){
+          if(reftracks)  reftracks->Clear(); 
+          if(refclusters)refclusters->Clear(); 
+        }
+        return ;
+      }
       
       //Check if there is any particle inside cone with pt larger than  fPtThreshold
       rad = TMath::Sqrt((eta-etaC)*(eta-etaC)+ (phi-phiC)*(phi-phiC));
@@ -231,11 +261,12 @@ void  AliIsolationCut::MakeIsolationCut(TObjArray * const plCTS,  TObjArray * co
         //printf("neutral in isolation cone pt %f, phi %f, eta %f, R %f \n",pt,phi,eta,rad);
         coneptsum+=pt;
         if(pt > fPtThreshold ) n++;
-        if(pt > fPtFraction*ptC ) nfrac++;
+        //if fPtFraction*ptC<fPtThreshold then consider the fPtThreshold directly
+        if(pt > fPtFraction*ptC && pt>fPtThreshold) nfrac++; 
       }//in cone
     }// neutral particle loop
   }//neutrals
-  
+
   //printf("Isolation Cut: in cone with: pT>pTthres %d, pT > pTfrac*pTcandidate %d \n",n,nfrac);
   
   //Add reference arrays to AOD when filling AODs only
@@ -243,21 +274,20 @@ void  AliIsolationCut::MakeIsolationCut(TObjArray * const plCTS,  TObjArray * co
     if(refclusters)    pCandidate->AddObjArray(refclusters);
     if(reftracks)        pCandidate->AddObjArray(reftracks);
   }
-  
   //Check isolation, depending on method.
   if( fICMethod == kPtThresIC){
     if(n==0) isolated = kTRUE ;
   }
   else if( fICMethod == kSumPtIC){
-    if(coneptsum < fPtThreshold)
+    if(coneptsum < fSumPtThreshold)
       isolated  =  kTRUE ;
   }
   else if( fICMethod == kPtFracIC){
     if(nfrac==0) isolated = kTRUE ;
   }
   else if( fICMethod == kSumPtFracIC){
-    if(coneptsum < fPtFraction*ptC)
-      isolated  =  kTRUE ;
+    //when the fPtFraction*ptC < fSumPtThreshold then consider the later case
+    if(coneptsum < fPtFraction*ptC && coneptsum < fSumPtThreshold) isolated  =  kTRUE ;
   }
   
   //if(refclusters) delete refclusters;
index 81e5f0c029334f7ddb7885b122fae63d7a4b0d3b..4ab9eea0bea132e4a2afb48ea4b31615df37f153 100755 (executable)
@@ -14,6 +14,8 @@
 // 
 // -- Author: Gustavo Conesa (INFN-LNF)
 
+//-Yaxian Mao (add the possibility for different IC method with different pt range, 01/10/2010)
+
 // --- ROOT system --- 
 #include <TObject.h>
 class TObjArray ;
@@ -38,6 +40,7 @@ class AliIsolationCut : public TObject {
        
   Float_t    GetConeSize()           const {return fConeSize   ;}
   Float_t    GetPtThreshold()        const {return fPtThreshold;}
+  Float_t    GetSumPtThreshold()     const {return fSumPtThreshold;}
   Float_t    GetPtFraction()         const {return fPtFraction ;}
   Int_t      GetICMethod()           const {return fICMethod   ;}
   Int_t      GetParticleTypeInCone() const {return fPartInCone ;}
@@ -52,6 +55,7 @@ class AliIsolationCut : public TObject {
   
   void SetConeSize(Float_t r)        {fConeSize = r ; }
   void SetPtThreshold(Float_t pt)    {fPtThreshold = pt; }
+  void SetSumPtThreshold(Float_t sumpt)    {fSumPtThreshold = sumpt; }
   void SetPtFraction(Float_t pt)     {fPtFraction = pt; }
   void SetICMethod(Int_t i )         {fICMethod = i ; }
   void SetParticleTypeInCone(Int_t i){fPartInCone = i;}
@@ -62,7 +66,8 @@ class AliIsolationCut : public TObject {
  private:
   
   Float_t      fConeSize ;    //Size of the isolation cone 
-  Float_t      fPtThreshold ; //Mimium pt of the particles in the cone or sum in cone 
+  Float_t      fPtThreshold ; //Mimium pt of the particles in the cone or sum in cone (UE pt mean in the forward region cone)
+  Float_t      fSumPtThreshold ; //Minium of sum pt of the particles in the cone (UE sum in the forward region cone)
   Float_t      fPtFraction ;  //Fraction of the momentum of particles in cone or sum in cone
   Int_t        fICMethod ;    //Isolation cut method to be used
                               // kPtIC: Pt threshold method
@@ -74,7 +79,7 @@ class AliIsolationCut : public TObject {
                                 
        
        
-  ClassDef(AliIsolationCut,2)
+  ClassDef(AliIsolationCut,3)
 } ;
 
 
index 915f051ce70b1d272925cc98c05b01b6d7033110..8902f88803ec34addbdde0fdf989693c1f9d7b0b 100755 (executable)
@@ -1222,40 +1222,45 @@ void  AliAnaCalorimeterQA::MakeAnalysisFillHistograms()
   Int_t trackIndex = 0;
   Int_t nModule = -1;
   
+  //Get vertex for photon momentum calculation and event selection
+  Double_t v[3] = {0,0,0}; //vertex ;
+  GetReader()->GetVertex(v);
+  if (TMath::Abs(v[2]) > GetZvertexCut()) return ;  
+  
   //Play with the MC stack if available        
   //Get the MC arrays and do some checks
   if(IsDataMC()){
     if(GetReader()->ReadStack()){
       
       if(!GetMCStack()) {
-       printf("AliAnaPhoton::MakeAnalysisFillHistograms() - Stack not available, is the MC handler called? STOP\n");
-       abort();
+        printf("AliAnaPhoton::MakeAnalysisFillHistograms() - Stack not available, is the MC handler called? STOP\n");
+        abort();
       }
       //Fill some pure MC histograms, only primaries.
       for(Int_t i=0 ; i<GetMCStack()->GetNprimary(); i++){//Only primary particles, for all MC transport put GetNtrack()
-       TParticle *primary = GetMCStack()->Particle(i) ;
+        TParticle *primary = GetMCStack()->Particle(i) ;
         //printf("i %d, %s: status = %d, primary? %d\n",i, primary->GetName(), primary->GetStatusCode(), primary->IsPrimary());
-       if (primary->GetStatusCode() > 11) continue; //Working for PYTHIA and simple generators, check for HERWIG 
-       primary->Momentum(mom);
-       MCHistograms(mom,TMath::Abs(primary->GetPdgCode()));
+        if (primary->GetStatusCode() > 11) continue; //Working for PYTHIA and simple generators, check for HERWIG 
+        primary->Momentum(mom);
+        MCHistograms(mom,TMath::Abs(primary->GetPdgCode()));
       } //primary loop
     }
     else if(GetReader()->ReadAODMCParticles()){
       
       if(!GetReader()->GetAODMCParticles(0))   {
-       printf("AliAnaPhoton::MakeAnalysisFillHistograms() -  AODMCParticles not available!\n");
-       abort();
+        printf("AliAnaPhoton::MakeAnalysisFillHistograms() -  AODMCParticles not available!\n");
+        abort();
       }
       //Fill some pure MC histograms, only primaries.
       for(Int_t i=0 ; i < (GetReader()->GetAODMCParticles(0))->GetEntriesFast(); i++){
-       AliAODMCParticle *aodprimary = (AliAODMCParticle*) (GetReader()->GetAODMCParticles(0))->At(i) ;
+        AliAODMCParticle *aodprimary = (AliAODMCParticle*) (GetReader()->GetAODMCParticles(0))->At(i) ;
         //printf("i %d, %s: primary? %d physical primary? %d, flag %d\n",
         //        i,(TDatabasePDG::Instance()->GetParticle(aodprimary->GetPdgCode()))->GetName(), 
         //        aodprimary->IsPrimary(), aodprimary->IsPhysicalPrimary(), aodprimary->GetFlag());
-       if (!aodprimary->IsPrimary()) continue; //accept all which is not MC transport generated. Don't know how to avoid partons
+        if (!aodprimary->IsPrimary()) continue; //accept all which is not MC transport generated. Don't know how to avoid partons
         //aodprimary->Momentum(mom);
-       mom.SetPxPyPzE(aodprimary->Px(),aodprimary->Py(),aodprimary->Pz(),aodprimary->E());
-       MCHistograms(mom,TMath::Abs(aodprimary->GetPdgCode()));
+        mom.SetPxPyPzE(aodprimary->Px(),aodprimary->Py(),aodprimary->Pz(),aodprimary->E());
+        MCHistograms(mom,TMath::Abs(aodprimary->GetPdgCode()));
       } //primary loop
       
     }
@@ -1295,11 +1300,7 @@ void  AliAnaCalorimeterQA::MakeAnalysisFillHistograms()
     if(GetDebug() > 0)
       printf("AliAnaCalorimeterQA::MakeAnalysisFillHistograms() - In %s there are %d clusters \n", fCalorimeter.Data(), nCaloClusters);
     
-    //Get vertex for photon momentum calculation
-    Double_t v[3] = {0,0,0}; //vertex ;
-    GetReader()->GetVertex(v);
     AliVTrack * track = 0x0;
-    
     Float_t pos[3] ;
     Float_t showerShape[3] ;
     Double_t tof = 0;
@@ -1326,7 +1327,7 @@ void  AliAnaCalorimeterQA::MakeAnalysisFillHistograms()
         Bool_t in = kTRUE;
         if(IsFiducialCutOn()) in =  GetFiducialCut()->IsInFiducialCut(mom,fCalorimeter) ;
         if(!in) continue;
-                
+        
         //Get module of cluster
         nCaloClustersAccepted++;
         nModule = GetModuleNumber(clus);
@@ -1339,7 +1340,7 @@ void  AliAnaCalorimeterQA::MakeAnalysisFillHistograms()
         //Cells per cluster
         nCaloCellsPerCluster =  clus->GetNCells();
         //if(mom.E() > 10 && nCaloCellsPerCluster == 1 ) printf("%s:************** E = %f ********** ncells = %d\n",fCalorimeter.Data(), mom.E(),nCaloCellsPerCluster);
-   
+        
         //matched cluster with tracks
         nTracksMatched = clus->GetNTracksMatched();
         trackIndex     = clus->GetTrackMatchedIndex();
@@ -1473,8 +1474,8 @@ void  AliAnaCalorimeterQA::MakeAnalysisFillHistograms()
         if(GetDebug()>1) printf("Invariant mass \n");
         
         //do not do for bad vertex
-        Float_t fZvtxCut = 40. ;       
-        if(v[2]<-fZvtxCut || v[2]> fZvtxCut) continue ; //Event can not be used (vertex, centrality,... cuts not fulfilled)
+        // Float_t fZvtxCut = 40. ;    
+        if(v[2]<-GetZvertexCut() || v[2]> GetZvertexCut()) continue ; //Event can not be used (vertex, centrality,... cuts not fulfilled)
         
         Int_t nModule2 = -1;
         Int_t nCaloCellsPerCluster2=0;
@@ -1751,7 +1752,7 @@ void AliAnaCalorimeterQA::ClusterHistograms(const TLorentzVector mom, const Doub
     fhYE     ->Fill(pos[1],e);
     fhZE     ->Fill(pos[2],e);
     fhXYZ    ->Fill(pos[0], pos[1],pos[2]);
-   
+    
     fhXNCells->Fill(pos[0],nCaloCellsPerCluster);
     fhYNCells->Fill(pos[1],nCaloCellsPerCluster);
     fhZNCells->Fill(pos[2],nCaloCellsPerCluster);
@@ -1790,8 +1791,8 @@ void AliAnaCalorimeterQA::ClusterHistograms(const TLorentzVector mom, const Doub
     if(GetReader()->ReadStack() && !GetMCAnalysisUtils()->CheckTagBit(tag, AliMCAnalysisUtils::kMCUnknown)){ //it MC stack and known tag
       
       if( label >= GetMCStack()->GetNtrack()) {
-       if(GetDebug() >= 0) printf("AliAnaCalorimeterQA::ClusterHistograms() *** large label ***:  label %d, n tracks %d \n", label, GetMCStack()->GetNtrack());
-       return ;
+        if(GetDebug() >= 0) printf("AliAnaCalorimeterQA::ClusterHistograms() *** large label ***:  label %d, n tracks %d \n", label, GetMCStack()->GetNtrack());
+        return ;
       }
       
       primary = GetMCStack()->Particle(label);
@@ -1804,50 +1805,50 @@ void AliAnaCalorimeterQA::ClusterHistograms(const TLorentzVector mom, const Doub
       iParent = primary->GetFirstMother();
       
       if(GetDebug() > 1 ) {
-       printf("AliAnaCalorimeterQA::ClusterHistograms() - Cluster most contributing mother: \n");
-       printf("\t Mother label %d, pdg %d, %s, status %d, parent %d \n",iMother, pdg0, primary->GetName(),status, iParent);
+        printf("AliAnaCalorimeterQA::ClusterHistograms() - Cluster most contributing mother: \n");
+        printf("\t Mother label %d, pdg %d, %s, status %d, parent %d \n",iMother, pdg0, primary->GetName(),status, iParent);
       }
       
       //Get final particle, no conversion products
       if(GetMCAnalysisUtils()->CheckTagBit(tag, AliMCAnalysisUtils::kMCConversion)){
         //Get the parent
-       primary = GetMCStack()->Particle(iParent);
-       pdg = TMath::Abs(primary->GetPdgCode());
-       if(GetDebug() > 1 ) printf("AliAnaCalorimeterQA::ClusterHistograms() - Converted cluster!. Find before conversion: \n");
-       while((pdg == 22 || pdg == 11) && status != 1){
-         iMother = iParent;
-         primary = GetMCStack()->Particle(iMother);
-         status  = primary->GetStatusCode();
-         iParent = primary->GetFirstMother();
-         pdg     = TMath::Abs(primary->GetPdgCode());
-         if(GetDebug() > 1 )printf("\t pdg %d, index %d, %s, status %d \n",pdg, iMother,  primary->GetName(),status);  
-       }       
+        primary = GetMCStack()->Particle(iParent);
+        pdg = TMath::Abs(primary->GetPdgCode());
+        if(GetDebug() > 1 ) printf("AliAnaCalorimeterQA::ClusterHistograms() - Converted cluster!. Find before conversion: \n");
+        while((pdg == 22 || pdg == 11) && status != 1){
+          iMother = iParent;
+          primary = GetMCStack()->Particle(iMother);
+          status  = primary->GetStatusCode();
+          iParent = primary->GetFirstMother();
+          pdg     = TMath::Abs(primary->GetPdgCode());
+          if(GetDebug() > 1 )printf("\t pdg %d, index %d, %s, status %d \n",pdg, iMother,  primary->GetName(),status); 
+        }      
         
-       if(GetDebug() > 1 ) {
-         printf("AliAnaCalorimeterQA::ClusterHistograms() - Converted Cluster mother before conversion: \n");
-         printf("\t Mother label %d, pdg %d, %s, status %d, parent %d \n",iMother, pdg, primary->GetName(), status, iParent);
-       }
+        if(GetDebug() > 1 ) {
+          printf("AliAnaCalorimeterQA::ClusterHistograms() - Converted Cluster mother before conversion: \n");
+          printf("\t Mother label %d, pdg %d, %s, status %d, parent %d \n",iMother, pdg, primary->GetName(), status, iParent);
+        }
         
       }
       
       //Overlapped pi0 (or eta, there will be very few), get the meson
       if(GetMCAnalysisUtils()->CheckTagBit(tag, AliMCAnalysisUtils::kMCPi0) || 
          GetMCAnalysisUtils()->CheckTagBit(tag, AliMCAnalysisUtils::kMCEta)){
-       if(GetDebug() > 1 ) printf("AliAnaCalorimeterQA::ClusterHistograms() - Overlapped Meson decay!, Find it: \n");
-       while(pdg != 111 && pdg != 221){
-         iMother = iParent;
-         primary = GetMCStack()->Particle(iMother);
-         status  = primary->GetStatusCode();
-         iParent = primary->GetFirstMother();
-         pdg     = TMath::Abs(primary->GetPdgCode());
-         if(GetDebug() > 1 ) printf("\t pdg %d, %s, index %d\n",pdg,  primary->GetName(),iMother);
-         if(iMother==-1) {
-           printf("AliAnaCalorimeterQA::ClusterHistograms() - Tagged as Overlapped photon but meson not found, why?\n");
+        if(GetDebug() > 1 ) printf("AliAnaCalorimeterQA::ClusterHistograms() - Overlapped Meson decay!, Find it: \n");
+        while(pdg != 111 && pdg != 221){
+          iMother = iParent;
+          primary = GetMCStack()->Particle(iMother);
+          status  = primary->GetStatusCode();
+          iParent = primary->GetFirstMother();
+          pdg     = TMath::Abs(primary->GetPdgCode());
+          if(GetDebug() > 1 ) printf("\t pdg %d, %s, index %d\n",pdg,  primary->GetName(),iMother);
+          if(iMother==-1) {
+            printf("AliAnaCalorimeterQA::ClusterHistograms() - Tagged as Overlapped photon but meson not found, why?\n");
             //break;
-         }
-       }
+          }
+        }
         
-       if(GetDebug() > 2 ) printf("AliAnaCalorimeterQA::ClusterHistograms() - Overlapped %s decay, label %d \n", 
+        if(GetDebug() > 2 ) printf("AliAnaCalorimeterQA::ClusterHistograms() - Overlapped %s decay, label %d \n", 
                                    primary->GetName(),iMother);
       }
       
@@ -1862,8 +1863,8 @@ void AliAnaCalorimeterQA::ClusterHistograms(const TLorentzVector mom, const Doub
     else if(GetReader()->ReadAODMCParticles() && !GetMCAnalysisUtils()->CheckTagBit(tag, AliMCAnalysisUtils::kMCUnknown)){//it MC AOD and known tag
       //Get the list of MC particles
       if(!GetReader()->GetAODMCParticles(0))   {
-       printf("AliAnaCalorimeterQA::ClusterHistograms() -  MCParticles not available!\n");
-       abort();
+        printf("AliAnaCalorimeterQA::ClusterHistograms() -  MCParticles not available!\n");
+        abort();
       }                
       
       aodprimary = (AliAODMCParticle*) (GetReader()->GetAODMCParticles(0))->At(label);
@@ -1876,58 +1877,58 @@ void AliAnaCalorimeterQA::ClusterHistograms(const TLorentzVector mom, const Doub
       iParent = aodprimary->GetMother();
       
       if(GetDebug() > 1 ) {
-       printf("AliAnaCalorimeterQA::ClusterHistograms() - Cluster most contributing mother: \n");
-       printf("\t Mother label %d, pdg %d, Primary? %d, Physical Primary? %d, parent %d \n",
+        printf("AliAnaCalorimeterQA::ClusterHistograms() - Cluster most contributing mother: \n");
+        printf("\t Mother label %d, pdg %d, Primary? %d, Physical Primary? %d, parent %d \n",
                iMother, pdg0, aodprimary->IsPrimary(), aodprimary->IsPhysicalPrimary(), iParent);
       }
       
       //Get final particle, no conversion products
       if(GetMCAnalysisUtils()->CheckTagBit(tag, AliMCAnalysisUtils::kMCConversion)){
-       if(GetDebug() > 1 ) 
-         printf("AliAnaCalorimeterQA::ClusterHistograms() - Converted cluster!. Find before conversion: \n");
+        if(GetDebug() > 1 ) 
+          printf("AliAnaCalorimeterQA::ClusterHistograms() - Converted cluster!. Find before conversion: \n");
         //Get the parent
-       aodprimary = (AliAODMCParticle*)(GetReader()->GetAODMCParticles(0))->At(iParent);
-       pdg = TMath::Abs(aodprimary->GetPdgCode());
-       while ((pdg == 22 || pdg == 11) && !aodprimary->IsPhysicalPrimary()) {
-         iMother    = iParent;
-         aodprimary = (AliAODMCParticle*)(GetReader()->GetAODMCParticles(0))->At(iMother);
-         status     = aodprimary->IsPrimary();
-         iParent    = aodprimary->GetMother();
-         pdg        = TMath::Abs(aodprimary->GetPdgCode());
-         if(GetDebug() > 1 )
-           printf("\t pdg %d, index %d, Primary? %d, Physical Primary? %d \n",
+        aodprimary = (AliAODMCParticle*)(GetReader()->GetAODMCParticles(0))->At(iParent);
+        pdg = TMath::Abs(aodprimary->GetPdgCode());
+        while ((pdg == 22 || pdg == 11) && !aodprimary->IsPhysicalPrimary()) {
+          iMother    = iParent;
+          aodprimary = (AliAODMCParticle*)(GetReader()->GetAODMCParticles(0))->At(iMother);
+          status     = aodprimary->IsPrimary();
+          iParent    = aodprimary->GetMother();
+          pdg        = TMath::Abs(aodprimary->GetPdgCode());
+          if(GetDebug() > 1 )
+            printf("\t pdg %d, index %d, Primary? %d, Physical Primary? %d \n",
                    pdg, iMother, aodprimary->IsPrimary(), aodprimary->IsPhysicalPrimary());    
-       }       
-       
-       if(GetDebug() > 1 ) {
-         printf("AliAnaCalorimeterQA::ClusterHistograms() - Converted Cluster mother before conversion: \n");
-         printf("\t Mother label %d, pdg %d, parent %d, Primary? %d, Physical Primary? %d \n",
+        }      
+        
+        if(GetDebug() > 1 ) {
+          printf("AliAnaCalorimeterQA::ClusterHistograms() - Converted Cluster mother before conversion: \n");
+          printf("\t Mother label %d, pdg %d, parent %d, Primary? %d, Physical Primary? %d \n",
                  iMother, pdg, iParent, aodprimary->IsPrimary(), aodprimary->IsPhysicalPrimary());
-       }
-       
+        }
+        
       }
       
       //Overlapped pi0 (or eta, there will be very few), get the meson
       if(GetMCAnalysisUtils()->CheckTagBit(tag, AliMCAnalysisUtils::kMCPi0) || 
          GetMCAnalysisUtils()->CheckTagBit(tag, AliMCAnalysisUtils::kMCEta)){
-       if(GetDebug() > 1 ) printf("AliAnaCalorimeterQA::ClusterHistograms() - Overlapped Meson decay!, Find it: PDG %d, mom %d \n",pdg, iMother);
-       while(pdg != 111 && pdg != 221){
-         
-         iMother    = iParent;
-         aodprimary = (AliAODMCParticle*)(GetReader()->GetAODMCParticles(0))->At(iMother);
-         status     = aodprimary->IsPrimary();
-         iParent    = aodprimary->GetMother();
-         pdg        = TMath::Abs(aodprimary->GetPdgCode());
+        if(GetDebug() > 1 ) printf("AliAnaCalorimeterQA::ClusterHistograms() - Overlapped Meson decay!, Find it: PDG %d, mom %d \n",pdg, iMother);
+        while(pdg != 111 && pdg != 221){
           
-         if(GetDebug() > 1 ) printf("\t pdg %d, index %d\n",pdg, iMother);
-         
-         if(iMother==-1) {
-           printf("AliAnaCalorimeterQA::ClusterHistograms() - Tagged as Overlapped photon but meson not found, why?\n");
+          iMother    = iParent;
+          aodprimary = (AliAODMCParticle*)(GetReader()->GetAODMCParticles(0))->At(iMother);
+          status     = aodprimary->IsPrimary();
+          iParent    = aodprimary->GetMother();
+          pdg        = TMath::Abs(aodprimary->GetPdgCode());
+          
+          if(GetDebug() > 1 ) printf("\t pdg %d, index %d\n",pdg, iMother);
+          
+          if(iMother==-1) {
+            printf("AliAnaCalorimeterQA::ClusterHistograms() - Tagged as Overlapped photon but meson not found, why?\n");
             //break;
-         }
-       }       
-       
-       if(GetDebug() > 2 ) printf("AliAnaCalorimeterQA::ClusterHistograms() - Overlapped %s decay, label %d \n", 
+          }
+        }      
+        
+        if(GetDebug() > 2 ) printf("AliAnaCalorimeterQA::ClusterHistograms() - Overlapped %s decay, label %d \n", 
                                    aodprimary->GetName(),iMother);
       }        
       
@@ -2009,10 +2010,10 @@ void AliAnaCalorimeterQA::ClusterHistograms(const TLorentzVector mom, const Doub
       fhEMVxyz   ->Fill(vxMC,vyMC);//,vz);
       fhEMR      ->Fill(e,rVMC);
       if( nTracksMatched > 0){
-       fhEleECharged     ->Fill(e,eMC);                
-       fhElePtCharged    ->Fill(pt,ptMC);
-       fhElePhiCharged   ->Fill(phi,phiMC);
-       fhEleEtaCharged   ->Fill(eta,etaMC);
+        fhEleECharged     ->Fill(e,eMC);               
+        fhElePtCharged    ->Fill(pt,ptMC);
+        fhElePhiCharged   ->Fill(phi,phiMC);
+        fhEleEtaCharged   ->Fill(eta,etaMC);
       }
     }
     else if(charge == 0){
@@ -2023,10 +2024,10 @@ void AliAnaCalorimeterQA::ClusterHistograms(const TLorentzVector mom, const Doub
       fhHaVxyz     ->Fill(vxMC,vyMC);//,vz);
       fhHaR        ->Fill(e,rVMC);
       if( nTracksMatched > 0){
-       fhNeHadECharged     ->Fill(e,eMC);              
-       fhNeHadPtCharged    ->Fill(pt,ptMC);
-       fhNeHadPhiCharged   ->Fill(phi,phiMC);
-       fhNeHadEtaCharged   ->Fill(eta,etaMC);
+        fhNeHadECharged     ->Fill(e,eMC);             
+        fhNeHadPtCharged    ->Fill(pt,ptMC);
+        fhNeHadPhiCharged   ->Fill(phi,phiMC);
+        fhNeHadEtaCharged   ->Fill(eta,etaMC);
       }
     }
     else if(charge!=0){
@@ -2037,10 +2038,10 @@ void AliAnaCalorimeterQA::ClusterHistograms(const TLorentzVector mom, const Doub
       fhHaVxyz     ->Fill(vxMC,vyMC);//,vz);
       fhHaR        ->Fill(e,rVMC);
       if( nTracksMatched > 0){
-       fhChHadECharged     ->Fill(e,eMC);              
-       fhChHadPtCharged    ->Fill(pt,ptMC);
-       fhChHadPhiCharged   ->Fill(phi,phiMC);
-       fhChHadEtaCharged   ->Fill(eta,etaMC);
+        fhChHadECharged     ->Fill(e,eMC);             
+        fhChHadPtCharged    ->Fill(pt,ptMC);
+        fhChHadPhiCharged   ->Fill(phi,phiMC);
+        fhChHadEtaCharged   ->Fill(eta,etaMC);
       }
     }
   }//Work with MC
@@ -2978,11 +2979,12 @@ void  AliAnaCalorimeterQA::Terminate(TList* outputList)
        }
        pLegendPhiCl.Draw();
        
-  //ETA
+       //ETA
        cetaphic->cd(2) ; 
        gPad->SetLogy();
        gPad->SetGridy();
   
+       delete htmp; 
        htmp = fhEtaPhiE->ProjectionX("heta_cluster_nocut",0,-1,0,-1);
        htmp ->SetLineColor(1);
        rbEta =  GetNewRebinForRePlotting(htmp,etamin, etamax,netabins) ;
@@ -3030,7 +3032,8 @@ void  AliAnaCalorimeterQA::Terminate(TList* outputList)
        pLegendPhiCell.SetTextSize(0.03);
        pLegendPhiCell.SetFillColor(10);
        pLegendPhiCell.SetBorderSize(1);
-       
+  
+       delete htmp; 
        htmp = fhEtaPhiAmp->ProjectionY("hphi_cell_nocut",0,-1,0,-1);
        if(htmp){
          htmp->SetMinimum(1);
@@ -3057,7 +3060,8 @@ void  AliAnaCalorimeterQA::Terminate(TList* outputList)
        cetaphicell->cd(2) ; 
        gPad->SetLogy();
        gPad->SetGridy();
-       
+  
+       delete htmp; 
        htmp = fhEtaPhiAmp->ProjectionX("heta_cell_nocut",0,-1,0,-1);
        if(htmp){
          htmp ->SetLineColor(1);
@@ -3162,7 +3166,7 @@ void  AliAnaCalorimeterQA::Terminate(TList* outputList)
     snprintf(name,buffersize,"QA_%s_ClusterX_Y_Z.eps",fCalorimeter.Data());
     cx->Print(name); printf("Create plot %s\n",name);
   }
-    //CELLS
+  //CELLS
   if(fFillAllPosHisto)
   { 
     snprintf(cname,buffersize,"%s_QA_CellXY",fCalorimeter.Data());
@@ -3243,6 +3247,7 @@ void  AliAnaCalorimeterQA::Terminate(TList* outputList)
     pLegendXCl.SetFillColor(10);
     pLegendXCl.SetBorderSize(1);
     
+    delete htmp; 
     htmp = fhRE->ProjectionX("hre_cluster_nocut",0,-1);
     Int_t rbR=1;
     if(htmp){
@@ -3271,6 +3276,7 @@ void  AliAnaCalorimeterQA::Terminate(TList* outputList)
     cxe->cd(2) ; 
     gPad->SetLogy();
     gPad->SetGridy();
+    delete htmp; 
     htmp = fhXE->ProjectionX("hxe_cluster_nocut",0,-1);
     if(htmp){
       htmp->SetMinimum(1);
@@ -3292,6 +3298,8 @@ void  AliAnaCalorimeterQA::Terminate(TList* outputList)
     cxe->cd(3) ; 
     gPad->SetLogy();
     gPad->SetGridy();
+    
+    delete htmp; 
     htmp = fhYE->ProjectionX("hye_cluster_nocut",0,-1);
     if(htmp){
       htmp->SetMinimum(1);
@@ -3314,6 +3322,7 @@ void  AliAnaCalorimeterQA::Terminate(TList* outputList)
     gPad->SetLogy();
     gPad->SetGridy();
     
+    delete htmp; 
     htmp = fhZE->ProjectionX("hze_cluster_nocut",0,-1);
     if(htmp){
       htmp->SetMinimum(1);
@@ -3354,6 +3363,7 @@ void  AliAnaCalorimeterQA::Terminate(TList* outputList)
     pLegendXClN.SetFillColor(10);
     pLegendXClN.SetBorderSize(1);
     
+    delete htmp; 
     htmp = fhRNCells->ProjectionX("hrn_cluster_nocut",0,-1);
     if(htmp){
       htmp->SetMinimum(1);
@@ -3380,6 +3390,8 @@ void  AliAnaCalorimeterQA::Terminate(TList* outputList)
     cxn->cd(2) ; 
     gPad->SetLogy();
     gPad->SetGridy();
+    
+    delete htmp; 
     htmp = fhXNCells->ProjectionX("hxn_cluster_nocut",0,-1);
     if(htmp){
       htmp->SetMinimum(1);
@@ -3400,6 +3412,7 @@ void  AliAnaCalorimeterQA::Terminate(TList* outputList)
     cxn->cd(3) ; 
     gPad->SetLogy();
     gPad->SetGridy();
+    delete htmp; 
     htmp = fhYNCells->ProjectionX("hyn_cluster_nocut",0,-1);
     if(htmp){
       htmp->SetMinimum(1);
@@ -3421,6 +3434,7 @@ void  AliAnaCalorimeterQA::Terminate(TList* outputList)
     gPad->SetLogy();
     gPad->SetGridy();
     
+    delete htmp; 
     htmp = fhZNCells->ProjectionX("hzn_cluster_nocut",0,-1);
     if(htmp){
       htmp->SetMinimum(1);
@@ -3459,6 +3473,7 @@ void  AliAnaCalorimeterQA::Terminate(TList* outputList)
     pLegendXCell.SetFillColor(10);
     pLegendXCell.SetBorderSize(1);
     
+    delete htmp; 
     htmp = fhRCellE->ProjectionX("hre_cell_nocut",0,-1);
     if(htmp){
       htmp->SetMinimum(1);
@@ -3485,6 +3500,7 @@ void  AliAnaCalorimeterQA::Terminate(TList* outputList)
     gPad->SetLogy();
     gPad->SetGridy();
     
+    delete htmp; 
     htmp = fhXCellE->ProjectionX("hxe_cells_nocut",0,-1);
     if(htmp){
       htmp->SetMinimum(1);
@@ -3506,6 +3522,7 @@ void  AliAnaCalorimeterQA::Terminate(TList* outputList)
     cxecell->cd(3) ; 
     gPad->SetLogy();
     gPad->SetGridy();
+    delete htmp; 
     htmp = fhYCellE->ProjectionX("hye_cells_nocut",0,-1);
     if(htmp){
       htmp->SetMinimum(1);
@@ -3517,6 +3534,7 @@ void  AliAnaCalorimeterQA::Terminate(TList* outputList)
       for (Int_t i = 0; i < ncuts; i++) {
         binmin =  hE->FindBin(ecut[i]);
         //printf(" bins %d for e %f\n",binmin[i],ecut[i]);
+        delete htmp; 
         htmp = fhYCellE->ProjectionX(Form("hye_cells_cut%d",i),binmin,-1);
         htmp->SetLineColor(ecutcolor[i]);
         htmp->Rebin(rbY);
@@ -3527,6 +3545,7 @@ void  AliAnaCalorimeterQA::Terminate(TList* outputList)
     cxecell->cd(4) ; 
     gPad->SetLogy();
     gPad->SetGridy();
+    delete htmp; 
     htmp = fhZCellE->ProjectionX("hze_cells_nocut",0,-1);
     if(htmp){
       htmp->SetMinimum(1);
@@ -3538,6 +3557,7 @@ void  AliAnaCalorimeterQA::Terminate(TList* outputList)
       for (Int_t i = 0; i < ncuts; i++) {
         binmin =  hE->FindBin(ecut[i]);
         //printf(" bins %d for e %f\n",binmin[i],ecut[i]);
+        delete htmp; 
         htmp = fhZCellE->ProjectionX(Form("hze_cells_cut%d",i),binmin,-1);
         htmp->SetLineColor(ecutcolor[i]);
         htmp->Rebin(rbZ);
@@ -3569,6 +3589,7 @@ void  AliAnaCalorimeterQA::Terminate(TList* outputList)
     pLegendXClD.SetFillColor(10);
     pLegendXClD.SetBorderSize(1);
     
+    delete htmp; 
     htmp = fhDeltaCellClusterRE->ProjectionX("hrde_nocut",0,-1);
     if(htmp){
       htmp->SetMinimum(1);
@@ -3581,6 +3602,7 @@ void  AliAnaCalorimeterQA::Terminate(TList* outputList)
       for (Int_t i = 0; i < ncuts; i++) {
         binmin =  hE->FindBin(ecut[i]);
         //printf(" bins %d for e %f\n",binmin[i],ecut[i]);
+        delete htmp; 
         htmp = fhDeltaCellClusterRE->ProjectionX(Form("hrde_cut%d",i),binmin,-1);
         htmp->SetLineColor(ecutcolor[i]);
         htmp->Rebin(rbDR);
@@ -3594,6 +3616,7 @@ void  AliAnaCalorimeterQA::Terminate(TList* outputList)
     cxde->cd(2) ; 
     gPad->SetLogy();
     gPad->SetGridy();
+    delete htmp; 
     htmp = fhDeltaCellClusterXE->ProjectionX("hxde_nocut",0,-1);
     if(htmp){
       htmp->SetMinimum(1);
@@ -3605,6 +3628,7 @@ void  AliAnaCalorimeterQA::Terminate(TList* outputList)
       for (Int_t i = 0; i < ncuts; i++) {
         binmin =  hE->FindBin(ecut[i]);
         //printf(" bins %d for e %f\n",binmin[i],ecut[i]);
+        delete htmp; 
         htmp = fhDeltaCellClusterXE->ProjectionX(Form("hxde_cut%d",i),binmin,-1);
         htmp->SetLineColor(ecutcolor[i]);
         htmp->Rebin(rbDX);
@@ -3616,6 +3640,7 @@ void  AliAnaCalorimeterQA::Terminate(TList* outputList)
     cxde->cd(3) ; 
     gPad->SetLogy();
     gPad->SetGridy();
+    delete htmp; 
     htmp = fhDeltaCellClusterYE->ProjectionX("hyde_nocut",0,-1);
     if(htmp){
       htmp->SetMinimum(1);
@@ -3627,6 +3652,7 @@ void  AliAnaCalorimeterQA::Terminate(TList* outputList)
       for (Int_t i = 0; i < ncuts; i++) {
         binmin =  hE->FindBin(ecut[i]);
         //printf(" bins %d for e %f\n",binmin[i],ecut[i]);
+        delete htmp; 
         htmp = fhDeltaCellClusterYE->ProjectionX(Form("hyde_cut%d",i),binmin,-1);
         htmp->SetLineColor(ecutcolor[i]);
         htmp->Rebin(rbDY);
@@ -3639,6 +3665,7 @@ void  AliAnaCalorimeterQA::Terminate(TList* outputList)
     gPad->SetLogy();
     gPad->SetGridy();
     
+    delete htmp; 
     htmp = fhDeltaCellClusterZE->ProjectionX("hzde_nocut",0,-1);
     if(htmp){
       htmp->SetMinimum(1);
@@ -3650,6 +3677,7 @@ void  AliAnaCalorimeterQA::Terminate(TList* outputList)
       for (Int_t i = 0; i < ncuts; i++) {
         binmin =  hE->FindBin(ecut[i]);
         //printf(" bins %d for e %f\n",binmin[i],ecut[i]);
+        delete htmp; 
         htmp = fhDeltaCellClusterZE->ProjectionX(Form("hzde_cut%d",i),binmin,-1);
         htmp->SetLineColor(ecutcolor[i]);
         htmp->Rebin(rbZ);
@@ -3677,7 +3705,7 @@ void  AliAnaCalorimeterQA::Terminate(TList* outputList)
     pLegendXClDN.SetTextSize(0.03);
     pLegendXClDN.SetFillColor(10);
     pLegendXClDN.SetBorderSize(1);
-    
+    delete htmp; 
     htmp = fhDeltaCellClusterRNCells->ProjectionX("hrdn_nocut",0,-1);
     if(htmp){
       htmp->SetMinimum(1);
@@ -3688,6 +3716,7 @@ void  AliAnaCalorimeterQA::Terminate(TList* outputList)
       pLegendXClDN.AddEntry(htmp,"No cut","L");
       
       for (Int_t i = 0; i < ncellcuts; i++) {
+        delete htmp; 
         if(i < ncellcuts-1) htmp = fhDeltaCellClusterRNCells->ProjectionX(Form("hrdn_cut%d",i),ncellcut[i],ncellcut[i]);
         else htmp = fhDeltaCellClusterRNCells->ProjectionX(Form("hrdn_cut%d",i),ncellcut[i],-1);
         htmp->SetLineColor(ecutcolor[i]);
@@ -3704,6 +3733,7 @@ void  AliAnaCalorimeterQA::Terminate(TList* outputList)
     cxdn->cd(2) ; 
     gPad->SetLogy();
     gPad->SetGridy();
+    delete htmp; 
     htmp = fhDeltaCellClusterXNCells->ProjectionX("hxdn_nocut",0,-1);
     if(htmp){
       htmp->SetMinimum(1);
@@ -3713,6 +3743,7 @@ void  AliAnaCalorimeterQA::Terminate(TList* outputList)
       htmp->Draw("HE");
       
       for (Int_t i = 0; i < ncellcuts; i++) {
+        delete htmp; 
         if(i < ncellcuts-1)htmp = fhDeltaCellClusterXNCells->ProjectionX(Form("hxdn_cut%d",i),ncellcut[i],ncellcut[i]);
         else htmp = fhDeltaCellClusterXNCells->ProjectionX(Form("hxdn_cut%d",i),ncellcut[i],-1);
         htmp->SetLineColor(ecutcolor[i]);
@@ -3725,6 +3756,7 @@ void  AliAnaCalorimeterQA::Terminate(TList* outputList)
     cxdn->cd(3) ; 
     gPad->SetLogy();
     gPad->SetGridy();
+    delete htmp; 
     htmp = fhDeltaCellClusterYNCells->ProjectionX("hydn_nocut",0,-1);
     if(htmp){
       htmp->SetMinimum(1);
@@ -3734,6 +3766,7 @@ void  AliAnaCalorimeterQA::Terminate(TList* outputList)
       htmp->Draw("HE");
       
       for (Int_t i = 0; i < ncellcuts; i++) {
+        delete htmp; 
         if(i < ncellcuts-1) htmp = fhDeltaCellClusterYNCells->ProjectionX(Form("hydn_cut%d",i),ncellcut[i],ncellcut[i]);
         else htmp = fhDeltaCellClusterYNCells->ProjectionX(Form("hydn_cut%d",i),ncellcut[i],-1);
         htmp->SetLineColor(ecutcolor[i]);
@@ -3746,7 +3779,7 @@ void  AliAnaCalorimeterQA::Terminate(TList* outputList)
     cxdn->cd(4) ; 
     gPad->SetLogy();
     gPad->SetGridy();
-    
+    delete htmp; 
     htmp = fhDeltaCellClusterZNCells->ProjectionX("hzdn_nocut",0,-1);
     if(htmp){
       htmp->SetMinimum(1);
@@ -3756,6 +3789,7 @@ void  AliAnaCalorimeterQA::Terminate(TList* outputList)
       htmp->Draw("HE");
       
       for (Int_t i = 0; i < ncellcuts; i++) {
+        delete htmp; 
         if(i < ncellcuts-1)htmp = fhDeltaCellClusterZNCells->ProjectionX(Form("hzdn_cut%d",i),ncellcut[i],ncellcut[i]);
         else htmp = fhDeltaCellClusterZNCells->ProjectionX(Form("hzdn_cut%d",i),ncellcut[i],-1);
         htmp->SetLineColor(ecutcolor[i]);
@@ -3886,6 +3920,7 @@ void  AliAnaCalorimeterQA::Terminate(TList* outputList)
        cN->cd(2) ; 
        gPad->SetLogx();
        for(Int_t imod = 1; imod < fNModules; imod++){
+    delete htmp; 
                htmp = (TH1D*)fhNClustersMod[imod]->Clone(Form("hNClustersRat%d",imod));
                htmp->Divide(fhNClustersMod[0]);
                htmp->SetLineColor(modColorIndex[imod]);
@@ -3916,6 +3951,7 @@ void  AliAnaCalorimeterQA::Terminate(TList* outputList)
        cN->cd(4) ; 
        gPad->SetLogx();
        for(Int_t imod = 1; imod < fNModules; imod++){
+    delete htmp; 
                htmp = (TH1D*)fhNCellsMod[imod]->Clone(Form("hNCellsRat%d",imod));
                htmp->Divide(fhNCellsMod[0]);
                htmp->SetLineColor(modColorIndex[imod]);
@@ -3949,6 +3985,7 @@ void  AliAnaCalorimeterQA::Terminate(TList* outputList)
        cN->cd(6) ; 
        gPad->SetLogx();
        for(Int_t imod = 1; imod < fNModules; imod++){
+    delete htmp; 
                htmp = (TH1D*)hNCellsCluster1D[imod]->Clone(Form("hNClustersCells1DRat%d",imod));
                htmp->Divide(hNCellsCluster1D[0]);
                htmp->SetLineColor(modColorIndex[imod]);
index 466fa6dda46c825512fd3879da1e57c3a5651cea..32e65d94d43b5817b9206e5782a2c7e7cb3d1d45 100755 (executable)
@@ -27,7 +27,7 @@
 // --- ROOT system ---
 #include "TParticle.h"
 #include "TH2F.h"
-
+#include "TH3D.h"
 //---- AliRoot system ----
 #include "AliAnaChargedParticles.h"
 #include "AliCaloTrackReader.h"
@@ -41,7 +41,8 @@ ClassImp(AliAnaChargedParticles)
   
 //____________________________________________________________________________
   AliAnaChargedParticles::AliAnaChargedParticles() : 
-    AliAnaPartCorrBaseClass(),fPdg(0), fhPt(0),fhPhi(0),fhEta(0), 
+    AliAnaPartCorrBaseClass(),fPdg(0), fhNtracks(0),fhVertex(0), fhPt(0),fhPhi(0),fhEta(0), 
+    fhPtEtaPhiPos(0), fhPtEtaPhiNeg(0),
     fhPtPion(0),fhPhiPion(0),fhEtaPion(0),
     fhPtProton(0),fhPhiProton(0),fhEtaProton(0),
     fhPtElectron(0),fhPhiElectron(0),fhEtaElectron(0),
@@ -113,6 +114,16 @@ TList *  AliAnaChargedParticles::GetCreateOutputObjects()
   Float_t ptmin  = GetHistoPtMin();
   Float_t phimin = GetHistoPhiMin();
   Float_t etamin = GetHistoEtaMin();   
+
+  fhNtracks  = new TH1F ("hNtracks","# of tracks", 1000,0,1000); 
+  fhNtracks->SetXTitle("# of tracks");
+  outputContainer->Add(fhNtracks);
+  
+  fhVertex  = new TH3D ("Vertex","vertex position", 100,-50.,50., 100,-50.,50., 100,-50.,50.); 
+  fhVertex->SetXTitle("X");
+  fhVertex->SetYTitle("Y");
+  fhVertex->SetZTitle("Z");
+  outputContainer->Add(fhVertex);
   
   fhPt  = new TH1F ("hPtCharged","p_T distribution", nptbins,ptmin,ptmax); 
   fhPt->SetXTitle("p_{T} (GeV/c)");
@@ -126,6 +137,17 @@ TList *  AliAnaChargedParticles::GetCreateOutputObjects()
   fhEta->SetXTitle("#eta ");
   outputContainer->Add(fhEta);
   
+  fhPtEtaPhiPos  = new TH3D ("hPtEtaPhiPos","pt/eta/phi of positive charge",nptbins,ptmin,ptmax, netabins,etamin,etamax, nphibins,phimin,phimax); 
+  fhPtEtaPhiPos->SetXTitle("p_{T}^{h^{+}} (GeV/c)");
+  fhPtEtaPhiPos->SetYTitle("#eta ");
+  fhPtEtaPhiPos->SetZTitle("#phi (rad)");  
+  outputContainer->Add(fhPtEtaPhiPos);
+  
+  fhPtEtaPhiNeg  = new TH3D ("hPtEtaPhiNeg","pt/eta/phi of negative charge",nptbins,ptmin,ptmax, netabins,etamin,etamax, nphibins,phimin,phimax); 
+  fhPtEtaPhiNeg->SetXTitle("p_{T}^{h^{-}} (GeV/c)");
+  fhPtEtaPhiNeg->SetYTitle("#eta ");
+  fhPtEtaPhiNeg->SetZTitle("#phi (rad)");  
+  outputContainer->Add(fhPtEtaPhiNeg);
   
   if(IsDataMC()){
     
@@ -249,6 +271,8 @@ void  AliAnaChargedParticles::MakeAnalysisFillAOD()
   
   //Fill AODParticle with CTS aods
   TVector3 p3;
+  Int_t evtIndex = 0;
+  Double_t vert[3]={0,0,0};
   for(Int_t i = 0; i < ntracks; i++){
     
     AliAODTrack * track =  (AliAODTrack*) (GetAODCTS()->At(i));
@@ -264,11 +288,17 @@ void  AliAnaChargedParticles::MakeAnalysisFillAOD()
       //Keep only particles identified with fPdg
       //Selection not done for the moment
       //Should be done here.
+      if (GetMixedEvent()){
+        evtIndex = GetMixedEvent()->EventIndex(track->GetID()) ;
+      }        
+      GetVertex(vert,evtIndex); 
+      if(TMath::Abs(vert[2])> GetZvertexCut()) continue;
       
       AliAODPWG4Particle tr = AliAODPWG4Particle(mom[0],mom[1],mom[2],0);
       tr.SetDetector("CTS");
       tr.SetLabel(track->GetLabel());
       tr.SetTrackLabel(track->GetID(),-1);
+    //  tr.SetChargedBit(track->Charge());
          //Input from second AOD?
          //if(GetReader()->GetAODCTSNormalInputEntries() <= i) tr.SetInputFileIndex(1);
                
@@ -287,6 +317,10 @@ void  AliAnaChargedParticles::MakeAnalysisFillHistograms()
   
   //Loop on stored AODParticles
   Int_t naod = GetOutputAODBranch()->GetEntriesFast();
+  if(naod!=0)fhNtracks->Fill(GetAODCTS()->GetEntriesFast()) ;
+  Double_t v[3] = {0,0,0}; //vertex ;
+  GetReader()->GetVertex(v);
+  fhVertex->Fill(v[0],v[1],v[2]);
   if(GetDebug() > 0) printf("AliAnaChargedParticles::MakeAnalysisFillHistograms() - aod branch entries %d\n", naod);
   for(Int_t iaod = 0; iaod < naod ; iaod++){
     AliAODPWG4Particle* tr =  (AliAODPWG4Particle*) (GetOutputAODBranch()->At(iaod));
@@ -294,47 +328,51 @@ void  AliAnaChargedParticles::MakeAnalysisFillHistograms()
     fhPt->Fill(tr->Pt());
     fhPhi->Fill(tr->Pt(), tr->Phi());
     fhEta->Fill(tr->Pt(), tr->Eta());
+    //for charge information
+    AliAODTrack * track =  (AliAODTrack*) (GetAODCTS()->At(iaod));
+    if(track->Charge()>0)fhPtEtaPhiPos->Fill(tr->Pt(), tr->Eta(),tr->Phi());
+    if(track->Charge()<0)fhPtEtaPhiNeg->Fill(tr->Pt(), tr->Eta(),tr->Phi());
     
     if(IsDataMC()){
       //Play with the MC stack if available            
-         Int_t mompdg = -1;
-         Int_t label  = tr->GetLabel();
-         if(GetReader()->ReadStack()){
-                 TParticle * mom = GetMCStack()->Particle(label);
-                 mompdg =TMath::Abs(mom->GetPdgCode());
+      Int_t mompdg = -1;
+      Int_t label  = tr->GetLabel();
+      if(GetReader()->ReadStack()){
+        TParticle * mom = GetMCStack()->Particle(label);
+        mompdg =TMath::Abs(mom->GetPdgCode());
       }
-         else if(GetReader()->ReadAODMCParticles()){
-               AliAODMCParticle * aodmom = 0;
-               //Get the list of MC particles
-           aodmom = (AliAODMCParticle*) (GetReader()->GetAODMCParticles(tr->GetInputFileIndex()))->At(label);
-               mompdg =TMath::Abs(aodmom->GetPdgCode());
-        }
-               
-        if(mompdg==211){
-       fhPtPion->Fill(tr->Pt());
-       fhPhiPion->Fill(tr->Pt(), tr->Phi());
-       fhEtaPion->Fill(tr->Pt(), tr->Eta());
+      else if(GetReader()->ReadAODMCParticles()){
+        AliAODMCParticle * aodmom = 0;
+        //Get the list of MC particles
+        aodmom = (AliAODMCParticle*) (GetReader()->GetAODMCParticles(tr->GetInputFileIndex()))->At(label);
+        mompdg =TMath::Abs(aodmom->GetPdgCode());
+      }
+      
+      if(mompdg==211){
+        fhPtPion->Fill(tr->Pt());
+        fhPhiPion->Fill(tr->Pt(), tr->Phi());
+        fhEtaPion->Fill(tr->Pt(), tr->Eta());
       }
       else if(mompdg==2212){
-       fhPtProton->Fill(tr->Pt());
-       fhPhiProton->Fill(tr->Pt(), tr->Phi());
-       fhEtaProton->Fill(tr->Pt(), tr->Eta());
+        fhPtProton->Fill(tr->Pt());
+        fhPhiProton->Fill(tr->Pt(), tr->Phi());
+        fhEtaProton->Fill(tr->Pt(), tr->Eta());
       }
       else if(mompdg==321){
-       fhPtKaon->Fill(tr->Pt());
-       fhPhiKaon->Fill(tr->Pt(), tr->Phi());
-       fhEtaKaon->Fill(tr->Pt(), tr->Eta());
+        fhPtKaon->Fill(tr->Pt());
+        fhPhiKaon->Fill(tr->Pt(), tr->Phi());
+        fhEtaKaon->Fill(tr->Pt(), tr->Eta());
       }
       else if(mompdg==11){
-       fhPtElectron->Fill(tr->Pt());
-       fhPhiElectron->Fill(tr->Pt(), tr->Phi());
-       fhEtaElectron->Fill(tr->Pt(), tr->Eta());
+        fhPtElectron->Fill(tr->Pt());
+        fhPhiElectron->Fill(tr->Pt(), tr->Phi());
+        fhEtaElectron->Fill(tr->Pt(), tr->Eta());
       }
       else {
-       //printf("unknown pdg %d\n",mompdg);
-       fhPtUnknown->Fill(tr->Pt());
-       fhPhiUnknown->Fill(tr->Pt(), tr->Phi());
-       fhEtaUnknown->Fill(tr->Pt(), tr->Eta());
+        //printf("unknown pdg %d\n",mompdg);
+        fhPtUnknown->Fill(tr->Pt());
+        fhPhiUnknown->Fill(tr->Pt(), tr->Phi());
+        fhEtaUnknown->Fill(tr->Pt(), tr->Eta());
       }
     }//Work with stack also
   }// aod branch loop
index a0e61a9c7c6538bec351a57a1a92abadd4de8282..4bde457ecd9f078b6fcbf7e2182954456d9cec55 100755 (executable)
@@ -15,7 +15,7 @@
 //-- Author: Gustavo Conesa (INFN-LNF)
 // Root system
 class TH2F; 
-
+class TH3D;
 // Analysis system
 #include "AliAnaPartCorrBaseClass.h"
  
@@ -50,10 +50,14 @@ class AliAnaChargedParticles : public AliAnaPartCorrBaseClass {
   
   Int_t  fPdg ; //identified particle id
   //Histograms 
+  TH1F * fhNtracks; //! track multiplicity distribution
+  TH3D * fhVertex; //! vertex distribution
   TH1F * fhPt; //! pT distribution
   TH2F * fhPhi; //! phi distribution vs pT
   TH2F * fhEta; //! eta distribution vs pT
-  
+  TH3D * fhPtEtaPhiPos; //! pT and phi distribution of positive charge  
+  TH3D * fhPtEtaPhiNeg; //! pT and phi distribution of positive charge  
+
   //MC
   TH1F * fhPtPion; //! pT distribution
   TH2F * fhPhiPion; //! phi distribution vs pT
@@ -75,7 +79,7 @@ class AliAnaChargedParticles : public AliAnaPartCorrBaseClass {
   TH2F * fhPhiUnknown; //! phi distribution vs pT
   TH2F * fhEtaUnknown; //! eta distribution vs pT
   
-  ClassDef(AliAnaChargedParticles,1)
+  ClassDef(AliAnaChargedParticles,2)
     } ;
 
 
index 3f1cb365cdb31956bcacea1c617687a9c59b1e32..0800105e5c99d55b809e0a22ad3ee787b017f875 100755 (executable)
@@ -24,6 +24,7 @@
 // 2. change the correlation variable
 // 3. Only use leading particle(cluster/track) as trigger for correlation (2010/07/02)
 // 4. Make decay photon-hadron correlations where decay contribute pi0 mass (2010/09/09)
+// 5. fill the pout to extract kt at the end, also to study charge asymmetry(2010/10/06) 
 //////////////////////////////////////////////////////////////////////////////
 
 
@@ -56,29 +57,40 @@ ClassImp(AliAnaParticleHadronCorrelation)
     AliAnaPartCorrBaseClass(),
     fDeltaPhiMaxCut(0.), fDeltaPhiMinCut(0.), fSelectIsolated(0),
     fMakeSeveralUE(0),  fUeDeltaPhiMaxCut(0.), fUeDeltaPhiMinCut(0.), 
-    fPi0AODBranchName(""),fPi0Trigger(0),
+    fPi0AODBranchName(""),fNeutralCorr(0), fPi0Trigger(0),
+   // fMultiBin(0),fNZvertBin(0),fNrpBin(0),fZvtxCut(0.),
+   // fUseSelectEvent(kFALSE), 
+    fhNclustersNtracks(0), fhVertex(0),
     fhPtLeading(0),fhPhiLeading(0),fhEtaLeading(0), 
-    fhDeltaPhiDeltaEtaCharged(0),fhDeltaPhiDeltaEtaNeutral(0),
-    fhPhiCharged(0), fhPhiNeutral(0), fhEtaCharged(0), fhEtaNeutral(0), 
-    fhDeltaPhiCharged(0), fhDeltaPhiNeutral(0), 
-    fhDeltaEtaCharged(0), fhDeltaEtaNeutral(0),
-    fhDeltaPhiChargedPt(0), fhDeltaPhiNeutralPt(0), 
-    fhDeltaPhiUeChargedPt(0), fhDeltaPhiUeNeutralPt(0), 
-    fhPtImbalanceNeutral(0), fhPtImbalanceCharged(0), 
-    fhPtImbalanceUeCharged(0),fhPtImbalanceUeNeutral(0),
+    fhDeltaPhiDeltaEtaCharged(0),
+    fhPhiCharged(0), fhEtaCharged(0), 
+    fhDeltaPhiCharged(0), 
+    fhDeltaEtaCharged(0), 
+    fhDeltaPhiChargedPt(0), 
+    fhDeltaPhiUeChargedPt(0), 
+    fhPtImbalanceCharged(0), 
+    fhPtImbalanceUeCharged(0),
+    fhPtImbalancePosCharged(0),fhPtImbalanceNegCharged(0),
     fhPtHbpCharged(0), fhPtHbpUeCharged(0),
-    fhPtHbpNeutral(0), fhPtHbpUeNeutral(0),
     fhDeltaPhiUeLeftCharged(0),fhDeltaPhiUeRightCharged(0),
-    fhDeltaPhiUeLeftNeutral(0),fhDeltaPhiUeRightNeutral(0),
     fhPtImbalanceUeLeftCharged(0),fhPtImbalanceUeRightCharged(0),
+    fhPtHbpUeLeftCharged(0),fhPtHbpUeRightCharged(0), 
+    fhPoutTrig(0), fhPtTrigCharged(0),
+    fhTrigDeltaPhiDeltaEtaCharged(0x0), fhTrigCorr(0x0),fhTrigUeCorr(0x0),
+    fhDeltaPhiDeltaEtaNeutral(0), 
+    fhPhiNeutral(0), fhEtaNeutral(0), 
+    fhDeltaPhiNeutral(0), fhDeltaEtaNeutral(0),
+    fhDeltaPhiNeutralPt(0),fhDeltaPhiUeNeutralPt(0), 
+    fhPtImbalanceNeutral(0),fhPtImbalanceUeNeutral(0),
+    fhPtHbpNeutral(0), fhPtHbpUeNeutral(0),
+    fhDeltaPhiUeLeftNeutral(0),fhDeltaPhiUeRightNeutral(0),
     fhPtImbalanceUeLeftNeutral(0),fhPtImbalanceUeRightNeutral(0),
-    fhPtHbpUeLeftCharged(0),fhPtHbpUeRightCharged(0),
     fhPtHbpUeLeftNeutral(0),fhPtHbpUeRightNeutral(0),
     fhPtPi0DecayRatio(0),
-    fhDeltaPhiDecay1Charged(0),fhDeltaPhiDecay2Charged(0),
-    fhPtImbalanceDecay1Charged(0), fhPtImbalanceDecay2Charged(0),
-    fhDeltaPhiDecay1Neutral(0),fhDeltaPhiDecay2Neutral(0),
-    fhPtImbalanceDecay1Neutral(0), fhPtImbalanceDecay2Neutral(0)
+    fhDeltaPhiDecayCharged(0),
+    fhPtImbalanceDecayCharged(0), 
+    fhDeltaPhiDecayNeutral(0),
+    fhPtImbalanceDecayNeutral(0)
 {
   //Default Ctor
   
@@ -104,6 +116,16 @@ TList *  AliAnaParticleHadronCorrelation::GetCreateOutputObjects()
   Float_t ptmin  = GetHistoPtMin();
   Float_t phimin = GetHistoPhiMin();
   Float_t etamin = GetHistoEtaMin();   
+
+  
+  fhNclustersNtracks  = new TH2F ("Multiplicity","Neutral cluster and charged track multiplicity",1000, 0., 1000.,1000, 0., 1000.); 
+  fhNclustersNtracks->SetYTitle("# of tracks");
+  fhNclustersNtracks->SetXTitle("# of clusters");
+  
+  fhVertex  = new TH3D ("Vertex","vertex position", 100,-50.,50., 100,-50.,50., 100,-50.,50.); 
+  fhVertex->SetXTitle("X");
+  fhVertex->SetYTitle("Y");
+  fhVertex->SetZTitle("Z");
   
   fhPtLeading  = new TH1F ("hPtLeading","p_T distribution of leading particles", nptbins,ptmin,ptmax); 
   fhPtLeading->SetXTitle("p_{T}^{trig} (GeV/c)");
@@ -113,6 +135,8 @@ TList *  AliAnaParticleHadronCorrelation::GetCreateOutputObjects()
   
   fhEtaLeading  = new TH2F ("hEtaLeading","#eta distribution of leading",nptbins,ptmin,ptmax, netabins,etamin,etamax); 
   fhEtaLeading->SetYTitle("#eta ");  
+  outputContainer->Add(fhNclustersNtracks);
+  outputContainer->Add(fhVertex);  
   outputContainer->Add(fhPtLeading);
   outputContainer->Add(fhPhiLeading);
   outputContainer->Add(fhEtaLeading);
@@ -173,6 +197,18 @@ TList *  AliAnaParticleHadronCorrelation::GetCreateOutputObjects()
     fhPtImbalanceUeCharged->SetYTitle("z_{trigger Ueh^{#pm}}");
     fhPtImbalanceUeCharged->SetXTitle("p_{T trigger}");
     
+    fhPtImbalancePosCharged  = 
+    new TH2F("CorrelationPositiveCharged","z_{trigger h^{+}} = p_{T h^{+}} / p_{T trigger}",
+             nptbins,ptmin,ptmax,200,0.,2.); 
+    fhPtImbalancePosCharged->SetYTitle("z_{trigger h^{+}}");
+    fhPtImbalancePosCharged->SetXTitle("p_{T trigger}");
+    
+    fhPtImbalanceNegCharged  = 
+    new TH2F("CorrelationNegativeCharged","z_{trigger h^{-}} = p_{T h^{-}} / p_{T trigger}",
+             nptbins,ptmin,ptmax,200,0.,2.); 
+    fhPtImbalanceNegCharged->SetYTitle("z_{trigger h^{-}}");
+    fhPtImbalanceNegCharged->SetXTitle("p_{T trigger}");
+    
     fhPtHbpCharged  = 
     new TH2F("HbpCharged","#xi = ln(1/x_{E}) with charged hadrons",
              nptbins,ptmin,ptmax,200,0.,10.); 
@@ -184,6 +220,18 @@ TList *  AliAnaParticleHadronCorrelation::GetCreateOutputObjects()
              nptbins,ptmin,ptmax,200,0.,10.); 
     fhPtHbpUeCharged->SetYTitle("ln(1/x_{E})");
     fhPtHbpUeCharged->SetXTitle("p_{T trigger}");
+    
+    fhPoutTrig  = 
+    new TH2F("PoutTrigPt","Pout with charged hadrons",
+             nptbins,ptmin,ptmax,nptbins,ptmin,ptmax); 
+    fhPoutTrig->SetYTitle("p_{out} (GeV/c)");
+    fhPoutTrig->SetXTitle("p_{T trigger} (GeV/c)");    
+    
+    fhPtTrigCharged  = 
+    new TH2F("PtTrigCharged","trgger and charged tracks pt distribution",
+             nptbins,ptmin,ptmax,nptbins,ptmin,ptmax); 
+    fhPtTrigCharged->SetYTitle("p_{T asso} (GeV/c)");
+    fhPtTrigCharged->SetXTitle("p_{T trigger} (GeV/c)");    
          
     outputContainer->Add(fhDeltaPhiDeltaEtaCharged);
     outputContainer->Add(fhPhiCharged) ;
@@ -193,10 +241,41 @@ TList *  AliAnaParticleHadronCorrelation::GetCreateOutputObjects()
     outputContainer->Add(fhDeltaPhiChargedPt) ;
     outputContainer->Add(fhDeltaPhiUeChargedPt) ;
     outputContainer->Add(fhPtImbalanceCharged) ;
+    outputContainer->Add(fhPtImbalancePosCharged) ;
+    outputContainer->Add(fhPtImbalanceNegCharged) ;
     outputContainer->Add(fhPtImbalanceUeCharged) ;
     outputContainer->Add(fhPtHbpCharged) ;
     outputContainer->Add(fhPtHbpUeCharged) ;
+    outputContainer->Add(fhPoutTrig) ;
+    outputContainer->Add(fhPtTrigCharged) ;
     
+    if(DoEventSelect()){ 
+      Int_t nMultiBins = GetMultiBin();
+      fhTrigDeltaPhiDeltaEtaCharged = new TH3D*[nMultiBins] ;
+      fhTrigCorr = new TH2F*[nMultiBins];
+      fhTrigUeCorr = new TH2F*[nMultiBins];
+      for(Int_t im=0; im<nMultiBins; im++){
+        fhTrigDeltaPhiDeltaEtaCharged[im]  = new TH3D 
+        (Form("fhTrigDeltaPhiDeltaEtaCharged_%d",im),Form("fhTrigDeltaPhiDeltaEtaCharged_%d",im), nptbins,ptmin,ptmax, 140,-2.,5., 200,-2,2); 
+        fhTrigDeltaPhiDeltaEtaCharged[im]->SetXTitle("p_{T trigger} (GeV/c)");
+        fhTrigDeltaPhiDeltaEtaCharged[im]->SetYTitle("#Delta #phi");
+        fhTrigDeltaPhiDeltaEtaCharged[im]->SetZTitle("#Delta #eta");
+        fhTrigCorr[im]  = new TH2F
+        (Form("fhTrigPtCorr_%d",im),Form("fhTrigPtCorr_%d",im), nptbins,ptmin,ptmax,200,0.,2.); 
+        fhTrigCorr[im]->SetYTitle("z_{trigger h^{#pm}}");
+        fhTrigCorr[im]->SetXTitle("p_{T trigger}");
+        fhTrigUeCorr[im]  = new TH2F
+        (Form("fhTrigPtUeCorr_%d",im),Form("fhTrigPtUeCorr_%d",im), nptbins,ptmin,ptmax,200,0.,2.); 
+        fhTrigUeCorr[im]->SetYTitle("z_{trigger h^{#pm}}");
+        fhTrigUeCorr[im]->SetXTitle("p_{T trigger}");       
+
+        outputContainer->Add(fhTrigDeltaPhiDeltaEtaCharged[im]) ;
+        outputContainer->Add(fhTrigCorr[im]);
+        outputContainer->Add(fhTrigUeCorr[im]);
+        
+        }
+    }
+   
     if(fPi0Trigger){
       fhPtPi0DecayRatio  = new TH3D
       ("hPtPi0DecayRatio","p_T of #pi^{0} and the ratio of pt for two decay", 
@@ -205,34 +284,21 @@ TList *  AliAnaParticleHadronCorrelation::GetCreateOutputObjects()
       fhPtPi0DecayRatio->SetYTitle("p_{T}^{Decay1}/p_{T}^{#pi^{0}}");
       fhPtPi0DecayRatio->SetZTitle("p_{T}^{Decay2}/p_{T}^{#pi^{0}}");
       
-      fhDeltaPhiDecay1Charged  = new TH2F
-      ("DeltaPhiDecay1Charged","#phi_{Decay} - #phi_{h^{#pm}} vs p_{T Decay}",
-       nptbins,ptmin,ptmax,140,-2.,5.); 
-      fhDeltaPhiDecay1Charged->SetYTitle("#Delta #phi");
-      fhDeltaPhiDecay1Charged->SetXTitle("p_{T Decay} (GeV/c)");
-      
-      fhDeltaPhiDecay2Charged  = new TH2F
-      ("DeltaPhiDecay2Charged","#phi_{Decay} - #phi_{h^{#pm}} vs p_{T Decay}",
+      fhDeltaPhiDecayCharged  = new TH2F
+      ("DeltaPhiDecayCharged","#phi_{Decay} - #phi_{h^{#pm}} vs p_{T Decay}",
        nptbins,ptmin,ptmax,140,-2.,5.); 
-      fhDeltaPhiDecay2Charged->SetYTitle("#Delta #phi");
-      fhDeltaPhiDecay2Charged->SetXTitle("p_{T Decay} (GeV/c)");
+      fhDeltaPhiDecayCharged->SetYTitle("#Delta #phi");
+      fhDeltaPhiDecayCharged->SetXTitle("p_{T Decay} (GeV/c)");
       
-      fhPtImbalanceDecay1Charged  = 
-      new TH2F("CorrelationDecay1Charged","z_{trigger h^{#pm}} = p_{T h^{#pm}} / p_{T Decay}",
+      fhPtImbalanceDecayCharged  = 
+      new TH2F("CorrelationDecayCharged","z_{trigger h^{#pm}} = p_{T h^{#pm}} / p_{T Decay}",
                nptbins,ptmin,ptmax,200,0.,2.); 
-      fhPtImbalanceDecay1Charged->SetYTitle("z_{decay h^{#pm}}");
-      fhPtImbalanceDecay1Charged->SetXTitle("p_{T decay}");
+      fhPtImbalanceDecayCharged->SetYTitle("z_{decay h^{#pm}}");
+      fhPtImbalanceDecayCharged->SetXTitle("p_{T decay}");
       
-      fhPtImbalanceDecay2Charged  = 
-      new TH2F("CorrelationDecay2Charged","z_{trigger h^{#pm}} = p_{T h^{#pm}} / p_{T Decay}",
-               nptbins,ptmin,ptmax,200,0.,2.); 
-      fhPtImbalanceDecay2Charged->SetYTitle("z_{decay h^{#pm}}");
-      fhPtImbalanceDecay2Charged->SetXTitle("p_{T decay}");
       outputContainer->Add(fhPtPi0DecayRatio) ; 
-      outputContainer->Add(fhDeltaPhiDecay1Charged) ; 
-      outputContainer->Add(fhDeltaPhiDecay2Charged) ; 
-      outputContainer->Add(fhPtImbalanceDecay1Charged) ;
-      outputContainer->Add(fhPtImbalanceDecay2Charged) ;
+      outputContainer->Add(fhDeltaPhiDecayCharged) ; 
+      outputContainer->Add(fhPtImbalanceDecayCharged) ;
     }    
     
     
@@ -283,7 +349,7 @@ TList *  AliAnaParticleHadronCorrelation::GetCreateOutputObjects()
   }  //Correlation with charged hadrons
   
   //Correlation with neutral hadrons
-  if(GetReader()->IsEMCALSwitchedOn() || GetReader()->IsPHOSSwitchedOn()){
+  if(fNeutralCorr){
     
     fhDeltaPhiDeltaEtaNeutral  = new TH2F
     ("DeltaPhiDeltaEtaNeutral","#phi_{trigger} - #phi_{h^{0}} vs #eta_{trigger} - #eta_{h^{0}}",
@@ -365,34 +431,20 @@ TList *  AliAnaParticleHadronCorrelation::GetCreateOutputObjects()
     outputContainer->Add(fhPtHbpUeNeutral) ;    
     
     if(fPi0Trigger){
-      fhDeltaPhiDecay1Neutral  = new TH2F
-      ("DeltaPhiDecay1Neutral","#phi_{Decay} - #phi_{h^{0}} vs p_{T Decay}",
-       nptbins,ptmin,ptmax,140,-2.,5.); 
-      fhDeltaPhiDecay1Neutral->SetYTitle("#Delta #phi");
-      fhDeltaPhiDecay1Neutral->SetXTitle("p_{T Decay} (GeV/c)");
-      
-      fhDeltaPhiDecay2Neutral  = new TH2F
-      ("DeltaPhiDecay2Neutral","#phi_{Decay} - #phi_{h^{0}} vs p_{T Decay}",
+      fhDeltaPhiDecayNeutral  = new TH2F
+      ("DeltaPhiDecayNeutral","#phi_{Decay} - #phi_{h^{0}} vs p_{T Decay}",
        nptbins,ptmin,ptmax,140,-2.,5.); 
-      fhDeltaPhiDecay2Neutral->SetYTitle("#Delta #phi");
-      fhDeltaPhiDecay2Neutral->SetXTitle("p_{T Decay} (GeV/c)");
-      
-      fhPtImbalanceDecay1Neutral  = 
-      new TH2F("CorrelationDecay1Neutral","z_{trigger h^{0}} = p_{T h^{0}} / p_{T Decay}",
-               nptbins,ptmin,ptmax,200,0.,2.); 
-      fhPtImbalanceDecay1Neutral->SetYTitle("z_{decay h^{0}}");
-      fhPtImbalanceDecay1Neutral->SetXTitle("p_{T decay}");
+      fhDeltaPhiDecayNeutral->SetYTitle("#Delta #phi");
+      fhDeltaPhiDecayNeutral->SetXTitle("p_{T Decay} (GeV/c)");
       
-      fhPtImbalanceDecay2Neutral  = 
-      new TH2F("CorrelationDecay2Neutral","z_{trigger h^{0}} = p_{T h^{0}} / p_{T Decay}",
+      fhPtImbalanceDecayNeutral  = 
+      new TH2F("CorrelationDecayNeutral","z_{trigger h^{0}} = p_{T h^{0}} / p_{T Decay}",
                nptbins,ptmin,ptmax,200,0.,2.); 
-      fhPtImbalanceDecay2Neutral->SetYTitle("z_{decay h^{0}}");
-      fhPtImbalanceDecay2Neutral->SetXTitle("p_{T decay}");
+      fhPtImbalanceDecayNeutral->SetYTitle("z_{decay h^{0}}");
+      fhPtImbalanceDecayNeutral->SetXTitle("p_{T decay}");
       
-      outputContainer->Add(fhDeltaPhiDecay1Neutral) ; 
-      outputContainer->Add(fhDeltaPhiDecay2Neutral) ; 
-      outputContainer->Add(fhPtImbalanceDecay1Neutral) ;
-      outputContainer->Add(fhPtImbalanceDecay2Neutral) ;
+      outputContainer->Add(fhDeltaPhiDecayNeutral) ; 
+      outputContainer->Add(fhPtImbalanceDecayNeutral) ;
     }
     
     
@@ -472,6 +524,7 @@ void AliAnaParticleHadronCorrelation::InitParameters()
   fMakeSeveralUE = kFALSE;
   fUeDeltaPhiMinCut = 1. ;
   fUeDeltaPhiMaxCut = 1.5 ;
+  fNeutralCorr = kFALSE ;
   fPi0Trigger = kFALSE ;
 
 }
@@ -585,7 +638,7 @@ void  AliAnaParticleHadronCorrelation::MakeAnalysisFillAOD()
       MakeChargedCorrelation(particle, GetAODCTS(),kFALSE);
     
     TObjArray * pi0list = (TObjArray*) GetAODBranch(fPi0AODBranchName); //For the future, foresee more possible pi0 lists
-    if(pi0list && pi0list->GetEntriesFast() > 0)
+    if(fNeutralCorr && pi0list && pi0list->GetEntriesFast() > 0)
       MakeNeutralCorrelation(particle, pi0list,kFALSE);
     
   }//Correlate leading
@@ -609,16 +662,41 @@ void  AliAnaParticleHadronCorrelation::MakeAnalysisFillHistograms()
     printf("AliAnaParticleHadronCorrelation::MakeAnalysisFillHistograms() - In particle branch aod entries %d\n", GetInputAODBranch()->GetEntriesFast());
   }
   
+  //Get the vertex and check it is not too large in z
+  Double_t v[3] = {0,0,0}; //vertex ;
+  GetReader()->GetVertex(v);
+  if(!GetMixedEvent() && TMath::Abs(v[2]) > GetZvertexCut()) return ;  
+  
   //Loop on stored AOD particles, find leading
   Int_t naod = GetInputAODBranch()->GetEntriesFast();
+  if(naod!=0)fhNclustersNtracks->Fill(naod, GetAODCTS()->GetEntriesFast());
+  if(naod!=0)fhVertex->Fill(v[0],v[1],v[2]);
   Double_t ptTrig = 0.;
   Int_t trigIndex = -1 ;
   for(Int_t iaod = 0; iaod < naod ; iaod++){    //loop on input trigger AOD file 
     AliAODPWG4ParticleCorrelation* particle =  (AliAODPWG4ParticleCorrelation*) (GetInputAODBranch()->At(iaod));
-    
+    //vertex cut in case of mixing
+    if (GetMixedEvent()) {
+      Int_t evt=-1;
+      Int_t id =-1;
+      if     (particle->GetCaloLabel(0)  >= 0 ){
+        id=particle->GetCaloLabel(0); 
+        if(id >= 0 )evt= GetMixedEvent()-> EventIndexForCaloCluster(id) ;
+      }
+      else if(particle->GetTrackLabel(0) >= 0 ){
+        id=particle->GetTrackLabel(0);
+        if(id >= 0 )evt= GetMixedEvent()->EventIndex(id) ;
+      }
+      else continue;
+      
+      if (TMath::Abs(GetVertex(evt)[2]) > GetZvertexCut()) 
+        continue ;
+    }
+
     //check if the particle is isolated or if we want to take the isolation into account
     if(OnlyIsolated() && !particle->IsIsolated()) continue;
-          //find the leading particles with highest momentum
+    //check if inside the vertex cut
+    //find the leading particles with highest momentum
     if (particle->Pt()>ptTrig) {
       ptTrig = particle->Pt() ;
                  trigIndex = iaod ;
@@ -628,6 +706,23 @@ void  AliAnaParticleHadronCorrelation::MakeAnalysisFillHistograms()
   if(trigIndex!=-1){ //using trigger partilce to do correlations
     AliAODPWG4ParticleCorrelation* particle =  (AliAODPWG4ParticleCorrelation*) (GetInputAODBranch()->At(trigIndex));
          
+    if (GetMixedEvent()) {
+      Int_t evt=-1;
+      Int_t id = 0;
+      if     (particle->GetCaloLabel(0)  >= 0 ){
+        id=particle->GetCaloLabel(0); 
+        if(id >= 0 )evt= GetMixedEvent()-> EventIndexForCaloCluster(id) ;
+      }
+      else if(particle->GetTrackLabel(0) >= 0 ){
+        id=particle->GetTrackLabel(0);
+        if(id >= 0 )evt= GetMixedEvent()->EventIndex(id) ;
+      }
+      else return;
+      
+      if (TMath::Abs(GetVertex(evt)[2]) > GetZvertexCut()) 
+        return ;
+    }
+        
     //Fill leading particle histogram   
     fhPtLeading->Fill(particle->Pt());
     Float_t phi = particle->Phi();
@@ -644,7 +739,7 @@ void  AliAnaParticleHadronCorrelation::MakeAnalysisFillHistograms()
     
     //Make correlation with neutral pions
     TObjArray * refpi0   = particle->GetObjArray(GetAODObjArrayName()+"Pi0s");
-    if(refpi0){
+    if(refpi0 && fNeutralCorr){
       if(GetDebug() > 1) printf("AliAnaParticleHadronCorrelation::MakeAnalysisFillHistograms() - Leading %d, In Pi0 Refs entries %d\n",trigIndex, refpi0->GetEntriesFast());      
       MakeNeutralCorrelation(particle, refpi0, kTRUE);
     }
@@ -665,6 +760,11 @@ void  AliAnaParticleHadronCorrelation::MakeChargedCorrelation(AliAODPWG4Particle
   Int_t evtIndex12 = 0 ;
   Int_t indexPhoton1 = -1 ;
   Int_t indexPhoton2 = -1 ;  
+  Double_t v[3] = {0,0,0}; //vertex ;
+  GetReader()->GetVertex(v);
+  if(!GetMixedEvent() && TMath::Abs(v[2]) > GetZvertexCut()) return ;  
+
+  Int_t nTracks = GetAODCTS()->GetEntriesFast() ;
   
   if (GetMixedEvent()) {
     evtIndex11 = GetMixedEvent()->EventIndexForCaloCluster(aodParticle->GetCaloLabel(0)) ;
@@ -676,6 +776,7 @@ void  AliAnaParticleHadronCorrelation::MakeChargedCorrelation(AliAODPWG4Particle
   Double_t pyTrig  = aodParticle->Py();
   
   Double_t phiTrig = aodParticle->Phi();
+  Double_t etaTrig = aodParticle->Eta();
   
   Double_t pt   = -100.;
   Double_t px   = -100.;
@@ -740,11 +841,16 @@ void  AliAnaParticleHadronCorrelation::MakeChargedCorrelation(AliAODPWG4Particle
   //Int_t currentIndex = -1 ; 
   for(Int_t ipr = 0;ipr < pl->GetEntriesFast() ; ipr ++ ){
     AliAODTrack * track = (AliAODTrack *) (pl->At(ipr)) ;
+    //check if inside the vertex cut
+    //printf("charge = %d\n", track->Charge());
     Int_t evtIndex2 = 0 ; 
     if (GetMixedEvent()) {
       evtIndex2 = GetMixedEvent()->EventIndex(track->GetID()) ;
       if (evtIndex11 == evtIndex2 || evtIndex12 == evtIndex2) // photon and track from different events
         continue ; 
+      //vertex cut
+      if (TMath::Abs(GetVertex(evtIndex2)[2]) > GetZvertexCut()) 
+         continue ;
       //      if(currentIndex == evtIndex2) // tracks from different event 
       //        continue ;
       //      currentIndex = evtIndex2 ;
@@ -752,9 +858,9 @@ void  AliAnaParticleHadronCorrelation::MakeChargedCorrelation(AliAODPWG4Particle
     if(track->GetID()==aodParticle->GetTrackLabel(0)) 
       continue ;
     
-    //if(track->Pt()>ptTrig) 
-    //continue ;
-    
+    if(track->Pt()==ptTrig && track->Phi()==phiTrig && track->Eta()==etaTrig) 
+    continue ;
     Double_t mom[3] = {track->Px(),track->Py(),track->Pz()};
     p3.SetXYZ(mom[0],mom[1],mom[2]);
     pt   = p3.Pt();
@@ -809,28 +915,52 @@ void  AliAnaParticleHadronCorrelation::MakeChargedCorrelation(AliAODPWG4Particle
       fhDeltaPhiDeltaEtaCharged->Fill(deltaphi,aodParticle->Eta()-eta);
       
       if(GetDebug() > 2 ) printf("AliAnaParticleHadronCorrelation::MakeChargedCorrelation() - Selected charge for momentum imbalance: pt %2.2f, phi %2.2f, eta %2.2f \n",pt,phi,eta);
-      
+      //fill different multiplicity histogram
+      if(DoEventSelect()){
+        for(Int_t im=0; im<GetMultiBin(); im++){
+          if(nTracks < GetMaxMulti()/GetMultiBin()*(im+1))fhTrigDeltaPhiDeltaEtaCharged[im]->Fill(ptTrig,deltaphi,aodParticle->Eta()-eta);
+        }
+      }
       //delta phi cut for correlation
       if( (deltaphi > fDeltaPhiMinCut) && ( deltaphi < fDeltaPhiMaxCut) ) {
         fhDeltaPhiChargedPt->Fill(pt,deltaphi);
-        fhPtImbalanceCharged->Fill(ptTrig,rat); 
+        fhPtImbalanceCharged->Fill(ptTrig,xE); 
         fhPtHbpCharged->Fill(ptTrig,cosi);
-      }
+        Double_t pout = pt*TMath::Sin(deltaphi) ;
+        fhPoutTrig->Fill(ptTrig, pout) ;
+        fhPtTrigCharged->Fill(ptTrig, pt) ;
+        if(track->Charge()>0) fhPtImbalancePosCharged->Fill(ptTrig,xE) ;
+        else fhPtImbalanceNegCharged->Fill(ptTrig,xE) ;
+        //fill different multiplicity histogram
+        if(DoEventSelect()){
+          for(Int_t im=0; im<GetMultiBin(); im++){
+            if(nTracks < ( GetMaxMulti() - 0 )/GetMultiBin()*(im+1))
+              fhTrigCorr[im]->Fill(ptTrig,xE);
+          }
+        } //multiplicity events selection
+      } //delta phi cut for correlation
       else {
         fhDeltaPhiUeChargedPt->Fill(pt,deltaphi);
-        fhPtImbalanceUeCharged->Fill(ptTrig,rat);
+        fhPtImbalanceUeCharged->Fill(ptTrig,xE);
         fhPtHbpUeCharged->Fill(ptTrig,cosi);
+        if(DoEventSelect()){
+          for(Int_t im=0; im<GetMultiBin(); im++){
+            if(nTracks < ( GetMaxMulti() - 0 )/GetMultiBin()*(im+1))
+              fhTrigUeCorr[im]->Fill(ptTrig,xE);
+          }
+        } //multiplicity events selection
+        
       }
       
       if(fPi0Trigger){
         if(indexPhoton1!=-1 && indexPhoton2!=-1){
-          fhDeltaPhiDecay1Charged->Fill(ptDecay1, deltaphiDecay1);
-          fhDeltaPhiDecay2Charged->Fill(ptDecay2, deltaphiDecay2);
+          fhDeltaPhiDecayCharged->Fill(ptDecay1, deltaphiDecay1);
+          fhDeltaPhiDecayCharged->Fill(ptDecay2, deltaphiDecay2);
           if(GetDebug() > 1)printf("deltaPhoton1 = %f, deltaPhoton2 = %f \n", deltaphiDecay1, deltaphiDecay2);
           if( (deltaphiDecay1 > fDeltaPhiMinCut) && ( deltaphiDecay1 < fDeltaPhiMaxCut) )
-            fhPtImbalanceDecay1Charged->Fill(ptDecay1,ratDecay1); 
+            fhPtImbalanceDecayCharged->Fill(ptDecay1,ratDecay1); 
           if( (deltaphiDecay2 > fDeltaPhiMinCut) && ( deltaphiDecay2 < fDeltaPhiMaxCut) )
-            fhPtImbalanceDecay2Charged->Fill(ptDecay2,ratDecay2);
+            fhPtImbalanceDecayCharged->Fill(ptDecay2,ratDecay2);
           if(GetDebug() > 1)printf("ratPhoton1 = %f, ratPhoton2 = %f \n", pt/ptDecay1, pt/ptDecay2);
         } //index of decay photons found
       } //make decay-hadron correlation          
@@ -1208,13 +1338,13 @@ void  AliAnaParticleHadronCorrelation::MakeNeutralCorrelation(AliAODPWG4Particle
           if(deltaphiDecay1>3*TMath::PiOver2()) deltaphiDecay1-=TMath::TwoPi();
           if(deltaphiDecay2< -TMath::PiOver2()) deltaphiDecay2+=TMath::TwoPi();
           if(deltaphiDecay2>3*TMath::PiOver2()) deltaphiDecay2-=TMath::TwoPi();   
-          fhDeltaPhiDecay1Neutral->Fill(ptDecay1, deltaphiDecay1);
-          fhDeltaPhiDecay2Neutral->Fill(ptDecay2, deltaphiDecay2);
+          fhDeltaPhiDecayNeutral->Fill(ptDecay1, deltaphiDecay1);
+          fhDeltaPhiDecayNeutral->Fill(ptDecay2, deltaphiDecay2);
           if(GetDebug() > 1)printf("deltaPhoton1 = %f, deltaPhoton2 = %f \n", deltaphiDecay1, deltaphiDecay2);
           if( (deltaphiDecay1 > fDeltaPhiMinCut) && ( deltaphiDecay1 < fDeltaPhiMaxCut) )
-            fhPtImbalanceDecay1Neutral->Fill(ptDecay1,ratDecay1); 
+            fhPtImbalanceDecayNeutral->Fill(ptDecay1,ratDecay1); 
           if( (deltaphiDecay2 > fDeltaPhiMinCut) && ( deltaphiDecay2 < fDeltaPhiMaxCut) )
-            fhPtImbalanceDecay2Neutral->Fill(ptDecay2,ratDecay2);
+            fhPtImbalanceDecayNeutral->Fill(ptDecay2,ratDecay2);
           if(GetDebug() > 1)printf("ratPhoton1 = %f, ratPhoton2 = %f \n", pt/ptDecay1, pt/ptDecay2);
         }
       } //do decay-hadron correlation
index 2c1d49b9ce09d24d14f7d27eca5e09638384dc2a..c2a2f497926562c2384b050d33b8ff93950f258d 100755 (executable)
@@ -14,7 +14,8 @@
 // 2. change the correlation variable
 // 3. Only use leading particle(cluster/track) as trigger for correlation (2010/07/02)
 // 4. Make decay photon-hadron correlations where decay contribute pi0 mass (2010/09/09)
-
+// 5. fill the pout to extract kt at the end, also to study charge asymmetry(2010/10/06) 
+// 6. Add the possibality for event selection analysis based on vertex and multiplicity bins (10/10/2010)
 // --- ROOT system ---
 class TH3D;
 
@@ -49,6 +50,11 @@ class AliAnaParticleHadronCorrelation : public AliAnaPartCorrBaseClass {
   void SwitchOnSeveralUECalculation()  { fMakeSeveralUE = kTRUE;}
   void SwitchOffSeveralUECalculation() { fMakeSeveralUE = kFALSE;}
 
+  // Do trigger-neutral correlation
+  Bool_t DoNeutralCorr() const {return fNeutralCorr ; }
+  void SwitchOnNeutralCorr()  { fNeutralCorr = kTRUE;}
+  void SwitchOffNeutralCorr() { fNeutralCorr = kFALSE;}  
+  
   // Do decay-hadron correlation if it is pi0 trigger
   Bool_t IsPi0Trigger() const {return fPi0Trigger ; }
   void SwitchOnDecayCorr()  { fPi0Trigger = kTRUE;}
@@ -56,6 +62,20 @@ class AliAnaParticleHadronCorrelation : public AliAnaPartCorrBaseClass {
   
   Bool_t OnlyIsolated() const {return fSelectIsolated ; }
   void SelectIsolated(Bool_t select) {fSelectIsolated = select ; }
+
+//  //Setters for parameters of event buffers
+//  void SetMultiBin(Int_t n=1) {fMultiBin=n ;} //number of bins in Multiplicity 
+//  void SetNRPBin(Int_t n=1)    {fNrpBin=n ;}    //number of bins in reaction plain  
+//  //Setters for event selection
+//  void SetZvertexCut(Float_t zcut=40.){fZvtxCut=zcut ;} //cut on vertex position
+//  Int_t GetMultiBin() const {return fMultiBin ;} //number of bins in Multiplicity 
+//  Int_t GetNRPBin()    const {return fNrpBin=n ;}    //number of bins in reaction plain  
+//  //Getters for event selection
+//  Float_t GetZvertexCut() const {return fZvtxCut ;} //cut on vertex position  
+//  void SwitchOnEventSelection()    {fUseSelectEvent = kTRUE ; }
+//  void SwitchOffEventSelection()   {fUseSelectEvent = kFALSE ; } s
+//  // Do correlation analysis with different event buffers
+//  Bool_t IsEventSelect() const {return fUseSelectEvent ; }
   
   void InitParameters();
   
@@ -83,67 +103,87 @@ class AliAnaParticleHadronCorrelation : public AliAnaPartCorrBaseClass {
   Double_t   fUeDeltaPhiMaxCut ;    // Minimum Delta Phi Gamma-Underlying Hadron
   Double_t   fUeDeltaPhiMinCut ;    // Maximum Delta Phi Gamma-Underlying Hadron
   TString    fPi0AODBranchName;     // Name of AOD branch with pi0, not trigger
-  Bool_t     fPi0Trigger ;          // Do analysis with decay photon from pi0 trigger
-
+  Bool_t     fNeutralCorr ;          // switch the analysis with neutral particles
+  Bool_t     fPi0Trigger ;          // switch the analysis with decay photon from pi0 trigger
+//  Int_t      fMultiBin ;       // Number of bins in event container for multiplicity
+//  Int_t      fNZvertBin ;      // Number of bins in event container for vertex position
+//  Int_t      fNrpBin ;           // Number of bins in event container for reaction plain
+//  Float_t    fZvtxCut ;          // Cut on vertex position  
+//  Bool_t     fUseSelectEvent ; // Select events based on multiplicity and vertex cuts
+  
+  
   //Histograms
+  TH2F * fhNclustersNtracks; //charge and cluster multiplicity distribution
+  TH3D * fhVertex; //vertex position
   //leading particles 
   TH1F * fhPtLeading;         //! pT distribution of leading particles
   TH2F * fhPhiLeading;        //! phi distribution vs pT of leading particles
   TH2F * fhEtaLeading;        //! eta distribution vs pT of leading particles
+  
+  //trigger-charged histograms
   TH2F * fhDeltaPhiDeltaEtaCharged ; //! differences of eta and phi between trigger and charged hadrons
-  TH2F * fhDeltaPhiDeltaEtaNeutral ; //! differences of eta and phi between trigger and neutral hadrons (pi0)
-       
   TH2F * fhPhiCharged  ;         //! Phi distribution of charged particles
-  TH2F * fhPhiNeutral   ;        //! Phi distribution of neutral particles
   TH2F * fhEtaCharged  ;         //! Eta distribution of charged particles
-  TH2F * fhEtaNeutral   ;        //! Eta distribution of neutral particles
   TH2F * fhDeltaPhiCharged  ;    //! Difference of charged particle phi and trigger particle  phi as function of  trigger particle pT
-  TH2F * fhDeltaPhiNeutral   ;   //! Difference of neutral particle phi and trigger particle  phi as function of  trigger particle pT
   TH2F * fhDeltaEtaCharged  ;    //! Difference of charged particle eta and trigger particle  eta as function of  trigger particle pT
-  TH2F * fhDeltaEtaNeutral  ;    //! Difference of neutral particle eta and trigger particle  eta as function of  trigger particle pT
   TH2F * fhDeltaPhiChargedPt  ;  //! Difference of charged particle phi and trigger particle  phi as function of charged particle pT
-  TH2F * fhDeltaPhiNeutralPt  ;  //! Difference of neutral particle phi and trigger particle  phi as function of neutral particle particle pT
   TH2F * fhDeltaPhiUeChargedPt ; //! Difference of charged particle from underlying events phi and trigger particle  phi as function of charged particle pT
-  TH2F * fhDeltaPhiUeNeutralPt ; //! Difference of neutral particle phi and trigger particle  phi as function of neutral particle particle pT
-
-  TH2F * fhPtImbalanceNeutral  ;   //! Trigger particle - neutral hadron momentum imbalance histogram 
   TH2F * fhPtImbalanceCharged  ;   //! Trigger particle -charged hadron momentim imbalance histogram
   TH2F * fhPtImbalanceUeCharged  ; //! Trigger particle -underlying charged hadron momentim imbalance histogram  
-  TH2F * fhPtImbalanceUeNeutral  ; //! Trigger particle - neutral hadron momentum imbalance histogram 
-
+  TH2F * fhPtImbalancePosCharged  ;   //! Trigger particle -positive charged hadron momentim imbalance histogram
+  TH2F * fhPtImbalanceNegCharged  ; //! Trigger particle -negative charged hadron momentim imbalance histogram 
   //with different imblance varible defination HBP distribution
   TH2F * fhPtHbpCharged  ;   //! Trigger particle -charged hadron momentim HBP histogram
   TH2F * fhPtHbpUeCharged  ; //! Trigger particle -underlying charged hadron momentim HBP histogram  
+  
+  //if several UE calculation is on, most useful for jet-jet events contribution
+  TH2F * fhDeltaPhiUeLeftCharged  ;    //! Difference of charged particle from underlying events phi and trigger particle  phi as function of charged particle pT
+  TH2F * fhDeltaPhiUeRightCharged  ;   //! Difference of charged particle from underlying events phi and trigger particle  phi 
+  TH2F * fhPtImbalanceUeLeftCharged  ; //! Trigger particle -underlying charged hadron momentim imbalance histogram 
+  TH2F * fhPtImbalanceUeRightCharged ; //! Trigger particle -underlying charged hadron momentim imbalance histogram  
+  TH2F * fhPtHbpUeLeftCharged  ;       //! Trigger particle -underlying charged hadron momentim HBP histogram 
+  TH2F * fhPtHbpUeRightCharged  ;      //! Trigger particle -underlying charged hadron momentim HBP histogram  
+
+  //for pout and kt extraction
+  TH2F * fhPoutTrig  ; // Pout =associated pt*sin(delta phi) distribution vs trigger pt
+  TH2F * fhPtTrigCharged ; //trigger and correlated particl pt, to be used for mean value for kt       
+  
+  //if different multiplicity analysis asked
+  TH3D ** fhTrigDeltaPhiDeltaEtaCharged ; //! differences of eta and phi between trigger and charged hadrons
+  TH2F ** fhTrigCorr  ;    //! Trigger particle -charged hadron momentim imbalance histogram
+  TH2F ** fhTrigUeCorr  ;    //! Trigger particle -UE charged hadron momentim imbalance histogram
+  
+  //trigger-neutral histograms
+  TH2F * fhDeltaPhiDeltaEtaNeutral ; //! differences of eta and phi between trigger and neutral hadrons (pi0)
+  TH2F * fhPhiNeutral   ;        //! Phi distribution of neutral particles  
+  TH2F * fhEtaNeutral   ;        //! Eta distribution of neutral particles
+  TH2F * fhDeltaPhiNeutral   ;   //! Difference of neutral particle phi and trigger particle  phi as function of  trigger particle pT
+  TH2F * fhDeltaEtaNeutral  ;    //! Difference of neutral particle eta and trigger particle  eta as function of  trigger particle pT
+  TH2F * fhDeltaPhiNeutralPt  ;  //! Difference of neutral particle phi and trigger particle  phi as function of neutral particle particle pT
+  TH2F * fhDeltaPhiUeNeutralPt ; //! Difference of neutral particle phi and trigger particle  phi as function of neutral particle particle pT  
+  TH2F * fhPtImbalanceNeutral  ;   //! Trigger particle - neutral hadron momentum imbalance histogram 
+  TH2F * fhPtImbalanceUeNeutral  ; //! Trigger particle - neutral hadron momentum imbalance histogram 
+  //with different imblance varible defination HBP distribution  
   TH2F * fhPtHbpNeutral  ;   //! Trigger particle -neutral particle momentim HBP histogram
   TH2F * fhPtHbpUeNeutral  ; //! Trigger particle -underlying neutral hadron momentim HBP histogram  
 
   //if several UE calculation is on, most useful for jet-jet events contribution
-  TH2F * fhDeltaPhiUeLeftCharged  ;    //! Difference of charged particle from underlying events phi and trigger particle  phi as function of charged particle pT
-  TH2F * fhDeltaPhiUeRightCharged  ;   //! Difference of charged particle from underlying events phi and trigger particle  phi 
   TH2F * fhDeltaPhiUeLeftNeutral  ;    //! Difference of charged particle from underlying events phi and trigger particle  phi as function of neutral particle pT
   TH2F * fhDeltaPhiUeRightNeutral  ;   //! Difference of charged particle from underlying events phi and trigger particle  phi 
-  TH2F * fhPtImbalanceUeLeftCharged  ; //! Trigger particle -underlying charged hadron momentim imbalance histogram 
-  TH2F * fhPtImbalanceUeRightCharged ; //! Trigger particle -underlying charged hadron momentim imbalance histogram  
   TH2F * fhPtImbalanceUeLeftNeutral  ; //! Trigger particle -underlying neutral hadron momentim imbalance histogram 
   TH2F * fhPtImbalanceUeRightNeutral ; //! Trigger particle -underlying neutral hadron momentim imbalance histogram 
-  TH2F * fhPtHbpUeLeftCharged  ;       //! Trigger particle -underlying charged hadron momentim HBP histogram 
-  TH2F * fhPtHbpUeRightCharged  ;      //! Trigger particle -underlying charged hadron momentim HBP histogram  
   TH2F * fhPtHbpUeLeftNeutral  ;       //! Trigger particle -underlying neutral hadron momentim HBP histogram 
-  TH2F * fhPtHbpUeRightNeutral  ;      //! Trigger particle -underlying neutral hadron momentim HBP histogram  
-       
+  TH2F * fhPtHbpUeRightNeutral  ;      //! Trigger particle -underlying neutral hadron momentim HBP histogram 
+  
   //for decay photon trigger correlation
   TH3D * fhPtPi0DecayRatio ;          //! for pi0 pt and ratio of decay photon pt
-  TH2F * fhDeltaPhiDecay1Charged  ;   //! Difference of charged particle phi and decay trigger
-  TH2F * fhDeltaPhiDecay2Charged  ;   //! Difference of charged particle phi and decay trigger
-  TH2F * fhPtImbalanceDecay1Charged ; //! Trigger particle (decay 1 from pi0)-charged hadron momentim imbalance histogram  
-  TH2F * fhPtImbalanceDecay2Charged ; //! Trigger particle (decay 2 from pi0) -charged hadron momentim imbalance histogram
-  
-  TH2F * fhDeltaPhiDecay1Neutral  ;   //! Difference of neutral particle phi and decay trigger
-  TH2F * fhDeltaPhiDecay2Neutral  ;   //! Difference of neutral particle phi and decay trigger
-  TH2F * fhPtImbalanceDecay1Neutral ; //! Trigger particle (decay 1 from pi0)-neutral hadron momentim imbalance histogram  
-  TH2F * fhPtImbalanceDecay2Neutral ; //! Trigger particle (decay 2 from pi0) -neutral hadron momentim imbalance histogram  
+  TH2F * fhDeltaPhiDecayCharged  ;   //! Difference of charged particle phi and decay trigger
+  TH2F * fhPtImbalanceDecayCharged ; //! Trigger particle (decay from pi0)-charged hadron momentim imbalance histogram    
+  TH2F * fhDeltaPhiDecayNeutral  ;   //! Difference of neutral particle phi and decay trigger
+  TH2F * fhPtImbalanceDecayNeutral ; //! Trigger particle (decay from pi0)-neutral hadron momentim imbalance histogram  
+  
        
-  ClassDef(AliAnaParticleHadronCorrelation,4)
+  ClassDef(AliAnaParticleHadronCorrelation,5)
 } ;
  
 
index da3d4e72d162b5b1a046a7d82c7c2f00529716ec..f6eb01fc9fb3c53eef0780acfc6192e9f518c340 100755 (executable)
@@ -22,6 +22,8 @@
 //  (see AliRoot versions previous Release 4-09)
 //
 // -- Author: Gustavo Conesa (LNF-INFN) 
+
+//-Yaxian Mao (add the possibility for different IC method with different pt range, 01/10/2010)
 //////////////////////////////////////////////////////////////////////////////
   
   
@@ -50,6 +52,7 @@ ClassImp(AliAnaParticleIsolation)
     AliAnaPartCorrBaseClass(), fCalorimeter(""), 
     fReMakeIC(0), fMakeSeveralIC(0), fMakeInvMass(0),
     fhPtIso(0),fhPhiIso(0),fhEtaIso(0), fhConeSumPt(0), fhPtInCone(0),
+    fhFRConeSumPt(0), fhPtInFRCone(0),
     //Several IC
     fNCones(0),fNPtThresFrac(0), fConeSizes(),  fPtThresholds(),  fPtFractions(), 
     //MC
@@ -237,6 +240,18 @@ TList *  AliAnaParticleIsolation::GetCreateOutputObjects()
     fhPtInCone->SetXTitle("p_{T} (GeV/c)");
     outputContainer->Add(fhPtInCone) ;
     
+    fhFRConeSumPt  = new TH2F
+    ("hFRConePtSum","#Sigma p_{T} in the froward region isolation cone ",nptbins,ptmin,ptmax,nptsumbins,ptsummin,ptsummax);
+    fhFRConeSumPt->SetYTitle("#Sigma p_{T}");
+    fhFRConeSumPt->SetXTitle("p_{T} (GeV/c)");
+    outputContainer->Add(fhFRConeSumPt) ;
+    
+    fhPtInFRCone  = new TH2F
+    ("hPtInFRCone","p_{T} in froward region isolation cone ",nptbins,ptmin,ptmax,nptinconebins,ptinconemin,ptinconemax);
+    fhPtInFRCone->SetYTitle("p_{T in cone} (GeV/c)");
+    fhPtInFRCone->SetXTitle("p_{T} (GeV/c)");
+    outputContainer->Add(fhPtInFRCone) ;    
+    
     fhPtIso  = new TH1F("hPt","Isolated Number of particles",nptbins,ptmin,ptmax); 
     fhPtIso->SetYTitle("N");
     fhPtIso->SetXTitle("p_{T}(GeV/c)");
@@ -560,6 +575,17 @@ void  AliAnaParticleIsolation::MakeAnalysisFillAOD()
     //If too small or too large pt, skip
     if(aodinput->Pt() < GetMinPt() || aodinput->Pt() > GetMaxPt() ) continue ; 
     
+    //check if it is low pt trigger particle, then adjust the isolation method
+    if(aodinput->Pt() < GetIsolationCut()->GetPtThreshold() || aodinput->Pt() < GetIsolationCut()->GetSumPtThreshold()) 
+      continue ; //trigger should not from underlying event
+ //   if(GetIsolationCut()->GetICMethod()!=AliIsolationCut::kPtThresIC && aodinput->Pt()!=0.){ 
+//      //low pt trigger use pt threshold IC instead of other method
+//      if (aodinput->Pt()*(GetIsolationCut()->GetPtFraction())<GetIsolationCut()->GetPtThreshold() || aodinput->Pt()*(GetIsolationCut()->GetPtFraction())<GetIsolationCut()->GetSumPtThreshold()) {
+//       // printf("change the IC method to PtThresIC\n") ;
+//        GetIsolationCut()->SetICMethod(AliIsolationCut::kPtThresIC); 
+//      }
+//    }
+    
     //Check invariant mass, if pi0, skip.
     Bool_t decay = kFALSE ;
     if(fMakeInvMass) decay = CheckInvMass(iaod,aodinput);
@@ -603,13 +629,16 @@ void  AliAnaParticleIsolation::MakeAnalysisFillHistograms()
     Float_t ptcluster  = aod->Pt();
     Float_t phicluster = aod->Phi();
     Float_t etacluster = aod->Eta();
+   // Float_t phiForward = aod->Phi()+TMath::PiOver2() ;
+    Float_t conesize       = GetIsolationCut()->GetConeSize();
+    
     //Recover reference arrays with clusters and tracks
     TObjArray * refclusters = aod->GetObjArray(GetAODObjArrayName()+"Clusters");
     TObjArray * reftracks   = aod->GetObjArray(GetAODObjArrayName()+"Tracks");
-    
     //If too small or too large pt, skip
     if(aod->Pt() < GetMinPt() || aod->Pt() > GetMaxPt() ) continue ; 
-         
+    
+
     if(fMakeSeveralIC) {
       //Analysis of multiple IC at same time
       MakeSeveralICAnalysis(aod);
@@ -626,6 +655,21 @@ void  AliAnaParticleIsolation::MakeAnalysisFillHistograms()
     //Fill pt distribution of particles in cone
     //Tracks
     coneptsum=0;
+    Double_t sumptFR = 0. ;
+    TObjArray * trackList   = GetAODCTS() ;
+    for(Int_t itrack=0; itrack < trackList->GetEntriesFast(); itrack++){
+      AliAODTrack* track = (AliAODTrack *) trackList->At(itrack);
+      //fill the histograms at forward range
+      if(TMath::Sqrt((phicluster+TMath::PiOver2()-track->Phi())*(phicluster+TMath::PiOver2()-track->Phi())+(etacluster-track->Eta())*(etacluster-track->Eta())) < conesize){
+        fhPtInFRCone->Fill(ptcluster,TMath::Sqrt(track->Px()*track->Px()+track->Py()*track->Py()));
+        sumptFR+=track->Pt();
+      }    
+      if(TMath::Sqrt((phicluster-TMath::PiOver2()-track->Phi())*(phicluster-TMath::PiOver2()-track->Phi())+(etacluster-track->Eta())*(etacluster-track->Eta())) < conesize){
+        fhPtInFRCone->Fill(ptcluster,TMath::Sqrt(track->Px()*track->Px()+track->Py()*track->Py()));
+        sumptFR+=track->Pt();
+      }      
+    }
+    fhFRConeSumPt->Fill(ptcluster,sumptFR);
     if(reftracks){  
       for(Int_t itrack=0; itrack < reftracks->GetEntriesFast(); itrack++){
         AliAODTrack* track = (AliAODTrack *) reftracks->At(itrack);
@@ -633,7 +677,7 @@ void  AliAnaParticleIsolation::MakeAnalysisFillHistograms()
         coneptsum+=track->Pt();
       }
     }
-         
+
     //CaloClusters
     if(refclusters){    
       TLorentzVector mom ;
index ba7175fbc2aee04878d714266b2e0c299304c010..d2b3369f933b1e933552b0966ef9d889d13b06da 100755 (executable)
@@ -115,6 +115,8 @@ class AliAnaParticleIsolation : public AliAnaPartCorrBaseClass {
   TH2F * fhEtaIso ;    //! eta of isolated particles
   TH2F * fhConeSumPt ; //! Sum Pt in the cone
   TH2F * fhPtInCone ;  //! Particle Pt in the cone
+  TH2F * fhFRConeSumPt ; //! Sum Pt in the forward region cone (phi +90)
+  TH2F * fhPtInFRCone ;  //! Particle Pt in the forward region cone (phi +90 ) 
   
   //Prompt photon analysis data members for multiple cones and pt thresholds 
   Int_t       fNCones ;          //! Number of cone sizes to test
index cbe42208b4a8bd8089476cee8b0622dcd7a40130..771e18322dba6caf65e8ef6fa111dd049184a628 100755 (executable)
@@ -361,6 +361,10 @@ void  AliAnaPhoton::MakeAnalysisFillAOD()
   //Do photon analysis and fill aods
   
   //  Double_t vertex2[] = {0,0,0} ; //vertex from second input aod
+  //Get the vertex and check it is not too large in z, cut for SE
+  Double_t v[3] = {0,0,0}; //vertex ;
+  GetReader()->GetVertex(v);
+  if(!GetMixedEvent() && TMath::Abs(v[2]) > GetZvertexCut()) return ;  
   
   //Select the Calorimeter of the photon
   TObjArray * pl = 0x0; 
@@ -391,6 +395,8 @@ void  AliAnaPhoton::MakeAnalysisFillAOD()
     Int_t evtIndex = 0 ; 
     if (GetMixedEvent()) {
       evtIndex=GetMixedEvent()->EventIndexForCaloCluster(calo->GetID()) ; 
+      //Get the vertex and check it is not too large in z
+      if(TMath::Abs(GetVertex(evtIndex)[2])> GetZvertexCut()) continue ;  
     }
 
     //Cluster selection, not charged, with photon id and in fiducial cut
index 1b2afb39743610ab690f9215d68d0f0dc5a98d9d..0031adf780bffc6fcc789ae95abfac251afb0910 100755 (executable)
@@ -53,8 +53,8 @@ ClassImp(AliAnaPi0)
 
 //________________________________________________________________________________________________________________________________________________  
 AliAnaPi0::AliAnaPi0() : AliAnaPartCorrBaseClass(),
-fDoOwnMix(kFALSE),fNCentrBin(0),fNZvertBin(0),fNrpBin(0),
-fNPID(0),fNmaxMixEv(0), fZvtxCut(0.),fCalorimeter(""),
+fDoOwnMix(kFALSE),fNCentrBin(0),//fNZvertBin(0),fNrpBin(0),
+fNPID(0),fNmaxMixEv(0), fCalorimeter(""),
 fNModules(12), fUseAngleCut(kFALSE), fEventsList(0x0), fMultiCutAna(kFALSE),
 fNPtCuts(0),fPtCuts(0x0),fNAsymCuts(0),fAsymCuts(0x0),
 fNCellNCuts(0),fCellNCuts(0x0),fNPIDBits(0),fPIDBits(0x0),fhReMod(0x0),
@@ -76,10 +76,10 @@ AliAnaPi0::~AliAnaPi0() {
   
   if(fDoOwnMix && fEventsList){
     for(Int_t ic=0; ic<fNCentrBin; ic++){
-      for(Int_t iz=0; iz<fNZvertBin; iz++){
-        for(Int_t irp=0; irp<fNrpBin; irp++){
-          fEventsList[ic*fNZvertBin*fNrpBin+iz*fNrpBin+irp]->Delete() ;
-          delete fEventsList[ic*fNZvertBin*fNrpBin+iz*fNrpBin+irp] ;
+      for(Int_t iz=0; iz<GetNZvertBin(); iz++){
+        for(Int_t irp=0; irp<GetNRPBin(); irp++){
+          fEventsList[ic*GetNZvertBin()*GetNRPBin()+iz*GetNRPBin()+irp]->Delete() ;
+          delete fEventsList[ic*GetNZvertBin()*GetNRPBin()+iz*GetNRPBin()+irp] ;
         }
       }
     }
@@ -99,11 +99,11 @@ void AliAnaPi0::InitParameters()
   AddToHistogramsName("AnaPi0_");
   fNModules = 12; // set maximum to maximum number of EMCAL modules
   fNCentrBin = 1;
-  fNZvertBin = 1;
-  fNrpBin    = 1;
+//  fNZvertBin = 1;
+//  fNrpBin    = 1;
   fNPID      = 9;
   fNmaxMixEv = 10;
-  fZvtxCut   = 40;
   fCalorimeter  = "PHOS";
   fUseAngleCut = kFALSE;
   
@@ -139,9 +139,9 @@ TObjString * AliAnaPi0::GetAnalysisCuts()
         parList+=onePar ;      
         snprintf(onePar,buffersize,"Number of bins in Centrality:  %d \n",fNCentrBin) ;
         parList+=onePar ;
-        snprintf(onePar,buffersize,"Number of bins in Z vert. pos: %d \n",fNZvertBin) ;
+        snprintf(onePar,buffersize,"Number of bins in Z vert. pos: %d \n",GetNZvertBin()) ;
         parList+=onePar ;
-        snprintf(onePar,buffersize,"Number of bins in Reac. Plain: %d \n",fNrpBin) ;
+        snprintf(onePar,buffersize,"Number of bins in Reac. Plain: %d \n",GetNRPBin()) ;
         parList+=onePar ;
         snprintf(onePar,buffersize,"Depth of event buffer: %d \n",fNmaxMixEv) ;
         parList+=onePar ;
@@ -149,7 +149,7 @@ TObjString * AliAnaPi0::GetAnalysisCuts()
         parList+=onePar ;
         snprintf(onePar,buffersize,"Cuts: \n") ;
         parList+=onePar ;
-        snprintf(onePar,buffersize,"Z vertex position: -%f < z < %f \n",fZvtxCut,fZvtxCut) ;
+        snprintf(onePar,buffersize,"Z vertex position: -%f < z < %f \n",GetZvertexCut(),GetZvertexCut()) ;
         parList+=onePar ;
         snprintf(onePar,buffersize,"Calorimeter: %s \n",fCalorimeter.Data()) ;
         parList+=onePar ;
@@ -183,12 +183,12 @@ TList * AliAnaPi0::GetCreateOutputObjects()
   // store them in fOutputContainer
   
   //create event containers
-  fEventsList = new TList*[fNCentrBin*fNZvertBin*fNrpBin] ;
+  fEventsList = new TList*[fNCentrBin*GetNZvertBin()*GetNRPBin()] ;
        
   for(Int_t ic=0; ic<fNCentrBin; ic++){
-    for(Int_t iz=0; iz<fNZvertBin; iz++){
-      for(Int_t irp=0; irp<fNrpBin; irp++){
-        fEventsList[ic*fNZvertBin*fNrpBin+iz*fNrpBin+irp] = new TList() ;
+    for(Int_t iz=0; iz<GetNZvertBin(); iz++){
+      for(Int_t irp=0; irp<GetNRPBin(); irp++){
+        fEventsList[ic*GetNZvertBin()*GetNRPBin()+iz*GetNRPBin()+irp] = new TList() ;
       }
     }
   }
@@ -342,7 +342,7 @@ TList * AliAnaPi0::GetCreateOutputObjects()
   }// multi cuts analysis
   
   fhEvents=new TH3D("hEvents","Number of events",fNCentrBin,0.,1.*fNCentrBin,
-                    fNZvertBin,0.,1.*fNZvertBin,fNrpBin,0.,1.*fNrpBin) ;
+                    GetNZvertBin(),0.,1.*GetNZvertBin(),GetNRPBin(),0.,1.*GetNRPBin()) ;
   outputContainer->Add(fhEvents) ;
        
   fhRealOpeningAngle  = new TH2D
@@ -418,12 +418,12 @@ void AliAnaPi0::Print(const Option_t * /*opt*/) const
   AliAnaPartCorrBaseClass::Print(" ");
 
   printf("Number of bins in Centrality:  %d \n",fNCentrBin) ;
-  printf("Number of bins in Z vert. pos: %d \n",fNZvertBin) ;
-  printf("Number of bins in Reac. Plain: %d \n",fNrpBin) ;
+  printf("Number of bins in Z vert. pos: %d \n",GetNZvertBin()) ;
+  printf("Number of bins in Reac. Plain: %d \n",GetNRPBin()) ;
   printf("Depth of event buffer: %d \n",fNmaxMixEv) ;
   printf("Number of different PID used:  %d \n",fNPID) ;
   printf("Cuts: \n") ;
-  printf("Z vertex position: -%2.3f < z < %2.3f \n",fZvtxCut,fZvtxCut) ;
+  printf("Z vertex position: -%2.3f < z < %2.3f \n",GetZvertexCut(),GetZvertexCut()) ;
   printf("Number of modules:             %d \n",fNModules) ;
   printf("Select pairs with their angle: %d \n",fUseAngleCut) ;
   if(fMultiCutAna){
@@ -569,6 +569,7 @@ void AliAnaPi0::MakeAnalysisFillHistograms()
     // get the event index in the mixed buffer where the photon comes from 
     // in case of mixing with analysis frame, not own mixing
     evtIndex1 = GetEventIndex(p1, vert) ; 
+    //printf("charge = %d\n", track->Charge());
     if ( evtIndex1 == -1 )
       return ; 
     if ( evtIndex1 == -2 )
@@ -578,7 +579,7 @@ void AliAnaPi0::MakeAnalysisFillHistograms()
       //does not exist in ESD yet????
       curCentrBin = 0 ; 
       curRPBin    = 0 ;
-      curZvertBin = (Int_t)(0.5*fNZvertBin*(vert[2]+fZvtxCut)/fZvtxCut) ;
+      curZvertBin = (Int_t)(0.5*GetNZvertBin()*(vert[2]+GetZvertexCut())/GetZvertexCut()) ;
       fhEvents->Fill(curCentrBin+0.5,curZvertBin+0.5,curRPBin+0.5) ;
       currentEvtIndex = evtIndex1 ; 
     }
@@ -688,7 +689,7 @@ void AliAnaPi0::MakeAnalysisFillHistograms()
   
   if(fDoOwnMix){
     //Fill mixed
-    TList * evMixList=fEventsList[curCentrBin*fNZvertBin*fNrpBin+curZvertBin*fNrpBin+curRPBin] ;
+    TList * evMixList=fEventsList[curCentrBin*GetNZvertBin()*GetNRPBin()+curZvertBin*GetNRPBin()+curRPBin] ;
     Int_t nMixed = evMixList->GetSize() ;
     for(Int_t ii=0; ii<nMixed; ii++){  
       TClonesArray* ev2= (TClonesArray*) (evMixList->At(ii));
@@ -958,13 +959,13 @@ Int_t AliAnaPi0::GetEventIndex(AliAODPWG4Particle * part, Double_t * vert)
       evtIndex = GetMixedEvent()->EventIndexForCaloCluster(part->GetCaloLabel(0)) ;
       GetVertex(vert,evtIndex); 
       
-      if(vert[2] < -fZvtxCut || vert[2] > fZvtxCut)
+      if(TMath::Abs(vert[2])> GetZvertexCut())
         evtIndex = -2 ; //Event can not be used (vertex, centrality,... cuts not fulfilled)
     } else {// Single event
       
       GetVertex(vert);
       
-      if(vert[2] < -fZvtxCut || vert[2] > fZvtxCut)
+      if(TMath::Abs(vert[2])> GetZvertexCut())
         evtIndex = -1 ; //Event can not be used (vertex, centrality,... cuts not fulfilled)
       else 
         evtIndex = 0 ;
index 15dcfefa27c7de0e87513198793a042de86e4e78..6eba56ab469454d62a5ce865179ed173f5e4ebe1 100755 (executable)
@@ -19,10 +19,10 @@ class TH2D ;
 class TObjString;
 
 //Analysis
+#include "AliAnaPartCorrBaseClass.h"
 class AliAODEvent ;
 class AliESDEvent ;
 class AliAODPWG4Particle ;
-#include "AliAnaPartCorrBaseClass.h"
 
 class AliAnaPi0 : public AliAnaPartCorrBaseClass {
   
@@ -52,12 +52,12 @@ class AliAnaPi0 : public AliAnaPartCorrBaseClass {
     
   //Setters for parameters of event buffers
   void SetNCentrBin(Int_t n=5) {fNCentrBin=n ;} //number of bins in centrality 
-  void SetNZvertBin(Int_t n=5) {fNZvertBin=n ;} //number of bins for vertex position
-  void SetNRPBin(Int_t n=6)    {fNrpBin=n ;}    //number of bins in reaction plain
+//  void SetNZvertBin(Int_t n=5) {fNZvertBin=n ;} //number of bins for vertex position
+//  void SetNRPBin(Int_t n=6)    {fNrpBin=n ;}    //number of bins in reaction plain
   void SetNMaxEvMix(Int_t n=20){fNmaxMixEv=n ;} //Maximal number of events for mixing
   
   //Setters for event selection
-  void SetZvertexCut(Float_t zcut=40.){fZvtxCut=zcut ;} //cut on vertex position
// void SetZvertexCut(Float_t zcut=40.){fZvtxCut=zcut ;} //cut on vertex position
   
   TString GetCalorimeter()   const {return fCalorimeter ; }
   void SetCalorimeter(TString det)    {fCalorimeter = det ; }
@@ -98,11 +98,11 @@ class AliAnaPi0 : public AliAnaPartCorrBaseClass {
   private:
   Bool_t   fDoOwnMix;     // Do combinatorial background not the one provided by the frame
   Int_t    fNCentrBin ;          // Number of bins in event container for centrality
 Int_t    fNZvertBin ;          // Number of bins in event container for vertex position
-  Int_t    fNrpBin ;       // Number of bins in event container for reaction plain
// Int_t    fNZvertBin ;        // Number of bins in event container for vertex position
+//  Int_t    fNrpBin ;     // Number of bins in event container for reaction plain
   Int_t    fNPID ;                 // Number of possible PID combinations
   Int_t    fNmaxMixEv ;          // Maximal number of events stored in buffer for mixing
-  Float_t  fZvtxCut ;      // Cut on vertex position
+//  Float_t  fZvtxCut ;            // Cut on vertex position
   TString  fCalorimeter ; // Select Calorimeter for IM
   Int_t    fNModules ;    // Number of EMCAL/PHOS modules, set as many histogras as modules 
   Bool_t   fUseAngleCut ; // Select pairs depending on their opening angle
index 00f48d80b3b1e4bc96c530e29b19d06bf781d427..900fa5fc177c40d8ce28da4a0abcc6afe8f06e94 100755 (executable)
@@ -276,7 +276,7 @@ void  AliAnaPi0EbE::MakeInvMassInCalorimeter()
     Int_t evtIndex1 = 0 ; 
     if(GetMixedEvent())
       evtIndex1 = GetMixedEvent()->EventIndexForCaloCluster(photon1->GetCaloLabel(0)) ;
-    
+    if(TMath::Abs(GetVertex(evtIndex1)[2]) > GetZvertexCut()) continue ;  //vertex cut
     mom1 = *(photon1->Momentum());
     
     for(Int_t jphoton = iphoton+1; jphoton < GetInputAODBranch()->GetEntriesFast()-1; jphoton++){
@@ -287,7 +287,7 @@ void  AliAnaPi0EbE::MakeInvMassInCalorimeter()
         evtIndex2 = GetMixedEvent()->EventIndexForCaloCluster(photon2->GetCaloLabel(0)) ;
       if(GetMixedEvent() && (evtIndex1 == evtIndex2))
         continue ; 
-      
+      if(TMath::Abs(GetVertex(evtIndex2)[2]) > GetZvertexCut()) continue ;  //vertex cut
       mom2 = *(photon2->Momentum());
       //Int_t input = -1;      //if -1 photons come from different files, not a pi0
       //if(photon1->GetInputFileIndex() == photon2->GetInputFileIndex()) 
@@ -407,7 +407,7 @@ void  AliAnaPi0EbE::MakeInvMassInCalorimeterAndCTS()
   Int_t tag1 = 0;
   Int_t tag2 = 0;
   Int_t tag  = 0;
-  
+  Int_t evtIndex = 0;
   if(!GetInputAODBranch()){
     printf("AliAnaPi0EbE::MakeInvMassInCalorimeterAndCTS() - No input calo photons in AOD branch with name < %s > , STOP\n",GetInputAODName().Data());
     abort();
@@ -425,6 +425,10 @@ void  AliAnaPi0EbE::MakeInvMassInCalorimeterAndCTS()
     }
     for(Int_t jphoton = iphoton+1; jphoton < fInputAODGammaConv->GetEntriesFast()-1; jphoton++){
       AliAODPWG4Particle * photon2 =  (AliAODPWG4Particle*) (fInputAODGammaConv->At(jphoton));
+      if(GetMixedEvent())
+        evtIndex = GetMixedEvent()->EventIndexForCaloCluster(photon2->GetCaloLabel(0)) ;
+      if(TMath::Abs(GetVertex(evtIndex)[2]) > GetZvertexCut()) continue ;  //vertex cut
+      
       mom2 = *(photon2->Momentum());
       
       //Int_t input = -1;      //if -1 photons come from different files, not a pi0
@@ -530,7 +534,8 @@ void  AliAnaPi0EbE::MakeShowerShapeIdentification()
     if (GetMixedEvent()) {
       evtIndex=GetMixedEvent()->EventIndexForCaloCluster(calo->GetID()) ; 
     }
-    
+    if(TMath::Abs(GetVertex(evtIndex)[2]) > GetZvertexCut()) continue ;  //vertex cut
+
     //Cluster selection, not charged, with pi0 id and in fiducial cut
          
     //Input from second AOD?