18 return StatusCode::SUCCESS;
33 if (muonCompClusters) rot = muonCompClusters->
containedROTs().empty() ? nullptr : &muonCompClusters->
rioOnTrack(0);
35 if (!trkPar || !rot) {
36 if( !trkPar )
ATH_MSG_WARNING (
"No TrackParameters, cannot calculate residual/pull ");
44 double sinAlpha = 0.0;
53 <<
"LocalParameters structure!");
58 double v0=0.5*(covmat(0,0)+covmat(1,1)-sqrt((covmat(0,0)+covmat(1,1))*(covmat(0,0)+covmat(1,1))-
59 4*(covmat(0,0)*covmat(1,1)-covmat(0,1)*covmat(0,1))));
60 double v1=0.5*(covmat(0,0)+covmat(1,1)+sqrt((covmat(0,0)+covmat(1,1))*(covmat(0,0)+covmat(1,1))-
61 4*(covmat(0,0)*covmat(1,1)-covmat(0,1)*covmat(0,1))));
62 sinAlpha=std::sin(0.5*std::asin(2*covmat(0,1)/(v0-v1)));
64 double cosAlpha = std::sqrt(1 - sinAlpha*sinAlpha);
74 <<
"LocalParameters structure!" );
100 if (muonCompClusters) rot = muonCompClusters->
containedROTs().empty() ? nullptr :
103 if (!trkPar || !rot) {
104 if( !trkPar )
ATH_MSG_WARNING (
"No TrackParameters, cannot calculate residual/pull ");
105 if( !rot )
ATH_MSG_WARNING (
"No ROT, cannot calculate residual/pull ");
114 bool pullIsValid = (trkCov);
116 double sinAlpha = 0.0;
121 std::vector<double> residual(1);
122 std::vector<double> pull(1);
127 <<
"LocalParameters structure!");
132 double v0=0.5*(covmat(0,0)+covmat(1,1)-sqrt((covmat(0,0)+covmat(1,1))*(covmat(0,0)+covmat(1,1))-
133 4*(covmat(0,0)*covmat(1,1)-covmat(0,1)*covmat(0,1))));
134 double v1=0.5*(covmat(0,0)+covmat(1,1)+sqrt((covmat(0,0)+covmat(1,1))*(covmat(0,0)+covmat(1,1))-
135 4*(covmat(0,0)*covmat(1,1)-covmat(0,1)*covmat(0,1))));
136 sinAlpha=std::sin(0.5*std::asin(2*covmat(0,1)/(v0-v1)));
141 ATH_MSG_WARNING (
"Could not obtain TGC detEl from TGC ROT, this is a bug!" );
145 double cosAlpha = std::sqrt(1 - sinAlpha*sinAlpha);
154 RotMat(0,0) = cosAlpha;
155 RotMat(0,1) = sinAlpha;
156 RotMat(1,0) = -sinAlpha;
157 RotMat(1,1) = cosAlpha;
166 Amg::MatrixX transformedTrkCov = subm.similarity(RotMat);
169 transformedROTCov(0,0),
170 transformedTrkCov(0,0),
174 transformedROTCov(0,0),
182 <<
"LocalParameters structure!" );
204 return std::make_optional<Trk::ResidualPull>(std::move(residual), std::move(pull), pullIsValid, resType, 1, sinAlpha);
216 const double residual,
217 const double locMesCov,
218 const double locTrkCov,
220 if( locMesCov < 0 ) {
221 ATH_MSG_DEBUG(
"Bad error " << locMesCov <<
" " << locTrkCov <<
" using measured error ");
226 if( locMesCov + locTrkCov > 0 ) ErrorSum = std::sqrt(locMesCov + locTrkCov);
228 ATH_MSG_DEBUG(
"Bad error measurement " << locMesCov <<
" from track " << locTrkCov <<
", using measured error ");
229 ErrorSum = std::sqrt(locMesCov);
232 if ((locMesCov - locTrkCov) < 0.) {
235 ErrorSum = std::sqrt(locMesCov - locTrkCov);
236 }
else ErrorSum = std::sqrt(locMesCov);
237 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)
#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< std::unique_ptr< const MuonClusterOnTrack > > & containedROTs() const
returns the vector of SCT_ClusterOnTrack objects .
const MuonClusterOnTrack & rioOnTrack(unsigned int) const
returns the RIO_OnTrack (also known as ROT) objects depending on the integer
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
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