12 #include "cetlib_except/exception.h" 69 throw cet::exception(
"KETrack") <<
"Pointing error requested for invalid track.\n";
93 throw cet::exception(
"KETrack") <<
"Track combination surfaces are not the same.\n";
97 std::optional<double> result{std::nullopt};
114 for (
unsigned int i = 0; i < err1->size1(); ++i)
115 tr1 += (*err1)(i, i);
118 for (
unsigned int i = 0; i < err2->size1(); ++i)
119 tr2 += (*err2)(i, i);
157 TrackError terr2s = ublas::symmetric_adaptor<TrackMatrix>(terr2);
165 double chisq = inner_prod(dvec, dvec1);
166 result = std::make_optional(chisq);
171 if (!
isValid()) result = std::nullopt;
181 if (doTitle) out <<
"KETrack:\n";
189 out <<
" Diagonal errors:\n" 191 for (
unsigned int i = 0; i <
fErr.size1(); ++i) {
192 if (i != 0) out <<
", ";
193 double err =
fErr(i, i);
194 err = (err >= 0. ? std::sqrt(err) : -std::sqrt(-err));
201 out <<
" Correlation matrix:";
202 for (
unsigned int i = 0; i <
fErr.size1(); ++i) {
207 for (
unsigned int j = 0; j <= i; ++j) {
208 if (j != 0) out <<
", ";
212 double eiijj =
fErr(i, i) *
fErr(j, j);
213 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.
constexpr auto abs(T v)
Returns the absolute value of the argument.
KETrack()
Default constructor.
void setError(const TrackError &err)
Set error matrix.
KMatrix< 5, 5 >::type TrackMatrix
General 5x5 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.
TrackError fErr
Track error matrix.
virtual std::ostream & Print(std::ostream &out, bool doTitle=true) const
Printout.
Basic Kalman filter track class, with error.
cet::coded_exception< error, detail::translate > exception
bool isValid() const
Test if track is valid.