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: Martin Heck, Markus Prim *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 #pragma once
11 
12 #include <framework/datastore/RelationsObject.h>
13 
14 #include <TVector3.h>
15 #include <TMatrixDfwd.h>
16 
17 #include <cmath>
18 
19 namespace Belle2 {
25  namespace HelixParameterIndex {
27  enum HelixParameterIndex {
28  iD0 = 0,
29  iPhi0 = 1,
30  iOmega = 2,
31  iZ0 = 3,
32  iTanLambda = 4,
36  iArcLength2D = 5,
37  };
38  }
39 
61  class Helix : public RelationsObject {
62  public:
63 
65  Helix();
66 
77  Helix(const TVector3& position,
78  const TVector3& momentum,
79  const short int charge,
80  const double bZ);
81 
92  Helix(const double& d0,
93  const double& phi0,
94  const double& omega,
95  const double& z0,
96  const double& tanLambda);
97 
99  friend std::ostream& operator<<(std::ostream& output, const Helix& helix);
100 
101 
102  //---------------------------------------------------------------------------------------------------------------------------
105  //---------------------------------------------------------------------------------------------------------------------------
106  public:
108  double getPerigeeX() const;
109 
111  double getPerigeeY() const;
112 
114  double getPerigeeZ() const;
115 
117  TVector3 getPerigee() const;
118 
122  double getMomentumX(const double bZ) const;
123 
127  double getMomentumY(const double bZ) const;
128 
132  double getMomentumZ(const double bZ) const;
133 
140  TVector3 getMomentum(const double bZ) const;
141 
146  TVector3 getDirection() const;
147 
152  double getTransverseMomentum(const double bZ) const;
153 
155  double getKappa(const double bZ) const;
156 
158  static double getAlpha(const double bZ);
159 
161  short getChargeSign() const;
163 
164 
165  //---------------------------------------------------------------------------------------------------------------------------
168  //---------------------------------------------------------------------------------------------------------------------------
169  public:
183  double getArcLength2DAtCylindricalR(const double& cylindricalR) const;
184 
196  double getArcLength2DAtXY(const double& x, const double& y) const;
197 
208  double getArcLength2DAtNormalPlane(const double& x, const double& y,
209  const double& nX, const double& nY) const;
210 
215  TVector3 getPositionAtArcLength2D(const double& arcLength2D) const;
216 
227  TVector3 getTangentialAtArcLength2D(const double& arcLength2D) const;
228 
233  TVector3 getUnitTangentialAtArcLength2D(const double& arcLength2D) const;
234 
240  TVector3 getMomentumAtArcLength2D(const double& arcLength2D, const double& bz) const;
241 
247  double passiveMoveBy(const TVector3& by)
248  { return passiveMoveBy(by.X(), by.Y(), by.Z()); }
249 
258  double passiveMoveBy(const double& byX,
259  const double& byY,
260  const double& byZ);
261 
262 
273  TMatrixD calcPassiveMoveByJacobian(const TVector3& by, const double expandBelowChi = M_PI / 8) const;
274 
275 
276  protected:
277  public:
297  void calcPassiveMoveByJacobian(const double& byX,
298  const double& byY,
299  TMatrixD& jacobian,
300  const double expandBelowChi = M_PI / 8) const;
301 
302  public:
310  void reverse();
311 
317  static double reversePhi(const double& phi);
318 
324  double calcArcLength2DFromSecantLength(const double& secantLength2D) const;
325 
328  double calcSecantLengthToArcLength2DFactor(const double& secantLength2D) const;
330 
331  protected:
333  static double calcASinXDividedByX(const double& x);
334 
336  static double calcATanXDividedByX(const double& x);
337 
339  static double calcDerivativeOfATanXDividedByX(const double& x);
340 
350  void calcArcLength2DAndDrAtXY(const double& x, const double& y, double& arcLength2D, double& dr) const;
351 
360  double calcArcLength2DAtDeltaCylindricalRAndDr(const double& deltaCylindricalR, const double& dr) const;
361 
362 
363  //---------------------------------------------------------------------------------------------------------------------------
366  //---------------------------------------------------------------------------------------------------------------------------
367  public:
374  double getD0() const { return m_d0; }
375 
380  double getPhi0() const { return m_phi0; }
381 
383  double getCosPhi0() const { return std::cos(getPhi0()); }
384 
386  double getSinPhi0() const { return std::sin(getPhi0()); }
387 
389  double getOmega() const { return m_omega; }
390 
392  double getZ0() const { return m_z0; }
393 
395  double getTanLambda() const { return m_tanLambda; }
396 
398  double getCotTheta() const { return m_tanLambda; }
400 
402  private:
403  //---------------------------------------------------------------------------------------------------------------------------
404  //--- Functions for internal conversions between cartesian and perigee helix parameters
405  //--- This can be placed in a seperate header which handles all the conversion stuff
406  //---------------------------------------------------------------------------------------------------------------------------
407 
410  void setCartesian(const TVector3& position,
411  const TVector3& momentum,
412  const short int charge,
413  const double bZ);
414 
416  Double32_t m_d0;
417 
419  Double32_t m_phi0;
420 
422  Double32_t m_omega;
423 
425  Double32_t m_z0;
426 
428  Double32_t m_tanLambda;
429 
431  };
433 }
434 
Belle2::operator<<
std::ostream & operator<<(std::ostream &output, const IntervalOfValidity &iov)
Definition: IntervalOfValidity.cc:196
Belle2::Helix::getTransverseMomentum
double getTransverseMomentum(const double bZ) const
Getter for the absolute value of the transverse momentum at the perigee.
Definition: Helix.cc:100
Belle2::Helix::getPerigeeY
double getPerigeeY() const
Calculates the y coordinate of the perigee point.
Definition: Helix.cc:60
Belle2::Helix::getTangentialAtArcLength2D
TVector3 getTangentialAtArcLength2D(const double &arcLength2D) const
Calculates the tangential vector to the helix curve at the given two dimensional arc length.
Definition: Helix.cc:246
Belle2::Helix::passiveMoveBy
double passiveMoveBy(const TVector3 &by)
Moves origin of the coordinate system (passive transformation) by the given vector.
Definition: Helix.h:255
Belle2::CDC::Helix::phi0
double phi0(void) const
Return helix parameter phi0.
Definition: Helix.h:391
Belle2::Helix::calcDerivativeOfATanXDividedByX
static double calcDerivativeOfATanXDividedByX(const double &x)
Implementation of the function d / dx (atan(x) / x) which handles small x values smoothly.
Definition: Helix.cc:510
Belle2::Helix::calcArcLength2DAndDrAtXY
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:546
Belle2::Helix::calcATanXDividedByX
static double calcATanXDividedByX(const double &x)
Implementation of the function atan(x) / x which handles small x values smoothly.
Definition: Helix.cc:478
Belle2::Helix::getZ0
double getZ0() const
Getter for z0, which is the z coordinate of the perigee.
Definition: Helix.h:400
Belle2::Helix::m_omega
Double32_t m_omega
Memory for the curvature of the signed curvature.
Definition: Helix.h:430
Belle2::Helix::getSinPhi0
double getSinPhi0() const
Getter for the cosine of the azimuth angle of travel direction at the perigee.
Definition: Helix.h:394
Belle2::Helix::getArcLength2DAtCylindricalR
double getArcLength2DAtCylindricalR(const double &cylindricalR) const
Calculates the transverse travel distance at the point the helix first reaches the given cylindrical ...
Definition: Helix.cc:129
Belle2::Helix::getMomentumAtArcLength2D
TVector3 getMomentumAtArcLength2D(const double &arcLength2D, const double &bz) const
Calculates the momentum vector at the given two dimensional arc length.
Definition: Helix.cc:271
Belle2::Helix::reverse
void reverse()
Reverses the direction of travel of the helix in place.
Definition: Helix.cc:120
Belle2::CDC::Helix::momentum
Hep3Vector momentum(double dPhi=0.) const
returns momentum vector after rotating angle dPhi in phi direction.
Definition: Helix.cc:261
Belle2::Helix::getMomentumX
double getMomentumX(const double bZ) const
Calculates the x momentum of the particle at the perigee point.
Definition: Helix.cc:75
Belle2::CDC::Helix::x
HepPoint3D x(double dPhi=0.) const
returns position after rotating angle dPhi in phi direction.
Definition: Helix.cc:199
Belle2::Helix::m_z0
Double32_t m_z0
Memory for the z coordinate of the perigee.
Definition: Helix.h:433
Belle2::Helix::getPhi0
double getPhi0() const
Getter for phi0, which is the azimuth angle of the transverse momentum at the perigee.
Definition: Helix.h:388
Belle2::Helix::getChargeSign
short getChargeSign() const
Return track charge sign (1, 0 or -1).
Definition: Helix.cc:115
Belle2::Helix::calcASinXDividedByX
static double calcASinXDividedByX(const double &x)
Implementation of the function asin(x) / x which handles small x values smoothly.
Definition: Helix.cc:439
Belle2::Helix::calcSecantLengthToArcLength2DFactor
double calcSecantLengthToArcLength2DFactor(const double &secantLength2D) const
Helper function to calculate the factor between the dimensional secant length and the two dimensional...
Definition: Helix.cc:433
Belle2::Helix::getPositionAtArcLength2D
TVector3 getPositionAtArcLength2D(const double &arcLength2D) const
Calculates the position on the helix at the given two dimensional arc length.
Definition: Helix.cc:202
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::Helix::setCartesian
void setCartesian(const TVector3 &position, const TVector3 &momentum, const short int charge, const double bZ)
Cartesian to Perigee conversion.
Definition: Helix.cc:589
Belle2::Helix::getPerigee
TVector3 getPerigee() const
Getter for the perigee position.
Definition: Helix.cc:70
Belle2::Helix::calcArcLength2DAtDeltaCylindricalRAndDr
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:582
Belle2::Helix::getAlpha
static double getAlpha(const double bZ)
Calculates the alpha value for a given magnetic field in Tesla.
Definition: Helix.cc:110
Belle2::Helix::getArcLength2DAtNormalPlane
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:150
Belle2::Helix::getCosPhi0
double getCosPhi0() const
Getter for the cosine of the azimuth angle of travel direction at the perigee.
Definition: Helix.h:391
Belle2::Helix::getDirection
TVector3 getDirection() const
Getter for unit vector of momentum at the perigee position.
Definition: Helix.cc:95
Belle2::Helix::m_phi0
Double32_t m_phi0
Memory for the azimuth angle between the transverse momentum and the x axis, which is in [-pi,...
Definition: Helix.h:427
Belle2::Helix::getPerigeeZ
double getPerigeeZ() const
Calculates the z coordinate of the perigee point.
Definition: Helix.cc:65
Belle2::Helix::getKappa
double getKappa(const double bZ) const
Getter for kappa, which is charge / transverse momentum or equivalently omega * alpha.
Definition: Helix.cc:105
Belle2::Helix::getUnitTangentialAtArcLength2D
TVector3 getUnitTangentialAtArcLength2D(const double &arcLength2D) const
Calculates the unit tangential vector to the helix curve at the given two dimensional arc length.
Definition: Helix.cc:262
Belle2::CDC::Helix
Helix parameter class.
Definition: Helix.h:51
Belle2::Helix::getCotTheta
double getCotTheta() const
Getter for cot theta, which is the z over two dimensional arc length slope of the track.
Definition: Helix.h:406
Belle2::Helix::m_d0
Double32_t m_d0
Memory for the signed distance to the perigee.
Definition: Helix.h:424
Belle2::RelationsObject
RelationsInterface< TObject > RelationsObject
Provides interface for getting/adding relations to objects in StoreArrays.
Definition: RelationsObject.h:443
Belle2::Helix::m_tanLambda
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:436
Belle2::Helix::calcPassiveMoveByJacobian
TMatrixD calcPassiveMoveByJacobian(const TVector3 &by, const double expandBelowChi=M_PI/8) const
Calculate the 5x5 jacobian matrix for the transport of the helix parameters, when moving the origin o...
Definition: Helix.cc:302
Belle2::Helix::ClassDef
ClassDef(Helix, 2)
This class represents an ideal helix in perigee parameterization.
Belle2::Helix::getMomentum
TVector3 getMomentum(const double bZ) const
Getter for vector of momentum at the perigee position.
Definition: Helix.cc:90
Belle2::Helix::getOmega
double getOmega() const
Getter for omega, which is a signed curvature measure of the track.
Definition: Helix.h:397
Belle2::Helix::getPerigeeX
double getPerigeeX() const
Calculates the x coordinate of the perigee point.
Definition: Helix.cc:55
Belle2::Helix::getMomentumZ
double getMomentumZ(const double bZ) const
Calculates the z momentum of the particle at the perigee point.
Definition: Helix.cc:85
Belle2::Helix::reversePhi
static double reversePhi(const double &phi)
Reverses an azimuthal angle to the opposite direction.
Definition: Helix.cc:422
Belle2::Helix::calcArcLength2DFromSecantLength
double calcArcLength2DFromSecantLength(const double &secantLength2D) const
Helper function to calculate the two dimensional arc length from the length of a secant.
Definition: Helix.cc:427
Belle2::Helix::getD0
double getD0() const
Getter for d0, which is the signed distance to the perigee in the r-phi plane.
Definition: Helix.h:382
Belle2::Helix::getMomentumY
double getMomentumY(const double bZ) const
Calculates the y momentum of the particle at the perigee point.
Definition: Helix.cc:80
Belle2::Helix::getTanLambda
double getTanLambda() const
Getter for tan lambda, which is the z over two dimensional arc length slope of the track.
Definition: Helix.h:403
Belle2::CDC::Helix::Helix
Helix(const HepPoint3D &pivot, const HepVector &a, const HepSymMatrix &Ea)
Constructor with pivot, helix parameter a, and its error matrix.
Definition: Helix.cc:134
Belle2::Helix::getArcLength2DAtXY
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:142
Belle2::CDC::Helix::dr
double dr(void) const
Return helix parameter dr.
Definition: Helix.h:383