CMS 3D CMS Logo

Functions
angle0to2pi Namespace Reference

Functions

template<class valType >
constexpr valType make0To2pi (valType angle)
 

Function Documentation

◆ make0To2pi()

template<class valType >
constexpr valType angle0to2pi::make0To2pi ( valType  angle)
inlineconstexpr

Definition at line 67 of file deltaPhi.h.

67  {
68  constexpr valType twoPi = 2._pi;
69  constexpr valType oneOverTwoPi = 1. / twoPi;
70  constexpr valType epsilon = 1.e-13;
71 
72  if ((std::abs(angle) <= epsilon) || (std::abs(twoPi - std::abs(angle)) <= epsilon))
73  return (0.);
74  if (std::abs(angle) > twoPi) {
75  valType nFac = trunc(angle * oneOverTwoPi);
76  angle -= (nFac * twoPi);
77  if (std::abs(angle) <= epsilon)
78  return (0.);
79  }
80  if (angle < 0.)
81  angle += twoPi;
82  return (angle);
83  }

References funct::abs(), angle(), geometryDiff::epsilon, pileupReCalc_HLTpaths::trunc, and Geom::twoPi().

Referenced by trklet::TrackletCalculatorBase::barrelSeeding(), magneticfield::bSector::bSector(), trklet::TrackletCalculatorBase::diskSeeding(), trklet::TrackletEventProcessor::event(), trklet::TrackletCalculatorDisplaced::exacttracklet(), CmsMTDConstruction< FilteredView >::mtdOrderPhi(), Geom::NormalizeWrapper< T1, ZeroTo2pi >::normalize(), and trklet::TrackletCalculatorBase::overlapSeeding().

geometryDiff.epsilon
int epsilon
Definition: geometryDiff.py:26
Geom::twoPi
constexpr double twoPi()
Definition: Pi.h:32
angle
T angle(T x1, T y1, T z1, T x2, T y2, T z2)
Definition: angle.h:11
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
pileupReCalc_HLTpaths.trunc
trunc
Definition: pileupReCalc_HLTpaths.py:144