Protection added.
authormorsch <morsch@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 24 Mar 2009 14:43:11 +0000 (14:43 +0000)
committermorsch <morsch@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 24 Mar 2009 14:43:11 +0000 (14:43 +0000)
EVGEN/AliGenMC.cxx

index 5588b5c..13339d7 100644 (file)
@@ -198,13 +198,17 @@ Bool_t AliGenMC::KinematicSelection(TParticle *particle, Int_t flag) const
 {
 // Perform kinematic selection
     Double_t pz    = particle->Pz();
-    Double_t  e    = particle->Energy();
     Double_t pt    = particle->Pt();
     Double_t p     = particle->P();
     Double_t theta = particle->Theta();
     Double_t mass  = particle->GetCalcMass();
     Double_t mt2   = pt * pt + mass * mass;
     Double_t phi   = particle->Phi();
+    Double_t e     = particle->Energy();
+    
+    if (e == 0.)     
+       e = TMath::Sqrt(p * p + mass * mass);
+
     
     Double_t y, y0;