CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
List of all members | Public Member Functions | Public Attributes
CircleEq< T > Class Template Reference

#include <CircleEq.h>

Public Member Functions

constexpr std::pair< T, Tcenter () const
 
 CircleEq ()
 
constexpr CircleEq (T x1, T y1, T x2, T y2, T x3, T y3)
 
constexpr void compute (T x1, T y1, T x2, T y2, T x3, T y3)
 
constexpr std::pair< T, Tcosdir () const
 
constexpr std::pair< T, Tcosdir (T x, T y) const
 
constexpr auto curvature () const
 
constexpr T dca (T x, T y) const
 
constexpr T dca0 () const
 
constexpr auto radius () const
 

Public Attributes

T m_alpha = 0
 
T m_beta = 0
 
T m_c = 0
 
T m_xp = 0
 
T m_yp = 0
 

Detailed Description

template<typename T>
class CircleEq< T >

| 1) circle is parameterized as: | | C*[(X-Xp)**2+(Y-Yp)**2] - 2*alpha*(X-Xp) - 2*beta*(Y-Yp) = 0 | | Xp,Yp is a point on the track; | | C = 1/r0 is the curvature ( sign of C is charge of particle ); | | alpha & beta are the direction cosines of the radial vector at Xp,Yp | | i.e. alpha = C*(X0-Xp), | | beta = C*(Y0-Yp), |

where center of circle is at X0,Y0.
Slope dy/dx of tangent at Xp,Yp is -alpha/beta.
2) the z dimension of the helix is parameterized by gamma = dZ/dSperp
this is also the tangent of the pitch angle of the helix.
with this parameterization, (alpha,beta,gamma) rotate like a vector.
3) For tracks going inward at (Xp,Yp), C, alpha, beta, and gamma change sign

|

Definition at line 24 of file CircleEq.h.

Constructor & Destructor Documentation

◆ CircleEq() [1/2]

template<typename T>
CircleEq< T >::CircleEq ( )
inline

Definition at line 26 of file CircleEq.h.

26 {}

◆ CircleEq() [2/2]

template<typename T>
constexpr CircleEq< T >::CircleEq ( T  x1,
T  y1,
T  x2,
T  y2,
T  x3,
T  y3 
)
inlineconstexpr

Member Function Documentation

◆ center()

template<typename T>
constexpr std::pair<T, T> CircleEq< T >::center ( ) const
inlineconstexpr

Definition at line 58 of file CircleEq.h.

58 { return std::make_pair(m_xp + m_alpha / m_c, m_yp + m_beta / m_c); }

References CircleEq< T >::m_alpha, CircleEq< T >::m_beta, CircleEq< T >::m_c, CircleEq< T >::m_xp, and CircleEq< T >::m_yp.

◆ compute()

template<typename T >
constexpr void CircleEq< T >::compute ( T  x1,
T  y1,
T  x2,
T  y2,
T  x3,
T  y3 
)
constexpr

Definition at line 70 of file CircleEq.h.

70  {
71  bool noflip = std::abs(x3 - x1) < std::abs(y3 - y1);
72 
73  auto x1p = noflip ? x1 - x2 : y1 - y2;
74  auto y1p = noflip ? y1 - y2 : x1 - x2;
75  auto d12 = x1p * x1p + y1p * y1p;
76  auto x3p = noflip ? x3 - x2 : y3 - y2;
77  auto y3p = noflip ? y3 - y2 : x3 - x2;
78  auto d32 = x3p * x3p + y3p * y3p;
79 
80  auto num = x1p * y3p - y1p * x3p; // num also gives correct sign for CT
81  auto det = d12 * y3p - d32 * y1p;
82 
83  auto st2 = (d12 * x3p - d32 * x1p);
84  auto seq = det * det + st2 * st2;
85  auto al2 = T(1.) / std::sqrt(seq);
86  auto be2 = -st2 * al2;
87  auto ct = T(2.) * num * al2;
88  al2 *= det;
89 
90  m_xp = x2;
91  m_yp = y2;
92  m_c = noflip ? ct : -ct;
93  m_alpha = noflip ? al2 : -be2;
94  m_beta = noflip ? be2 : -al2;
95 }

References funct::abs(), EgammaValidation_cff::num, cmsswSequenceInfo::seq, mathSSE::sqrt(), testProducerWithPsetDescEmpty_cfi::x1, testProducerWithPsetDescEmpty_cfi::x2, testProducerWithPsetDescEmpty_cfi::y1, and testProducerWithPsetDescEmpty_cfi::y2.

Referenced by CircleEq< T >::CircleEq().

◆ cosdir() [1/2]

template<typename T>
constexpr std::pair<T, T> CircleEq< T >::cosdir ( ) const
inlineconstexpr

Definition at line 50 of file CircleEq.h.

50 { return std::make_pair(m_alpha, m_beta); }

References CircleEq< T >::m_alpha, and CircleEq< T >::m_beta.

◆ cosdir() [2/2]

template<typename T>
constexpr std::pair<T, T> CircleEq< T >::cosdir ( T  x,
T  y 
) const
inlineconstexpr

Definition at line 53 of file CircleEq.h.

53  {
54  return std::make_pair(m_alpha - m_c * (x - m_xp), m_beta - m_c * (y - m_yp));
55  }

References CircleEq< T >::m_alpha, CircleEq< T >::m_beta, CircleEq< T >::m_c, CircleEq< T >::m_xp, CircleEq< T >::m_yp, x, and y.

◆ curvature()

template<typename T>
constexpr auto CircleEq< T >::curvature ( ) const
inlineconstexpr

Definition at line 47 of file CircleEq.h.

47 { return m_c; }

References CircleEq< T >::m_c.

◆ dca()

template<typename T>
constexpr T CircleEq< T >::dca ( T  x,
T  y 
) const
inlineconstexpr

Definition at line 40 of file CircleEq.h.

40  {
41  x = m_c * (m_xp - x) + m_alpha;
42  y = m_c * (m_yp - y) + m_beta;
43  return std::sqrt(x * x + y * y) - T(1);
44  }

References CircleEq< T >::m_alpha, CircleEq< T >::m_beta, CircleEq< T >::m_c, CircleEq< T >::m_xp, CircleEq< T >::m_yp, mathSSE::sqrt(), x, and y.

◆ dca0()

template<typename T>
constexpr T CircleEq< T >::dca0 ( ) const
inlineconstexpr

Definition at line 33 of file CircleEq.h.

33  {
34  auto x = m_c * m_xp + m_alpha;
35  auto y = m_c * m_yp + m_beta;
36  return std::sqrt(x * x + y * y) - T(1);
37  }

References CircleEq< T >::m_alpha, CircleEq< T >::m_beta, CircleEq< T >::m_c, CircleEq< T >::m_xp, CircleEq< T >::m_yp, mathSSE::sqrt(), x, and y.

◆ radius()

template<typename T>
constexpr auto CircleEq< T >::radius ( void  ) const
inlineconstexpr

Definition at line 60 of file CircleEq.h.

60 { return T(1) / m_c; }

References CircleEq< T >::m_c.

Member Data Documentation

◆ m_alpha

template<typename T>
T CircleEq< T >::m_alpha = 0

◆ m_beta

template<typename T>
T CircleEq< T >::m_beta = 0

◆ m_c

template<typename T>
T CircleEq< T >::m_c = 0

◆ m_xp

template<typename T>
T CircleEq< T >::m_xp = 0

◆ m_yp

template<typename T>
T CircleEq< T >::m_yp = 0
DDAxes::y
cmsswSequenceInfo.seq
seq
Definition: cmsswSequenceInfo.py:536
CircleEq::m_xp
T m_xp
Definition: CircleEq.h:62
testProducerWithPsetDescEmpty_cfi.x2
x2
Definition: testProducerWithPsetDescEmpty_cfi.py:28
CircleEq::m_c
T m_c
Definition: CircleEq.h:64
DDAxes::x
CircleEq::m_yp
T m_yp
Definition: CircleEq.h:63
testProducerWithPsetDescEmpty_cfi.x1
x1
Definition: testProducerWithPsetDescEmpty_cfi.py:33
testProducerWithPsetDescEmpty_cfi.y1
y1
Definition: testProducerWithPsetDescEmpty_cfi.py:29
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
CircleEq::m_beta
T m_beta
Definition: CircleEq.h:66
testProducerWithPsetDescEmpty_cfi.y2
y2
Definition: testProducerWithPsetDescEmpty_cfi.py:30
CircleEq::compute
constexpr void compute(T x1, T y1, T x2, T y2, T x3, T y3)
Definition: CircleEq.h:70
EgammaValidation_cff.num
num
Definition: EgammaValidation_cff.py:33
T
long double T
Definition: Basic3DVectorLD.h:48
CircleEq::m_alpha
T m_alpha
Definition: CircleEq.h:65
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22