KFTrackState.cxx
Go to the documentation of this file.
1 #include "KFTrackState.h"
2 
3 using namespace trkf;
4 
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)
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 }
16 
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 }
Class for track parameters (and errors) defined on a recob::tracking::Plane.
Definition: TrackState.h:79
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
recob::tracking::SMatrix55 SMatrix55
Definition: TrackState.h:14
double hitMeasErr2() const
Definition: TrackState.h:49
const Plane & plane() const
Definition: TrackState.h:50
bool combineWithTrackState(const TrackState &trackstate)
Combine the TrackState given another TrackState (they need to be on the same plane) ...
const double e
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
bool updateWithHitState(const HitState &hitstate)
Update the TrackState given a HitState (they need to be on the same plane)
Definition: KFTrackState.cxx:5
string tmp
Definition: languages.py:63
const SMatrixSym55 & covariance() const
track parameter covariance matrix on the plane
Definition: TrackState.h:92
Class for a measurement on a recob::tracking::Plane (plane defined by a wire and the drift direction)...
Definition: TrackState.h:42
const Plane & plane() const
plane where the parameters are defined
Definition: TrackState.h:94