LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
KFTrackState.cxx
Go to the documentation of this file.
1 #include "KFTrackState.h"
2 
3 using namespace trkf;
4 
6 {
7  // if track and hit not on same plane do not update and return false
8  if ((hitstate.plane().position() - fTrackState.plane().position()).Mag2() > 10e-6) return false;
9  if ((hitstate.plane().direction() - fTrackState.plane().direction()).Mag2() > 10e-6) return false;
10  // Kalman Filter update (simplified case: 1D measurement along the same coordinate as element 0 of the track parameters)
12  tmp(0, 0) = 1. / (hitstate.hitMeasErr2() + fTrackState.covariance()(0, 0));
14  fTrackState.covariance() * tmp.Col(0) *
15  (hitstate.hitMeas() - fTrackState.parameters()(0)));
17  (fTrackState.covariance() - ROOT::Math::Similarity(fTrackState.covariance(), tmp)));
18  return true;
19 }
20 
22 {
23  // if tracks not on same plane do not update and return false
24  if ((trackstate.plane().position() - fTrackState.plane().position()).Mag2() > 10e-6) return false;
25  if ((trackstate.plane().direction() - fTrackState.plane().direction()).Mag2() > 10e-6)
26  return false;
27  // compute the weighted average of the two states
28  const SVector5& par1 = fTrackState.parameters();
29  const SVector5& par2 = trackstate.parameters();
30  const SMatrixSym55& cov1 = fTrackState.covariance();
31  const SMatrixSym55& cov2 = trackstate.covariance();
32  SMatrixSym55&& cov = cov1 + cov2;
33  bool success = cov.Invert();
34  if (!success) return false;
35  SMatrix55 K = cov1 * cov;
36  fTrackState.setParameters(par1 + K * (par2 - par1));
37  K = K * cov2;
38  fTrackState.setCovariance(K.LowerBlock());
39  return true;
40 }
Class for track parameters (and errors) defined on a recob::tracking::Plane.
Definition: TrackState.h:93
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:178
const SVector5 & parameters() const
track parameters defined on the plane
Definition: TrackState.h:108
recob::tracking::SMatrixSym55 SMatrixSym55
Definition: TrackState.h:15
double hitMeas() const
Definition: TrackState.h:59
TrackState fTrackState
Definition: KFTrackState.h:85
Float_t tmp
Definition: plot.C:35
recob::tracking::SMatrix55 SMatrix55
Definition: TrackState.h:14
double hitMeasErr2() const
Definition: TrackState.h:60
const Plane & plane() const
Definition: TrackState.h:61
bool combineWithTrackState(const TrackState &trackstate)
Combine the TrackState given another TrackState (they need to be on the same plane) ...
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:181
bool updateWithHitState(const HitState &hitstate)
Update the TrackState given a HitState (they need to be on the same plane)
Definition: KFTrackState.cxx:5
const SMatrixSym55 & covariance() const
track parameter covariance matrix on the plane
Definition: TrackState.h:110
Class for a measurement on a recob::tracking::Plane (plane defined by a wire and the drift direction)...
Definition: TrackState.h:42
Float_t e
Definition: plot.C:35
const Plane & plane() const
plane where the parameters are defined
Definition: TrackState.h:112