ATLAS Offline Software
SegmentSelectionTool.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3 */
4 #include "SegmentSelectionTool.h"
6 
7 namespace {
8  using LayIdx_t = Muon::MuonStationIndex::LayerIndex;
9 }
10 
11 
12 namespace MuonR4{
13 
15  ATH_CHECK(m_idHelperSvc.retrieve());
16  return StatusCode::SUCCESS;
17  }
18  bool SegmentSelectionTool::passSeedingQuality(const EventContext& /* ctx*/,
19  const Segment& segment) const {
20  const HitSummary& summary = segment.summary();
21 
22  switch (summary.tech) {
24  if (summary.nPrecHits < m_nMdtSeedHitCut || summary.nPrecOutlier > m_nMdtSeedOutlierCut){
25  return false;
26  }
27  const LayIdx_t layIdx {Muon::MuonStationIndex::toLayerIndex(segment.msSector()->chamberIndex())};
29  if (segment.msSector()->barrel()) {
30  switch (layIdx) {
31  case LayIdx_t::Inner:
32  case LayIdx_t::BarrelExtended:
33  return summary.nPhiHits >= m_nRpcPhiSeedHitCutBI;
34  case LayIdx_t::Middle:
35  return summary.nPhiHits >= m_nRpcPhiSeedHitCutBM;
36  case LayIdx_t::Outer:
37  return summary.nPhiHits >= m_nRpcPhiSeedHitCutBO;
38  default:
39  break;
40  }
41  } else {
43  switch (layIdx) {
44  case LayIdx_t::Inner:
45  case LayIdx_t::Extended:
46  return summary.nPhiHits >= m_nTgcPhiSeedHitCutEI;
47  case LayIdx_t::Middle:
48  return summary.nPhiHits >= m_nTgcPhiSeedHitCutEM;
49  default:
50  break;
51  }
52  }
53  break;
54  }
57  ATH_MSG_ALWAYS(__FILE__<<":"<<__LINE__<<" Implement me");
58  break;
59  }
60  default:
61  break;
62  }
63  return false;
64  }
65 
66  bool SegmentSelectionTool::passTrackQuality(const EventContext& /*ctx*/,
67  const Segment& segment) const {
68  const HitSummary& summary = segment.summary();
69  switch (summary.tech) {
71  return summary.nPrecHits >= m_nMdtMinHitCut;
72  }
75  ATH_MSG_ALWAYS(__FILE__<<":"<<__LINE__<<" Implement me");
76  break;
77  }
78  default:
79  break;
80  }
81  return false;
82  }
83  bool SegmentSelectionTool::compatibleForTrack(const EventContext& /*ctx*/,
84  const Segment& segA,
85  const Segment& segB) const {
87  if(segA.msSector() == segB.msSector()) {
88  return false;
89  }
91  const unsigned secMax = Muon::MuonStationIndex::numberOfSectors();
92  const unsigned deltaSec = std::abs(segA.msSector()->sector() - segB.msSector()->sector()) % secMax;
93  if (deltaSec > 1) {
94  return false;
95  }
96  const HitSummary& sumA = segA.summary();
97  const HitSummary& sumB = segB.summary();
99  if (!sumA.nPhiHits && !sumB.nPhiHits) {
100  return true;
101  }
104  else if (sumA.nPhiHits && !sumB.nPhiHits) {
105  if (!m_sectorMap.insideSector(segB.msSector()->sector(), segA.position().phi())){
106  return false;
107  }
108  } else if (!sumA.nPhiHits && sumB.nPhiHits) {
109  if (!m_sectorMap.insideSector(segA.msSector()->sector(), segB.position().phi())) {
110  return false;
111  }
112  }
114  else {
116  const double dPhi = std::abs(segA.position().deltaPhi(segB.position()));
117  if (dPhi > 5. * Gaudi::Units::deg) {
118  return false;
119  }
120  }
121  return true;
122  }
123 
124 }
Muon::MuonStationIndex::LayerIndex
LayerIndex
enum to classify the different layers in the muon spectrometer
Definition: MuonStationIndex.h:38
MuonR4::Segment::summary
const HitSummary & summary() const
Returns the hit summary.
Definition: MuonSpectrometer/MuonPhaseII/Event/MuonPatternEvent/MuonPatternEvent/Segment.h:74
MuonGMR4::SpectrometerSector::sector
int sector() const
Returns the sector of the MS-sector.
Definition: SpectrometerSector.cxx:64
MuonR4::SegmentSelectionTool::m_nMdtSeedOutlierCut
Gaudi::Property< unsigned > m_nMdtSeedOutlierCut
Cont on maximum number of outlies to consider the segment for seeding.
Definition: SegmentSelectionTool.h:40
MuonR4::SegmentSelectionTool::compatibleForTrack
virtual bool compatibleForTrack(const EventContext &ctx, const Segment &segA, const Segment &segB) const override final
Definition: SegmentSelectionTool.cxx:83
SegmentSelectionTool.h
MuonR4::Segment
Placeholder for what will later be the muon segment EDM representation.
Definition: MuonSpectrometer/MuonPhaseII/Event/MuonPatternEvent/MuonPatternEvent/Segment.h:19
xAOD::UncalibMeasType::MMClusterType
@ MMClusterType
deg
#define deg
Definition: SbPolyhedron.cxx:17
MuonR4::SegmentSelectionTool::passTrackQuality
virtual bool passTrackQuality(const EventContext &ctx, const Segment &segment) const override final
Definition: SegmentSelectionTool.cxx:66
xAOD::UncalibMeasType::sTgcStripType
@ sTgcStripType
Muon::MuonStationIndex::numberOfSectors
constexpr unsigned numberOfSectors()
return total number of sectors
Definition: MuonStationIndex.h:118
MuonR4::Segment::position
const Amg::Vector3D & position() const
Returns the global segment position.
Definition: MuonSpectrometer/MuonPhaseII/Event/MuonPatternEvent/MuonPatternEvent/Segment.h:41
Muon::MuonSectorMapping::insideSector
bool insideSector(int sector, double phi) const
checks whether the phi position is consistent with sector
Definition: MuonSectorMapping.h:74
MuonR4::SegmentSelectionTool::m_nRpcPhiSeedHitCutBI
Gaudi::Property< unsigned > m_nRpcPhiSeedHitCutBI
Minimum number of Rpc phi hits in BI to consider the segment for seeding.
Definition: SegmentSelectionTool.h:42
MuonR4::SegmentSelectionTool::m_idHelperSvc
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
IdHelperSvc to decode the Identifiers.
Definition: SegmentSelectionTool.h:34
MuonR4::SegmentSelectionTool::m_sectorMap
const Muon::MuonSectorMapping m_sectorMap
Definition: SegmentSelectionTool.h:52
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
TauGNNUtils::Variables::Track::dPhi
bool dPhi(const xAOD::TauJet &tau, const xAOD::TauTrack &track, double &out)
Definition: TauGNNUtils.cxx:549
ATH_MSG_ALWAYS
#define ATH_MSG_ALWAYS(x)
Definition: AthMsgStreamMacros.h:35
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
MuonR4::SegmentSelectionTool::passSeedingQuality
virtual bool passSeedingQuality(const EventContext &ctx, const Segment &segment) const override final
Definition: SegmentSelectionTool.cxx:18
MuonR4::Segment::msSector
const MuonGMR4::SpectrometerSector * msSector() const
Returns the associated MS sector.
Definition: MuonSpectrometer/MuonPhaseII/Event/MuonPatternEvent/MuonPatternEvent/Segment.h:39
MuonR4::SegmentSelectionTool::m_nMdtSeedHitCut
Gaudi::Property< unsigned > m_nMdtSeedHitCut
Cut on minimum number of Mdt hits to consider the segment for seeding
Definition: SegmentSelectionTool.h:36
MuonR4::SegmentSelectionTool::m_nRpcPhiSeedHitCutBO
Gaudi::Property< unsigned > m_nRpcPhiSeedHitCutBO
Minimum number of Rpc phi hits in BO to consider the segment for seeding.
Definition: SegmentSelectionTool.h:46
MuonR4::SegmentSelectionTool::m_nRpcPhiSeedHitCutBM
Gaudi::Property< unsigned > m_nRpcPhiSeedHitCutBM
Minimum number of Rpc phi hits in BM to consider the segment for seeding.
Definition: SegmentSelectionTool.h:44
sTgcMeasurement.h
MuonR4::SegmentSelectionTool::initialize
virtual StatusCode initialize() override final
Definition: SegmentSelectionTool.cxx:14
MuonR4
This header ties the generic definitions in this package.
Definition: HoughEventData.h:16
MuonR4::Segment::HitSummary
Helper struct to summarize the hit count
Definition: MuonSpectrometer/MuonPhaseII/Event/MuonPatternEvent/MuonPatternEvent/Segment.h:61
Muon::MuonStationIndex::toLayerIndex
LayerIndex toLayerIndex(ChIndex index)
convert ChIndex into LayerIndex
MuonR4::Segment::HitSummary::nPhiHits
unsigned nPhiHits
Number of good Rpc / Tgc / sTgc phi hits.
Definition: MuonSpectrometer/MuonPhaseII/Event/MuonPatternEvent/MuonPatternEvent/Segment.h:67
MuonR4::SegmentSelectionTool::m_nTgcPhiSeedHitCutEM
Gaudi::Property< unsigned > m_nTgcPhiSeedHitCutEM
Minimum number of Tgc phi hits in EM to consider the segment for seeding.
Definition: SegmentSelectionTool.h:50
xAOD::UncalibMeasType::MdtDriftCircleType
@ MdtDriftCircleType
MuonR4::SegmentSelectionTool::m_nMdtMinHitCut
Gaudi::Property< unsigned > m_nMdtMinHitCut
Cut on minimum number of Mdt hits to consider the segment for tracking.
Definition: SegmentSelectionTool.h:38
MuonR4::SegmentSelectionTool::m_nTgcPhiSeedHitCutEI
Gaudi::Property< unsigned > m_nTgcPhiSeedHitCutEI
Minimum number of Tgc phi hits in EI to consider the segment for seeding.
Definition: SegmentSelectionTool.h:48
NSWL1::PadTriggerAdapter::segment
Muon::NSW_PadTriggerSegment segment(const NSWL1::PadTrigger &data)
Definition: PadTriggerAdapter.cxx:5
SCT_Monitoring::summary
@ summary
Definition: SCT_MonitoringNumbers.h:65