CMS 3D CMS Logo

Functions
cms_rounding Namespace Reference

Functions

template<class valType >
constexpr valType roundIfNear0 (valType value, double tolerance=1.e-7)
 
template<class valType >
constexpr valType roundVecIfNear0 (valType value, double tolerance=1.e-7)
 

Function Documentation

◆ roundIfNear0()

template<class valType >
constexpr valType cms_rounding::roundIfNear0 ( valType  value,
double  tolerance = 1.e-7 
)
inlineconstexpr

Definition at line 11 of file Rounding.h.

11  {
12  if (std::abs(value) < tolerance)
13  return (0.0);
14  return (value);
15  }

References funct::abs(), and tolerance.

Referenced by CSCGeometryParsFromDD::build(), and roundVecIfNear0().

◆ roundVecIfNear0()

template<class valType >
constexpr valType cms_rounding::roundVecIfNear0 ( valType  value,
double  tolerance = 1.e-7 
)
inlineconstexpr

Definition at line 18 of file Rounding.h.

18  {
19  auto xVal{roundIfNear0(value.x(), tolerance)};
20  auto yVal{roundIfNear0(value.y(), tolerance)};
21  auto zVal{roundIfNear0(value.z(), tolerance)};
22  return (valType{xVal, yVal, zVal});
23  }

References roundIfNear0(), and tolerance.

Referenced by DTGeometryTest::analyze().

value
Definition: value.py:1
tolerance
const double tolerance
Definition: HGCalGeomParameters.cc:27
cms_rounding::roundIfNear0
constexpr valType roundIfNear0(valType value, double tolerance=1.e-7)
Definition: Rounding.h:11
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22