16 declareInterface<IResidualPullCalculator>(
this);
25 return StatusCode::SUCCESS;
40 if (muonCompClusters) rot = muonCompClusters->
containedROTs().empty() ? nullptr :
43 if (!trkPar || !rot) {
44 if( !trkPar )
ATH_MSG_WARNING (
"No TrackParameters, cannot calculate residual/pull ");
52 double sinAlpha = 0.0;
61 <<
"LocalParameters structure!");
66 double v0=0.5*(covmat(0,0)+covmat(1,1)-sqrt((covmat(0,0)+covmat(1,1))*(covmat(0,0)+covmat(1,1))-
67 4*(covmat(0,0)*covmat(1,1)-covmat(0,1)*covmat(0,1))));
68 double v1=0.5*(covmat(0,0)+covmat(1,1)+sqrt((covmat(0,0)+covmat(1,1))*(covmat(0,0)+covmat(1,1))-
69 4*(covmat(0,0)*covmat(1,1)-covmat(0,1)*covmat(0,1))));
70 sinAlpha=std::sin(0.5*std::asin(2*covmat(0,1)/(v0-v1)));
72 double cosAlpha = std::sqrt(1 - sinAlpha*sinAlpha);
82 <<
"LocalParameters structure!" );
108 if (muonCompClusters) rot = muonCompClusters->
containedROTs().empty() ? nullptr :
111 if (!trkPar || !rot) {
112 if( !trkPar )
ATH_MSG_WARNING (
"No TrackParameters, cannot calculate residual/pull ");
113 if( !rot )
ATH_MSG_WARNING (
"No ROT, cannot calculate residual/pull ");
122 bool pullIsValid = (trkCov);
124 double sinAlpha = 0.0;
129 std::vector<double> residual(1);
130 std::vector<double> pull(1);
135 <<
"LocalParameters structure!");
140 double v0=0.5*(covmat(0,0)+covmat(1,1)-sqrt((covmat(0,0)+covmat(1,1))*(covmat(0,0)+covmat(1,1))-
141 4*(covmat(0,0)*covmat(1,1)-covmat(0,1)*covmat(0,1))));
142 double v1=0.5*(covmat(0,0)+covmat(1,1)+sqrt((covmat(0,0)+covmat(1,1))*(covmat(0,0)+covmat(1,1))-
143 4*(covmat(0,0)*covmat(1,1)-covmat(0,1)*covmat(0,1))));
144 sinAlpha=std::sin(0.5*std::asin(2*covmat(0,1)/(v0-v1)));
149 ATH_MSG_WARNING (
"Could not obtain TGC detEl from TGC ROT, this is a bug!" );
153 double cosAlpha = std::sqrt(1 - sinAlpha*sinAlpha);
162 RotMat(0,0) = cosAlpha;
163 RotMat(0,1) = sinAlpha;
164 RotMat(1,0) = -sinAlpha;
165 RotMat(1,1) = cosAlpha;
174 Amg::MatrixX transformedTrkCov = subm.similarity(RotMat);
177 transformedROTCov(0,0),
178 transformedTrkCov(0,0),
182 transformedROTCov(0,0),
190 <<
"LocalParameters structure!" );
212 return std::make_optional<Trk::ResidualPull>(std::move(residual), std::move(pull), pullIsValid, resType, 1, sinAlpha);
224 const double residual,
225 const double locMesCov,
226 const double locTrkCov,
228 if( locMesCov < 0 ) {
229 ATH_MSG_DEBUG(
"Bad error " << locMesCov <<
" " << locTrkCov <<
" using measured error ");
234 if( locMesCov + locTrkCov > 0 ) ErrorSum = std::sqrt(locMesCov + locTrkCov);
236 ATH_MSG_DEBUG(
"Bad error measurement " << locMesCov <<
" from track " << locTrkCov <<
", using measured error ");
237 ErrorSum = std::sqrt(locMesCov);
240 if ((locMesCov - locTrkCov) < 0.) {
243 ErrorSum = std::sqrt(locMesCov - locTrkCov);
244 }
else ErrorSum = std::sqrt(locMesCov);
245 if (ErrorSum != 0)
return residual/ErrorSum;
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
std::vector< Identifier > ID
#define AmgSymMatrix(dim)
A TgcReadoutElement corresponds to a single TGC chamber; therefore typically a TGC station contains s...
Class for competing MuonClusters, it extends the Trk::CompetingRIOsOnTrack base class.
const std::vector< const MuonClusterOnTrack * > & containedROTs() const
returns the vector of SCT_ClusterOnTrack objects .
virtual std::array< double, 5 > residuals(const Trk::MeasurementBase *measurement, const Trk::TrackParameters *trkPar, const Trk::ResidualPull::ResidualType, const Trk::TrackState::MeasurementType) const override
This function is a light-weight version of the function above, designed for track fitters where speed...
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
virtual StatusCode initialize() override
TGC_ResidualPullCalculator(const std::string &, const std::string &, const IInterface *)
virtual std::optional< Trk::ResidualPull > residualPull(const Trk::MeasurementBase *measurement, const Trk::TrackParameters *trkPar, const Trk::ResidualPull::ResidualType, const Trk::TrackState::MeasurementType) const override
This function returns (creates!) a Trk::ResidualPull object, which contains the values of residual an...
double calcPull(const double residual, const double locMesCov, const double locTrkCov, const Trk::ResidualPull::ResidualType &) const
internal structuring: common code for calculating hit pulls
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.
Class to handle RIO On Tracks ROT) for InDet and Muons, it inherits from the common MeasurementBase.
virtual const TrkDetElementBase * detectorElement() const =0
returns the detector element, assoicated with the PRD of this class
Identifier identify() const
return the identifier -extends MeasurementBase
@ 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.
MeasurementType
enum describing the flavour of MeasurementBase
ParametersBase< TrackParametersDim, Charged > TrackParameters