24 #include "WireMeasurementNew.h"
29 #include <Exception.h>
30 #include <RKTrackRep.h>
39 WireMeasurementNew::WireMeasurementNew()
40 : AbsMeasurement(1), maxDistance_(2), leftRight_(0)
42 memset(wireEndPoint1_, 0, 3*
sizeof(
double));
43 memset(wireEndPoint2_, 0, 3*
sizeof(
double));
46 WireMeasurementNew::WireMeasurementNew(
double driftDistance,
double driftDistanceError,
const TVector3& endPoint1,
const TVector3& endPoint2,
int detId,
int hitId, TrackPoint* trackPoint)
47 : AbsMeasurement(1), maxDistance_(2), leftRight_(0)
50 coords[0] = driftDistance;
51 this->setRawHitCoords(coords);
54 cov(0,0) = driftDistanceError*driftDistanceError;
55 this->setRawHitCov(cov);
57 this->setWireEndPoints(endPoint1, endPoint2);
59 this->setDetId(detId);
60 this->setHitId(hitId);
61 this->setTrackPoint(trackPoint);
69 TVector3 wire1(wireEndPoint1_);
70 TVector3 wire2(wireEndPoint2_);
73 TVector3 wireDirection = wire2 - wire1;
74 wireDirection.SetMag(1.);
79 const TVector3& poca = rep->
getPos(st);
80 TVector3 dirInPoca = rep->
getMom(st);
82 const TVector3& pocaOnWire = wire1 + wireDirection.Dot(poca - wire1)*wireDirection;
85 if (fabs(wireDirection.Angle(dirInPoca)) < 0.01){
86 Exception exc(
"WireMeasurementNew::detPlane(): Cannot construct detector plane, direction is parallel to wire", __LINE__,__FILE__);
91 TVector3 U = wireDirection.Cross(dirInPoca);
98 std::vector<MeasurementOnPlane*> WireMeasurementNew::constructMeasurementsOnPlane(
const StateOnPlane& state)
const
100 double mR = getRawHitCoords()(0);
105 state.getPlane(), state.getRep(), constructHMatrix(state.getRep()));
109 state.getPlane(), state.getRep(), constructHMatrix(state.getRep()));
112 if (leftRight_ < 0) {
116 else if (leftRight_ > 0) {
121 double val = 0.5 * pow(std::max(0., 1 - mR/maxDistance_), 2.);
122 mopL->setWeight(val);
123 mopR->setWeight(val);
126 std::vector<MeasurementOnPlane*> retVal;
127 retVal.push_back(mopL);
128 retVal.push_back(mopR);
133 if (
dynamic_cast<const RKTrackRep*
>(rep) ==
nullptr) {
134 Exception exc(
"WireMeasurementNew default implementation can only handle state vectors of type RKTrackRep!", __LINE__,__FILE__);
141 void WireMeasurementNew::setWireEndPoints(
const TVector3& endPoint1,
const TVector3& endPoint2)
143 wireEndPoint1_[0] = endPoint1.X();
144 wireEndPoint1_[1] = endPoint1.Y();
145 wireEndPoint1_[2] = endPoint1.Z();
147 wireEndPoint2_[0] = endPoint2.X();
148 wireEndPoint2_[1] = endPoint2.Y();
149 wireEndPoint2_[2] = endPoint2.Z();
152 void WireMeasurementNew::setLeftRightResolution(
int lr){
153 if (lr==0) leftRight_ = 0;
154 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.