Belle II Software  release-08-01-10
AbsTrackRep Class Referenceabstract

Abstract base class for a track representation. More...

#include <AbsTrackRep.h>

Inheritance diagram for AbsTrackRep:
Collaboration diagram for AbsTrackRep:

Public Member Functions

 AbsTrackRep (int pdgCode, char propDir=0)
 
virtual AbsTrackRepclone () const =0
 Clone the trackRep.
 
virtual double extrapolateToPlane (StateOnPlane &state, const genfit::SharedPlanePtr &plane, bool stopAtBoundary=false, bool calcJacobianNoise=false) const =0
 Extrapolates the state to plane, and returns the extrapolation length and, via reference, the extrapolated state. More...
 
virtual double extrapolateToLine (StateOnPlane &state, const TVector3 &linePoint, const TVector3 &lineDirection, bool stopAtBoundary=false, bool calcJacobianNoise=false) const =0
 Extrapolates the state to the POCA to a line, and returns the extrapolation length and, via reference, the extrapolated state. More...
 
virtual double extrapolateToLine (StateOnPlane &state, const TVector3 &point1, const TVector3 &point2, TVector3 &poca, TVector3 &dirInPoca, TVector3 &poca_onwire, bool stopAtBoundary=false, bool calcJacobianNoise=false) const
 Resembles the interface of GFAbsTrackRep in old versions of genfit. More...
 
virtual double extrapolateToPoint (StateOnPlane &state, const TVector3 &point, bool stopAtBoundary=false, bool calcJacobianNoise=false) const =0
 Extrapolates the state to the POCA to a point, and returns the extrapolation length and, via reference, the extrapolated state. More...
 
virtual double extrapolateToPoint (StateOnPlane &state, const TVector3 &point, const TMatrixDSym &G, bool stopAtBoundary=false, bool calcJacobianNoise=false) const =0
 Extrapolates the state to the POCA to a point in the metric of G, and returns the extrapolation length and, via reference, the extrapolated state. More...
 
virtual double extrapolateToCylinder (StateOnPlane &state, double radius, const TVector3 &linePoint=TVector3(0., 0., 0.), const TVector3 &lineDirection=TVector3(0., 0., 1.), bool stopAtBoundary=false, bool calcJacobianNoise=false) const =0
 Extrapolates the state to the cylinder surface, and returns the extrapolation length and, via reference, the extrapolated state. More...
 
virtual double extrapolateToCone (StateOnPlane &state, double radius, const TVector3 &linePoint=TVector3(0., 0., 0.), const TVector3 &lineDirection=TVector3(0., 0., 1.), bool stopAtBoundary=false, bool calcJacobianNoise=false) const =0
 Extrapolates the state to the cone surface, and returns the extrapolation length and, via reference, the extrapolated state. More...
 
virtual double extrapolateToSphere (StateOnPlane &state, double radius, const TVector3 &point=TVector3(0., 0., 0.), bool stopAtBoundary=false, bool calcJacobianNoise=false) const =0
 Extrapolates the state to the sphere surface, and returns the extrapolation length and, via reference, the extrapolated state. More...
 
virtual double extrapolateBy (StateOnPlane &state, double step, bool stopAtBoundary=false, bool calcJacobianNoise=false) const =0
 Extrapolates the state by step (cm) and returns the extrapolation length and, via reference, the extrapolated state. More...
 
double extrapolateToMeasurement (StateOnPlane &state, const AbsMeasurement *measurement, bool stopAtBoundary=false, bool calcJacobianNoise=false) const
 extrapolate to an AbsMeasurement
 
virtual unsigned int getDim () const =0
 Get the dimension of the state vector used by the track representation.
 
virtual TVector3 getPos (const StateOnPlane &state) const =0
 Get the cartesian position of a state.
 
virtual TVector3 getMom (const StateOnPlane &state) const =0
 Get the cartesian momentum vector of a state.
 
TVector3 getDir (const StateOnPlane &state) const
 Get the direction vector of a state.
 
virtual void getPosMom (const StateOnPlane &state, TVector3 &pos, TVector3 &mom) const =0
 Get cartesian position and momentum vector of a state.
 
void getPosDir (const StateOnPlane &state, TVector3 &pos, TVector3 &dir) const
 Get cartesian position and direction vector of a state.
 
virtual TVectorD get6DState (const StateOnPlane &state) const
 Get the 6D state vector (x, y, z, p_x, p_y, p_z).
 
virtual TMatrixDSym get6DCov (const MeasuredStateOnPlane &state) const =0
 Get the 6D covariance.
 
virtual void getPosMomCov (const MeasuredStateOnPlane &state, TVector3 &pos, TVector3 &mom, TMatrixDSym &cov) const =0
 Translates MeasuredStateOnPlane into 3D position, momentum and 6x6 covariance.
 
virtual void get6DStateCov (const MeasuredStateOnPlane &state, TVectorD &stateVec, TMatrixDSym &cov) const
 Translates MeasuredStateOnPlane into 6D state vector (x, y, z, p_x, p_y, p_z) and 6x6 covariance.
 
virtual double getMomMag (const StateOnPlane &state) const =0
 get the magnitude of the momentum in GeV.
 
virtual double getMomVar (const MeasuredStateOnPlane &state) const =0
 get the variance of the absolute value of the momentum .
 
int getPDG () const
 Get the pdg code.
 
double getPDGCharge () const
 Get the charge of the particle of the pdg code.
 
virtual double getCharge (const StateOnPlane &state) const =0
 Get the (fitted) charge of a state. More...
 
virtual double getQop (const StateOnPlane &state) const =0
 Get charge over momentum.
 
double getMass (const StateOnPlane &state) const
 Get tha particle mass in GeV/c^2.
 
char getPropDir () const
 Get propagation direction. (-1, 0, 1) -> (backward, auto, forward).
 
virtual void getForwardJacobianAndNoise (TMatrixD &jacobian, TMatrixDSym &noise, TVectorD &deltaState) const =0
 Get the jacobian and noise matrix of the last extrapolation.
 
virtual void getBackwardJacobianAndNoise (TMatrixD &jacobian, TMatrixDSym &noise, TVectorD &deltaState) const =0
 Get the jacobian and noise matrix of the last extrapolation if it would have been done in opposite direction.
 
virtual std::vector< genfit::MatStepgetSteps () const =0
 Get stepsizes and material properties of crossed materials of the last extrapolation.
 
virtual double getRadiationLenght () const =0
 Get the accumulated X/X0 (path / radiation length) of the material crossed in the last extrapolation.
 
virtual double getTime (const StateOnPlane &) const =0
 Get the time corresponding to the StateOnPlane. Extrapolation.
 
void calcJacobianNumerically (const genfit::StateOnPlane &origState, const genfit::SharedPlanePtr destPlane, TMatrixD &jacobian) const
 Calculate Jacobian of transportation numerically. More...
 
bool switchPDGSign ()
 try to multiply pdg code with -1. (Switch from particle to anti-particle and vice versa).
 
virtual void setPosMom (StateOnPlane &state, const TVector3 &pos, const TVector3 &mom) const =0
 Set position and momentum of state.
 
virtual void setPosMom (StateOnPlane &state, const TVectorD &state6) const =0
 Set position and momentum of state.
 
virtual void setPosMomErr (MeasuredStateOnPlane &state, const TVector3 &pos, const TVector3 &mom, const TVector3 &posErr, const TVector3 &momErr) const =0
 Set position and momentum and error of state.
 
virtual void setPosMomCov (MeasuredStateOnPlane &state, const TVector3 &pos, const TVector3 &mom, const TMatrixDSym &cov6x6) const =0
 Set position, momentum and covariance of state.
 
virtual void setPosMomCov (MeasuredStateOnPlane &state, const TVectorD &state6, const TMatrixDSym &cov6x6) const =0
 Set position, momentum and covariance of state.
 
virtual void setChargeSign (StateOnPlane &state, double charge) const =0
 Set the sign of the charge according to charge.
 
virtual void setQop (StateOnPlane &state, double qop) const =0
 Set charge/momentum.
 
virtual void setTime (StateOnPlane &state, double time) const =0
 Set time at which the state was defined.
 
void setPropDir (int dir)
 Set propagation direction. (-1, 0, 1) -> (backward, auto, forward).
 
void switchPropDir ()
 Switch propagation direction. Has no effect if propDir_ is set to 0.
 
virtual bool isSameType (const AbsTrackRep *other)=0
 check if other is of same type (e.g. RKTrackRep).
 
virtual bool isSame (const AbsTrackRep *other)=0
 check if other is of same type (e.g. RKTrackRep) and has same pdg code.
 
virtual void setDebugLvl (unsigned int lvl=1)
 
virtual void Print (const Option_t *="") const
 

Protected Member Functions

 AbsTrackRep (const AbsTrackRep &)
 protect from calling copy c'tor from outside the class. Use clone() if you want a copy!
 
AbsTrackRepoperator= (const AbsTrackRep &)
 protect from calling assignment operator from outside the class. Use clone() instead!
 

Protected Attributes

int pdgCode_
 Particle code.
 
char propDir_
 propagation direction (-1, 0, 1) -> (backward, auto, forward)
 
unsigned int debugLvl_
 

Detailed Description

Abstract base class for a track representation.

Provides functionality to extrapolate a StateOnPlane to another DetPlane, to the POCA to a line or a point, or a cylinder or sphere. Defines a set of parameters describing the track. StateOnPlane objects are always defined with a track parameterization of a specific AbsTrackRep. The AbsTrackRep provides functionality to translate from the internal representation of a state into cartesian position and momentum (and covariance) and vice versa.

Definition at line 66 of file AbsTrackRep.h.

Member Function Documentation

◆ calcJacobianNumerically()

void calcJacobianNumerically ( const genfit::StateOnPlane origState,
const genfit::SharedPlanePtr  destPlane,
TMatrixD &  jacobian 
) const

Calculate Jacobian of transportation numerically.

Slow but accurate. Can be used to validate (semi)analytic calculations.

Definition at line 105 of file AbsTrackRep.cc.

107  {
108 
109  // Find the transport matrix for track propagation from origState to destPlane
110  // I.e. this finds
111  // d stateDestPlane / d origState |_origState
112 
113  jacobian.ResizeTo(getDim(), getDim());
114 
115  // no science behind these values, I verified that forward and
116  // backward propagation yield inverse matrices to good
117  // approximation. In order to avoid bad roundoff errors, the actual
118  // step taken is determined below, separately for each direction.
119  const double defaultStepX = 1.E-5;
120  double stepX;
121 
122  // Calculate derivative for all three dimensions successively.
123  // The algorithm follows the one in TF1::Derivative() :
124  // df(x) = (4 D(h/2) - D(h)) / 3
125  // with D(h) = (f(x + h) - f(x - h)) / (2 h).
126  //
127  // Could perhaps do better by also using f(x) which would be stB.
128  TVectorD rightShort(getDim()), rightFull(getDim());
129  TVectorD leftShort(getDim()), leftFull(getDim());
130  for (size_t i = 0; i < getDim(); ++i) {
131  {
132  genfit::StateOnPlane stateCopy(origState);
133  double temp = stateCopy.getState()(i) + defaultStepX / 2;
134  // Find the actual size of the step, which will differ from
135  // defaultStepX due to roundoff. This is the step-size we will
136  // use for this direction. Idea taken from Numerical Recipes,
137  // 3rd ed., section 5.7.
138  //
139  // Note that if a number is exactly representable, it's double
140  // will also be exact. Outside denormals, this also holds for
141  // halving. Unless the exponent changes (which it only will in
142  // the vicinity of zero) adding or subtracing doesn't make a
143  // difference.
144  //
145  // We determine the roundoff error for the half-step. If this
146  // is exactly representable, the full step will also be.
147  stepX = 2 * (temp - stateCopy.getState()(i));
148  (stateCopy.getState())(i) = temp;
149  extrapolateToPlane(stateCopy, destPlane);
150  rightShort = stateCopy.getState();
151  }
152  {
153  genfit::StateOnPlane stateCopy(origState);
154  (stateCopy.getState())(i) -= stepX / 2;
155  extrapolateToPlane(stateCopy, destPlane);
156  leftShort = stateCopy.getState();
157  }
158  {
159  genfit::StateOnPlane stateCopy(origState);
160  (stateCopy.getState())(i) += stepX;
161  extrapolateToPlane(stateCopy, destPlane);
162  rightFull = stateCopy.getState();
163  }
164  {
165  genfit::StateOnPlane stateCopy(origState);
166  (stateCopy.getState())(i) -= stepX;
167  extrapolateToPlane(stateCopy, destPlane);
168  leftFull = stateCopy.getState();
169  }
170 
171  // Calculate the derivatives for the individual components of
172  // the track parameters.
173  for (size_t j = 0; j < getDim(); ++j) {
174  double derivFull = (rightFull(j) - leftFull(j)) / 2 / stepX;
175  double derivShort = (rightShort(j) - leftShort(j)) / stepX;
176 
177  jacobian(j, i) = 1./3.*(4*derivShort - derivFull);
178  }
179  }
180 }
virtual unsigned int getDim() const =0
Get the dimension of the state vector used by the track representation.
virtual double extrapolateToPlane(StateOnPlane &state, const genfit::SharedPlanePtr &plane, bool stopAtBoundary=false, bool calcJacobianNoise=false) const =0
Extrapolates the state to plane, and returns the extrapolation length and, via reference,...
A state with arbitrary dimension defined in a DetPlane.
Definition: StateOnPlane.h:47

◆ extrapolateBy()

virtual double extrapolateBy ( StateOnPlane state,
double  step,
bool  stopAtBoundary = false,
bool  calcJacobianNoise = false 
) const
pure virtual

Extrapolates the state by step (cm) and returns the extrapolation length and, via reference, the extrapolated state.

If stopAtBoundary is true, the extrapolation stops as soon as a material boundary is encountered.

If state has a covariance, jacobian and noise matrices will be calculated and the covariance will be propagated. If state has no covariance, jacobian and noise will only be calculated if calcJacobianNoise == true.

Implemented in RKTrackRep.

◆ extrapolateToCone()

virtual double extrapolateToCone ( StateOnPlane state,
double  radius,
const TVector3 &  linePoint = TVector3(0., 0., 0.),
const TVector3 &  lineDirection = TVector3(0., 0., 1.),
bool  stopAtBoundary = false,
bool  calcJacobianNoise = false 
) const
pure virtual

Extrapolates the state to the cone surface, and returns the extrapolation length and, via reference, the extrapolated state.

If stopAtBoundary is true, the extrapolation stops as soon as a material boundary is encountered.

If state has a covariance, jacobian and noise matrices will be calculated and the covariance will be propagated. If state has no covariance, jacobian and noise will only be calculated if calcJacobianNoise == true.

Implemented in RKTrackRep.

◆ extrapolateToCylinder()

virtual double extrapolateToCylinder ( StateOnPlane state,
double  radius,
const TVector3 &  linePoint = TVector3(0., 0., 0.),
const TVector3 &  lineDirection = TVector3(0., 0., 1.),
bool  stopAtBoundary = false,
bool  calcJacobianNoise = false 
) const
pure virtual

Extrapolates the state to the cylinder surface, and returns the extrapolation length and, via reference, the extrapolated state.

If stopAtBoundary is true, the extrapolation stops as soon as a material boundary is encountered.

If state has a covariance, jacobian and noise matrices will be calculated and the covariance will be propagated. If state has no covariance, jacobian and noise will only be calculated if calcJacobianNoise == true.

Implemented in RKTrackRep.

◆ extrapolateToLine() [1/2]

virtual double extrapolateToLine ( StateOnPlane state,
const TVector3 &  linePoint,
const TVector3 &  lineDirection,
bool  stopAtBoundary = false,
bool  calcJacobianNoise = false 
) const
pure virtual

Extrapolates the state to the POCA to a line, and returns the extrapolation length and, via reference, the extrapolated state.

If stopAtBoundary is true, the extrapolation stops as soon as a material boundary is encountered.

If state has a covariance, jacobian and noise matrices will be calculated and the covariance will be propagated. If state has no covariance, jacobian and noise will only be calculated if calcJacobianNoise == true.

Implemented in RKTrackRep.

◆ extrapolateToLine() [2/2]

virtual double extrapolateToLine ( StateOnPlane state,
const TVector3 &  point1,
const TVector3 &  point2,
TVector3 &  poca,
TVector3 &  dirInPoca,
TVector3 &  poca_onwire,
bool  stopAtBoundary = false,
bool  calcJacobianNoise = false 
) const
inlinevirtual

Resembles the interface of GFAbsTrackRep in old versions of genfit.

This interface to extrapolateToLine is intended to resemble the interface of GFAbsTrackRep in old versions of genfit and is implemented by default via the preceding function.

If stopAtBoundary is true, the extrapolation stops as soon as a material boundary is encountered.

If state has a covariance, jacobian and noise matrices will be calculated and the covariance will be propagated. If state has no covariance, jacobian and noise will only be calculated if calcJacobianNoise == true.

Definition at line 120 of file AbsTrackRep.h.

127  {
128  TVector3 wireDir(point2 - point1);
129  wireDir = wireDir.Unit();
130  double retval = this->extrapolateToLine(state, point1, wireDir, stopAtBoundary, calcJacobianNoise);
131  poca = this->getPos(state);
132  dirInPoca = this->getMom(state);
133  dirInPoca = dirInPoca.Unit();
134 
135  poca_onwire = point1 + wireDir*((poca - point1)*wireDir);
136 
137  return retval;
138  }
virtual double extrapolateToLine(StateOnPlane &state, const TVector3 &linePoint, const TVector3 &lineDirection, bool stopAtBoundary=false, bool calcJacobianNoise=false) const =0
Extrapolates the state to the POCA to a line, and returns the extrapolation length and,...
virtual TVector3 getMom(const StateOnPlane &state) const =0
Get the cartesian momentum vector of a state.
virtual TVector3 getPos(const StateOnPlane &state) const =0
Get the cartesian position of a state.
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.

◆ extrapolateToPlane()

virtual double extrapolateToPlane ( StateOnPlane state,
const genfit::SharedPlanePtr plane,
bool  stopAtBoundary = false,
bool  calcJacobianNoise = false 
) const
pure virtual

Extrapolates the state to plane, and returns the extrapolation length and, via reference, the extrapolated state.

If stopAtBoundary is true, the extrapolation stops as soon as a material boundary is encountered.

If state has a covariance, jacobian and noise matrices will be calculated and the covariance will be propagated. If state has no covariance, jacobian and noise will only be calculated if calcJacobianNoise == true.

Implemented in RKTrackRep.

◆ extrapolateToPoint() [1/2]

virtual double extrapolateToPoint ( StateOnPlane state,
const TVector3 &  point,
bool  stopAtBoundary = false,
bool  calcJacobianNoise = false 
) const
pure virtual

Extrapolates the state to the POCA to a point, and returns the extrapolation length and, via reference, the extrapolated state.

If stopAtBoundary is true, the extrapolation stops as soon as a material boundary is encountered.

If state has a covariance, jacobian and noise matrices will be calculated and the covariance will be propagated. If state has no covariance, jacobian and noise will only be calculated if calcJacobianNoise == true.

Implemented in RKTrackRep.

◆ extrapolateToPoint() [2/2]

virtual double extrapolateToPoint ( StateOnPlane state,
const TVector3 &  point,
const TMatrixDSym &  G,
bool  stopAtBoundary = false,
bool  calcJacobianNoise = false 
) const
pure virtual

Extrapolates the state to the POCA to a point in the metric of G, and returns the extrapolation length and, via reference, the extrapolated state.

If stopAtBoundary is true, the extrapolation stops as soon as a material boundary is encountered.

If state has a covariance, jacobian and noise matrices will be calculated and the covariance will be propagated. If state has no covariance, jacobian and noise will only be calculated if calcJacobianNoise == true.

Implemented in RKTrackRep.

◆ extrapolateToSphere()

virtual double extrapolateToSphere ( StateOnPlane state,
double  radius,
const TVector3 &  point = TVector3(0., 0., 0.),
bool  stopAtBoundary = false,
bool  calcJacobianNoise = false 
) const
pure virtual

Extrapolates the state to the sphere surface, and returns the extrapolation length and, via reference, the extrapolated state.

If stopAtBoundary is true, the extrapolation stops as soon as a material boundary is encountered.

If state has a covariance, jacobian and noise matrices will be calculated and the covariance will be propagated. If state has no covariance, jacobian and noise will only be calculated if calcJacobianNoise == true.

Implemented in RKTrackRep.

◆ getCharge()

virtual double getCharge ( const StateOnPlane state) const
pure virtual

Get the (fitted) charge of a state.

This is not always equal the pdg charge (e.g. if the charge sign was flipped during the fit).

Implemented in RKTrackRep, and MplTrackRep.


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