]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PWG2/SPECTRA/AliProtonSpectraCorrection.cxx
obsolte code -> removed
[u/mrichter/AliRoot.git] / PWG2 / SPECTRA / AliProtonSpectraCorrection.cxx
index 65f7dfe91b70e032bbbb6b7cf035b4a1c795dc56..e4c2cc9efe1ab3962e6b728004bc83b4a86b9652 100644 (file)
@@ -206,39 +206,41 @@ void AliProtonSpectraCorrection::FillCorrectionMaps(AliESDEvent *esd,
 
     //Protons
     //check the MC-level cuts
-    if (fCFManagerProtons->CheckParticleCuts(AliCFManager::kPartGenCuts,
-                                            mcPart)) {
-      containerInput[0] = (Float_t)mcPart->Eta();
-      containerInput[1] = (Float_t)mcPart->Pt();
-      //fill the container for Gen-level selection
-      fCFManagerProtons->GetParticleContainer()->Fill(containerInput,
-                                                     kStepGenerated);
-      //check the Acceptance-level cuts
-      if (fCFManagerProtons->CheckParticleCuts(AliCFManager::kPartAccCuts,
+    if (mcPart){
+      if (fCFManagerProtons->CheckParticleCuts(AliCFManager::kPartGenCuts,
                                               mcPart)) {
-       //fill the container for Acceptance-level selection
+       containerInput[0] = (Float_t)mcPart->Eta();
+       containerInput[1] = (Float_t)mcPart->Pt();
+       //fill the container for Gen-level selection
        fCFManagerProtons->GetParticleContainer()->Fill(containerInput,
-                                                       kStepReconstructible);
-      }//acceptance cuts - protons
-    }//MC level cuts - protons
-
-    //Antiprotons
-    //check the MC-level cuts
-    if (fCFManagerAntiProtons->CheckParticleCuts(AliCFManager::kPartGenCuts,
+                                                       kStepGenerated);
+       //check the Acceptance-level cuts
+       if (fCFManagerProtons->CheckParticleCuts(AliCFManager::kPartAccCuts,
                                                 mcPart)) {
-      containerInput[0] = (Float_t)mcPart->Eta();
-      containerInput[1] = (Float_t)mcPart->Pt();
-      //fill the container for Gen-level selection
-      fCFManagerAntiProtons->GetParticleContainer()->Fill(containerInput,
-                                                         kStepGenerated);
-      //check the Acceptance-level cuts
-      if (fCFManagerAntiProtons->CheckParticleCuts(AliCFManager::kPartAccCuts,
+         //fill the container for Acceptance-level selection
+         fCFManagerProtons->GetParticleContainer()->Fill(containerInput,
+                                                         kStepReconstructible);
+       }//acceptance cuts - protons
+      }//MC level cuts - protons
+
+      //Antiprotons
+      //check the MC-level cuts
+      if (fCFManagerAntiProtons->CheckParticleCuts(AliCFManager::kPartGenCuts,
                                                   mcPart)) {
-       //fill the container for Acceptance-level selection
+       containerInput[0] = (Float_t)mcPart->Eta();
+       containerInput[1] = (Float_t)mcPart->Pt();
+       //fill the container for Gen-level selection
        fCFManagerAntiProtons->GetParticleContainer()->Fill(containerInput,
-                                                           kStepReconstructible);
-      }//acceptance cuts - antiprotons
-    }//MC level cuts - antiprotons
+                                                           kStepGenerated);
+       //check the Acceptance-level cuts
+       if (fCFManagerAntiProtons->CheckParticleCuts(AliCFManager::kPartAccCuts,
+                                                    mcPart)) {
+         //fill the container for Acceptance-level selection
+         fCFManagerAntiProtons->GetParticleContainer()->Fill(containerInput,
+                                                             kStepReconstructible);
+       }//acceptance cuts - antiprotons
+      }//MC level cuts - antiprotons
+    }//MC particle condition
   }//loop over MC particles
   
   
@@ -252,6 +254,7 @@ void AliProtonSpectraCorrection::FillCorrectionMaps(AliESDEvent *esd,
     Int_t label = track->GetLabel();
     if (label<0) continue;
     AliMCParticle *mcPart  = dynamic_cast<AliMCParticle *>(mcEvent->GetTrack(label));
+    if (!mcPart) continue;
 
     if((fProtonAnalysisBase->GetAnalysisMode()==AliProtonAnalysisBase::kTPC)||(fProtonAnalysisBase->GetAnalysisMode()==AliProtonAnalysisBase::kHybrid)) {
       AliExternalTrackParam *tpcTrack = (AliExternalTrackParam *)track->GetTPCInnerParam();