Belle II Software  release-05-02-19
Helix.h
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2014 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Oliver Frost *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 #pragma once
11 
12 #include <tracking/trackFindingCDC/geometry/PerigeeCircle.h>
13 #include <tracking/trackFindingCDC/geometry/SZLine.h>
14 
15 #include <tracking/trackFindingCDC/geometry/HelixParameters.h>
16 #include <tracking/trackFindingCDC/geometry/Vector3D.h>
17 #include <tracking/trackFindingCDC/geometry/Vector2D.h>
18 
19 #include <iosfwd>
20 #include <cmath>
21 
22 namespace Belle2 {
27  namespace TrackFindingCDC {
28 
30  class Helix {
31 
32  public:
34  Helix()
35  : m_circleXY()
36  , m_szLine()
37  {
38  }
39 
41  Helix(const PerigeeCircle& circleXY, const SZLine& szLine)
43  , m_szLine(szLine)
44  {
45  }
46 
48  explicit Helix(const HelixParameters& parameters)
49  : m_circleXY(HelixUtil::getPerigeeParameters(parameters))
50  , m_szLine(HelixUtil::getSZParameters(parameters))
51  {
52  }
53 
55  Helix(double curvature, double phi0, double impact, double tanLambda, double z0)
56  : m_circleXY(curvature, phi0, impact)
58  {
59  }
60 
62  Helix(double curvature, const Vector2D& phi0Vec, double impact, double tanLambda, double z0)
63  : m_circleXY(curvature, phi0Vec, impact)
65  {
66  }
67 
69  void invalidate()
70  {
73  }
74 
76  bool isInvalid() const
77  {
78  return circleXY().isInvalid() and szLine().isInvalid();
79  }
80 
82  void reverse()
83  {
85  m_szLine.reverse();
86  }
87 
89  Helix reversed() const
90  {
91  return Helix(circleXY().reversed(), szLine().reversed());
92  }
93 
94  public:
97  double arcLength2DToClosest(const Vector3D& point, bool firstPeriod = true) const;
98 
104  double arcLength2DToXY(const Vector2D& point) const
105  {
106  return circleXY().arcLengthTo(point);
107  }
108 
114  double arcLength2DToCylindricalR(double cylindricalR) const
115  {
116  return circleXY().arcLengthToCylindricalR(cylindricalR);
117  }
118 
120  Vector3D closest(const Vector3D& point, bool firstPeriod = true) const
121  {
122  double arcLength2D = arcLength2DToClosest(point, firstPeriod);
123  return atArcLength2D(arcLength2D);
124  }
125 
127  Vector3D closestXY(const Vector2D& pointXY) const
128  {
129  double arcLength2D = arcLength2DToXY(pointXY);
130  return atArcLength2D(arcLength2D);
131  }
132 
134  double distance(const Vector3D& point) const
135  {
136  return point.distance(closest(point));
137  }
138 
140  double distanceXY(const Vector2D& point) const
141  {
142  return m_circleXY.distance(point);
143  }
144 
149  double passiveMoveBy(const Vector3D& by)
150  {
151  // First keep the necessary shift of the perpendicular travel distance to the new perigee
152  // point.
153  double byS = circleXY().arcLengthTo(by.xy());
155  Vector2D bySZ(byS, by.z());
156  m_szLine.passiveMoveBy(bySZ);
157  return byS;
158  }
159 
162 
167  double shiftPeriod(int nPeriods)
168  {
169  double arcLength2D = nPeriods * fabs(perimeterXY());
170  m_szLine.passiveMoveBy(Vector2D(arcLength2D, 0.0));
171  return arcLength2D;
172  }
173 
176  Vector3D atArcLength2D(double s) const
177  {
178  return Vector3D(circleXY().atArcLength(s), szLine().map(s));
179  }
180 
182  Vector3D atZ(double z) const
183  {
184  return Vector3D(xyAtZ(z), z);
185  }
186 
188  Vector2D xyAtZ(double z) const
189  {
190  return Vector2D(circleXY().atArcLength(szLine().inverseMap(z)));
191  }
192 
194  double minimalCylindricalR() const
195  {
197  }
198 
200  double maximalCylindricalR() const
201  {
203  }
204 
206  double curvatureXY() const
207  {
208  return circleXY().curvature();
209  }
210 
212  double impactXY() const
213  {
214  return circleXY().impact();
215  }
216 
218  double omega() const
219  {
220  return circleXY().omega();
221  }
222 
224  double d0() const
225  {
226  return circleXY().d0();
227  }
228 
230  Vector2D perigeeXY() const
231  {
232  return circleXY().perigee();
233  }
234 
236  Vector3D perigee() const
237  {
238  return Vector3D(perigeeXY(), z0());
239  }
240 
242  double tanLambda() const
243  {
244  return m_szLine.tanLambda();
245  }
246 
248  double cotTheta() const
249  {
250  return tanLambda();
251  }
252 
254  double z0() const
255  {
256  return m_szLine.z0();
257  }
258 
261  double zPeriod() const
262  {
263  return tanLambda() * arcLength2DPeriod();
264  }
265 
267  double arcLength2DPeriod() const
268  {
270  }
271 
273  double perimeterXY() const
274  {
275  return circleXY().perimeter();
276  }
277 
279  double radiusXY() const
280  {
281  return circleXY().radius();
282  }
283 
285  Vector2D centerXY() const
286  {
287  return circleXY().center();
288  }
289 
291  Vector3D tangential() const
292  {
293  return Vector3D(phi0Vec(), tanLambda()).unit();
294  }
295 
297  const Vector2D& phi0Vec() const
298  {
299  return circleXY().phi0Vec();
300  }
301 
303  double phi0() const
304  {
305  return circleXY().phi0();
306  }
307 
310  {
312  using namespace NHelixParameterIndices;
313  result(c_Curv) = curvatureXY();
314  result(c_Phi0) = phi0();
315  result(c_I) = impactXY();
316  result(c_TanL) = tanLambda();
317  result(c_Z0) = z0();
318  return result;
319  }
320 
322  const PerigeeCircle& circleXY() const
323  {
324  return m_circleXY;
325  }
326 
328  const SZLine& szLine() const
329  {
330  return m_szLine;
331  }
332 
333  private:
336 
340 
341  };
342 
344  std::ostream& operator<<(std::ostream& output, const Helix& helix);
345  }
347 }
Belle2::TrackFindingCDC::Helix::invalidate
void invalidate()
Sets all circle parameters to zero.
Definition: Helix.h:77
Belle2::TrackFindingCDC::SZLine::tanLambda
double tanLambda() const
Getter for the tan lambda parameter.
Definition: SZLine.h:62
Belle2::Vector3D
HepGeom::Vector3D< double > Vector3D
3D Vector
Definition: Cell.h:35
Belle2::TrackFindingCDC::Helix::perigee
Vector3D perigee() const
Getter for the perigee point of the helix.
Definition: Helix.h:244
Belle2::operator<<
std::ostream & operator<<(std::ostream &output, const IntervalOfValidity &iov)
Definition: IntervalOfValidity.cc:196
Belle2::TrackFindingCDC::Helix::isInvalid
bool isInvalid() const
Indicates if the stored parameter combination designates a valid helix.
Definition: Helix.h:84
Belle2::TrackFindingCDC::Helix::curvatureXY
double curvatureXY() const
Getter for the signed curvature in the xy projection.
Definition: Helix.h:214
Belle2::TrackFindingCDC::Helix::passiveMoveBy
double passiveMoveBy(const Vector3D &by)
Moves the coordinates system by the given vector.
Definition: Helix.h:157
Belle2::TrackFindingCDC::HelixUtil
Utility struct for functions and types related to the helix parameters.
Definition: HelixParameters.h:66
Belle2::TrackFindingCDC::Vector2D
A two dimensional vector which is equipped with functions for correct handeling of orientation relat...
Definition: Vector2D.h:37
Belle2::TrackFindingCDC::Helix::helixParameters
HelixParameters helixParameters() const
Getter for the five helix parameters in the order defined by EHelixParameter.h.
Definition: Helix.h:317
Belle2::TrackFindingCDC::Helix::centerXY
Vector2D centerXY() const
Getter for the central point of the helix.
Definition: Helix.h:293
Belle2::TrackFindingCDC::Helix::xyAtZ
Vector2D xyAtZ(double z) const
Calculates the point, which lies at the given z coordinate.
Definition: Helix.h:196
Belle2::TrackFindingCDC::SZLine::invalidate
void invalidate()
Sets the parameters to a invalid representation.
Definition: SZLine.h:145
Belle2::TrackFindingCDC::PerigeeCircle::arcLengthTo
double arcLengthTo(const Vector2D &point) const
Calculates the arc length between the perigee and the given point.
Definition: PerigeeCircle.cc:238
Belle2::TrackFindingCDC::Helix::perigeeXY
Vector2D perigeeXY() const
Getter for the perigee point in the xy projection.
Definition: Helix.h:238
Belle2::TrackFindingCDC::SZLine::isInvalid
bool isInvalid() const
Indicates if the line parameters do not represent a valid line.
Definition: SZLine.h:152
Belle2::TrackFindingCDC::Helix
Extension of the generalized circle also caching the perigee coordinates.
Definition: Helix.h:38
Belle2::TrackFindingCDC::Helix::reversed
Helix reversed() const
Returns a copy of the helix with flips the travel direction, pivot point is the same.
Definition: Helix.h:97
Belle2::TrackFindingCDC::Helix::tanLambda
double tanLambda() const
Getter for the proportinality factor from arc length in xy space to z.
Definition: Helix.h:250
Belle2::TrackFindingCDC::Helix::arcLength2DToXY
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:112
Belle2::TrackFindingCDC::PerigeeCircle::minimalCylindricalR
double minimalCylindricalR() const
Gives the minimal cylindrical radius the circle reaches (unsigned)
Definition: PerigeeCircle.h:320
Belle2::TrackFindingCDC::Helix::m_szLine
SZLine m_szLine
Memory of the of the linear relation between perpendicular travel distance and the z position.
Definition: Helix.h:347
Belle2::TrackFindingCDC::SZLine
A line in the sz space.
Definition: SZLine.h:36
Belle2::TrackFindingCDC::Helix::shiftPeriod
double shiftPeriod(int nPeriods)
Adjust the arclength measure to start n periods later.
Definition: Helix.h:175
Belle2::TrackFindingCDC::Helix::m_circleXY
PerigeeCircle m_circleXY
Memory of the projection of the helix in xy space.
Definition: Helix.h:343
Belle2::TrackFindingCDC::PerigeeCircle::impact
double impact() const
Getter for the signed distance of the origin to the circle.
Definition: PerigeeCircle.h:444
Belle2::TrackFindingCDC::Helix::arcLength2DToClosest
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:31
Belle2::TrackFindingCDC::Helix::minimalCylindricalR
double minimalCylindricalR() const
Gives the minimal cylindrical radius the circle reaches (unsigned)
Definition: Helix.h:202
Belle2::TrackFindingCDC::Helix::szLine
const SZLine & szLine() const
Getter for the projection into xy space.
Definition: Helix.h:336
Belle2::TrackFindingCDC::SZLine::z0
double z0() const
Getter for the z0 parameter.
Definition: SZLine.h:92
Belle2::TrackFindingCDC::Helix::passiveMoveByJacobian
HelixJacobian passiveMoveByJacobian(const Vector3D &by) const
Computes the Jacobi matrix for a move of the coordinate system by the given vector.
Definition: Helix.cc:92
Belle2::TrackFindingCDC::Helix::arcLength2DPeriod
double arcLength2DPeriod() const
Getter for the arc length of one trip around the helix.
Definition: Helix.h:275
Belle2::TrackFindingCDC::PerigeeCircle::reverse
void reverse()
Flips the orientation of the circle in place.
Definition: PerigeeCircle.cc:128
Belle2::TrackFindingCDC::PerigeeCircle::radius
double radius() const
Gives the signed radius of the circle. If it was a line this will be infinity.
Definition: PerigeeCircle.h:344
Belle2::TrackFindingCDC::PerigeeCircle::perimeter
double perimeter() const
Gives the signed perimeter of the circle.
Definition: PerigeeCircle.h:338
Belle2::TrackFindingCDC::Helix::perimeterXY
double perimeterXY() const
Getter for the perimeter of the circle in the xy projection.
Definition: Helix.h:281
Belle2::TrackFindingCDC::Helix::radiusXY
double radiusXY() const
Getter for the radius of the circle in the xy projection.
Definition: Helix.h:287
Belle2::TrackFindingCDC::Helix::phi0Vec
const Vector2D & phi0Vec() const
Getter for the direction vector in the xy projection at the perigee of the helix.
Definition: Helix.h:305
Belle2::TrackFindingCDC::PerigeeCircle::perigee
Vector2D perigee() const
Getter for the perigee point.
Definition: PerigeeCircle.h:302
Belle2::TrackFindingCDC::Helix::arcLength2DToCylindricalR
double arcLength2DToCylindricalR(double cylindricalR) const
Calculates the two dimensional arc length that first reaches a cylindrical radius on the helix Return...
Definition: Helix.h:122
Belle2::TrackFindingCDC::PerigeeCircle::center
Vector2D center() const
Getter for the center of the circle. If it was a line both components will be infinity.
Definition: PerigeeCircle.h:308
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::TrackFindingCDC::Helix::z0
double z0() const
Getter for z coordinate at the perigee point of the helix.
Definition: Helix.h:262
Belle2::TrackFindingCDC::PerigeeCircle::phi0
double phi0() const
Getter for the azimuth angle of the direction of flight at the perigee.
Definition: PerigeeCircle.h:432
Belle2::TrackFindingCDC::Helix::atZ
Vector3D atZ(double z) const
Calculates the point, which lies at the given z coordinate.
Definition: Helix.h:190
Belle2::TrackFindingCDC::Vector3D
A three dimensional vector.
Definition: Vector3D.h:34
Belle2::TrackFindingCDC::Helix::distanceXY
double distanceXY(const Vector2D &point) const
Calculates the distance of the line parallel to the z axes through the given point.
Definition: Helix.h:148
Belle2::TrackFindingCDC::PerigeeCircle::isInvalid
bool isInvalid() const
Indicates if all circle parameters are zero.
Definition: PerigeeCircle.cc:170
Belle2::TrackFindingCDC::Vector3D::distance
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:236
Belle2::TrackFindingCDC::PerigeeCircle
Extension of the generalized circle also caching the perigee coordinates.
Definition: PerigeeCircle.h:46
Belle2::TrackFindingCDC::Helix::zPeriod
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:269
Belle2::TrackFindingCDC::Helix::circleXY
const PerigeeCircle & circleXY() const
Getter for the projection into xy space.
Definition: Helix.h:330
Belle2::TrackFindingCDC::PerigeeCircle::phi0Vec
const Vector2D & phi0Vec() const
Getter for the unit vector of the direction of flight at the perigee.
Definition: PerigeeCircle.h:438
Belle2::TrackFindingCDC::PerigeeCircle::passiveMoveBy
void passiveMoveBy(const Vector2D &by)
Moves the coordinates system by the given vector. Updates perigee parameters in place.
Definition: PerigeeCircle.cc:176
Belle2::TrackFindingCDC::Vector3D::xy
const Vector2D & xy() const
Getter for the xy projected vector ( reference ! )
Definition: Vector3D.h:500
Belle2::TrackFindingCDC::Helix::tangential
Vector3D tangential() const
Getter for the unit three dimensional tangential vector at the perigee point of the helix.
Definition: Helix.h:299
Belle2::TrackFindingCDC::PerigeeCircle::maximalCylindricalR
double maximalCylindricalR() const
Gives the maximal cylindrical radius the circle reaches.
Definition: PerigeeCircle.h:326
Belle2::TrackFindingCDC::Helix::impactXY
double impactXY() const
Getter for the signed distance to the z axes at the perigee point.
Definition: Helix.h:220
Belle2::TrackFindingCDC::Helix::Helix
Helix()
Default constructor for ROOT compatibility.
Definition: Helix.h:42
Belle2::TrackFindingCDC::PlainMatrix
A matrix implementation to be used as an interface typ through out the track finder.
Definition: PlainMatrix.h:50
Belle2::TrackFindingCDC::Vector3D::z
double z() const
Getter for the z coordinate.
Definition: Vector3D.h:488
Belle2::TrackFindingCDC::PerigeeCircle::arcLengthToCylindricalR
double arcLengthToCylindricalR(double cylindricalR) const
Calculates the two dimensional arc length till the cylindrical radius is reached If the radius can no...
Definition: PerigeeCircle.cc:258
Belle2::TrackFindingCDC::SZLine::reverse
void reverse()
Reverse the arc length direction in place.
Definition: SZLine.h:158
Belle2::TrackFindingCDC::PerigeeCircle::distance
double distance(const Vector2D &point) const
Getter for the proper signed distance of the point to the circle.
Definition: PerigeeCircle.h:220
Belle2::TrackFindingCDC::PerigeeCircle::invalidate
void invalidate()
Sets all circle parameters to zero.
Definition: PerigeeCircle.cc:162
Belle2::TrackFindingCDC::PerigeeCircle::curvature
double curvature() const
Getter for the signed curvature.
Definition: PerigeeCircle.h:426
Belle2::TrackFindingCDC::Helix::reverse
void reverse()
Flips the travel direction of the helix in place, pivot point is unchanged.
Definition: Helix.h:90
Belle2::TrackFindingCDC::PerigeeCircle::omega
double omega() const
Getter for omega parameter of the common Belle2::Helix which is the wrong sign curvature.
Definition: PerigeeCircle.h:414
Belle2::TrackFindingCDC::Helix::maximalCylindricalR
double maximalCylindricalR() const
Gives the maximal cylindrical radius the circle reaches.
Definition: Helix.h:208
Belle2::TrackFindingCDC::Helix::atArcLength2D
Vector3D atArcLength2D(double s) const
Calculates the point, which lies at the give perpendicular travel distance (counted from the perigee)
Definition: Helix.h:184
Belle2::TrackFindingCDC::PerigeeCircle::arcLengthPeriod
double arcLengthPeriod() const
Getter for the arc length for a full round of the circle.
Definition: PerigeeCircle.h:332
Belle2::TrackFindingCDC::Helix::closest
Vector3D closest(const Vector3D &point, bool firstPeriod=true) const
Calculates the point on the helix with the smallest total distance.
Definition: Helix.h:128
Belle2::TrackFindingCDC::Helix::d0
double d0() const
Getter for the signed distance to the z axes at the perigee point.
Definition: Helix.h:232
Belle2::TrackFindingCDC::Helix::phi0
double phi0() const
Getter for the azimuth angle of the direction of flight at the perigee.
Definition: Helix.h:311
Belle2::TrackFindingCDC::Helix::omega
double omega() const
Getter for the omega parameter of the common helix parameterisation.
Definition: Helix.h:226
Belle2::TrackFindingCDC::Helix::cotTheta
double cotTheta() const
Getter for the proportinality factor from arc length in xy space to z.
Definition: Helix.h:256
Belle2::TrackFindingCDC::Helix::closestXY
Vector3D closestXY(const Vector2D &pointXY) const
Calculates the point on the helix with the smallest perpendicular (xy) distance.
Definition: Helix.h:135
Belle2::TrackFindingCDC::PerigeeCircle::d0
double d0() const
Getter for d0 parameter of the common Belle2::Helix representation.
Definition: PerigeeCircle.h:420
Belle2::TrackFindingCDC::Helix::distance
double distance(const Vector3D &point) const
Calculates the distance of the point to the point of closest approach on the helix.
Definition: Helix.h:142
Belle2::TrackFindingCDC::SZLine::passiveMoveBy
void passiveMoveBy(const Vector2D &bySZ)
Passivelly move the coordinate system in place by the given sz vector.
Definition: SZLine.h:194