[Rivet-svn] r2859 - trunk/include/Rivet/Math

blackhole at projects.hepforge.org blackhole at projects.hepforge.org
Mon Dec 27 18:33:51 GMT 2010


Author: buckley
Date: Mon Dec 27 18:33:51 2010
New Revision: 2859

Log:
Add add_quad functions

Modified:
   trunk/include/Rivet/Math/MathUtils.hh

Modified: trunk/include/Rivet/Math/MathUtils.hh
==============================================================================
--- trunk/include/Rivet/Math/MathUtils.hh	Tue Dec 21 11:41:21 2010	(r2858)
+++ trunk/include/Rivet/Math/MathUtils.hh	Mon Dec 27 18:33:51 2010	(r2859)
@@ -151,6 +151,18 @@
     return a*a;
   }
 
+  /// Named number-type addition in quadrature operation.
+  template <typename Num>
+  inline Num add_quad(Num a, Num b) {
+    return sqrt(a*a + b*b);
+  }
+
+  /// Named number-type addition in quadrature operation.
+  template <typename Num>
+  inline Num add_quad(Num a, Num b, Num c) {
+    return sqrt(a*a + b*b + c*c);
+  }
+
   /// Find the sign of a number
   inline int sign(double val) {
     if (isZero(val)) return ZERO;


More information about the Rivet-svn mailing list