68 #include "cetlib_except/exception.h" 81 KHit(
const std::shared_ptr<const Surface>& psurf);
84 KHit(
const std::shared_ptr<const Surface>& psurf,
146 virtual std::ostream&
Print(std::ostream& out,
bool doTitle =
true)
const;
245 throw cet::exception(
"KHit") <<
"Track surface does not match measurement surface and no propagator.\n";
269 prefprop, &prop_matrix);
287 fH = prod(hmatrix, prop_matrix);
334 throw cet::exception(
"KHit") <<
"Track surface not the same as prediction surface.\n";
338 TrackVector::size_type size = tvec.size();
345 gain = prod(terr, temp);
353 TrackMatrix fact = ublas::identity_matrix<TrackVector::value_type>(size);
354 fact -= prod(gain,
fH);
357 TrackError errtemp2s = ublas::symmetric_adaptor<TrackMatrix>(errtemp2);
360 TrackError errtemp4s = ublas::symmetric_adaptor<TrackMatrix>(errtemp4);
374 out <<
"KHit<" << N <<
">:\n";
382 out <<
" Measurement vector:\n" 384 for(
unsigned int i = 0; i <
fMvec.size(); ++i) {
393 out <<
" Diagonal measurement errors:\n" 395 for(
unsigned int i = 0; i <
fMerr.size1(); ++i) {
398 double err =
fMerr(i,i);
399 err = (err >= 0. ? std::sqrt(err) : -std::sqrt(-err));
406 if(
fMerr.size1() > 1) {
407 out <<
" Measurement correlation matrix:";
408 for(
unsigned int i = 0; i <
fMerr.size1(); ++i) {
413 for(
unsigned int j = 0; j <= i; ++j) {
420 double eij =
fMerr(i,j);
422 eij /= std::sqrt(std::abs(eiijj));
434 out <<
" Prediction vector:\n" 436 for(
unsigned int i = 0; i <
fPvec.size(); ++i) {
445 out <<
" Diagonal prediction errors:\n" 447 for(
unsigned int i = 0; i <
fPerr.size1(); ++i) {
450 double err =
fPerr(i,i);
451 err = (err >= 0. ? std::sqrt(err) : -std::sqrt(-err));
458 if(
fPerr.size1() > 1) {
459 out <<
" Prediction correlation matrix:";
460 for(
unsigned int i = 0; i <
fPerr.size1(); ++i) {
465 for(
unsigned int j = 0; j <= i; ++j) {
472 double eij =
fPerr(i,j);
474 eij /= std::sqrt(std::abs(eiijj));
486 out <<
" Residual vector:\n" 488 for(
unsigned int i = 0; i <
fRvec.size(); ++i) {
497 out <<
" Diagonal residual errors:\n" 499 for(
unsigned int i = 0; i <
fRerr.size1(); ++i) {
502 double err =
fRerr(i,i);
503 err = (err >= 0. ? std::sqrt(err) : -std::sqrt(-err));
510 if(
fRerr.size1() > 1) {
511 out <<
" Residual correlation matrix:";
512 for(
unsigned int i = 0; i <
fRerr.size1(); ++i) {
517 for(
unsigned int j = 0; j <= i; ++j) {
524 double eij =
fRerr(i,j);
526 eij /= std::sqrt(std::abs(eiijj));
538 out <<
" Incremental chisquare = " <<
fChisq <<
"\n";
ublas::symmetric_matrix< double, ublas::lower, ublas::row_major, ublas::bounded_array< double, N *(N+1)/2 > > type
const TrackError & getError() const
Track error matrix.
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).
const std::shared_ptr< const Surface > & getSurface() const
Surface.
void update(KETrack &tre) const
Update track method.
KSymMatrix< 5 >::type TrackError
Track error matrix, dimension 5x5.
void setVector(const TrackVector &vec)
Set state vector.
const KSymMatrix< N >::type & getMeasError() const
Measurement error matrix.
virtual std::ostream & Print(std::ostream &out, bool doTitle=true) const
Printout.
const KHMatrix< N >::type & getH() const
Kalman H-matrix.
const KVector< N >::type & getResVector() const
Residual vector.
virtual std::ostream & Print(std::ostream &out, bool doTitle=true) const
Printout.
void setError(const TrackError &err)
Set error matrix.
const KVector< N >::type & getPredVector() const
Prediction vector.
const KSymMatrix< N >::type & getPredError() const
Prediction matrix.
boost::optional< double > err_prop(KETrack &tre, const std::shared_ptr< const Surface > &psurf, PropDirection dir, bool doDedx, KTrack *ref=0, TrackMatrix *prop_matrix=0) const
Propagate with error, but without noise.
KVector< N >::type fPvec
Prediction vector.
KHit()
Default constructor.
KMatrix< N, 5 >::type type
KVector< N >::type fMvec
Measurement vector.
KVector< N >::type fRvec
Residual vector.
void setMeasVector(const typename KVector< N >::type &mvec)
Set measurement vector.
std::shared_ptr< const Surface > fPredSurf
Prediction surface.
const KSymMatrix< N >::type & getResError() const
Residual error matrix.
ublas::vector< double, ublas::bounded_array< double, N > > type
bool syminvert(ublas::symmetric_matrix< T, TRI, L, A > &m)
KHMatrix< N >::type fH
Kalman H-matrix.
const KSymMatrix< N >::type & getResInvError() const
Residual inv. error matrix.
double getChisq() const
Incremental chisquare.
KSymMatrix< N >::type fRinv
Residual inverse error matrix.
KVector< 5 >::type TrackVector
Track state vector, dimension 5.
void setMeasError(const typename KSymMatrix< N >::type &merr)
Set measurement error.
bool predict(const KETrack &tre, const Propagator *prop=0, const KTrack *ref=0) const
Prediction method (return false if fail).
double fPredDist
Prediction distance.
const TrackVector & getVector() const
Track state vector.
KSymMatrix< N >::type fRerr
Residual error matrix.
const KVector< N >::type & getMeasVector() const
Measurement vector.
KMatrix< 5, 5 >::type TrackMatrix
General 5x5 matrix.
KSymMatrix< N >::type fPerr
Prediction error matrix.
KMatrix< 5, N >::type type
virtual ~KHit()
Destructor.
KSymMatrix< N >::type fMerr
Measurement error matrix.
Base class for Kalman filter measurement.
const std::shared_ptr< const Surface > & getMeasSurface() const
Measurement surface.
cet::coded_exception< error, detail::translate > exception
double fChisq
Incremental chisquare.
const std::shared_ptr< const Surface > & getPredSurface() const
Predition surface.