20#include "GaudiKernel/ServiceHandle.h"
21#include "GaudiKernel/SystemOfUnits.h"
38 declareInterface<IMuidMuonRecovery>(
this);
63 return StatusCode::SUCCESS;
70 return StatusCode::SUCCESS;
73 const EventContext& ctx)
const {
83 <<
" ID track " <<
m_printer->print(indetTrack) << std::endl
84 <<
" MS track " <<
m_printer->print(spectrometerTrack) << std::endl
85 <<
m_printer->printStations(spectrometerTrack));
90 while (!lastIndetPars &&
index > 0) {
101 std::unique_ptr<Trk::TrackParameters> innerParameters, middleParameters, outerParameters;
102 std::unique_ptr<Trk::TrackParameters> lastPars = lastIndetPars->
uniqueClone();
103 bool innerParsSet{
false};
105 std::vector<const Trk::TrackStateOnSurface*> stations;
106 std::set<Muon::MuonStationIndex::StIndex> etaIndices, phiIndices, badEtaIndices, badPhiIndices;
108 unsigned int nmeas = 0;
117 if (!
id.is_valid())
continue;
124 if (phiIndices.count(
index))
continue;
126 phiIndices.insert(
index);
128 if (etaIndices.count(
index))
continue;
131 etaIndices.insert(
index);
136 std::unique_ptr<Trk::TrackParameters> exPars{};
139 exPars = std::move(lastPars);
155 badPhiIndices.insert(
index);
157 badEtaIndices.insert(
index);
189 if (!innerParsSet && !innerParameters && exPars && lastPars) {
190 innerParameters = std::move(exPars);
191 }
else if (exPars && innerParameters && !middleParameters ) {
192 middleParameters = std::move(exPars);
194 lastPars = std::move(exPars);
199 if (middleParameters) {
200 outerParameters = std::move(lastPars);
202 middleParameters = std::move(innerParameters);
203 if (!middleParameters) {
209 bool cleanEta = badEtaIndices.size() == 1 && etaIndices.size() > 1;
210 bool cleanPhi = badPhiIndices.size() == 1;
212 if (!cleanPhi && !cleanEta) {
217 if (badEtaIndices.size() == etaIndices.size()) {
229 if (!
id.is_valid())
continue;
233 if (cleanEta && !measuresPhi && badEtaIndices.count(
index))
continue;
234 if (cleanPhi && measuresPhi && badPhiIndices.count(
index))
continue;
235 spectrometerMeasurements.push_back(meas);
238 ATH_MSG_DEBUG(
"Number of measurements before cleaning " << nmeas <<
" after cleaning " << spectrometerMeasurements.size());
240 if (spectrometerMeasurements.size() < 6) {
246 std::unique_ptr<Trk::Track> combinedTrack;
248 combinedTrack =
m_trackBuilder->indetExtension(ctx, indetTrack, spectrometerMeasurements, std::move(innerParameters), std::move(middleParameters),
249 std::move(outerParameters));
256 <<
m_printer->print(*combinedTrack) << std::endl
257 <<
m_printer->printStations(*combinedTrack));
262 return combinedTrack;
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_WARNING(x)
std::pair< std::vector< unsigned int >, bool > res
bool msgLvl(const MSG::Level lvl) const
Base class for the XxxReadoutElement, with Xxx = Mdt, Rpc, Tgc, Csc.
Class to represent the calibrated clusters created from CSC strips.
virtual const MuonGM::CscReadoutElement * detectorElement() const override final
Returns the detector element, associated with the PRD of this class.
This class represents the corrected MDT measurements, where the corrections include the effects of wi...
virtual const MuonGM::MdtReadoutElement * detectorElement() const override final
Returns the detector element, assoicated with the PRD of this class.
StatusCode initialize() override
PublicToolHandle< Muon::MuonEDMPrinterTool > m_printer
MuidMuonRecovery(const std::string &type, const std::string &name, const IInterface *parent)
ToolHandle< ICombinedMuonTrackBuilder > m_trackBuilder
StatusCode finalize() override
std::unique_ptr< Trk::Track > recoverableMatch(const Trk::Track &indetTrack, const Trk::Track &spectrometerTrack, const EventContext &ctx) const override
IMuidMuonRecovery interface: algorithmic code for recovering muon spectrometer using the inner detect...
std::atomic< unsigned int > m_recoveryAttempts
ToolHandle< Trk::IExtrapolator > m_extrapolator
Gaudi::Property< double > m_minP
ToolHandle< Trk::IResidualPullCalculator > m_residualCalculator
ServiceHandle< Muon::IMuonEDMHelperSvc > m_edmHelperSvc
Gaudi::Property< double > m_minPt
std::atomic< unsigned int > m_recoveryFitFailure
std::atomic< unsigned int > m_recoverySuccess
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
Gaudi::Property< double > m_pullCut
represents the three-dimensional global direction with respect to a planar surface frame.
double angleXZ() const
access method for angle of local XZ projection
double angleYZ() const
access method for angle of local YZ projection
This class is the pure abstract base class for all fittable tracking measurements.
virtual const Surface & associatedSurface() const =0
Interface method to get the associated Surface.
const Amg::Vector3D & momentum() const
Access method for the momentum.
std::unique_ptr< ParametersBase< DIM, T > > uniqueClone() const
clone method for polymorphic deep copy returning unique_ptr; it is not overriden, but uses the existi...
Class for a planaer rectangular or trapezoidal surface in the ATLAS detector.
void globalToLocalDirection(const Amg::Vector3D &glodir, Trk::LocalDirection &locdir) const
This method transforms the global direction to a local direction wrt the plane.
@ Unbiased
RP with track state that has measurement not included.
@ MuidMuonRecoveryTool
Muons found by the ID seeded muon recovery.
represents the track state (measurement, material, fit parameters and quality) at a surface.
@ Outlier
This TSoS contains an outlier, that is, it contains a MeasurementBase/RIO_OnTrack which was not used ...
const Trk::TrackStates * trackStateOnSurfaces() const
return a pointer to a const DataVector of const TrackStateOnSurfaces.
const DataVector< const TrackParameters > * trackParameters() const
Return a pointer to a vector of TrackParameters.
const Perigee * perigeeParameters() const
return Perigee.
virtual const Surface & surface() const =0
Return surface associated with this detector element.
StIndex
enum to classify the different station layers in the muon spectrometer
std::vector< const MeasurementBase * > MeasurementSet
vector of fittable measurements
ParametersBase< TrackParametersDim, Charged > TrackParameters