LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
trkf::KHit< N > Class Template Referenceabstract

#include "KHit.h"

Inheritance diagram for trkf::KHit< N >:
trkf::KHitBase

Public Member Functions

 KHit ()
 Default constructor. More...
 
 KHit (const std::shared_ptr< const Surface > &psurf)
 Initializing Constructor – surface only. More...
 
 KHit (const std::shared_ptr< const Surface > &psurf, const typename KVector< N >::type &mvec, const typename KSymMatrix< N >::type &merr)
 Fully Initializing Constructor. More...
 
virtual ~KHit ()
 Destructor. More...
 
void setMeasVector (const typename KVector< N >::type &mvec)
 Set measurement vector. More...
 
void setMeasError (const typename KSymMatrix< N >::type &merr)
 Set measurement error. More...
 
const KVector< N >::typegetMeasVector () const
 Measurement vector. More...
 
const KSymMatrix< N >::typegetMeasError () const
 Measurement error matrix. More...
 
const KVector< N >::typegetPredVector () const
 Prediction vector. More...
 
const KSymMatrix< N >::typegetPredError () const
 Prediction matrix. More...
 
const KVector< N >::typegetResVector () const
 Residual vector. More...
 
const KSymMatrix< N >::typegetResError () const
 Residual error matrix. More...
 
const KSymMatrix< N >::typegetResInvError () const
 Residual inv. error matrix. More...
 
const KHMatrix< N >::typegetH () const
 Kalman H-matrix. More...
 
double getChisq () const
 Incremental chisquare. More...
 
bool predict (const KETrack &tre, const Propagator &prop, const KTrack *ref=0) const
 Prediction method (return false if fail). More...
 
void update (KETrack &tre) const
 Update track method. More...
 
virtual bool subpredict (const KETrack &tre, typename KVector< N >::type &pvec, typename KSymMatrix< N >::type &perr, typename KHMatrix< N >::type &hmatrix) const =0
 Calculate prediction function (return via arguments). More...
 
virtual std::ostream & Print (std::ostream &out, bool doTitle=true) const
 Printout. More...
 
const std::shared_ptr< const Surface > & getPredSurface () const
 Predition surface. More...
 
double getPredDistance () const
 Prediction distance. More...
 
const std::shared_ptr< const Surface > & getMeasSurface () const
 Measurement surface. More...
 
int getMeasPlane () const
 Measurement plane index. More...
 
int getID () const
 Unique id. More...
 
void setMeasSurface (const std::shared_ptr< const Surface > &psurf)
 Measurement surface. More...
 
void setMeasPlane (int plane)
 Measurement plane. More...
 

Protected Attributes

std::shared_ptr< const SurfacefPredSurf
 Prediction surface. More...
 
double fPredDist
 Prediction distance. More...
 
int fID
 Unique id. More...
 

Private Attributes

KVector< N >::type fMvec
 Measurement vector. More...
 
KSymMatrix< N >::type fMerr
 Measurement error matrix. More...
 
KVector< N >::type fPvec
 Prediction vector. More...
 
KSymMatrix< N >::type fPerr
 Prediction error matrix. More...
 
KVector< N >::type fRvec
 Residual vector. More...
 
KSymMatrix< N >::type fRerr
 Residual error matrix. More...
 
KSymMatrix< N >::type fRinv
 Residual inverse error matrix. More...
 
KHMatrix< N >::type fH
 Kalman H-matrix. More...
 
double fChisq
 Incremental chisquare. More...
 

Detailed Description

template<int N>
class trkf::KHit< N >

Definition at line 74 of file KHit.h.

Constructor & Destructor Documentation

template<int N>
trkf::KHit< N >::KHit ( )

Default constructor.

Definition at line 165 of file KHit.h.

165  : fChisq(0.)
166  {}
double fChisq
Incremental chisquare.
Definition: KHit.h:158
template<int N>
trkf::KHit< N >::KHit ( const std::shared_ptr< const Surface > &  psurf)

Initializing Constructor – surface only.

Initializing Constructor – surface only.

Arguments:

psurf - Surface pointer.

Definition at line 175 of file KHit.h.

175  : KHitBase(psurf), fChisq(0.)
176  {}
KHitBase()
Default constructor.
Definition: KHitBase.cxx:18
double fChisq
Incremental chisquare.
Definition: KHit.h:158
template<int N>
trkf::KHit< N >::KHit ( const std::shared_ptr< const Surface > &  psurf,
const typename KVector< N >::type mvec,
const typename KSymMatrix< N >::type merr 
)

Fully Initializing Constructor.

Fully Initializing Constructor.

Arguments:

psurf - Surface pointer. mvec - Measurement vector. merr - Measurement error.

Definition at line 187 of file KHit.h.

190  : KHitBase(psurf), fMvec(mvec), fMerr(merr), fChisq(0.)
191  {}
KVector< N >::type fMvec
Measurement vector.
Definition: KHit.h:150
KHitBase()
Default constructor.
Definition: KHitBase.cxx:18
KSymMatrix< N >::type fMerr
Measurement error matrix.
Definition: KHit.h:151
double fChisq
Incremental chisquare.
Definition: KHit.h:158
template<int N>
trkf::KHit< N >::~KHit ( )
virtual

Destructor.

Definition at line 195 of file KHit.h.

196  {}

Member Function Documentation

template<int N>
double trkf::KHit< N >::getChisq ( ) const
inlinevirtual

Incremental chisquare.

Implements trkf::KHitBase.

Definition at line 125 of file KHit.h.

125 { return fChisq; }
double fChisq
Incremental chisquare.
Definition: KHit.h:158
template<int N>
const KHMatrix<N>::type& trkf::KHit< N >::getH ( ) const
inline

Kalman H-matrix.

Definition at line 122 of file KHit.h.

Referenced by trkf::KHitMulti::predict().

122 { return fH; }
KHMatrix< N >::type fH
Kalman H-matrix.
Definition: KHit.h:157
int trkf::KHitBase::getID ( ) const
inlineinherited
template<int N>
const KSymMatrix<N>::type& trkf::KHit< N >::getMeasError ( ) const
inline

Measurement error matrix.

Definition at line 104 of file KHit.h.

Referenced by trkf::KHitMulti::predict().

104 { return fMerr; }
KSymMatrix< N >::type fMerr
Measurement error matrix.
Definition: KHit.h:151
int trkf::KHitBase::getMeasPlane ( ) const
inlineinherited

Measurement plane index.

Definition at line 85 of file KHitBase.h.

References trkf::KHitBase::fMeasPlane.

Referenced by trkf::KalmanFilterAlg::buildTrack(), trkf::KalmanFilterAlg::cleanTrack(), trkf::KalmanFilterAlg::extendTrack(), and trkf::KGTrack::Print().

85 { return fMeasPlane; }
int fMeasPlane
Measurement plane index.
Definition: KHitBase.h:123
const std::shared_ptr<const Surface>& trkf::KHitBase::getMeasSurface ( ) const
inlineinherited

Measurement surface.

Definition at line 82 of file KHitBase.h.

References trkf::KHitBase::fMeasSurf.

Referenced by trkf::KHit< N >::predict(), trkf::KHitWireLine::subpredict(), and trkf::KHitWireX::subpredict().

82 { return fMeasSurf; }
std::shared_ptr< const Surface > fMeasSurf
Measurement surface.
Definition: KHitBase.h:122
template<int N>
const KVector<N>::type& trkf::KHit< N >::getMeasVector ( ) const
inline

Measurement vector.

Definition at line 101 of file KHit.h.

Referenced by trkf::KHitMulti::predict().

101 { return fMvec; }
KVector< N >::type fMvec
Measurement vector.
Definition: KHit.h:150
double trkf::KHitBase::getPredDistance ( ) const
inlineinherited

Prediction distance.

Definition at line 79 of file KHitBase.h.

References trkf::KHitBase::fPredDist.

Referenced by trkf::KalmanFilterAlg::buildTrack(), and trkf::KalmanFilterAlg::extendTrack().

79 { return fPredDist; }
double fPredDist
Prediction distance.
Definition: KHitBase.h:118
template<int N>
const KSymMatrix<N>::type& trkf::KHit< N >::getPredError ( ) const
inline

Prediction matrix.

Definition at line 110 of file KHit.h.

110 { return fPerr; }
KSymMatrix< N >::type fPerr
Prediction error matrix.
Definition: KHit.h:153
const std::shared_ptr<const Surface>& trkf::KHitBase::getPredSurface ( ) const
inlineinherited

Predition surface.

Definition at line 76 of file KHitBase.h.

References trkf::KHitBase::fPredSurf.

Referenced by trkf::KHitMulti::update(), and trkf::KHit< N >::update().

76 { return fPredSurf; }
std::shared_ptr< const Surface > fPredSurf
Prediction surface.
Definition: KHitBase.h:117
template<int N>
const KVector<N>::type& trkf::KHit< N >::getPredVector ( ) const
inline

Prediction vector.

Definition at line 107 of file KHit.h.

Referenced by trkf::KHitMulti::predict().

107 { return fPvec; }
KVector< N >::type fPvec
Prediction vector.
Definition: KHit.h:152
template<int N>
const KSymMatrix<N>::type& trkf::KHit< N >::getResError ( ) const
inline

Residual error matrix.

Definition at line 116 of file KHit.h.

Referenced by trkf::Track3DKalmanHit::fillHistograms(), and trkf::TrackKalmanCheater::produce().

116 { return fRerr; }
KSymMatrix< N >::type fRerr
Residual error matrix.
Definition: KHit.h:155
template<int N>
const KSymMatrix<N>::type& trkf::KHit< N >::getResInvError ( ) const
inline

Residual inv. error matrix.

Definition at line 119 of file KHit.h.

119 { return fRinv; }
KSymMatrix< N >::type fRinv
Residual inverse error matrix.
Definition: KHit.h:156
template<int N>
const KVector<N>::type& trkf::KHit< N >::getResVector ( ) const
inline

Residual vector.

Definition at line 113 of file KHit.h.

Referenced by trkf::Track3DKalmanHit::fillHistograms(), and trkf::TrackKalmanCheater::produce().

113 { return fRvec; }
KVector< N >::type fRvec
Residual vector.
Definition: KHit.h:154
template<int N>
bool trkf::KHit< N >::predict ( const KETrack tre,
const Propagator prop,
const KTrack ref = 0 
) const
virtual

Prediction method (return false if fail).

Prediction method.

Arguments;

tre - Track prediction. prop - Propagator. ref - Reference track.

Implements trkf::KHitBase.

Definition at line 207 of file KHit.h.

References larg4::dist(), trkf::Propagator::err_prop(), trkf::KHit< N >::fChisq, trkf::KHit< N >::fH, trkf::KHit< N >::fMerr, trkf::KHit< N >::fMvec, trkf::KHit< N >::fPerr, trkf::KHitBase::fPredDist, trkf::KHitBase::fPredSurf, trkf::KHit< N >::fPvec, trkf::KHit< N >::fRerr, trkf::KHit< N >::fRinv, trkf::KHit< N >::fRvec, trkf::KHitBase::getMeasSurface(), trkf::KTrack::getSurface(), trkf::KHit< N >::subpredict(), trkf::syminvert(), and trkf::Propagator::UNKNOWN.

Referenced by trkf::KHit< 1 >::getChisq(), and trkf::KHitMulti::predict().

208  {
209  // Update the prediction surface to be the track surface.
210 
211  fPredSurf = tre.getSurface();
212  fPredDist = 0.;
213 
214  // Default result.
215 
216  bool ok = false;
217 
218  // Update prediction vector, error matrox, and H-matrix.
219 
220  // First test whether the prediction surface matches the
221  // measurement surface.
222 
223  if (getMeasSurface()->isEqual(*fPredSurf)) {
224 
225  // Prediction and measurement surfaces agree.
226  //Just call subpredict method (don't do propagation).
227 
228  ok = subpredict(tre, fPvec, fPerr, fH);
229  }
230  else {
231 
232  // Track surface does not match the prediction surface, so an
233  // internal propagation will be required. Throw an exception if
234  // no propagator was provided.
235 
236  // First make a copy of the original KETrack.
237 
238  KETrack treprop(tre);
239 
240  // Also make a copy of the reference track (if specified).
241 
242  KTrack refprop;
243  KTrack* prefprop = 0;
244  if (ref != 0) {
245  refprop = *ref;
246  prefprop = &refprop;
247  }
248 
249  // Make a no-noise, no-dE/dx propagation to the measurement
250  // surface. But do calculate the propagation matrix, which we
251  // will use to update the H-matrix calculated in the derived
252  // class.
253 
254  TrackMatrix prop_matrix;
255  std::optional<double> dist = prop.err_prop(
256  treprop, getMeasSurface(), Propagator::UNKNOWN, false, prefprop, &prop_matrix);
257  if (dist) {
258 
259  // Update prediction distance.
260 
261  fPredDist = *dist;
262 
263  // Now we are ready to calculate the prediction on the
264  // measurement surface.
265 
266  typename KHMatrix<N>::type hmatrix;
267  ok = subpredict(treprop, fPvec, fPerr, hmatrix);
268  if (ok) {
269 
270  // Use the propagation matrix to transform the H-matrix back
271  // to the prediction surface.
272 
273  fH = prod(hmatrix, prop_matrix);
274  }
275  }
276  }
277  if (ok) {
278 
279  // Update residual
280 
281  fRvec = fMvec - fPvec;
282  fRerr = fMerr + fPerr;
283  fRinv = fRerr;
284  ok = syminvert(fRinv);
285  if (ok) {
286 
287  // Calculate incremental chisquare.
288 
289  // (workaround: if we use the copy constructor, gcc emits a spurious warning)
290  // typename KVector<N>::type rtemp = prod(fRinv, fRvec);
291  fChisq = inner_prod(fRvec, prod(fRinv, fRvec));
292  }
293  }
294 
295  // If a problem occured at any step, clear the prediction surface pointer.
296 
297  if (!ok) {
298  fPredSurf.reset();
299  fPredDist = 0.;
300  }
301 
302  // Done.
303 
304  return ok;
305  }
virtual bool subpredict(const KETrack &tre, typename KVector< N >::type &pvec, typename KSymMatrix< N >::type &perr, typename KHMatrix< N >::type &hmatrix) const =0
Calculate prediction function (return via arguments).
KVector< N >::type fPvec
Prediction vector.
Definition: KHit.h:152
KMatrix< 5, 5 >::type TrackMatrix
General 5x5 matrix.
KVector< N >::type fMvec
Measurement vector.
Definition: KHit.h:150
KVector< N >::type fRvec
Residual vector.
Definition: KHit.h:154
std::shared_ptr< const Surface > fPredSurf
Prediction surface.
Definition: KHitBase.h:117
bool syminvert(ublas::symmetric_matrix< T, TRI, L, A > &m)
KHMatrix< N >::type fH
Kalman H-matrix.
Definition: KHit.h:157
KSymMatrix< N >::type fRinv
Residual inverse error matrix.
Definition: KHit.h:156
double fPredDist
Prediction distance.
Definition: KHitBase.h:118
KMatrix< N, 5 >::type type
KSymMatrix< N >::type fRerr
Residual error matrix.
Definition: KHit.h:155
constexpr double dist(const TReal *x, const TReal *y, const unsigned int dimension)
KSymMatrix< N >::type fPerr
Prediction error matrix.
Definition: KHit.h:153
KSymMatrix< N >::type fMerr
Measurement error matrix.
Definition: KHit.h:151
const std::shared_ptr< const Surface > & getMeasSurface() const
Measurement surface.
Definition: KHitBase.h:82
double fChisq
Incremental chisquare.
Definition: KHit.h:158
template<int N>
std::ostream & trkf::KHit< N >::Print ( std::ostream &  out,
bool  doTitle = true 
) const
virtual

Printout.

Reimplemented from trkf::KHitBase.

Definition at line 357 of file KHit.h.

References util::abs(), trkf::KHit< N >::fChisq, trkf::KHit< N >::fMerr, trkf::KHit< N >::fMvec, trkf::KHit< N >::fPerr, trkf::KHit< N >::fPvec, trkf::KHit< N >::fRerr, trkf::KHit< N >::fRvec, and trkf::KHitBase::Print().

Referenced by trkf::KHit< 1 >::getChisq().

358  {
359  if (doTitle) out << "KHit<" << N << ">:\n";
360 
361  // Print base class.
362 
363  KHitBase::Print(out, false);
364 
365  // Print measurement vector.
366 
367  out << " Measurement vector:\n"
368  << " [";
369  for (unsigned int i = 0; i < fMvec.size(); ++i) {
370  if (i != 0) out << ", ";
371  out << fMvec(i);
372  }
373  out << "]\n";
374 
375  // Print diagonal measurement errors.
376 
377  out << " Diagonal measurement errors:\n"
378  << " [";
379  for (unsigned int i = 0; i < fMerr.size1(); ++i) {
380  if (i != 0) out << ", ";
381  double err = fMerr(i, i);
382  err = (err >= 0. ? std::sqrt(err) : -std::sqrt(-err));
383  out << err;
384  }
385  out << "]\n";
386 
387  // Print measurement correlations.
388 
389  if (fMerr.size1() > 1) {
390  out << " Measurement correlation matrix:";
391  for (unsigned int i = 0; i < fMerr.size1(); ++i) {
392  if (i == 0)
393  out << "\n [";
394  else
395  out << "\n ";
396  for (unsigned int j = 0; j <= i; ++j) {
397  if (j != 0) out << ", ";
398  if (i == j)
399  out << 1.;
400  else {
401  double eiijj = fMerr(i, i) * fMerr(j, j);
402  double eij = fMerr(i, j);
403  if (eiijj != 0.)
404  eij /= std::sqrt(std::abs(eiijj));
405  else
406  eij = 0.;
407  out << eij;
408  }
409  }
410  }
411  out << "]\n";
412  }
413 
414  // Print prediction vector.
415 
416  out << " Prediction vector:\n"
417  << " [";
418  for (unsigned int i = 0; i < fPvec.size(); ++i) {
419  if (i != 0) out << ", ";
420  out << fPvec(i);
421  }
422  out << "]\n";
423 
424  // Print diagonal prediction errors.
425 
426  out << " Diagonal prediction errors:\n"
427  << " [";
428  for (unsigned int i = 0; i < fPerr.size1(); ++i) {
429  if (i != 0) out << ", ";
430  double err = fPerr(i, i);
431  err = (err >= 0. ? std::sqrt(err) : -std::sqrt(-err));
432  out << err;
433  }
434  out << "]\n";
435 
436  // Print prediction correlations.
437 
438  if (fPerr.size1() > 1) {
439  out << " Prediction correlation matrix:";
440  for (unsigned int i = 0; i < fPerr.size1(); ++i) {
441  if (i == 0)
442  out << "\n [";
443  else
444  out << "\n ";
445  for (unsigned int j = 0; j <= i; ++j) {
446  if (j != 0) out << ", ";
447  if (i == j)
448  out << 1.;
449  else {
450  double eiijj = fPerr(i, i) * fPerr(j, j);
451  double eij = fPerr(i, j);
452  if (eiijj != 0.)
453  eij /= std::sqrt(std::abs(eiijj));
454  else
455  eij = 0.;
456  out << eij;
457  }
458  }
459  }
460  out << "]\n";
461  }
462 
463  // Print residual vector.
464 
465  out << " Residual vector:\n"
466  << " [";
467  for (unsigned int i = 0; i < fRvec.size(); ++i) {
468  if (i != 0) out << ", ";
469  out << fRvec(i);
470  }
471  out << "]\n";
472 
473  // Print diagonal residual errors.
474 
475  out << " Diagonal residual errors:\n"
476  << " [";
477  for (unsigned int i = 0; i < fRerr.size1(); ++i) {
478  if (i != 0) out << ", ";
479  double err = fRerr(i, i);
480  err = (err >= 0. ? std::sqrt(err) : -std::sqrt(-err));
481  out << err;
482  }
483  out << "]\n";
484 
485  // Print residual correlations.
486 
487  if (fRerr.size1() > 1) {
488  out << " Residual correlation matrix:";
489  for (unsigned int i = 0; i < fRerr.size1(); ++i) {
490  if (i == 0)
491  out << "\n [";
492  else
493  out << "\n ";
494  for (unsigned int j = 0; j <= i; ++j) {
495  if (j != 0) out << ", ";
496  if (i == j)
497  out << 1.;
498  else {
499  double eiijj = fRerr(i, i) * fRerr(j, j);
500  double eij = fRerr(i, j);
501  if (eiijj != 0.)
502  eij /= std::sqrt(std::abs(eiijj));
503  else
504  eij = 0.;
505  out << eij;
506  }
507  }
508  }
509  out << "]\n";
510  }
511 
512  // Print incremental chisquare.
513 
514  out << " Incremental chisquare = " << fChisq << "\n";
515 
516  // Done.
517 
518  return out;
519  }
constexpr auto abs(T v)
Returns the absolute value of the argument.
STL namespace.
virtual std::ostream & Print(std::ostream &out, bool doTitle=true) const
Printout.
Definition: KHitBase.cxx:31
KVector< N >::type fPvec
Prediction vector.
Definition: KHit.h:152
KVector< N >::type fMvec
Measurement vector.
Definition: KHit.h:150
KVector< N >::type fRvec
Residual vector.
Definition: KHit.h:154
KSymMatrix< N >::type fRerr
Residual error matrix.
Definition: KHit.h:155
KSymMatrix< N >::type fPerr
Prediction error matrix.
Definition: KHit.h:153
KSymMatrix< N >::type fMerr
Measurement error matrix.
Definition: KHit.h:151
double fChisq
Incremental chisquare.
Definition: KHit.h:158
template<int N>
void trkf::KHit< N >::setMeasError ( const typename KSymMatrix< N >::type merr)
inline

Set measurement error.

Definition at line 96 of file KHit.h.

96 { fMerr = merr; }
KSymMatrix< N >::type fMerr
Measurement error matrix.
Definition: KHit.h:151
void trkf::KHitBase::setMeasPlane ( int  plane)
inlineinherited

Measurement plane.

Definition at line 96 of file KHitBase.h.

References trkf::KHitBase::fMeasPlane, trkf::KHitBase::getChisq(), trkf::KHitBase::predict(), trkf::KHitBase::Print(), and trkf::KHitBase::update().

Referenced by trkf::KHitWireLine::KHitWireLine(), and trkf::KHitWireX::KHitWireX().

96 { fMeasPlane = plane; }
int fMeasPlane
Measurement plane index.
Definition: KHitBase.h:123
void trkf::KHitBase::setMeasSurface ( const std::shared_ptr< const Surface > &  psurf)
inlineinherited

Measurement surface.

Definition at line 93 of file KHitBase.h.

References trkf::KHitBase::fMeasSurf.

Referenced by trkf::KHitWireLine::KHitWireLine(), and trkf::KHitWireX::KHitWireX().

93 { fMeasSurf = psurf; }
std::shared_ptr< const Surface > fMeasSurf
Measurement surface.
Definition: KHitBase.h:122
template<int N>
void trkf::KHit< N >::setMeasVector ( const typename KVector< N >::type mvec)
inline

Set measurement vector.

Definition at line 93 of file KHit.h.

93 { fMvec = mvec; }
KVector< N >::type fMvec
Measurement vector.
Definition: KHit.h:150
template<int N>
virtual bool trkf::KHit< N >::subpredict ( const KETrack tre,
typename KVector< N >::type pvec,
typename KSymMatrix< N >::type perr,
typename KHMatrix< N >::type hmatrix 
) const
pure virtual

Calculate prediction function (return via arguments).

Referenced by trkf::KHit< 1 >::getChisq(), and trkf::KHit< N >::predict().

template<int N>
void trkf::KHit< N >::update ( KETrack tre) const
virtual

Update track method.

Update track method.

Arguments:

tre - Track to be updated.

Implements trkf::KHitBase.

Definition at line 314 of file KHit.h.

References trkf::KHit< N >::fH, trkf::KHit< N >::fMerr, trkf::KHit< N >::fRinv, trkf::KHit< N >::fRvec, trkf::KETrack::getError(), trkf::KHitBase::getPredSurface(), trkf::KTrack::getSurface(), trkf::KTrack::getVector(), trkf::KETrack::setError(), trkf::KTrack::setVector(), and util::size().

Referenced by trkf::KHit< 1 >::getChisq().

315  {
316  // Make sure that the track surface and the prediction surface are the same.
317  // Throw an exception if they are not.
318 
319  if (!getPredSurface()->isEqual(*tre.getSurface()))
320  throw cet::exception("KHit") << "Track surface not the same as prediction surface.\n";
321 
322  const TrackVector& tvec = tre.getVector();
323  const TrackError& terr = tre.getError();
324  TrackVector::size_type size = tvec.size();
325 
326  // Calculate gain matrix.
327 
328  typename KGMatrix<N>::type temp(size, N);
329  typename KGMatrix<N>::type gain(size, N);
330  temp = prod(trans(fH), fRinv);
331  gain = prod(terr, temp);
332 
333  // Calculate updated track state.
334 
335  TrackVector newvec = tre.getVector() + prod(gain, fRvec);
336 
337  // Calculate updated error matrix.
338 
339  TrackMatrix fact = ublas::identity_matrix<TrackVector::value_type>(size);
340  fact -= prod(gain, fH);
341  TrackMatrix errtemp1 = prod(terr, trans(fact));
342  TrackMatrix errtemp2 = prod(fact, errtemp1);
343  TrackError errtemp2s = ublas::symmetric_adaptor<TrackMatrix>(errtemp2);
344  typename KHMatrix<N>::type errtemp3 = prod(fMerr, trans(gain));
345  TrackMatrix errtemp4 = prod(gain, errtemp3);
346  TrackError errtemp4s = ublas::symmetric_adaptor<TrackMatrix>(errtemp4);
347  TrackError newerr = errtemp2s + errtemp4s;
348 
349  // Update track.
350 
351  tre.setVector(newvec);
352  tre.setError(newerr);
353  }
KSymMatrix< 5 >::type TrackError
Track error matrix, dimension 5x5.
decltype(auto) constexpr size(T &&obj)
ADL-aware version of std::size.
Definition: StdUtils.h:101
KMatrix< 5, 5 >::type TrackMatrix
General 5x5 matrix.
KVector< N >::type fRvec
Residual vector.
Definition: KHit.h:154
KMatrix< 5, N >::type type
KHMatrix< N >::type fH
Kalman H-matrix.
Definition: KHit.h:157
KSymMatrix< N >::type fRinv
Residual inverse error matrix.
Definition: KHit.h:156
KVector< 5 >::type TrackVector
Track state vector, dimension 5.
KMatrix< N, 5 >::type type
KSymMatrix< N >::type fMerr
Measurement error matrix.
Definition: KHit.h:151
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
const std::shared_ptr< const Surface > & getPredSurface() const
Predition surface.
Definition: KHitBase.h:76

Member Data Documentation

template<int N>
double trkf::KHit< N >::fChisq
mutableprivate

Incremental chisquare.

Definition at line 158 of file KHit.h.

Referenced by trkf::KHit< 1 >::getChisq(), trkf::KHit< N >::predict(), and trkf::KHit< N >::Print().

template<int N>
KHMatrix<N>::type trkf::KHit< N >::fH
mutableprivate

Kalman H-matrix.

Definition at line 157 of file KHit.h.

Referenced by trkf::KHit< 1 >::getH(), trkf::KHit< N >::predict(), and trkf::KHit< N >::update().

int trkf::KHitBase::fID
protectedinherited

Unique id.

Definition at line 119 of file KHitBase.h.

Referenced by trkf::KHitBase::getID(), trkf::KHitWireLine::KHitWireLine(), and trkf::KHitWireX::KHitWireX().

template<int N>
KSymMatrix<N>::type trkf::KHit< N >::fMerr
private
template<int N>
KVector<N>::type trkf::KHit< N >::fMvec
private
template<int N>
KSymMatrix<N>::type trkf::KHit< N >::fPerr
mutableprivate

Prediction error matrix.

Definition at line 153 of file KHit.h.

Referenced by trkf::KHit< 1 >::getPredError(), trkf::KHit< N >::predict(), and trkf::KHit< N >::Print().

double trkf::KHitBase::fPredDist
mutableprotectedinherited
std::shared_ptr<const Surface> trkf::KHitBase::fPredSurf
mutableprotectedinherited
template<int N>
KVector<N>::type trkf::KHit< N >::fPvec
mutableprivate

Prediction vector.

Definition at line 152 of file KHit.h.

Referenced by trkf::KHit< 1 >::getPredVector(), trkf::KHit< N >::predict(), and trkf::KHit< N >::Print().

template<int N>
KSymMatrix<N>::type trkf::KHit< N >::fRerr
mutableprivate

Residual error matrix.

Definition at line 155 of file KHit.h.

Referenced by trkf::KHit< 1 >::getResError(), trkf::KHit< N >::predict(), and trkf::KHit< N >::Print().

template<int N>
KSymMatrix<N>::type trkf::KHit< N >::fRinv
mutableprivate

Residual inverse error matrix.

Definition at line 156 of file KHit.h.

Referenced by trkf::KHit< 1 >::getResInvError(), trkf::KHit< N >::predict(), and trkf::KHit< N >::update().

template<int N>
KVector<N>::type trkf::KHit< N >::fRvec
mutableprivate

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