1)AliAODParticleCorrelation.h: Data member fIsolation changed from float to bool
authorgconesab <gconesab@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 19 Feb 2009 08:55:23 +0000 (08:55 +0000)
committergconesab <gconesab@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 19 Feb 2009 08:55:23 +0000 (08:55 +0000)
2)AliCaloTrackMCReader: Possibility to keep the pi0 instead of the photon decay, in case of overlapping in calorimeters
3)AliAnaPi0EbE: In case of shower shape selection of pi0, it was selecting clusters id as photon not pi0. Added init method to check if calorimeter information is read.

PWG4/PartCorrBase/AliAODPWG4ParticleCorrelation.h
PWG4/PartCorrBase/AliCaloTrackMCReader.cxx
PWG4/PartCorrBase/AliCaloTrackMCReader.h
PWG4/PartCorrDep/AliAnaPi0EbE.cxx
PWG4/PartCorrDep/AliAnaPi0EbE.h

index 618e78b..ed9eae4 100755 (executable)
@@ -29,7 +29,7 @@ class AliAODPWG4ParticleCorrelation : public AliAODPWG4Particle {
     AliAODPWG4ParticleCorrelation(const AliAODPWG4ParticleCorrelation& photon); 
     AliAODPWG4ParticleCorrelation& operator=(const AliAODPWG4ParticleCorrelation& photon);
 
-    virtual Float_t IsIsolated() const { return fIsolated ;}
+    virtual Bool_t IsIsolated() const { return fIsolated ;}
     virtual void    SetIsolated(Bool_t iso) {fIsolated = iso ;}
 
     virtual TRefArray* GetRefTracks()    const { return  fRefTracks;}
@@ -76,7 +76,7 @@ class AliAODPWG4ParticleCorrelation : public AliAODPWG4Particle {
 
  private:
 
-       Float_t            fIsolated ; //Particle is isolated or not
+    Bool_t                fIsolated ; //Particle is isolated or not
        
     TRefArray*     fRefTracks;  // array of references to the tracks belonging to the jet / all selected hadrons  
     TRefArray*     fRefClusters; // array of references to the clusters belonging to the jet / all selected hadrons  
index 05c9c2d..b7c5fa4 100755 (executable)
@@ -43,7 +43,9 @@ ClassImp(AliCaloTrackMCReader)
 AliCaloTrackMCReader::AliCaloTrackMCReader() : 
   AliCaloTrackReader(), fDecayPi0(0), 
   fNeutralParticlesArray(0x0),    fChargedParticlesArray(0x0), 
-  fStatusArray(0x0), fKeepAllStatus(0), fClonesArrayType(0)
+  fStatusArray(0x0), fKeepAllStatus(0), fClonesArrayType(0), 
+  fCheckOverlap(0),  fEMCALOverlapAngle(0),fPHOSOverlapAngle(0),
+  fIndex2ndPhoton(0)
 {
   //Ctor
   
@@ -59,7 +61,10 @@ AliCaloTrackMCReader::AliCaloTrackMCReader(const AliCaloTrackMCReader & g) :
   fNeutralParticlesArray(g.fNeutralParticlesArray?new TArrayI(*g.fNeutralParticlesArray):0x0),
   fChargedParticlesArray(g.fChargedParticlesArray?new TArrayI(*g.fChargedParticlesArray):0x0),
   fStatusArray(g.fStatusArray?new TArrayI(*g.fStatusArray):0x0),
-  fKeepAllStatus(g.fKeepAllStatus), fClonesArrayType(g.fClonesArrayType)
+  fKeepAllStatus(g.fKeepAllStatus), fClonesArrayType(g.fClonesArrayType),
+  fCheckOverlap(g.fCheckOverlap),
+  fEMCALOverlapAngle( g.fEMCALOverlapAngle), fPHOSOverlapAngle(g.fPHOSOverlapAngle),
+  fIndex2ndPhoton(g.fIndex2ndPhoton)
 {
   // cpy ctor
 }
@@ -132,10 +137,55 @@ void AliCaloTrackMCReader::InitParameters()
   fKeepAllStatus = kTRUE;
   fClonesArrayType = kAliAOD ;
 
+  fCheckOverlap = kFALSE;
+  fEMCALOverlapAngle = 2.5 * TMath::DegToRad();
+  fPHOSOverlapAngle = 0.5 * TMath::DegToRad();
+  fIndex2ndPhoton = -1;
+}
+//____________________________________________________________________________
+void  AliCaloTrackMCReader::CheckOverlap(const Float_t anglethres, const Int_t imom, Int_t & iPrimary, Int_t & index, TLorentzVector & mom, Int_t & pdg) {
+  //Check overlap of decay photons
+  if( fIndex2ndPhoton==iPrimary ){
+    fIndex2ndPhoton=-1;
+    return;
+  }
+  else fIndex2ndPhoton=-1;
+  
+
+  if(pdg!=22) return;
+  
+  TLorentzVector ph1, ph2;
+  TParticle *meson = GetStack()->Particle(imom);
+  Int_t mepdg = meson->GetPdgCode();
+  Int_t idaug1 = meson->GetFirstDaughter();
+  if((mepdg == 111 || mepdg == 221 ) && meson->GetNDaughters() == 2){ //Check only decay in 2 photons
+    TParticle * d1 = GetStack()->Particle(idaug1);
+    TParticle  *d2 = GetStack()->Particle(idaug1+1);
+    if(d1->GetPdgCode() == 22 && d2->GetPdgCode() == 22 ){
+      d1->Momentum(ph1);
+      d2->Momentum(ph2);
+      //printf("angle %2.2f\n",ph1.Angle(ph2.Vect()));
+      
+      if(anglethres >  ph1.Angle(ph2.Vect())){           
+       //Keep the meson
+       pdg=mepdg;
+       index=imom;
+       meson->Momentum(mom);
+       //printf("Overlap:: pt %2.2f, phi %2.2f, eta %2.2f\n",mom.Pt(),mom.Phi(),mom.Eta());
+       if(iPrimary == idaug1) iPrimary++; //skip next photon in list
+      }
+      else{
+       //Do not check overlapping for next decay photon from same meson
+       if(iPrimary == idaug1) {fIndex2ndPhoton = idaug1+1;
+       }
+
+      }
+    }
+  }//Meson Decay with 2 photon daughters
 }
 
 //____________________________________________________________________________
-void  AliCaloTrackMCReader::FillCalorimeters(const Int_t iParticle, TParticle* particle, TLorentzVector momentum,
+void  AliCaloTrackMCReader::FillCalorimeters(Int_t & iParticle, TParticle* particle, TLorentzVector momentum,
                                             Int_t &indexPHOS, Int_t &indexEMCAL) {
        //Fill AODCaloClusters or TParticles lists of PHOS or EMCAL
        //In PHOS
@@ -143,13 +193,18 @@ void  AliCaloTrackMCReader::FillCalorimeters(const Int_t iParticle, TParticle* p
                
                if(fClonesArrayType == kTParticle) new((*fAODPHOS)[indexPHOS++])       TParticle(*particle) ;
                else{
-                       
-                       Char_t ttype= AliAODCluster::kPHOSNeutral;
-                       Int_t labels[] = {iParticle};
-                       Float_t x[] = {momentum.X(), momentum.Y(), momentum.Z()};                       
+                       Int_t index = iParticle ;
+                       Int_t pdg = TMath::Abs(particle->GetPdgCode());
+                       if(fCheckOverlap) 
+                         CheckOverlap(fPHOSOverlapAngle,particle->GetFirstMother(),index, iParticle, momentum, pdg);
+
+                       Char_t ttype= AliAODCluster::kPHOSNeutral;      
+                       Int_t labels[] = {index};
+                       Float_t x[] = {momentum.X(), momentum.Y(), momentum.Z()};
                        AliAODCaloCluster *calo = new((*fAODPHOS)[indexPHOS++]) 
-                       AliAODCaloCluster(iParticle,1,labels,momentum.E(), x, NULL, ttype, 0);
-                       SetCaloClusterPID(particle->GetPdgCode(),calo) ;
+                         AliAODCaloCluster(index,1,labels,momentum.E(), x, NULL, ttype, 0);
+               
+                       SetCaloClusterPID(pdg,calo) ;
                        if(fDebug > 3 && momentum.Pt() > 0.2)
                                        printf("Fill MC PHOS :: Selected tracks %s E %3.2f, pt %3.2f, phi %3.2f, eta %3.2f\n",
                                                        particle->GetName(),momentum.E(),momentum.Pt(),momentum.Phi()*TMath::RadToDeg(),momentum.Eta());                        
@@ -159,12 +214,19 @@ void  AliCaloTrackMCReader::FillCalorimeters(const Int_t iParticle, TParticle* p
        else if(fFillEMCAL && fFidutialCut->IsInFidutialCut(momentum,"EMCAL") && momentum.Pt() > fEMCALPtMin){
                if(fClonesArrayType == kTParticle) new((*fAODEMCAL)[indexEMCAL++])       TParticle(*particle) ;
                else{
+                                       Int_t index = iParticle ;
+                       Int_t pdg = TMath::Abs(particle->GetPdgCode());
+                       //Int_t pdgorg=pdg;
+                       if(fCheckOverlap) 
+                         CheckOverlap(fEMCALOverlapAngle,particle->GetFirstMother(),iParticle, index, momentum, pdg);
+
                        Char_t ttype= AliAODCluster::kEMCALClusterv1;
-                       Int_t labels[] = {iParticle};
+                       Int_t labels[] = {index};
                        Float_t x[] = {momentum.X(), momentum.Y(), momentum.Z()};
                        AliAODCaloCluster *calo = new((*fAODEMCAL)[indexEMCAL++]) 
                        AliAODCaloCluster(iParticle,1,labels,momentum.E(), x, NULL, ttype, 0);
-                       SetCaloClusterPID(particle->GetPdgCode(),calo) ;
+                    
+                       SetCaloClusterPID(pdg,calo) ;
                        if(fDebug > 3 && momentum.Pt() > 0.2)
                                        printf("Fill MC EMCAL :: Selected tracks %s E %3.2f, pt %3.2f, phi %3.2f, eta %3.2f\n",
                                                        particle->GetName(),momentum.E(),momentum.Pt(),momentum.Phi()*TMath::RadToDeg(),momentum.Eta());        
@@ -203,8 +265,8 @@ void AliCaloTrackMCReader::FillInputEvent(Int_t iEntry){
                TLorentzVector momentum;
                Float_t p[3];
                Float_t x[3];
-               Int_t pdg = particle->GetPdgCode();
-               
+               Int_t pdg = particle->GetPdgCode();                                             
+
                //Keep particles with a given status 
                if(KeepParticleWithStatus(particle->GetStatusCode()) && (particle->Pt() > 0) ){
                
@@ -246,7 +308,6 @@ void AliCaloTrackMCReader::FillInputEvent(Int_t iEntry){
                                //Skip neutrinos or other neutral particles
                                //if(SkipNeutralParticles(pdg) || particle->IsPrimary()) continue ; // protection added (MG)
                                if(SkipNeutralParticles(pdg)) continue ;
-                                                               
                                //Fill particle/calocluster arrays
                                if(!fDecayPi0) {
                                        FillCalorimeters(iParticle, particle, momentum, indexPHOS, indexEMCAL);
@@ -276,7 +337,8 @@ void AliCaloTrackMCReader::FillInputEvent(Int_t iEntry){
                        }//neutral particles
                } //particle with correct status
        }//particle loop
-       
+
+       fIndex2ndPhoton = -1; //In case of overlapping studies, reset for each event    
 }
 
 //________________________________________________________________
@@ -317,6 +379,7 @@ void AliCaloTrackMCReader::Print(const Option_t * opt) const
   
   printf("Decay Pi0?          : %d\n", fDecayPi0) ;
   printf("TClonesArray type   : %d\n", fClonesArrayType) ;
+  printf("Check Overlap in Calo?    : %d\n", fCheckOverlap) ;
   printf("Keep all status?    : %d\n", fKeepAllStatus) ;
   
   if(!fKeepAllStatus) printf("Keep particles with status : ");
index ab879b8..6e76e6b 100755 (executable)
@@ -66,10 +66,19 @@ class AliCaloTrackMCReader : public AliCaloTrackReader {
   void SetCaloClusterPID(const Int_t pdgCode, AliAODCaloCluster *calo) const ;
   void SetTrackChargeAndPID(const Int_t pdgCode, AliAODTrack *track) const ;
   
+  void SwitchOnOverlapCheck()  {fCheckOverlap = kTRUE;}
+  void SwitchOffOverlapCheck() {fCheckOverlap = kFALSE;}
+
+  Float_t GetEMCALOverlapAngle()  const {return fEMCALOverlapAngle ;}
+  Float_t GetPHOSOverlapAngle() const {return fPHOSOverlapAngle ;}
+  void SetEMCALOverlapAngle(Float_t angle)  {fEMCALOverlapAngle = angle;}
+  void SetPHOSOverlapAngle(Float_t angle) {fPHOSOverlapAngle = angle;}
+
  private:
   
+  void CheckOverlap(const Float_t anglethres, const Int_t imom, Int_t & iPrimary, Int_t & index, TLorentzVector & mom, Int_t & pdg);
   void MakePi0Decay(TLorentzVector &p0, TLorentzVector &p1, TLorentzVector &p2) const ;//, Double_t &angle); 
-  void FillCalorimeters(const Int_t iParticle, TParticle* particle, TLorentzVector momentum,   
+  void FillCalorimeters(Int_t & iParticle, TParticle* particle, TLorentzVector momentum,   
                        Int_t &indexPHOS, Int_t &indexEMCAL) ;
   
   private:
@@ -79,8 +88,12 @@ class AliCaloTrackMCReader : public AliCaloTrackReader {
   TArrayI * fStatusArray ; //Keep particles with status of the list.
   Bool_t fKeepAllStatus ; //Do or do not select particles depending on their status code.
   Int_t fClonesArrayType; //Analysis with TParticles or AliAODCaloCluster/Track?
-  
-  ClassDef(AliCaloTrackMCReader,1)
+  Bool_t fCheckOverlap; //Check of overlapped photons from pi0 enter the calorimeter
+  Float_t fEMCALOverlapAngle; //Aperture angle of photons from decay that is not resolved by EMCAL, in radians
+  Float_t fPHOSOverlapAngle; //Aperture angle of photons from decay that is not resolved by PHOS, in radians
+  Int_t fIndex2ndPhoton; //Check overlap of first decay photon already done, internal use.
+
+  ClassDef(AliCaloTrackMCReader,2)
     } ;
 
 
index 67d4b59..e9d5015 100755 (executable)
@@ -139,7 +139,9 @@ TList *  AliAnaPi0EbE::GetCreateOutputObjects()
        fhEtaPi0->SetXTitle("p_{T #pi^{0}} (GeV/c)");\r
        outputContainer->Add(fhEtaPi0) ;\r
        \r
-       if(IsDataMC()){\r
+       if(IsDataMC()) {
+         if((GetReader()->GetDataType() == AliCaloTrackReader::kMC && fAnaType!=kSSCalo) || 
+            GetReader()->GetDataType() != AliCaloTrackReader::kMC){\r
                \r
                fhPtMCPi0  = new TH1F("hPtMCPi0","Identified pi0 from pi0",nptbins,ptmin,ptmax); \r
                fhPtMCPi0->SetYTitle("N");\r
@@ -175,6 +177,7 @@ TList *  AliAnaPi0EbE::GetCreateOutputObjects()
                fhEtaMCNoPi0->SetXTitle("p_{T #pi^{0}} (GeV/c)");\r
                outputContainer->Add(fhEtaMCNoPi0) ;\r
                \r
+       }
        }//Histos with MC\r
     \r
        \r
@@ -275,7 +278,7 @@ void  AliAnaPi0EbE::MakeInvMassInCalorimeter()
                        if(GetNeutralMesonSelection()->SelectPair(mom1, mom2))\r
                        {\r
                                if(GetDebug()>1) \r
-                                       printf("Selected gamma pair: pt %f, phi %f, eta%f \n",(mom1+mom2).Pt(), (mom1+mom2).Phi()*180./3.1416, (mom1+mom2).Eta());\r
+                                       printf("AliAnaPi0EbE::kIMCalo::Selected gamma pair: pt %f, phi %f, eta%f \n",(mom1+mom2).Pt(), (mom1+mom2).Phi()*180./3.1416, (mom1+mom2).Eta());\r
                                \r
                                                //Play with the MC stack if available\r
                                if(IsDataMC()){\r
@@ -283,7 +286,7 @@ void  AliAnaPi0EbE::MakeInvMassInCalorimeter()
                                        tag1 = GetMCAnalysisUtils()->CheckOrigin(photon1->GetLabel(), GetMCStack());\r
                                        tag2 = GetMCAnalysisUtils()->CheckOrigin(photon2->GetLabel(), GetMCStack());\r
                                        \r
-                                       if(GetDebug() > 0) printf("Origin of: photon1 %d; photon2 %d \n",tag1, tag2);\r
+                                       if(GetDebug() > 0) printf("AliAnaPi0EbE::kIMCalo::Origin of: photon1 %d; photon2 %d \n",tag1, tag2);\r
                                        if(tag1 == AliMCAnalysisUtils::kMCPi0Decay && tag2 == AliMCAnalysisUtils::kMCPi0Decay){\r
                                        \r
                                         //Check if pi0 mother is the same\r
@@ -318,7 +321,7 @@ void  AliAnaPi0EbE::MakeInvMassInCalorimeter()
                \r
        }//1st photon loop\r
        \r
-       if(GetDebug() > 1) printf("End fill AODs \n");  \r
+       if(GetDebug() > 1) printf("AliAnaPi0EbE::kIMCalo::End fill AODs \n");  \r
        \r
 }\r
 \r
@@ -354,13 +357,13 @@ void  AliAnaPi0EbE::MakeInvMassInCalorimeterAndCTS()
                        mom2 = *(photon2->Momentum());\r
                        //Select good pair (good phi, pt cuts, aperture and invariant mass)\r
                        if(GetNeutralMesonSelection()->SelectPair(mom1, mom2)){\r
-                               if(GetDebug() > 1) printf("Selected gamma pair: pt %f, phi %f, eta%f\n",(mom1+mom2).Pt(), (mom1+mom2).Phi()*180./3.1416, (mom1+mom2).Eta());\r
+                               if(GetDebug() > 1) printf("AliAnaPi0EbE::kIMCaloCTS::Selected gamma pair: pt %f, phi %f, eta%f\n",(mom1+mom2).Pt(), (mom1+mom2).Phi()*180./3.1416, (mom1+mom2).Eta());\r
                                \r
                                if(IsDataMC()){\r
                                        //Check origin of the candidates\r
                                        tag1 = GetMCAnalysisUtils()->CheckOrigin(photon1->GetLabel(), GetMCStack());\r
                                        tag2 = GetMCAnalysisUtils()->CheckOrigin(photon2->GetLabel(), GetMCStack());\r
-                                       if(GetDebug() > 0) printf("Origin of: photon1 %d; photon2 %d \n",tag1, tag2);\r
+                                       if(GetDebug() > 0) printf("AliAnaPi0EbE::kIMCaloCTS::Origin of: photon1 %d; photon2 %d \n",tag1, tag2);\r
                                        if(tag1 == AliMCAnalysisUtils::kMCPi0Decay && tag2 == AliMCAnalysisUtils::kMCPi0Decay){\r
                                                //Check if pi0 mother is the same\r
                                                Int_t label1 = photon1->GetLabel();\r
@@ -395,7 +398,7 @@ void  AliAnaPi0EbE::MakeInvMassInCalorimeterAndCTS()
                \r
        }//1st photon loop\r
        \r
-       if(GetDebug() > 1) printf("End fill AODs \n");  \r
+       if(GetDebug() > 1) printf("AliAnaPi0EbE::kIMCaloCTS::End fill AODs \n");  \r
        \r
 }\r
 \r
@@ -421,7 +424,7 @@ void  AliAnaPi0EbE::MakeShowerShapeIdentification()
        for(Int_t icalo = 0; icalo < pl->GetEntriesFast(); icalo++){\r
                AliAODCaloCluster * calo = (AliAODCaloCluster*) (pl->At(icalo));        \r
                \r
-               //Cluster selection, not charged, with photon id and in fidutial cut\r
+               //Cluster selection, not charged, with pi0 id and in fidutial cut\r
                //Get Momentum vector, \r
                calo->GetMomentum(mom,vertex);//Assume that come from vertex in straight line\r
                //If too small or big pt, skip it\r
@@ -433,10 +436,13 @@ void  AliAnaPi0EbE::MakeShowerShapeIdentification()
                }\r
                \r
                //Create AOD for analysis\r
-               AliAODPWG4Particle aodph = AliAODPWG4Particle(mom);\r
-               aodph.SetLabel(calo->GetLabel(0));\r
-               aodph.SetDetector(fCalorimeter);\r
-               if(GetDebug() > 1) printf("AliAnaPhoton::FillAOD: Min pt cut and fidutial cut passed: pt %3.2f, phi %2.2f, eta %1.2f\n",aodph.Pt(),aodph.Phi(),aodph.Eta());    \r
+               AliAODPWG4Particle aodpi0 = AliAODPWG4Particle(mom);\r
+               aodpi0.SetLabel(calo->GetLabel(0));\r
+               //Set the indeces of the original caloclusters  
+               aodpi0.SetCaloLabel(calo->GetID(),-1);
+               aodpi0.SetDetector(fCalorimeter);\r
+               if(GetDebug() > 1) 
+                 printf("AliAnaPi0EbE::kSSCalo::::FillAOD: Min pt cut and fidutial cut passed: pt %3.2f, phi %2.2f, eta %1.2f\n",aodpi0.Pt(),aodpi0.Phi(),aodpi0.Eta());       \r
                \r
                //Check Distance to Bad channel, set bit.\r
                Double_t distBad=calo->GetDistToBadChannel() ; //Distance to bad channel\r
@@ -444,20 +450,21 @@ void  AliAnaPi0EbE::MakeShowerShapeIdentification()
                if(distBad < fMinDist) //In bad channel (PHOS cristal size 2.2x2.2 cm)\r
                        continue ;\r
                \r
-               if(GetDebug() > 1) printf("AliAnaPhoton::FillAOD: Bad channel cut passed %4.2f\n",distBad);\r
+               if(GetDebug() > 1) printf("AliAnaPi0EbE::kSSCalo::::FillAOD: Bad channel cut passed %4.2f\n",distBad);\r
                \r
-               if(distBad > fMinDist3) aodph.SetDistToBad(2) ;\r
-               else if(distBad > fMinDist2) aodph.SetDistToBad(1) ; \r
-               else aodph.SetDistToBad(0) ;\r
+               if(distBad > fMinDist3) aodpi0.SetDistToBad(2) ;\r
+               else if(distBad > fMinDist2) aodpi0.SetDistToBad(1) ; \r
+               else aodpi0.SetDistToBad(0) ;\r
                \r
                //Check PID\r
                //PID selection or bit setting\r
                if(GetReader()->GetDataType() == AliCaloTrackReader::kMC){\r
                        //Get most probable PID, check PID weights (in MC this option is mandatory)\r
-                       aodph.SetPdg(GetCaloPID()->GetPdg(fCalorimeter,calo->PID(),mom.E()));//PID with weights\r
-                       if(GetDebug() > 1) printf("AliAnaPhoton::FillAOD: PDG of identified particle %d\n",aodph.GetPdg());\r
-                       //If primary is not photon, skip it.\r
-                       if(aodph.GetPdg() != AliCaloPID::kPhoton) continue ;\r
+                       aodpi0.SetPdg(GetCaloPID()->GetPdg(fCalorimeter,calo->PID(),mom.E()));//PID with weights\r
+                       if(GetDebug() > 1) 
+                         printf("AliAnaPi0EbE::kSSCalo::::FillAOD: PDG of identified particle %d\n",aodpi0.GetPdg());\r
+                       //If primary is not pi0, skip it.\r
+                       if(aodpi0.GetPdg() != AliCaloPID::kPi0) continue ;\r
                }                                       \r
                else if(IsCaloPIDOn()){\r
                        //Skip matched clusters with tracks\r
@@ -466,38 +473,41 @@ void  AliAnaPi0EbE::MakeShowerShapeIdentification()
                        //Get most probable PID, 2 options check PID weights \r
                        //or redo PID, recommended option for EMCal.            \r
                        if(!IsCaloPIDRecalculationOn())\r
-                               aodph.SetPdg(GetCaloPID()->GetPdg(fCalorimeter,calo->PID(),mom.E()));//PID with weights\r
+                               aodpi0.SetPdg(GetCaloPID()->GetPdg(fCalorimeter,calo->PID(),mom.E()));//PID with weights\r
                        else\r
-                               aodph.SetPdg(GetCaloPID()->GetPdg(fCalorimeter,mom,calo));//PID recalculated\r
+                               aodpi0.SetPdg(GetCaloPID()->GetPdg(fCalorimeter,mom,calo));//PID recalculated\r
                        \r
-                       if(GetDebug() > 1) printf("AliAnaPhoton::FillAOD: PDG of identified particle %d\n",aodph.GetPdg());\r
+                       if(GetDebug() > 1) printf("AliAnaPi0EbE::kSSCalo::::FillAOD: PDG of identified particle %d\n",aodpi0.GetPdg());\r
                        \r
-                       //If cluster does not pass pid, not photon, skip it.\r
-                       if(aodph.GetPdg() != AliCaloPID::kPhoton) continue ;                    \r
+                       //If cluster does not pass pid, not pi0, skip it.\r
+                       if(aodpi0.GetPdg() != AliCaloPID::kPi0) continue ;                      \r
                        \r
                }\r
                else{\r
                        //Set PID bits for later selection (AliAnaPi0 for example)\r
                        //GetPDG already called in SetPIDBits.\r
-                       GetCaloPID()->SetPIDBits(fCalorimeter,calo,&aodph);\r
-                       if(GetDebug() > 1) printf("AliAnaPhoton::FillAOD: PID Bits set \n");            \r
+                       GetCaloPID()->SetPIDBits(fCalorimeter,calo,&aodpi0);\r
+                       if(GetDebug() > 1) printf("AliAnaPi0EbE::kSSCalo::::FillAOD: PID Bits set \n");         \r
                }\r
                \r
-               if(GetDebug() > 1) printf("AliAnaPhoton::FillAOD: Photon selection cuts passed: pT %3.2f, pdg %d\n",aodph.Pt(), aodph.GetPdg());\r
+               if(GetDebug() > 1) printf("AliAnaPi0EbE::kSSCalo::::FillAOD: Pi0 selection cuts passed: pT %3.2f, pdg %d\n",aodpi0.Pt(), aodpi0.GetPdg());\r
                \r
                //Play with the MC stack if available\r
                //Check origin of the candidates\r
                if(IsDataMC()){\r
-                       aodph.SetTag(GetMCAnalysisUtils()->CheckOrigin(calo->GetLabel(0),GetMCStack()));\r
-                       if(GetDebug() > 0) printf("AliAnaPi0EbE::FillAOD: Origin of candidate %d\n",aodph.GetTag());\r
+                 if((GetReader()->GetDataType() == AliCaloTrackReader::kMC && fAnaType!=kSSCalo) || 
+                    GetReader()->GetDataType() != AliCaloTrackReader::kMC){\r
+                       aodpi0.SetTag(GetMCAnalysisUtils()->CheckOrigin(calo->GetLabel(0),GetMCStack()));\r
+                       if(GetDebug() > 0) printf("AliAnaPi0EbE::kSSCalo::EbE::FillAOD: Origin of candidate %d\n",aodpi0.GetTag());\r
+                 }
                }//Work with stack also   \r
                \r
-               //Add AOD with photon object to aod branch\r
-               AddAODParticle(aodph);\r
+               //Add AOD with pi0 object to aod branch\r
+               AddAODParticle(aodpi0);\r
                \r
        }//loop\r
        \r
-       if(GetDebug() > 1) printf("AliAnaPhoton::FillAOD: End fill AODs \n");  \r
+       if(GetDebug() > 1) printf("AliAnaPi0EbE::kSSCalo::::FillAOD: End fill AODs \n");  \r
        \r
 }\r
 //__________________________________________________________________\r
@@ -510,7 +520,7 @@ void  AliAnaPi0EbE::MakeAnalysisFillHistograms()
        \r
        //Loop on stored AOD pi0\r
        Int_t naod = GetOutputAODBranch()->GetEntriesFast();\r
-       if(GetDebug() > 0) printf("pi0 aod branch entries %d\n", naod);\r
+       if(GetDebug() > 0) printf("AliAnaPi0EbE::Histo::pi0 aod branch entries %d\n", naod);\r
        \r
        for(Int_t iaod = 0; iaod < naod ; iaod++){\r
                \r
@@ -530,6 +540,8 @@ void  AliAnaPi0EbE::MakeAnalysisFillHistograms()
                fhEtaPi0 ->Fill(pt,eta);\r
                \r
                if(IsDataMC()){\r
+                 if((GetReader()->GetDataType() == AliCaloTrackReader::kMC && fAnaType!=kSSCalo) || 
+                    GetReader()->GetDataType() != AliCaloTrackReader::kMC){\r
                        if(pi0->GetTag()== AliMCAnalysisUtils::kMCPi0){\r
                                fhPtMCPi0  ->Fill(pt);\r
                                fhPhiMCPi0 ->Fill(pt,phi);\r
@@ -540,6 +552,7 @@ void  AliAnaPi0EbE::MakeAnalysisFillHistograms()
                                fhPhiMCNoPi0 ->Fill(pt,phi);\r
                                fhEtaMCNoPi0 ->Fill(pt,eta);\r
                        }\r
+                 }
                }//Histograms with MC\r
                \r
        }// aod loop\r
@@ -547,6 +560,23 @@ void  AliAnaPi0EbE::MakeAnalysisFillHistograms()
 }\r
 \r
 \r
+//____________________________________________________________________________
+void AliAnaPi0EbE::Init()
+{
+  
+  //Init
+  //Do some checks
+  if(fCalorimeter == "PHOS" && !GetReader()->IsPHOSSwitchedOn()){
+    printf("!!ABORT: You want to use PHOS in analysis but it is not read!! \n!!Check the configuration file!!\n");
+    abort();
+  }
+  else  if(fCalorimeter == "EMCAL" && !GetReader()->IsEMCALSwitchedOn()){
+    printf("!!ABORT: You want to use EMCAL in analysis but it is not read!! \n!!Check the configuration file!!\n");
+    abort();
+  }
+  
+}
+
 //____________________________________________________________________________\r
 void AliAnaPi0EbE::InitParameters()\r
 {\r
@@ -556,7 +586,7 @@ void AliAnaPi0EbE::InitParameters()
        SetOutputAODName("pi0s");\r
        fInputAODGammaConvName = "gammaconv" ;\r
        fAnaType = kIMCalo ;\r
-       fCalorimeter = "PHOS" ;\r
+       fCalorimeter = "EMCAL" ;\r
        fMinDist  = 2.;\r
        fMinDist2 = 4.;\r
        fMinDist3 = 5.;\r
index 26a7162..5a34a94 100755 (executable)
@@ -39,6 +39,7 @@ public:
        \r
        TList *  GetCreateOutputObjects();\r
        \r
+       void Init();
        void InitParameters();\r
        \r
        void MakeAnalysisFillAOD()  ;\r