12 #include "cetlib_except/exception.h"
43 :
KTrack(psurf, vec, dir, pdg), fErr(err)
70 throw cet::exception(
"KETrack") <<
"Pointing error requested for invalid track.\n";
95 throw cet::exception(
"KETrack") <<
"Track combination surfaces are not the same.\n";
99 std::optional<double> result{std::nullopt};
116 for (
unsigned int i = 0; i < err1->size1(); ++i)
117 tr1 += (*err1)(i, i);
120 for (
unsigned int i = 0; i < err2->size1(); ++i)
121 tr2 += (*err2)(i, i);
159 TrackError terr2s = ublas::symmetric_adaptor<TrackMatrix>(terr2);
167 double chisq = inner_prod(dvec, dvec1);
168 result = std::make_optional(chisq);
173 if (!
isValid()) result = std::nullopt;
184 if (doTitle) out <<
"KETrack:\n";
192 out <<
" Diagonal errors:\n"
194 for (
unsigned int i = 0; i <
fErr.size1(); ++i) {
195 if (i != 0) out <<
", ";
197 err = (err >= 0. ? std::sqrt(err) : -std::sqrt(-err));
204 out <<
" Correlation matrix:";
205 for (
unsigned int i = 0; i <
fErr.size1(); ++i) {
210 for (
unsigned int j = 0; j <= i; ++j) {
211 if (j != 0) out <<
", ";
215 double eiijj =
fErr(i, i) *
fErr(j, j);
216 double eij =
fErr(i, j);
const TrackError & getError() const
Track error matrix.
TrackDirection
Track direction enum.
const std::shared_ptr< const Surface > & getSurface() const
Surface.
double PointingError() const
Pointing error (radians).
KSymMatrix< 5 >::type TrackError
Track error matrix, dimension 5x5.
void setVector(const TrackVector &vec)
Set state vector.
EResult err(const char *call)
KETrack()
Default constructor.
void setError(const TrackError &err)
Set error matrix.
virtual ~KETrack()
Destructor.
bool syminvert(ublas::symmetric_matrix< T, TRI, L, A > &m)
std::optional< double > combineTrack(const KETrack &tre)
Combine two tracks.
KVector< 5 >::type TrackVector
Track state vector, dimension 5.
virtual std::ostream & Print(std::ostream &out, bool doTitle=true) const
Printout.
const TrackVector & getVector() const
Track state vector.
KMatrix< 5, 5 >::type TrackMatrix
General 5x5 matrix.
TrackError fErr
Track error matrix.
virtual std::ostream & Print(std::ostream &out, bool doTitle=true) const
Printout.
Basic Kalman filter track class, with error.
bool isValid() const
Test if track is valid.