12 #include "cetlib_except/exception.h"
26 :
KHitBase(psurf), fMeasDim(0), fChisq(0.)
47 throw cet::exception(
"KHitMulti") <<
"Attempt to add null measurement pointer.\n";
51 std::shared_ptr<const KHit<1>> pmeas1 =
56 if (pmeas1.get() == 0)
57 throw cet::exception(
"KHitMulti") <<
"Dynamic cast for KHitBase pointer failed.\n";
73 throw cet::exception(
"KHitMulti") <<
"Attempt to add null measurement pointer.\n";
134 for (
unsigned int im = 0; ok && im <
fMeasVec.size(); ++im) {
139 ok = meas.
predict(tre, prop, ref);
152 for (
unsigned int j = 0; j < meas.
getH().size2(); ++j)
153 fH(im, j) = meas.
getH()(0, j);
160 ublas::matrix<double> temp(
fH.size2(),
fMeasDim);
163 temp2 = prod(
fH, temp);
164 fPerr = ublas::symmetric_adaptor<ublas::matrix<double>>(temp2);
176 ublas::vector<double> rtemp = prod(
fRinv, fRvec);
177 fChisq = inner_prod(fRvec, rtemp);
208 throw cet::exception(
"KHitMulti") <<
"Track surface not the same as prediction surface.\n";
212 TrackVector::size_type
size = tvec.size();
216 ublas::matrix<double> temp(size,
fMeasDim);
217 ublas::matrix<double> gain(size,
fMeasDim);
219 gain = prod(terr, temp);
227 TrackMatrix fact = ublas::identity_matrix<TrackVector::value_type>(
size);
228 fact -= prod(gain,
fH);
231 TrackError errtemp2s = ublas::symmetric_adaptor<TrackMatrix>(errtemp2);
232 ublas::matrix<double> errtemp3 = prod(
fMerr, trans(gain));
234 TrackError errtemp4s = ublas::symmetric_adaptor<TrackMatrix>(errtemp4);
247 if (doTitle) out <<
"KHitMulti:\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.
ublas::vector< double > fPvec
Prediction vector.
const std::shared_ptr< const Surface > & getSurface() const
Surface.
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.
Compound Kalman Filter measurement.
std::size_t size(FixedBins< T, C > const &) noexcept
const KHMatrix< N >::type & getH() const
Kalman H-matrix.
std::vector< std::shared_ptr< const KHit< 1 > > > fMeasVec
Underlying measurements.
void setError(const TrackError &err)
Set error matrix.
const KVector< N >::type & getPredVector() const
Prediction vector.
std::shared_ptr< const Surface > fPredSurf
Prediction surface.
bool syminvert(ublas::symmetric_matrix< T, TRI, L, A > &m)
void addMeas(const std::shared_ptr< const KHitBase > &pmeas)
Add a measurement of unknown type.
ublas::symmetric_matrix< double > fRinv
Residual inverse error matrix.
KVector< 5 >::type TrackVector
Track state vector, dimension 5.
virtual std::ostream & Print(std::ostream &out, bool doTitle=true) const
Printout.
KHitMulti()
Default constructor.
ublas::symmetric_matrix< double > fPerr
Prediction error matrix.
double fPredDist
Prediction distance.
ublas::vector< double > fRvec
Residual vector.
const TrackVector & getVector() const
Track state vector.
bool predict(const KETrack &tre, const Propagator &prop, const KTrack *ref=0) const
Prediction method (return false if fail).
const KVector< N >::type & getMeasVector() const
Measurement vector.
ublas::matrix< double > fH
Kalman H-matrix.
KMatrix< 5, 5 >::type TrackMatrix
General 5x5 matrix.
ublas::symmetric_matrix< double > fRerr
Residual error matrix.
ublas::symmetric_matrix< double > fMerr
Measurement error matrix.
void update(KETrack &tre) const
Update track method.
double fChisq
Incremental chisquare.
ublas::vector< double > fMvec
Measurement vector.
const std::shared_ptr< const Surface > & getPredSurface() const
Predition surface.
virtual ~KHitMulti()
Destructor.
int fMeasDim
Measurement space dimension.