Add check on the primary getter on the goodness of the finding
authorgconesab <gconesab@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 5 Oct 2012 14:09:43 +0000 (14:09 +0000)
committergconesab <gconesab@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 5 Oct 2012 14:09:43 +0000 (14:09 +0000)
Compactify histogram filling in AliAnaPhoton
Add few histograms in AliAnaPi0EbE for SS analysis

PWG/CaloTrackCorrBase/AliMCAnalysisUtils.cxx
PWG/CaloTrackCorrBase/AliMCAnalysisUtils.h
PWGGA/CaloTrackCorrelations/AliAnaPhoton.cxx
PWGGA/CaloTrackCorrelations/AliAnaPi0EbE.cxx
PWGGA/CaloTrackCorrelations/AliAnaPi0EbE.h

index 6c0dd27..91db7b9 100755 (executable)
@@ -1115,24 +1115,46 @@ TList * AliMCAnalysisUtils::GetJets(const AliCaloTrackReader * reader)
   return fJetsList;
 }
 
-//_____________________________________________________________
-TLorentzVector AliMCAnalysisUtils::GetMother(const Int_t label, const AliCaloTrackReader* reader) 
+
+//_______________________________________________________________________________________________
+TLorentzVector AliMCAnalysisUtils::GetMother(const Int_t label, const AliCaloTrackReader* reader,
+                                             Bool_t & ok) 
 {
   //Return the kinematics of the particle that generated the signal
   
-  TLorentzVector mom;
+  Int_t pdg = -1; Int_t status = -1;
+  return GetMother(label,reader,pdg,status, ok);
+}
+
+//_______________________________________________________________________________________________
+TLorentzVector AliMCAnalysisUtils::GetMother(const Int_t label, const AliCaloTrackReader* reader, 
+                                             Int_t & pdg, Int_t & status, Bool_t & ok) 
+{
+  //Return the kinematics of the particle that generated the signal, its pdg and its status
+  
+  TLorentzVector mom(0,0,0,0);
   
   if(reader->ReadStack())
   {
-    if(!reader->GetStack()) {
+    if(!reader->GetStack()) 
+    {
       if (fDebug >=0) 
         printf("AliMCAnalysisUtils::GetMother() - Stack is not available, check analysis settings in configuration file, STOP!!\n");
-      return -1;
+     
+      ok=kFALSE;
+      return mom;
     }
     if(label >= 0 && label < reader->GetStack()->GetNtrack())
     {
       TParticle * momP = reader->GetStack()->Particle(label);
       momP->Momentum(mom);
+      pdg    = momP->GetPdgCode();
+      status = momP->GetStatusCode();
+    } 
+    else 
+    {
+      ok = kFALSE;
+      return mom;
     }
   }
   else if(reader->ReadAODMCParticles())
@@ -1142,7 +1164,9 @@ TLorentzVector AliMCAnalysisUtils::GetMother(const Int_t label, const AliCaloTra
     {
       if(fDebug >= 0)
         printf("AliMCAnalysisUtils::GetMother() - AODMCParticles is not available, check analysis settings in configuration file!!\n");
-      return -1;
+      
+      ok=kFALSE;
+      return mom;
     }
     
     Int_t nprimaries = mcparticles->GetEntriesFast();
@@ -1150,18 +1174,28 @@ TLorentzVector AliMCAnalysisUtils::GetMother(const Int_t label, const AliCaloTra
     {
       AliAODMCParticle * momP = (AliAODMCParticle *) mcparticles->At(label);
       mom.SetPxPyPzE(momP->Px(),momP->Py(),momP->Pz(),momP->E());
+      pdg    = momP->GetPdgCode();
+      status = momP->GetStatus();
+    }     
+    else 
+    {
+      ok = kFALSE;
+      return mom;
     }
   }
   
+  ok = kTRUE;
+  
   return mom;
 }
 
+
 //_____________________________________________________________________________________
-TLorentzVector AliMCAnalysisUtils::GetMotherWithPDG(const Int_t label, const Int_t pdg, const AliCaloTrackReader* reader) 
+TLorentzVector AliMCAnalysisUtils::GetMotherWithPDG(const Int_t label, const Int_t pdg, const AliCaloTrackReader* reader, Bool_t & ok) 
 {
   //Return the kinematics of the particle that generated the signal
   
-  TLorentzVector grandmom;
+  TLorentzVector grandmom(0,0,0,0);
   
   
   if(reader->ReadStack())
@@ -1170,7 +1204,9 @@ TLorentzVector AliMCAnalysisUtils::GetMotherWithPDG(const Int_t label, const Int
     {
       if (fDebug >=0) 
         printf("AliMCAnalysisUtils::GetMotherWithPDG() - Stack is not available, check analysis settings in configuration file, STOP!!\n");
-      return -1;
+      
+      ok = kFALSE;
+      return grandmom;
     }
     if(label >= 0 && label < reader->GetStack()->GetNtrack())
     {
@@ -1203,7 +1239,9 @@ TLorentzVector AliMCAnalysisUtils::GetMotherWithPDG(const Int_t label, const Int
     {
       if(fDebug >= 0)
         printf("AliMCAnalysisUtils::GetMotherWithPDG() - AODMCParticles is not available, check analysis settings in configuration file!!\n");
-      return -1;
+      
+      ok=kFALSE;
+      return grandmom;
     }
     
     Int_t nprimaries = mcparticles->GetEntriesFast();
@@ -1235,6 +1273,7 @@ TLorentzVector AliMCAnalysisUtils::GetMotherWithPDG(const Int_t label, const Int
     }
   }
   
+  ok = kTRUE;
   
   return grandmom;
 }
index fdc5c2a..5dac33e 100755 (executable)
@@ -62,8 +62,9 @@ class AliMCAnalysisUtils : public TObject {
   void    CheckOverlapped2GammaDecay(const Int_t *labels, const Int_t nlabels, const Int_t mesonIndex, AliStack * stack, Int_t & tag); // ESD
   void    CheckOverlapped2GammaDecay(const Int_t *labels, const Int_t nlabels, const Int_t mesonIndex, const TClonesArray* mcparticles, Int_t & tag); // AOD
   
-  TLorentzVector GetMother(const Int_t label,const AliCaloTrackReader* reader);
-  TLorentzVector GetMotherWithPDG(const Int_t label, const Int_t pdg,const AliCaloTrackReader* reader);
+  TLorentzVector GetMother(const Int_t label,const AliCaloTrackReader* reader, Bool_t & ok);
+  TLorentzVector GetMother(const Int_t label,const AliCaloTrackReader* reader, Int_t & pdg, Int_t & status, Bool_t & ok);
+  TLorentzVector GetMotherWithPDG(const Int_t label, const Int_t pdg,const AliCaloTrackReader* reader, Bool_t & ok);
   
   //Check or set the bits produced in the above methods
   void    SetTagBit(Int_t &tag, const UInt_t set) const {
index 6d9ce93..ad4f41a 100755 (executable)
@@ -2277,39 +2277,7 @@ void  AliAnaPhoton::MakeAnalysisFillAOD()
 void  AliAnaPhoton::MakeAnalysisFillHistograms() 
 {
   //Fill histograms
-  
-  //-------------------------------------------------------------------
-  // Access MC information in stack if requested, check that it exists.        
-  AliStack         * stack       = 0x0;
-  TParticle        * primary     = 0x0;   
-  TClonesArray     * mcparticles = 0x0;
-  AliAODMCParticle * aodprimary  = 0x0; 
-  
-  if(IsDataMC())
-  {
-    if(GetReader()->ReadStack())
-    {
-      stack =  GetMCStack() ;
-      if(!stack) 
-      {
-        printf("AliAnaPhoton::MakeAnalysisFillHistograms() - Stack not available, is the MC handler called? STOP\n");
-        abort();
-      }
       
-    }
-    else if(GetReader()->ReadAODMCParticles())
-    {
-      
-      //Get the list of MC particles
-      mcparticles = GetReader()->GetAODMCParticles(0);
-      if(!mcparticles && GetDebug() > 0)       
-      {
-        printf("AliAnaPhoton::MakeAnalysisFillHistograms() -  Standard MCParticles not available!\n");
-      }        
-    }
-  }// is data and MC
-  
-  
   // Get vertex
   Double_t v[3] = {0,0,0}; //vertex ;
   GetReader()->GetVertex(v);
@@ -2389,11 +2357,24 @@ void  AliAnaPhoton::MakeAnalysisFillHistograms()
     //Play with the MC data if available
     if(IsDataMC())
     {
+      if(GetDebug()>0)
+      {
+        if(GetReader()->ReadStack() && !GetMCStack())
+        {
+          printf("AliAnaPhoton::MakeAnalysisFillHistograms() - Stack not available, is the MC handler called?\n");
+        }
+        else if(GetReader()->ReadAODMCParticles() && !GetReader()->GetAODMCParticles(0))
+        {
+          printf("AliAnaPhoton::MakeAnalysisFillHistograms() -  Standard MCParticles not available!\n");
+        }      
+      }    
+      
       FillAcceptanceHistograms();
       
       //....................................................................
       // Access MC information in stack if requested, check that it exists.
       Int_t label =ph->GetLabel();
+      
       if(label < 0) 
       {
         if(GetDebug() > 1) printf("AliAnaPhoton::MakeAnalysisFillHistograms() *** bad label ***:  label %d \n", label);
@@ -2402,226 +2383,74 @@ void  AliAnaPhoton::MakeAnalysisFillHistograms()
       
       Float_t eprim   = 0;
       Float_t ptprim  = 0;
-      if(GetReader()->ReadStack())
-      {
-        if(label >=  stack->GetNtrack())
-        {
-          if(GetDebug() > 2)  printf("AliAnaPhoton::MakeAnalysisFillHistograms() *** large label ***:  label %d, n tracks %d \n", label, stack->GetNtrack());
-          continue ;
-        }
-        
-        primary = stack->Particle(label);
-        if(!primary)
-        {
-          printf("AliAnaPhoton::MakeAnalysisFillHistograms() *** no primary ***:  label %d \n", label);
-          continue;
-        }
-        
-        eprim   = primary->Energy();
-        ptprim  = primary->Pt();               
-        
-      }
-      else if(GetReader()->ReadAODMCParticles())
+      Bool_t ok = kFALSE;
+      TLorentzVector primary = GetMCAnalysisUtils()->GetMother(label,GetReader(),ok);
+      if(ok)
       {
-        //Check which is the input
-        if(ph->GetInputFileIndex() == 0)
-        {
-          if(!mcparticles) continue;
-          if(label >=  mcparticles->GetEntriesFast()) 
-          {
-            if(GetDebug() > 2)  printf("AliAnaPhoton::MakeAnalysisFillHistograms() *** large label ***:  label %d, n tracks %d \n", 
-                                       label, mcparticles->GetEntriesFast());
-            continue ;
-          }
-          //Get the particle
-          aodprimary = (AliAODMCParticle*) mcparticles->At(label);
-          
-        }
-        
-        if(!aodprimary)
-        {
-          printf("AliAnaPhoton::MakeAnalysisFillHistograms() *** no primary ***:  label %d \n", label);
-          continue;
-        }
-        
-        eprim   = aodprimary->E();
-        ptprim  = aodprimary->Pt();
-        
+        eprim   = primary.Energy();
+        ptprim  = primary.Pt();                
       }
       
       Int_t tag =ph->GetTag();
-      
+      Int_t mcParticleTag = -1;
       if( GetMCAnalysisUtils()->CheckTagBit(tag,AliMCAnalysisUtils::kMCPhoton) && fhMCE[kmcPhoton])
       {
-        fhMCE  [kmcPhoton] ->Fill(ecluster);
-        fhMCPt [kmcPhoton] ->Fill(ptcluster);
-        fhMCPhi[kmcPhoton] ->Fill(ecluster,phicluster);
-        fhMCEta[kmcPhoton] ->Fill(ecluster,etacluster);
-        
-        fhMC2E[kmcPhoton]     ->Fill(ecluster, eprim);
-        fhMC2Pt[kmcPhoton]    ->Fill(ptcluster, ptprim);     
-        fhMCDeltaE[kmcPhoton] ->Fill(ecluster,eprim-ecluster);
-        fhMCDeltaPt[kmcPhoton]->Fill(ptcluster,ptprim-ptcluster);     
-        
+        mcParticleTag = kmcPhoton;
+    
         if(GetMCAnalysisUtils()->CheckTagBit(tag,AliMCAnalysisUtils::kMCConversion) && 
            GetMCAnalysisUtils()->CheckTagBit(tag,AliMCAnalysisUtils::kMCPhoton)     &&
            fhMCE[kmcConversion])
         {
-          fhMCE  [kmcConversion] ->Fill(ecluster);
-          fhMCPt [kmcConversion] ->Fill(ptcluster);
-          fhMCPhi[kmcConversion] ->Fill(ecluster,phicluster);
-          fhMCEta[kmcConversion] ->Fill(ecluster,etacluster);
-          
-          fhMC2E[kmcConversion]     ->Fill(ecluster, eprim);
-          fhMC2Pt[kmcConversion]    ->Fill(ptcluster, ptprim);     
-          fhMCDeltaE[kmcConversion] ->Fill(ecluster,eprim-ecluster);
-          fhMCDeltaPt[kmcConversion]->Fill(ptcluster,ptprim-ptcluster);     
+          mcParticleTag = kmcConversion;
         }                      
         
-        if(GetMCAnalysisUtils()->CheckTagBit(tag,AliMCAnalysisUtils::kMCPrompt) && fhMCE[kmcPrompt])
+        if     (GetMCAnalysisUtils()->CheckTagBit(tag,AliMCAnalysisUtils::kMCPrompt) && fhMCE[kmcPrompt])
         {
-          fhMCE  [kmcPrompt] ->Fill(ecluster);
-          fhMCPt [kmcPrompt] ->Fill(ptcluster);
-          fhMCPhi[kmcPrompt] ->Fill(ecluster,phicluster);
-          fhMCEta[kmcPrompt] ->Fill(ecluster,etacluster);      
-          
-          fhMC2E[kmcPrompt]     ->Fill(ecluster, eprim);
-          fhMC2Pt[kmcPrompt]    ->Fill(ptcluster, ptprim);     
-          fhMCDeltaE[kmcPrompt] ->Fill(ecluster,eprim-ecluster);
-          fhMCDeltaPt[kmcPrompt]->Fill(ptcluster,ptprim-ptcluster);     
-          
+          mcParticleTag = kmcPrompt;
         }
         else if(GetMCAnalysisUtils()->CheckTagBit(tag,AliMCAnalysisUtils::kMCFragmentation)&& fhMCE[kmcFragmentation])
         {
-          fhMCE  [kmcFragmentation] ->Fill(ecluster);
-          fhMCPt [kmcFragmentation] ->Fill(ptcluster);
-          fhMCPhi[kmcFragmentation] ->Fill(ecluster,phicluster);
-          fhMCEta[kmcFragmentation] ->Fill(ecluster,etacluster);
-          
-          fhMC2E[kmcFragmentation]     ->Fill(ecluster, eprim);
-          fhMC2Pt[kmcFragmentation]    ->Fill(ptcluster, ptprim);     
-          fhMCDeltaE[kmcFragmentation] ->Fill(ecluster,eprim-ecluster);
-          fhMCDeltaPt[kmcFragmentation]->Fill(ptcluster,ptprim-ptcluster);     
-          
+          mcParticleTag = kmcFragmentation;
         }
         else if(GetMCAnalysisUtils()->CheckTagBit(tag,AliMCAnalysisUtils::kMCISR)&& fhMCE[kmcISR])
         {
-          fhMCE  [kmcISR] ->Fill(ecluster);
-          fhMCPt [kmcISR] ->Fill(ptcluster);
-          fhMCPhi[kmcISR] ->Fill(ecluster,phicluster);
-          fhMCEta[kmcISR] ->Fill(ecluster,etacluster);    
-          
-          fhMC2E[kmcISR]     ->Fill(ecluster, eprim);
-          fhMC2Pt[kmcISR]    ->Fill(ptcluster, ptprim);     
-          fhMCDeltaE[kmcISR] ->Fill(ecluster,eprim-ecluster);
-          fhMCDeltaPt[kmcISR]->Fill(ptcluster,ptprim-ptcluster);     
-          
+          mcParticleTag = kmcISR; 
         }
         else if( GetMCAnalysisUtils()->CheckTagBit(tag,AliMCAnalysisUtils::kMCPi0Decay) && 
                 !GetMCAnalysisUtils()->CheckTagBit(tag,AliMCAnalysisUtils::kMCPi0) && fhMCE[kmcPi0Decay])
         {
-          fhMCE  [kmcPi0Decay] ->Fill(ecluster);
-          fhMCPt [kmcPi0Decay] ->Fill(ptcluster);
-          fhMCPhi[kmcPi0Decay] ->Fill(ecluster,phicluster);
-          fhMCEta[kmcPi0Decay] ->Fill(ecluster,etacluster);
-          
-          fhMC2E[kmcPi0Decay]     ->Fill(ecluster, eprim);
-          fhMC2Pt[kmcPi0Decay]    ->Fill(ptcluster, ptprim);     
-          fhMCDeltaE[kmcPi0Decay] ->Fill(ecluster,eprim-ecluster);
-          fhMCDeltaPt[kmcPi0Decay]->Fill(ptcluster,ptprim-ptcluster);     
-          
+          mcParticleTag = kmcPi0Decay;
         }
         else if((( GetMCAnalysisUtils()->CheckTagBit(tag,AliMCAnalysisUtils::kMCEtaDecay) && 
                   !GetMCAnalysisUtils()->CheckTagBit(tag,AliMCAnalysisUtils::kMCEta)        ) || 
-                 GetMCAnalysisUtils()->CheckTagBit(tag,AliMCAnalysisUtils::kMCOtherDecay) ) && fhMCE[kmcOtherDecay])
+                   GetMCAnalysisUtils()->CheckTagBit(tag,AliMCAnalysisUtils::kMCOtherDecay) ) && fhMCE[kmcOtherDecay])
         {
-          fhMCE  [kmcOtherDecay] ->Fill(ecluster);
-          fhMCPt [kmcOtherDecay] ->Fill(ptcluster);
-          fhMCPhi[kmcOtherDecay] ->Fill(ecluster,phicluster);
-          fhMCEta[kmcOtherDecay] ->Fill(ecluster,etacluster);
-          
-          fhMC2E[kmcOtherDecay]     ->Fill(ecluster, eprim);
-          fhMC2Pt[kmcOtherDecay]    ->Fill(ptcluster, ptprim);     
-          fhMCDeltaE[kmcOtherDecay] ->Fill(ecluster,eprim-ecluster);
-          fhMCDeltaPt[kmcOtherDecay]->Fill(ptcluster,ptprim-ptcluster);     
-          
+          mcParticleTag = kmcOtherDecay;
         }
-        else if(GetMCAnalysisUtils()->CheckTagBit(tag,AliMCAnalysisUtils::kMCPi0) && fhMCE  [kmcPi0])
+        else if(GetMCAnalysisUtils()->CheckTagBit(tag,AliMCAnalysisUtils::kMCPi0) && fhMCE[kmcPi0])
         {
-          fhMCE  [kmcPi0] ->Fill(ecluster);
-          fhMCPt [kmcPi0] ->Fill(ptcluster);
-          fhMCPhi[kmcPi0] ->Fill(ecluster,phicluster);
-          fhMCEta[kmcPi0] ->Fill(ecluster,etacluster);
-          
-          fhMC2E[kmcPi0]     ->Fill(ecluster, eprim);
-          fhMC2Pt[kmcPi0]    ->Fill(ptcluster, ptprim);     
-          fhMCDeltaE[kmcPi0] ->Fill(ecluster,eprim-ecluster);
-          fhMCDeltaPt[kmcPi0]->Fill(ptcluster,ptprim-ptcluster);     
-          
+          mcParticleTag = kmcPi0;   
         } 
         else if(GetMCAnalysisUtils()->CheckTagBit(tag,AliMCAnalysisUtils::kMCEta) && fhMCE[kmcEta])
         {
-          fhMCE  [kmcEta] ->Fill(ecluster);
-          fhMCPt [kmcEta] ->Fill(ptcluster);
-          fhMCPhi[kmcEta] ->Fill(ecluster,phicluster);
-          fhMCEta[kmcEta] ->Fill(ecluster,etacluster);
-          
-          fhMC2E[kmcEta]     ->Fill(ecluster, eprim);
-          fhMC2Pt[kmcEta]    ->Fill(ptcluster, ptprim);     
-          fhMCDeltaE[kmcEta] ->Fill(ecluster,eprim-ecluster);
-          fhMCDeltaPt[kmcEta]->Fill(ptcluster,ptprim-ptcluster);     
-          
+          mcParticleTag = kmcEta;
         }      
       }
       else if(GetMCAnalysisUtils()->CheckTagBit(tag,AliMCAnalysisUtils::kMCAntiNeutron) && fhMCE[kmcAntiNeutron])
       {
-        fhMCE  [kmcAntiNeutron] ->Fill(ecluster);
-        fhMCPt [kmcAntiNeutron] ->Fill(ptcluster);
-        fhMCPhi[kmcAntiNeutron] ->Fill(ecluster,phicluster);
-        fhMCEta[kmcAntiNeutron] ->Fill(ecluster,etacluster);
-        
-        fhMC2E[kmcAntiNeutron]     ->Fill(ecluster, eprim);
-        fhMC2Pt[kmcAntiNeutron]    ->Fill(ptcluster, ptprim);     
-        fhMCDeltaE[kmcAntiNeutron] ->Fill(ecluster,eprim-ecluster);
-        fhMCDeltaPt[kmcAntiNeutron]->Fill(ptcluster,ptprim-ptcluster);     
-        
+        mcParticleTag = kmcAntiNeutron;
       }
       else if(GetMCAnalysisUtils()->CheckTagBit(tag,AliMCAnalysisUtils::kMCAntiProton) && fhMCE[kmcAntiProton])
       {
-        fhMCE  [kmcAntiProton] ->Fill(ecluster);
-        fhMCPt [kmcAntiProton] ->Fill(ptcluster);
-        fhMCPhi[kmcAntiProton] ->Fill(ecluster,phicluster);
-        fhMCEta[kmcAntiProton] ->Fill(ecluster,etacluster);
-        
-        fhMC2E[kmcAntiProton]     ->Fill(ecluster, eprim);
-        fhMC2Pt[kmcAntiProton]    ->Fill(ptcluster, ptprim);     
-        fhMCDeltaE[kmcAntiProton] ->Fill(ecluster,eprim-ecluster);
-        fhMCDeltaPt[kmcAntiProton]->Fill(ecluster,ptprim-ptcluster);     
-        
+        mcParticleTag = kmcAntiProton; 
       } 
       else if(GetMCAnalysisUtils()->CheckTagBit(tag,AliMCAnalysisUtils::kMCElectron) && fhMCE[kmcElectron])
       {
-        fhMCE  [kmcElectron] ->Fill(ecluster);
-        fhMCPt [kmcElectron] ->Fill(ptcluster);
-        fhMCPhi[kmcElectron] ->Fill(ecluster,phicluster);
-        fhMCEta[kmcElectron] ->Fill(ecluster,etacluster);
-        
-        fhMC2E[kmcElectron]     ->Fill(ecluster, eprim);
-        fhMC2Pt[kmcElectron]    ->Fill(ptcluster, ptprim);     
-        fhMCDeltaE[kmcElectron] ->Fill(ecluster,eprim-ecluster);
-        fhMCDeltaPt[kmcElectron]->Fill(ecluster,ptprim-ptcluster);             
+        mcParticleTag = kmcElectron;            
       }     
       else if( fhMCE[kmcOther])
       {
-        fhMCE  [kmcOther] ->Fill(ecluster);
-        fhMCPt [kmcOther] ->Fill(ptcluster);
-        fhMCPhi[kmcOther] ->Fill(ecluster,phicluster);
-        fhMCEta[kmcOther] ->Fill(ecluster,etacluster);
-        
-        fhMC2E[kmcOther]     ->Fill(ecluster, eprim);
-        fhMC2Pt[kmcOther]    ->Fill(ptcluster, ptprim);     
-        fhMCDeltaE[kmcOther] ->Fill(ecluster,eprim-ecluster);
-        fhMCDeltaPt[kmcOther]->Fill(ecluster,ptprim-ptcluster);     
+        mcParticleTag = kmcOther;
         
         //              printf(" AliAnaPhoton::MakeAnalysisFillHistograms() - Label %d, pT %2.3f Unknown, bits set: ",
         //                                     ph->GetLabel(),ph->Pt());
@@ -2632,6 +2461,16 @@ void  AliAnaPhoton::MakeAnalysisFillHistograms()
         
       }
       
+      fhMCE  [mcParticleTag] ->Fill(ecluster);
+      fhMCPt [mcParticleTag] ->Fill(ptcluster);
+      fhMCPhi[mcParticleTag] ->Fill(ecluster,phicluster);
+      fhMCEta[mcParticleTag] ->Fill(ecluster,etacluster);
+      
+      fhMC2E[mcParticleTag]     ->Fill(ecluster, eprim);
+      fhMC2Pt[mcParticleTag]    ->Fill(ptcluster, ptprim);     
+      fhMCDeltaE[mcParticleTag] ->Fill(ecluster,eprim-ecluster);
+      fhMCDeltaPt[mcParticleTag]->Fill(ptcluster,ptprim-ptcluster); 
+      
     }//Histograms with MC
     
   }// aod loop
index 2105656..4d81f7d 100755 (executable)
@@ -68,7 +68,8 @@ AliAnaPi0EbE::AliAnaPi0EbE() :
 
     // MC histos
     fhMCPt(),                      fhMCPhi(),                    fhMCEta(),
-    fhMCPi0DecayPt(0),             fhMCPi0DecayPtFraction(0),
+    fhMCPi0PtFraction(0),          fhMCEtaPtFraction(0),
+    fhMCPi0DecayPt(0),             fhMCPi0DecayPtFraction(0),      
     fhMCEtaDecayPt(0),             fhMCEtaDecayPtFraction(0),
     fhMCOtherDecayPt(0),           
     fhMassPairMCPi0(0),            fhMassPairMCEta(0),
@@ -885,9 +886,20 @@ TList *  AliAnaPi0EbE::GetCreateOutputObjects()
   
   if(IsDataMC()) 
   {
-    
     if(GetReader()->GetDataType() != AliCaloTrackReader::kMC && fAnaType==kSSCalo)
     {
+      fhMCPi0PtFraction = new TH2F("hMCPi0PtFraction","Number of clusters from #pi^{0} (2 #gamma) identified as #pi^{0} (#eta), pT versus pT / pT mother",
+                                   nptbins,ptmin,ptmax,100,0,1); 
+      fhMCPi0PtFraction->SetXTitle("p^{rec}_{T} (GeV/c)");
+      fhMCPi0PtFraction->SetYTitle("E^{gen}_{T} / E^{gen-mother}_{T}");
+      outputContainer->Add(fhMCPi0PtFraction) ; 
+            
+      fhMCEtaPtFraction = new TH2F("hMCEtaPtFraction","Number of clusters from #eta (2 #gamma) identified as #pi^{0} (#eta), pT versus pT / pT mother",
+                                   nptbins,ptmin,ptmax,100,0,1); 
+      fhMCEtaPtFraction->SetXTitle("p^{rec}_{T} (GeV/c)");
+      fhMCEtaPtFraction->SetYTitle("E^{gen}_{T} / E^{gen-mother}_{T}");
+      outputContainer->Add(fhMCEtaPtFraction) ; 
+      
       fhMCPi0DecayPt = new TH1F("hMCPi0DecayPt","Number of #gamma from #pi^{0} decay  identified as #pi^{0} (#eta)",nptbins,ptmin,ptmax); 
       fhMCPi0DecayPt->SetYTitle("N");
       fhMCPi0DecayPt->SetXTitle("p^{rec}_{T} (GeV/c)");
@@ -899,18 +911,18 @@ TList *  AliAnaPi0EbE::GetCreateOutputObjects()
       fhMCPi0DecayPtFraction->SetYTitle("E^{gen}_{T} / E^{gen-mother}_{T}");
       outputContainer->Add(fhMCPi0DecayPtFraction) ; 
       
-      fhMCEtaDecayPt = new TH1F("hMCEtaDecayPt","Number of #gamma from #pi^{0} decay  identified as #pi^{0} (#eta)",nptbins,ptmin,ptmax); 
+      fhMCEtaDecayPt = new TH1F("hMCEtaDecayPt","Number of #gamma from #eta decay  identified as #pi^{0} (#eta)",nptbins,ptmin,ptmax); 
       fhMCEtaDecayPt->SetYTitle("N");
       fhMCEtaDecayPt->SetXTitle("p^{rec}_{T} (GeV/c)");
       outputContainer->Add(fhMCEtaDecayPt) ; 
       
-      fhMCEtaDecayPtFraction = new TH2F("hMCEtaDecayPtFraction","Number of #gamma from #pi^{0} decay  identified as #pi^{0} (#eta), pT versus pT / pT mother",
+      fhMCEtaDecayPtFraction = new TH2F("hMCEtaDecayPtFraction","Number of #gamma from #eta decay  identified as #pi^{0} (#eta), pT versus pT / pT mother",
                                         nptbins,ptmin,ptmax,100,0,1); 
       fhMCEtaDecayPtFraction->SetXTitle("p^{rec}_{T} (GeV/c)");
       fhMCEtaDecayPtFraction->SetYTitle("E^{gen}_{T} / E^{gen-mother}_{T}");
       outputContainer->Add(fhMCEtaDecayPtFraction) ; 
       
-      fhMCOtherDecayPt = new TH1F("hMCOtherDecayPt","Number of #gamma from #pi^{0} decay  identified as #pi^{0} (#eta)",nptbins,ptmin,ptmax); 
+      fhMCOtherDecayPt = new TH1F("hMCOtherDecayPt","Number of #gamma decay (not #eta or #pi^{0})  identified as #pi^{0} (#eta)",nptbins,ptmin,ptmax); 
       fhMCOtherDecayPt->SetYTitle("N");
       fhMCOtherDecayPt->SetXTitle("p^{rec}_{T} (GeV/c)");
       outputContainer->Add(fhMCOtherDecayPt) ; 
@@ -1213,7 +1225,7 @@ Int_t AliAnaPi0EbE::GetMCIndex(const Int_t tag)
     return kmcEta ; 
   }//eta          
   else if  ( GetMCAnalysisUtils()->CheckTagBit(tag,AliMCAnalysisUtils::kMCPhoton) &&
-            GetMCAnalysisUtils()->CheckTagBit(tag,AliMCAnalysisUtils::kMCConversion) )
+             GetMCAnalysisUtils()->CheckTagBit(tag,AliMCAnalysisUtils::kMCConversion) )
   {
     return kmcConversion ; 
   }//conversion photon
@@ -1851,22 +1863,48 @@ void  AliAnaPi0EbE::MakeAnalysisFillHistograms()
       {
         Float_t efracMC = 0;
         Int_t label = pi0->GetLabel();
-        TLorentzVector mom   = GetMCAnalysisUtils()->GetMother(label,GetReader()); 
-
-        if(GetMCAnalysisUtils()->CheckTagBit(tag,AliMCAnalysisUtils::kMCPi0Decay))
+        
+        Bool_t ok = kFALSE;
+        TLorentzVector mom   = GetMCAnalysisUtils()->GetMother(label,GetReader(),ok); 
+        if(!ok) continue;
+        
+        if(GetMCAnalysisUtils()->CheckTagBit(tag,AliMCAnalysisUtils::kMCPi0))
+        {
+          TLorentzVector grandmom = GetMCAnalysisUtils()->GetMotherWithPDG(label,111,GetReader(),ok); 
+          if(grandmom.E() > 0 && ok) 
+          {
+            efracMC =  mom.E()/grandmom.E();
+            fhMCPi0PtFraction ->Fill(pt,efracMC);
+          }
+        }        
+        else if(GetMCAnalysisUtils()->CheckTagBit(tag,AliMCAnalysisUtils::kMCPi0Decay))
         {
           fhMCPi0DecayPt->Fill(pt);
-          TLorentzVector grandmom = GetMCAnalysisUtils()->GetMotherWithPDG(label,111,GetReader()); 
-          if(grandmom.E()>0) efracMC =  mom.E()/grandmom.E();
-          fhMCPi0DecayPtFraction ->Fill(pt,efracMC);
+          TLorentzVector grandmom = GetMCAnalysisUtils()->GetMotherWithPDG(label,111,GetReader(),ok); 
+          if(grandmom.E() > 0 && ok) 
+          {
+            efracMC =  mom.E()/grandmom.E();
+            fhMCPi0DecayPtFraction ->Fill(pt,efracMC);
+          }
         }
+        else if(GetMCAnalysisUtils()->CheckTagBit(tag,AliMCAnalysisUtils::kMCEta))
+        {
+          TLorentzVector grandmom = GetMCAnalysisUtils()->GetMotherWithPDG(label,221,GetReader(),ok); 
+          if(grandmom.E() > 0 && ok) 
+          {
+            efracMC =  mom.E()/grandmom.E();
+            fhMCEtaPtFraction ->Fill(pt,efracMC);
+          }
+        }        
         else if(GetMCAnalysisUtils()->CheckTagBit(tag,AliMCAnalysisUtils::kMCEtaDecay))
         {
           fhMCEtaDecayPt->Fill(pt);
-          
-          TLorentzVector grandmom = GetMCAnalysisUtils()->GetMotherWithPDG(label,221,GetReader()); 
-          if(grandmom.E()>0) efracMC =  mom.E()/grandmom.E();
-          fhMCEtaDecayPtFraction ->Fill(pt,efracMC);
+          TLorentzVector grandmom = GetMCAnalysisUtils()->GetMotherWithPDG(label,221,GetReader(),ok); 
+          if(grandmom.E() > 0 && ok) 
+          {
+            efracMC =  mom.E()/grandmom.E();
+            fhMCEtaDecayPtFraction ->Fill(pt,efracMC);
+          }
         }
         else if(GetMCAnalysisUtils()->CheckTagBit(tag,AliMCAnalysisUtils::kMCOtherDecay))
         {
index da10fc8..7211909 100755 (executable)
@@ -184,11 +184,13 @@ class AliAnaPi0EbE : public AliAnaCaloTrackCorrBaseClass {
   TH2F         * fhMCPhi[6];                  //! Phi of identified as pi0, coming from X
   TH2F         * fhMCEta[6];                  //! eta of identified as pi0, coming from X
 
-  TH1F         * fhMCPi0DecayPt;              //! SS id, clusters id as pi0, coming from single photon, pi0 decay, pt
-  TH2F         * fhMCPi0DecayPtFraction;      //! SS id, clusters id as pi0, coming from single photon, pi0 decay, pt vs pt decay / pt mother
-  TH1F         * fhMCEtaDecayPt;              //! SS id, clusters id as pi0, coming from single photon, eta decay, pt
-  TH2F         * fhMCEtaDecayPtFraction;      //! SS id, clusters id as pi0, coming from single photon, eta decay, pt vs pt decay / pt mother  
-  TH1F         * fhMCOtherDecayPt;            //! SS id, clusters id as pi0, coming from single photon, other decay, pt
+  TH2F         * fhMCPi0PtFraction;           //! SS id, clusters id as pi0, coming from 2 photon, pi0 decay, pt vs pt decay / pt mother
+  TH2F         * fhMCEtaPtFraction;           //! SS id, clusters id as pi0, coming from 2 photon, eta decay, pt vs pt decay / pt mother  
+  TH1F         * fhMCPi0DecayPt;              //! SS id, clusters id as pi0, coming from 1 photon, pi0 decay, pt
+  TH2F         * fhMCPi0DecayPtFraction;      //! SS id, clusters id as pi0, coming from 1 photon, pi0 decay, pt vs pt decay / pt mother
+  TH1F         * fhMCEtaDecayPt;              //! SS id, clusters id as pi0, coming from 1 photon, eta decay, pt
+  TH2F         * fhMCEtaDecayPtFraction;      //! SS id, clusters id as pi0, coming from 1 photon, eta decay, pt vs pt decay / pt mother  
+  TH1F         * fhMCOtherDecayPt;            //! SS id, clusters id as pi0, coming from 1 photon, other decay, pt
 
   TH2F         * fhMassPairMCPi0;             //! pair mass, origin is same pi0
   TH2F         * fhMassPairMCEta;             //! pair mass, origin is same eta