ATLAS Offline Software
MuPatCandidateTool.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef MUPATCANDIDATETOOL_H
6 #define MUPATCANDIDATETOOL_H
7 
8 #include <mutex>
9 #include <set>
10 #include <vector>
11 
13 #include "GaudiKernel/ServiceHandle.h"
14 #include "GaudiKernel/ToolHandle.h"
15 #include "MuPatHitTool.h" // Needed to enfornce build order for reflex dict
26 
27 class MsgStream;
28 
29 namespace Trk {
30  class Track;
31  class MeasurementBase;
32  class MagneticFieldProperties;
33 } // namespace Trk
34 
35 namespace MuonGM {
36  class MuonReadoutElement;
37 }
38 
39 namespace Muon {
40 
41  class MuonSegment;
42  class MuPatTrack;
43  class MuPatSegment;
44  class MuPatCandidateBase;
45  class MuonClusterOnTrack;
46 
47 
49  class MuPatCandidateTool : public AthAlgTool {
50  public:
51  using MeasVec = std::vector<const Trk::MeasurementBase*>;
53  typedef MeasVec::const_iterator MeasCit;
54 
55  public:
57  MuPatCandidateTool(const std::string&, const std::string&, const IInterface*);
58 
60  virtual ~MuPatCandidateTool() = default;
61 
63  virtual StatusCode initialize() override;
64 
66  static const InterfaceID& interfaceID() {
67  static const InterfaceID IID_MuPatCandidateTool("Muon::MuPatCandidateTool", 1, 0);
68  return IID_MuPatCandidateTool;
69  }
70 
77  bool extendWithSegment(MuPatTrack& can, MuPatSegment& segInfo, std::unique_ptr<Trk::Track>& track) const;
78 
85  std::unique_ptr<MuPatTrack> createCandidate(MuPatSegment& segInfo, std::unique_ptr<Trk::Track>& track) const;
86 
93  std::unique_ptr<MuPatTrack> createCandidate(MuPatSegment& segInfo1, MuPatSegment& segInfo2, std::unique_ptr<Trk::Track>& track) const;
94 
99  std::unique_ptr<MuPatTrack> createCandidate(std::unique_ptr<Trk::Track>& track) const;
100 
103  bool updateTrack(MuPatTrack& candidate, std::unique_ptr<Trk::Track>& track) const;
104 
106  bool recalculateCandidateSegmentContent(MuPatTrack& candidate) const;
107 
112  static std::unique_ptr<MuPatTrack> copyCandidate(MuPatTrack* canIn) ;
113 
118  std::unique_ptr<MuPatSegment> createSegInfo(const EventContext& ctx, const MuonSegment& segment) const;
119 
121  std::set<const MuonGM::MuonReadoutElement*> readoutElements(const MuPatCandidateBase& entry) const;
122 
131  std::string print(const MuPatSegment& segment, int level = 0) const;
132 
133  std::string print(const std::vector<MuPatSegment*>& segments, int level = 0) const;
134 
135  std::string print(const MuPatCandidateBase& candidate, int level = 0) const;
136 
137  std::string print(const MuPatTrack& track, int level = 0) const;
138 
139  std::string print(const std::vector<std::unique_ptr<MuPatTrack> >& tracks, int level = 0) const;
140 
141  private:
143  void updateHits(MuPatCandidateBase& entry, const MeasVec& measurements, bool recreateMDT = false,
144  bool recreateCSC = false, bool createComp = false) const;
145 
147  void addCluster(const Trk::MeasurementBase& meas, std::vector<const MuonClusterOnTrack*>& rots) const;
148 
150  void createAndAddCompetingROTs(const std::vector<const MuonClusterOnTrack*>& rots, MeasVec& hits, MeasVec& allHits,
151  MuPatCandidateBase& entry) const;
152 
153  ToolHandle<IMdtDriftCircleOnTrackCreator> m_mdtRotCreator{
154  this, "MdtRotCreator", "Muon::MdtDriftCircleOnTrackCreator/MdtDriftCircleOnTrackCreator", "tool to calibrate MDT hits"};
155  ToolHandle<IMuonClusterOnTrackCreator> m_cscRotCreator{
156  this, "CscRotCreator", "Muon::CscClusterOnTrackCreator/CscClusterOnTrackCreator", "tool to calibrate CSC hits"};
157  ToolHandle<IMuonCompetingClustersOnTrackCreator> m_compClusterCreator{
158  this, "CompetingClustersCreator", "Muon::TriggerChamberClusterOnTrackCreator/TriggerChamberClusterOnTrackCreator",
159  "tool to create competing clusters on track"};
160  ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc{this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"};
161  ServiceHandle<IMuonEDMHelperSvc> m_edmHelperSvc{this, "edmHelper", "Muon::MuonEDMHelperSvc/MuonEDMHelperSvc",
162  "Handle to the service providing the IMuonEDMHelperSvc interface"};
163  PublicToolHandle<MuonEDMPrinterTool> m_printer{this, "MuonPrinterTool", "Muon::MuonEDMPrinterTool/MuonEDMPrinterTool"};
164  ToolHandle<MuPatHitTool> m_hitHandler{this, "HitTool", "Muon::MuPatHitTool/MuPatHitTool", "Tool to manipulate hit lists"};
165  ToolHandle<Muon::IMuonSegmentSelectionTool> m_segmentSelector{
166  this, "SegmentSelector", "Muon::MuonSegmentSelectionTool/MuonSegmentSelectionTool", "Tool to resolve track ambiguities"};
167 
168  Gaudi::Property<bool> m_createCompetingROTsPhi{this, "CreateCompetingROTsPhi", false};
169  Gaudi::Property<bool> m_createCompetingROTsEta{this, "CreateCompetingROTsEta", true};
170  Gaudi::Property<bool> m_doMdtRecreation{this, "DoMdtRecreation", false};
171  Gaudi::Property<bool> m_doCscRecreation{this, "DoCscRecreation", true};
172  };
173 
174 } // namespace Muon
175 
176 #endif
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
Muon::MuPatCandidateTool::print
std::string print(const MuPatSegment &segment, int level=0) const
print the measurements on the track to string
Definition: MuPatCandidateTool.cxx:450
MuonGM
Ensure that the Athena extensions are properly loaded.
Definition: GeoMuonHits.h:27
TRTCalib_Extractor.hits
hits
Definition: TRTCalib_Extractor.py:35
TrackParameters.h
Muon::MuPatCandidateBase
track candidate entry object.
Definition: MuPatCandidateBase.h:46
MuonEDMPrinterTool.h
Muon::MuPatCandidateTool::interfaceID
static const InterfaceID & interfaceID()
access to tool interface
Definition: MuPatCandidateTool.h:66
Muon::MuPatCandidateTool::m_mdtRotCreator
ToolHandle< IMdtDriftCircleOnTrackCreator > m_mdtRotCreator
Definition: MuPatCandidateTool.h:153
Muon::MuPatCandidateTool::m_cscRotCreator
ToolHandle< IMuonClusterOnTrackCreator > m_cscRotCreator
Definition: MuPatCandidateTool.h:155
IMuonCompetingClustersOnTrackCreator.h
Muon::MuPatCandidateTool::~MuPatCandidateTool
virtual ~MuPatCandidateTool()=default
destructor
Muon::MuPatCandidateTool::MeasVec
std::vector< const Trk::MeasurementBase * > MeasVec
Definition: MuPatCandidateTool.h:51
MuPatHitTool.h
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::MuPatCandidateTool::m_createCompetingROTsEta
Gaudi::Property< bool > m_createCompetingROTsEta
Definition: MuPatCandidateTool.h:169
MuonTrackMakerStlTools.h
python.iconfTool.models.loaders.level
level
Definition: loaders.py:20
Muon::MuPatCandidateTool::m_doCscRecreation
Gaudi::Property< bool > m_doCscRecreation
Definition: MuPatCandidateTool.h:171
Muon::MuPatCandidateTool::createAndAddCompetingROTs
void createAndAddCompetingROTs(const std::vector< const MuonClusterOnTrack * > &rots, MeasVec &hits, MeasVec &allHits, MuPatCandidateBase &entry) const
create CompetingMuonClustersOnTracks from ROTs and add them to the MeasVec.
Definition: MuPatCandidateTool.cxx:302
Muon::MuPatCandidateTool::MuPatCandidateTool
MuPatCandidateTool(const std::string &, const std::string &, const IInterface *)
default AlgTool constructor
Definition: MuPatCandidateTool.cxx:34
Muon::MuPatCandidateTool::createSegInfo
std::unique_ptr< MuPatSegment > createSegInfo(const EventContext &ctx, const MuonSegment &segment) const
create a MuPatSegment object from a segment
Definition: MuPatCandidateTool.cxx:58
Muon::MuPatCandidateTool::updateTrack
bool updateTrack(MuPatTrack &candidate, std::unique_ptr< Trk::Track > &track) const
set the new track in the candidate, and update candidate contents.
Definition: MuPatCandidateTool.cxx:113
PlotPulseshapeFromCool.can
can
Definition: PlotPulseshapeFromCool.py:91
Muon::MuPatCandidateTool::updateHits
void updateHits(MuPatCandidateBase &entry, const MeasVec &measurements, bool recreateMDT=false, bool recreateCSC=false, bool createComp=false) const
update hits for a MuPatCandidateBase
Definition: MuPatCandidateTool.cxx:136
IMuonSegmentSelectionTool.h
Muon::MeasVec
NSWSeed::MeasVec MeasVec
Stereo seeds can be formed using hits from 4 independent layers by solving the following system of eq...
Definition: MuonNSWSegmentFinderTool.cxx:102
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
Muon::MuPatCandidateTool::m_idHelperSvc
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
Definition: MuPatCandidateTool.h:160
IMuonClusterOnTrackCreator.h
AthAlgTool.h
Muon::MuPatCandidateTool
class to manipulate MuPatCandidateBase objects
Definition: MuPatCandidateTool.h:49
Muon::MuPatCandidateTool::initialize
virtual StatusCode initialize() override
initialize method, method taken from bass-class AlgTool
Definition: MuPatCandidateTool.cxx:38
Muon::MuPatCandidateTool::copyCandidate
static std::unique_ptr< MuPatTrack > copyCandidate(MuPatTrack *canIn)
copy a candidate without copying the track (lazy pointer copy)
Definition: MuPatCandidateTool.cxx:100
Muon::MuPatCandidateTool::m_segmentSelector
ToolHandle< Muon::IMuonSegmentSelectionTool > m_segmentSelector
Definition: MuPatCandidateTool.h:165
Trk::MeasurementBase
Definition: MeasurementBase.h:58
GetAllXsec.entry
list entry
Definition: GetAllXsec.py:132
IMuonEDMHelperSvc.h
Trk
Ensure that the ATLAS eigen extensions are properly loaded.
Definition: FakeTrackBuilder.h:9
Muon::MuPatCandidateTool::m_compClusterCreator
ToolHandle< IMuonCompetingClustersOnTrackCreator > m_compClusterCreator
Definition: MuPatCandidateTool.h:157
IMdtDriftCircleOnTrackCreator.h
Muon::MuPatCandidateTool::m_printer
PublicToolHandle< MuonEDMPrinterTool > m_printer
Definition: MuPatCandidateTool.h:163
Muon::MuPatCandidateTool::m_edmHelperSvc
ServiceHandle< IMuonEDMHelperSvc > m_edmHelperSvc
Definition: MuPatCandidateTool.h:161
Muon::MuPatCandidateTool::m_createCompetingROTsPhi
Gaudi::Property< bool > m_createCompetingROTsPhi
Definition: MuPatCandidateTool.h:168
Muon::MuPatCandidateTool::m_doMdtRecreation
Gaudi::Property< bool > m_doMdtRecreation
Definition: MuPatCandidateTool.h:170
Muon::MuPatSegment
segment candidate object.
Definition: MuPatSegment.h:43
Muon::MuPatCandidateTool::readoutElements
std::set< const MuonGM::MuonReadoutElement * > readoutElements(const MuPatCandidateBase &entry) const
get list of the readout elements of the hits on the entry
Definition: MuPatCandidateTool.cxx:423
Muon::MuPatCandidateTool::MeasCit
MeasVec::const_iterator MeasCit
Definition: MuPatCandidateTool.h:53
Muon::MuPatTrack
track candidate object.
Definition: MuPatTrack.h:37
Muon::MuPatCandidateTool::extendWithSegment
bool extendWithSegment(MuPatTrack &can, MuPatSegment &segInfo, std::unique_ptr< Trk::Track > &track) const
extend a track candidate with a segment
Definition: MuPatCandidateTool.cxx:94
IMuonSegmentInfoExtender.h
Muon::MuPatCandidateTool::createCandidate
std::unique_ptr< MuPatTrack > createCandidate(MuPatSegment &segInfo, std::unique_ptr< Trk::Track > &track) const
create a track candidate from one segment
Definition: MuPatCandidateTool.cxx:106
Muon::MuPatCandidateTool::MeasIt
MeasVec::iterator MeasIt
Definition: MuPatCandidateTool.h:52
Track
Definition: TriggerChamberClusterOnTrackCreator.h:21
xAOD::track
@ track
Definition: TrackingPrimitives.h:512
Muon::MuonSegment
Definition: MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonSegment/MuonSegment/MuonSegment.h:45
AthAlgTool
Definition: AthAlgTool.h:26
Muon::MuPatCandidateTool::recalculateCandidateSegmentContent
bool recalculateCandidateSegmentContent(MuPatTrack &candidate) const
recalculate the chamber indices on the candidate and reset them.
Definition: MuPatCandidateTool.cxx:374
Muon::MuPatCandidateTool::addCluster
void addCluster(const Trk::MeasurementBase &meas, std::vector< const MuonClusterOnTrack * > &rots) const
extract MuonClusterOnTrack('s) from measurement
Definition: MuPatCandidateTool.cxx:286
IMuonIdHelperSvc.h
NSWL1::PadTriggerAdapter::segment
Muon::NSW_PadTriggerSegment segment(const NSWL1::PadTrigger &data)
Definition: PadTriggerAdapter.cxx:5
ServiceHandle< Muon::IMuonIdHelperSvc >
Muon::MuPatCandidateTool::m_hitHandler
ToolHandle< MuPatHitTool > m_hitHandler
Definition: MuPatCandidateTool.h:164