Belle II Software prerelease-10-00-00a
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 <framework/datastore/RelationsObject.h>
11
12#include <Math/Vector3D.h>
13#include <TMatrixDfwd.h>
14
15#include <cmath>
16
17namespace Belle2 {
22
23 namespace HelixParameterIndex {
25 enum HelixParameterIndex {
26 iD0 = 0,
27 iPhi0 = 1,
28 iOmega = 2,
29 iZ0 = 3,
30 iTanLambda = 4,
34 iArcLength2D = 5,
35 };
36 }
37
59 class Helix : public RelationsObject {
60 public:
61
64
75 Helix(const ROOT::Math::XYZVector& position,
76 const ROOT::Math::XYZVector& momentum,
77 const short int charge,
78 const double bZ);
79
90 Helix(const double& d0,
91 const double& phi0,
92 const double& omega,
93 const double& z0,
94 const double& tanLambda);
95
97 friend std::ostream& operator<<(std::ostream& output, const Helix& helix);
98
99
100 //---------------------------------------------------------------------------------------------------------------------------
103 //---------------------------------------------------------------------------------------------------------------------------
104 public:
106 double getPerigeeX() const;
107
109 double getPerigeeY() const;
110
112 double getPerigeeZ() const;
113
115 ROOT::Math::XYZVector getPerigee() const;
116
120 double getMomentumX(const double bZ) const;
121
125 double getMomentumY(const double bZ) const;
126
130 double getMomentumZ(const double bZ) const;
131
138 ROOT::Math::XYZVector getMomentum(const double bZ) const;
139
144 ROOT::Math::XYZVector getDirection() const;
145
150 double getTransverseMomentum(const double bZ) const;
151
153 double getKappa(const double bZ) const;
154
156 static double getAlpha(const double bZ);
157
159 short getChargeSign() const;
161
162
163 //---------------------------------------------------------------------------------------------------------------------------
166 //---------------------------------------------------------------------------------------------------------------------------
167 public:
181 double getArcLength2DAtCylindricalR(const double& cylindricalR) const;
182
194 double getArcLength2DAtXY(const double& x, const double& y) const;
195
206 double getArcLength2DAtNormalPlane(const double& x, const double& y,
207 const double& nX, const double& nY) const;
208
213 ROOT::Math::XYZVector getPositionAtArcLength2D(const double& arcLength2D) const;
214
225 ROOT::Math::XYZVector getTangentialAtArcLength2D(const double& arcLength2D) const;
226
231 ROOT::Math::XYZVector getUnitTangentialAtArcLength2D(const double& arcLength2D) const;
232
238 ROOT::Math::XYZVector getMomentumAtArcLength2D(const double& arcLength2D, const double& bz) const;
239
245 double passiveMoveBy(const ROOT::Math::XYZVector& by)
246 { return passiveMoveBy(by.X(), by.Y(), by.Z()); }
247
256 double passiveMoveBy(const double& byX,
257 const double& byY,
258 const double& byZ);
259
260
271 TMatrixD calcPassiveMoveByJacobian(const ROOT::Math::XYZVector& by, const double expandBelowChi = M_PI / 8) const;
272
273
274 protected:
275 public:
295 void calcPassiveMoveByJacobian(const double& byX,
296 const double& byY,
297 TMatrixD& jacobian,
298 const double expandBelowChi = M_PI / 8) const;
299
300 public:
308 void reverse();
309
315 static double reversePhi(const double& phi);
316
322 double calcArcLength2DFromSecantLength(const double& secantLength2D) const;
323
326 double calcSecantLengthToArcLength2DFactor(const double& secantLength2D) const;
328
329 protected:
331 static double calcASinXDividedByX(const double& x);
332
334 static double calcATanXDividedByX(const double& x);
335
337 static double calcDerivativeOfATanXDividedByX(const double& x);
338
348 void calcArcLength2DAndDrAtXY(const double& x, const double& y, double& arcLength2D, double& dr) const;
349
358 double calcArcLength2DAtDeltaCylindricalRAndDr(const double& deltaCylindricalR, const double& dr) const;
359
360
361 //---------------------------------------------------------------------------------------------------------------------------
364 //---------------------------------------------------------------------------------------------------------------------------
365 public:
372 double getD0() const { return m_d0; }
373
378 double getPhi0() const { return m_phi0; }
379
381 double getCosPhi0() const { return std::cos(getPhi0()); }
382
384 double getSinPhi0() const { return std::sin(getPhi0()); }
385
387 double getOmega() const { return m_omega; }
388
390 double getZ0() const { return m_z0; }
391
393 double getTanLambda() const { return m_tanLambda; }
394
396 double getCotTheta() const { return m_tanLambda; }
398
400 private:
401 //---------------------------------------------------------------------------------------------------------------------------
402 //--- Functions for internal conversions between cartesian and perigee helix parameters
403 //--- This can be placed in a separate header which handles all the conversion stuff
404 //---------------------------------------------------------------------------------------------------------------------------
405
408 void setCartesian(const ROOT::Math::XYZVector& position,
409 const ROOT::Math::XYZVector& momentum,
410 const short int charge,
411 const double bZ);
412
414 Double32_t m_d0;
415
417 Double32_t m_phi0;
418
420 Double32_t m_omega;
421
423 Double32_t m_z0;
424
426 Double32_t m_tanLambda;
427
429 };
430
431}
432
Helix(const HepPoint3D &pivot, const HepVector &a, const HepSymMatrix &Ea)
Constructor with pivot, helix parameter a, and its error matrix.
Definition Helix.cc:132
double phi0(void) const
Return helix parameter phi0.
Definition Helix.h:388
double dr(void) const
Return helix parameter dr.
Definition Helix.h:380
Hep3Vector momentum(double dPhi=0.) const
returns momentum vector after rotating angle dPhi in phi direction.
Definition Helix.cc:259
HepPoint3D x(double dPhi=0.) const
returns position after rotating angle dPhi in phi direction.
Definition Helix.cc:197
Double32_t m_tanLambda
Memory for the slope of the track in the z coordinate over the two dimensional arc length (dz/ds)
Definition Helix.h:426
double getPerigeeX() const
Calculates the x coordinate of the perigee point.
Definition Helix.cc:54
double getSinPhi0() const
Getter for the cosine of the azimuth angle of travel direction at the perigee.
Definition Helix.h:384
double getMomentumZ(const double bZ) const
Calculates the z momentum of the particle at the perigee point.
Definition Helix.cc:84
Double32_t m_omega
Memory for the curvature of the signed curvature.
Definition Helix.h:420
double getMomentumY(const double bZ) const
Calculates the y momentum of the particle at the perigee point.
Definition Helix.cc:79
void reverse()
Reverses the direction of travel of the helix in place.
double getCosPhi0() const
Getter for the cosine of the azimuth angle of travel direction at the perigee.
Definition Helix.h:381
double getArcLength2DAtCylindricalR(const double &cylindricalR) const
Calculates the transverse travel distance at the point the helix first reaches the given cylindrical ...
Definition Helix.cc:128
static double calcASinXDividedByX(const double &x)
Implementation of the function asin(x) / x which handles small x values smoothly.
Definition Helix.cc:438
static double reversePhi(const double &phi)
Reverses an azimuthal angle to the opposite direction.
Definition Helix.cc:421
short getChargeSign() const
Return track charge sign (1, 0 or -1).
Definition Helix.cc:114
double getArcLength2DAtXY(const double &x, const double &y) const
Calculates the two dimensional arc length at which the circle in the xy projection is closest to the ...
Definition Helix.cc:141
Double32_t m_z0
Memory for the z coordinate of the perigee.
Definition Helix.h:423
static double getAlpha(const double bZ)
Calculates the alpha value for a given magnetic field in Tesla.
Definition Helix.cc:109
double getCotTheta() const
Getter for cot theta, which is the z over two dimensional arc length slope of the track.
Definition Helix.h:396
double getOmega() const
Getter for omega, which is a signed curvature measure of the track.
Definition Helix.h:387
ROOT::Math::XYZVector getDirection() const
Getter for unit vector of momentum at the perigee position.
Definition Helix.cc:94
ROOT::Math::XYZVector getTangentialAtArcLength2D(const double &arcLength2D) const
Calculates the tangential vector to the helix curve at the given two dimensional arc length.
Definition Helix.cc:245
ROOT::Math::XYZVector getPositionAtArcLength2D(const double &arcLength2D) const
Calculates the position on the helix at the given two dimensional arc length.
Definition Helix.cc:201
Double32_t m_d0
Memory for the signed distance to the perigee.
Definition Helix.h:414
ROOT::Math::XYZVector getUnitTangentialAtArcLength2D(const double &arcLength2D) const
Calculates the unit tangential vector to the helix curve at the given two dimensional arc length.
Definition Helix.cc:261
double getPerigeeZ() const
Calculates the z coordinate of the perigee point.
Definition Helix.cc:64
double getD0() const
Getter for d0, which is the signed distance to the perigee in the r-phi plane.
Definition Helix.h:372
ROOT::Math::XYZVector getMomentum(const double bZ) const
Getter for vector of momentum at the perigee position.
Definition Helix.cc:89
void calcArcLength2DAndDrAtXY(const double &x, const double &y, double &arcLength2D, double &dr) const
Helper method to calculate the signed two dimensional arc length and the signed distance to the circl...
Definition Helix.cc:545
double passiveMoveBy(const ROOT::Math::XYZVector &by)
Moves origin of the coordinate system (passive transformation) by the given vector.
Definition Helix.h:245
double getArcLength2DAtNormalPlane(const double &x, const double &y, const double &nX, const double &nY) const
Calculates the arc length to reach a plane parallel to the z axes.
Definition Helix.cc:149
double getMomentumX(const double bZ) const
Calculates the x momentum of the particle at the perigee point.
Definition Helix.cc:74
double getTanLambda() const
Getter for tan lambda, which is the z over two dimensional arc length slope of the track.
Definition Helix.h:393
double getPerigeeY() const
Calculates the y coordinate of the perigee point.
Definition Helix.cc:59
double calcSecantLengthToArcLength2DFactor(const double &secantLength2D) const
Helper function to calculate the factor between the dimensional secant length and the two dimensional...
Definition Helix.cc:432
Double32_t m_phi0
Memory for the azimuth angle between the transverse momentum and the x axis, which is in [-pi,...
Definition Helix.h:417
double calcArcLength2DAtDeltaCylindricalRAndDr(const double &deltaCylindricalR, const double &dr) const
Helper method to calculate the two dimensional arc length from the perigee to a point at cylindrical ...
Definition Helix.cc:581
double calcArcLength2DFromSecantLength(const double &secantLength2D) const
Helper function to calculate the two dimensional arc length from the length of a secant.
Definition Helix.cc:426
double getZ0() const
Getter for z0, which is the z coordinate of the perigee.
Definition Helix.h:390
double getKappa(const double bZ) const
Getter for kappa, which is charge / transverse momentum or equivalently omega * alpha.
Definition Helix.cc:104
static double calcDerivativeOfATanXDividedByX(const double &x)
Implementation of the function d / dx (atan(x) / x) which handles small x values smoothly.
Definition Helix.cc:509
Helix()
Constructor initializing all perigee parameters to zero.
ClassDef(Helix, 2)
This class represents an ideal helix in perigee parameterization.
ROOT::Math::XYZVector getMomentumAtArcLength2D(const double &arcLength2D, const double &bz) const
Calculates the momentum vector at the given two dimensional arc length.
Definition Helix.cc:270
ROOT::Math::XYZVector getPerigee() const
Getter for the perigee position.
Definition Helix.cc:69
double getTransverseMomentum(const double bZ) const
Getter for the absolute value of the transverse momentum at the perigee.
Definition Helix.cc:99
double getPhi0() const
Getter for phi0, which is the azimuth angle of the transverse momentum at the perigee.
Definition Helix.h:378
static double calcATanXDividedByX(const double &x)
Implementation of the function atan(x) / x which handles small x values smoothly.
Definition Helix.cc:477
std::ostream & operator<<(std::ostream &output, const IntervalOfValidity &iov)
RelationsInterface< TObject > RelationsObject
Provides interface for getting/adding relations to objects in StoreArrays.
Abstract base class for different kinds of events.