20 #include "SpacepointMeasurement.h"
22 #include "Exception.h"
23 #include "RKTrackRep.h"
25 #include "HMatrixUV.h"
26 #include "MeasurementOnPlane.h"
33 SpacepointMeasurement::SpacepointMeasurement(
int nDim)
34 : AbsMeasurement(nDim), weightedPlaneContruction_(true), G_(3), cutCov_(true)
41 SpacepointMeasurement::SpacepointMeasurement(
const TVectorD& rawHitCoords,
const TMatrixDSym& rawHitCov,
int detId,
int hitId, TrackPoint* trackPoint,
42 bool weightedPlaneContruction,
bool cutCov)
43 : AbsMeasurement(rawHitCoords, rawHitCov, detId, hitId, trackPoint),
44 weightedPlaneContruction_(weightedPlaneContruction), cutCov_(cutCov)
46 assert(rawHitCoords_.GetNrows() >= 3);
48 if (weightedPlaneContruction_)
58 const TVector3 point(rawHitCoords_(0), rawHitCoords_(1), rawHitCoords_(2));
60 if (weightedPlaneContruction_)
61 st.extrapolateToPoint(point, G_);
63 st.extrapolateToPoint(point);
69 std::vector<MeasurementOnPlane*> SpacepointMeasurement::constructMeasurementsOnPlane(
const StateOnPlane& state)
const
73 state.getPlane(), state.getRep(), constructHMatrix(state.getRep()));
75 TVectorD& m = mop->getState();
76 TMatrixDSym& V = mop->getCov();
78 const TVector3& o(state.getPlane()->getO());
79 const TVector3& u(state.getPlane()->getU());
80 const TVector3& v(state.getPlane()->getV());
83 m(0) = (rawHitCoords_(0)-o.X()) * u.X() +
84 (rawHitCoords_(1)-o.Y()) * u.Y() +
85 (rawHitCoords_(2)-o.Z()) * u.Z();
87 m(1) = (rawHitCoords_(0)-o.X()) * v.X() +
88 (rawHitCoords_(1)-o.Y()) * v.Y() +
89 (rawHitCoords_(2)-o.Z()) * v.Z();
106 tools::invertMatrix(V);
108 tools::invertMatrix(V);
114 std::vector<MeasurementOnPlane*> retVal;
115 retVal.push_back(mop);
121 if (
dynamic_cast<const RKTrackRep*
>(rep) ==
nullptr) {
122 Exception exc(
"SpacepointMeasurement default implementation can only handle state vectors of type RKTrackRep!", __LINE__,__FILE__);
130 void SpacepointMeasurement::initG() {
131 rawHitCov_.GetSub(0, 2, G_);
132 tools::invertMatrix(G_);
137 void SpacepointMeasurement::Streamer(TBuffer &R__b)
141 if (R__b.IsReading()) {
142 R__b.ReadClassBuffer(genfit::SpacepointMeasurement::Class(),
this);
144 if (weightedPlaneContruction_)
147 R__b.WriteClassBuffer(genfit::SpacepointMeasurement::Class(),
this);
HMatrix for projecting from AbsTrackRep parameters to measured parameters in a DetPlane.
Abstract base class for a track representation.
Exception class for error handling in GENFIT (provides storage for diagnostic information)
AbsHMatrix implementation for two-dimensional MeasurementOnPlane and RKTrackRep parameterization.
Measured coordinates on a plane.
AbsTrackRep with 5D track parameterization in plane coordinates: (q/p, u', v', u, v)
A state with arbitrary dimension defined in a DetPlane.
Defines for I/O streams used for error and debug printing.
std::shared_ptr< genfit::DetPlane > SharedPlanePtr
Shared Pointer to a DetPlane.