]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PWGGA/CaloTrackCorrelations/AliAnaParticleHadronCorrelation.cxx
Merge branch 'feature-movesplit'
[u/mrichter/AliRoot.git] / PWGGA / CaloTrackCorrelations / AliAnaParticleHadronCorrelation.cxx
index d2eee6ac15794e881abbb1d1bb4575909c3174ba..1c12fb7d908089ba5c2fab3c9528d378eef76d96 100755 (executable)
@@ -69,12 +69,13 @@ ClassImp(AliAnaParticleHadronCorrelation)
     fListMixTrackEvents(),          fListMixCaloEvents(),
     fUseMixStoredInReader(0),       fFillNeutralEventMixPool(0),
     fM02MaxCut(0),                  fM02MinCut(0),  
-    fFillPileUpHistograms(0),       fFillHighMultHistograms(0),
     fSelectLeadingHadronAngle(0),   fFillLeadHadOppositeHisto(0),
     fMinLeadHadPhi(0),              fMaxLeadHadPhi(0),
     fMinLeadHadPt(0),               fMaxLeadHadPt(0),
     fFillEtaGapsHisto(1),           fFillMomImbalancePtAssocBinsHisto(0),
     fMCGenTypeMin(0),               fMCGenTypeMax(0),
+    fTrackVector(),                 fMomentum(),
+    fDecayMom1(),                   fDecayMom2(),
     //Histograms
     fhPtTriggerInput(0),            fhPtTriggerSSCut(0),
     fhPtTriggerIsoCut(0),           fhPtTriggerFidCut(0),
@@ -281,7 +282,7 @@ void AliAnaParticleHadronCorrelation::FillChargedAngularCorrelationHistograms(Fl
   
   // Pile up studies
   
-  if(fFillPileUpHistograms)
+  if(IsPileUpAnalysisOn())
   {
     if     (outTOF==1)
     {
@@ -325,8 +326,12 @@ void AliAnaParticleHadronCorrelation::FillChargedAngularCorrelationHistograms(Fl
   {
     Int_t mcIndex = GetMCTagHistogramIndex(mcTag);
     fhDeltaPhiChargedMC[mcIndex]->Fill(ptTrig , deltaPhi);
-    if(GetMCAnalysisUtils()->CheckTagBit(mcTag,AliMCAnalysisUtils::kMCDecayPairLost) && mcIndex==2 )
-      fhDeltaPhiChargedMC[7]->Fill(ptTrig , deltaPhi);
+    if(GetMCAnalysisUtils()->CheckTagBit(mcTag,AliMCAnalysisUtils::kMCDecayPairLost) )
+    {
+      // check index in GetMCTagIndexHistogram
+      if     ( mcIndex == 2 ) fhDeltaPhiChargedMC[8]->Fill(ptTrig , deltaPhi); // pi0 decay
+      else if( mcIndex == 4 ) fhDeltaPhiChargedMC[9]->Fill(ptTrig , deltaPhi); // eta decay
+    }
   }
   
   if(fDecayTrigger && decayTag > 0)
@@ -390,7 +395,7 @@ void AliAnaParticleHadronCorrelation::FillChargedAngularCorrelationHistograms(Fl
   }
   
   //fill different multiplicity/centrality histogram
-  if(fFillHighMultHistograms && cen >= 0 && cen < GetNCentrBin())
+  if(IsHighMultiplicityAnalysisOn() && cen >= 0 && cen < GetNCentrBin())
   {
     fhDeltaPhiChargedMult[cen]->Fill(ptTrig,deltaPhi);
     fhDeltaEtaChargedMult[cen]->Fill(ptTrig,deltaEta);
@@ -446,11 +451,9 @@ Bool_t AliAnaParticleHadronCorrelation::FillChargedMCCorrelationHistograms(Float
   
   Double_t mcpout = mcAssocPt*TMath::Sin(mcdeltaPhi) ; 
   
-  if(GetDebug() > 0 )
-  {
-    AliInfo(Form("Charged hadron: track Pt %f, track Phi %f, phi trigger %f. Cuts:  delta phi  %2.2f < %2.2f < %2.2f \n",
-                 mcAssocPt,mcAssocPhi, mcTrigPhi,fDeltaPhiMinCut, mcdeltaPhi, fDeltaPhiMaxCut));
-  }
+  AliDebug(1,Form("Charged hadron: track Pt %f, track Phi %f, phi trigger %f. Cuts:  delta phi  %2.2f < %2.2f < %2.2f",
+                  mcAssocPt,mcAssocPhi, mcTrigPhi,fDeltaPhiMinCut, mcdeltaPhi, fDeltaPhiMaxCut));
+  
   
   // Fill Histograms
   fhMCEtaCharged     [histoIndex]->Fill(mcAssocPt, mcAssocEta);
@@ -472,28 +475,54 @@ Bool_t AliAnaParticleHadronCorrelation::FillChargedMCCorrelationHistograms(Float
     fhMCPtTrigPout       [histoIndex]->Fill(mcTrigPt, mcpout) ;
   }
 
-  if(histoIndex==2 && lostDecayPair && 7 >= fMCGenTypeMin && 7 <= fMCGenTypeMax )
+  if(lostDecayPair)
   {
-    fhMCEtaCharged     [7]->Fill(mcAssocPt, mcAssocEta);
-    fhMCPhiCharged     [7]->Fill(mcAssocPt, mcAssocPhi);
-    fhMCDeltaEtaCharged[7]->Fill(mcTrigPt , mcTrigEta-mcAssocEta);
-    fhMCDeltaPhiCharged[7]->Fill(mcTrigPt , mcdeltaPhi);
-    fhMCPtAssocDeltaPhi[7]->Fill(mcAssocPt, mcdeltaPhi);
-    
-    fhMCDeltaPhiDeltaEtaCharged[7]->Fill(mcdeltaPhi,mcTrigEta-mcAssocEta);
-    
-    //delta phi cut for correlation
-    if( (mcdeltaPhi > fDeltaPhiMinCut) && (mcdeltaPhi < fDeltaPhiMaxCut) )
+    // check index in GetMCTagIndexHistogram
+    if(histoIndex == 2 && 8 >= fMCGenTypeMin && 8 <= fMCGenTypeMax )
     {
-      fhMCDeltaPhiChargedPt[7]->Fill(mcAssocPt,mcdeltaPhi);
-      fhMCPtXECharged      [7]->Fill(mcTrigPt, mcxE);
-      fhMCPtHbpXECharged   [7]->Fill(mcTrigPt, mchbpXE);
-      fhMCPtZTCharged      [7]->Fill(mcTrigPt, mczT);
-      fhMCPtHbpZTCharged   [7]->Fill(mcTrigPt, mchbpZT);
-      fhMCPtTrigPout       [7]->Fill(mcTrigPt, mcpout) ;
-    }
+      // pi0 decay
+      fhMCEtaCharged     [8]->Fill(mcAssocPt, mcAssocEta);
+      fhMCPhiCharged     [8]->Fill(mcAssocPt, mcAssocPhi);
+      fhMCDeltaEtaCharged[8]->Fill(mcTrigPt , mcTrigEta-mcAssocEta);
+      fhMCDeltaPhiCharged[8]->Fill(mcTrigPt , mcdeltaPhi);
+      fhMCPtAssocDeltaPhi[8]->Fill(mcAssocPt, mcdeltaPhi);
+      
+      fhMCDeltaPhiDeltaEtaCharged[8]->Fill(mcdeltaPhi,mcTrigEta-mcAssocEta);
+      
+      //delta phi cut for correlation
+      if( (mcdeltaPhi > fDeltaPhiMinCut) && (mcdeltaPhi < fDeltaPhiMaxCut) )
+      {
+        fhMCDeltaPhiChargedPt[8]->Fill(mcAssocPt,mcdeltaPhi);
+        fhMCPtXECharged      [8]->Fill(mcTrigPt, mcxE);
+        fhMCPtHbpXECharged   [8]->Fill(mcTrigPt, mchbpXE);
+        fhMCPtZTCharged      [8]->Fill(mcTrigPt, mczT);
+        fhMCPtHbpZTCharged   [8]->Fill(mcTrigPt, mchbpZT);
+        fhMCPtTrigPout       [8]->Fill(mcTrigPt, mcpout) ;
+      }
+    } // pi0 decay lost pair
+    if(histoIndex == 4 && 9 >= fMCGenTypeMin && 9 <= fMCGenTypeMax )
+    {
+      // eta decay
+      fhMCEtaCharged     [9]->Fill(mcAssocPt, mcAssocEta);
+      fhMCPhiCharged     [9]->Fill(mcAssocPt, mcAssocPhi);
+      fhMCDeltaEtaCharged[9]->Fill(mcTrigPt , mcTrigEta-mcAssocEta);
+      fhMCDeltaPhiCharged[9]->Fill(mcTrigPt , mcdeltaPhi);
+      fhMCPtAssocDeltaPhi[9]->Fill(mcAssocPt, mcdeltaPhi);
+      
+      fhMCDeltaPhiDeltaEtaCharged[9]->Fill(mcdeltaPhi,mcTrigEta-mcAssocEta);
+      
+      //delta phi cut for correlation
+      if( (mcdeltaPhi > fDeltaPhiMinCut) && (mcdeltaPhi < fDeltaPhiMaxCut) )
+      {
+        fhMCDeltaPhiChargedPt[9]->Fill(mcAssocPt,mcdeltaPhi);
+        fhMCPtXECharged      [9]->Fill(mcTrigPt, mcxE);
+        fhMCPtHbpXECharged   [9]->Fill(mcTrigPt, mchbpXE);
+        fhMCPtZTCharged      [9]->Fill(mcTrigPt, mczT);
+        fhMCPtHbpZTCharged   [9]->Fill(mcTrigPt, mchbpZT);
+        fhMCPtTrigPout       [9]->Fill(mcTrigPt, mcpout) ;
+      }
+    } // eta decay lost pair
   }
-  
   // Underlying event
   
   // Right
@@ -505,8 +534,8 @@ Bool_t AliAnaParticleHadronCorrelation::FillChargedMCCorrelationHistograms(Float
     Double_t mcUezT =   mcAssocPt/mcTrigPt;
     
     if(mcUexE < 0.)
-      printf("FillChargedMCCorrelationHistograms(): Careful!!, negative xE %2.2f for right UE cos(dPhi %2.2f) = %2.2f, check correlation dPhi limits %f to %f\n",
-             mcUexE,randomphi*TMath::RadToDeg(),TMath::Cos(randomphi),fDeltaPhiMinCut*TMath::RadToDeg(),fDeltaPhiMaxCut*TMath::RadToDeg());
+      AliWarning(Form("Careful!!, negative xE %2.2f for right UE cos(dPhi %2.2f) = %2.2f, check correlation dPhi limits %f to %f",
+                      mcUexE,randomphi*TMath::RadToDeg(),TMath::Cos(randomphi),fDeltaPhiMinCut*TMath::RadToDeg(),fDeltaPhiMaxCut*TMath::RadToDeg()));
 
     fhMCPtXEUeCharged[histoIndex]->Fill(mcTrigPt,mcUexE);
     if(mcUexE > 0) fhMCPtHbpXEUeCharged[histoIndex]->Fill(mcTrigPt,TMath::Log(1/mcUexE));
@@ -516,15 +545,31 @@ Bool_t AliAnaParticleHadronCorrelation::FillChargedMCCorrelationHistograms(Float
     
     fhMCUePart[histoIndex]->Fill(mcTrigPt);
     
-    if(histoIndex==2 && lostDecayPair && 7 >= fMCGenTypeMin && 7 <= fMCGenTypeMax )
+    if(lostDecayPair)
     {
-      fhMCPtXEUeCharged[7]->Fill(mcTrigPt,mcUexE);
-      if(mcUexE > 0) fhMCPtHbpXEUeCharged[histoIndex]->Fill(mcTrigPt,TMath::Log(1/mcUexE));
-      
-      fhMCPtZTUeCharged[7]->Fill(mcTrigPt,mcUezT);
-      if(mcUezT > 0) fhMCPtHbpZTUeCharged[histoIndex]->Fill(mcTrigPt,TMath::Log(1/mcUezT));
-      
-      fhMCUePart[7]->Fill(mcTrigPt);
+      // check index in GetMCTagIndexHistogram
+      if(histoIndex == 2 && 8 >= fMCGenTypeMin && 8 <= fMCGenTypeMax )
+      {
+        // pi0 decay
+        fhMCPtXEUeCharged[8]->Fill(mcTrigPt,mcUexE);
+        if(mcUexE > 0) fhMCPtHbpXEUeCharged[8]->Fill(mcTrigPt,TMath::Log(1/mcUexE));
+        
+        fhMCPtZTUeCharged[8]->Fill(mcTrigPt,mcUezT);
+        if(mcUezT > 0) fhMCPtHbpZTUeCharged[8]->Fill(mcTrigPt,TMath::Log(1/mcUezT));
+        
+        fhMCUePart[8]->Fill(mcTrigPt);
+      }
+      else if(histoIndex == 4 && 9 >= fMCGenTypeMin && 9 <= fMCGenTypeMax )
+      {
+        // eta decay
+        fhMCPtXEUeCharged[9]->Fill(mcTrigPt,mcUexE);
+        if(mcUexE > 0) fhMCPtHbpXEUeCharged[9]->Fill(mcTrigPt,TMath::Log(1/mcUexE));
+        
+        fhMCPtZTUeCharged[9]->Fill(mcTrigPt,mcUezT);
+        if(mcUezT > 0) fhMCPtHbpZTUeCharged[9]->Fill(mcTrigPt,TMath::Log(1/mcUezT));
+        
+        fhMCUePart[9]->Fill(mcTrigPt);
+      }
     }
   }
 
@@ -538,8 +583,8 @@ Bool_t AliAnaParticleHadronCorrelation::FillChargedMCCorrelationHistograms(Float
       Double_t mcUezT =   mcAssocPt/mcTrigPt;
       
       if(mcUexE < 0.)
-        printf("FillChargedMCCorrelationHistograms(): Careful!!, negative xE %2.2f for left UE cos(dPhi %2.2f) = %2.2f, check correlation dPhi limits %f to %f\n",
-               mcUexE,randomphi*TMath::RadToDeg(),TMath::Cos(randomphi),fDeltaPhiMinCut*TMath::RadToDeg(),fDeltaPhiMaxCut*TMath::RadToDeg());
+        AliWarning(Form("Careful!!, negative xE %2.2f for left UE cos(dPhi %2.2f) = %2.2f, check correlation dPhi limits %f to %f",
+                        mcUexE,randomphi*TMath::RadToDeg(),TMath::Cos(randomphi),fDeltaPhiMinCut*TMath::RadToDeg(),fDeltaPhiMaxCut*TMath::RadToDeg()));
       
       fhMCPtXEUeLeftCharged[histoIndex]->Fill(mcTrigPt,mcUexE);
       if(mcUexE > 0) fhMCPtHbpXEUeLeftCharged[histoIndex]->Fill(mcTrigPt,TMath::Log(1/mcUexE));
@@ -547,13 +592,27 @@ Bool_t AliAnaParticleHadronCorrelation::FillChargedMCCorrelationHistograms(Float
       fhMCPtZTUeLeftCharged[histoIndex]->Fill(mcTrigPt,mcUezT);
       if(mcUezT > 0) fhMCPtHbpZTUeLeftCharged[histoIndex]->Fill(mcTrigPt,TMath::Log(1/mcUezT));
       
-      if(histoIndex==2 && lostDecayPair && 7 >= fMCGenTypeMin && 7 <= fMCGenTypeMax )
+      if(lostDecayPair)
       {
-        fhMCPtXEUeLeftCharged[7]->Fill(mcTrigPt,mcUexE);
-        if(mcUexE > 0) fhMCPtHbpXEUeLeftCharged[7]->Fill(mcTrigPt,TMath::Log(1/mcUexE));
-        
-        fhMCPtZTUeLeftCharged[7]->Fill(mcTrigPt,mcUezT);
-        if(mcUezT > 0) fhMCPtHbpZTUeLeftCharged[7]->Fill(mcTrigPt,TMath::Log(1/mcUezT));
+        // check index in GetMCTagIndexHistogram
+        if(histoIndex == 2  && 8 >= fMCGenTypeMin && 8 <= fMCGenTypeMax )
+        {
+          // pi0 decay
+          fhMCPtXEUeLeftCharged[8]->Fill(mcTrigPt,mcUexE);
+          if(mcUexE > 0) fhMCPtHbpXEUeLeftCharged[8]->Fill(mcTrigPt,TMath::Log(1/mcUexE));
+          
+          fhMCPtZTUeLeftCharged[8]->Fill(mcTrigPt,mcUezT);
+          if(mcUezT > 0) fhMCPtHbpZTUeLeftCharged[8]->Fill(mcTrigPt,TMath::Log(1/mcUezT));
+        }
+        else if(histoIndex == 4  && 9 >= fMCGenTypeMin && 9 <= fMCGenTypeMax )
+        {
+          // eta decay
+          fhMCPtXEUeLeftCharged[9]->Fill(mcTrigPt,mcUexE);
+          if(mcUexE > 0) fhMCPtHbpXEUeLeftCharged[9]->Fill(mcTrigPt,TMath::Log(1/mcUexE));
+          
+          fhMCPtZTUeLeftCharged[9]->Fill(mcTrigPt,mcUezT);
+          if(mcUezT > 0) fhMCPtHbpZTUeLeftCharged[9]->Fill(mcTrigPt,TMath::Log(1/mcUezT));
+        }
       }
     }
   }
@@ -576,8 +635,8 @@ void AliAnaParticleHadronCorrelation::FillChargedMomentumImbalanceHistograms(Flo
   Float_t pout = ptAssoc*TMath::Sin(deltaPhi) ;
 
   if(xE < 0.)
-    printf("FillChargedMomentumImbalanceHistograms(): Careful!!, negative xE %2.2f for right UE cos(dPhi %2.2f) = %2.2f, check correlation dPhi limits %f to %f\n",
-           xE,deltaPhi*TMath::RadToDeg(),TMath::Cos(deltaPhi),fDeltaPhiMinCut*TMath::RadToDeg(),fDeltaPhiMaxCut*TMath::RadToDeg());
+    AliWarning(Form("Careful!!, negative xE %2.2f for right UE cos(dPhi %2.2f) = %2.2f, check correlation dPhi limits %f to %f",
+               xE,deltaPhi*TMath::RadToDeg(),TMath::Cos(deltaPhi),fDeltaPhiMinCut*TMath::RadToDeg(),fDeltaPhiMaxCut*TMath::RadToDeg()));
 
   Float_t hbpXE = -100;
   Float_t hbpZT = -100;
@@ -602,12 +661,16 @@ void AliAnaParticleHadronCorrelation::FillChargedMomentumImbalanceHistograms(Flo
   {
     Int_t mcIndex = GetMCTagHistogramIndex(mcTag);
     fhXEChargedMC[mcIndex]->Fill(ptTrig , xE);
-    if(GetMCAnalysisUtils()->CheckTagBit(mcTag,AliMCAnalysisUtils::kMCDecayPairLost) && mcIndex==2 )
-      fhXEChargedMC[7]->Fill(ptTrig , xE);
+    if( GetMCAnalysisUtils()->CheckTagBit(mcTag,AliMCAnalysisUtils::kMCDecayPairLost) )
+    {
+      // check index in GetMCTagIndexHistogram
+      if      ( mcIndex == 2 ) fhXEChargedMC[8]->Fill(ptTrig , xE); // pi0 decay
+      else if ( mcIndex == 4 ) fhXEChargedMC[9]->Fill(ptTrig , xE); // eta decay
+    }
   }
   
   // Pile up studies
-  if(fFillPileUpHistograms) 
+  if(IsPileUpAnalysisOn())
   {
     if     (outTOF==1)
     {
@@ -676,7 +739,7 @@ void AliAnaParticleHadronCorrelation::FillChargedMomentumImbalanceHistograms(Flo
   }
   
   //fill different multiplicity/centrality histogram
-  if(fFillHighMultHistograms && cen >= 0 && cen < GetNCentrBin())
+  if(IsHighMultiplicityAnalysisOn() && cen >= 0 && cen < GetNCentrBin())
   {
     fhXEMult[cen]->Fill(ptTrig,xE);
     fhZTMult[cen]->Fill(ptTrig,zT);
@@ -698,8 +761,8 @@ void AliAnaParticleHadronCorrelation::FillChargedUnderlyingEventHistograms(Float
   Double_t uezT =   ptAssoc/ptTrig;
   
   if(uexE < 0.)
-    printf("FillChargedUnderlyingEventHistograms(): Careful!!, negative xE %2.2f for right UE cos(dPhi %2.2f) = %2.2f, check correlation dPhi limits %f to %f\n",
-           uexE,randomphi*TMath::RadToDeg(),TMath::Cos(randomphi),fDeltaPhiMinCut*TMath::RadToDeg(),fDeltaPhiMaxCut*TMath::RadToDeg());
+    AliWarning(Form("Careful!!, negative xE %2.2f for right UE cos(dPhi %2.2f) = %2.2f, check correlation dPhi limits %f to %f",
+               uexE,randomphi*TMath::RadToDeg(),TMath::Cos(randomphi),fDeltaPhiMinCut*TMath::RadToDeg(),fDeltaPhiMaxCut*TMath::RadToDeg()));
   
   fhXEUeCharged->Fill(ptTrig,uexE);
   if(uexE > 0) fhPtHbpXEUeCharged->Fill(ptTrig,TMath::Log(1/uexE));
@@ -709,7 +772,7 @@ void AliAnaParticleHadronCorrelation::FillChargedUnderlyingEventHistograms(Float
   
   // Pile up studies
   
-  if(fFillPileUpHistograms)
+  if(IsPileUpAnalysisOn())
   {
     if     (outTOF==1)
     {
@@ -739,7 +802,7 @@ void AliAnaParticleHadronCorrelation::FillChargedUnderlyingEventHistograms(Float
   }
   
   //fill different multiplicity/centrality histogram
-  if(fFillHighMultHistograms && cen >= 0 && cen < GetNCentrBin())
+  if(IsHighMultiplicityAnalysisOn() && cen >= 0 && cen < GetNCentrBin())
   {
     fhXEUeMult[cen]->Fill(ptTrig,uexE);
     fhZTUeMult[cen]->Fill(ptTrig,uezT);
@@ -762,8 +825,8 @@ void AliAnaParticleHadronCorrelation::FillChargedUnderlyingEventSidesHistograms(
     Double_t uezT =   ptAssoc/ptTrig;
     
     if(uexE < 0.)
-      printf("FillChargedUnderlyingEventSidesHistograms(): Careful!!, negative xE %2.2f for left UE cos(dPhi %2.2f) = %2.2f, check correlation dPhi limits %f to %f\n",
-              uexE,randomphi*TMath::RadToDeg(),TMath::Cos(randomphi),fDeltaPhiMinCut*TMath::RadToDeg(),fDeltaPhiMaxCut*TMath::RadToDeg());
+      AliWarning(Form("Careful!!, negative xE %2.2f for left UE cos(dPhi %2.2f) = %2.2f, check correlation dPhi limits %f to %f",
+                      uexE,randomphi*TMath::RadToDeg(),TMath::Cos(randomphi),fDeltaPhiMinCut*TMath::RadToDeg(),fDeltaPhiMaxCut*TMath::RadToDeg()));
     
     fhXEUeLeftCharged->Fill(ptTrig,uexE);
     if(uexE > 0) fhPtHbpXEUeLeftCharged->Fill(ptTrig,TMath::Log(1/uexE));
@@ -781,8 +844,8 @@ void AliAnaParticleHadronCorrelation::FillChargedUnderlyingEventSidesHistograms(
     Double_t uexE = -(ptAssoc/ptTrig)*TMath::Cos(randomphi);
     
     if(uexE < 0.)
-      printf("FillChargedUnderlyingEventSidesHistograms(): Careful!!, negative xE %2.2f for left-down UE cos(dPhi %2.2f) = %2.2f, check correlation dPhi limits %f to %f\n",
-             uexE,randomphi*TMath::RadToDeg(),TMath::Cos(randomphi),fDeltaPhiMinCut*TMath::RadToDeg(),fDeltaPhiMaxCut*TMath::RadToDeg());
+      AliWarning(Form("Careful!!, negative xE %2.2f for left-down UE cos(dPhi %2.2f) = %2.2f, check correlation dPhi limits %f to %f",
+                      uexE,randomphi*TMath::RadToDeg(),TMath::Cos(randomphi),fDeltaPhiMinCut*TMath::RadToDeg(),fDeltaPhiMaxCut*TMath::RadToDeg()));
     
     fhXEUeLeftDownCharged->Fill(ptTrig,uexE);
   }
@@ -794,8 +857,8 @@ void AliAnaParticleHadronCorrelation::FillChargedUnderlyingEventSidesHistograms(
     Double_t uexE = -(ptAssoc/ptTrig)*TMath::Cos(randomphi);
     
     if(uexE < 0.)
-      printf("FillChargedUnderlyingEventSidesHistograms(): Careful!!, negative xE %2.2f for left-up UE cos(dPhi %2.2f) = %2.2f, check correlation dPhi limits %f to %f\n",
-             uexE,randomphi*TMath::RadToDeg(),TMath::Cos(randomphi),fDeltaPhiMinCut*TMath::RadToDeg(),fDeltaPhiMaxCut*TMath::RadToDeg());
+      AliWarning(Form("Careful!!, negative xE %2.2f for left-up UE cos(dPhi %2.2f) = %2.2f, check correlation dPhi limits %f to %f",
+                      uexE,randomphi*TMath::RadToDeg(),TMath::Cos(randomphi),fDeltaPhiMinCut*TMath::RadToDeg(),fDeltaPhiMaxCut*TMath::RadToDeg()));
     
     fhXEUeLeftUpCharged->Fill(ptTrig,uexE);
   }
@@ -807,8 +870,8 @@ void AliAnaParticleHadronCorrelation::FillChargedUnderlyingEventSidesHistograms(
     Double_t uexE = -(ptAssoc/ptTrig)*TMath::Cos(randomphi);
     
     if(uexE < 0.)
-      printf("FillChargedUnderlyingEventSidesHistograms(): Careful!!, negative xE %2.2f for right-up UE cos(dPhi %2.2f) = %2.2f, check correlation dPhi limits %f to %f\n",
-             uexE,randomphi*TMath::RadToDeg(),TMath::Cos(randomphi),fDeltaPhiMinCut*TMath::RadToDeg(),fDeltaPhiMaxCut*TMath::RadToDeg());
+      AliWarning(Form("Careful!!, negative xE %2.2f for right-up UE cos(dPhi %2.2f) = %2.2f, check correlation dPhi limits %f to %f",
+                      uexE,randomphi*TMath::RadToDeg(),TMath::Cos(randomphi),fDeltaPhiMinCut*TMath::RadToDeg(),fDeltaPhiMaxCut*TMath::RadToDeg()));
     
     fhXEUeRightUpCharged->Fill(ptTrig,uexE);
   }
@@ -820,33 +883,31 @@ void AliAnaParticleHadronCorrelation::FillChargedUnderlyingEventSidesHistograms(
     Double_t uexE = -(ptAssoc/ptTrig)*TMath::Cos(randomphi);
     
     if(uexE < 0.)
-      printf("FillChargedUnderlyingEventSidesHistograms(): Careful!!, negative xE %2.2f for right-down UE cos(dPhi %2.2f) = %2.2f, check correlation dPhi limits %f to %f\n",
-             uexE,randomphi*TMath::RadToDeg(),TMath::Cos(randomphi),fDeltaPhiMinCut*TMath::RadToDeg(),fDeltaPhiMaxCut*TMath::RadToDeg());
+      AliWarning(Form("Careful!!, negative xE %2.2f for right-down UE cos(dPhi %2.2f) = %2.2f, check correlation dPhi limits %f to %f",
+             uexE,randomphi*TMath::RadToDeg(),TMath::Cos(randomphi),fDeltaPhiMinCut*TMath::RadToDeg(),fDeltaPhiMaxCut*TMath::RadToDeg()));
     
     fhXEUeRightDownCharged->Fill(ptTrig,uexE);
   }
 } 
 
-//______________________________________________________________________________________________________________________________
-void AliAnaParticleHadronCorrelation::FillDecayPhotonCorrelationHistograms(Float_t ptAssoc,     Float_t phiAssoc, 
-                                                                           TLorentzVector mom1, TLorentzVector mom2,
-                                                                           Bool_t bChargedOrNeutral)
+//_____________________________________________________________________________________________________________________________________
+void AliAnaParticleHadronCorrelation::FillDecayPhotonCorrelationHistograms(Float_t ptAssoc, Float_t phiAssoc, Bool_t bChargedOrNeutral)
 {
   // Do correlation with decay photons of triggered pi0 or eta
   
   // Calculate the correlation parameters
-  Float_t ptDecay1 = mom1.Pt();
-  Float_t ptDecay2 = mom2.Pt();
+  Float_t ptDecay1 = fDecayMom1.Pt();
+  Float_t ptDecay2 = fDecayMom2.Pt();
   
   Float_t zTDecay1 = -100, zTDecay2 = -100;
   if(ptDecay1 > 0) zTDecay1 = ptAssoc/ptDecay1 ;
   if(ptDecay2 > 0) zTDecay2 = ptAssoc/ptDecay2 ;
   
-  Float_t deltaPhiDecay1 = mom1.Phi()-phiAssoc;
+  Float_t deltaPhiDecay1 = fDecayMom1.Phi()-phiAssoc;
   if(deltaPhiDecay1< -TMath::PiOver2()) deltaPhiDecay1+=TMath::TwoPi();
   if(deltaPhiDecay1>3*TMath::PiOver2()) deltaPhiDecay1-=TMath::TwoPi();
   
-  Float_t deltaPhiDecay2 = mom2.Phi()-phiAssoc;
+  Float_t deltaPhiDecay2 = fDecayMom2.Phi()-phiAssoc;
   if(deltaPhiDecay2< -TMath::PiOver2()) deltaPhiDecay2+=TMath::TwoPi();
   if(deltaPhiDecay2>3*TMath::PiOver2()) deltaPhiDecay2-=TMath::TwoPi();
   
@@ -858,7 +919,7 @@ void AliAnaParticleHadronCorrelation::FillDecayPhotonCorrelationHistograms(Float
     fhDeltaPhiPi0DecayCharged->Fill(ptDecay1, deltaPhiDecay1);
     fhDeltaPhiPi0DecayCharged->Fill(ptDecay2, deltaPhiDecay2);
     
-    if(GetDebug() > 1) printf("AliAnaParticleHadronCorrelation::FillDecayPhotonHistograms( Charged corr) - deltaPhoton1 = %f, deltaPhoton2 = %f \n", deltaPhiDecay1, deltaPhiDecay2);
+    AliDebug(2,Form("deltaPhoton1 = %f, deltaPhoton2 = %f", deltaPhiDecay1, deltaPhiDecay2));
     
     if( (deltaPhiDecay1 > fDeltaPhiMinCut) && ( deltaPhiDecay1 < fDeltaPhiMaxCut) )
     {
@@ -876,7 +937,7 @@ void AliAnaParticleHadronCorrelation::FillDecayPhotonCorrelationHistograms(Float
     fhDeltaPhiPi0DecayNeutral->Fill(ptDecay1, deltaPhiDecay1);
     fhDeltaPhiPi0DecayNeutral->Fill(ptDecay2, deltaPhiDecay2);
     
-    if(GetDebug() > 1) printf("AliAnaParticleHadronCorrelation::FillDecayPhotonHistograms(Neutral corr) - deltaPhoton1 = %f, deltaPhoton2 = %f \n", deltaPhiDecay1, deltaPhiDecay2);
+    AliDebug(2,Form("deltaPhoton1 = %f, deltaPhoton2 = %f", deltaPhiDecay1, deltaPhiDecay2));
     
     if( (deltaPhiDecay1 > fDeltaPhiMinCut) && ( deltaPhiDecay1 < fDeltaPhiMaxCut) )
     {
@@ -972,20 +1033,18 @@ void AliAnaParticleHadronCorrelation::FillChargedEventMixPool()
   
   TList * pool = fListMixTrackEvents[eventBin];
   
-  TVector3 p3;  
   for(Int_t ipr = 0;ipr < GetCTSTracks()->GetEntriesFast() ; ipr ++ )
   {
     AliVTrack * track = (AliVTrack *) (GetCTSTracks()->At(ipr)) ;
     
-    Double_t mom[3] = {track->Px(),track->Py(),track->Pz()};
-    p3.SetXYZ(mom[0],mom[1],mom[2]);
-    Float_t pt   = p3.Pt();
+    fTrackVector.SetXYZ(track->Px(),track->Py(),track->Pz());
+    Float_t pt   = fTrackVector.Pt();
     
     //Select only hadrons in pt range
     if(pt < fMinAssocPt || pt > fMaxAssocPt) continue ;
     
-    AliAODPWG4Particle * mixedTrack = new AliAODPWG4Particle(mom[0],mom[1],mom[2],0);
-    mixedTrack->SetDetector("CTS");
+    AliAODPWG4Particle * mixedTrack = new AliAODPWG4Particle(track->Px(),track->Py(),track->Pz(),0);
+    mixedTrack->SetDetectorTag(kCTS);
     mixedTrack->SetChargedBit(track->Charge()>0);
     mixEventTracks->Add(mixedTrack);
   }
@@ -1051,8 +1110,6 @@ void AliAnaParticleHadronCorrelation::FillNeutralEventMixPool()
   
   TList * poolCalo = fListMixCaloEvents[eventBin];
   
-  TLorentzVector mom;
-
   for(Int_t ipr = 0;ipr <  pl->GetEntriesFast() ; ipr ++ )
   {
     AliVCluster * calo = (AliVCluster *) (pl->At(ipr)) ;
@@ -1063,20 +1120,20 @@ void AliAnaParticleHadronCorrelation::FillNeutralEventMixPool()
     //Cluster momentum calculation
     if(GetReader()->GetDataType() != AliCaloTrackReader::kMC)
     {
-      calo->GetMomentum(mom,GetVertex(0)) ;
+      calo->GetMomentum(fMomentum,GetVertex(0)) ;
     }//Assume that come from vertex in straight line
     else
     {
       Double_t vertex[]={0,0,0};
-      calo->GetMomentum(mom,vertex) ;
+      calo->GetMomentum(fMomentum,vertex) ;
     }
     
-    Float_t pt = mom.Pt();
+    Float_t pt = fMomentum.Pt();
     //Select only clusters in pt range
     if(pt < fMinAssocPt || pt > fMaxAssocPt) continue ;
     
-    AliAODPWG4Particle * mixedCalo = new AliAODPWG4Particle(mom);
-    mixedCalo->SetDetector("EMCAL");
+    AliAODPWG4Particle * mixedCalo = new AliAODPWG4Particle(fMomentum);
+    mixedCalo->SetDetectorTag(kEMCAL);
     mixEventCalo->Add(mixedCalo);
   }
   
@@ -1115,17 +1172,15 @@ Bool_t AliAnaParticleHadronCorrelation::FindLeadingOppositeHadronInWindow(AliAOD
   Float_t phiLeadHad = -100 ;
   Float_t etaLeadHad = -100 ;
   Int_t   nTrack     = 0;
-  TVector3 p3;
 
   for(Int_t ipr = 0;ipr < GetCTSTracks()->GetEntriesFast() ; ipr ++ )
   {
     AliVTrack * track = (AliVTrack *) (GetCTSTracks()->At(ipr)) ;
     
-    Double_t mom[3] = {track->Px(),track->Py(),track->Pz()};
-    p3.SetXYZ(mom[0],mom[1],mom[2]);
+    fTrackVector.SetXYZ(track->Px(),track->Py(),track->Pz());
     
-    Float_t pt   = p3.Pt();
-    Float_t phi  = p3.Phi() ;
+    Float_t pt   = fTrackVector.Pt();
+    Float_t phi  = fTrackVector.Phi() ;
     if(phi < 0 ) phi+= TMath::TwoPi();
     
     Float_t deltaPhi = phiTrig-phi;
@@ -1142,7 +1197,7 @@ Bool_t AliAnaParticleHadronCorrelation::FindLeadingOppositeHadronInWindow(AliAOD
       ptLeadHad  = pt ;
       phiLeadHad = phi;
       dphiLeadHad= deltaPhi;
-      etaLeadHad = p3.Eta();
+      etaLeadHad = fTrackVector.Eta();
       nTrack++;
     }
   }// track loop
@@ -1162,15 +1217,14 @@ Bool_t AliAnaParticleHadronCorrelation::FindLeadingOppositeHadronInWindow(AliAOD
     }
   }
   
-  if(GetDebug() > 1 )
-  {
-    printf("AliAnaParticleHadronCorrelation::FindLeadingOppositeHadronInWindow() pT %2.2f, phi %2.2f, eta %2.2f, nTracks away %d, total tracks %d\n",
-           ptLeadHad,phiLeadHad*TMath::RadToDeg(),etaLeadHad,nTrack, GetTrackMultiplicity());
-    
-    printf("\t  pT trig %2.2f, Dphi (trigger-hadron) %2.2f, Deta (trigger-hadron) %2.2f\n",
-           ptTrig, dphiLeadHad*TMath::RadToDeg(), etaLeadHad-etaTrig);
-    printf("\t cuts pT: min %2.2f, max %2.2f; DPhi: min %2.2f, max %2.2f\n",fMinLeadHadPt,fMaxLeadHadPt,fMinLeadHadPhi*TMath::RadToDeg(),fMaxLeadHadPhi*TMath::RadToDeg());
-  }
+  
+    AliDebug(1,Form("pT %2.2f, phi %2.2f, eta %2.2f, nTracks away %d, total tracks %d",
+                    ptLeadHad,phiLeadHad*TMath::RadToDeg(),etaLeadHad,nTrack, GetTrackMultiplicity()));
+    AliDebug(1,Form("\t pT trig %2.2f, Dphi (trigger-hadron) %2.2f, Deta (trigger-hadron) %2.2f",
+           ptTrig, dphiLeadHad*TMath::RadToDeg(), etaLeadHad-etaTrig));
+    AliDebug(1,Form("\t cuts pT: min %2.2f, max %2.2f; DPhi: min %2.2f, max %2.2f",
+                    fMinLeadHadPt,fMaxLeadHadPt,fMinLeadHadPhi*TMath::RadToDeg(),fMaxLeadHadPhi*TMath::RadToDeg()));
+  
   
   // reject the trigger if the leading hadron is not in the requested pt or phi window and
   
@@ -1259,7 +1313,7 @@ TList *  AliAnaParticleHadronCorrelation::GetCreateOutputObjects()
   
   Int_t nMixBins = GetNCentrBin()*GetNZvertBin()*GetNRPBin();
   
-  TString nameMC[]     = {"Photon","Pi0","Pi0Decay","EtaDecay","OtherDecay","Electron","Hadron","Pi0DecayLostPair"};
+  TString nameMC[]     = {"Photon","Pi0","Pi0Decay","Eta","EtaDecay","OtherDecay","Electron","Hadron","Pi0DecayLostPair","EtaDecayLostPair"};
   TString pileUpName[] = {"SPD","EMCAL","SPDOrEMCAL","SPDAndEMCAL","SPDAndNotEMCAL","EMCALAndNotSPD","NotSPDAndNotEMCAL"} ;
   
   // For vz dependent histograms, if option ON
@@ -1355,7 +1409,7 @@ TList *  AliAnaParticleHadronCorrelation::GetCreateOutputObjects()
   fhEtaTrigger->SetYTitle("#eta ");
   outputContainer->Add(fhEtaTrigger);
   
-  if(fFillHighMultHistograms)
+  if(IsHighMultiplicityAnalysisOn())
   {
     fhPtTriggerCentrality   = new TH2F("hPtTriggerCentrality","Trigger particle #it{p}_{T} vs centrality",nptbins,ptmin,ptmax,100,0.,100) ;
     fhPtTriggerCentrality->SetXTitle("#it{p}_{T}^{trig} (GeV/#it{c})");
@@ -1722,7 +1776,7 @@ TList *  AliAnaParticleHadronCorrelation::GetCreateOutputObjects()
     outputContainer->Add(fhPtHbpZTUeLeftCharged) ;
   }
   
-  if(fFillPileUpHistograms)
+  if(IsPileUpAnalysisOn())
   {
     fhDeltaPhiChargedOtherBC  = new TH2F
     ("hDeltaPhiChargedOtherBC","#phi_{trigger} - #phi_{h^{#pm}} vs #it{p}_{T trigger}, track BC!=0",
@@ -1951,7 +2005,7 @@ TList *  AliAnaParticleHadronCorrelation::GetCreateOutputObjects()
     }
   }
 
-  if(fFillHighMultHistograms)
+  if(IsHighMultiplicityAnalysisOn())
   {
     Int_t nMultiBins = GetNCentrBin();
     fhDeltaPhiChargedMult = new TH2F*[nMultiBins] ;
@@ -2570,29 +2624,29 @@ TList *  AliAnaParticleHadronCorrelation::GetCreateOutputObjects()
       fhMCUePart[i]->SetXTitle("#it{p}_{T trigger} (GeV/#it{c})");
       
       fhMCPtXEUeCharged[i]  =
-      new TH2F(Form("hMCPtXEUeCharged%s",right.Data()),
-               Form("MC %s: #it{x}_{#it{E}} with charged hadrons, Underlying Event",nameMC[i].Data()),
+      new TH2F(Form("hMCPtXEUeCharged%s_%s",right.Data(),nameMC[i].Data()),
+               Form("MC %s: #it{x}_{#it{E}} with charged hadrons, Underlying Event %s",nameMC[i].Data(),right.Data()),
                nptbins,ptmin,ptmax,nxeztbins,xeztmin,xeztmax);
       fhMCPtXEUeCharged[i]->SetYTitle("#it{x}_{#it{E}}");
       fhMCPtXEUeCharged[i]->SetXTitle("#it{p}_{T trigger} (GeV/#it{c})");
       
       fhMCPtHbpXEUeCharged[i] =
-      new TH2F(Form("hMCPtHbpXEUeCharged%s",right.Data()),
-               Form("MC %s: #xi = ln(1/#it{x}_{#it{E}}) with charged hadrons, Underlying Event",nameMC[i].Data()),
+      new TH2F(Form("hMCPtHbpXEUeCharged%s_%s",right.Data(),nameMC[i].Data()),
+               Form("MC %s: #xi = ln(1/#it{x}_{#it{E}}) with charged hadrons, Underlying Event %s",nameMC[i].Data(),right.Data()),
                nptbins,ptmin,ptmax,nhbpbins,hbpmin,hbpmax);
       fhMCPtHbpXEUeCharged[i]->SetYTitle("ln(1/#it{x}_{#it{E}})");
       fhMCPtHbpXEUeCharged[i]->SetXTitle("#it{p}_{T trigger} (GeV/#it{c})");
       
       fhMCPtZTUeCharged[i] =
-      new TH2F(Form("hMCPtZTUeCharged%s",right.Data()),
-               Form("MC %s: #it{z}_{T} with charged hadrons, Underlying Event",nameMC[i].Data()),
+      new TH2F(Form("hMCPtZTUeCharged%s_%s",right.Data(),nameMC[i].Data()),
+               Form("MC %s: #it{z}_{T} with charged hadrons, Underlying Event %s",nameMC[i].Data(),right.Data()),
                nptbins,ptmin,ptmax,nxeztbins,xeztmin,xeztmax);
       fhMCPtZTUeCharged[i]->SetYTitle("#it{z}_{T}");
       fhMCPtZTUeCharged[i]->SetXTitle("#it{p}_{T trigger} (GeV/#it{c})");
       
       fhMCPtHbpZTUeCharged[i] =
-      new TH2F(Form("hMCPtHbpZTUeCharged%s",right.Data()),
-               Form("MC %s: #xi = ln(1/#it{z}_{T}) with charged hadrons, Underlying Event",nameMC[i].Data()),
+      new TH2F(Form("hMCPtHbpZTUeCharged%s_%s",right.Data(),nameMC[i].Data()),
+               Form("MC %s: #xi = ln(1/#it{z}_{T}) with charged hadrons, Underlying Event %s",nameMC[i].Data(),right.Data()),
                nptbins,ptmin,ptmax,nhbpbins,hbpmin,hbpmax);
       fhMCPtHbpZTUeCharged[i]->SetYTitle("ln(1/#it{z}_{T})");
       fhMCPtHbpZTUeCharged[i]->SetXTitle("#it{p}_{T trigger} (GeV/#it{c})");
@@ -2861,35 +2915,29 @@ TList *  AliAnaParticleHadronCorrelation::GetCreateOutputObjects()
   
 }
 
-//_________________________________________________________________________________________________
-Bool_t AliAnaParticleHadronCorrelation::GetDecayPhotonMomentum(AliAODPWG4Particle* trigger,
-                                                               TLorentzVector & mom1,
-                                                               TLorentzVector & mom2)
+//_____________________________________________________________________________________________________________________
+Bool_t AliAnaParticleHadronCorrelation::GetDecayPhotonMomentum(Int_t indexPhoton1, Int_t indexPhoton2, Int_t idetector)
 {
   // Get the momentum of the pi0/eta assigned decay photons
   // In case of pi0/eta trigger, we may want to check their decay correlation,
   // get their decay children
   
-  Int_t indexPhoton1 = trigger->GetCaloLabel(0);
-  Int_t indexPhoton2 = trigger->GetCaloLabel(1);
-  
   if(indexPhoton1!=-1 || indexPhoton2!=-1) return kFALSE;
   
-  if(GetDebug() > 1)
-    printf("AliAnaParticleHadronCorrelation::GetDecayPhotonMomentum() - indexPhoton1 = %d, indexPhoton2 = %d \n", indexPhoton1, indexPhoton2);
+  AliDebug(1,Form("indexPhoton1 = %d, indexPhoton2 = %d", indexPhoton1, indexPhoton2));
   
   TObjArray * clusters  = 0x0 ;
-  if(trigger->GetDetector()=="EMCAL") clusters = GetEMCALClusters() ;
-  else                                clusters = GetPHOSClusters()  ;
+  if(idetector==kEMCAL) clusters = GetEMCALClusters() ;
+  else                  clusters = GetPHOSClusters()  ;
   
   for(Int_t iclus = 0; iclus < clusters->GetEntriesFast(); iclus++)
   {
     AliVCluster * photon =  (AliVCluster*) (clusters->At(iclus));
     
-    if(photon->GetID()==indexPhoton1) photon->GetMomentum(mom1,GetVertex(0)) ;
-    if(photon->GetID()==indexPhoton2) photon->GetMomentum(mom1,GetVertex(0)) ;
+    if(photon->GetID()==indexPhoton1) photon->GetMomentum(fDecayMom1,GetVertex(0)) ;
+    if(photon->GetID()==indexPhoton2) photon->GetMomentum(fDecayMom2,GetVertex(0)) ;
     
-    if(GetDebug() > 1)printf("AliAnaParticleHadronCorrelation::GetDecayPhotonMomentum() - Photon1 = %f, Photon2 = %f \n", mom1.Pt(), mom2.Pt());
+    AliDebug(1,Form("Photon1 = %f, Photon2 = %f", fDecayMom1.Pt(), fDecayMom2.Pt()));
     
   } //cluster loop        
   
@@ -2903,14 +2951,15 @@ Int_t AliAnaParticleHadronCorrelation::GetMCTagHistogramIndex(Int_t mcTag)
   // Index of MC histograms depending on MC origin
   
   if     ( GetMCAnalysisUtils()->CheckTagBit(mcTag,AliMCAnalysisUtils::kMCPrompt) ||        
-           GetMCAnalysisUtils()->CheckTagBit(mcTag,AliMCAnalysisUtils::kMCFragmentation)) return 0;
-  else if( GetMCAnalysisUtils()->CheckTagBit(mcTag,AliMCAnalysisUtils::kMCPi0))           return 1;    
-  else if( GetMCAnalysisUtils()->CheckTagBit(mcTag,AliMCAnalysisUtils::kMCPi0Decay))      return 2;
-  else if( GetMCAnalysisUtils()->CheckTagBit(mcTag,AliMCAnalysisUtils::kMCEta)  ||
-           GetMCAnalysisUtils()->CheckTagBit(mcTag,AliMCAnalysisUtils::kMCEtaDecay))      return 3;
-  else if( GetMCAnalysisUtils()->CheckTagBit(mcTag,AliMCAnalysisUtils::kMCOtherDecay))    return 4;
-  else if(!GetMCAnalysisUtils()->CheckTagBit(mcTag,AliMCAnalysisUtils::kMCElectron))      return 5;
-  else                                                                                    return 6;
+           GetMCAnalysisUtils()->CheckTagBit(mcTag,AliMCAnalysisUtils::kMCFragmentation) ||
+           GetMCAnalysisUtils()->CheckTagBit(mcTag,AliMCAnalysisUtils::kMCISR)          ) return 0;
+  else if( GetMCAnalysisUtils()->CheckTagBit(mcTag,AliMCAnalysisUtils::kMCPi0)          ) return 1;
+  else if( GetMCAnalysisUtils()->CheckTagBit(mcTag,AliMCAnalysisUtils::kMCPi0Decay)     ) return 2;
+  else if( GetMCAnalysisUtils()->CheckTagBit(mcTag,AliMCAnalysisUtils::kMCEta)          ) return 3;
+  else if( GetMCAnalysisUtils()->CheckTagBit(mcTag,AliMCAnalysisUtils::kMCEtaDecay)     ) return 4;
+  else if( GetMCAnalysisUtils()->CheckTagBit(mcTag,AliMCAnalysisUtils::kMCPhoton)       ) return 5; // other decays
+  else if(!GetMCAnalysisUtils()->CheckTagBit(mcTag,AliMCAnalysisUtils::kMCElectron)     ) return 6;
+  else                                                                                    return 7;
   
 }
 
@@ -2921,7 +2970,7 @@ void AliAnaParticleHadronCorrelation::Init()
   //Do some checks
   
   if(!GetReader()->IsCTSSwitchedOn())
-    AliFatal("STOP!: You want to use CTS tracks in analysis but not read!! \n!!Check the configuration file!!\n");
+    AliFatal("STOP!: You want to use CTS tracks in analysis but not read!! \n!!Check the configuration file!!");
 }
 
 //____________________________________________________
@@ -2977,15 +3026,15 @@ void AliAnaParticleHadronCorrelation::InitParameters()
   fM02MaxCut   = -1 ;
   
   fSelectLeadingHadronAngle = kFALSE;
-  fFillLeadHadOppositeHisto      = kFALSE;
+  fFillLeadHadOppositeHisto = kFALSE;
   fMinLeadHadPhi = 150*TMath::DegToRad();
   fMaxLeadHadPhi = 210*TMath::DegToRad();
 
   fMinLeadHadPt  = 1;
   fMaxLeadHadPt  = 100;
   
-  fMCGenTypeMin = 0;
-  fMCGenTypeMax = 6;
+  fMCGenTypeMin =  0;
+  fMCGenTypeMax = 10;
   
   fNDecayBits = 1;
   fDecayBits[0] = AliNeutralMesonSelection::kPi0;
@@ -3036,7 +3085,6 @@ Bool_t AliAnaParticleHadronCorrelation::IsTriggerTheEventLeadingParticle()
   
   // Compare if it is the leading of all tracks
   
-  TVector3 p3;
   for(Int_t ipr = 0;ipr < GetCTSTracks()->GetEntriesFast() ; ipr ++ )
   {
     AliVTrack * track = (AliVTrack *) (GetCTSTracks()->At(ipr)) ;
@@ -3044,10 +3092,9 @@ Bool_t AliAnaParticleHadronCorrelation::IsTriggerTheEventLeadingParticle()
     if(track->GetID() == pLeading->GetTrackLabel(0) || track->GetID() == pLeading->GetTrackLabel(1) ||
        track->GetID() == pLeading->GetTrackLabel(2) || track->GetID() == pLeading->GetTrackLabel(3)   ) continue ;
     
-    Double_t mom[3] = {track->Px(),track->Py(),track->Pz()};
-    p3.SetXYZ(mom[0],mom[1],mom[2]);
-    Float_t pt   = p3.Pt();
-    Float_t phi  = p3.Phi() ;
+    fTrackVector.SetXYZ(track->Px(),track->Py(),track->Pz());
+    Float_t pt   = fTrackVector.Pt();
+    Float_t phi  = fTrackVector.Phi() ;
     if(phi < 0) phi+=TMath::TwoPi();
     
     //jump out this event if near side associated particle pt larger than trigger
@@ -3072,24 +3119,23 @@ Bool_t AliAnaParticleHadronCorrelation::IsTriggerTheEventLeadingParticle()
   {
     // Select the calorimeter cluster list
     TObjArray * nePl = 0x0;
-    if      (pLeading->GetDetector() == "PHOS" )
+    if      (pLeading->GetDetectorTag() == kPHOS )
       nePl = GetPHOSClusters();
     else
       nePl = GetEMCALClusters();
     
     if(!nePl) return kTRUE; // Do the selection just with the tracks if no calorimeter is available.
     
-    TLorentzVector lv;
     for(Int_t ipr = 0;ipr < nePl->GetEntriesFast() ; ipr ++ )
     {
       AliVCluster * cluster = (AliVCluster *) (nePl->At(ipr)) ;
       
       if(cluster->GetID() == pLeading->GetCaloLabel(0) || cluster->GetID() == pLeading->GetCaloLabel(1) ) continue ;
       
-      cluster->GetMomentum(lv,GetVertex(0));
+      cluster->GetMomentum(fMomentum,GetVertex(0));
       
-      Float_t pt   = lv.Pt();
-      Float_t phi  = lv.Phi() ;
+      Float_t pt   = fMomentum.Pt();
+      Float_t phi  = fMomentum.Phi() ;
       if(phi < 0) phi+=TMath::TwoPi();
       
       if(IsTrackMatched(cluster,GetReader()->GetInputEvent())) continue ; // avoid charged clusters, already covered by tracks, or cluster merging with track.
@@ -3115,7 +3161,7 @@ Bool_t AliAnaParticleHadronCorrelation::IsTriggerTheEventLeadingParticle()
   fLeadingTriggerIndex = index ;
   pLeading->SetLeadingParticle(kTRUE);
 
-  if( GetDebug() > 1 ) printf("\t particle AOD with index %d is leading with pT %2.2f\n", fLeadingTriggerIndex, pLeading->Pt());
+  AliDebug(1,Form("\t particle AOD with index %d is leading with pT %2.2f", fLeadingTriggerIndex, pLeading->Pt()));
   
   return kTRUE;
   
@@ -3128,25 +3174,20 @@ void  AliAnaParticleHadronCorrelation::MakeAnalysisFillHistograms()
   
   if(!GetInputAODBranch())
   {
-    AliFatal(Form("No input particles in AOD with name branch < %s >, STOP \n",GetInputAODName().Data()));
+    AliFatal(Form("No input particles in AOD with name branch < %s >, STOP",GetInputAODName().Data()));
     return ; // coverity
   }
   
   Int_t naod = GetInputAODBranch()->GetEntriesFast();
   if( naod == 0 )
   {
-    if(GetDebug() > 1)
-      printf("AliAnaParticleHadronCorrelation::MakeAnalysisFillAOD() - No particle AOD found! \n");
-    
+    AliWarning("No particle AOD found!");
     return ; // no trigger particles found.
   }
 
-  if(GetDebug() > 1)
-  {
-    printf("AliAnaParticleHadronCorrelation::MakeAnalysisFillHistograms() - Begin hadron correlation analysis, fill histograms \n");
-    printf("AliAnaParticleHadronCorrelation::MakeAnalysisFillHistograms() - In particle branch aod entries %d\n", naod);
-    printf("AliAnaParticleHadronCorrelation::MakeAnalysisFillHistograms() - In CTS aod entries %d\n",   GetCTSTracks()->GetEntriesFast());
-  }
+  AliDebug(1,Form("Begin hadron correlation analysis, fill histograms"));
+  AliDebug(1,Form("n particle branch aod entries %d", naod));
+  AliDebug(1,Form("In CTS aod entries %d",GetCTSTracks()->GetEntriesFast()));
   
   //------------------------------------------------------
   // Find leading trigger if analysis request only leading,
@@ -3157,12 +3198,11 @@ void  AliAnaParticleHadronCorrelation::MakeAnalysisFillHistograms()
   {
     Bool_t leading = IsTriggerTheEventLeadingParticle();
     
-    if(GetDebug() > 1)
-      printf("AliAnaParticleHadronCorrelation::MakeAnalysisFillHistograms() - AOD Leading trigger? %d, with index %d\n",leading,fLeadingTriggerIndex);
+    AliDebug(1,Form("AOD Leading trigger? %d, with index %d",leading,fLeadingTriggerIndex));
     
     if(!leading)
     {
-      if(GetDebug() > 1) printf("AliAnaParticleHadronCorrelation::MakeAnalysisFillHistograms() - Leading was requested and not found\n");
+      AliDebug(1,"Leading was requested and not found");
       return ;
     }
     else
@@ -3178,7 +3218,7 @@ void  AliAnaParticleHadronCorrelation::MakeAnalysisFillHistograms()
   
   Float_t cen         = GetEventCentrality();
   Float_t ep          = GetEventPlaneAngle();
-  if(fFillHighMultHistograms) fhTriggerEventPlaneCentrality->Fill(cen,ep);
+  if(IsHighMultiplicityAnalysisOn()) fhTriggerEventPlaneCentrality->Fill(cen,ep);
 
   Int_t   mixEventBin = GetEventMixBin();
   Int_t   vzbin       = GetEventVzBin();
@@ -3205,26 +3245,31 @@ void  AliAnaParticleHadronCorrelation::MakeAnalysisFillHistograms()
     // Not needed if already done at the particle identification level,
     // but for isolation studies, it is preferred not to remove so we do it here
     //
-    Int_t clID1  = particle->GetCaloLabel(0) ;
-    Int_t clID2  = particle->GetCaloLabel(1) ; // for photon clusters should not be set.
-    if( GetDebug() > 1 ) printf("%s Trigger : id1 %d, id2 %d, min %f, max %f, det %s\n",
-           GetInputAODName().Data(),clID1,clID2,fM02MinCut,fM02MaxCut,(particle->GetDetector()).Data());
-    
-    if(clID1 > 0 && clID2 < 0 && fM02MaxCut > 0 && fM02MinCut > 0)
+
+    AliDebug(1,Form("%s Trigger : min %f, max %f, det %d",
+                    GetInputAODName().Data(),fM02MinCut,fM02MaxCut,particle->GetDetectorTag()));
+
+    if(fM02MaxCut > 0 && fM02MinCut > 0) //clID1 > 0 && clID2 < 0 &&
     {
-      Int_t iclus = -1;
-      TObjArray* clusters = 0x0;
-      if     (particle->GetDetector() == "EMCAL") clusters = GetEMCALClusters();
-      else if(particle->GetDetector() == "PHOS" ) clusters = GetPHOSClusters();
-      
-      if(clusters)
-      {
-        AliVCluster *cluster = FindCluster(clusters,clID1,iclus);
-        Float_t m02 = cluster->GetM02();
-        if(m02 > fM02MaxCut || m02 < fM02MinCut) continue ;
-      }
+//      Int_t iclus = -1;
+//      TObjArray* clusters = 0x0;
+//      if     (particle->GetDetectorTag() == kEMCAL) clusters = GetEMCALClusters();
+//      else if(particle->GetDetectorTag() == kPHOS ) clusters = GetPHOSClusters();
+//      
+//      if(clusters)
+//      {
+//        AliVCluster *cluster = FindCluster(clusters,clID1,iclus);
+//        Float_t m02 = cluster->GetM02();
+//        if(m02 > fM02MaxCut || m02 < fM02MinCut) continue ;
+//      }
+      
+      Float_t m02 = particle->GetM02();
+
+      if(m02 > fM02MaxCut || m02 < fM02MinCut) continue ;
       
       fhPtTriggerSSCut->Fill(pt);
+      
+      AliDebug(1,"Pass the shower shape cut");
     }
     
     //
@@ -3234,7 +3279,10 @@ void  AliAnaParticleHadronCorrelation::MakeAnalysisFillHistograms()
     if(OnlyIsolated())
     {
       if( !particle->IsIsolated() ) continue;
+
       fhPtTriggerIsoCut->Fill(pt);
+      
+      AliDebug(1,"Pass the isolation cut");
     }
     
     //
@@ -3242,8 +3290,11 @@ void  AliAnaParticleHadronCorrelation::MakeAnalysisFillHistograms()
     //
     if(IsFiducialCutOn())
     {
-      Bool_t in = GetFiducialCut()->IsInFiducialCut(*particle->Momentum(),particle->GetDetector()) ;
+      Bool_t in = GetFiducialCut()->IsInFiducialCut(particle->Eta(),particle->Phi(),particle->GetDetectorTag()) ;
+      
       if(! in ) continue ;
+      
+      AliDebug(1,"Pass the fiducial cut");
     }
     
     fhPtTriggerFidCut->Fill(pt);
@@ -3297,30 +3348,37 @@ void  AliAnaParticleHadronCorrelation::MakeAnalysisFillHistograms()
     if(IsDataMC() && mcIndex >=0 && mcIndex < fgkNmcTypes)
     {
       fhPtTriggerMC[mcIndex]->Fill(pt);
-      if( lostDecayPair && mcIndex==2 )
-        fhPtTriggerMC[7]->Fill(pt);
+      if( lostDecayPair )
+      {
+        // check index in GetMCTagIndexHistogram
+        if     ( mcIndex == 2 ) fhPtTriggerMC[8]->Fill(pt); // pi0 decay
+        else if( mcIndex == 4 ) fhPtTriggerMC[9]->Fill(pt); // eta decay
+      }
     }
     
     if(fDecayTrigger)
     {
-      Int_t decayTag = particle->GetBtag(); // temporary
-      if(decayTag > 0)
+      Int_t decayTag = particle->DecayTag();
+      if(decayTag < 0) decayTag = 0;
+      
+      for(Int_t ibit = 0; ibit<fNDecayBits; ibit++)
       {
-        for(Int_t ibit = 0; ibit<fNDecayBits; ibit++)
+        if(GetNeutralMesonSelection()->CheckDecayBit(decayTag,fDecayBits[ibit]))
         {
-          if(GetNeutralMesonSelection()->CheckDecayBit(decayTag,fDecayBits[ibit]))
+          fhPtDecayTrigger[ibit]->Fill(pt);
+          
+          if(IsDataMC() && mcIndex >=0 && mcIndex < fgkNmcTypes)
           {
-            fhPtDecayTrigger[ibit]->Fill(pt);
-            
-            if(IsDataMC() && mcIndex >=0 && mcIndex < fgkNmcTypes)
+            fhPtDecayTriggerMC[ibit][mcIndex]->Fill(pt);
+            if( lostDecayPair )
             {
-              fhPtDecayTriggerMC[ibit][mcIndex]->Fill(pt);
-              if(lostDecayPair && mcIndex==2 )
-                fhPtDecayTriggerMC[ibit][7]->Fill(pt);
+              // check index in GetMCTagIndexHistogram
+              if( mcIndex == 2 )  fhPtDecayTriggerMC[ibit][8]->Fill(pt); // pi0 decay
+              if( mcIndex == 4 )  fhPtDecayTriggerMC[ibit][9]->Fill(pt); // eta decay
             }
           }
-        }
-      }
+        }// check bit
+      }// bit loop
     }
     
     //
@@ -3340,7 +3398,7 @@ void  AliAnaParticleHadronCorrelation::MakeAnalysisFillHistograms()
     if(fCorrelVzBin)
       fhPtTriggerVzBin->Fill(pt,vzbin);
     
-    if(fFillHighMultHistograms)
+    if(IsHighMultiplicityAnalysisOn())
     {
       fhPtTriggerCentrality->Fill(pt,cen);
       fhPtTriggerEventPlane->Fill(pt,ep);
@@ -3349,7 +3407,7 @@ void  AliAnaParticleHadronCorrelation::MakeAnalysisFillHistograms()
     //----------------------------------
     // Trigger particle pT vs pile-up
     
-    if(fFillPileUpHistograms)
+    if(IsPileUpAnalysisOn())
     {
       Int_t vtxBC = GetReader()->GetVertexBC();
       if(vtxBC == 0 || vtxBC==AliVTrack::kTOFBCNA)     fhPtTriggerVtxBC0->Fill(pt);
@@ -3367,15 +3425,14 @@ void  AliAnaParticleHadronCorrelation::MakeAnalysisFillHistograms()
   //Reinit for next event
   fLeadingTriggerIndex = -1;
   
-  if(GetDebug() > 1) printf("AliAnaParticleHadronCorrelation::MakeAnalysisFillHistograms() - End fill histograms \n");
+  AliDebug(1,"End fill histograms");
 }
 
 //_______________________________________________________________________________________________________
 void  AliAnaParticleHadronCorrelation::MakeChargedCorrelation(AliAODPWG4ParticleCorrelation *aodParticle)
 {  
   // Charged Hadron Correlation Analysis
-  if(GetDebug() > 1) 
-    printf("AliAnaParticleHadronCorrelation::MakeChargedCorrelation() - Make trigger particle - charged hadron correlation \n");
+  AliDebug(1,"Make trigger particle - charged hadron correlation");
     
   Float_t phiTrig = aodParticle->Phi();
   Float_t etaTrig = aodParticle->Eta();
@@ -3388,8 +3445,8 @@ void  AliAnaParticleHadronCorrelation::MakeChargedCorrelation(AliAODPWG4Particle
   if(fDecayTrigger)
   {
     //decay = aodParticle->IsTagged();
-    decayTag = aodParticle->GetBtag(); // temporary
-    if(decayTag < 0) decayTag = 0; // temporary
+    decayTag = aodParticle->DecayTag();
+    if(decayTag < 0) decayTag = 0;
 //    printf("Correlation: pT %2.2f, BTag %d, Tagged %d\n",ptTrig, decayTag, aodParticle->IsTagged());
 //    printf("\t check bit Pi0 %d, Eta %d,  Pi0Side %d, EtaSide %d\n",
 //           GetNeutralMesonSelection()->CheckDecayBit(decayTag,AliNeutralMesonSelection::kPi0),
@@ -3403,8 +3460,6 @@ void  AliAnaParticleHadronCorrelation::MakeChargedCorrelation(AliAODPWG4Particle
   Float_t eta      = -100. ;
   Float_t deltaPhi = -100. ;
   
-  TVector3 p3;  
-  TLorentzVector photonMom ;   
   TObjArray * reftracks = 0x0;
   Int_t nrefs           = 0;
   
@@ -3422,22 +3477,21 @@ void  AliAnaParticleHadronCorrelation::MakeChargedCorrelation(AliAODPWG4Particle
   
   // Track multiplicity or cent bin
   Int_t cenbin = 0;
-  if(fFillHighMultHistograms) cenbin = GetEventCentralityBin();
+  if(IsHighMultiplicityAnalysisOn()) cenbin = GetEventCentralityBin();
 
   //
   // In case of pi0/eta trigger, we may want to check their decay correlation,
   // get their decay children
   //
-  TLorentzVector decayMom1;
-  TLorentzVector decayMom2;
+
   Bool_t decayFound = kFALSE;
   if( fPi0Trigger )
   {
-    decayFound = GetDecayPhotonMomentum(aodParticle,decayMom1, decayMom2);
+    decayFound = GetDecayPhotonMomentum(aodParticle->GetCaloLabel(0),aodParticle->GetCaloLabel(1),aodParticle->GetDetectorTag());
     if(decayFound)
     {
-      fhPtPi0DecayRatio->Fill(ptTrig, decayMom1.Pt()/ptTrig);
-      fhPtPi0DecayRatio->Fill(ptTrig, decayMom2.Pt()/ptTrig);
+      fhPtPi0DecayRatio->Fill(ptTrig, fDecayMom1.Pt()/ptTrig);
+      fhPtPi0DecayRatio->Fill(ptTrig, fDecayMom2.Pt()/ptTrig);
     }
   }
   
@@ -3449,11 +3503,10 @@ void  AliAnaParticleHadronCorrelation::MakeChargedCorrelation(AliAODPWG4Particle
   {
     AliVTrack * track = (AliVTrack *) (GetCTSTracks()->At(ipr)) ;
     
-    Double_t mom[3] = {track->Px(),track->Py(),track->Pz()};
-    p3.SetXYZ(mom[0],mom[1],mom[2]);
-    pt   = p3.Pt();
-    eta  = p3.Eta();
-    phi  = p3.Phi() ;
+    fTrackVector.SetXYZ(track->Px(),track->Py(),track->Pz());
+    pt   = fTrackVector.Pt();
+    eta  = fTrackVector.Eta();
+    phi  = fTrackVector.Phi() ;
     if(phi < 0) phi+=TMath::TwoPi();
     
     //Select only hadrons in pt range
@@ -3476,8 +3529,7 @@ void  AliAnaParticleHadronCorrelation::MakeChargedCorrelation(AliAODPWG4Particle
         continue;
     }    
     
-     if(GetDebug() > 2 )
-      printf("AliAnaParticleHadronCorrelation::MakeChargedCorrelation() - Selected charge for momentum imbalance: pt %2.2f, phi %2.2f, eta %2.2f \n",pt,phi,eta);
+     AliDebug(2,Form("Selected charge for momentum imbalance: pt %2.2f, phi %2.2f, eta %2.2f",pt,phi,eta));
     
     // ------------------------------
     // Track type bin or bits setting
@@ -3568,7 +3620,7 @@ void  AliAnaParticleHadronCorrelation::MakeChargedCorrelation(AliAODPWG4Particle
     
     //
     if(fPi0Trigger && decayFound)
-      FillDecayPhotonCorrelationHistograms(pt, phi, decayMom1,decayMom2, kTRUE) ;
+      FillDecayPhotonCorrelationHistograms(pt, phi, kTRUE) ;
     
     //
     // Add track reference to array
@@ -3601,7 +3653,7 @@ void AliAnaParticleHadronCorrelation::MakeChargedMixCorrelation(AliAODPWG4Partic
 {  
   // Mix current trigger with tracks in another MB event
   
-  if(GetDebug() > 1) printf("AliAnaParticleHadronCorrelationNew::MakeChargedMixCorrelation() - Make trigger particle - charged hadron mixed event correlation \n");
+  AliDebug(1,Form("Make trigger particle - charged hadron mixed event correlation"));
   
   if(GetMixedEvent()) return;  // This is not the mixed event from general mixing frame
   
@@ -3644,16 +3696,15 @@ void AliAnaParticleHadronCorrelation::MakeChargedMixCorrelation(AliAODPWG4Partic
   if(!pool) return ;
     
   if( neutralMix && !poolCalo )
-    printf("AliAnaParticleHadronCorrelation::MakeChargedMixCorrelation() - Careful, cluster pool not available\n");
+    AliWarning("Careful, cluster pool not available");
   
   Double_t ptTrig  = aodParticle->Pt();
   Double_t etaTrig = aodParticle->Eta();
   Double_t phiTrig = aodParticle->Phi();
   if(phiTrig < 0.) phiTrig+=TMath::TwoPi();
   
-  if(GetDebug() > 1) 
-    printf("AliAnaParticleHadronCorrelationNew::MakeChargedMixCorrelation() - Pool bin %d size %d, trigger trigger pt=%f, phi=%f, eta=%f\n",
-           eventBin,pool->GetSize(), ptTrig,phiTrig,etaTrig);
+  AliDebug(1,Form("Pool bin %d size %d, trigger trigger pt=%f, phi=%f, eta=%f",
+                  eventBin,pool->GetSize(), ptTrig,phiTrig,etaTrig));
   
   Double_t ptAssoc  = -999.;
   Double_t phiAssoc = -999.;
@@ -3678,12 +3729,11 @@ void AliAnaParticleHadronCorrelation::MakeChargedMixCorrelation(AliAODPWG4Partic
     if( neutralMix && poolCalo )
     {
       if(pool->GetSize()!=poolCalo->GetSize()) 
-        printf("AliAnaParticleHadronCorrelationNew::MakeChargedMixCorrelation() - Different size of calo and track pools\n");
+        AliWarning("Different size of calo and track pools");
       
       bgCalo = static_cast<TObjArray*>(poolCalo->At(ev));
       
-      if(!bgCalo) 
-        printf("AliAnaParticleHadronCorrelationNew::MakeChargedMixCorrelation() - Event %d in calo pool not available?\n",ev);
+      if(!bgCalo) AliDebug(1,Form("Event %d in calo pool not available?",ev));
     }
     
     //
@@ -3747,12 +3797,11 @@ void AliAnaParticleHadronCorrelation::MakeChargedMixCorrelation(AliAODPWG4Partic
       }
       
       if( !neutralMix && fCheckLeadingWithNeutralClusters )
-        printf("AliAnaParticleHadronCorrelation::MakeChargedMixCorrelation() - Leading of clusters requested but no clusters in mixed event\n");
+        AliWarning("Leading of clusters requested but no clusters in mixed event");
       
       if(neutralMix && fCheckLeadingWithNeutralClusters && bgCalo)
       {
         Int_t nClusters=bgCalo->GetEntriesFast();
-        TLorentzVector mom ;
         for(Int_t jlead = 0;jlead <nClusters; jlead++ )
         {
           AliAODPWG4Particle *cluster= (AliAODPWG4Particle*) bgCalo->At(jlead) ;
@@ -3821,8 +3870,7 @@ void AliAnaParticleHadronCorrelation::MakeChargedMixCorrelation(AliAODPWG4Partic
       if(deltaPhi > 3*TMath::PiOver2()) deltaPhi-=TMath::TwoPi();
       deltaEta = etaTrig-etaAssoc;
       
-      if(GetDebug()>0)
-        printf("AliAnaParticleHadronCorrelationNew::MakeChargedMixCorrelation(): deltaPhi= %f, deltaEta=%f\n",deltaPhi, deltaEta);
+      AliDebug(1,Form("deltaPhi= %f, deltaEta=%f",deltaPhi, deltaEta));
       
       // Angular correlation
       fhMixDeltaPhiCharged        ->Fill(ptTrig,   deltaPhi);
@@ -3836,8 +3884,8 @@ void AliAnaParticleHadronCorrelation::MakeChargedMixCorrelation(AliAODPWG4Partic
         xE = -ptAssoc/ptTrig*TMath::Cos(deltaPhi); // -(px*pxTrig+py*pyTrig)/(ptTrig*ptTrig);
         
         if(xE < 0.)
-          printf("MakeChargedMixCorrelation(): Careful!!, negative xE %2.2f for right UE cos(dPhi %2.2f) = %2.2f, check correlation dPhi limits %f to %f\n",
-                 xE,deltaPhi*TMath::RadToDeg(),TMath::Cos(deltaPhi),fDeltaPhiMinCut*TMath::RadToDeg(),fDeltaPhiMaxCut*TMath::RadToDeg());
+          AliWarning(Form("Careful!!, negative xE %2.2f for right UE cos(dPhi %2.2f) = %2.2f, check correlation dPhi limits %f to %f",
+                          xE,deltaPhi*TMath::RadToDeg(),TMath::Cos(deltaPhi),fDeltaPhiMinCut*TMath::RadToDeg(),fDeltaPhiMaxCut*TMath::RadToDeg()));
         
         fhMixXECharged->Fill(ptTrig,xE);
         if(xE > 0 ) fhMixHbpXECharged->Fill(ptTrig, TMath::Log(1./xE));
@@ -3853,8 +3901,8 @@ void AliAnaParticleHadronCorrelation::MakeChargedMixCorrelation(AliAODPWG4Partic
         Double_t uexE = -(ptAssoc/ptTrig)*TMath::Cos(randomphi);
         
         if(uexE < 0.)
-          printf("MakeChargedMixCorrelation(): Careful!!, negative xE %2.2f for left UE cos(dPhi %2.2f) = %2.2f, check correlation dPhi limits %f to %f\n",
-                 uexE,randomphi*TMath::RadToDeg(),TMath::Cos(randomphi),fDeltaPhiMinCut*TMath::RadToDeg(),fDeltaPhiMaxCut*TMath::RadToDeg());
+          AliWarning(Form("Careful!!, negative xE %2.2f for left UE cos(dPhi %2.2f) = %2.2f, check correlation dPhi limits %f to %f",
+                          uexE,randomphi*TMath::RadToDeg(),TMath::Cos(randomphi),fDeltaPhiMinCut*TMath::RadToDeg(),fDeltaPhiMaxCut*TMath::RadToDeg()));
         
         fhMixXEUeCharged->Fill(ptTrig,uexE);
       }
@@ -3909,8 +3957,7 @@ void AliAnaParticleHadronCorrelation::MakeNeutralCorrelation(AliAODPWG4ParticleC
   Int_t npi0 = pi0list->GetEntriesFast();
   if(npi0 == 0) return ;
   
-  if(GetDebug() > 1)
-    printf("AliAnaParticleHadronCorrelation::MakeNeutralCorrelation() - Particle - pi0 correlation, %d pi0's\n",npi0);
+  AliDebug(1,Form("Particle - pi0 correlation, %d pi0's",npi0));
   
   Int_t evtIndex11 = 0 ; 
   Int_t evtIndex12 = 0 ; 
@@ -3933,15 +3980,12 @@ void AliAnaParticleHadronCorrelation::MakeNeutralCorrelation(AliAODPWG4ParticleC
   Float_t etaTrig = aodParticle->Eta();
   Float_t deltaPhi= -100. ;
   Float_t deltaEta= -100. ;
-
-  TLorentzVector photonMom ;
        
   // In case of pi0/eta trigger, we may want to check their decay correlation, 
   // get their decay children
-  TLorentzVector decayMom1;
-  TLorentzVector decayMom2;
+
   Bool_t decayFound = kFALSE;
-  if(fPi0Trigger) decayFound = GetDecayPhotonMomentum(aodParticle,decayMom1, decayMom2);
+  if(fPi0Trigger) decayFound = GetDecayPhotonMomentum(aodParticle->GetCaloLabel(0),aodParticle->GetCaloLabel(1),aodParticle->GetDetectorTag());
   
   TObjArray * refpi0 = 0x0;
   Int_t nrefs        = 0;
@@ -4008,8 +4052,8 @@ void AliAnaParticleHadronCorrelation::MakeNeutralCorrelation(AliAODPWG4ParticleC
       xE  =-pt/ptTrig*TMath::Cos(deltaPhi); // -(px*pxTrig+py*pyTrig)/(ptTrig*ptTrig);
 
       if(xE < 0.)
-        printf("MakeNeutralCorrelation(): Careful!!, negative xE %2.2f for right UE cos(dPhi %2.2f) = %2.2f, check correlation dPhi limits %f to %f\n",
-               xE,deltaPhi*TMath::RadToDeg(),TMath::Cos(deltaPhi),fDeltaPhiMinCut*TMath::RadToDeg(),fDeltaPhiMaxCut*TMath::RadToDeg());
+        AliWarning(Form("Careful!!, negative xE %2.2f for right UE cos(dPhi %2.2f) = %2.2f, check correlation dPhi limits %f to %f",
+                        xE,deltaPhi*TMath::RadToDeg(),TMath::Cos(deltaPhi),fDeltaPhiMinCut*TMath::RadToDeg(),fDeltaPhiMaxCut*TMath::RadToDeg()));
       
       if(xE > 0 ) hbpXE = TMath::Log(1./xE);
       
@@ -4042,7 +4086,7 @@ void AliAnaParticleHadronCorrelation::MakeNeutralCorrelation(AliAODPWG4ParticleC
     // Decay photon correlations
     //
     if(fPi0Trigger && decayFound)
-      FillDecayPhotonCorrelationHistograms(pt, phi, decayMom1,decayMom2,kFALSE) ;
+      FillDecayPhotonCorrelationHistograms(pt, phi, kFALSE) ;
     
     if(fFillAODWithReferences)
     {
@@ -4054,10 +4098,9 @@ void AliAnaParticleHadronCorrelation::MakeNeutralCorrelation(AliAODPWG4ParticleC
         refpi0->SetOwner(kFALSE);
       }
       refpi0->Add(pi0);
-    }//put references in trigger AOD 
+    } // put references in trigger AOD
     
-    if(GetDebug() > 2 ) 
-      printf("AliAnaParticleHadronCorrelation::MakeNeutralCorrelation() - Selected pi0: pt %2.2f, phi %2.2f, eta %2.2f \n",pt,phi,eta);
+    AliDebug(1,Form("Selected pi0: pt %2.2f, phi %2.2f, eta %2.2f",pt,phi,eta));
     
   }//loop
   
@@ -4073,12 +4116,11 @@ void  AliAnaParticleHadronCorrelation::MakeMCChargedCorrelation(Int_t label, Int
 {
   // Charged Hadron Correlation Analysis with MC information
   
-  if ( GetDebug() > 1 )
-    AliInfo("Make trigger particle - charged hadron correlation in AOD MC level");
+  AliDebug(1,"Make trigger particle - charged hadron correlation in AOD MC level");
   
   if( label < 0 )
   {
-    if( GetDebug() > 0 ) AliInfo(Form(" *** bad label ***:  label %d", label));
+    AliDebug(1,Form(" *** bad label ***:  label %d", label));
     return;
   }
 
@@ -4137,7 +4179,6 @@ void  AliAnaParticleHadronCorrelation::MakeMCChargedCorrelation(Int_t label, Int
     for (iParticle = 0 ; iParticle <  nTracks ; iParticle++)
     {
       TParticle * particle = stack->Particle(iParticle);
-      TLorentzVector momentum;
       
       //keep only final state particles
       if( particle->GetStatusCode() != 1 ) continue ;
@@ -4147,11 +4188,11 @@ void  AliAnaParticleHadronCorrelation::MakeMCChargedCorrelation(Int_t label, Int
       Int_t charge = (Int_t) TDatabasePDG::Instance()->GetParticle(pdg)->Charge();
       if(charge == 0) continue;
       
-      particle->Momentum(momentum);
+      particle->Momentum(fMomentum);
       
       //Particles in CTS acceptance, make sure to use the same selection as in the reader
-      Bool_t inCTS =  GetReader()->GetFiducialCut()->IsInFiducialCut(momentum,"CTS");
-      //printf("Accepted? %d; pt %2.2f, eta %2.2f, phi %2.2f\n",inCTS,momentum.Pt(),momentum.Eta(),momentum.Phi()*TMath::RadToDeg());
+      Bool_t inCTS =  GetReader()->GetFiducialCut()->IsInFiducialCut(fMomentum.Eta(),fMomentum.Phi(),kCTS);
+      //printf("Accepted? %d; pt %2.2f, eta %2.2f, phi %2.2f\n",inCTS,fMomentum.Pt(),fMomentum.Eta(),fMomentum.Phi()*TMath::RadToDeg());
       if( !inCTS ) continue;
       
       // Remove conversions
@@ -4209,11 +4250,11 @@ void  AliAnaParticleHadronCorrelation::MakeMCChargedCorrelation(Int_t label, Int
       
       if ( part->Charge() == 0 ) continue;
       
-      TLorentzVector momentum(part->Px(),part->Py(),part->Pz(),part->E());
+      fMomentum.SetPxPyPzE(part->Px(),part->Py(),part->Pz(),part->E());
       
       //Particles in CTS acceptance, make sure to use the same selection as in the reader
-      Bool_t inCTS =  GetReader()->GetFiducialCut()->IsInFiducialCut(momentum,"CTS");
-      //printf("Accepted? %d; pt %2.2f, eta %2.2f, phi %2.2f\n",inCTS,momentum.Pt(),momentum.Eta(),momentum.Phi()*TMath::RadToDeg());
+      Bool_t inCTS =  GetReader()->GetFiducialCut()->IsInFiducialCut(fMomentum.Eta(),fMomentum.Phi(),kCTS);
+      //printf("Accepted? %d; pt %2.2f, eta %2.2f, phi %2.2f\n",inCTS,fMomentum.Pt(),fMomentum.Eta(),fMomentum.Phi()*TMath::RadToDeg());
       if( !inCTS ) continue;
       
       // Remove conversions
@@ -4244,28 +4285,51 @@ void  AliAnaParticleHadronCorrelation::MakeMCChargedCorrelation(Int_t label, Int
   fhMCPhiTrigger[histoIndex]->Fill(ptprim,phiprim);
   fhMCEtaTrigger[histoIndex]->Fill(ptprim,etaprim);
   
-  if(histoIndex==2 && lostDecayPair && 7 >= fMCGenTypeMin && 7 <= fMCGenTypeMax )
+  if(lostDecayPair)
   {
-    fhMCPtTrigger [7]->Fill(ptprim);
-    fhMCPhiTrigger[7]->Fill(ptprim,phiprim);
-    fhMCEtaTrigger[7]->Fill(ptprim,etaprim);
+    // check index in GetMCTagIndexHistogram
+    if     (histoIndex == 2 && 8 >= fMCGenTypeMin && 8 <= fMCGenTypeMax )
+    {
+      // pi0 decay
+      fhMCPtTrigger [8]->Fill(ptprim);
+      fhMCPhiTrigger[8]->Fill(ptprim,phiprim);
+      fhMCEtaTrigger[8]->Fill(ptprim,etaprim);
+    }
+    else if(histoIndex == 4 && 9 >= fMCGenTypeMin && 9 <= fMCGenTypeMax )
+    {
+      // eta decay
+      fhMCPtTrigger [9]->Fill(ptprim);
+      fhMCPhiTrigger[9]->Fill(ptprim,phiprim);
+      fhMCEtaTrigger[9]->Fill(ptprim,etaprim);
+    }
   }
   
   if(!leadTrig && (fMakeAbsoluteLeading || fMakeNearSideLeading) )
   {
-    if(GetDebug() > 1)
-      printf("AliAnaParticleHadronCorrelation::MakeMCChargedCorrelation(): Not leading primary trigger: pT %2.2f, phi %2.2f, eta %2.2f\n",
-             ptprim,phiprim*TMath::RadToDeg(),etaprim);
+    AliDebug(1,Form("Not leading primary trigger: pT %2.2f, phi %2.2f, eta %2.2f",
+                    ptprim,phiprim*TMath::RadToDeg(),etaprim));
     
     fhMCPtTriggerNotLeading [histoIndex]->Fill(ptprim);
     fhMCPhiTriggerNotLeading[histoIndex]->Fill(ptprim,phiprim);
     fhMCEtaTriggerNotLeading[histoIndex]->Fill(ptprim,etaprim);
     
-    if(histoIndex==2 && lostDecayPair && 7 >= fMCGenTypeMin && 7 <= fMCGenTypeMax )
+    if(lostDecayPair)
     {
-      fhMCPtTriggerNotLeading [7]->Fill(ptprim);
-      fhMCPhiTriggerNotLeading[7]->Fill(ptprim,phiprim);
-      fhMCEtaTriggerNotLeading[7]->Fill(ptprim,etaprim);
+      // check index in GetMCTagIndexHistogram
+      if      (histoIndex == 2  && 8 >= fMCGenTypeMin && 8 <= fMCGenTypeMax )
+      {
+        // pi0 decay
+        fhMCPtTriggerNotLeading [8]->Fill(ptprim);
+        fhMCPhiTriggerNotLeading[8]->Fill(ptprim,phiprim);
+        fhMCEtaTriggerNotLeading[8]->Fill(ptprim,etaprim);
+      }
+      else  if(histoIndex == 4  && 9 >= fMCGenTypeMin && 9 <= fMCGenTypeMax )
+      {
+        // eta decay
+        fhMCPtTriggerNotLeading [9]->Fill(ptprim);
+        fhMCPhiTriggerNotLeading[9]->Fill(ptprim,phiprim);
+        fhMCEtaTriggerNotLeading[9]->Fill(ptprim,etaprim);
+      }
     }
   }
 }
@@ -4312,7 +4376,7 @@ void AliAnaParticleHadronCorrelation::SetNAssocPtBins(Int_t n)
   }
   else 
   {
-    printf("n = larger than 19 or too small, set to 19 \n");
+    AliWarning("n = larger than 19 or too small, set to 19");
     fNAssocPtBins = 19;
   }
 }
@@ -4328,7 +4392,7 @@ void AliAnaParticleHadronCorrelation::SetAssocPtBinLimit(Int_t ibin, Float_t pt)
   }
   else 
   {
-    printf("AliAnaParticleHadronCorrelation::SetAssocPtBinLimit() - bin  number too large %d > %d or small, nothing done\n", ibin, fNAssocPtBins) ; 
+    AliWarning(Form("Bin  number too large %d > %d or small, nothing done", ibin, fNAssocPtBins)) ;
   }
 }