Belle II Software development
HelixHelper Class Reference

Helper class representing a helical track. More...

#include <HelixHelper.h>

Public Member Functions

 HelixHelper (float z0, float d0, float omega, float cotTheta, float phi)
 construct a helix with given helix parameters, as defined for Track objects
 
 HelixHelper (const ROOT::Math::XYZVector &poca, const ROOT::Math::XYZVector &momentum_in_poca, int charge)
 construct a helix at an arbitrary position 'poca' (helices built at different points are not comparable)
 
double pathLengthToPoint (const ROOT::Math::XYZVector &p) const
 returns the path length (along the helix) to the helix point closest to p.
 
double pathLengthToLine (const ROOT::Math::XYZVector &a, const ROOT::Math::XYZVector &b) const
 returns the path length (along the helix) to the helix point closest to the line going through points a and b.
 
ROOT::Math::XYZVector momentum (double s=0) const
 momentum of the particle, at the helix point corresponding to a flown path length s (from poca).
 
ROOT::Math::XYZVector position (double s) const
 point on helix corresponding to a flown path length s (from poca)
 

Static Private Member Functions

static double distanceToPoint (double s)
 minimization function, calculates distance to minimize_distance_to_point
 
static double distanceToLine (double s)
 same as distanceToPoint, but ignoring z coordinate
 

Private Attributes

float m_z0
 minimal z distance of point of closest approach to origin
 
float m_d0
 minimal r distance of point of closest approach to origin
 
float m_omega
 signed curvature
 
float m_cotTheta
 cotangens of polar angle
 
float m_phi
 Phi at the perigee [-pi, pi].
 
ROOT::Math::XYZVector m_poca
 point of closest approach to origin
 

Static Private Attributes

static constexpr double c_cTimesB = (1.5 * 0.00299792458)
 magnetic filed times speed of light
 
static constexpr double c_maxFlightLength = 150.0
 maximal path length (from origin) considered for extrapolation
 
static ROOT::Math::XYZVector minimize_distance_to_point
 user supplied point we're trying to find the nearest helix point to
 
static ROOT::Math::XYZVector minimize_distance_to_line_a
 first user supplied line we're trying to find the nearest helix point to
 
static ROOT::Math::XYZVector minimize_distance_to_line_b
 second user supplied line we're trying to find the nearest helix point to
 
static HelixHelper const * helix_object
 keep a 'this' pointer around for minimization
 

Detailed Description

Helper class representing a helical track.

It is used as an alternative to Genfit's track representation and provides much faster replacements for its extrapolateToLine/ extrapolateToPoint() methods.

Definition at line 28 of file HelixHelper.h.

Constructor & Destructor Documentation

◆ HelixHelper() [1/2]

HelixHelper ( float  z0,
float  d0,
float  omega,
float  cotTheta,
float  phi 
)
inline

construct a helix with given helix parameters, as defined for Track objects

Definition at line 34 of file HelixHelper.h.

34 :
35 m_z0(z0), m_d0(d0), m_omega(omega), m_cotTheta(cotTheta), m_phi(phi),
36 m_poca(d0 * sin(phi), -d0 * cos(phi), z0)
37 { }
float m_z0
minimal z distance of point of closest approach to origin
Definition: HelixHelper.h:133
float m_omega
signed curvature
Definition: HelixHelper.h:137
float m_phi
Phi at the perigee [-pi, pi].
Definition: HelixHelper.h:141
float m_cotTheta
cotangens of polar angle
Definition: HelixHelper.h:139
float m_d0
minimal r distance of point of closest approach to origin
Definition: HelixHelper.h:135
ROOT::Math::XYZVector m_poca
point of closest approach to origin
Definition: HelixHelper.h:144

◆ HelixHelper() [2/2]

HelixHelper ( const ROOT::Math::XYZVector &  poca,
const ROOT::Math::XYZVector &  momentum_in_poca,
int  charge 
)
inline

construct a helix at an arbitrary position 'poca' (helices built at different points are not comparable)

Definition at line 41 of file HelixHelper.h.

41 :
42 m_poca(poca)
43 {
44 const double pt = momentum_in_poca.Rho();
45 const double R = pt / c_cTimesB; //c and magnetic field, should come from some common database later...
46
47 const ROOT::Math::XYZVector& dirInPoca = momentum_in_poca.Unit();
48
49 //determine the angle phi, distribute it from -pi to pi
50 m_phi = atan2(dirInPoca.Y(), dirInPoca.X());
51
52 //determine sign of d0
53 //calculate the sign of the projection of pt(dirInPoca) at d0(poca)
54 const double d0Sign = TMath::Sign(1., poca.X() * dirInPoca.X()
55 + poca.Y() * dirInPoca.Y());
56
57 //Now set the helix parameters
58 m_d0 = d0Sign * poca.Rho();
59 m_omega = 1 / R * charge;
60 m_z0 = poca.Z();
61 m_cotTheta = dirInPoca.Z() / dirInPoca.Rho();
62 }
double R
typedef autogenerated by FFTW
static constexpr double c_cTimesB
magnetic filed times speed of light
Definition: HelixHelper.h:29
ROOT::Math::XYZVector poca(ROOT::Math::XYZVector const &trackPos, ROOT::Math::XYZVector const &trackP, ROOT::Math::XYZVector const &vtxPos)
Returns the Point Of Closest Approach of a track to a vertex.
double charge(int pdgCode)
Returns electric charge of a particle with given pdg code.
Definition: EvtPDLUtil.cc:44

Member Function Documentation

◆ distanceToLine()

static double distanceToLine ( double  s)
inlinestaticprivate

same as distanceToPoint, but ignoring z coordinate

Definition at line 153 of file HelixHelper.h.

154 {
155 const ROOT::Math::XYZVector& p = helix_object->position(s);
156 // d = |(p-a) \times (p-b)| / |b-a|
159 }
ROOT::Math::XYZVector position(double s) const
point on helix corresponding to a flown path length s (from poca)
Definition: HelixHelper.h:120
static ROOT::Math::XYZVector minimize_distance_to_line_b
second user supplied line we're trying to find the nearest helix point to
Definition: HelixHelper.h:166
static HelixHelper const * helix_object
keep a 'this' pointer around for minimization
Definition: HelixHelper.h:168
static ROOT::Math::XYZVector minimize_distance_to_line_a
first user supplied line we're trying to find the nearest helix point to
Definition: HelixHelper.h:164

◆ distanceToPoint()

static double distanceToPoint ( double  s)
inlinestaticprivate

minimization function, calculates distance to minimize_distance_to_point

Definition at line 147 of file HelixHelper.h.

148 {
150 }
static ROOT::Math::XYZVector minimize_distance_to_point
user supplied point we're trying to find the nearest helix point to
Definition: HelixHelper.h:162

◆ momentum()

ROOT::Math::XYZVector momentum ( double  s = 0) const
inline

momentum of the particle, at the helix point corresponding to a flown path length s (from poca).

Definition at line 109 of file HelixHelper.h.

110 {
111 const float pt = c_cTimesB / TMath::Abs(m_omega);
112 return ROOT::Math::XYZVector(
113 pt * cos(m_phi - 2 * m_omega * s),
114 pt * sin(m_phi - 2 * m_omega * s),
115 pt * m_cotTheta
116 );
117 }

◆ pathLengthToLine()

double pathLengthToLine ( const ROOT::Math::XYZVector &  a,
const ROOT::Math::XYZVector &  b 
) const
inline

returns the path length (along the helix) to the helix point closest to the line going through points a and b.

Definition at line 87 of file HelixHelper.h.

88 {
91
92 helix_object = this; //ok, this is ugly
93 //TODO create a functor object to wrap everything up
94
95 ROOT::Math::Functor1D functor(&distanceToLine);
96 ROOT::Math::BrentMinimizer1D bm;
97 bm.SetFunction(functor, 0.0, c_maxFlightLength);
98 bm.Minimize(100); //#iterations, abs. error, rel. error
99
100 //bm.FValMinimum() is shortest distance
101 //bm.XMinimum() is corresponding path length
102 return bm.XMinimum();
103 }
static double distanceToLine(double s)
same as distanceToPoint, but ignoring z coordinate
Definition: HelixHelper.h:153
static constexpr double c_maxFlightLength
maximal path length (from origin) considered for extrapolation
Definition: HelixHelper.h:30

◆ pathLengthToPoint()

double pathLengthToPoint ( const ROOT::Math::XYZVector &  p) const
inline

returns the path length (along the helix) to the helix point closest to p.

a path length of 0 corresponds to p = poca

Definition at line 68 of file HelixHelper.h.

69 {
71 helix_object = this; //ok, this is ugly
72 //TODO create a functor object to wrap everything up
73
74 ROOT::Math::Functor1D functor(&distanceToPoint);
75 ROOT::Math::BrentMinimizer1D bm;
76 bm.SetFunction(functor, 0.0, c_maxFlightLength);
77 bm.Minimize(100); //#iterations, abs. error, rel. error
78
79 //bm.FValMinimum() is shortest distance
80 //bm.XMinimum() is corresponding path length
81 return bm.XMinimum();
82 }
static double distanceToPoint(double s)
minimization function, calculates distance to minimize_distance_to_point
Definition: HelixHelper.h:147

◆ position()

ROOT::Math::XYZVector position ( double  s) const
inline

point on helix corresponding to a flown path length s (from poca)

Definition at line 120 of file HelixHelper.h.

121 {
122 //approximation (but it does work for straight tracks)
123 return m_poca + ROOT::Math::XYZVector(
124 s * s * m_omega / 2 * sin(m_phi) + s * cos(m_phi),
125 -s * s * m_omega / 2 * cos(m_phi) + s * sin(m_phi),
126 s * m_cotTheta
127 );
128 }

Member Data Documentation

◆ c_cTimesB

constexpr double c_cTimesB = (1.5 * 0.00299792458)
staticconstexprprivate

magnetic filed times speed of light

Definition at line 29 of file HelixHelper.h.

◆ c_maxFlightLength

constexpr double c_maxFlightLength = 150.0
staticconstexprprivate

maximal path length (from origin) considered for extrapolation

Definition at line 30 of file HelixHelper.h.

◆ m_cotTheta

float m_cotTheta
private

cotangens of polar angle

Definition at line 139 of file HelixHelper.h.

◆ m_d0

float m_d0
private

minimal r distance of point of closest approach to origin

Definition at line 135 of file HelixHelper.h.

◆ m_omega

float m_omega
private

signed curvature

Definition at line 137 of file HelixHelper.h.

◆ m_phi

float m_phi
private

Phi at the perigee [-pi, pi].

Definition at line 141 of file HelixHelper.h.

◆ m_poca

ROOT::Math::XYZVector m_poca
private

point of closest approach to origin

Definition at line 144 of file HelixHelper.h.

◆ m_z0

float m_z0
private

minimal z distance of point of closest approach to origin

Definition at line 133 of file HelixHelper.h.


The documentation for this class was generated from the following file: