ATLAS Offline Software
MuonSegmentTagTool.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 MUONCOMBINEDBASETOOLS_MUONSEGMENTTAGTOOL_H
6 #define MUONCOMBINEDBASETOOLS_MUONSEGMENTTAGTOOL_H
7 
8 #include <array>
9 #include <atomic>
10 #include <string>
11 #include <vector>
12 
14 #include "GaudiKernel/ServiceHandle.h"
15 #include "GaudiKernel/ToolHandle.h"
32 namespace Muon {
33  class MuonSegment;
34 }
35 
36 namespace MuonCombined {
37 
38  class MuonSegmentTagTool : public AthAlgTool, virtual public IMuonSegmentTagTool {
39  using SegmentMap = std::map<const Muon::MuonSegment*, ElementLink<xAOD::MuonSegmentContainer>>;
41 
42  public:
43  MuonSegmentTagTool(const std::string& type, const std::string& name, const IInterface* parent);
44  ~MuonSegmentTagTool() = default;
45 
46  StatusCode initialize() override;
47  StatusCode finalize() override;
48 
50  void tag(const EventContext& ctx, const InDetCandidateCollection& inDetCandidates,
51  const std::vector<const Muon::MuonSegment*>& segments, InDetCandidateToTagMap* tagMap) const override;
52 
53  private:
54  void printTable(const std::vector<std::string>& didEx, const std::vector<std::string>& segStation,
55  const std::vector<std::vector<std::string>>& segToSurf) const;
56  std::vector<const Muon::MuonSegment*> getCandidateSegments(const std::vector<const Muon::MuonSegment*>& segments) const;
58 
61  using SortedSegmentMap = std::map<int, std::vector<const Muon::MuonSegment*>>;
63  SortedSegmentMap findPopulatedStations(const std::vector<const Muon::MuonSegment*>& filteredSegments) const;
64 
66  inline static double getPropDistance(const Trk::TrackParameters& start_pars, const Trk::Surface& target_surf);
67 
69  SortedSegmentMap findCandidateStations(const MuonCombined::InDetCandidate& Id_trk, const SortedSegmentMap& filteredSegments) const;
70 
71  ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc{this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"};
72  ServiceHandle<Muon::IMuonEDMHelperSvc> m_edmHelperSvc{this, "edmHelper", "Muon::MuonEDMHelperSvc/MuonEDMHelperSvc",
73  "Handle to the service providing the IMuonEDMHelperSvc interface"};
74 
75  ToolHandle<Muon::MuonEDMPrinterTool> m_printer{this, "Printer", "Muon::MuonEDMPrinterTool/MuonEDMPrinterTool"};
76  ToolHandle<IMuTagMatchingTool> m_MuTagMatchingTool{this, "MuTagMatchingTool", "MuTagMatchingTool/MuTagMatchingTool"};
77  ToolHandle<IMuTagAmbiguitySolverTool> m_MuTagAmbiguitySolverTool{this, "MuTagAmbiguitySolverTool",
78  "MuTagAmbiguitySolverTool/MuTagAmbiguitySolverTool"};
79 
80  ToolHandle<Muon::IMuonSegmentSelectionTool> m_segmentSelector{this, "MuonSegmentSelectionTool",
81  "Muon::MuonSegmentSelectionTool/MuonSegmentSelectionTool"};
82  ToolHandle<Muon::IMuonSegmentHitSummaryTool> m_hitSummaryTool{this, "MuonSegmentHitSummaryTool",
83  "Muon::MuonSegmentHitSummaryTool/MuonSegmentHitSummaryTool"};
84 
85  Gaudi::Property<bool> m_doSegmentsFilter{this, "DoSegmentsFilter", true, "flag to switch segment filtering on/off (for trigger)"};
86  Gaudi::Property<bool> m_doTable{this, "DoOverviewTable", false};
87  Gaudi::Property<bool> m_doBidirectional{this, "DoBidirectionalExtrapolation", false,
88  "flag to toggle to bidirectional extrapolation"};
89  Gaudi::Property<bool> m_doPtDependentPullCut{this, "DoPtDependentPullCut", false, "flag to enable the pT-dependent pull cut"};
90  Gaudi::Property<bool> m_removeLowPLowFieldRegion{this, "RemoveLowPLowFieldRegion", false,
91  "remove track with p < 6 GeV in eta 1.4-17 region (low p and low field)"};
92 
93  Gaudi::Property<int> m_segmentQualityCut{this, "SegmentQualityCut", 1, "minimum segment quality"};
94  Gaudi::Property<unsigned int> m_nmdtHits{this, "nmdtHits", 4};
95  Gaudi::Property<unsigned int> m_nmdtHoles{this, "nmdtHoles", 3};
96  Gaudi::Property<unsigned int> m_nmdtHitsML{this, "nmdtHitsML", 2};
97 
98  Gaudi::Property<bool> m_triggerHitCut{this, "TriggerHitCut", true, "apply Trigger hit cut if trigger hits are expected"};
99  Gaudi::Property<bool> m_ignoreSiAssocated{this, "IgnoreSiAssociatedCandidates", true,
100  "If true, ignore InDetCandidates which are SiAssociated"};
101 
105 
106  mutable std::atomic_uint m_ntotTracks{0};
107  mutable std::atomic_uint m_nangleMatch{0};
108  mutable std::atomic_uint m_npmatch{0};
109  mutable std::atomic_uint m_natMSEntrance{0};
110  mutable std::atomic_uint m_naccepted{0};
111  mutable std::array<std::atomic_uint, SurfDef::NumSurf> m_extrapolated ATLAS_THREAD_SAFE{0};
112  mutable std::array<std::atomic_uint, SurfDef::NumSurf> m_goodExtrapolated ATLAS_THREAD_SAFE{0};
113  mutable std::array<std::atomic_uint, SurfDef::NumSurf> m_recycledIntersect ATLAS_THREAD_SAFE{0};
114  };
115 
116 } // namespace MuonCombined
117 
118 #endif
MuonCombined::MuonSegmentTagTool::m_doBidirectional
Gaudi::Property< bool > m_doBidirectional
Definition: MuonSegmentTagTool.h:87
MuonCombined::MuonSegmentTagTool::m_segmentQualityCut
Gaudi::Property< int > m_segmentQualityCut
Definition: MuonSegmentTagTool.h:93
MuonCombined::MuonSegmentTagTool::m_nangleMatch
std::atomic_uint m_nangleMatch
Definition: MuonSegmentTagTool.h:107
MuonCombined::MuonSegmentTagTool::tag
void tag(const EventContext &ctx, const InDetCandidateCollection &inDetCandidates, const std::vector< const Muon::MuonSegment * > &segments, InDetCandidateToTagMap *tagMap) const override
IMuonSegmentTagTool interface: build muons from ID and MuonSegments.
Definition: MuonSegmentTagTool.cxx:87
MuonCombined::MuonSegmentTagTool::m_naccepted
std::atomic_uint m_naccepted
Definition: MuonSegmentTagTool.h:110
TrackParameters.h
MuonCombined::MuonSegmentTagTool::m_doPtDependentPullCut
Gaudi::Property< bool > m_doPtDependentPullCut
Definition: MuonSegmentTagTool.h:89
MuonEDMPrinterTool.h
MuonCombined::InDetCandidateToTagMap
Definition: InDetCandidateToTagMap.h:15
MuonCombined::MuonSegmentTagTool::m_idHelperSvc
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
Definition: MuonSegmentTagTool.h:71
MuonCombined::MuonSegmentTagTool::SegmentMap
std::map< const Muon::MuonSegment *, ElementLink< xAOD::MuonSegmentContainer > > SegmentMap
Definition: MuonSegmentTagTool.h:39
MuonCombined::MuonSegmentTagTool::m_hitSummaryTool
ToolHandle< Muon::IMuonSegmentHitSummaryTool > m_hitSummaryTool
Definition: MuonSegmentTagTool.h:82
MuonCombined::IMuonSegmentTagTool
interface for tools building muons from ID and MuonSegments
Definition: IMuonSegmentTagTool.h:24
MuonCombined::MuonSegmentTagTool::findPopulatedStations
SortedSegmentMap findPopulatedStations(const std::vector< const Muon::MuonSegment * > &filteredSegments) const
Creates the sorted segment map.
Definition: MuonSegmentTagTool.cxx:553
IMuTagMatchingTool.h
MuonCombined::InDetCandidate
Definition: InDetCandidate.h:18
PropDirection.h
MuonCombined::MuonSegmentTagTool::m_surfaces
const MuonCombined::MuonSegmentTagSurfaces m_surfaces
Definition: MuonSegmentTagTool.h:102
Muon
This class provides conversion from CSC RDO data to CSC Digits.
Definition: TrackSystemController.h:49
MuonCombined::MuonSegmentTagTool::m_nmdtHits
Gaudi::Property< unsigned int > m_nmdtHits
Definition: MuonSegmentTagTool.h:94
MuonSegmentInfo.h
xAOD::MuonSegment
MuonSegment_v1 MuonSegment
Reference the current persistent version:
Definition: Event/xAOD/xAODMuon/xAODMuon/MuonSegment.h:13
MuonCombined::MuonSegmentTagTool::initialize
StatusCode initialize() override
Definition: MuonSegmentTagTool.cxx:54
MuonSegmentContainer.h
MuonCombined::MuonSegmentTagTool::m_MuTagMatchingTool
ToolHandle< IMuTagMatchingTool > m_MuTagMatchingTool
Definition: MuonSegmentTagTool.h:76
MuonCombined::MuonSegmentTagTool::m_edmHelperSvc
ServiceHandle< Muon::IMuonEDMHelperSvc > m_edmHelperSvc
Definition: MuonSegmentTagTool.h:72
MuonCombined::MuonSegmentTagTool::m_ntotTracks
std::atomic_uint m_ntotTracks
Definition: MuonSegmentTagTool.h:106
MuonCombined::MuonSegmentTagTool::m_nmdtHitsML
Gaudi::Property< unsigned int > m_nmdtHitsML
Definition: MuonSegmentTagTool.h:96
MuonCombined::MuonSegmentTagTool::m_triggerHitCut
Gaudi::Property< bool > m_triggerHitCut
Definition: MuonSegmentTagTool.h:98
MuonCombined::MuonSegmentTagTool::MuonSegmentTagTool
MuonSegmentTagTool(const std::string &type, const std::string &name, const IInterface *parent)
Definition: MuonSegmentTagTool.cxx:49
MuonSegmentTagSurfaces.h
MuonCombined::MuonSegmentTagTool::m_sectorMapping
const Muon::MuonSectorMapping m_sectorMapping
sector mapping helper
Definition: MuonSegmentTagTool.h:104
MuonCombined::MuonSegmentTagTool::findCandidateStations
SortedSegmentMap findCandidateStations(const MuonCombined::InDetCandidate &Id_trk, const SortedSegmentMap &filteredSegments) const
Returns an array encoding which muon segments are compatible with the IdCandidate.
Definition: MuonSegmentTagTool.cxx:566
MuonCombined::MuonSegmentTagTool::m_doSegmentsFilter
Gaudi::Property< bool > m_doSegmentsFilter
Definition: MuonSegmentTagTool.h:85
IMuonSegmentSelectionTool.h
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
MuonCombined::MuonSegmentTagTool::m_doTable
Gaudi::Property< bool > m_doTable
Definition: MuonSegmentTagTool.h:86
AthAlgTool.h
test_pyathena.parent
parent
Definition: test_pyathena.py:15
MuonCombined::MuonSegmentTagTool::m_MuTagAmbiguitySolverTool
ToolHandle< IMuTagAmbiguitySolverTool > m_MuTagAmbiguitySolverTool
Definition: MuonSegmentTagTool.h:77
MuonCombined::MuonSegmentTagTool::m_segmentSelector
ToolHandle< Muon::IMuonSegmentSelectionTool > m_segmentSelector
Definition: MuonSegmentTagTool.h:80
Trk::ParametersBase
Definition: ParametersBase.h:55
DataVector
Derived DataVector<T>.
Definition: DataVector.h:581
MuonCombined::MuonSegmentTagTool::SortedSegmentMap
std::map< int, std::vector< const Muon::MuonSegment * > > SortedSegmentMap
The segment vector is sorted into a map where the key is the associated surface definition of each se...
Definition: MuonSegmentTagTool.h:61
MuonCombined::MuonSegmentTagTool::printTable
void printTable(const std::vector< std::string > &didEx, const std::vector< std::string > &segStation, const std::vector< std::vector< std::string >> &segToSurf) const
method for extra DEBUG
Definition: MuonSegmentTagTool.cxx:464
MuonCombined::MuonSegmentTagSurfaces
Definition: MuonSegmentTagSurfaces.h:21
IMuonEDMHelperSvc.h
MuonCombined::MuonSegmentTagTool::m_nmdtHoles
Gaudi::Property< unsigned int > m_nmdtHoles
Definition: MuonSegmentTagTool.h:95
MuonCombined::MuonSegmentTagTool::ATLAS_THREAD_SAFE
std::array< std::atomic_uint, SurfDef::NumSurf > m_extrapolated ATLAS_THREAD_SAFE
Definition: MuonSegmentTagTool.h:111
MuonCombined::MuonSegmentTagTool::finalize
StatusCode finalize() override
Definition: MuonSegmentTagTool.cxx:71
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:192
MuonCombined::MuonSegmentTagSurfaces::SurfDef
SurfDef
Definition: MuonSegmentTagSurfaces.h:23
MuonCombined::MuonSegmentTagTool::getPropDistance
static double getPropDistance(const Trk::TrackParameters &start_pars, const Trk::Surface &target_surf)
Returns the straight line distance estimation of the parameters to the surface.
Definition: MuonSegmentTagTool.cxx:626
MuonCombined::MuonSegmentTagTool::m_ignoreSiAssocated
Gaudi::Property< bool > m_ignoreSiAssocated
Definition: MuonSegmentTagTool.h:99
IMuonSegmentTagTool.h
IMuTagAmbiguitySolverTool.h
IParticleCaloExtensionTool.h
MuonCombined::MuonSegmentTagTool::m_natMSEntrance
std::atomic_uint m_natMSEntrance
Definition: MuonSegmentTagTool.h:109
MuonCombined::MuonSegmentTagTool::m_printer
ToolHandle< Muon::MuonEDMPrinterTool > m_printer
Definition: MuonSegmentTagTool.h:75
MuonSectorMapping.h
MuonCombined::MuonSegmentTagTool::m_npmatch
std::atomic_uint m_npmatch
Definition: MuonSegmentTagTool.h:108
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
MuonCombined
The MuonTagToSegMap is an auxillary construct that links the MuonSegments associated with a combined ...
Definition: IMuonSystemExtensionTool.h:23
MuonCombined::MuonSegmentTagTool::~MuonSegmentTagTool
~MuonSegmentTagTool()=default
Muon::MuonSectorMapping
Definition: MuonSectorMapping.h:20
InDetCandidateCollection.h
MuonCombined::MuonSegmentTagTool::m_removeLowPLowFieldRegion
Gaudi::Property< bool > m_removeLowPLowFieldRegion
Definition: MuonSegmentTagTool.h:90
AthAlgTool
Definition: AthAlgTool.h:26
IMuonSegmentHitSummaryTool.h
MuonCombined::MuonSegmentTagTool
Definition: MuonSegmentTagTool.h:38
Trk::Surface
Definition: Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/Surface.h:75
IMuonIdHelperSvc.h
MuonCombined::MuonSegmentTagTool::getCandidateSegments
std::vector< const Muon::MuonSegment * > getCandidateSegments(const std::vector< const Muon::MuonSegment * > &segments) const
Filters the input segments based on the number of hits fit quality etc.
Definition: MuonSegmentTagTool.cxx:504
ServiceHandle< Muon::IMuonIdHelperSvc >