24 declareInterface<IResidualPullCalculator>(
this);
32 return StatusCode::SUCCESS;
46 if (!sctROT)
return std::nullopt;
47 if (!trkPar)
return std::nullopt;
50 bool pullIsValid = trkPar->covariance()!=
nullptr;
53 std::vector<double> residual(1);
54 std::vector<double> pull(1);
55 double sinAlpha = 0.0;
65 resType, pullIsValid);
70 resType, pullIsValid);
86 double cosAlpha = sqrt(1 - sinAlpha*sinAlpha);
91 trkPar->parameters()[
Trk::locX]) * cosAlpha
93 trkPar->parameters()[
Trk::locY]) * sinAlpha;
97 RotMat(0,0) = cosAlpha;
98 RotMat(0,1) = sinAlpha;
99 RotMat(1,0) = -sinAlpha;
100 RotMat(1,1) = cosAlpha;
104 if (trkPar->covariance()) {
109 RotMatTrk(0,0) = (*trkPar->covariance())(0,0);
110 RotMatTrk(0,1) = (*trkPar->covariance())(0,1);
111 RotMatTrk(1,0) = (*trkPar->covariance())(1,0);
112 RotMatTrk(1,1) = (*trkPar->covariance())(1,1);
114 Amg::MatrixX transformedTrkCov = RotMatTrk.similarity(RotMat);
117 transformedROTCov(0,0),
118 transformedTrkCov(0,0),
119 resType, pullIsValid);
122 transformedROTCov(0,0),
124 resType, pullIsValid);
131 return std::make_optional<Trk::ResidualPull>(std::move(residual),
132 std::move(pull), pullIsValid,
133 resType, 1, sinAlpha);
150 double sinAlpha = 0.0;
170 double cosAlpha = sqrt(1 - sinAlpha*sinAlpha);
175 trkPar->parameters()[
Trk::locX]) * cosAlpha
177 trkPar->parameters()[
Trk::locY]) * sinAlpha;
188 const double residual,
189 const double locMesCov,
190 const double locTrkCov,
192 bool& pullIsValid ) {
196 if ((locMesCov + locTrkCov) < 0.) {
200 ErrorSum = sqrt(locMesCov + locTrkCov);
202 if ((locMesCov - locTrkCov) < 0.) {
206 ErrorSum = sqrt(locMesCov - locTrkCov);
208 if (locMesCov < 0.) {
212 ErrorSum = sqrt(locMesCov);
215 return residual/ErrorSum;
double sinStereoLocal(const Amg::Vector2D &localPos) const
Angle of strip in local frame with respect to the etaAxis.
Specific class to represent the SCT measurements.
virtual const InDet::SCT_Cluster * prepRawData() const override final
returns the PrepRawData - is a SCT_Cluster in this scope
virtual const InDetDD::SiDetectorElement * detectorElement() const override final
returns the detector element, assoicated with the PRD of this class
virtual StatusCode initialize() override
initialize
static double calcPull(const double residual, const double locMesCov, const double locTrkCov, const Trk::ResidualPull::ResidualType &, bool &pullIsValid)
calc pull in 1 dimension
virtual std::array< double, 5 > residuals(const Trk::MeasurementBase *measurement, const Trk::TrackParameters *trkPar, const Trk::ResidualPull::ResidualType resType, const Trk::TrackState::MeasurementType) const override
This function is a light-weight version of the function above, designed for track fitters where speed...
SCT_ResidualPullCalculator(const std::string &type, const std::string &name, const IInterface *parent)
constructor
virtual std::optional< Trk::ResidualPull > residualPull(const Trk::MeasurementBase *measurement, const Trk::TrackParameters *trkPar, const Trk::ResidualPull::ResidualType resType, const Trk::TrackState::MeasurementType) const override
This function returns (creates!) a Trk::ResidualPull object, which contains the values of residual an...
virtual const InDetDD::SiDetectorElement * detectorElement() const override final
return the detector element corresponding to this PRD The pointer will be zero if the det el is not d...
int parameterKey() const
Identifier key for matrix expansion/reduction.
This class is the pure abstract base class for all fittable tracking measurements.
const LocalParameters & localParameters() const
Interface method to get the LocalParameters.
const Amg::MatrixX & localCovariance() const
Interface method to get the localError.
const Amg::Vector2D & localPosition() const
return the local position reference
@ Biased
RP with track state including the hit.
@ Unbiased
RP with track state that has measurement not included.
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > MatrixX
Dynamic Matrix - dynamic allocation.
Eigen::Matrix< double, 2, 1 > Vector2D
MeasurementType
enum describing the flavour of MeasurementBase
ParametersBase< TrackParametersDim, Charged > TrackParameters