1 #ifndef DataFormats_Math_deltaPhi_h
2 #define DataFormats_Math_deltaPhi_h
19 constexpr
T o2pi = 1. / (2. *
M_PI);
22 T n = std::round(x * o2pi);
23 return x - n *
T(2. *
M_PI);
28 constexpr
double deltaPhi(
float phi1,
double phi2) {
return deltaPhi(static_cast<double>(phi1), phi2); }
30 constexpr
double deltaPhi(
double phi1,
float phi2) {
return deltaPhi(phi1, static_cast<double>(phi2)); }
34 template <
typename T1,
typename T2>
35 constexpr
auto deltaPhi(T1
const& t1, T2
const& t2) -> decltype(
deltaPhi(t1.phi(), t2.phi())) {
48 template <
typename T1,
typename T2 = T1>
55 namespace angle0to2pi {
66 template <
class valType>
69 constexpr valType oneOverTwoPi = 1. / (2. *
M_PI);
70 constexpr valType
epsilon = 1.e-13;
75 valType nFac =
trunc(angle * oneOverTwoPi);
76 angle -= (nFac *
twoPi);
constexpr double deltaPhi(double phi1, double phi2)
constexpr T reduceRange(T x)
Abs< T >::type abs(const T &t)
constexpr auto operator()(const T1 &t1, const T2 &t2) -> decltype(reco::deltaPhi(t1, t2)) const
constexpr valType make0To2pi(valType angle)
T angle(T x1, T y1, T z1, T x2, T y2, T z2)