]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PWGGA/CaloTrackCorrelations/AliAnaPi0EbE.cxx
fix compilation warning
[u/mrichter/AliRoot.git] / PWGGA / CaloTrackCorrelations / AliAnaPi0EbE.cxx
index 08c49833ac4c17a2eabd7316bfab40b3f643a14f..1828d95d3ed72318652f9347ec4262a7cc2de8b3 100755 (executable)
@@ -50,7 +50,8 @@ ClassImp(AliAnaPi0EbE)
 AliAnaPi0EbE::AliAnaPi0EbE() : 
     AliAnaCaloTrackCorrBaseClass(),fAnaType(kIMCalo),            fCalorimeter(""),
     fMinDist(0.),fMinDist2(0.),    fMinDist3(0.),      
-    fTimeCutMin(-10000),           fTimeCutMax(10000),      
+    fNLMCutMin(-1),                fNLMCutMax(10), 
+    fTimeCutMin(-10000),           fTimeCutMax(10000),
     fFillPileUpHistograms(0),
     fFillWeightHistograms(kFALSE), fFillTMHisto(0),              
     fFillSelectClHisto(0),         fFillOnlySimpleSSHisto(1),
@@ -58,6 +59,11 @@ AliAnaPi0EbE::AliAnaPi0EbE() :
     // Histograms
     fhPt(0),                       fhE(0),                    
     fhEEta(0),                     fhEPhi(0),                    fhEtaPhi(0),
+    fhPtCentrality(),              fhPtEventPlane(0),
+    fhPtReject(0),                 fhEReject(0),
+    fhEEtaReject(0),               fhEPhiReject(0),              fhEtaPhiReject(0),
+    fhMass(0),                     fhAsymmetry(0), 
+    fhSelectedMass(0),             fhSelectedAsymmetry(0),
     fhPtDecay(0),                  fhEDecay(0),  
     // Shower shape histos
     fhEDispersion(0),              fhELambda0(0),                fhELambda1(0), 
@@ -66,10 +72,13 @@ AliAnaPi0EbE::AliAnaPi0EbE() :
     fhENCells(0),                  fhETime(0),                   fhEPairDiffTime(0),
     fhDispEtaE(0),                 fhDispPhiE(0),
     fhSumEtaE(0),                  fhSumPhiE(0),                 fhSumEtaPhiE(0),
-    fhDispEtaPhiDiffE(0),          fhSphericityE(0),             fhAsymmetryE(0), 
+    fhDispEtaPhiDiffE(0),          fhSphericityE(0),           
 
     // MC histos
-    fhMCPt(),                      fhMCPhi(),                    fhMCEta(),
+    fhMCE(),                       fhMCPt(),        
+    fhMCPhi(),                     fhMCEta(),
+    fhMCEReject(),                 fhMCPtReject(),
+    fhMCPtCentrality(),            
     fhMCPi0PtGenRecoFraction(0),   fhMCEtaPtGenRecoFraction(0),
     fhMCPi0DecayPt(0),             fhMCPi0DecayPtFraction(0),      
     fhMCEtaDecayPt(0),             fhMCEtaDecayPtFraction(0),
@@ -94,9 +103,12 @@ AliAnaPi0EbE::AliAnaPi0EbE() :
   
   for(Int_t i = 0; i < 6; i++)
   {
+    fhMCE              [i] = 0;
     fhMCPt             [i] = 0;
     fhMCPhi            [i] = 0;                   
     fhMCEta            [i] = 0;
+    fhMCPtCentrality   [i] = 0;
+    
     fhEMCLambda0       [i] = 0;
     fhEMCLambda0NoTRD  [i] = 0;
     fhEMCLambda0FracMaxCellCut[i]= 0;
@@ -130,7 +142,9 @@ AliAnaPi0EbE::AliAnaPi0EbE() :
     fhAsymmetryLambda0  [j] = 0;    
     fhAsymmetryDispEta  [j] = 0; 
     fhAsymmetryDispPhi  [j] = 0;
-  }  
+    
+    fhPtPi0PileUp       [j] = 0;
+  }
   
   for(Int_t i = 0; i < 3; i++)
   {
@@ -157,8 +171,8 @@ AliAnaPi0EbE::AliAnaPi0EbE() :
   
 }
 
-//___________________________________________________________________
-void AliAnaPi0EbE::FillPileUpHistograms(Float_t energy, Float_t time) 
+//_______________________________________________________________________________
+void AliAnaPi0EbE::FillPileUpHistograms(const Float_t energy, const Float_t time) 
 {
   // Fill some histograms to understand pile-up
   if(!fFillPileUpHistograms) return;
@@ -230,6 +244,33 @@ void AliAnaPi0EbE::FillPileUpHistograms(Float_t energy, Float_t time)
   }// loop
 }
 
+
+//___________________________________________________________________________________________
+void AliAnaPi0EbE::FillRejectedClusterHistograms(const TLorentzVector mom, const Int_t mctag)
+{
+ // Fill histograms that do not pass the identification (SS case only)
+  
+  Float_t ener  = mom.E();
+  Float_t pt    = mom.Pt();
+  Float_t phi   = mom.Phi();
+  if(phi < 0) phi+=TMath::TwoPi();
+  Float_t eta = mom.Eta();
+  
+  fhPtReject     ->Fill(pt);
+  fhEReject      ->Fill(ener);
+  
+  fhEEtaReject   ->Fill(ener,eta);
+  fhEPhiReject   ->Fill(ener,phi);
+  fhEtaPhiReject ->Fill(eta,phi);
+  
+  if(IsDataMC())
+  {
+    Int_t mcIndex = GetMCIndex(mctag);
+    fhMCEReject  [mcIndex] ->Fill(ener);
+    fhMCPtReject [mcIndex] ->Fill(pt);
+  }    
+}
+
 //_____________________________________________________________________________________
 void AliAnaPi0EbE::FillSelectedClusterHistograms(AliVCluster* cluster, 
                                                  const Int_t nMaxima,
@@ -298,7 +339,6 @@ void AliAnaPi0EbE::FillSelectedClusterHistograms(AliVCluster* cluster,
     if (fAnaType==kSSCalo)
     {
       // Asymmetry histograms
-      fhAsymmetryE            ->Fill(e  ,asy);
       fhAsymmetryLambda0[ebin]->Fill(l0 ,asy);
       fhAsymmetryDispEta[ebin]->Fill(dEta,asy);
       fhAsymmetryDispPhi[ebin]->Fill(dPhi,asy);
@@ -424,7 +464,6 @@ void AliAnaPi0EbE::FillSelectedClusterHistograms(AliVCluster* cluster,
 
       if (fAnaType==kSSCalo)
       {
-        fhMCEAsymmetry            [mcIndex]->Fill(e  ,asy);
         fhMCAsymmetryLambda0[ebin][mcIndex]->Fill(l0 ,asy);
         fhMCAsymmetryDispEta[ebin][mcIndex]->Fill(dEta,asy);
         fhMCAsymmetryDispPhi[ebin][mcIndex]->Fill(dPhi,asy);
@@ -622,6 +661,59 @@ TList *  AliAnaPi0EbE::GetCreateOutputObjects()
   fhEtaPhi->SetXTitle("#eta");
   outputContainer->Add(fhEtaPhi) ; 
   
+  fhPtCentrality  = new TH2F("hPtCentrality","centrality vs p_{T}",nptbins,ptmin,ptmax, 100,0,100);
+  fhPtCentrality->SetYTitle("centrality");
+  fhPtCentrality->SetXTitle("p_{T}(GeV/c)");
+  outputContainer->Add(fhPtCentrality) ;
+  
+  fhPtEventPlane  = new TH2F("hPtEventPlane","event plane angle vs p_{T}",nptbins,ptmin,ptmax, 100,0,TMath::Pi());
+  fhPtEventPlane->SetYTitle("Event plane angle (rad)");
+  fhPtEventPlane->SetXTitle("p_{T} (GeV/c)");
+  outputContainer->Add(fhPtEventPlane) ;
+  
+  if(fAnaType == kSSCalo)
+  {
+    fhPtReject  = new TH1F("hPtReject","Number of rejected as #pi^{0} (#eta) decay",nptbins,ptmin,ptmax); 
+    fhPtReject->SetYTitle("N");
+    fhPtReject->SetXTitle("p_{T} (GeV/c)");
+    outputContainer->Add(fhPtReject) ; 
+    
+    fhEReject  = new TH1F("hEReject","Number of rejected as  #pi^{0} (#eta) decay pairs",nptbins,ptmin,ptmax); 
+    fhEReject->SetYTitle("N");
+    fhEReject->SetXTitle("E (GeV)");
+    outputContainer->Add(fhEReject) ; 
+    
+    fhEPhiReject  = new TH2F
+    ("hEPhiReject","Rejected #pi^{0} (#eta) cluster: E vs #phi",nptbins,ptmin,ptmax, nphibins,phimin,phimax); 
+    fhEPhiReject->SetYTitle("#phi (rad)");
+    fhEPhiReject->SetXTitle("E (GeV)");
+    outputContainer->Add(fhEPhiReject) ; 
+    
+    fhEEtaReject  = new TH2F
+    ("hEEtaReject","Rejected #pi^{0} (#eta) cluster: E vs #eta",nptbins,ptmin,ptmax,netabins,etamin,etamax); 
+    fhEEtaReject->SetYTitle("#eta");
+    fhEEtaReject->SetXTitle("E (GeV)");
+    outputContainer->Add(fhEEtaReject) ; 
+    
+    fhEtaPhiReject  = new TH2F
+    ("hEtaPhiReject","Rejected #pi^{0} (#eta) cluster: #eta vs #phi",netabins,etamin,etamax, nphibins,phimin,phimax); 
+    fhEtaPhiReject->SetYTitle("#phi (rad)");
+    fhEtaPhiReject->SetXTitle("#eta");
+    outputContainer->Add(fhEtaPhiReject) ; 
+  }
+  
+  fhMass  = new TH2F
+  ("hMass","all pairs mass: E vs mass",nptbins,ptmin,ptmax, nmassbins,massmin,massmax); 
+  fhMass->SetYTitle("mass (GeV/c^{2})");
+  fhMass->SetXTitle("E (GeV)");
+  outputContainer->Add(fhMass) ; 
+  
+  fhSelectedMass  = new TH2F
+  ("hSelectedMass","Selected #pi^{0} (#eta) pairs mass: E vs mass",nptbins,ptmin,ptmax, nmassbins,massmin,massmax); 
+  fhSelectedMass->SetYTitle("mass (GeV/c^{2})");
+  fhSelectedMass->SetXTitle("E (GeV)");
+  outputContainer->Add(fhSelectedMass) ; 
+  
   if(fAnaType != kSSCalo)
   {
     fhPtDecay  = new TH1F("hPtDecay","Number of identified  #pi^{0} (#eta) decay photons",nptbins,ptmin,ptmax); 
@@ -1051,6 +1143,15 @@ TList *  AliAnaPi0EbE::GetCreateOutputObjects()
       for(Int_t i = 0; i < 6; i++)
       { 
         
+        fhMCE[i]  = new TH1F
+        (Form("hE_MC%s",pname[i].Data()),
+         Form("Identified as #pi^{0} (#eta), cluster from %s",
+              ptype[i].Data()),
+         nptbins,ptmin,ptmax); 
+        fhMCE[i]->SetYTitle("N");
+        fhMCE[i]->SetXTitle("E (GeV)");
+        outputContainer->Add(fhMCE[i]) ; 
+        
         fhMCPt[i]  = new TH1F
         (Form("hPt_MC%s",pname[i].Data()),
          Form("Identified as #pi^{0} (#eta), cluster from %s",
@@ -1060,6 +1161,36 @@ TList *  AliAnaPi0EbE::GetCreateOutputObjects()
         fhMCPt[i]->SetXTitle("p_{T} (GeV/c)");
         outputContainer->Add(fhMCPt[i]) ; 
         
+        fhMCPtCentrality[i]  = new TH2F
+        (Form("hPtCentrality_MC%s",pname[i].Data()),
+         Form("Identified as #pi^{0} (#eta), cluster from %s",
+              ptype[i].Data()),
+         nptbins,ptmin,ptmax, 100,0,100);
+        fhMCPtCentrality[i]->SetYTitle("centrality");
+        fhMCPtCentrality[i]->SetXTitle("p_{T} (GeV/c)");
+        outputContainer->Add(fhMCPtCentrality[i]) ;
+        
+        if(fAnaType == kSSCalo)
+        {
+          fhMCEReject[i]  = new TH1F
+          (Form("hEReject_MC%s",pname[i].Data()),
+           Form("Rejected as #pi^{0} (#eta), cluster from %s",
+                ptype[i].Data()),
+           nptbins,ptmin,ptmax); 
+          fhMCEReject[i]->SetYTitle("N");
+          fhMCEReject[i]->SetXTitle("E (GeV)");
+          outputContainer->Add(fhMCEReject[i]) ; 
+          
+          fhMCPtReject[i]  = new TH1F
+          (Form("hPtReject_MC%s",pname[i].Data()),
+           Form("Rejected as #pi^{0} (#eta), cluster from %s",
+                ptype[i].Data()),
+           nptbins,ptmin,ptmax); 
+          fhMCPtReject[i]->SetYTitle("N");
+          fhMCPtReject[i]->SetXTitle("p_{T} (GeV/c)");
+          outputContainer->Add(fhMCPtReject[i]) ;           
+        }
+        
         fhMCPhi[i]  = new TH2F
         (Form("hPhi_MC%s",pname[i].Data()),
          Form("Identified as #pi^{0} (#eta), cluster from %s",ptype[i].Data()),
@@ -1193,15 +1324,37 @@ TList *  AliAnaPi0EbE::GetCreateOutputObjects()
     } //Not MC reader
   }//Histos with MC
   
+  if(fAnaType==kSSCalo)
+  {
+    fhAsymmetry  = new TH2F ("hAsymmetry","A = ( E1 - E2 ) / ( E1 + E2 ) vs E",  
+                              nptbins,ptmin,ptmax, 200, -1,1); 
+    fhAsymmetry->SetXTitle("E (GeV)");
+    fhAsymmetry->SetYTitle("A = ( E1 - E2 ) / ( E1 + E2 )");
+    outputContainer->Add(fhAsymmetry);
+    
+    fhSelectedAsymmetry  = new TH2F ("hSelectedAsymmetry","A = ( E1 - E2 ) / ( E1 + E2 ) vs E",  
+                             nptbins,ptmin,ptmax, 200, -1,1); 
+    fhSelectedAsymmetry->SetXTitle("E (GeV)");
+    fhSelectedAsymmetry->SetYTitle("A = ( E1 - E2 ) / ( E1 + E2 )");
+    outputContainer->Add(fhSelectedAsymmetry);
+    
+    if(IsDataMC())
+    {
+      for(Int_t i = 0; i< 6; i++)
+      {
+        fhMCEAsymmetry[i]  = new TH2F (Form("hEAsymmetry_MC%s",pname[i].Data()),
+                                       Form("cluster from %s : A = ( E1 - E2 ) / ( E1 + E2 ) vs E",ptype[i].Data()),  
+                                       nptbins,ptmin,ptmax, 200,-1,1); 
+        fhMCEAsymmetry[i]->SetXTitle("E (GeV)");
+        fhMCEAsymmetry[i]->SetYTitle("A = ( E1 - E2 ) / ( E1 + E2 )");
+        outputContainer->Add(fhMCEAsymmetry[i]);
+      } 
+    }
+  }
   
   if(fAnaType==kSSCalo && fFillSelectClHisto && !fFillOnlySimpleSSHisto )
   {
     
-    fhAsymmetryE  = new TH2F ("hAsymmetryE","A = ( E1 - E2 ) / ( E1 + E2 ) vs E",  
-                               nptbins,ptmin,ptmax, 200, -1,1); 
-    fhAsymmetryE->SetXTitle("E (GeV)");
-    fhAsymmetryE->SetYTitle("A = ( E1 - E2 ) / ( E1 + E2 )");
-    outputContainer->Add(fhAsymmetryE);
     
     for(Int_t i = 0; i< 3; i++)
     {
@@ -1243,13 +1396,6 @@ TList *  AliAnaPi0EbE::GetCreateOutputObjects()
     {
       for(Int_t i = 0; i< 6; i++)
       {
-        fhMCEAsymmetry[i]  = new TH2F (Form("hEAsymmetry_MC%s",pname[i].Data()),
-                                       Form("cluster from %s : A = ( E1 - E2 ) / ( E1 + E2 ) vs E",ptype[i].Data()),  
-                                       nptbins,ptmin,ptmax, 200,-1,1); 
-        fhMCEAsymmetry[i]->SetXTitle("E (GeV)");
-        fhMCEAsymmetry[i]->SetYTitle("A = ( E1 - E2 ) / ( E1 + E2 )");
-        outputContainer->Add(fhMCEAsymmetry[i]);
-        
         for(Int_t ie = 0; ie < 7; ie++)
         {
           fhMCAsymmetryLambda0[ie][i] = new TH2F (Form("hMCAsymmetryLambda0_EBin%d_MC%s",ie,pname[i].Data()),
@@ -1279,6 +1425,17 @@ TList *  AliAnaPi0EbE::GetCreateOutputObjects()
   
   if(fFillPileUpHistograms)
   {
+    
+    TString pileUpName[] = {"SPD","EMCAL","SPDOrEMCAL","SPDAndEMCAL","SPDAndNotEMCAL","EMCALAndNotSPD","NotSPDAndNotEMCAL"} ;
+
+    for(Int_t i = 0 ; i < 7 ; i++)
+    {
+      fhPtPi0PileUp[i]  = new TH1F(Form("hPtPi0PileUp%s",pileUpName[i].Data()),
+                                      Form("Selected #pi^{0} (#eta) p_{T} distribution, %s Pile-Up event",pileUpName[i].Data()), nptbins,ptmin,ptmax);
+      fhPtPi0PileUp[i]->SetXTitle("p_{T} (GeV/c)");
+      outputContainer->Add(fhPtPi0PileUp[i]);
+    }
+    
     fhTimeENoCut  = new TH2F ("hTimeE_NoCut","time of cluster vs E of clusters, no cut", nptbins,ptmin,ptmax, ntimebins,timemin,timemax); 
     fhTimeENoCut->SetXTitle("E (GeV)");
     fhTimeENoCut->SetYTitle("time (ns)");
@@ -1385,8 +1542,8 @@ void AliAnaPi0EbE::HasPairSameMCMother(AliAODPWG4Particle * photon1,
   
   if(label1 < 0 || label2 < 0 ) return ;
   
-  //Int_t tag1 = GetMCAnalysisUtils()->CheckOrigin(label1, GetReader(), photon1->GetInputFileIndex());
-  //Int_t tag2 = GetMCAnalysisUtils()->CheckOrigin(label2, GetReader(), photon2->GetInputFileIndex());
+  //Int_t tag1 = GetMCAnalysisUtils()->CheckOrigin(label1, GetReader());
+  //Int_t tag2 = GetMCAnalysisUtils()->CheckOrigin(label2, GetReader());
   Int_t tag1 = photon1->GetTag();
   Int_t tag2 = photon2->GetTag();
   
@@ -1418,13 +1575,13 @@ void AliAnaPi0EbE::HasPairSameMCMother(AliAODPWG4Particle * photon1,
     {//&& (input > -1)){
       if(label1>=0)
       {
-        AliAODMCParticle * mother1 = (AliAODMCParticle *) (GetReader()->GetAODMCParticles(photon1->GetInputFileIndex()))->At(label1);//photon in kine tree
+        AliAODMCParticle * mother1 = (AliAODMCParticle *) (GetReader()->GetAODMCParticles())->At(label1);//photon in kine tree
         label1 = mother1->GetMother();
         //mother1 = GetMCStack()->Particle(label1);//pi0
       }
       if(label2>=0)
       {
-        AliAODMCParticle * mother2 = (AliAODMCParticle *) (GetReader()->GetAODMCParticles(photon2->GetInputFileIndex()))->At(label2);//photon in kine tree
+        AliAODMCParticle * mother2 = (AliAODMCParticle *) (GetReader()->GetAODMCParticles())->At(label2);//photon in kine tree
         label2 = mother2->GetMother();
         //mother2 = GetMCStack()->Particle(label2);//pi0
       }
@@ -1624,6 +1781,14 @@ void  AliAnaPi0EbE::MakeInvMassInCalorimeter()
       if(nMaxima1 >  1 && cluster2->GetM02() < 0.3 && cluster2->GetM02()> 0.1 ) fhMassPairLocMax[7]->Fill(epair,mass); 
       if(nMaxima2 >  1 && cluster1->GetM02() < 0.3 && cluster1->GetM02()> 0.1 ) fhMassPairLocMax[7]->Fill(epair,mass); 
       
+      //Skip events with too few or too many  NLM
+      if((nMaxima1 < fNLMCutMin || nMaxima1 > fNLMCutMax) || (nMaxima2 < fNLMCutMin || nMaxima2 > fNLMCutMax)) continue ;
+      
+      if(GetDebug() > 1) printf("AliAnaPi0EbE::MakeInvMassInCalorimeter() - NLM of out of range: cluster1 %d, cluster2 %d \n",nMaxima1, nMaxima2);
+      
+      //Mass of all pairs
+      fhMass->Fill(epair,(mom1+mom2).M());
+      
       //Select good pair (good phi, pt cuts, aperture and invariant mass)
       if(GetNeutralMesonSelection()->SelectPair(mom1, mom2,fCalorimeter))
       {
@@ -1649,6 +1814,9 @@ void  AliAnaPi0EbE::MakeInvMassInCalorimeter()
         
         //Create AOD for analysis
         mom = mom1+mom2;
+                
+        //Mass of selected pairs
+        fhSelectedMass->Fill(epair,mom.M());
         
         // Fill histograms to undertand pile-up before other cuts applied
         // Remember to relax time cuts in the reader
@@ -1720,7 +1888,8 @@ void  AliAnaPi0EbE::MakeInvMassInCalorimeterAndCTS()
   
   Int_t nCTS  = inputAODGammaConv->GetEntriesFast();
   Int_t nCalo = GetInputAODBranch()->GetEntriesFast();
-  if(nCTS<=0 || nCalo <=0) {
+  if(nCTS<=0 || nCalo <=0) 
+  {
     if(GetDebug() > 1) printf("AliAnaPi0EbE::MakeInvMassInCalorimeterAndCTS() - nCalo %d, nCTS %d, cannot loop\n",nCalo,nCTS);
     return;
   }
@@ -1753,15 +1922,21 @@ void  AliAnaPi0EbE::MakeInvMassInCalorimeterAndCTS()
       else if(nMaxima==2) fhMassPairLocMax[1]->Fill(epair,mass);
       else                fhMassPairLocMax[2]->Fill(epair,mass);
       
+      if(nMaxima < fNLMCutMin || nMaxima > fNLMCutMax) continue ;
+      if(GetDebug() > 1) printf("AliAnaPi0EbE::MakeInvMassInCalorimeterAndCTS() - NLM %d of out of range \n",nMaxima);
+
       //Play with the MC stack if available
       if(IsDataMC())
       {
         Int_t  label2 = photon2->GetLabel();
-        if(label2 >= 0 )photon2->SetTag(GetMCAnalysisUtils()->CheckOrigin(label2, GetReader(), photon2->GetInputFileIndex()));
+        if(label2 >= 0 )photon2->SetTag(GetMCAnalysisUtils()->CheckOrigin(label2, GetReader()));
         
         HasPairSameMCMother(photon1, photon2, label, tag) ;
       }
       
+      //Mass of selected pairs
+      fhMass->Fill(epair,(mom1+mom2).M());
+      
       //Select good pair (good phi, pt cuts, aperture and invariant mass)
       if(GetNeutralMesonSelection()->SelectPair(mom1, mom2,fCalorimeter))
       {
@@ -1784,9 +1959,12 @@ void  AliAnaPi0EbE::MakeInvMassInCalorimeterAndCTS()
         
         mom = mom1+mom2;
         
+        //Mass of selected pairs
+        fhSelectedMass->Fill(epair,mom.M());
+        
         // Fill histograms to undertand pile-up before other cuts applied
         // Remember to relax time cuts in the reader
-        FillPileUpHistograms(mom.E(),cluster->GetTOF()*1e9);     
+        if(cluster)FillPileUpHistograms(mom.E(),cluster->GetTOF()*1e9);
         
         AliAODPWG4Particle pi0 = AliAODPWG4Particle(mom);
         
@@ -1853,13 +2031,13 @@ void  AliAnaPi0EbE::MakeShowerShapeIdentification()
     if(TMath::Abs(GetVertex(evtIndex)[2]) > GetZvertexCut()) continue ;  //vertex cut
     
     //Get Momentum vector, 
+    Double_t vertex[]={0,0,0};
     if(GetReader()->GetDataType() != AliCaloTrackReader::kMC)
     {
       calo->GetMomentum(mom,GetVertex(evtIndex)) ;
     }//Assume that come from vertex in straight line
     else
     {
-      Double_t vertex[]={0,0,0};
       calo->GetMomentum(mom,vertex) ;
     }
          
@@ -1873,75 +2051,124 @@ void  AliAnaPi0EbE::MakeShowerShapeIdentification()
       if(! in ) continue ;
     }
     
-    //Create AOD for analysis
-    AliAODPWG4Particle aodpi0 = AliAODPWG4Particle(mom);
-    aodpi0.SetLabel(calo->GetLabel());
-    
-    //Set the indeces of the original caloclusters  
-    aodpi0.SetCaloLabel(calo->GetID(),-1);
-    aodpi0.SetDetector(fCalorimeter);
     if(GetDebug() > 1) 
-      printf("AliAnaPi0EbE::MakeShowerShapeIdentification() - FillAOD: Min pt cut and fiducial cut passed: pt %3.2f, phi %2.2f, eta %1.2f\n",aodpi0.Pt(),aodpi0.Phi(),aodpi0.Eta());   
-    
+      printf("AliAnaPi0EbE::MakeShowerShapeIdentification() - FillAOD: Min pt cut and fiducial cut passed: pt %3.2f, phi %2.2f, eta %1.2f\n",mom.Pt(),mom.Phi(),mom.Eta());    
+        
     //Check Distance to Bad channel, set bit.
     Double_t distBad=calo->GetDistanceToBadChannel() ; //Distance to bad channel
     if(distBad < 0.) distBad=9999. ; //workout strange convension dist = -1. ;
     if(distBad < fMinDist) //In bad channel (PHOS cristal size 2.2x2.2 cm)
       continue ;
-    
+
+    if(GetDebug() > 1) printf("AliAnaPi0EbE::MakeShowerShapeIdentification() - FillAOD: Bad channel cut passed %4.2f\n",distBad);
+
     //.......................................
     // TOF cut, BE CAREFUL WITH THIS CUT
     Double_t tof = calo->GetTOF()*1e9;
     if(tof < fTimeCutMin || tof > fTimeCutMax) continue ;
     
+    //Play with the MC stack if available
+    //Check origin of the candidates
+    Int_t tag  = 0 ;
+    if(IsDataMC())
+    {
+      tag = GetMCAnalysisUtils()->CheckOrigin(calo->GetLabels(),calo->GetNLabels(),GetReader());
+      //GetMCAnalysisUtils()->CheckMultipleOrigin(calo->GetLabels(),calo->GetNLabels(), GetReader(), aodpi0.GetInputFileIndex(), tag);
+      if(GetDebug() > 0) printf("AliAnaPi0EbE::MakeShowerShapeIdentification() - Origin of candidate %d\n",tag);
+    }      
     
-    if(GetDebug() > 1) printf("AliAnaPi0EbE::MakeShowerShapeIdentification() - FillAOD: Bad channel cut passed %4.2f\n",distBad);
-    
-    if     (distBad > fMinDist3) aodpi0.SetDistToBad(2) ;
-    else if(distBad > fMinDist2) aodpi0.SetDistToBad(1) ; 
-    else                         aodpi0.SetDistToBad(0) ;
+    //Skip matched clusters with tracks
+    if(IsTrackMatched(calo, GetReader()->GetInputEvent())) 
+    {
+      FillRejectedClusterHistograms(mom,tag);
+      continue ;
+    }
+        
     
     //Check PID
     //PID selection or bit setting
     Int_t    nMaxima = 0 ; 
     Double_t mass    = 0 , angle = 0;
     Double_t e1      = 0 , e2    = 0;
-    //Skip matched clusters with tracks
-    if(IsTrackMatched(calo, GetReader()->GetInputEvent())) continue ;
-      
-    // Check if cluster is pi0 via cluster splitting
-    aodpi0.SetIdentifiedParticleType(GetCaloPID()->GetIdentifiedParticleTypeFromClusterSplitting(calo,cells,GetCaloUtils(),
-                                                                                                 GetVertex(evtIndex),nMaxima,
-                                                                                                 mass,angle,e1,e2)); 
+    Int_t idPartType = GetCaloPID()->GetIdentifiedParticleTypeFromClusterSplitting(calo,cells,GetCaloUtils(),
+                                                                                   GetVertex(evtIndex),nMaxima,
+                                                                                   mass,angle,e1,e2) ;   
+    
+    if(GetDebug() > 1) printf("AliAnaPi0EbE::MakeShowerShapeIdentification() - PDG of identified particle %d\n",idPartType);
+  
+        
+    //Skip events with too few or too many  NLM
+    if(nMaxima < fNLMCutMin || nMaxima > fNLMCutMax) 
+    {
+      FillRejectedClusterHistograms(mom,tag);
+      continue ;
+    }
     
-    if(GetDebug() > 1) printf("AliAnaPi0EbE::MakeShowerShapeIdentification() - PDG of identified particle %d\n",aodpi0.GetIdentifiedParticleType());
+    if(GetDebug() > 1)
+      printf("AliAnaPi0EbE::MakeShowerShapeIdentification() - NLM %d accepted \n",nMaxima);
     
-    // If cluster does not pass pid, not pi0, skip it.
-    // TO DO, add option for Eta ... or conversions
-    if(aodpi0.GetIdentifiedParticleType() != AliCaloPID::kPi0) continue ;              
+    //mass of all clusters
+    fhMass->Fill(mom.E(),mass);
+
+    // Asymmetry of all clusters
+    Float_t asy =-10;      
+    if(e1+e2 > 0) asy = (e1-e2) / (e1+e2);
+    fhAsymmetry->Fill(mom.E(),asy);
     
-    if(GetDebug() > 1) printf("AliAnaPi0EbE::MakeShowerShapeIdentification() - Pi0 selection cuts passed: pT %3.2f, pdg %d\n",
-                              aodpi0.Pt(), aodpi0.GetIdentifiedParticleType());
+    if(IsDataMC())
+    {
+      Int_t mcIndex = GetMCIndex(tag);
+      fhMCEAsymmetry[mcIndex]->Fill(mom.E(),asy);
+    }  
     
+    // If cluster does not pass pid, not pi0/eta, skip it.
+    if     (GetOutputAODName().Contains("Pi0") && idPartType != AliCaloPID::kPi0) 
+    { 
+      if(GetDebug() > 1) printf("AliAnaPi0EbE::MakeShowerShapeIdentification() - Cluster is not Pi0\n");
+      FillRejectedClusterHistograms(mom,tag);
+      continue ;
+    }  
+    
+    else if(GetOutputAODName().Contains("Eta") && idPartType != AliCaloPID::kEta)     
+    { 
+      if(GetDebug() > 1) printf("AliAnaPi0EbE::MakeShowerShapeIdentification() - Cluster is not Eta\n");
+      FillRejectedClusterHistograms(mom,tag);
+      continue ;
+    }  
+    
+    if(GetDebug() > 1) 
+      printf("AliAnaPi0EbE::MakeShowerShapeIdentification() - Pi0/Eta selection cuts passed: pT %3.2f, pdg %d\n",
+                              mom.Pt(), idPartType);
+    
+    //Mass and asymmetry of selected pairs
+    fhSelectedAsymmetry->Fill(mom.E(),asy);
+    fhSelectedMass     ->Fill(mom.E(),mass);
+
+    //-----------------------
+    //Create AOD for analysis
+    
+    AliAODPWG4Particle aodpi0 = AliAODPWG4Particle(mom);
+    aodpi0.SetLabel(calo->GetLabel());
+    
+    //Set the indeces of the original caloclusters  
+    aodpi0.SetCaloLabel(calo->GetID(),-1);
+    aodpi0.SetDetector(fCalorimeter);
+
+    if     (distBad > fMinDist3) aodpi0.SetDistToBad(2) ;
+    else if(distBad > fMinDist2) aodpi0.SetDistToBad(1) ; 
+    else                         aodpi0.SetDistToBad(0) ;
+    
+    // Check if cluster is pi0 via cluster splitting
+    aodpi0.SetIdentifiedParticleType(idPartType); 
+        
     // Add number of local maxima to AOD, method name in AOD to be FIXED
     aodpi0.SetFiducialArea(nMaxima);
     
-    //Play with the MC stack if available
-    //Check origin of the candidates
-    Int_t tag  = 0 ;
-    if(IsDataMC())
-    {
-      tag = GetMCAnalysisUtils()->CheckOrigin(calo->GetLabels(),calo->GetNLabels(),GetReader(), aodpi0.GetInputFileIndex());
-      //GetMCAnalysisUtils()->CheckMultipleOrigin(calo->GetLabels(),calo->GetNLabels(), GetReader(), aodpi0.GetInputFileIndex(), tag);
-      aodpi0.SetTag(tag);
-      if(GetDebug() > 0) printf("AliAnaPi0EbE::MakeShowerShapeIdentification() - Origin of candidate %d\n",aodpi0.GetTag());
-    }//Work with stack also   
+    aodpi0.SetTag(tag);
     
     //Fill some histograms about shower shape
     if(fFillSelectClHisto && GetReader()->GetDataType()!=AliCaloTrackReader::kMC)
     {
-      Float_t asy =-10;      
-      if(e1+e2 > 0 ) asy = (e1-e2) / (e1+e2);
       FillSelectedClusterHistograms(calo, nMaxima, tag, asy);
     }  
     
@@ -1949,7 +2176,6 @@ void  AliAnaPi0EbE::MakeShowerShapeIdentification()
     // Remember to relax time cuts in the reader
     FillPileUpHistograms(calo->E(),calo->GetTOF()*1e9);
     
-    
     //Add AOD with pi0 object to aod branch
     AddAODParticle(aodpi0);
     
@@ -1972,6 +2198,9 @@ void  AliAnaPi0EbE::MakeAnalysisFillHistograms()
   Int_t naod = GetOutputAODBranch()->GetEntriesFast();
   if(GetDebug() > 0) printf("AliAnaPi0EbE::MakeAnalysisFillHistograms() - aod branch entries %d\n", naod);
   
+  Float_t cen = GetEventCentrality();
+  Float_t ep  = GetEventPlaneAngle();
+  
   for(Int_t iaod = 0; iaod < naod ; iaod++)
   {
     
@@ -1987,22 +2216,40 @@ void  AliAnaPi0EbE::MakeAnalysisFillHistograms()
     if(phi < 0) phi+=TMath::TwoPi();
     Float_t eta = pi0->Eta();
     
-    fhPt     ->Fill(pt);
+    fhPt     ->Fill(pt  );
     fhE      ->Fill(ener);
     
     fhEEta   ->Fill(ener,eta);
     fhEPhi   ->Fill(ener,phi);
-    fhEtaPhi ->Fill(eta,phi);
+    fhEtaPhi ->Fill(eta ,phi);
 
+    fhPtCentrality ->Fill(pt,cen) ;
+    fhPtEventPlane ->Fill(pt,ep ) ;
+    
+    if(fFillPileUpHistograms)
+    {
+      if(GetReader()->IsPileUpFromSPD())               fhPtPi0PileUp[0]->Fill(pt);
+      if(GetReader()->IsPileUpFromEMCal())             fhPtPi0PileUp[1]->Fill(pt);
+      if(GetReader()->IsPileUpFromSPDOrEMCal())        fhPtPi0PileUp[2]->Fill(pt);
+      if(GetReader()->IsPileUpFromSPDAndEMCal())       fhPtPi0PileUp[3]->Fill(pt);
+      if(GetReader()->IsPileUpFromSPDAndNotEMCal())    fhPtPi0PileUp[4]->Fill(pt);
+      if(GetReader()->IsPileUpFromEMCalAndNotSPD())    fhPtPi0PileUp[5]->Fill(pt);
+      if(GetReader()->IsPileUpFromNotSPDAndNotEMCal()) fhPtPi0PileUp[6]->Fill(pt);
+    }
+
+    
     if(IsDataMC())
     {
       Int_t tag     = pi0->GetTag();
       Int_t mcIndex = GetMCIndex(tag);
 
+      fhMCE  [mcIndex] ->Fill(ener);
       fhMCPt [mcIndex] ->Fill(pt);
       fhMCPhi[mcIndex] ->Fill(pt,phi);
       fhMCEta[mcIndex] ->Fill(pt,eta);
       
+      fhMCPtCentrality[mcIndex]->Fill(pt,cen);
+
       if((mcIndex==kmcPhoton || mcIndex==kmcPi0 || mcIndex==kmcEta) && fAnaType==kSSCalo)
       {
         Float_t efracMC = 0;