CMS 3D CMS Logo

Functions
normalizedPhi.h File Reference
#include "DataFormats/Math/interface/deltaPhi.h"
#include <algorithm>
#include <iostream>

Go to the source code of this file.

Functions

template<typename T >
constexpr bool checkPhiInRange (T phi, T phi1, T phi2, float maxDphi=float(M_PI))
 
template<typename T >
constexpr bool checkPhiInSymRange (T phi, T phi1, T phi2, float maxDphi=float(M_PI))
 
template<typename T >
constexpr T normalizedPhi (T phi)
 
template<typename T >
constexpr T proxim (T b, T a)
 

Function Documentation

◆ checkPhiInRange()

template<typename T >
constexpr bool checkPhiInRange ( T  phi,
T  phi1,
T  phi2,
float  maxDphi = float(M_PI) 
)
constexpr

Definition at line 33 of file normalizedPhi.h.

33  {
34  phi2 = proxim(phi2, phi1);
35  constexpr float c1 = 2. * M_PI;
36  if (phi2 < phi1)
37  phi2 += c1;
38  auto dphi = std::min(maxDphi, 0.5f * (phi2 - phi1));
39  auto phiA = phi1 + dphi;
40  phi = proxim(phi, phiA);
41  return std::abs(phiA - phi) < dphi;
42 
43  /* old "alternative algo"
44  constexpr T c1 = 2.*M_PI;
45  phi1 = normalizedPhi(phi1);
46  phi2 = proxim(phi2,phi1);
47  if (phi2<phi1) phi2+=c1;
48  // phi & phi1 are in [-pi,pi] range...
49  return ( (phi1 <= phi) & (phi <= phi2) )
50 // || ( (phi1 <= phi-c1) & (phi-c1 <= phi2) )
51  || ( (phi1 <= phi+c1) & (phi+c1 <= phi2) );
52  */
53 }

References funct::abs(), alignmentValidation::c1, f, M_PI, min(), PVValHelper::phi, and proxim().

Referenced by checkPhiInSymRange(), PixelTripletLargeTipGenerator::hitTriplets(), and PixelTripletHLTGenerator::hitTriplets().

◆ checkPhiInSymRange()

template<typename T >
constexpr bool checkPhiInSymRange ( T  phi,
T  phi1,
T  phi2,
float  maxDphi = float(M_PI) 
)
constexpr

Definition at line 24 of file normalizedPhi.h.

24  {
25  // symmetrize
26  if (phi2 < phi1)
27  std::swap(phi1, phi2);
28  return checkPhiInRange(phi, phi1, phi2, maxDphi);
29 }

References checkPhiInRange(), PVValHelper::phi, and std::swap().

◆ normalizedPhi()

template<typename T >
constexpr T normalizedPhi ( T  phi)
constexpr

◆ proxim()

template<typename T >
constexpr T proxim ( T  b,
T  a 
)
constexpr
checkPhiInRange
constexpr bool checkPhiInRange(T phi, T phi1, T phi2, float maxDphi=float(M_PI))
Definition: normalizedPhi.h:33
f
double f[11][100]
Definition: MuScleFitUtils.cc:78
min
T min(T a, T b)
Definition: MathUtil.h:58
proxim
constexpr T proxim(T b, T a)
Definition: normalizedPhi.h:14
std::swap
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
Definition: DataFrameContainer.h:209
b
double b
Definition: hdecay.h:118
a
double a
Definition: hdecay.h:119
PVValHelper::phi
Definition: PVValidationHelpers.h:68
alignmentValidation.c1
c1
do drawing
Definition: alignmentValidation.py:1025
M_PI
#define M_PI
Definition: BXVectorInputProducer.cc:50
T
long double T
Definition: Basic3DVectorLD.h:48
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
reco::reduceRange
constexpr T reduceRange(T x)
Definition: deltaPhi.h:18