Belle II Software development
Helix.h
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8#pragma once
9
10#include <tracking/trackFindingCDC/geometry/PerigeeCircle.h>
11#include <tracking/trackFindingCDC/geometry/SZLine.h>
12
13#include <tracking/trackFindingCDC/geometry/HelixParameters.h>
14#include <tracking/trackFindingCDC/geometry/Vector3D.h>
15#include <tracking/trackFindingCDC/geometry/Vector2D.h>
16
17#include <iosfwd>
18#include <cmath>
19
20namespace Belle2 {
25 namespace TrackFindingCDC {
26
28 class Helix {
29
30 public:
33 : m_circleXY()
34 , m_szLine()
35 {
36 }
37
42 {
43 }
44
46 explicit Helix(const HelixParameters& parameters)
47 : m_circleXY(HelixUtil::getPerigeeParameters(parameters))
48 , m_szLine(HelixUtil::getSZParameters(parameters))
49 {
50 }
51
53 Helix(double curvature, double phi0, double impact, double tanLambda, double z0)
54 : m_circleXY(curvature, phi0, impact)
56 {
57 }
58
60 Helix(double curvature, const Vector2D& phi0Vec, double impact, double tanLambda, double z0)
61 : m_circleXY(curvature, phi0Vec, impact)
63 {
64 }
65
68 {
71 }
72
74 bool isInvalid() const
75 {
76 return circleXY().isInvalid() and szLine().isInvalid();
77 }
78
80 void reverse()
81 {
84 }
85
88 {
89 return Helix(circleXY().reversed(), szLine().reversed());
90 }
91
92 public:
95 double arcLength2DToClosest(const Vector3D& point, bool firstPeriod = true) const;
96
102 double arcLength2DToXY(const Vector2D& point) const
103 {
104 return circleXY().arcLengthTo(point);
105 }
106
112 double arcLength2DToCylindricalR(double cylindricalR) const
113 {
114 return circleXY().arcLengthToCylindricalR(cylindricalR);
115 }
116
118 Vector3D closest(const Vector3D& point, bool firstPeriod = true) const
119 {
120 double arcLength2D = arcLength2DToClosest(point, firstPeriod);
121 return atArcLength2D(arcLength2D);
122 }
123
125 Vector3D closestXY(const Vector2D& pointXY) const
126 {
127 double arcLength2D = arcLength2DToXY(pointXY);
128 return atArcLength2D(arcLength2D);
129 }
130
132 double distance(const Vector3D& point) const
133 {
134 return point.distance(closest(point));
135 }
136
138 double distanceXY(const Vector2D& point) const
139 {
140 return m_circleXY.distance(point);
141 }
142
147 double passiveMoveBy(const Vector3D& by)
148 {
149 // First keep the necessary shift of the perpendicular travel distance to the new perigee
150 // point.
151 double byS = circleXY().arcLengthTo(by.xy());
153 Vector2D bySZ(byS, by.z());
155 return byS;
156 }
157
160
165 double shiftPeriod(int nPeriods)
166 {
167 double arcLength2D = nPeriods * fabs(perimeterXY());
168 m_szLine.passiveMoveBy(Vector2D(arcLength2D, 0.0));
169 return arcLength2D;
170 }
171
174 Vector3D atArcLength2D(double s) const
175 {
176 return Vector3D(circleXY().atArcLength(s), szLine().map(s));
177 }
178
180 Vector3D atZ(double z) const
181 {
182 return Vector3D(xyAtZ(z), z);
183 }
184
186 Vector2D xyAtZ(double z) const
187 {
188 return Vector2D(circleXY().atArcLength(szLine().inverseMap(z)));
189 }
190
192 double minimalCylindricalR() const
193 {
194 return circleXY().minimalCylindricalR();
195 }
196
198 double maximalCylindricalR() const
199 {
200 return circleXY().maximalCylindricalR();
201 }
202
204 double curvatureXY() const
205 {
206 return circleXY().curvature();
207 }
208
210 double impactXY() const
211 {
212 return circleXY().impact();
213 }
214
216 double omega() const
217 {
218 return circleXY().omega();
219 }
220
222 double d0() const
223 {
224 return circleXY().d0();
225 }
226
229 {
230 return circleXY().perigee();
231 }
232
235 {
236 return Vector3D(perigeeXY(), z0());
237 }
238
240 double tanLambda() const
241 {
242 return m_szLine.tanLambda();
243 }
244
246 double cotTheta() const
247 {
248 return tanLambda();
249 }
250
252 double z0() const
253 {
254 return m_szLine.z0();
255 }
256
259 double zPeriod() const
260 {
261 return tanLambda() * arcLength2DPeriod();
262 }
263
265 double arcLength2DPeriod() const
266 {
267 return circleXY().arcLengthPeriod();
268 }
269
271 double perimeterXY() const
272 {
273 return circleXY().perimeter();
274 }
275
277 double radiusXY() const
278 {
279 return circleXY().radius();
280 }
281
284 {
285 return circleXY().center();
286 }
287
290 {
291 return Vector3D(phi0Vec(), tanLambda()).unit();
292 }
293
295 const Vector2D& phi0Vec() const
296 {
297 return circleXY().phi0Vec();
298 }
299
301 double phi0() const
302 {
303 return circleXY().phi0();
304 }
305
308 {
309 HelixParameters result;
310 using namespace NHelixParameterIndices;
311 result(c_Curv) = curvatureXY();
312 result(c_Phi0) = phi0();
313 result(c_I) = impactXY();
314 result(c_TanL) = tanLambda();
315 result(c_Z0) = z0();
316 return result;
317 }
318
320 const PerigeeCircle& circleXY() const
321 {
322 return m_circleXY;
323 }
324
326 const SZLine& szLine() const
327 {
328 return m_szLine;
329 }
330
331 private:
334
338
339 };
340
342 std::ostream& operator<<(std::ostream& output, const Helix& helix);
343 }
345}
Extension of the generalized circle also caching the perigee coordinates.
Definition: Helix.h:28
PerigeeCircle m_circleXY
Memory of the projection of the helix in xy space.
Definition: Helix.h:333
Vector3D closest(const Vector3D &point, bool firstPeriod=true) const
Calculates the point on the helix with the smallest total distance.
Definition: Helix.h:118
Helix(const HelixParameters &parameters)
Constructor taking all stored parameters for internal use.
Definition: Helix.h:46
Helix(const PerigeeCircle &circleXY, const SZLine &szLine)
Constructor combining a two dimensional circle with the linear augment in the sz space.
Definition: Helix.h:39
Vector2D perigeeXY() const
Getter for the perigee point in the xy projection.
Definition: Helix.h:228
double z0() const
Getter for z coordinate at the perigee point of the helix.
Definition: Helix.h:252
Vector3D tangential() const
Getter for the unit three dimensional tangential vector at the perigee point of the helix.
Definition: Helix.h:289
double phi0() const
Getter for the azimuth angle of the direction of flight at the perigee.
Definition: Helix.h:301
double cotTheta() const
Getter for the proportinality factor from arc length in xy space to z.
Definition: Helix.h:246
Helix(double curvature, const Vector2D &phi0Vec, double impact, double tanLambda, double z0)
Constructor from all helix parameter, phi given as a unit vector.
Definition: Helix.h:60
bool isInvalid() const
Indicates if the stored parameter combination designates a valid helix.
Definition: Helix.h:74
double minimalCylindricalR() const
Gives the minimal cylindrical radius the circle reaches (unsigned)
Definition: Helix.h:192
void reverse()
Flips the travel direction of the helix in place, pivot point is unchanged.
Definition: Helix.h:80
double perimeterXY() const
Getter for the perimeter of the circle in the xy projection.
Definition: Helix.h:271
double distanceXY(const Vector2D &point) const
Calculates the distance of the line parallel to the z axes through the given point.
Definition: Helix.h:138
double impactXY() const
Getter for the signed distance to the z axes at the perigee point.
Definition: Helix.h:210
double omega() const
Getter for the omega parameter of the common helix parameterisation.
Definition: Helix.h:216
double arcLength2DToXY(const Vector2D &point) const
Calculates the two dimensional arc length that is closest to two dimensional point in the xy projecti...
Definition: Helix.h:102
Vector3D closestXY(const Vector2D &pointXY) const
Calculates the point on the helix with the smallest perpendicular (xy) distance.
Definition: Helix.h:125
Helix reversed() const
Returns a copy of the helix with flips the travel direction, pivot point is the same.
Definition: Helix.h:87
double shiftPeriod(int nPeriods)
Adjust the arclength measure to start n periods later.
Definition: Helix.h:165
double tanLambda() const
Getter for the proportinality factor from arc length in xy space to z.
Definition: Helix.h:240
double maximalCylindricalR() const
Gives the maximal cylindrical radius the circle reaches.
Definition: Helix.h:198
double curvatureXY() const
Getter for the signed curvature in the xy projection.
Definition: Helix.h:204
double arcLength2DToCylindricalR(double cylindricalR) const
Calculates the two dimensional arc length that first reaches a cylindrical radius on the helix Return...
Definition: Helix.h:112
const Vector2D & phi0Vec() const
Getter for the direction vector in the xy projection at the perigee of the helix.
Definition: Helix.h:295
HelixParameters helixParameters() const
Getter for the five helix parameters in the order defined by EHelixParameter.h.
Definition: Helix.h:307
double zPeriod() const
Getter for the distance in z at which the two points on the helix coincide in the xy projection.
Definition: Helix.h:259
void invalidate()
Sets all circle parameters to zero.
Definition: Helix.h:67
double radiusXY() const
Getter for the radius of the circle in the xy projection.
Definition: Helix.h:277
Vector2D xyAtZ(double z) const
Calculates the point, which lies at the given z coordinate.
Definition: Helix.h:186
double arcLength2DPeriod() const
Getter for the arc length of one trip around the helix.
Definition: Helix.h:265
Vector3D perigee() const
Getter for the perigee point of the helix.
Definition: Helix.h:234
Vector2D centerXY() const
Getter for the central point of the helix.
Definition: Helix.h:283
double d0() const
Getter for the signed distance to the z axes at the perigee point.
Definition: Helix.h:222
SZLine m_szLine
Memory of the of the linear relation between perpendicular travel distance and the z position.
Definition: Helix.h:337
const PerigeeCircle & circleXY() const
Getter for the projection into xy space.
Definition: Helix.h:320
Vector3D atArcLength2D(double s) const
Calculates the point, which lies at the give perpendicular travel distance (counted from the perigee)
Definition: Helix.h:174
double arcLength2DToClosest(const Vector3D &point, bool firstPeriod=true) const
Calculates the perpendicular travel distance at which the helix has the closest approach to the given...
Definition: Helix.cc:29
Helix()
Default constructor for ROOT compatibility.
Definition: Helix.h:32
Vector3D atZ(double z) const
Calculates the point, which lies at the given z coordinate.
Definition: Helix.h:180
double passiveMoveBy(const Vector3D &by)
Moves the coordinates system by the given vector.
Definition: Helix.h:147
HelixJacobian passiveMoveByJacobian(const Vector3D &by) const
Computes the Jacobi matrix for a move of the coordinate system by the given vector.
Definition: Helix.cc:90
double distance(const Vector3D &point) const
Calculates the distance of the point to the point of closest approach on the helix.
Definition: Helix.h:132
Helix(double curvature, double phi0, double impact, double tanLambda, double z0)
Constructor from all helix parameter.
Definition: Helix.h:53
const SZLine & szLine() const
Getter for the projection into xy space.
Definition: Helix.h:326
Extension of the generalized circle also caching the perigee coordinates.
Definition: PerigeeCircle.h:36
Vector2D perigee() const
Getter for the perigee point.
double phi0() const
Getter for the azimuth angle of the direction of flight at the perigee.
bool isInvalid() const
Indicates if all circle parameters are zero.
double minimalCylindricalR() const
Gives the minimal cylindrical radius the circle reaches (unsigned)
void reverse()
Flips the orientation of the circle in place.
double radius() const
Gives the signed radius of the circle. If it was a line this will be infinity.
double distance(const Vector2D &point) const
Getter for the proper signed distance of the point to the circle.
double omega() const
Getter for omega parameter of the common Belle2::Helix which is the wrong sign curvature.
void passiveMoveBy(const Vector2D &by)
Moves the coordinates system by the given vector. Updates perigee parameters in place.
double impact() const
Getter for the signed distance of the origin to the circle.
Vector2D center() const
Getter for the center of the circle. If it was a line both components will be infinity.
double maximalCylindricalR() const
Gives the maximal cylindrical radius the circle reaches.
const Vector2D & phi0Vec() const
Getter for the unit vector of the direction of flight at the perigee.
void invalidate()
Sets all circle parameters to zero.
double perimeter() const
Gives the signed perimeter of the circle.
double curvature() const
Getter for the signed curvature.
double d0() const
Getter for d0 parameter of the common Belle2::Helix representation.
double arcLengthPeriod() const
Getter for the arc length for a full round of the circle.
double arcLengthTo(const Vector2D &point) const
Calculates the arc length between the perigee and the given point.
double arcLengthToCylindricalR(double cylindricalR) const
Calculates the two dimensional arc length till the cylindrical radius is reached If the radius can no...
A matrix implementation to be used as an interface typ through out the track finder.
Definition: PlainMatrix.h:40
A line in the sz space.
Definition: SZLine.h:26
double z0() const
Getter for the z0 parameter.
Definition: SZLine.h:82
bool isInvalid() const
Indicates if the line parameters do not represent a valid line.
Definition: SZLine.h:142
void reverse()
Reverse the arc length direction in place.
Definition: SZLine.h:148
double tanLambda() const
Getter for the tan lambda parameter.
Definition: SZLine.h:52
void invalidate()
Sets the parameters to a invalid representation.
Definition: SZLine.h:135
void passiveMoveBy(const Vector2D &bySZ)
Passivelly move the coordinate system in place by the given sz vector.
Definition: SZLine.h:184
A two dimensional vector which is equipped with functions for correct handeling of orientation relat...
Definition: Vector2D.h:32
A three dimensional vector.
Definition: Vector3D.h:33
const Vector2D & xy() const
Getter for the xy projected vector ( reference ! )
Definition: Vector3D.h:508
double distance(const Vector3D &rhs=Vector3D(0.0, 0.0, 0.0)) const
Calculates the distance of this point to the rhs.
Definition: Vector3D.h:244
Vector3D unit() const
Returns a unit vector colaligned with this.
Definition: Vector3D.h:359
double z() const
Getter for the z coordinate.
Definition: Vector3D.h:496
Abstract base class for different kinds of events.
Utility struct for functions and types related to the helix parameters.