ATLAS Offline Software
Loading...
Searching...
No Matches
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
35namespace Trk {
36 class Track;
37 class MeasurementBase;
38} // namespace Trk
39
40namespace Muon {
41
42 class MuonSegment;
43 class MuPatTrack;
44 class MuPatSegment;
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 };
61
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
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
210
213 };
214
215} // namespace Muon
216
217#endif
Define macros for attributes used to control the static checker.
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
The IMuonSegmentMaker is a pure virtual interface for tools to find tracks starting from MuonSegmentC...
bool checkSegmentDistance(const MuPatSegment &entry1, const MuPatSegment &entry2) const
evaluate distance between two segments, if too large return false (cut at 3000.).
Gaudi::Property< bool > m_doTrackSegmentMatching
virtual StatusCode finalize() override
finialize method, method taken from bass-class AlgTool
TrackSegmentMatchCuts getMatchingCuts(const MuPatTrack &entry1, const MuPatSegment &entry2, bool useTightCuts) const
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...
double m_caloMatchZ
Z position of calo end-cap disks.
bool match(const EventContext &ctx, const MuPatSegment &entry1, const MuPatSegment &entry2, bool useTightCuts) const
match two segment entries
bool applyTrackSegmentCuts(const EventContext &ctx, MooTrackSegmentMatchResult &info, const TrackSegmentMatchCuts &cuts) const
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
MooCandidateMatchingTool(const std::string &, const std::string &, const IInterface *)
default AlgTool constructor
Gaudi::Property< int > m_trackSegmentPreMatchingStrategy
bool areInNeighbouringChambers(const MuPatSegment &seg1, const MuPatSegment &seg2) const
return whether the 2 segments are in neighbouring chambers
SG::ReadCondHandleKey< AtlasFieldCacheCondObj > m_fieldCacheCondObjInputKey
ToolHandle< IMuonSegmentMatchingTool > m_segmentMatchingTool
void calculateTrackSegmentMatchResult(const EventContext &ctx, const MuPatTrack &entry1, const MuPatSegment &entry2, MooTrackSegmentMatchResult &info) const
calculate the info needed for the matching decision
PublicToolHandle< MuonEDMPrinterTool > m_printer
ToolHandle< MuPatCandidateTool > m_candidateTool
std::atomic_ulong m_reasonsForMatchOk[TrackSegmentMatchResult::NumberOfReasons]
static const InterfaceID & interfaceID()
access to tool interface
ServiceHandle< IMuonEDMHelperSvc > m_edmHelperSvc
ToolHandle< IMuonSegmentMatchingTool > m_segmentMatchingToolTight
virtual ~MooCandidateMatchingTool()
destructor
ToolHandle< Trk::IExtrapolator > m_atlasExtrapolator
static bool checkPhiHitConsistency(const MuPatCandidateBase &entry1, const MuPatCandidateBase &entry2)
evaluate overlap between phi hits of two entries.
std::atomic_ulong m_reasonsForMatchNotOk[TrackSegmentMatchResult::NumberOfReasons]
virtual StatusCode initialize() override
initialize method, method taken from bass-class AlgTool
std::atomic_ulong m_goodSegmentMatches
matching counters
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
bool m_requireSameSide
require entries to be on the same side of the Perigee or Calorimeter
track candidate entry object.
segment candidate object.
track candidate object.
Definition MuPatTrack.h:37
This is the common class for 3D segments used in the muon spectrometer.
This class is the pure abstract base class for all fittable tracking measurements.
Eigen::Matrix< double, 3, 1 > Vector3D
NRpcCablingAlg reads raw condition data and writes derived condition data to the condition store.
Ensure that the ATLAS eigen extensions are properly loaded.