ATLAS Offline Software
MooCandidateMatchingTool.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 MOOCANDIDATEMATCHINGTOOL_H
6 #define MOOCANDIDATEMATCHINGTOOL_H
7 
9 #include "GaudiKernel/ServiceHandle.h"
10 #include "GaudiKernel/ToolHandle.h"
12 #include "TrkTrack/Track.h"
14 //
19 #include "MuPatCandidateTool.h"
27 //
29 //
30 #include <array>
31 #include <atomic>
32 #include <set>
33 #include <string>
34 
35 namespace Trk {
36  class Track;
37  class MeasurementBase;
38 } // namespace Trk
39 
40 namespace Muon {
41 
42  class MuonSegment;
43  class MuPatTrack;
44  class MuPatSegment;
45  class MuPatCandidateBase;
46 
49  public:
52  const MuPatTrack* MCTBTrack{nullptr};
53  const MuPatSegment* MCTBSegment{nullptr};
54 
56 
57  virtual ~MooTrackSegmentMatchResult() = default;
58 
59  virtual void clear();
60  };
62  static const InterfaceID& interfaceID() {
63  static const InterfaceID IID_MooCandidateMatchingTool("Muon::MooCandidateMatchingTool", 1, 0);
64  return IID_MooCandidateMatchingTool;
65  }
66 
68  MooCandidateMatchingTool(const std::string&, const std::string&, const IInterface*);
69 
72 
74  virtual StatusCode initialize() override;
75 
77  virtual StatusCode finalize() override;
78 
80  bool match(const EventContext& ctx, const MuPatSegment& entry1, const MuPatSegment& entry2, bool useTightCuts ) const;
81 
83  bool match(const EventContext& ctx, const MuPatTrack& entry1, const MuPatSegment& entry2, bool useTightCuts) const;
84 
86  bool match(const EventContext& ctx, const MuPatCandidateBase& entry1, const MuPatSegment& entry2, bool useTightCuts) const;
87 
89  virtual bool match(const EventContext& ctx, const Trk::Track& track, const MuonSegment& segment, bool useTightCuts) const override;
90 
92  void calculateTrackSegmentMatchResult(const EventContext& ctx, const MuPatTrack& entry1, const MuPatSegment& entry2, MooTrackSegmentMatchResult& info) const;
93 
94  TrackSegmentMatchCuts getMatchingCuts(const MuPatTrack& entry1, const MuPatSegment& entry2, bool useTightCuts) const;
95 
96  bool applyTrackSegmentCuts(const EventContext& ctx, MooTrackSegmentMatchResult& info, const TrackSegmentMatchCuts& cuts) const;
97 
106  bool sameSide(const MuPatSegment& entry1, const MuPatSegment& entry2, bool requireSameSideOfPerigee) const;
107 
116  bool sameSide(const MuPatTrack& entry1, const MuPatSegment& entry2, bool requireSameSideOfPerigee) const;
117 
126  bool sameSide(const MuPatTrack& entry1, const MuPatTrack& entry2, bool requireSameSideOfPerigee) const;
127 
136  bool sameSide(const Amg::Vector3D& dir, const Amg::Vector3D& pos1, const Amg::Vector3D& pos2, bool requireSameSideOfPerigee) const;
137 
140  static void getIdentifierSet(const std::vector<const Trk::MeasurementBase*>& measurements, std::set<Identifier>& ids) ;
141 
145  static bool checkPhiHitConsistency(const MuPatCandidateBase& entry1, const MuPatCandidateBase& entry2) ;
146 
149  bool checkSegmentDistance(const MuPatSegment& entry1, const MuPatSegment& entry2) const;
150 
152  bool areInNeighbouringChambers(const MuPatSegment& seg1, const MuPatSegment& seg2) const;
153 
154  private:
169 
170  ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc{this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"};
171  ServiceHandle<IMuonEDMHelperSvc> m_edmHelperSvc{this, "edmHelper", "Muon::MuonEDMHelperSvc/MuonEDMHelperSvc",
172  "Handle to the service providing the IMuonEDMHelperSvc interface"};
173 
174  PublicToolHandle<MuonEDMPrinterTool> m_printer{this, "MuonPrinterTool", "Muon::MuonEDMPrinterTool/MuonEDMPrinterTool",
175  "tool to print EDM objects"};
176  ToolHandle<Trk::IExtrapolator> m_atlasExtrapolator{this, "Extrapolator", "Trk::Extrapolator/AtlasExtrapolator",
177  "curved extrapolator"};
178  ToolHandle<IMuonSegmentMatchingTool> m_segmentMatchingTool{this, "SegmentMatchingTool",
179  "Muon::MuonSegmentMatchingTool/MuonSegmentMatchingTool"};
180  ToolHandle<IMuonSegmentMatchingTool> m_segmentMatchingToolTight{this, "SegmentMatchingToolTight",
181  "Muon::MuonSegmentMatchingTool/MuonSegmentMatchingToolTight"};
182  ToolHandle<MuPatCandidateTool> m_candidateTool{this, "MuPatCandidateTool", "Muon::MuPatCandidateTool/MuPatCandidateTool"};
183 
184  // Read handle for conditions object to get the field cache
185  SG::ReadCondHandleKey<AtlasFieldCacheCondObj> m_fieldCacheCondObjInputKey{this, "AtlasFieldCacheCondObj", "fieldCondObj",
186  "Name of the Magnetic Field conditions object key"};
187 
188  Gaudi::Property<int> m_trackSegmentPreMatchingStrategy{this, "TrackSegmentPreMatching", 0,
189  "0=no segments match,1=any segment match,2=all segment match"};
190  Gaudi::Property<bool> m_doTrackSegmentMatching{this, "DoTrackSegmentMatching", false, "Apply dedicated track-segment matching"};
191 
193  mutable std::atomic_ulong m_goodSegmentMatches{0};
194  mutable std::atomic_ulong m_goodSegmentMatchesTight{0};
195  mutable std::atomic_ulong m_segmentMatches{0};
196  mutable std::atomic_ulong m_segmentMatchesTight{0};
197  mutable std::atomic_ulong m_goodSegmentTrackMatches{0};
198  mutable std::atomic_ulong m_goodSegmentTrackMatchesTight{0};
199  mutable std::atomic_ulong m_sameSideOfPerigee{0};
200  mutable std::atomic_ulong m_otherSideOfPerigee{0};
201  mutable std::atomic_ulong m_sameSideOfPerigeeTrk{0};
202  mutable std::atomic_ulong m_otherSideOfPerigeeTrk{0};
203  mutable std::atomic_ulong m_segmentTrackMatches{0};
204  mutable std::atomic_ulong m_segmentTrackMatchesTight{0};
207 
208  double m_caloMatchZ;
209 
212  };
214 
215 } // namespace Muon
216 
217 #endif
grepfile.info
info
Definition: grepfile.py:38
Muon::MooCandidateMatchingTool::sameSide
bool sameSide(const MuPatSegment &entry1, const MuPatSegment &entry2, bool requireSameSideOfPerigee) const
check whether two segments are on the same side of the point of closest approach to the perigee of th...
Definition: MooCandidateMatchingTool.cxx:1094
Muon::MooCandidateMatchingTool::m_sameSideOfPerigeeTrk
std::atomic_ulong m_sameSideOfPerigeeTrk
Definition: MooCandidateMatchingTool.h:201
Muon::TrackSegmentMatchResult::NumberOfReasons
@ NumberOfReasons
Definition: MuonTrackSegmentMatchResult.h:72
Muon::MooCandidateMatchingTool::getMatchingCuts
TrackSegmentMatchCuts getMatchingCuts(const MuPatTrack &entry1, const MuPatSegment &entry2, bool useTightCuts) const
Definition: MooCandidateMatchingTool.cxx:328
Muon::MooCandidateMatchingTool::m_alignErrorPosY
double m_alignErrorPosY
Definition: MooCandidateMatchingTool.h:164
Muon::MooCandidateMatchingTool::checkSegmentDistance
bool checkSegmentDistance(const MuPatSegment &entry1, const MuPatSegment &entry2) const
evaluate distance between two segments, if too large return false (cut at 3000.).
Definition: MooCandidateMatchingTool.cxx:1220
TrackParameters.h
Muon::IMuonTrackSegmentMatchingTool
The IMuonSegmentMaker is a pure virtual interface for tools to find tracks starting from MuonSegmentC...
Definition: IMuonTrackSegmentMatchingTool.h:20
Muon::MuPatCandidateBase
track candidate entry object.
Definition: MuPatCandidateBase.h:46
Muon::MooCandidateMatchingTool::checkPhiHitConsistency
static bool checkPhiHitConsistency(const MuPatCandidateBase &entry1, const MuPatCandidateBase &entry2)
evaluate overlap between phi hits of two entries.
Definition: MooCandidateMatchingTool.cxx:1197
MuPatCandidateTool.h
IMuonSegmentMatchingTool.h
Muon::MooCandidateMatchingTool::m_trackSegmentPreMatchingStrategy
Gaudi::Property< int > m_trackSegmentPreMatchingStrategy
Definition: MooCandidateMatchingTool.h:188
Trk::Track
The ATLAS Track class.
Definition: Tracking/TrkEvent/TrkTrack/TrkTrack/Track.h:73
MuonEDMPrinterTool.h
Muon::MooCandidateMatchingTool::MooTrackSegmentMatchResult
Class with matching return information.
Definition: MooCandidateMatchingTool.h:51
AtlasFieldCacheCondObj.h
Muon::MooCandidateMatchingTool::m_matchChiSquaredCutTight
double m_matchChiSquaredCutTight
Definition: MooCandidateMatchingTool.h:168
Muon::MooCandidateMatchingTool::m_matchAngYPullCut
double m_matchAngYPullCut
Definition: MooCandidateMatchingTool.h:159
Muon::MooCandidateMatchingTool::areInNeighbouringChambers
bool areInNeighbouringChambers(const MuPatSegment &seg1, const MuPatSegment &seg2) const
return whether the 2 segments are in neighbouring chambers
Definition: MooCandidateMatchingTool.cxx:1230
Muon::MooCandidateMatchingTool::m_otherSideOfPerigee
std::atomic_ulong m_otherSideOfPerigee
Definition: MooCandidateMatchingTool.h:200
Muon::MooCandidateMatchingTool::m_matchPosYCut
double m_matchPosYCut
Definition: MooCandidateMatchingTool.h:161
Muon::MooCandidateMatchingTool::m_edmHelperSvc
ServiceHandle< IMuonEDMHelperSvc > m_edmHelperSvc
Definition: MooCandidateMatchingTool.h:171
Muon::MooCandidateMatchingTool::m_idHelperSvc
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
Definition: MooCandidateMatchingTool.h:170
Muon::MooCandidateMatchingTool::m_segmentMatchingTool
ToolHandle< IMuonSegmentMatchingTool > m_segmentMatchingTool
Definition: MooCandidateMatchingTool.h:178
IExtrapolator.h
Muon::MooCandidateMatchingTool::m_matchPosXCut
double m_matchPosXCut
Definition: MooCandidateMatchingTool.h:160
Muon::MooCandidateMatchingTool::MooTrackSegmentMatchResult::~MooTrackSegmentMatchResult
virtual ~MooTrackSegmentMatchResult()=default
Muon
This class provides conversion from CSC RDO data to CSC Digits.
Definition: TrackSystemController.h:49
Muon::MooCandidateMatchingTool::initialize
virtual StatusCode initialize() override
initialize method, method taken from bass-class AlgTool
Definition: MooCandidateMatchingTool.cxx:99
IMuonTrackSegmentMatchingTool.h
Muon::MooCandidateMatchingTool::calculateTrackSegmentMatchResult
void calculateTrackSegmentMatchResult(const EventContext &ctx, const MuPatTrack &entry1, const MuPatSegment &entry2, MooTrackSegmentMatchResult &info) const
calculate the info needed for the matching decision
Definition: MooCandidateMatchingTool.cxx:682
xAOD::MuonSegment
MuonSegment_v1 MuonSegment
Reference the current persistent version:
Definition: Event/xAOD/xAODMuon/xAODMuon/MuonSegment.h:13
Muon::TrackSegmentMatchCuts
Definition: MuonTrackSegmentMatchResult.h:174
Muon::MooCandidateMatchingTool::applyTrackSegmentCuts
bool applyTrackSegmentCuts(const EventContext &ctx, MooTrackSegmentMatchResult &info, const TrackSegmentMatchCuts &cuts) const
Definition: MooCandidateMatchingTool.cxx:382
Muon::MooCandidateMatchingTool::m_alignErrorAngleX
double m_alignErrorAngleX
Definition: MooCandidateMatchingTool.h:165
Muon::MooCandidateMatchingTool::m_printer
PublicToolHandle< MuonEDMPrinterTool > m_printer
Definition: MooCandidateMatchingTool.h:174
Muon::MooCandidateMatchingTool::m_matchChiSquaredCut
double m_matchChiSquaredCut
Definition: MooCandidateMatchingTool.h:167
Track.h
GeoPrimitives.h
Muon::MooCandidateMatchingTool
class to manipulate MuPatCandidateBase objects
Definition: MooCandidateMatchingTool.h:48
Muon::MooCandidateMatchingTool::~MooCandidateMatchingTool
virtual ~MooCandidateMatchingTool()
destructor
Muon::MooCandidateMatchingTool::m_doTrackSegmentMatching
Gaudi::Property< bool > m_doTrackSegmentMatching
Definition: MooCandidateMatchingTool.h:190
Muon::MooCandidateMatchingTool::m_minimumSideMatchRadius
double m_minimumSideMatchRadius
Definition: MooCandidateMatchingTool.h:155
Muon::MooCandidateMatchingTool::m_goodSegmentMatchesTight
std::atomic_ulong m_goodSegmentMatchesTight
Definition: MooCandidateMatchingTool.h:194
Muon::MooCandidateMatchingTool::MooCandidateMatchingTool
MooCandidateMatchingTool(const std::string &, const std::string &, const IInterface *)
default AlgTool constructor
Definition: MooCandidateMatchingTool.cxx:61
Muon::MooCandidateMatchingTool::m_otherSideOfPerigeeTrk
std::atomic_ulong m_otherSideOfPerigeeTrk
Definition: MooCandidateMatchingTool.h:202
Muon::MooCandidateMatchingTool::m_matchPosPullCut
double m_matchPosPullCut
Definition: MooCandidateMatchingTool.h:162
Muon::MooCandidateMatchingTool::m_caloMatchZ
double m_caloMatchZ
Z position of calo end-cap disks.
Definition: MooCandidateMatchingTool.h:208
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
AthAlgTool.h
plotBeamSpotVert.cuts
string cuts
Definition: plotBeamSpotVert.py:93
Muon::MooCandidateMatchingTool::m_reasonsForMatchNotOk
std::atomic_ulong m_reasonsForMatchNotOk[TrackSegmentMatchResult::NumberOfReasons]
Definition: MooCandidateMatchingTool.h:206
Muon::MooCandidateMatchingTool::MooTrackSegmentMatchResult::MCTBTrack
const MuPatTrack * MCTBTrack
Definition: MooCandidateMatchingTool.h:52
Muon::MooCandidateMatchingTool::m_matchAngXCut
double m_matchAngXCut
Definition: MooCandidateMatchingTool.h:156
Muon::MooCandidateMatchingTool::m_goodSegmentTrackMatchesTight
std::atomic_ulong m_goodSegmentTrackMatchesTight
Definition: MooCandidateMatchingTool.h:198
SortMeasurementsByPosition.h
Muon::MooCandidateMatchingTool::m_sameSideOfPerigee
std::atomic_ulong m_sameSideOfPerigee
Definition: MooCandidateMatchingTool.h:199
Muon::MooCandidateMatchingTool::finalize
virtual StatusCode finalize() override
finialize method, method taken from bass-class AlgTool
Definition: MooCandidateMatchingTool.cxx:112
beamspotman.dir
string dir
Definition: beamspotman.py:623
Muon::MooCandidateMatchingTool::getIdentifierSet
static void getIdentifierSet(const std::vector< const Trk::MeasurementBase * > &measurements, std::set< Identifier > &ids)
extract Idenfitiers from a vector of measurements and copy them into a set
Definition: MooCandidateMatchingTool.cxx:1176
Muon::MooCandidateMatchingTool::MooTrackSegmentMatchResult::MooTrackSegmentMatchResult
MooTrackSegmentMatchResult()
Definition: MooCandidateMatchingTool.cxx:53
EventPrimitives.h
IMuonEDMHelperSvc.h
Trk
Ensure that the ATLAS eigen extensions are properly loaded.
Definition: FakeTrackBuilder.h:9
python.subdetectors.mmg.ids
ids
Definition: mmg.py:8
Muon::MooCandidateMatchingTool::m_segmentTrackMatchesTight
std::atomic_ulong m_segmentTrackMatchesTight
Definition: MooCandidateMatchingTool.h:204
Muon::MooCandidateMatchingTool::interfaceID
static const InterfaceID & interfaceID()
access to tool interface
Definition: MooCandidateMatchingTool.h:62
MuonTrackSegmentMatchResult.h
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
Muon::MooCandidateMatchingTool::m_goodSegmentMatches
std::atomic_ulong m_goodSegmentMatches
matching counters
Definition: MooCandidateMatchingTool.h:193
Muon::MuPatSegment
segment candidate object.
Definition: MuPatSegment.h:43
SG::ReadCondHandleKey< AtlasFieldCacheCondObj >
Muon::MooCandidateMatchingTool::m_segmentMatchesTight
std::atomic_ulong m_segmentMatchesTight
Definition: MooCandidateMatchingTool.h:196
Muon::MooCandidateMatchingTool::m_segmentMatches
std::atomic_ulong m_segmentMatches
Definition: MooCandidateMatchingTool.h:195
Muon::MooCandidateMatchingTool::m_atlasExtrapolator
ToolHandle< Trk::IExtrapolator > m_atlasExtrapolator
Definition: MooCandidateMatchingTool.h:176
Muon::MooCandidateMatchingTool::MooTrackSegmentMatchResult::clear
virtual void clear()
Definition: MooCandidateMatchingTool.cxx:55
Muon::MuPatTrack
track candidate object.
Definition: MuPatTrack.h:37
Muon::MooCandidateMatchingTool::m_fieldCacheCondObjInputKey
SG::ReadCondHandleKey< AtlasFieldCacheCondObj > m_fieldCacheCondObjInputKey
Definition: MooCandidateMatchingTool.h:185
Muon::MooCandidateMatchingTool::m_matchAngYCut
double m_matchAngYCut
Definition: MooCandidateMatchingTool.h:157
Muon::MooCandidateMatchingTool::m_goodSegmentTrackMatches
std::atomic_ulong m_goodSegmentTrackMatches
Definition: MooCandidateMatchingTool.h:197
Muon::MooCandidateMatchingTool::m_alignErrorAngleY
double m_alignErrorAngleY
Definition: MooCandidateMatchingTool.h:166
Muon::MooCandidateMatchingTool::m_candidateTool
ToolHandle< MuPatCandidateTool > m_candidateTool
Definition: MooCandidateMatchingTool.h:182
Muon::MooCandidateMatchingTool::match
bool match(const EventContext &ctx, const MuPatSegment &entry1, const MuPatSegment &entry2, bool useTightCuts) const
match two segment entries
Definition: MooCandidateMatchingTool.cxx:171
Track
Definition: TriggerChamberClusterOnTrackCreator.h:21
Muon::MooCandidateMatchingTool::m_segmentTrackMatches
std::atomic_ulong m_segmentTrackMatches
Definition: MooCandidateMatchingTool.h:203
Muon::MooCandidateMatchingTool::m_segmentMatchingToolTight
ToolHandle< IMuonSegmentMatchingTool > m_segmentMatchingToolTight
Definition: MooCandidateMatchingTool.h:180
xAOD::track
@ track
Definition: TrackingPrimitives.h:512
Muon::MooCandidateMatchingTool::MooTrackSegmentMatchResult::MCTBSegment
const MuPatSegment * MCTBSegment
Definition: MooCandidateMatchingTool.h:53
Muon::MuonSegment
Definition: MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonSegment/MuonSegment/MuonSegment.h:45
AthAlgTool
Definition: AthAlgTool.h:26
Muon::MooCandidateMatchingTool::m_matchAngXPullCut
double m_matchAngXPullCut
Definition: MooCandidateMatchingTool.h:158
Muon::MooCandidateMatchingTool::m_reasonsForMatchOk
std::atomic_ulong m_reasonsForMatchOk[TrackSegmentMatchResult::NumberOfReasons]
Definition: MooCandidateMatchingTool.h:205
checker_macros.h
Define macros for attributes used to control the static checker.
Muon::MooCandidateMatchingTool::m_requireSameSide
bool m_requireSameSide
require entries to be on the same side of the Perigee or Calorimeter
Definition: MooCandidateMatchingTool.h:211
IMuonIdHelperSvc.h
TrackStateOnSurface.h
Muon::TrackSegmentMatchResult
Class with matching return information.
Definition: MuonTrackSegmentMatchResult.h:29
NSWL1::PadTriggerAdapter::segment
Muon::NSW_PadTriggerSegment segment(const NSWL1::PadTrigger &data)
Definition: PadTriggerAdapter.cxx:5
ServiceHandle< Muon::IMuonIdHelperSvc >
Muon::MooCandidateMatchingTool::m_alignErrorPosX
double m_alignErrorPosX
Definition: MooCandidateMatchingTool.h:163