20 #include "AbsTrackRep.h"
21 #include "StateOnPlane.h"
22 #include "AbsMeasurement.h"
25 #include <TDatabasePDG.h>
31 AbsTrackRep::AbsTrackRep() :
32 pdgCode_(0), propDir_(0), debugLvl_(0)
37 AbsTrackRep::AbsTrackRep(
int pdgCode,
char propDir) :
38 pdgCode_(pdgCode), propDir_(propDir), debugLvl_(0)
44 TObject(rep), pdgCode_(rep.pdgCode_), propDir_(rep.propDir_), debugLvl_(rep.debugLvl_)
53 bool calcJacobianNoise)
const {
65 stateVec(0) = pos.X();
66 stateVec(1) = pos.Y();
67 stateVec(2) = pos.Z();
69 stateVec(3) = mom.X();
70 stateVec(4) = mom.Y();
71 stateVec(5) = mom.Z();
83 stateVec(0) = pos.X();
84 stateVec(1) = pos.Y();
85 stateVec(2) = pos.Z();
87 stateVec(3) = mom.X();
88 stateVec(4) = mom.Y();
89 stateVec(5) = mom.Z();
94 TParticlePDG* particle = TDatabasePDG::Instance()->GetParticle(
pdgCode_);
95 assert(particle !=
nullptr);
96 return particle->Charge()/(3.);
101 return TDatabasePDG::Instance()->GetParticle(
pdgCode_)->Mass();
107 TMatrixD& jacobian)
const {
119 const double defaultStepX = 1.E-5;
130 for (
size_t i = 0; i <
getDim(); ++i) {
133 double temp = stateCopy.getState()(i) + defaultStepX / 2;
147 stepX = 2 * (temp - stateCopy.getState()(i));
148 (stateCopy.getState())(i) = temp;
150 rightShort = stateCopy.getState();
154 (stateCopy.getState())(i) -= stepX / 2;
156 leftShort = stateCopy.getState();
160 (stateCopy.getState())(i) += stepX;
162 rightFull = stateCopy.getState();
166 (stateCopy.getState())(i) -= stepX;
168 leftFull = stateCopy.getState();
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;
177 jacobian(j, i) = 1./3.*(4*derivShort - derivFull);
184 TParticlePDG* particle = TDatabasePDG::Instance()->GetParticle(-
pdgCode_);
185 if(particle !=
nullptr) {
194 void AbsTrackRep::Print(
const Option_t*)
const {
Contains the measurement and covariance in raw detector coordinates.
virtual SharedPlanePtr constructPlane(const StateOnPlane &state) const =0
Construct (virtual) detector plane (use state's AbsTrackRep).
Abstract base class for a track representation.
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 TVectorD get6DState(const StateOnPlane &state) const
Get the 6D state vector (x, y, z, p_x, p_y, p_z).
bool switchPDGSign()
try to multiply pdg code with -1. (Switch from particle to anti-particle and vice versa).
double getPDGCharge() const
Get the charge of the particle of the pdg code.
double getMass(const StateOnPlane &state) const
Get tha particle mass in GeV/c^2.
char propDir_
propagation direction (-1, 0, 1) -> (backward, auto, forward)
int pdgCode_
Particle code.
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,...
void calcJacobianNumerically(const genfit::StateOnPlane &origState, const genfit::SharedPlanePtr destPlane, TMatrixD &jacobian) const
Calculate Jacobian of transportation numerically.
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 void getPosMomCov(const MeasuredStateOnPlane &state, TVector3 &pos, TVector3 &mom, TMatrixDSym &cov) const =0
Translates MeasuredStateOnPlane into 3D position, momentum and 6x6 covariance.
virtual void getPosMom(const StateOnPlane &state, TVector3 &pos, TVector3 &mom) const =0
Get cartesian position and momentum vector of a state.
#StateOnPlane with additional covariance matrix.
A state with arbitrary dimension defined in a DetPlane.
Defines for I/O streams used for error and debug printing.
std::ostream printOut
Default stream for output of Print calls.
std::shared_ptr< genfit::DetPlane > SharedPlanePtr
Shared Pointer to a DetPlane.