ATLAS Offline Software
MooTrackBuilder.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 MUON_MOOTRACKBUILDER_H
6 #define MUON_MOOTRACKBUILDER_H
7 
9 #include "GaudiKernel/ServiceHandle.h"
10 #include "GaudiKernel/ToolHandle.h"
11 
12 // Tools & interfaces
28 
29 // For magneticfield
33 
34 // Tracking EDM
38 #include "TrkTrack/Track.h"
40 
41 // Local
43 #include "MooTrackFitter.h"
44 #include "MuPatCandidateTool.h"
45 
46 // Misc
47 #include <vector>
48 
49 class MsgStream;
50 
51 namespace Trk {
52  class Track;
53  class PrepRawData;
54  class IExtendedTrackSummaryTool;
55 } // namespace Trk
56 
57 namespace Muon {
58  class MuonSegment;
59  class MuPatCandidateBase;
60  class MuPatTrack;
61  class MuPatSegment;
62 } // namespace Muon
63 
64 namespace Muon {
65 
83 
84 
85  public:
87  MooTrackBuilder(const std::string&, const std::string&, const IInterface*);
88 
90  ~MooTrackBuilder() = default;
91 
93  virtual StatusCode initialize() override;
94 
96  virtual StatusCode finalize() override;
97 
99  static const InterfaceID& interfaceID() {
100  static const InterfaceID IID_MooTrackBuilder("Muon::MooTrackBuilder", 1, 0);
101  return IID_MooTrackBuilder;
102  }
103 
108  virtual std::unique_ptr<Trk::Track> refit(const EventContext& ctx, Trk::Track& track) const override;
109  private:
116  std::unique_ptr<Trk::Track> combine(const EventContext& ctx, const MuPatCandidateBase& firstEntry, const MuPatCandidateBase& secondEntry,
117  const PrepVec& patternPhiHits) const;
118 
120  public:
127  std::unique_ptr<MuonSegment> combineToSegment(const EventContext& ctx, const MuPatCandidateBase& firstEntry, const MuPatCandidateBase& secondEntry,
128  const PrepVec& patternPhiHits) const;
129 
136  virtual std::unique_ptr<MuonSegment> combineToSegment(const EventContext& ctx, const MuonSegment& seg1, const MuonSegment& seg2,
137  const PrepVec& patternPhiHits) const override;
138 
145  virtual std::unique_ptr<Trk::Track> combine(const EventContext& ctx, const MuonSegment& seg1, const MuonSegment& seg2,
146  const PrepVec& patternPhiHits) const override;
147 
154  virtual std::unique_ptr<Trk::Track> combine(const EventContext& ctx, const Trk::Track& track, const MuonSegment& seg,
155  const PrepVec& patternPhiHits) const override;
156 
162  private:
163  std::vector<std::unique_ptr<Trk::Track> > combineWithSegmentFinding(const EventContext& ctx, const Trk::Track& track, const MuonSegment& seg,
164  const PrepVec& patternPhiHits) const;
165 
171  std::vector<std::unique_ptr<Trk::Track> > combineWithSegmentFinding(const EventContext& ctx, const MuPatTrack& candidate,
172  const MuPatSegment& segInfo, const PrepVec& patternPhiHits) const;
173 
180  std::vector<std::unique_ptr<Trk::Track> > combineWithSegmentFinding(const EventContext& ctx, const MuPatTrack& candidate, const Trk::TrackParameters& pars,
181  const std::set<Identifier>& chIds, const PrepVec& patternPhiHits) const;
188  std::vector<std::unique_ptr<Trk::Track> > combineWithSegmentFinding(const EventContext& ctx, const Trk::Track& track, const Trk::TrackParameters& pars,
189  const std::set<Identifier>& chIds,
190  const PrepVec& patternPhiHits) const;
191  public:
198  virtual std::unique_ptr<Trk::TrackParameters> findClosestParameters(const Trk::Track& track, const Amg::Vector3D& pos) const override;
199 
205  virtual std::unique_ptr<Trk::TrackParameters> getClosestParameters(const Trk::Track& track, const Trk::Surface& surf) const override;
206 
212  std::unique_ptr<Trk::TrackParameters> getClosestParameters(const MuPatCandidateBase& candidate, const Trk::Surface& surf) const;
213 
215  virtual std::unique_ptr<Trk::Track> recalibrateHitsOnTrack(const EventContext& ctx, const Trk::Track& track, bool doMdts,
216  bool doCompetingClusters) const override;
217 
218  private:
222  std::pair<std::unique_ptr<Trk::Track>, std::unique_ptr<Trk::Track> > splitTrack(const EventContext& ctx, const Trk::Track& track) const;
223 
225  bool isSplitTrack(const EventContext& ctx, const Trk::Track& track1, const Trk::Track& track2) const;
226 
228  TrackCollection* mergeSplitTracks(const EventContext& ctx, const TrackCollection& tracks) const;
229 
237  public:
238  virtual std::vector<std::unique_ptr<MuPatTrack> > find(const EventContext& ctx, MuPatCandidateBase& candidate, const std::vector<MuPatSegment*>& segments) const override;
239 
244  virtual void refine(const EventContext& ctx, MuPatTrack& track) const override;
245 
246  private:
247  void removeDuplicateWithReference(std::unique_ptr<Trk::SegmentCollection>& segments,
248  std::vector<const MuonSegment*>& referenceSegments) const;
249 
253  std::vector<std::unique_ptr<const Trk::TrackStateOnSurface>>& states) const;
254 
255  ToolHandle<MooTrackFitter> m_fitter{this, "Fitter", "Muon::MooTrackFitter/MooTrackFitter", "Tool to fit segments to tracks"};
256  ToolHandle<MooTrackFitter> m_slFitter{this, "SLFitter", "Muon::MooTrackFitter/MooSLTrackFitter", "Tool to fit segments to tracks"};
257  ToolHandle<MuPatCandidateTool> m_candidateHandler{this, "CandidateTool",
258  "Muon::MuPatCandidateTool/MuPatCandidateTool"};
259  ToolHandle<MooCandidateMatchingTool> m_candidateMatchingTool{this, "CandidateMatchingTool",
260  "Muon::MooCandidateMatchingTool/MooCandidateMatchingTool"};
261  ToolHandle<IMuonTrackToSegmentTool> m_trackToSegmentTool{this, "TrackToSegmentTool",
262  "Muon::MuonTrackToSegmentTool/MuonTrackToSegmentTool"};
263  ServiceHandle<IMuonEDMHelperSvc> m_edmHelperSvc{this, "edmHelper", "Muon::MuonEDMHelperSvc/MuonEDMHelperSvc",
264  "Handle to the service providing the IMuonEDMHelperSvc interface"};
265  PublicToolHandle<MuonEDMPrinterTool> m_printer{this, "Printer",
266  "Muon::MuonEDMPrinterTool/MuonEDMPrinterTool"};
267  ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc{this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"};
268  ToolHandle<IMuonSeededSegmentFinder> m_seededSegmentFinder{this, "SeededSegmentFinder",
269  "Muon::MuonSeededSegmentFinder/MuonSeededSegmentFinder"};
270  ToolHandle<IMdtDriftCircleOnTrackCreator> m_mdtRotCreator{this, "MdtRotCreator",
271  "Muon::MdtDriftCircleOnTrackCreator/MdtDriftCircleOnTrackCreator"};
272  ToolHandle<IMuonCompetingClustersOnTrackCreator> m_compRotCreator{
273  this, "CompetingClustersCreator", "Muon::TriggerChamberClusterOnTrackCreator/TriggerChamberClusterOnTrackCreator"};
274  ToolHandle<Trk::IPropagator> m_propagator{this, "Propagator", "Trk::STEP_Propagator/MuonPropagator"};
275  ToolHandle<Trk::IResidualPullCalculator> m_pullCalculator{this, "PullCalculator",
276  "Trk::ResidualPullCalculator/ResidualPullCalculator"};
277  ToolHandle<IMuonHoleRecoveryTool> m_muonChamberHoleRecoverTool{
278  this, "ChamberHoleRecoveryTool",
279  "Muon::MuonChamberHoleRecoveryTool/MuonChamberHoleRecoveryTool"}; //<! tool to add holes on track
280  ToolHandle<IMuonTrackExtrapolationTool> m_trackExtrapolationTool{
281  this, "Extrapolator", "Muon::MuonTrackExtrapolationTool/MuonTrackExtrapolationTool"}; //<! track extrapolation tool
282 
283  ToolHandle<IMuonErrorOptimisationTool> m_errorOptimisationTool{this, "ErrorOptimisationTool", ""};
284  ToolHandle<Trk::IExtendedTrackSummaryTool> m_trackSummaryTool{this, "TrackSummaryTool", "MuonTrackSummaryTool"};
285  // Read handle for conditions object to get the field cache
286  SG::ReadCondHandleKey<AtlasFieldCacheCondObj> m_fieldCacheCondObjInputKey{this, "AtlasFieldCacheCondObj", "fieldCondObj",
287  "Name of the Magnetic Field conditions object key"};
289 
290  Gaudi::Property<bool> m_doTimeOutChecks{this, "UseTimeOutGuard", true};
291  Gaudi::Property<bool> m_useExclusionList{this, "UseExclusionList",
292  true};
293  Gaudi::Property<bool> m_useTrackingHistory{this, "UseTrackingHistory",
294  true};
295  Gaudi::Property<bool> m_recalibrateMDTHits{this, "RecalibrateMDTHitsOnTrack", true};
296  mutable std::atomic_uint m_ncalls{0};
297  mutable std::atomic_uint m_nTimedOut{0};
298  };
299 
300 } // namespace Muon
301 
302 #endif
Muon::MooTrackBuilder::isSplitTrack
bool isSplitTrack(const EventContext &ctx, const Trk::Track &track1, const Trk::Track &track2) const
identify whether two track are split
Definition: MooTrackBuilder.cxx:1092
make_hlt_rep.pars
pars
Definition: make_hlt_rep.py:90
DataModel_detail::const_iterator
Const iterator class for DataVector/DataList.
Definition: DVLIterator.h:82
TrackParameters.h
Muon::MooTrackBuilder::m_muonChamberHoleRecoverTool
ToolHandle< IMuonHoleRecoveryTool > m_muonChamberHoleRecoverTool
Definition: MooTrackBuilder.h:277
Muon::MooTrackBuilder::mergeSplitTracks
TrackCollection * mergeSplitTracks(const EventContext &ctx, const TrackCollection &tracks) const
look for split tracks in collection and merge them
Definition: MooTrackBuilder.cxx:1311
Muon::MooTrackBuilder::m_trackToSegmentTool
ToolHandle< IMuonTrackToSegmentTool > m_trackToSegmentTool
Definition: MooTrackBuilder.h:261
Muon::MuPatCandidateBase
track candidate entry object.
Definition: MuPatCandidateBase.h:46
Trk::MagneticFieldProperties
Definition: MagneticFieldProperties.h:31
MuPatCandidateTool.h
MuonTrackSummary.h
Trk::Track
The ATLAS Track class.
Definition: Tracking/TrkEvent/TrkTrack/TrkTrack/Track.h:73
Muon::MooTrackBuilder::m_useTrackingHistory
Gaudi::Property< bool > m_useTrackingHistory
use history of the track finding up to now to avoid creating duplicates
Definition: MooTrackBuilder.h:293
MuonEDMPrinterTool.h
AtlasFieldCacheCondObj.h
Muon::MooTrackBuilder::m_edmHelperSvc
ServiceHandle< IMuonEDMHelperSvc > m_edmHelperSvc
Definition: MooTrackBuilder.h:263
IMuonTrackBuilder.h
Muon::MooTrackBuilder::recalibrateHitsOnTrack
virtual std::unique_ptr< Trk::Track > recalibrateHitsOnTrack(const EventContext &ctx, const Trk::Track &track, bool doMdts, bool doCompetingClusters) const override
recalibrate hits on track
Definition: MooTrackBuilder.cxx:615
Muon::MooTrackBuilder::refit
virtual std::unique_ptr< Trk::Track > refit(const EventContext &ctx, Trk::Track &track) const override
refit track
Definition: MooTrackBuilder.cxx:68
Muon::MooTrackBuilder::finalize
virtual StatusCode finalize() override
finialize method, method taken from bass-class AlgTool
Definition: MooTrackBuilder.cxx:60
IMuonCompetingClustersOnTrackCreator.h
Muon::MooTrackBuilder::m_candidateHandler
ToolHandle< MuPatCandidateTool > m_candidateHandler
candidate handler
Definition: MooTrackBuilder.h:257
IPropagator.h
Muon::MooTrackBuilder::~MooTrackBuilder
~MooTrackBuilder()=default
destructor
Muon::MooTrackBuilder::m_seededSegmentFinder
ToolHandle< IMuonSeededSegmentFinder > m_seededSegmentFinder
Definition: MooTrackBuilder.h:268
Muon
NRpcCablingAlg reads raw condition data and writes derived condition data to the condition store.
Definition: TrackSystemController.h:45
xAOD::MuonSegment
MuonSegment_v1 MuonSegment
Reference the current persistent version:
Definition: Event/xAOD/xAODMuon/xAODMuon/MuonSegment.h:13
Muon::MooTrackBuilder::m_compRotCreator
ToolHandle< IMuonCompetingClustersOnTrackCreator > m_compRotCreator
Definition: MooTrackBuilder.h:272
Track.h
MagneticFieldProperties.h
IMuonSeededSegmentFinder.h
MooTrackFitter.h
Muon::MooTrackBuilder::m_candidateMatchingTool
ToolHandle< MooCandidateMatchingTool > m_candidateMatchingTool
Definition: MooTrackBuilder.h:259
Muon::MooTrackBuilder::m_fitter
ToolHandle< MooTrackFitter > m_fitter
Definition: MooTrackBuilder.h:255
Muon::MooTrackBuilder::m_nTimedOut
std::atomic_uint m_nTimedOut
Definition: MooTrackBuilder.h:297
Muon::MooTrackBuilder::find
virtual std::vector< std::unique_ptr< MuPatTrack > > find(const EventContext &ctx, MuPatCandidateBase &candidate, const std::vector< MuPatSegment * > &segments) const override
interface for tools to find track in the muon system starting from a vector of segments
Definition: MooTrackBuilder.cxx:917
Muon::MooTrackBuilder::m_trackExtrapolationTool
ToolHandle< IMuonTrackExtrapolationTool > m_trackExtrapolationTool
Definition: MooTrackBuilder.h:280
IMuonErrorOptimisationTool.h
Muon::MooTrackBuilder::m_idHelperSvc
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
Definition: MooTrackBuilder.h:267
Muon::MooTrackBuilder::getClosestParameters
virtual std::unique_ptr< Trk::TrackParameters > getClosestParameters(const Trk::Track &track, const Trk::Surface &surf) const override
find closest TrackParameters to the surface.
Definition: MooTrackBuilder.cxx:410
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
urldecode::states
states
Definition: urldecode.h:39
Muon::MooTrackBuilder::m_slFitter
ToolHandle< MooTrackFitter > m_slFitter
Definition: MooTrackBuilder.h:256
AthAlgTool.h
TrackCollection.h
Muon::MooTrackBuilder::m_printer
PublicToolHandle< MuonEDMPrinterTool > m_printer
tool to print out EDM objects;
Definition: MooTrackBuilder.h:265
Muon::MooTrackBuilder::m_ncalls
std::atomic_uint m_ncalls
Definition: MooTrackBuilder.h:296
Muon::MooTrackBuilder::m_trackSummaryTool
ToolHandle< Trk::IExtendedTrackSummaryTool > m_trackSummaryTool
Definition: MooTrackBuilder.h:284
Muon::MooTrackBuilder::MooTrackBuilder
MooTrackBuilder(const std::string &, const std::string &, const IInterface *)
default AlgTool constructor
Definition: MooTrackBuilder.cxx:30
Muon::MooTrackBuilder::findClosestParameters
virtual std::unique_ptr< Trk::TrackParameters > findClosestParameters(const Trk::Track &track, const Amg::Vector3D &pos) const override
find closest TrackParameters to the position.
Definition: MooTrackBuilder.cxx:344
Trk::ParametersBase
Definition: ParametersBase.h:55
DataVector< Trk::Track >
Muon::MooTrackBuilder::m_doTimeOutChecks
Gaudi::Property< bool > m_doTimeOutChecks
on/off time out check
Definition: MooTrackBuilder.h:290
Muon::MooTrackBuilder::combine
std::unique_ptr< Trk::Track > combine(const EventContext &ctx, const MuPatCandidateBase &firstEntry, const MuPatCandidateBase &secondEntry, const PrepVec &patternPhiHits) const
combine two MCTBCandidateEntries
Definition: MooTrackBuilder.cxx:178
Trk::FullField
@ FullField
Field is set to be realistic, but within a given Volume.
Definition: MagneticFieldMode.h:21
Muon::MooTrackBuilder::m_recalibrateMDTHits
Gaudi::Property< bool > m_recalibrateMDTHits
Definition: MooTrackBuilder.h:295
IMuonEDMHelperSvc.h
Trk
Ensure that the ATLAS eigen extensions are properly loaded.
Definition: FakeTrackBuilder.h:9
Muon::MooTrackBuilder::m_useExclusionList
Gaudi::Property< bool > m_useExclusionList
use exclusion list (bit faster at the price of missing chambers)
Definition: MooTrackBuilder.h:291
IMdtDriftCircleOnTrackCreator.h
Muon::MooTrackBuilder::m_fieldCacheCondObjInputKey
SG::ReadCondHandleKey< AtlasFieldCacheCondObj > m_fieldCacheCondObjInputKey
Definition: MooTrackBuilder.h:286
Muon::MooTrackBuilder::combineToSegment
std::unique_ptr< MuonSegment > combineToSegment(const EventContext &ctx, const MuPatCandidateBase &firstEntry, const MuPatCandidateBase &secondEntry, const PrepVec &patternPhiHits) const
Methos is used externally by MuonTrackSteering.cxx:233. Should be revised to put it into an interface...
Definition: MooTrackBuilder.cxx:164
Muon::MooTrackBuilder::initialize
virtual StatusCode initialize() override
initialize method, method taken from bass-class AlgTool
Definition: MooTrackBuilder.cxx:37
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
Muon::MuPatSegment
segment candidate object.
Definition: MuPatSegment.h:43
python.LumiBlobConversion.pos
pos
Definition: LumiBlobConversion.py:18
IResidualPullCalculator.h
SG::ReadCondHandleKey< AtlasFieldCacheCondObj >
Muon::MooTrackBuilder::splitTrack
std::pair< std::unique_ptr< Trk::Track >, std::unique_ptr< Trk::Track > > splitTrack(const EventContext &ctx, const Trk::Track &track) const
split given track if it crosses the calorimeter volume, code assumes that the track was already extra...
Definition: MooTrackBuilder.cxx:896
IMuonSegmentTrackBuilder.h
Muon::MooTrackBuilder::refine
virtual void refine(const EventContext &ctx, MuPatTrack &track) const override
interface for tools which refine the hit content of a given track
Definition: MooTrackBuilder.cxx:92
Muon::MooTrackBuilder::m_errorOptimisationTool
ToolHandle< IMuonErrorOptimisationTool > m_errorOptimisationTool
Definition: MooTrackBuilder.h:283
Muon::MooTrackBuilder
Definition: MooTrackBuilder.h:82
IExtendedTrackSummaryTool.h
Muon::MuPatTrack
track candidate object.
Definition: MuPatTrack.h:37
MooCandidateMatchingTool.h
Muon::IMuonTrackRefiner
The IMuonTrackRefiner is a pure virtual interface for tools which refine the hit content of a given t...
Definition: IMuonTrackRefiner.h:31
Muon::MooTrackBuilder::m_magFieldProperties
Trk::MagneticFieldProperties m_magFieldProperties
magnetic field properties
Definition: MooTrackBuilder.h:288
IMuonTrackToSegmentTool.h
Track
Definition: TriggerChamberClusterOnTrackCreator.h:21
xAOD::track
@ track
Definition: TrackingPrimitives.h:512
IMuonHoleRecoveryTool.h
Muon::MuonSegment
Definition: MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonSegment/MuonSegment/MuonSegment.h:45
Muon::MooTrackBuilder::m_pullCalculator
ToolHandle< Trk::IResidualPullCalculator > m_pullCalculator
Definition: MooTrackBuilder.h:275
AthAlgTool
Definition: AthAlgTool.h:26
Muon::MooTrackBuilder::combineWithSegmentFinding
std::vector< std::unique_ptr< Trk::Track > > combineWithSegmentFinding(const EventContext &ctx, const Trk::Track &track, const MuonSegment &seg, const PrepVec &patternPhiHits) const
find tracks by redoing the segment finding in the chamber of the segment
Definition: MooTrackBuilder.cxx:331
Muon::MooTrackBuilder::m_mdtRotCreator
ToolHandle< IMdtDriftCircleOnTrackCreator > m_mdtRotCreator
Definition: MooTrackBuilder.h:270
Muon::MooTrackBuilder::m_propagator
ToolHandle< Trk::IPropagator > m_propagator
Definition: MooTrackBuilder.h:274
Trk::Surface
Definition: Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/Surface.h:75
Muon::IMuonTrackBuilder
The IMuonTrackBuilder is a pure virtual interface for tools extending muon track candidates with segm...
Definition: IMuonTrackBuilder.h:33
IMuonTrackRefiner.h
Muon::IMuonSegmentTrackBuilder::PrepVec
std::vector< const Trk::PrepRawData * > PrepVec
Definition: IMuonSegmentTrackBuilder.h:26
Muon::MooTrackBuilder::insertClustersWithCompetingRotCreation
Trk::TrackStates::const_iterator insertClustersWithCompetingRotCreation(const EventContext &ctx, Trk::TrackStates::const_iterator tsit, Trk::TrackStates::const_iterator tsit_end, std::vector< std::unique_ptr< const Trk::TrackStateOnSurface >> &states) const
Definition: MooTrackBuilder.cxx:721
Muon::MooTrackBuilder::removeDuplicateWithReference
void removeDuplicateWithReference(std::unique_ptr< Trk::SegmentCollection > &segments, std::vector< const MuonSegment * > &referenceSegments) const
Definition: MooTrackBuilder.cxx:481
IMuonTrackExtrapolationTool.h
IMuonIdHelperSvc.h
Muon::MooTrackBuilder::interfaceID
static const InterfaceID & interfaceID()
access to tool interface
Definition: MooTrackBuilder.h:99
SegmentCollection.h
ServiceHandle
Definition: ClusterMakerTool.h:37
Muon::IMuonSegmentTrackBuilder
The IMuonSegmentMaker is a pure virtual interface for tools to find tracks starting from MuonSegmentC...
Definition: IMuonSegmentTrackBuilder.h:24