Hammer  1.0.0
Helicity Amplitude Module for Matrix Element Reweighting
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Utils.cc
Go to the documentation of this file.
1 ///
2 /// @file Utils.cc
3 /// @brief Hammer math utilities class
4 ///
5 
6 //**** This file is a part of the HAMMER library
7 //**** Copyright (C) 2016 - 2020 The HAMMER Collaboration
8 //**** HAMMER is licensed under version 3 of the GPL; see COPYING for details
9 //**** Please note the MCnet academic guidelines; see GUIDELINES for details
10 
11 // -*- C++ -*-
12 #include "Hammer/Math/Utils.hh"
13 
14 using namespace std;
15 
16 namespace Hammer {
17 
18  double compareVals(const double val1, const double val2) {
19  if(isZero(val2)) {
20  return (val1 + 1.)/(val2 + 1.);
21  }
22  else {
23  return val1/val2;
24  }
25  }
26 
27  complex<double> compareVals(const complex<double> val1, const complex<double> val2) {
28  if(isZero(val2)) {
29  return (val1 + 1.)/(val2 + 1.);
30  }
31  else {
32  return val1/val2;
33  }
34  }
35 
36 } // namespace Hammer
double compareVals(const double val1, const double val2)
Definition: Utils.cc:18
bool isZero(const std::complex< double > val)
Definition: Math/Utils.hh:25