Protections added
authormorsch <morsch@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 4 Jul 2013 16:22:21 +0000 (16:22 +0000)
committermorsch <morsch@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 4 Jul 2013 16:22:21 +0000 (16:22 +0000)
Martin Poghoshyan

PYTHIA6/AliGenPythia.cxx
TDPMjet/AliGenDPMjet.cxx

index 756273c..5872c40 100644 (file)
@@ -1798,7 +1798,9 @@ Bool_t AliGenPythia::CheckDiffraction()
        TParticle *  part = (TParticle *) fParticles.At(iPart);
        Double_t E= part->Energy();
        Double_t P= part->P();
-       M= TMath::Sqrt((fEnergyCMS-E-P)*(fEnergyCMS-E+P));
+       Double_t M2 = (fEnergyCMS-E-P)*(fEnergyCMS-E+P);
+       if(M2<0)  return kFALSE;
+       M= TMath::Sqrt(M2);
      }
 
      Double_t Mmin, Mmax, wSD, wDD, wND;
index 8dd9565..2b9cef5 100644 (file)
@@ -631,7 +631,9 @@ Bool_t AliGenDPMjet::CheckDiffraction()
        TParticle *  part = (TParticle *) fParticles.At(iPart);
        Double_t E= part->Energy();
        Double_t P= part->P();
-       M= TMath::Sqrt((fEnergyCMS-E-P)*(fEnergyCMS-E+P));
+       Double_t M2 = (fEnergyCMS-E-P)*(fEnergyCMS-E+P);
+       if(M2<0)  return kFALSE;
+       M= TMath::Sqrt(M2);
      }
 
      Double_t Mmin, Mmax, wSD, wDD, wND;