67 #include "cetlib_except/exception.h" 80 KHit(
const std::shared_ptr<const Surface>& psurf);
83 KHit(
const std::shared_ptr<const Surface>& psurf,
145 virtual std::ostream&
Print(std::ostream& out,
bool doTitle =
true)
const;
273 fH = prod(hmatrix, prop_matrix);
320 throw cet::exception(
"KHit") <<
"Track surface not the same as prediction surface.\n";
324 TrackVector::size_type
size = tvec.size();
331 gain = prod(terr, temp);
339 TrackMatrix fact = ublas::identity_matrix<TrackVector::value_type>(
size);
340 fact -= prod(gain,
fH);
343 TrackError errtemp2s = ublas::symmetric_adaptor<TrackMatrix>(errtemp2);
346 TrackError errtemp4s = ublas::symmetric_adaptor<TrackMatrix>(errtemp4);
359 if (doTitle) out <<
"KHit<" << N <<
">:\n";
367 out <<
" Measurement vector:\n" 369 for (
unsigned int i = 0; i <
fMvec.size(); ++i) {
370 if (i != 0) out <<
", ";
377 out <<
" Diagonal measurement errors:\n" 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));
389 if (
fMerr.size1() > 1) {
390 out <<
" Measurement correlation matrix:";
391 for (
unsigned int i = 0; i <
fMerr.size1(); ++i) {
396 for (
unsigned int j = 0; j <= i; ++j) {
397 if (j != 0) out <<
", ";
402 double eij =
fMerr(i, j);
416 out <<
" Prediction vector:\n" 418 for (
unsigned int i = 0; i <
fPvec.size(); ++i) {
419 if (i != 0) out <<
", ";
426 out <<
" Diagonal prediction errors:\n" 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));
438 if (
fPerr.size1() > 1) {
439 out <<
" Prediction correlation matrix:";
440 for (
unsigned int i = 0; i <
fPerr.size1(); ++i) {
445 for (
unsigned int j = 0; j <= i; ++j) {
446 if (j != 0) out <<
", ";
451 double eij =
fPerr(i, j);
465 out <<
" Residual vector:\n" 467 for (
unsigned int i = 0; i <
fRvec.size(); ++i) {
468 if (i != 0) out <<
", ";
475 out <<
" Diagonal residual errors:\n" 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));
487 if (
fRerr.size1() > 1) {
488 out <<
" Residual correlation matrix:";
489 for (
unsigned int i = 0; i <
fRerr.size1(); ++i) {
494 for (
unsigned int j = 0; j <= i; ++j) {
495 if (j != 0) out <<
", ";
500 double eij =
fRerr(i, j);
514 out <<
" Incremental chisquare = " <<
fChisq <<
"\n";
bool predict(const KETrack &tre, const Propagator &prop, const KTrack *ref=0) const
Prediction method (return false if fail).
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.
constexpr auto abs(T v)
Returns the absolute value of the argument.
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.
ublas::symmetric_matrix< double, ublas::lower, ublas::row_major, ublas::bounded_array< double, N *(N+1)/2 > > type
KVector< N >::type fPvec
Prediction vector.
KHit()
Default constructor.
decltype(auto) constexpr size(T &&obj)
ADL-aware version of std::size.
KMatrix< 5, 5 >::type TrackMatrix
General 5x5 matrix.
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.
KMatrix< 5, N >::type type
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.
std::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.
KSymMatrix< N >::type fRinv
Residual inverse error matrix.
Base class for Kalman filter track propagator.
KVector< 5 >::type TrackVector
Track state vector, dimension 5.
void setMeasError(const typename KSymMatrix< N >::type &merr)
Set measurement error.
double fPredDist
Prediction distance.
KMatrix< N, 5 >::type type
const TrackVector & getVector() const
Track state vector.
KSymMatrix< N >::type fRerr
Residual error matrix.
const KVector< N >::type & getMeasVector() const
Measurement vector.
constexpr double dist(const TReal *x, const TReal *y, const unsigned int dimension)
KSymMatrix< N >::type fPerr
Prediction error matrix.
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.