fix to be able to run on new productions
authorcnattras <christine.nattrass@cern.ch>
Thu, 20 Mar 2014 08:32:36 +0000 (09:32 +0100)
committercnattras <christine.nattrass@cern.ch>
Thu, 20 Mar 2014 15:34:25 +0000 (16:34 +0100)
PWGLF/totEt/AliAnalysisEtMonteCarlo.cxx

index b709fe3..28f91a3 100644 (file)
@@ -1041,7 +1041,7 @@ Int_t AliAnalysisEtMonteCarlo::AnalyseEvent(AliVEvent* ev,AliVEvent* ev2)
 
         TParticle *primPart = stack->Particle(primIdx);
         fPrimaryCode = primPart->GetPdgCode();
-        fPrimaryCharge = (Int_t) primPart->GetPDG()->Charge();
+        if(primPart->GetPDG()) fPrimaryCharge = (Int_t) primPart->GetPDG()->Charge();
 
         fPrimaryE = primPart->Energy();
         fPrimaryEt = primPart->Energy()*TMath::Sin(primPart->Theta());
@@ -1059,7 +1059,7 @@ Int_t AliAnalysisEtMonteCarlo::AnalyseEvent(AliVEvent* ev,AliVEvent* ev2)
         fDepositedCode = part->GetPdgCode();
        fDepositedE = part->Energy();
         fDepositedEt = part->Energy()*TMath::Sin(part->Theta());
-        fDepositedCharge = (Int_t) part->GetPDG()->Charge();
+        if(part->GetPDG()) fDepositedCharge = (Int_t) part->GetPDG()->Charge();
 
         fDepositedVx = part->Vx();
         fDepositedVy = part->Vy();