[Rivet-svn] r2752 - in trunk: . include/Rivet/Math

blackhole at projects.hepforge.org blackhole at projects.hepforge.org
Thu Nov 11 13:39:58 GMT 2010


Author: buckley
Date: Thu Nov 11 13:39:57 2010
New Revision: 2752

Log:
Adding special handling of FourMomentum::mass() for computed zero-mass vectors for which mass2 can go (very slightly) negative due to numerical precision.

Modified:
   trunk/ChangeLog
   trunk/include/Rivet/Math/Vector4.hh

Modified: trunk/ChangeLog
==============================================================================
--- trunk/ChangeLog	Wed Nov 10 16:03:27 2010	(r2751)
+++ trunk/ChangeLog	Thu Nov 11 13:39:57 2010	(r2752)
@@ -1,3 +1,9 @@
+2010-11-11  Andy Buckley  <andy at insectnation.org>
+
+	* Adding special handling of FourMomentum::mass() for computed
+	zero-mass vectors for which mass2 can go (very slightly) negative
+	due to numerical precision.
+
 2010-11-10  Hendrik Hoeth <hendrik.hoeth at cern.ch>
 
 	* Adding ATLAS-CONF-2010-083 conference note. Data is read from plots.

Modified: trunk/include/Rivet/Math/Vector4.hh
==============================================================================
--- trunk/include/Rivet/Math/Vector4.hh	Wed Nov 10 16:03:27 2010	(r2751)
+++ trunk/include/Rivet/Math/Vector4.hh	Thu Nov 11 13:39:57 2010	(r2752)
@@ -367,7 +367,11 @@
     /// Get mass \f$ m = \sqrt{E^2 - p^2} \f$ (the Lorentz self-invariant).
     double mass() const {
       assert(Rivet::isZero(mass2()) || mass2() > 0);
-      return sqrt(mass2());
+      if (Rivet::isZero(mass2())) {
+        return 0.0;
+      } else {
+        return sqrt(mass2());
+      }
     }
 
     /// Calculate rapidity.


More information about the Rivet-svn mailing list