ATLAS Offline Software
MuonTrackExtrapolationTool.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3  */
4 
5 #ifndef MUON_MUONTRACKEXTRAPOLATIONTOOL_H
6 #define MUON_MUONTRACKEXTRAPOLATIONTOOL_H
7 
9 #include "GaudiKernel/ServiceHandle.h"
10 #include "GaudiKernel/ToolHandle.h"
17 
18 // For magneticfield
21 
22 namespace Muon {
23 
29  public:
31  MuonTrackExtrapolationTool(const std::string &, const std::string &, const IInterface *);
32 
34  virtual ~MuonTrackExtrapolationTool() = default;
35 
37  virtual StatusCode initialize() override;
38 
44  virtual std::unique_ptr<Trk::Track> extrapolate(const Trk::Track &track, const EventContext &ctx) const override;
45 
51  virtual std::unique_ptr<TrackCollection> extrapolate(const TrackCollection &tracks, const EventContext &ctx) const override;
52 
53  private:
54  double estimateDistanceToEntryRecord(const EventContext &ctx, const Trk::TrackParameters &pars) const;
55  static const Trk::TrackParameters *checkForSecondCrossing(const Trk::TrackParameters &firstCrossing, const Trk::Track &track) ;
56  const Trk::TrackParameters *findClosestParametersToMuonEntry(const EventContext &ctx, const Trk::Track &track) const;
57 
60  std::unique_ptr<Trk::TrackParameters> extrapolateToMuonEntryRecord(const EventContext &ctx, const Trk::TrackParameters &pars,
61  Trk::ParticleHypothesis particleHypo = Trk::muon) const;
62 
65  std::unique_ptr<Trk::TrackParameters> extrapolateToIP(const EventContext& ctx, const Trk::TrackParameters &pars,
66  Trk::ParticleHypothesis particleHypo = Trk::muon) const;
67 
68  std::shared_ptr<Trk::Perigee> createPerigee(const EventContext& ctx, const Trk::TrackParameters &pars) const;
69 
70  // Read handle for conditions object to get the field cache
71  SG::ReadCondHandleKey<AtlasFieldCacheCondObj> m_fieldCacheCondObjInputKey{this, "AtlasFieldCacheCondObj", "fieldCondObj",
72  "Name of the Magnetic Field conditions object key"};
73 
75  "Key of input TrackingGeometry"};
76  ServiceHandle<Muon::IMuonEDMHelperSvc> m_edmHelperSvc{this, "edmHelper", "Muon::MuonEDMHelperSvc/MuonEDMHelperSvc",
77  "Handle to the service providing the IMuonEDMHelperSvc interface"};
78  ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc{this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"};
79 
80  PublicToolHandle<Muon::MuonEDMPrinterTool> m_printer{this, "EDMPrinter", "Muon::MuonEDMPrinterTool/MuonEDMPrinterTool",
81  "helper to nicely print out tracks"};
82  ToolHandle<Trk::IExtrapolator> m_atlasExtrapolator{this, "AtlasExtrapolator", "Trk::Extrapolator/AtlasExtrapolator"};
83  ToolHandle<Trk::IExtrapolator> m_muonExtrapolator{this, "MuonExtrapolator", "Trk::Extrapolator/MuonExtrapolator"};
84 
85  Gaudi::Property<bool> m_cosmics{this, "Cosmics", false};
86  Gaudi::Property<bool> m_keepOldPerigee{this, "KeepInitialPerigee", true};
87  Gaudi::Property<std::string> m_msEntranceName{this, "MuonSystemEntranceName", "MuonSpectrometerEntrance"};
88 
89  inline const Trk::TrackingVolume *getVolume(const std::string &vol_name, const EventContext &ctx) const {
91  if (!handle.isValid()) {
92  ATH_MSG_WARNING("Could not retrieve a valid tracking geometry");
93  return nullptr;
94  }
95  return handle.cptr()->trackingVolume(vol_name);
96  }
97  };
98 } // namespace Muon
99 
100 #endif
make_hlt_rep.pars
pars
Definition: make_hlt_rep.py:90
Muon::MuonTrackExtrapolationTool::extrapolateToIP
std::unique_ptr< Trk::TrackParameters > extrapolateToIP(const EventContext &ctx, const Trk::TrackParameters &pars, Trk::ParticleHypothesis particleHypo=Trk::muon) const
extrapolates track parameters to muon entry record, will return a zero pointer if the extrapolation f...
Definition: MuonTrackExtrapolationTool.cxx:79
Muon::MuonTrackExtrapolationTool
tool to select tracks
Definition: MuonTrackExtrapolationTool.h:28
TrackParameters.h
SG::ReadCondHandle
Definition: ReadCondHandle.h:44
Trk::Track
The ATLAS Track class.
Definition: Tracking/TrkEvent/TrkTrack/TrkTrack/Track.h:73
MuonEDMPrinterTool.h
Muon::MuonTrackExtrapolationTool::getVolume
const Trk::TrackingVolume * getVolume(const std::string &vol_name, const EventContext &ctx) const
Definition: MuonTrackExtrapolationTool.h:89
AtlasFieldCacheCondObj.h
Muon::IMuonTrackExtrapolationTool
Interface class for tools extrapolating muon tracks to a location in the atlas detector.
Definition: IMuonTrackExtrapolationTool.h:16
Muon::MuonTrackExtrapolationTool::m_keepOldPerigee
Gaudi::Property< bool > m_keepOldPerigee
Definition: MuonTrackExtrapolationTool.h:86
SG::ReadCondHandle::isValid
bool isValid()
Definition: ReadCondHandle.h:206
Muon::MuonTrackExtrapolationTool::extrapolate
virtual std::unique_ptr< Trk::Track > extrapolate(const Trk::Track &track, const EventContext &ctx) const override
extrapolates a muon track to the muon entry record and returns a new track expressed at the destinati...
Definition: MuonTrackExtrapolationTool.cxx:254
IExtrapolator.h
Muon
This class provides conversion from CSC RDO data to CSC Digits.
Definition: TrackSystemController.h:45
Muon::MuonTrackExtrapolationTool::createPerigee
std::shared_ptr< Trk::Perigee > createPerigee(const EventContext &ctx, const Trk::TrackParameters &pars) const
Definition: MuonTrackExtrapolationTool.cxx:632
Muon::MuonTrackExtrapolationTool::m_edmHelperSvc
ServiceHandle< Muon::IMuonEDMHelperSvc > m_edmHelperSvc
Definition: MuonTrackExtrapolationTool.h:76
Trk::ParticleHypothesis
ParticleHypothesis
Definition: ParticleHypothesis.h:25
Muon::MuonTrackExtrapolationTool::m_printer
PublicToolHandle< Muon::MuonEDMPrinterTool > m_printer
Definition: MuonTrackExtrapolationTool.h:80
Muon::MuonTrackExtrapolationTool::~MuonTrackExtrapolationTool
virtual ~MuonTrackExtrapolationTool()=default
destructor
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
AthAlgTool.h
Muon::MuonTrackExtrapolationTool::m_fieldCacheCondObjInputKey
SG::ReadCondHandleKey< AtlasFieldCacheCondObj > m_fieldCacheCondObjInputKey
Definition: MuonTrackExtrapolationTool.h:71
Muon::MuonTrackExtrapolationTool::m_idHelperSvc
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
Definition: MuonTrackExtrapolationTool.h:78
Trk::ParametersBase
Definition: ParametersBase.h:55
Trk::muon
@ muon
Definition: ParticleHypothesis.h:28
DataVector< Trk::Track >
Muon::MuonTrackExtrapolationTool::m_trackingGeometryReadKey
SG::ReadCondHandleKey< Trk::TrackingGeometry > m_trackingGeometryReadKey
Definition: MuonTrackExtrapolationTool.h:74
Muon::MuonTrackExtrapolationTool::checkForSecondCrossing
static const Trk::TrackParameters * checkForSecondCrossing(const Trk::TrackParameters &firstCrossing, const Trk::Track &track)
Definition: MuonTrackExtrapolationTool.cxx:212
Muon::MuonTrackExtrapolationTool::m_atlasExtrapolator
ToolHandle< Trk::IExtrapolator > m_atlasExtrapolator
Definition: MuonTrackExtrapolationTool.h:82
IMuonEDMHelperSvc.h
Muon::MuonTrackExtrapolationTool::m_msEntranceName
Gaudi::Property< std::string > m_msEntranceName
Definition: MuonTrackExtrapolationTool.h:87
Muon::MuonTrackExtrapolationTool::estimateDistanceToEntryRecord
double estimateDistanceToEntryRecord(const EventContext &ctx, const Trk::TrackParameters &pars) const
Definition: MuonTrackExtrapolationTool.cxx:192
Muon::MuonTrackExtrapolationTool::extrapolateToMuonEntryRecord
std::unique_ptr< Trk::TrackParameters > extrapolateToMuonEntryRecord(const EventContext &ctx, const Trk::TrackParameters &pars, Trk::ParticleHypothesis particleHypo=Trk::muon) const
extrapolates track parameters to muon entry record, will return a zero pointer if the extrapolation f...
Definition: MuonTrackExtrapolationTool.cxx:49
SG::ReadCondHandleKey< AtlasFieldCacheCondObj >
Muon::MuonTrackExtrapolationTool::findClosestParametersToMuonEntry
const Trk::TrackParameters * findClosestParametersToMuonEntry(const EventContext &ctx, const Trk::Track &track) const
Definition: MuonTrackExtrapolationTool.cxx:110
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
Muon::MuonTrackExtrapolationTool::initialize
virtual StatusCode initialize() override
AlgTool initilize.
Definition: MuonTrackExtrapolationTool.cxx:31
Trk::TrackingGeometry::trackingVolume
const TrackingVolume * trackingVolume(const std::string &name) const
return the tracking Volume by name, 0 if it doesn't exist
TrackingGeometry.h
Muon::MuonTrackExtrapolationTool::m_cosmics
Gaudi::Property< bool > m_cosmics
Definition: MuonTrackExtrapolationTool.h:85
xAOD::track
@ track
Definition: TrackingPrimitives.h:512
Muon::MuonTrackExtrapolationTool::m_muonExtrapolator
ToolHandle< Trk::IExtrapolator > m_muonExtrapolator
Definition: MuonTrackExtrapolationTool.h:83
AthAlgTool
Definition: AthAlgTool.h:26
Trk::TrackingVolume
Definition: TrackingVolume.h:121
Muon::MuonTrackExtrapolationTool::MuonTrackExtrapolationTool
MuonTrackExtrapolationTool(const std::string &, const std::string &, const IInterface *)
constructor
Definition: MuonTrackExtrapolationTool.cxx:26
IMuonTrackExtrapolationTool.h
IMuonIdHelperSvc.h
ServiceHandle< Muon::IMuonEDMHelperSvc >
SG::ReadCondHandle::cptr
const_pointer_type cptr()
Definition: ReadCondHandle.h:67