CMS 3D CMS Logo

PhiInterval.h
Go to the documentation of this file.
1 #ifndef GeometryVector_PhiInterval_H
2 #define GeometryVector_PhiInterval_H
5 
6 class PhiInterval {
7 public:
8  PhiInterval(float phi1, float phi2) {
9  phi2 = proxim(phi2, phi1);
10  constexpr float c1 = 2. * M_PI;
11  if (phi2 < phi1)
12  phi2 += c1;
13  auto dphi = 0.5f * (phi2 - phi1);
14  auto phi = phi1 + dphi;
15  x = std::cos(phi);
16  y = std::sin(phi);
17  dcos = std::cos(dphi);
18  }
19 
20  PhiInterval(float ix, float iy, float dphi) {
21  auto norm = 1.f / std::sqrt(ix * ix + iy * iy);
22  x = ix * norm;
23  y = iy * norm;
24  dcos = std::cos(dphi);
25  }
26 
27  template <typename T>
28  bool inside(Basic3DVector<T> const& v) const {
29  return inside(v.x(), v.y());
30  }
31 
32  bool inside(float ix, float iy) const { return ix * x + iy * y > dcos * std::sqrt(ix * ix + iy * iy); }
33 
34 private:
35  float x, y;
36  float dcos;
37 };
38 
39 #endif
PhiInterval::inside
bool inside(float ix, float iy) const
Definition: PhiInterval.h:32
PhiInterval::PhiInterval
PhiInterval(float ix, float iy, float dphi)
Definition: PhiInterval.h:20
Basic3DVector.h
PhiInterval::inside
bool inside(Basic3DVector< T > const &v) const
Definition: PhiInterval.h:28
proxim
constexpr T proxim(T b, T a)
Definition: normalizedPhi.h:14
findQualityFiles.v
v
Definition: findQualityFiles.py:179
funct::sin
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
PhiInterval
Definition: PhiInterval.h:6
funct::cos
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
PhiInterval::x
float x
Definition: PhiInterval.h:35
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
PhiInterval::y
float y
Definition: PhiInterval.h:35
normalizedPhi.h
alignmentValidation.c1
c1
do drawing
Definition: alignmentValidation.py:1025
M_PI
#define M_PI
Definition: BXVectorInputProducer.cc:50
DDAxes::phi
PhiInterval::PhiInterval
PhiInterval(float phi1, float phi2)
Definition: PhiInterval.h:8
PhiInterval::dcos
float dcos
Definition: PhiInterval.h:36
Basic3DVector
Definition: extBasic3DVector.h:30