23 #include "WireMeasurement.h"
29 #include <Exception.h>
30 #include <RKTrackRep.h>
39 WireMeasurement::WireMeasurement(
int nDim)
40 : AbsMeasurement(nDim), maxDistance_(2), leftRight_(0)
45 WireMeasurement::WireMeasurement(
const TVectorD& rawHitCoords,
const TMatrixDSym& rawHitCov,
int detId,
int hitId, TrackPoint* trackPoint)
46 : AbsMeasurement(rawHitCoords, rawHitCov, detId, hitId, trackPoint), maxDistance_(2), leftRight_(0)
48 assert(rawHitCoords_.GetNrows() >= 7);
56 TVector3 wire1(rawHitCoords_(0), rawHitCoords_(1), rawHitCoords_(2));
57 TVector3 wire2(rawHitCoords_(3), rawHitCoords_(4), rawHitCoords_(5));
60 TVector3 wireDirection = wire2 - wire1;
61 wireDirection.SetMag(1.);
66 const TVector3& poca = rep->
getPos(st);
67 TVector3 dirInPoca = rep->
getMom(st);
69 const TVector3& pocaOnWire = wire1 + wireDirection.Dot(poca - wire1)*wireDirection;
72 if (fabs(wireDirection.Angle(dirInPoca)) < 0.01){
73 Exception exc(
"WireMeasurement::detPlane(): Cannot construct detector plane, direction is parallel to wire", __LINE__,__FILE__);
78 TVector3 U = dirInPoca.Cross(wireDirection);
85 std::vector<MeasurementOnPlane*> WireMeasurement::constructMeasurementsOnPlane(
const StateOnPlane& state)
const
87 double mR = rawHitCoords_(6);
89 double V = rawHitCov_(6,6);
93 state.getPlane(), state.getRep(), constructHMatrix(state.getRep()));
97 state.getPlane(), state.getRep(), constructHMatrix(state.getRep()));
100 if (leftRight_ < 0) {
104 else if (leftRight_ > 0) {
109 double val = 0.5 * pow(std::max(0., 1 - mR/maxDistance_), 2.);
110 mopL->setWeight(val);
111 mopR->setWeight(val);
114 std::vector<MeasurementOnPlane*> retVal;
115 retVal.push_back(mopL);
116 retVal.push_back(mopR);
121 if (
dynamic_cast<const RKTrackRep*
>(rep) ==
nullptr) {
122 Exception exc(
"WireMeasurement default implementation can only handle state vectors of type RKTrackRep!", __LINE__,__FILE__);
129 void WireMeasurement::setLeftRightResolution(
int lr) {
130 if (lr==0) leftRight_ = 0;
131 else if (lr<0) leftRight_ = -1;
HMatrix for projecting from AbsTrackRep parameters to measured parameters in a DetPlane.
Abstract base class for a track representation.
virtual double extrapolateToLine(StateOnPlane &state, const TVector3 &linePoint, const TVector3 &lineDirection, bool stopAtBoundary=false, bool calcJacobianNoise=false) const =0
Extrapolates the state to the POCA to a line, and returns the extrapolation length and,...
virtual TVector3 getMom(const StateOnPlane &state) const =0
Get the cartesian momentum vector of a state.
virtual TVector3 getPos(const StateOnPlane &state) const =0
Get the cartesian position of a state.
Exception class for error handling in GENFIT (provides storage for diagnostic information)
AbsHMatrix implementation for one-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.