LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
trkf::TrackState Class Reference

Class for track parameters (and errors) defined on a recob::tracking::Plane. More...

#include "TrackState.h"

Public Member Functions

 TrackState (const SVector5 &trackStatePar, const SMatrixSym55 &trackStateCov, const Plane &plane, bool trackAlongPlaneDir, int pid)
 
const SVector5parameters () const
 track parameters defined on the plane More...
 
const SMatrixSym55covariance () const
 track parameter covariance matrix on the plane More...
 
const Planeplane () const
 plane where the parameters are defined More...
 
const Point_tposition () const
 position of the track More...
 
const Vector_tmomentum () const
 momentum of the track More...
 
int pID () const
 particle id hypthesis of the track More...
 
double mass () const
 mass hypthesis of the track More...
 
SVector6 parameters6D () const
 track parameters in global cartesian coordinates More...
 
SMatrixSym66 covariance6D () const
 track parameter covariance matrix in global cartesian coordinates More...
 
bool isTrackAlongPlaneDir () const
 is the track momentum along the plane direction? More...
 
std::ostream & dump (std::ostream &out=std::cout) const
 Printout information. More...
 
double residual (const HitState &hitstate) const
 Residual of the TrackState with respect to a HitState. The two states must be on the same plane; it is responsibility of the user to enforce this. More...
 
double combinedError2 (const HitState &hitstate) const
 Combined squared error of the TrackState with respect to a HitState. The two states must be on the same plane; it is responsibility of the user to enforce this. More...
 
double combinedError (const HitState &hitstate) const
 Combined error of the TrackState with respect to a HitState. The two states must be on the same plane; it is responsibility of the user to enforce this. More...
 
double chi2 (const HitState &hitstate) const
 Chi2 of the TrackState with respect to a HitState. The two states must be on the same plane; it is responsibility of the user to enforce this. More...
 
void setCovariance (const SMatrixSym55 &trackStateCov)
 Set the covariance matrix of the TrackState. More...
 
void setParameters (const SVector5 &trackStatePar)
 Set the parameters of the TrackState; also update the global position and momentum accordingly. More...
 

Private Attributes

SVector5 fTrackStatePar
 track parameters defined on the plane More...
 
SMatrixSym55 fTrackStateCov
 track parameter covariance matrix on the plane More...
 
Plane fPlane
 plane where the parameters are defined More...
 
int fPid
 particle id hypthesis of the track More...
 
Point_t fPos
 position of the track (cached) More...
 
Vector_t fMom
 momentum of the track (cached) More...
 

Detailed Description

Class for track parameters (and errors) defined on a recob::tracking::Plane.

Author
G. Cerati (FNAL, MicroBooNE)
Date
2017
Version
1.0

This class collects the track parameters (and errors) defined on a recob::tracking::Plane. It stores the 5d parameters and covariance, plus the global position and momentum. Given a HitState on the same plane, it provides easy access to functionalities like chi2 and residual.

Definition at line 93 of file TrackState.h.

Constructor & Destructor Documentation

trkf::TrackState::TrackState ( const SVector5 trackStatePar,
const SMatrixSym55 trackStateCov,
const Plane plane,
bool  trackAlongPlaneDir,
int  pid 
)
inline

Definition at line 95 of file TrackState.h.

References trkf::HitState::fPlane, and recob::tracking::Plane::Local5DToGlobal6DParameters().

100  : fTrackStatePar(trackStatePar), fTrackStateCov(trackStateCov), fPlane(plane), fPid(pid)
101  {
102  SVector6 par6d = fPlane.Local5DToGlobal6DParameters(fTrackStatePar, trackAlongPlaneDir);
103  fPos = Point_t(par6d[0], par6d[1], par6d[2]);
104  fMom = Point_t(par6d[3], par6d[4], par6d[5]);
105  }
int fPid
particle id hypthesis of the track
Definition: TrackState.h:193
Plane fPlane
plane where the parameters are defined
Definition: TrackState.h:192
recob::tracking::Point_t Point_t
Definition: TrackState.h:18
Vector_t fMom
momentum of the track (cached)
Definition: TrackState.h:195
SMatrixSym55 fTrackStateCov
track parameter covariance matrix on the plane
Definition: TrackState.h:191
SVector6 Local5DToGlobal6DParameters(const SVector5 &par5d, bool trackAlongPlaneDir=true) const
Function to convert parameters from local to global coordinates. Local coordinates are on the plane w...
Definition: TrackingPlane.h:86
recob::tracking::SVector6 SVector6
Definition: TrackState.h:13
Point_t fPos
position of the track (cached)
Definition: TrackState.h:194
const Plane & plane() const
plane where the parameters are defined
Definition: TrackState.h:112
SVector5 fTrackStatePar
track parameters defined on the plane
Definition: TrackState.h:190

Member Function Documentation

double trkf::TrackState::chi2 ( const HitState hitstate) const
inline

Chi2 of the TrackState with respect to a HitState. The two states must be on the same plane; it is responsibility of the user to enforce this.

Definition at line 172 of file TrackState.h.

Referenced by trkf::KFTrackState::chi2().

173  {
174  return residual(hitstate) * residual(hitstate) / combinedError2(hitstate);
175  }
double residual(const HitState &hitstate) const
Residual of the TrackState with respect to a HitState. The two states must be on the same plane; it i...
Definition: TrackState.h:154
double combinedError2(const HitState &hitstate) const
Combined squared error of the TrackState with respect to a HitState. The two states must be on the sa...
Definition: TrackState.h:160
double trkf::TrackState::combinedError ( const HitState hitstate) const
inline

Combined error of the TrackState with respect to a HitState. The two states must be on the same plane; it is responsibility of the user to enforce this.

Definition at line 166 of file TrackState.h.

Referenced by trkf::KFTrackState::combinedError().

167  {
168  return sqrt(combinedError2(hitstate));
169  }
double combinedError2(const HitState &hitstate) const
Combined squared error of the TrackState with respect to a HitState. The two states must be on the sa...
Definition: TrackState.h:160
double trkf::TrackState::combinedError2 ( const HitState hitstate) const
inline

Combined squared error of the TrackState with respect to a HitState. The two states must be on the same plane; it is responsibility of the user to enforce this.

Definition at line 160 of file TrackState.h.

References trkf::HitState::hitMeasErr2().

Referenced by trkf::KFTrackState::combinedError2().

161  {
162  return hitstate.hitMeasErr2() + fTrackStateCov(0, 0);
163  }
SMatrixSym55 fTrackStateCov
track parameter covariance matrix on the plane
Definition: TrackState.h:191
const SMatrixSym55& trkf::TrackState::covariance ( ) const
inline

track parameter covariance matrix on the plane

Definition at line 110 of file TrackState.h.

Referenced by trkf::KFTrackState::combineWithTrackState(), trkf::KFTrackState::covariance(), trkf::TrackStatePropagator::propagateToPlane(), trkf::TrackStatePropagator::rotateToPlane(), and trkf::KFTrackState::updateWithHitState().

110 { return fTrackStateCov; }
SMatrixSym55 fTrackStateCov
track parameter covariance matrix on the plane
Definition: TrackState.h:191
SMatrixSym66 trkf::TrackState::covariance6D ( ) const
inline

track parameter covariance matrix in global cartesian coordinates

Definition at line 135 of file TrackState.h.

References trkf::HitState::fPlane, and recob::tracking::Plane::Local5DToGlobal6DCovariance().

136  {
138  }
Plane fPlane
plane where the parameters are defined
Definition: TrackState.h:192
Vector_t fMom
momentum of the track (cached)
Definition: TrackState.h:195
SMatrixSym66 Local5DToGlobal6DCovariance(SMatrixSym55 cov5d, bool hasMomentum, const Vector_t &trackMomOrDir) const
Translate track covariance from local to global coordinates. The track momentum (or direction) is nee...
SMatrixSym55 fTrackStateCov
track parameter covariance matrix on the plane
Definition: TrackState.h:191
std::ostream& trkf::TrackState::dump ( std::ostream &  out = std::cout) const
inline

Printout information.

Definition at line 144 of file TrackState.h.

References recob::tracking::Plane::direction(), trkf::HitState::plane(), and recob::tracking::Plane::position().

Referenced by trkf::TrackKalmanFitter::doFitWork().

145  {
146  out << "TrackState with pID=" << pID() << " mass=" << mass() << "\npars=" << parameters()
147  << " position=" << position() << " momentum=" << momentum() << "\ncov=\n"
148  << covariance() << "\non plane with pos=" << plane().position()
149  << " and dir=" << plane().direction() << " along=" << isTrackAlongPlaneDir() << "\n";
150  return out;
151  }
Vector_t const & direction() const
Reference direction orthogonal to the plane.
Definition: TrackingPlane.h:70
const Vector_t & momentum() const
momentum of the track
Definition: TrackState.h:116
const SVector5 & parameters() const
track parameters defined on the plane
Definition: TrackState.h:108
double mass() const
mass hypthesis of the track
Definition: TrackState.h:120
const Point_t & position() const
position of the track
Definition: TrackState.h:114
bool isTrackAlongPlaneDir() const
is the track momentum along the plane direction?
Definition: TrackState.h:141
int pID() const
particle id hypthesis of the track
Definition: TrackState.h:118
Point_t const & position() const
Reference position on the plane.
Definition: TrackingPlane.h:66
const SMatrixSym55 & covariance() const
track parameter covariance matrix on the plane
Definition: TrackState.h:110
const Plane & plane() const
plane where the parameters are defined
Definition: TrackState.h:112
bool trkf::TrackState::isTrackAlongPlaneDir ( ) const
inline

is the track momentum along the plane direction?

Definition at line 141 of file TrackState.h.

References recob::tracking::Plane::direction(), and trkf::HitState::fPlane.

Referenced by trkf::KFTrackState::isTrackAlongPlaneDir(), and trkf::TrackStatePropagator::propagateToPlane().

141 { return fMom.Dot(fPlane.direction()) > 0; }
Plane fPlane
plane where the parameters are defined
Definition: TrackState.h:192
Vector_t const & direction() const
Reference direction orthogonal to the plane.
Definition: TrackingPlane.h:70
Vector_t fMom
momentum of the track (cached)
Definition: TrackState.h:195
double trkf::TrackState::mass ( ) const
inline

mass hypthesis of the track

Definition at line 120 of file TrackState.h.

References util::abs(), and util::kBogusD.

Referenced by trkf::KFTrackState::mass(), and trkf::TrackStatePropagator::propagateToPlane().

121  {
122  if (abs(fPid) == 11) { return elmass; }
123  if (abs(fPid) == 13) { return mumass; }
124  if (abs(fPid) == 211) { return pimass; }
125  if (abs(fPid) == 321) { return kmass; }
126  if (abs(fPid) == 2212) { return pmass; }
127  return util::kBogusD;
128  }
int fPid
particle id hypthesis of the track
Definition: TrackState.h:193
constexpr auto abs(T v)
Returns the absolute value of the argument.
constexpr double kBogusD
obviously bogus double value
const Vector_t& trkf::TrackState::momentum ( ) const
inline
const SVector5& trkf::TrackState::parameters ( ) const
inline
SVector6 trkf::TrackState::parameters6D ( ) const
inline

track parameters in global cartesian coordinates

Definition at line 130 of file TrackState.h.

Referenced by trkf::KFTrackState::parameters6D().

131  {
132  return SVector6(fPos.X(), fPos.Y(), fPos.Z(), fMom.X(), fMom.Y(), fMom.Z());
133  }
Vector_t fMom
momentum of the track (cached)
Definition: TrackState.h:195
recob::tracking::SVector6 SVector6
Definition: TrackState.h:13
Point_t fPos
position of the track (cached)
Definition: TrackState.h:194
int trkf::TrackState::pID ( ) const
inline

particle id hypthesis of the track

Definition at line 118 of file TrackState.h.

Referenced by trkf::KFTrackState::pID(), trkf::TrackStatePropagator::propagateToPlane(), and trkf::TrackStatePropagator::rotateToPlane().

118 { return fPid; }
int fPid
particle id hypthesis of the track
Definition: TrackState.h:193
const Plane& trkf::TrackState::plane ( ) const
inline
double trkf::TrackState::residual ( const HitState hitstate) const
inline

Residual of the TrackState with respect to a HitState. The two states must be on the same plane; it is responsibility of the user to enforce this.

Definition at line 154 of file TrackState.h.

References trkf::HitState::hitMeas().

Referenced by trkf::KFTrackState::residual().

155  {
156  return hitstate.hitMeas() - fTrackStatePar(0);
157  }
SVector5 fTrackStatePar
track parameters defined on the plane
Definition: TrackState.h:190
void trkf::TrackState::setCovariance ( const SMatrixSym55 trackStateCov)
inline

Set the covariance matrix of the TrackState.

Definition at line 178 of file TrackState.h.

Referenced by trkf::KFTrackState::combineWithTrackState(), trkf::KFTrackState::setCovariance(), and trkf::KFTrackState::updateWithHitState().

178 { fTrackStateCov = trackStateCov; }
SMatrixSym55 fTrackStateCov
track parameter covariance matrix on the plane
Definition: TrackState.h:191
void trkf::TrackState::setParameters ( const SVector5 trackStatePar)
inline

Set the parameters of the TrackState; also update the global position and momentum accordingly.

Definition at line 181 of file TrackState.h.

References trkf::HitState::fPlane, and recob::tracking::Plane::Local5DToGlobal6DParameters().

Referenced by trkf::KFTrackState::combineWithTrackState(), trkf::KFTrackState::setParameters(), and trkf::KFTrackState::updateWithHitState().

182  {
183  fTrackStatePar = trackStatePar;
185  fPos = Point_t(par6d[0], par6d[1], par6d[2]);
186  fMom = Vector_t(par6d[3], par6d[4], par6d[5]);
187  }
Plane fPlane
plane where the parameters are defined
Definition: TrackState.h:192
recob::tracking::Point_t Point_t
Definition: TrackState.h:18
recob::tracking::Vector_t Vector_t
Definition: TrackState.h:19
bool isTrackAlongPlaneDir() const
is the track momentum along the plane direction?
Definition: TrackState.h:141
Vector_t fMom
momentum of the track (cached)
Definition: TrackState.h:195
SVector6 Local5DToGlobal6DParameters(const SVector5 &par5d, bool trackAlongPlaneDir=true) const
Function to convert parameters from local to global coordinates. Local coordinates are on the plane w...
Definition: TrackingPlane.h:86
recob::tracking::SVector6 SVector6
Definition: TrackState.h:13
Point_t fPos
position of the track (cached)
Definition: TrackState.h:194
SVector5 fTrackStatePar
track parameters defined on the plane
Definition: TrackState.h:190

Member Data Documentation

Vector_t trkf::TrackState::fMom
private

momentum of the track (cached)

Definition at line 195 of file TrackState.h.

int trkf::TrackState::fPid
private

particle id hypthesis of the track

Definition at line 193 of file TrackState.h.

Plane trkf::TrackState::fPlane
private

plane where the parameters are defined

Definition at line 192 of file TrackState.h.

Point_t trkf::TrackState::fPos
private

position of the track (cached)

Definition at line 194 of file TrackState.h.

SMatrixSym55 trkf::TrackState::fTrackStateCov
private

track parameter covariance matrix on the plane

Definition at line 191 of file TrackState.h.

SVector5 trkf::TrackState::fTrackStatePar
private

track parameters defined on the plane

Definition at line 190 of file TrackState.h.


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