]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Unified ESD and AOD usage (AliVParticle) / Some Minor Cleanup (Jochen Thaeder <jochen...
authormiweber <miweber@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sun, 24 Mar 2013 10:02:10 +0000 (10:02 +0000)
committermiweber <miweber@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sun, 24 Mar 2013 10:02:10 +0000 (10:02 +0000)
PWGCF/EBYE/NetParticle/AliAnalysisNetParticleDistribution.cxx
PWGCF/EBYE/NetParticle/AliAnalysisNetParticleDistribution.h
PWGCF/EBYE/NetParticle/AliAnalysisNetParticleEffCont.cxx
PWGCF/EBYE/NetParticle/AliAnalysisNetParticleEffCont.h
PWGCF/EBYE/NetParticle/AliAnalysisNetParticleHelper.cxx
PWGCF/EBYE/NetParticle/AliAnalysisNetParticleHelper.h

index 23d962485c0c0235456dba49cf60a0e2e833f85e..843a9a0d6531349c13339ba883ed04bb68f004ca 100644 (file)
@@ -251,9 +251,9 @@ Int_t AliAnalysisNetParticleDistribution::Process() {
   else if (fAOD) 
     ProcessAODTracks();
     
-  // -- Fill MC truth particles (missing for AOD XXX)
+  // -- Fill MC truth particles (missing for AOD MW - However AliVParticle already used)
   if (fIsMC)
-    ProcessStackParticles();
+    ProcessParticles();
 
   return 0;
 }
@@ -446,13 +446,14 @@ Int_t AliAnalysisNetParticleDistribution::ProcessAODTracks() {
 }
 
 //________________________________________________________________________
-Int_t AliAnalysisNetParticleDistribution::ProcessStackParticles() {
+Int_t AliAnalysisNetParticleDistribution::ProcessParticles() {
   // -- Process primary particles from the stack and fill histograms
 
   Int_t pdgCode    = AliPID::ParticleCode(fHelper->GetParticleSpecies());
   
   for (Int_t idxMC = 0; idxMC < fStack->GetNprimary(); ++idxMC) {
-    TParticle* particle = fStack->Particle(idxMC);
+    AliVParticle* particle = (fESD) ? fMCEvent->GetTrack(idxMC) : NULL;
+
     if (!particle) 
       continue;
 
@@ -461,7 +462,7 @@ Int_t AliAnalysisNetParticleDistribution::ProcessStackParticles() {
       continue;
     
     // -- Check if particle / anti-particle
-    if (fHelper->GetUsePID() && TMath::Abs(particle->GetPdgCode()) != pdgCode)
+    if (fHelper->GetUsePID() && TMath::Abs(particle->PdgCode()) != pdgCode)
       continue;
     
     // -- Check rapidity window -- for identfied particles
@@ -478,8 +479,7 @@ Int_t AliAnalysisNetParticleDistribution::ProcessStackParticles() {
     //  idxPart = 0 -> anti particle
     //  idxPart = 1 -> particle
 
-    Int_t idxPart = (particle->GetPdgCode() < 0) ? 0 : 1;
-
+    Int_t idxPart = (particle->PdgCode() < 0) ? 0 : 1;
 
     // -- MCrapidity for identfied particles
     //    MCeta for charged particles
index a78262660070fe1a2976bf848d7244e92ea0c8c8..a8c5d378239125a6bfeffa98315efaa1aba7851f 100644 (file)
@@ -80,7 +80,7 @@ class AliAnalysisNetParticleDistribution : public TNamed {
   Int_t ProcessAODTracks();
 
   /** Process primary particles from the stack and fill histograms */
-  Int_t ProcessStackParticles();
+  Int_t ProcessParticles();
   
   /*
    * ---------------------------------------------------------------------------------
index fa748613b3a7ea5f016e8ed119e17763f814086b..43da676359819187289dbe4cc7fea0f836e0d306 100644 (file)
@@ -128,13 +128,13 @@ Int_t AliAnalysisNetParticleEffCont::SetupEvent(AliESDInputHandler *esdHandler,
   // -- Setup of event
   // -------------------
   
-  // -- Get ESD objects                                                                                                                                
+  // -- Get ESD objects
   if(esdHandler) {
     fESD     = esdHandler->GetEvent(); 
     fNTracks = fESD->GetNumberOfTracks();
   }
-                                                                                                                                                       
-  // -- Get AOD objects                                                                                                                                
+  
+  // -- Get AOD objects
   else if(aodHandler) {
     fAOD     = aodHandler->GetEvent();
     fNTracks = fAOD->GetNumberOfTracks();
@@ -144,7 +144,7 @@ Int_t AliAnalysisNetParticleEffCont::SetupEvent(AliESDInputHandler *esdHandler,
       AliFatal("No array of MC particles found !!!"); // MW  no AliFatal use return values
   }           
 
-  // -- Get MC objects                                                                                                                                 
+  // -- Get MC objects
   if (mcEvent) {
     fMCEvent     = mcEvent;
     if (fMCEvent)
@@ -198,10 +198,7 @@ void AliAnalysisNetParticleEffCont::Process() {
  
   // -- Fill  MC histograms for efficiency studies
   // -----------------------------------------------
-  if(fESD)
-    FillMCEffHist();
-  else if(fAOD)
-    FillMCEffHistAOD();
+  FillMCEffHist();
 
   return;
 }      
@@ -388,10 +385,7 @@ void AliAnalysisNetParticleEffCont::FillMCLabels() {
     fLabelsRec[1][idxTrack] = label;    
     
     // -- Check for contamination and fill contamination THnSparse
-    if (fESD)
-      CheckContTrack(label, track->Charge(), idxTrack);
-    else if (fAOD)
-      CheckContTrackAOD(label, track->Charge(), idxTrack);
+    CheckContTrack(label, track->Charge(), idxTrack);
 
   } // for (Int_t idxTrack = 0; idxTrack < fNTracks; ++idxTrack) {
 
@@ -400,143 +394,51 @@ void AliAnalysisNetParticleEffCont::FillMCLabels() {
 
 //________________________________________________________________________
 void AliAnalysisNetParticleEffCont::CheckContTrack(Int_t label, Float_t sign, Int_t idxTrack) {
-  // Check if particle is contamination or correctly identified for ESDs
+  // Check if particle is contamination or correctly identified for ESDs and AODs
+  // Check for missidentified primaries and secondaries
   // Fill contamination THnSparse
 
-  TParticle* particle = fStack->Particle(label);
+  AliVParticle* particle = (fESD) ? fMCEvent->GetTrack(label) : static_cast<AliVParticle*>(fArrayMC->At(label));
   if (!particle)
     return;
 
-  Bool_t isSecondaryFromWeakDecay = kFALSE;
-  Bool_t isSecondaryFromMaterial  = kFALSE;
+  Bool_t isPhysicalPrimary = (fESD) ? fStack->IsPhysicalPrimary(label): (static_cast<AliAODMCParticle*>(particle))->IsPhysicalPrimary();
   
   // -- Check if correctly identified 
-  //    > Check for Primaries and Secondaries
+  //    > return if correctly identified -> all ok, no action neededin this method
+  //    > if PID required check -> for the correct (signed pdgcode) particle
+  //    > no PID just check for primary 
   if (fHelper->GetUsePID()) {
-    if (particle->GetPdgCode() == (sign*fPdgCode)) {
-      
-      // Check if is physical primary -> all ok 
-      if (fStack->IsPhysicalPrimary(label))
+    if (particle->PdgCode() == (sign*fPdgCode))
+      if (isPhysicalPrimary)
        return;
-      
-      // -- Check if secondaries from material or weak decay
-      isSecondaryFromWeakDecay = fStack->IsSecondaryFromWeakDecay(label);
-      isSecondaryFromMaterial  = fStack->IsSecondaryFromMaterial(label);
-    } 
   }
-
-  // -- If no PID is required 
-  //    > only check for Primaries and Secondaries  
   else {
-    // Check if is physical primary -> all ok 
-    if (fStack->IsPhysicalPrimary(label))
+    if (isPhysicalPrimary)
       return;
-    
-    // -- Check if secondaries from material or weak decay
-    isSecondaryFromWeakDecay = fStack->IsSecondaryFromWeakDecay(label);
-    isSecondaryFromMaterial  = fStack->IsSecondaryFromMaterial(label);
-  }
-
-  // -- Get PDG Charge
-  Float_t contSign = 0.;
-  if      (particle->GetPDG()->Charge() == 0.) contSign =  0.;
-  else if (particle->GetPDG()->Charge() <  0.) contSign = -1.; 
-  else if (particle->GetPDG()->Charge() >  0.) contSign =  1.; 
-
-  // -- Get contaminating particle
-  Float_t contPart = 0;
-  if        (isSecondaryFromWeakDecay)                   contPart = 7; // probeParticle from WeakDecay
-  else if   (isSecondaryFromMaterial)                    contPart = 8; // probeParticle from Material
-  else {
-    if      (TMath::Abs(particle->GetPdgCode()) ==  211) contPart = 1; // pion
-    else if (TMath::Abs(particle->GetPdgCode()) ==  321) contPart = 2; // kaon
-    else if (TMath::Abs(particle->GetPdgCode()) == 2212) contPart = 3; // proton
-    else if (TMath::Abs(particle->GetPdgCode()) ==   11) contPart = 4; // electron
-    else if (TMath::Abs(particle->GetPdgCode()) ==   13) contPart = 5; // muon
-    else                                                 contPart = 6; // other
-  }
-  
-  // -- Get Reconstructed values 
-  Float_t etaRec = 0.;
-  Float_t phiRec = 0.;
-  Float_t ptRec  = 0.;
-  Double_t yRec  = 0.;
-
-  AliESDtrack *track = fESD->GetTrack(idxTrack);
-  if (track) {
-    // if no track present (which should not happen)
-    // -> pt = 0. , which is not in the looked at range
-    
-    // -- Get Reconstructed eta/phi/pt/y
-    etaRec = track->Eta();
-    phiRec = track->Phi();       
-    ptRec  = track->Pt();
-    fHelper->IsTrackAcceptedRapidity(track, yRec); // yRec = y for identified particles | yRec = eta for charged particles
-  }    
-
-  // -- Fill THnSparse
-  Double_t hnCont[12] = {fCentralityBin, particle->Eta(), particle->Y(), particle->Phi(), particle->Pt(), sign, 
-                        contPart, contSign, etaRec, yRec, phiRec, ptRec};
-  fHnCont->Fill(hnCont);
-}
-
-//________________________________________________________________________
-void AliAnalysisNetParticleEffCont::CheckContTrackAOD(Int_t label, Float_t sign, Int_t idxTrack) {
-  // Check if particle is contamination or correctly identified for AODs
-  // Fill contamination THnSparse
-  
-  AliAODMCParticle* particle = static_cast<AliAODMCParticle*>(fArrayMC->At(label));
-
-  if (!particle)
-    return;
-
-  Bool_t isSecondaryFromWeakDecay = kFALSE;
-  Bool_t isSecondaryFromMaterial  = kFALSE;
-  
-  // -- Check if correctly identified 
-  //    > Check for Primaries and Secondaries
-  if (fHelper->GetUsePID()) {
-    if (particle->GetPdgCode() == (sign*fPdgCode)) {
-      
-      // Check if is physical primary -> all ok 
-      if (particle->IsPhysicalPrimary())
-       return;
-      
-      // -- Check if secondaries from material or weak decay
-      isSecondaryFromWeakDecay = particle->IsSecondaryFromWeakDecay();
-      isSecondaryFromMaterial  = particle->IsSecondaryFromMaterial();
-    } 
   }
 
-  // -- If no PID is required 
-  //    > only check for Primaries and Secondaries  
-  else {
-   // Check if is physical primary -> all ok 
-    if (particle->IsPhysicalPrimary())
-      return;
-    
-    // -- Check if secondaries from material or weak decay
-    isSecondaryFromWeakDecay = particle->IsSecondaryFromWeakDecay();
-    isSecondaryFromMaterial  = particle->IsSecondaryFromMaterial();
-  }
+  // -- Check if secondaries from material or weak decay
+  Bool_t isSecondaryFromWeakDecay = (fESD) ? fStack->IsSecondaryFromWeakDecay(label) : (static_cast<AliAODMCParticle*>(particle))->IsSecondaryFromWeakDecay();
+  Bool_t isSecondaryFromMaterial  = (fESD) ? fStack->IsSecondaryFromMaterial(label)  : (static_cast<AliAODMCParticle*>(particle))->IsSecondaryFromMaterial();
 
   // -- Get PDG Charge
   Float_t contSign = 0.;
   if      (particle->Charge() == 0.) contSign =  0.;
-  else if (particle->Charge()  < 0.) contSign = -1.;
-  else if (particle->Charge()  > 0.) contSign =  1.;
+  else if (particle->Charge() <  0.) contSign = -1.;   
+  else if (particle->Charge() >  0.) contSign =  1.;   
 
   // -- Get contaminating particle
   Float_t contPart = 0;
-  if        (isSecondaryFromWeakDecay)                   contPart = 7; // probeParticle from WeakDecay
-  else if   (isSecondaryFromMaterial)                    contPart = 8; // probeParticle from Material
+  if        (isSecondaryFromWeakDecay)                contPart = 7; // probeParticle from WeakDecay
+  else if   (isSecondaryFromMaterial)                 contPart = 8; // probeParticle from Material
   else {
-    if      (TMath::Abs(particle->GetPdgCode()) ==  211) contPart = 1; // pion
-    else if (TMath::Abs(particle->GetPdgCode()) ==  321) contPart = 2; // kaon
-    else if (TMath::Abs(particle->GetPdgCode()) == 2212) contPart = 3; // proton
-    else if (TMath::Abs(particle->GetPdgCode()) ==   11) contPart = 4; // electron
-    else if (TMath::Abs(particle->GetPdgCode()) ==   13) contPart = 5; // muon
-    else                                                 contPart = 6; // other
+    if      (TMath::Abs(particle->PdgCode()) ==  211) contPart = 1; // pion
+    else if (TMath::Abs(particle->PdgCode()) ==  321) contPart = 2; // kaon
+    else if (TMath::Abs(particle->PdgCode()) == 2212) contPart = 3; // proton
+    else if (TMath::Abs(particle->PdgCode()) ==   11) contPart = 4; // electron
+    else if (TMath::Abs(particle->PdgCode()) ==   13) contPart = 5; // muon
+    else                                              contPart = 6; // other
   }
   
   // -- Get Reconstructed values 
@@ -545,8 +447,8 @@ void AliAnalysisNetParticleEffCont::CheckContTrackAOD(Int_t label, Float_t sign,
   Float_t ptRec  = 0.;
   Double_t yRec  = 0.;
 
-  AliAODTrack *track = fAOD->GetTrack(idxTrack);
-  
+  AliVTrack *track = (fESD) ? static_cast<AliVTrack*>(fESD->GetTrack(idxTrack)) : static_cast<AliVTrack*>(fAOD->GetTrack(idxTrack)); 
+
   if (track) {
     // if no track present (which should not happen)
     // -> pt = 0. , which is not in the looked at range
@@ -567,14 +469,14 @@ void AliAnalysisNetParticleEffCont::CheckContTrackAOD(Int_t label, Float_t sign,
 //________________________________________________________________________
 void AliAnalysisNetParticleEffCont::FillMCEffHist() {
   // Fill efficiency THnSparse for ESDs
-  
-  Int_t nPart  = fStack->GetNprimary();
-  
+
   Float_t etaRange[2];
   fESDTrackCuts->GetEtaRange(etaRange[0],etaRange[1]);
 
+  Int_t nPart  = (fESD) ? fStack->GetNprimary() : fArrayMC->GetEntriesFast();
+
   for (Int_t idxMC = 0; idxMC < nPart; ++idxMC) {
-    TParticle* particle = fStack->Particle(idxMC);
+    AliVParticle* particle = (fESD) ? fMCEvent->GetTrack(idxMC) : static_cast<AliVParticle*>(fArrayMC->At(idxMC));
 
     // -- Check basic MC properties -> charged physical primary
     if (!fHelper->IsParticleAcceptedBasicCharged(particle, idxMC))
@@ -591,14 +493,14 @@ void AliAnalysisNetParticleEffCont::FillMCEffHist() {
 
     // -- Check if probeParticle / anti-probeParticle 
     //    > skip check if PID is not required
-    if (fHelper->GetUsePID() && TMath::Abs(particle->GetPdgCode()) != fPdgCode)
+    if (fHelper->GetUsePID() && TMath::Abs(particle->PdgCode()) != fPdgCode)
       continue;
     
     // -- Get sign of particle
-    Float_t sign      = (particle->GetPdgCode() < 0) ? -1. : 1.;
+    Float_t sign      = (particle->PdgCode() < 0) ? -1. : 1.;
 
-    // -- Get if particle is findable 
-    Float_t findable  = Float_t(fHelper->IsParticleFindable(idxMC));
+    // -- Get if particle is findable --- not availible for AODs yet
+    Float_t findable  = (fESD) ? Float_t(fHelper->IsParticleFindable(idxMC)) : 1.;
 
     // -- Get recStatus and pidStatus
     Float_t recStatus = 0.;
@@ -617,112 +519,34 @@ void AliAnalysisNetParticleEffCont::FillMCEffHist() {
        
        if (idxMC == fLabelsRec[1][idxRec])
          recPid = 1.;
-
-       AliESDtrack *track = fESD->GetTrack(idxRec);
-       if (track) {
-         // if no track present (which should not happen)
-         // -> pt = 0. , which is not in the looked at range
-
-         // -- Get Reconstructed eta/phi/pt/y
-         etaRec = track->Eta();
-         phiRec = track->Phi();          
-         ptRec  = track->Pt();
-         fHelper->IsTrackAcceptedRapidity(track, yRec); // yRec = y for identified particles | yRec = eta for charged particles
-       }       
-       break;
-      }
-    } // for (Int_t idxRec=0; idxRec < fNTracks; ++idxRec) {  
-    
-    // -- Fill THnSparse
-    Double_t hnEff[15] = {fCentralityBin, particle->Eta(), particle->Y(), particle->Phi(), particle->Pt(), sign, 
-                         findable, recStatus, recPid, etaRec, yRec, phiRec, ptRec};
-    fHnEff->Fill(hnEff);
-
-  } // for (Int_t idxMC = 0; idxMC < nPart; ++idxMC) {
-  
-  return;
-}
-
-//________________________________________________________________________
-void AliAnalysisNetParticleEffCont::FillMCEffHistAOD() {
-  // Fill efficiency THnSparse for AODs
-  
-  Int_t nPart  = fArrayMC->GetEntriesFast();
-  Float_t etaRange[2];
-  fESDTrackCuts->GetEtaRange(etaRange[0],etaRange[1]);
-
-  for (Int_t idxMC = 0; idxMC < nPart; ++idxMC) {
-    
-    AliAODMCParticle* particle = static_cast<AliAODMCParticle*>(fArrayMC->At(idxMC));
-             
-    // -- Check basic MC properties -> charged physical primary
-    if (!fHelper->IsParticleAcceptedBasicCharged(particle))
-      continue;
-
-    // -- Check if accepted in rapidity window -- for identified particles
-    Double_t yMC;
-    if (fHelper->GetUsePID() && !fHelper->IsParticleAcceptedRapidity(particle, yMC))
-      continue;
-
-    // -- Check if accepted in eta window -- for charged particles
-    if (!fHelper->GetUsePID() && TMath::Abs(particle->Eta()) > etaRange[1])
-      continue;
-
-    // -- Check if probeParticle / anti-probeParticle 
-    //    > skip check if PID is not required
-    if (fHelper->GetUsePID() && TMath::Abs(particle->GetPdgCode()) != fPdgCode)
-      continue;
-        
-    // -- Get sign of particle
-    Float_t sign      = (particle->GetPdgCode() < 0) ? -1. : 1.;
-
-    // -- Get if particle is findable 
-    Float_t findable  = 1.;// Float_t(fHelper->IsParticleFindable(idxMC)); XXX
-
-    // -- Get recStatus and pidStatus
-    Float_t recStatus = 0.;
-    Float_t recPid    = 0.;
-
-    // -- Get Reconstructed values 
-    Float_t etaRec = 0.;
-    Float_t phiRec = 0.;
-    Float_t ptRec  = 0.;
-    Double_t yRec  = 0.;
-
-    // -- Loop over all labels
-    for (Int_t idxRec=0; idxRec < fNTracks; ++idxRec) {
-      if (idxMC == fLabelsRec[0][idxRec]) {
-       recStatus = 1.;
        
-       if (idxMC == fLabelsRec[1][idxRec])
-         recPid = 1.;
-
-       AliVTrack *track = NULL;
-       if(fESD)
-         track = fESD->GetTrack(idxRec);
-       else if(fAOD)
-         track = fAOD->GetTrack(idxRec);
-
-       if (track) {
-         // if no track present (which should not happen)
-         // -> pt = 0. , which is not in the looked at range
-
-         // -- Get Reconstructed eta/phi/pt/y
-         etaRec = track->Eta();
-         phiRec = track->Phi();          
-         ptRec  = track->Pt();
-         fHelper->IsTrackAcceptedRapidity(track, yRec); // yRec = y for identified particles | yRec = eta for charged particles
-       }       
-       break;
+        AliVTrack *track = NULL;
+        if(fESD)
+          track = fESD->GetTrack(idxRec);
+        else if(fAOD)
+          track = fAOD->GetTrack(idxRec);
+       
+        if (track) {
+          // if no track present (which should not happen)
+          // -> pt = 0. , which is not in the looked at range
+         
+          // -- Get Reconstructed eta/phi/pt/y
+          etaRec = track->Eta();
+          phiRec = track->Phi();         
+          ptRec  = track->Pt();
+          fHelper->IsTrackAcceptedRapidity(track, yRec); // yRec = y for identified particles | yRec = eta for charged particles
+        }      
+        break;
       }
     } // for (Int_t idxRec=0; idxRec < fNTracks; ++idxRec) {  
     
     // -- Fill THnSparse
     Double_t hnEff[15] = {fCentralityBin, particle->Eta(), particle->Y(), particle->Phi(), particle->Pt(), sign, 
-                         findable, recStatus, recPid, etaRec, yRec, phiRec, ptRec};
+                         findable, recStatus, recPid, etaRec, yRec, phiRec, ptRec};
     fHnEff->Fill(hnEff);
 
   } // for (Int_t idxMC = 0; idxMC < nPart; ++idxMC) {
   
   return;
+  AliInfo("STOP");
 }
index 9091d09cd8d4a5010cf4d4967d09212c8f9a8d7a..1fe6c7583587c1d74ef49e02364106c34c61d8cb 100644 (file)
@@ -86,11 +86,9 @@ class AliAnalysisNetParticleEffCont : public TNamed {
 
   /** Fill efficiency THnSparse */
   void FillMCEffHist();
-  void FillMCEffHistAOD();
 
   /** Check if particle is contamination */
   void CheckContTrack(Int_t label, Float_t sign, Int_t idxTrack);
-  void CheckContTrackAOD(Int_t label, Float_t sign, Int_t idxTrack);
       
   /*
    * ---------------------------------------------------------------------------------
index 9ae0c14cda2fe25c6f9dc5b7e0ffbf7b660e02f6..9f15769aa0996623d24937fd69d8f608b0533d9d 100644 (file)
@@ -445,29 +445,7 @@ Bool_t AliAnalysisNetParticleHelper::IsEventRejected() {
  */
 
 //________________________________________________________________________
-Bool_t AliAnalysisNetParticleHelper::IsParticleAcceptedBasicCharged(TParticle *particle, Int_t idxMC) {
-  // -- Check if MC particle is accepted for basic parameters
-  
-  if (!particle) 
-    return kFALSE;
-
-  // -- check if PDF code exists
-  if (!particle->GetPDG()) 
-    return kFALSE;
-    
-  // -- check if charged
-  if (particle->GetPDG()->Charge() == 0.0) 
-    return kFALSE;
-      
-  // -- check if physical primary
-  if(!fStack->IsPhysicalPrimary(idxMC)) 
-    return kFALSE;
-        
-  return kTRUE;
-}
-
-//________________________________________________________________________
-Bool_t AliAnalysisNetParticleHelper::IsParticleAcceptedBasicCharged(AliAODMCParticle *particle) {
+Bool_t AliAnalysisNetParticleHelper::IsParticleAcceptedBasicCharged(AliVParticle *particle, Int_t idxMC) {
   // -- Check if MC particle is accepted for basic parameters
   
   if (!particle) 
@@ -477,36 +455,22 @@ Bool_t AliAnalysisNetParticleHelper::IsParticleAcceptedBasicCharged(AliAODMCPart
   if (particle->Charge() == 0.0) 
     return kFALSE;
   
-  // -- check if physical primary
-  if(!particle->IsPhysicalPrimary()) 
-    return kFALSE;
-        
-  return kTRUE;
-}
-
-//________________________________________________________________________
-Bool_t AliAnalysisNetParticleHelper::IsParticleAcceptedBasicNeutral(TParticle *particle, Int_t idxMC) {
-  // -- Check if MC particle is accepted for basic parameters
+  // -- check if physical primary - ESD
+  if (fESD) {
+    if(!fStack->IsPhysicalPrimary(idxMC)) 
+      return kFALSE;
+  }
+  // -- check if physical primary - AOD
+  else {
+    if(!(static_cast<AliAODMCParticle*>(particle))->IsPhysicalPrimary()) 
+      return kFALSE;
+  }
   
-  if (!particle) 
-    return kFALSE;
-
-  // -- check if PDF code exists
-  if (!particle->GetPDG()) 
-    return kFALSE;
-    
-  // -- check if neutral
-  if (particle->GetPDG()->Charge() != 0.0) 
-    return kFALSE;
-      
-  // -- check if physical primary
-  if(!fStack->IsPhysicalPrimary(idxMC)) 
-    return kFALSE;
-        
   return kTRUE;
 }
+
 //________________________________________________________________________
-Bool_t AliAnalysisNetParticleHelper::IsParticleAcceptedBasicNeutral(AliAODMCParticle *particle) {
+Bool_t AliAnalysisNetParticleHelper::IsParticleAcceptedBasicNeutral(AliVParticle *particle, Int_t idxMC) {
   // -- Check if MC particle is accepted for basic parameters
   
   if (!particle) 
@@ -516,44 +480,23 @@ Bool_t AliAnalysisNetParticleHelper::IsParticleAcceptedBasicNeutral(AliAODMCPart
   if (particle->Charge() != 0.0) 
     return kFALSE;
   
-  // -- check if physical primary
-  if(!particle->IsPhysicalPrimary()) 
-    return kFALSE;
-        
-  return kTRUE;
-}
-
-//________________________________________________________________________
-Bool_t AliAnalysisNetParticleHelper::IsParticleAcceptedRapidity(TParticle *particle, Double_t &yP) {
-  // -- Check if particle is accepted
-  // > in rapidity
-  // > if no pid : return kTRUE, yP = eta
-  // > return 0 if not accepted
-
-  if (!fUsePID) {
-    yP = particle->Eta();
-    return kTRUE;
+  // -- check if physical primary - ESD
+  if (fESD) {
+    if(!fStack->IsPhysicalPrimary(idxMC)) 
+      return kFALSE;
+  }
+  // -- check if physical primary - AOD
+  else {
+    if(!(static_cast<AliAODMCParticle*>(particle))->IsPhysicalPrimary()) 
+      return kFALSE;
   }
-
-  Double_t mP = AliPID::ParticleMass(fParticleSpecies);
-
-  // -- Calculate rapidities and kinematics
-  Double_t p  = particle->P();
-  Double_t pz = particle->Pz();
-
-  Double_t eP = TMath::Sqrt(p*p + mP*mP);
-  yP          = 0.5 * TMath::Log((eP + pz) / (eP - pz));  
-
-  // -- Check Rapidity window
-  if (TMath::Abs(yP) > fRapidityMax)
-    return kFALSE;
   
   return kTRUE;
 }
 
 //________________________________________________________________________
-Bool_t AliAnalysisNetParticleHelper::IsParticleAcceptedRapidity(AliAODMCParticle *particle, Double_t &yP) {
-  // -- Check if AOD particle is accepted
+Bool_t AliAnalysisNetParticleHelper::IsParticleAcceptedRapidity(AliVParticle *particle, Double_t &yP) {
+  // -- Check if particle is accepted
   // > in rapidity
   // > if no pid : return kTRUE, yP = eta
   // > return 0 if not accepted
@@ -580,7 +523,7 @@ Bool_t AliAnalysisNetParticleHelper::IsParticleAcceptedRapidity(AliAODMCParticle
 }
 
 //________________________________________________________________________
-Bool_t AliAnalysisNetParticleHelper::IsParticleAcceptedPhi(TParticle *particle) {
+Bool_t AliAnalysisNetParticleHelper::IsParticleAcceptedPhi(AliVParticle *particle) {
   // -- Check if particle is accepted
   // > in phi
   // > return 0 if not accepted
@@ -593,20 +536,6 @@ Bool_t AliAnalysisNetParticleHelper::IsParticleAcceptedPhi(TParticle *particle)
     return kFALSE;
 }
 
-//________________________________________________________________________
-Bool_t AliAnalysisNetParticleHelper::IsParticleAcceptedPhi(AliAODMCParticle *particle) {
-  // -- Check if AOD particle is accepted
-  // > in phi
-  // > return 0 if not accepted
-  
-  if (particle->Phi() > fPhiMin && particle->Phi() <= fPhiMax)
-    return kTRUE;
-  else if (particle->Phi() < fPhiMin && (particle->Phi() + TMath::TwoPi()) <= fPhiMax)
-    return kTRUE;
-  else
-    return kFALSE;
-}
-
 //_____________________________________________________________________________
 Bool_t AliAnalysisNetParticleHelper::IsParticleFindable(Int_t label) {
   // -- Check if MC particle is findable tracks
index a5b0947e6ef7dd5042c1e9433132bd420b731eb8..e792f4c528d445bea78b5aa6e70eb64ef421c3d7 100644 (file)
@@ -15,7 +15,6 @@
 
 #include "THnBase.h"
 #include "THn.h"
-#include "TParticle.h"
 #include "TH1F.h"
 #include "TF1.h"
 
@@ -29,6 +28,7 @@ class AliAODInputHandler;
 class AliAODEvent;
 class AliAODTrack;
 class AliAODMCParticle;
+class AliMCParticle;
 
 class AliAnalysisNetParticleHelper : public TNamed {
 
@@ -123,23 +123,17 @@ class AliAnalysisNetParticleHelper : public TNamed {
    * ---------------------------------------------------------------------------------
    */
   
-  /** Check if charged MC particle is accepted for basic parameters
-      NOT possible for AODs (AliAODMCParticle NOT from TParticle) */
-  Bool_t IsParticleAcceptedBasicCharged(TParticle *particle, Int_t idxMC);
-  Bool_t IsParticleAcceptedBasicCharged(AliAODMCParticle *particle);
-
-  /** Check if neutral MC particle is accepted for basic parameters
-      NOT possible for AODs (AliAODMCParticle NOT from TParticle) */
-  Bool_t IsParticleAcceptedBasicNeutral(TParticle *particle, Int_t idxMC);
-  Bool_t IsParticleAcceptedBasicNeutral(AliAODMCParticle *particle);
+  /** Check if charged MC particle is accepted for basic parameters */
+  Bool_t IsParticleAcceptedBasicCharged(AliVParticle *particle, Int_t idxMC);
+
+  /** Check if neutral MC particle is accepted for basic parameters */
+  Bool_t IsParticleAcceptedBasicNeutral(AliVParticle *particle, Int_t idxMC);
  
   /** Check if MC particle is accepted for Rapidity */
-  Bool_t IsParticleAcceptedRapidity(TParticle *particle, Double_t &yP);
-  Bool_t IsParticleAcceptedRapidity(AliAODMCParticle *particle, Double_t &yP);
+  Bool_t IsParticleAcceptedRapidity(AliVParticle *particle, Double_t &yP);
 
   /** Check if MC particle is accepted for Phi */
-  Bool_t IsParticleAcceptedPhi(TParticle *particle);
-  Bool_t IsParticleAcceptedPhi(AliAODMCParticle *particle);
+  Bool_t IsParticleAcceptedPhi(AliVParticle *particle);
 
   /** Check if MC particle is findable tracks */
   Bool_t IsParticleFindable(Int_t label);