ATLAS Offline Software
MuonTrackSteering.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef MUONTRACKSTEERING_H
6 #define MUONTRACKSTEERING_H
7 
8 #include <mutex>
9 #include <set>
10 #include <utility>
11 
12 
14 #include "GaudiKernel/ServiceHandle.h"
15 #include "GaudiKernel/StatEntity.h"
16 #include "GaudiKernel/ToolHandle.h"
17 #include "Identifier/Identifier.h"
19 #include "MooTrackBuilder.h"
20 #include "MuPatCandidateTool.h"
30 #include "MuonTrackSelectorTool.h"
35 #include "TrkTrack/Track.h"
38 namespace Muon {
39  class MuPatTrack;
40 } // namespace Muon
41 
42 namespace Muon {
43 
44  typedef std::vector<const Muon::MuonSegment*> MuonSegmentCollection;
45 
51  class MuonTrackSteering : virtual public IMuonTrackFinder, public AthAlgTool {
52  public:
53  typedef std::vector<MuPatTrack*> TrkVec;
54  typedef std::vector<Trk::Track*> TrkCollVec;
55  typedef std::vector<MuPatSegment*> SegCol;
57  typedef std::vector<SegCol> SegColVec;
59  typedef SegColVec::const_iterator SegColVecCit;
60 
61  typedef std::set<MuonStationIndex::ChIndex> ChSet;
63  typedef ChSet::const_iterator ChCit;
64 
65  typedef std::set<MuonStationIndex::StIndex> StSet;
67  typedef StSet::const_iterator StCit;
68 
69  public:
71  MuonTrackSteering(const std::string&, const std::string&, const IInterface*);
72 
74  virtual ~MuonTrackSteering() = default;
75 
77  virtual StatusCode initialize() override;
78 
83  std::unique_ptr<TrackCollection> find(const EventContext& ctx, const MuonSegmentCollection& coll) const override;
84 
85  private:
87  void push_back(std::unique_ptr<MuonSegment> seg) {seg_garbage.push_back(std::move(seg));}
88  void push_back(std::unique_ptr<MuPatSegment> seg) {pat_garbage.push_back(std::move(seg));}
89  void reserve(size_t N) {
90  pat_garbage.reserve(N);
91  seg_garbage.reserve(N);
92  }
93  std::vector<std::unique_ptr<MuPatSegment>> pat_garbage{};
94  std::vector<std::unique_ptr<MuonSegment>> seg_garbage{};
95  };
96  std::unique_ptr<TrackCollection> selectTracks(std::vector<std::unique_ptr<MuPatTrack>>& candidates, bool takeOwnership = true) const;
97 
99  std::unique_ptr<TrackCollection> findTracks(const EventContext& ctx, SegColVec& chamberSegments, SegColVec& stationSegments) const;
100  bool extractSegments(const EventContext& ctx, const MuonSegmentCollection& coll, SegColVec& chamberSegments, SegColVec& stationSegments,
101  ChSet& chambersWithSegments, StSet& stationsWithSegments, GarbageContainer& trash_bin) const;
102 
103  StatusCode decodeStrategyVector(const std::vector<std::string>& strategy);
104  std::unique_ptr<const MuonTrackSteeringStrategy> decodeStrategy(const std::string& strategy) const;
105  static bool decodeList(const std::string& input, std::vector<std::string>& list) ;
106 
107  std::vector<std::unique_ptr<MuPatTrack>> extendWithLayer(const EventContext& ctx, MuPatTrack& candidate, const SegColVec& segcol, unsigned int nextlayer,
108  const unsigned int endlayer, int cutLevel = 0) const;
114  std::vector<std::unique_ptr<MuPatTrack>> findTrackFromSeed(const EventContext& ctx, MuPatSegment& seedSeg, const MuonTrackSteeringStrategy& strat,
115  const unsigned int layer, const SegColVec& segs) const;
116 
117  void refineTracks(const EventContext& ctx, std::vector<std::unique_ptr<MuPatTrack>>& candidates) const;
118 
124  void solveAmbiguities(std::vector<std::unique_ptr<MuPatTrack>>& tracks, const MuonTrackSteeringStrategy* strat = nullptr) const;
125 
126  void combineOverlapSegments(const EventContext& ctx, std::vector<MuPatSegment*>& ch1, std::vector<MuPatSegment*>& ch2, SegColVec& stationSegments,
127  StSet& stationsWithSegments, GarbageContainer& trash_bin) const;
128 
129  private:
130  ServiceHandle<IMuonEDMHelperSvc> m_edmHelperSvc{this, "edmHelper", "Muon::MuonEDMHelperSvc/MuonEDMHelperSvc",
131  "Handle to the service providing the IMuonEDMHelperSvc interface"};
132  PublicToolHandle<MuonEDMPrinterTool> m_printer{this, "MuonPrinterTool", "Muon::MuonEDMPrinterTool/MuonEDMPrinterTool"};
133  ToolHandle<MuPatCandidateTool> m_candidateTool{this, "MuPatCandidateTool", "Muon::MuPatCandidateTool/MuPatCandidateTool"};
134  ToolHandle<IMuonTrackBuilder> m_trackBTool{this, "TrackBuilderTool", "Muon::MooTrackBuilder/MooMuonTrackBuilder"};
135  ToolHandle<Trk::ITrackAmbiguityProcessorTool> m_ambiTool{this, "AmbiguityTool",
136  "Trk::TrackSelectionProcessorTool/MuonAmbiProcessor"};
137  ToolHandle<MooTrackBuilder> m_mooBTool{this, "MooBuilderTool", "Muon::MooTrackBuilder/MooMuonTrackBuilder"};
138  ToolHandle<MooCandidateMatchingTool> m_candidateMatchingTool{this, "CandidateMatchingTool",
139  "Muon::MooCandidateMatchingTool/MooCandidateMatchingTool"};
140  ToolHandle<IMuonTrackRefiner> m_trackRefineTool{this, "TrackRefinementTool", "Muon::MooTrackBuilder/MooMuonTrackBuilder"};
141  ToolHandle<IMuonSegmentFittingTool> m_segmentFitter{this, "MuonSegmentFittingTool",
142  "Muon::MuonSegmentFittingTool/MuonSegmentFittingTool"};
143  ToolHandle<Muon::MuonTrackSelectorTool> m_trackSelector{this, "MuonTrackSelector",
144  "Muon::MuonTrackSelectorTool/MuonTrackSelectorTool"};
145  ToolHandle<IMuonHoleRecoveryTool> m_muonHoleRecoverTool{this, "HoleRecoveryTool",
146  "Muon::MuonChamberHoleRecoveryTool/MuonChamberHoleRecoveryTool"};
147  ToolHandle<Trk::IExtendedTrackSummaryTool> m_trackSummaryTool{this, "TrackSummaryTool", "MuonTrackSummaryTool"};
148 
149  std::vector<std::unique_ptr<const MuonTrackSteeringStrategy>> m_strategies;
150  std::vector<std::string> m_stringStrategies;
151 
152  std::array<int, 3> m_segQCut{};
159  };
160 
161 } // namespace Muon
162 
163 #endif
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
xAOD::strategy
strategy
Definition: L2CombinedMuon_v1.cxx:107
Muon::MuonTrackSteering::m_segQCut
std::array< int, 3 > m_segQCut
Required segment quality for seed, 2nd, and other segments.
Definition: MuonTrackSteering.h:152
Muon::MuonTrackSteering::ChCit
ChSet::const_iterator ChCit
Definition: MuonTrackSteering.h:63
Muon::MuonTrackSteering::GarbageContainer::push_back
void push_back(std::unique_ptr< MuonSegment > seg)
Definition: MuonTrackSteering.h:87
Muon::MuonTrackSteering::SegCol
std::vector< MuPatSegment * > SegCol
Definition: MuonTrackSteering.h:55
Muon::MuonTrackSteering::decodeList
static bool decodeList(const std::string &input, std::vector< std::string > &list)
Definition: MuonTrackSteering.cxx:812
TrackParameters.h
MuPatCandidateTool.h
MuonTrackSummary.h
MuonEDMPrinterTool.h
Muon::MuonTrackSteering::refineTracks
void refineTracks(const EventContext &ctx, std::vector< std::unique_ptr< MuPatTrack >> &candidates) const
Definition: MuonTrackSteering.cxx:665
Muon::MuonTrackSteering::decodeStrategy
std::unique_ptr< const MuonTrackSteeringStrategy > decodeStrategy(const std::string &strategy) const
Definition: MuonTrackSteering.cxx:719
Muon::MuonTrackSteering::SegColVecCit
SegColVec::const_iterator SegColVecCit
Definition: MuonTrackSteering.h:59
drawFromPickle.candidates
candidates
Definition: drawFromPickle.py:271
IMuonTrackBuilder.h
Muon::MuonTrackSteering::GarbageContainer::seg_garbage
std::vector< std::unique_ptr< MuonSegment > > seg_garbage
Definition: MuonTrackSteering.h:94
Muon::MuonTrackSteering::GarbageContainer::reserve
void reserve(size_t N)
Definition: MuonTrackSteering.h:89
Muon::MuonTrackSteering::m_printer
PublicToolHandle< MuonEDMPrinterTool > m_printer
Definition: MuonTrackSteering.h:132
Muon::MuonTrackSteering::MuonTrackSteering
MuonTrackSteering(const std::string &, const std::string &, const IInterface *)
default AlgTool constructor
Definition: MuonTrackSteering.cxx:50
JetTiledMap::N
@ N
Definition: TiledEtaPhiMap.h:44
Muon::MuonTrackSteering::m_useTightMatching
bool m_useTightMatching
Definition: MuonTrackSteering.h:156
Muon
This class provides conversion from CSC RDO data to CSC Digits.
Definition: TrackSystemController.h:45
Muon::MuonTrackSteering::~MuonTrackSteering
virtual ~MuonTrackSteering()=default
destructor
MuPatSegment.h
Muon::MuonTrackSteering::m_trackSummaryTool
ToolHandle< Trk::IExtendedTrackSummaryTool > m_trackSummaryTool
Definition: MuonTrackSteering.h:147
Muon::MuonTrackSteering::m_outputSingleStationTracks
bool m_outputSingleStationTracks
Definition: MuonTrackSteering.h:153
ITrackAmbiguityProcessorTool.h
IMuonTrackFinder.h
Muon::MuonTrackSteering::m_combinedSLOverlaps
bool m_combinedSLOverlaps
Definition: MuonTrackSteering.h:154
Track.h
IMuonSegmentFittingTool.h
Muon::MuonTrackSteering::SegColIt
std::vector< MuPatSegment * >::iterator SegColIt
Definition: MuonTrackSteering.h:56
Muon::MuonTrackSteering::ChIt
ChSet::iterator ChIt
Definition: MuonTrackSteering.h:62
Muon::MuonTrackSteering::StCit
StSet::const_iterator StCit
Definition: MuonTrackSteering.h:67
IMuonSegmentInOverlapResolvingTool.h
Muon::MuonTrackSteering::extendWithLayer
std::vector< std::unique_ptr< MuPatTrack > > extendWithLayer(const EventContext &ctx, MuPatTrack &candidate, const SegColVec &segcol, unsigned int nextlayer, const unsigned int endlayer, int cutLevel=0) const
Definition: MuonTrackSteering.cxx:617
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
Muon::MuonTrackSteering::TrkCollVec
std::vector< Trk::Track * > TrkCollVec
Definition: MuonTrackSteering.h:54
TRT::Hit::layer
@ layer
Definition: HitInfo.h:79
Muon::MuonTrackSteering::SegColVecIt
SegColVec::iterator SegColVecIt
Definition: MuonTrackSteering.h:58
PlotPulseshapeFromCool.input
input
Definition: PlotPulseshapeFromCool.py:106
AthAlgTool.h
TrackCollection.h
Muon::MuonTrackSteering::m_trackSelector
ToolHandle< Muon::MuonTrackSelectorTool > m_trackSelector
Definition: MuonTrackSteering.h:143
Muon::MuonTrackSteering::StSet
std::set< MuonStationIndex::StIndex > StSet
Definition: MuonTrackSteering.h:65
Muon::MuonTrackSteering::m_strategies
std::vector< std::unique_ptr< const MuonTrackSteeringStrategy > > m_strategies
Definition: MuonTrackSteering.h:149
Muon::MuonTrackSteering::m_edmHelperSvc
ServiceHandle< IMuonEDMHelperSvc > m_edmHelperSvc
Definition: MuonTrackSteering.h:130
histSizes.list
def list(name, path='/')
Definition: histSizes.py:38
Muon::MuonTrackSteering::ChSet
std::set< MuonStationIndex::ChIndex > ChSet
Definition: MuonTrackSteering.h:61
Muon::MuonTrackSteering::SegColVec
std::vector< SegCol > SegColVec
Definition: MuonTrackSteering.h:57
Muon::MuonTrackSteering::findTracks
std::unique_ptr< TrackCollection > findTracks(const EventContext &ctx, SegColVec &chamberSegments, SegColVec &stationSegments) const
actual find method
Definition: MuonTrackSteering.cxx:312
Muon::MuonTrackSteering::m_segmentFitter
ToolHandle< IMuonSegmentFittingTool > m_segmentFitter
Definition: MuonTrackSteering.h:141
Muon::MuonTrackSteering
Implementation of an IMuonTrackFinder.
Definition: MuonTrackSteering.h:51
Muon::MuonTrackSteering::GarbageContainer
Definition: MuonTrackSteering.h:86
Muon::MuonTrackSteering::extractSegments
bool extractSegments(const EventContext &ctx, const MuonSegmentCollection &coll, SegColVec &chamberSegments, SegColVec &stationSegments, ChSet &chambersWithSegments, StSet &stationsWithSegments, GarbageContainer &trash_bin) const
Definition: MuonTrackSteering.cxx:103
MooTrackBuilder.h
Muon::MuonTrackSteering::initialize
virtual StatusCode initialize() override
initialize method, method taken from bass-class AlgTool
Definition: MuonTrackSteering.cxx:65
Muon::MuonTrackSteering::m_trackRefineTool
ToolHandle< IMuonTrackRefiner > m_trackRefineTool
Definition: MuonTrackSteering.h:140
Muon::MuonTrackSteering::m_muonHoleRecoverTool
ToolHandle< IMuonHoleRecoveryTool > m_muonHoleRecoverTool
Definition: MuonTrackSteering.h:145
MuonTrackSelectorTool.h
IMuonEDMHelperSvc.h
Muon::MuonTrackSteering::decodeStrategyVector
StatusCode decodeStrategyVector(const std::vector< std::string > &strategy)
Definition: MuonTrackSteering.cxx:702
Muon::MuonTrackSteering::m_mooBTool
ToolHandle< MooTrackBuilder > m_mooBTool
Definition: MuonTrackSteering.h:137
Muon::MuonTrackSteering::m_candidateTool
ToolHandle< MuPatCandidateTool > m_candidateTool
Definition: MuonTrackSteering.h:133
Muon::MuonTrackSteering::selectTracks
std::unique_ptr< TrackCollection > selectTracks(std::vector< std::unique_ptr< MuPatTrack >> &candidates, bool takeOwnership=true) const
Definition: MuonTrackSteering.cxx:645
Muon::MuonTrackSteering::m_candidateMatchingTool
ToolHandle< MooCandidateMatchingTool > m_candidateMatchingTool
Definition: MuonTrackSteering.h:138
Muon::MuonTrackSteeringStrategy
Definition: MuonTrackSteeringStrategy.h:17
Muon::MuonTrackSteering::m_segThreshold
int m_segThreshold
Definition: MuonTrackSteering.h:158
Muon::MuonTrackSteering::solveAmbiguities
void solveAmbiguities(std::vector< std::unique_ptr< MuPatTrack >> &tracks, const MuonTrackSteeringStrategy *strat=nullptr) const
Resolve ambiguities among tracks for a single strategy This allows a strategy-specific ambiguity solv...
Definition: MuonTrackSteering.cxx:671
Muon::MuPatSegment
segment candidate object.
Definition: MuPatSegment.h:43
Muon::MuonTrackSteering::m_doSummary
bool m_doSummary
Definition: MuonTrackSteering.h:155
MuonTrackSteeringStrategy.h
Muon::MuonTrackSteering::m_onlyMDTSeeding
bool m_onlyMDTSeeding
Definition: MuonTrackSteering.h:157
Muon::MuonTrackSteering::GarbageContainer::push_back
void push_back(std::unique_ptr< MuPatSegment > seg)
Definition: MuonTrackSteering.h:88
IExtendedTrackSummaryTool.h
Muon::MuonTrackSteering::GarbageContainer::pat_garbage
std::vector< std::unique_ptr< MuPatSegment > > pat_garbage
Definition: MuonTrackSteering.h:93
Muon::MuPatTrack
track candidate object.
Definition: MuPatTrack.h:37
MooCandidateMatchingTool.h
Muon::MuonTrackSteering::find
std::unique_ptr< TrackCollection > find(const EventContext &ctx, const MuonSegmentCollection &coll) const override
find tracks starting from a MuonSegmentCollection
Definition: MuonTrackSteering.cxx:85
Muon::MuonTrackSteering::TrkVec
std::vector< MuPatTrack * > TrkVec
Definition: MuonTrackSteering.h:53
Muon::MuonTrackSteering::findTrackFromSeed
std::vector< std::unique_ptr< MuPatTrack > > findTrackFromSeed(const EventContext &ctx, MuPatSegment &seedSeg, const MuonTrackSteeringStrategy &strat, const unsigned int layer, const SegColVec &segs) const
Find tracks starting from a good segment.
Definition: MuonTrackSteering.cxx:539
Muon::MuonTrackSteering::m_stringStrategies
std::vector< std::string > m_stringStrategies
Definition: MuonTrackSteering.h:150
Muon::MuonTrackSteering::combineOverlapSegments
void combineOverlapSegments(const EventContext &ctx, std::vector< MuPatSegment * > &ch1, std::vector< MuPatSegment * > &ch2, SegColVec &stationSegments, StSet &stationsWithSegments, GarbageContainer &trash_bin) const
Definition: MuonTrackSteering.cxx:161
Muon::MuonSegmentCollection
std::vector< const Muon::MuonSegment * > MuonSegmentCollection
Definition: MuonTrackSteering.h:44
IMuonHoleRecoveryTool.h
MuonStationIndex.h
AthAlgTool
Definition: AthAlgTool.h:26
Muon::MuonTrackSteering::m_trackBTool
ToolHandle< IMuonTrackBuilder > m_trackBTool
Definition: MuonTrackSteering.h:134
Muon::IMuonTrackFinder
The IMuonTrackFinder is a pure virtual interface for tools to find track in the muon system starting ...
Definition: IMuonTrackFinder.h:27
Muon::MuonTrackSteering::m_ambiTool
ToolHandle< Trk::ITrackAmbiguityProcessorTool > m_ambiTool
Definition: MuonTrackSteering.h:135
Muon::MuonTrackSteering::StIt
StSet::iterator StIt
Definition: MuonTrackSteering.h:66
ServiceHandle
Definition: ClusterMakerTool.h:37