Main Page
Namespaces
Classes
Package Documentation
src
JetMETCorrections
InterpolationTables
interface
closeWithinTolerance.h
Go to the documentation of this file.
1
#ifndef NPSTAT_CLOSEWITHINTOLERANCE_HH_
2
#define NPSTAT_CLOSEWITHINTOLERANCE_HH_
3
15
#include <cmath>
16
#include <algorithm>
17
#include "
JetMETCorrections/InterpolationTables/interface/NpstatException.h
"
18
19
namespace
npstat
{
25
inline
bool
closeWithinTolerance
(
const
double
&
a
,
const
double
&
b
,
26
const
double
& tol)
27
{
28
if
(tol < 0.0)
29
throw
npstat::NpstatInvalidArgument
(
"In npstat::closeWithinTolerance: "
30
"negative tolerance is not allowed"
);
31
if
(a == b)
32
return
true
;
33
else
34
return
fabs(a - b)/
std::max
(fabs(a), fabs(b)) <= tol;
35
}
36
}
37
38
#endif // NPSTAT_CLOSEWITHINTOLERANCE_HH_
39
npstat::NpstatInvalidArgument
Definition:
NpstatException.h:43
npstat::closeWithinTolerance
bool closeWithinTolerance(const double &a, const double &b, const double &tol)
Definition:
closeWithinTolerance.h:25
npstat
Definition:
AbsArrayProjector.h:14
NpstatException.h
Exceptions for the npstat namespace.
SiStripPI::max
Definition:
SiStripPayloadInspectorHelper.h:178
b
double b
Definition:
hdecay.h:120
a
double a
Definition:
hdecay.h:121
Generated for CMSSW Reference Manual by
1.8.11