All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Private Attributes | List of all members
trkf::KFTrackState Class Reference

Extension of a TrackState to perform KalmanFilter calculations. More...

#include <KFTrackState.h>

Public Member Functions

 KFTrackState (const SVector5 &trackStatePar, const SMatrixSym55 &trackStateCov, const Plane &plane, bool trackAlongPlaneDir, int pid)
 
 KFTrackState (TrackState &&trackState)
 
bool updateWithHitState (const HitState &hitstate)
 Update the TrackState given a HitState (they need to be on the same plane) More...
 
bool combineWithTrackState (const TrackState &trackstate)
 Combine the TrackState given another TrackState (they need to be on the same plane) More...
 
const TrackStatetrackState () const
 Get the (const reference to the) TrackState. More...
 
void setTrackState (TrackState &&s)
 Set the TrackState. More...
 
std::ostream & dump (std::ostream &out=std::cout) const
 Printout information. More...
 
const SVector5parameters () const
 This function calls the homonymous function of the stored TrackState. More...
 
const SMatrixSym55covariance () const
 
const Planeplane () const
 
const Point_tposition () const
 
const Vector_tmomentum () const
 
int pID () const
 
double mass () const
 
const SVector6 parameters6D () const
 
bool isTrackAlongPlaneDir () const
 
double residual (const HitState &hitstate) const
 
double combinedError2 (const HitState &hitstate) const
 
double combinedError (const HitState &hitstate) const
 
double chi2 (const HitState &hitstate) const
 
void setCovariance (const SMatrixSym55 &trackStateCov)
 
void setParameters (const SVector5 &trackStatePar)
 

Private Attributes

TrackState fTrackState
 

Detailed Description

Extension of a TrackState to perform KalmanFilter calculations.

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

This class extends the concept of TrackState, providing functionalities for Kalman Filter-specific calculations such as 'update' and 'combine'. It holds a TrackState by value, which is modified in place when updating or combining.

Definition at line 21 of file KFTrackState.h.

Constructor & Destructor Documentation

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

Definition at line 24 of file KFTrackState.h.

25  : fTrackState(trackStatePar, trackStateCov, plane, trackAlongPlaneDir, pid) {}
TrackState fTrackState
Definition: KFTrackState.h:71
const Plane & plane() const
Definition: KFTrackState.h:44
trkf::KFTrackState::KFTrackState ( TrackState &&  trackState)
inline

Definition at line 26 of file KFTrackState.h.

27  : fTrackState(std::move(trackState)) { }
const TrackState & trackState() const
Get the (const reference to the) TrackState.
Definition: KFTrackState.h:36
TrackState fTrackState
Definition: KFTrackState.h:71

Member Function Documentation

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

Definition at line 55 of file KFTrackState.h.

55 { return fTrackState.chi2(hitstate); }
TrackState fTrackState
Definition: KFTrackState.h:71
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 re...
Definition: TrackState.h:137
double trkf::KFTrackState::combinedError ( const HitState hitstate) const
inline

Definition at line 54 of file KFTrackState.h.

54 { return fTrackState.combinedError(hitstate); }
TrackState fTrackState
Definition: KFTrackState.h:71
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...
Definition: TrackState.h:134
double trkf::KFTrackState::combinedError2 ( const HitState hitstate) const
inline

Definition at line 53 of file KFTrackState.h.

53 { return fTrackState.combinedError2(hitstate); }
TrackState fTrackState
Definition: KFTrackState.h:71
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:131
bool KFTrackState::combineWithTrackState ( const TrackState trackstate)

Combine the TrackState given another TrackState (they need to be on the same plane)

Definition at line 17 of file KFTrackState.cxx.

17  {
18  // if tracks not on same plane do not update and return false
19  if ( (trackstate.plane().position()-fTrackState.plane().position()).Mag2()>10e-6 ) return false;
20  if ( (trackstate.plane().direction()-fTrackState.plane().direction()).Mag2()>10e-6 ) return false;
21  // compute the weighted average of the two states
22  const SVector5& par1 = fTrackState.parameters();
23  const SVector5& par2 = trackstate.parameters();
24  const SMatrixSym55& cov1 = fTrackState.covariance();
25  const SMatrixSym55& cov2 = trackstate.covariance();
26  SMatrixSym55&& cov = cov1 + cov2;
27  bool success = cov.Invert();
28  if (!success) return false;
29  SMatrix55 K = cov1 * cov;
30  fTrackState.setParameters( par1 + K*(par2 - par1) );
31  K = K*cov2;
32  fTrackState.setCovariance( K.LowerBlock() );
33  return true;
34 }
Vector_t const & direction() const
Reference direction orthogonal to the plane.
Definition: TrackingPlane.h:70
void setCovariance(const SMatrixSym55 &trackStateCov)
Set the covariance matrix of the TrackState.
Definition: TrackState.h:140
const SVector5 & parameters() const
track parameters defined on the plane
Definition: TrackState.h:90
recob::tracking::SMatrixSym55 SMatrixSym55
Definition: TrackState.h:15
TrackState fTrackState
Definition: KFTrackState.h:71
recob::tracking::SMatrix55 SMatrix55
Definition: TrackState.h:14
recob::tracking::SVector5 SVector5
Definition: TrackState.h:12
Point_t const & position() const
Reference position on the plane.
Definition: TrackingPlane.h:66
void setParameters(const SVector5 &trackStatePar)
Set the parameters of the TrackState; also update the global position and momentum accordingly...
Definition: TrackState.h:143
const SMatrixSym55 & covariance() const
track parameter covariance matrix on the plane
Definition: TrackState.h:92
do i e
const Plane & plane() const
plane where the parameters are defined
Definition: TrackState.h:94
const SMatrixSym55& trkf::KFTrackState::covariance ( ) const
inline

Definition at line 43 of file KFTrackState.h.

43 { return fTrackState.covariance(); }
TrackState fTrackState
Definition: KFTrackState.h:71
const SMatrixSym55 & covariance() const
track parameter covariance matrix on the plane
Definition: TrackState.h:92
std::ostream& trkf::KFTrackState::dump ( std::ostream &  out = std::cout) const
inline

Printout information.

Definition at line 62 of file KFTrackState.h.

62  {
63  out << "KFTrackState with pID=" << pID() << " mass=" << mass()
64  << "\npars=" << parameters() << " position=" << position() << " momentum=" << momentum()
65  << "\ncov=\n" << covariance()
66  << "\non plane with pos=" << plane().position() << " and dir=" << plane().direction() << " along=" << isTrackAlongPlaneDir() << "\n";
67  return out;
68  }
Vector_t const & direction() const
Reference direction orthogonal to the plane.
Definition: TrackingPlane.h:70
bool isTrackAlongPlaneDir() const
Definition: KFTrackState.h:50
const SVector5 & parameters() const
This function calls the homonymous function of the stored TrackState.
Definition: KFTrackState.h:42
double mass() const
Definition: KFTrackState.h:48
const Point_t & position() const
Definition: KFTrackState.h:45
const SMatrixSym55 & covariance() const
Definition: KFTrackState.h:43
Point_t const & position() const
Reference position on the plane.
Definition: TrackingPlane.h:66
const Plane & plane() const
Definition: KFTrackState.h:44
const Vector_t & momentum() const
Definition: KFTrackState.h:46
int pID() const
Definition: KFTrackState.h:47
bool trkf::KFTrackState::isTrackAlongPlaneDir ( ) const
inline

Definition at line 50 of file KFTrackState.h.

TrackState fTrackState
Definition: KFTrackState.h:71
bool isTrackAlongPlaneDir() const
is the track momentum along the plane direction?
Definition: TrackState.h:116
double trkf::KFTrackState::mass ( ) const
inline

Definition at line 48 of file KFTrackState.h.

48 { return fTrackState.mass(); }
TrackState fTrackState
Definition: KFTrackState.h:71
double mass() const
mass hypthesis of the track
Definition: TrackState.h:102
const Vector_t& trkf::KFTrackState::momentum ( ) const
inline

Definition at line 46 of file KFTrackState.h.

46 { return fTrackState.momentum(); }
const Vector_t & momentum() const
momentum of the track
Definition: TrackState.h:98
TrackState fTrackState
Definition: KFTrackState.h:71
const SVector5& trkf::KFTrackState::parameters ( ) const
inline

This function calls the homonymous function of the stored TrackState.

Definition at line 42 of file KFTrackState.h.

42 { return fTrackState.parameters(); }
const SVector5 & parameters() const
track parameters defined on the plane
Definition: TrackState.h:90
TrackState fTrackState
Definition: KFTrackState.h:71
const SVector6 trkf::KFTrackState::parameters6D ( ) const
inline

Definition at line 49 of file KFTrackState.h.

49 { return fTrackState.parameters6D(); }
TrackState fTrackState
Definition: KFTrackState.h:71
SVector6 parameters6D() const
track parameters in global cartesian coordinates
Definition: TrackState.h:111
int trkf::KFTrackState::pID ( ) const
inline

Definition at line 47 of file KFTrackState.h.

47 { return fTrackState.pID(); }
TrackState fTrackState
Definition: KFTrackState.h:71
int pID() const
particle id hypthesis of the track
Definition: TrackState.h:100
const Plane& trkf::KFTrackState::plane ( ) const
inline

Definition at line 44 of file KFTrackState.h.

44 { return fTrackState.plane(); }
TrackState fTrackState
Definition: KFTrackState.h:71
const Plane & plane() const
plane where the parameters are defined
Definition: TrackState.h:94
const Point_t& trkf::KFTrackState::position ( ) const
inline

Definition at line 45 of file KFTrackState.h.

45 { return fTrackState.position(); }
TrackState fTrackState
Definition: KFTrackState.h:71
const Point_t & position() const
position of the track
Definition: TrackState.h:96
double trkf::KFTrackState::residual ( const HitState hitstate) const
inline

Definition at line 52 of file KFTrackState.h.

52 { return fTrackState.residual(hitstate); }
TrackState fTrackState
Definition: KFTrackState.h:71
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:128
void trkf::KFTrackState::setCovariance ( const SMatrixSym55 trackStateCov)
inline

Definition at line 57 of file KFTrackState.h.

57 { fTrackState.setCovariance(trackStateCov); }
void setCovariance(const SMatrixSym55 &trackStateCov)
Set the covariance matrix of the TrackState.
Definition: TrackState.h:140
TrackState fTrackState
Definition: KFTrackState.h:71
void trkf::KFTrackState::setParameters ( const SVector5 trackStatePar)
inline

Definition at line 58 of file KFTrackState.h.

58 { fTrackState.setParameters(trackStatePar); }
TrackState fTrackState
Definition: KFTrackState.h:71
void setParameters(const SVector5 &trackStatePar)
Set the parameters of the TrackState; also update the global position and momentum accordingly...
Definition: TrackState.h:143
void trkf::KFTrackState::setTrackState ( TrackState &&  s)
inline

Set the TrackState.

Definition at line 38 of file KFTrackState.h.

38 { fTrackState = std::move(s); }
TrackState fTrackState
Definition: KFTrackState.h:71
then echo File list $list not found else cat $list while read file do echo $file sed s
Definition: file_to_url.sh:60
const TrackState& trkf::KFTrackState::trackState ( ) const
inline

Get the (const reference to the) TrackState.

Definition at line 36 of file KFTrackState.h.

36 { return fTrackState; }
TrackState fTrackState
Definition: KFTrackState.h:71
bool KFTrackState::updateWithHitState ( const HitState hitstate)

Update the TrackState given a HitState (they need to be on the same plane)

Definition at line 5 of file KFTrackState.cxx.

5  {
6  // if track and hit not on same plane do not update and return false
7  if ( (hitstate.plane().position()-fTrackState.plane().position()).Mag2()>10e-6 ) return false;
8  if ( (hitstate.plane().direction()-fTrackState.plane().direction()).Mag2()>10e-6 ) return false;
9  // Kalman Filter update (simplified case: 1D measurement along the same coordinate as element 0 of the track parameters)
10  SMatrixSym55 tmp;
11  tmp(0,0) = 1./(hitstate.hitMeasErr2()+fTrackState.covariance()(0,0));
13  fTrackState.setCovariance( (fTrackState.covariance()-ROOT::Math::Similarity(fTrackState.covariance(),tmp)) );
14  return true;
15 }
Vector_t const & direction() const
Reference direction orthogonal to the plane.
Definition: TrackingPlane.h:70
void setCovariance(const SMatrixSym55 &trackStateCov)
Set the covariance matrix of the TrackState.
Definition: TrackState.h:140
const SVector5 & parameters() const
track parameters defined on the plane
Definition: TrackState.h:90
recob::tracking::SMatrixSym55 SMatrixSym55
Definition: TrackState.h:15
double hitMeas() const
Definition: TrackState.h:48
TrackState fTrackState
Definition: KFTrackState.h:71
double hitMeasErr2() const
Definition: TrackState.h:49
const Plane & plane() const
Definition: TrackState.h:50
Point_t const & position() const
Reference position on the plane.
Definition: TrackingPlane.h:66
void setParameters(const SVector5 &trackStatePar)
Set the parameters of the TrackState; also update the global position and momentum accordingly...
Definition: TrackState.h:143
const SMatrixSym55 & covariance() const
track parameter covariance matrix on the plane
Definition: TrackState.h:92
do i e
const Plane & plane() const
plane where the parameters are defined
Definition: TrackState.h:94

Member Data Documentation

TrackState trkf::KFTrackState::fTrackState
private

Definition at line 71 of file KFTrackState.h.


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