ATLAS Offline Software
CombinatorialNSWSeedFinderAlg.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef MUONR4_MUONPATTERNRECOGNITIONALGS_COMBINATORIALNSWSEEDFINDERALG_H
6 #define MUONR4_MUONPATTERNRECOGNITIONALGS_COMBINATORIALNSWSEEDFINDERALG_H
7 
11 
14 
20 
21 #include <span>
22 #include <vector>
23 
24 
25 namespace MuonR4{
26 
27 
29 
30  public:
31  using AthReentrantAlgorithm::AthReentrantAlgorithm;
32  virtual ~CombinatorialNSWSeedFinderAlg() = default;
33  virtual StatusCode initialize() override;
34  virtual StatusCode execute(const EventContext& ctx) const override;
35 
36  private:
37 
39  enum class StripOrient{
40  U,
41  V,
42  X,
43  Unknown
44  };
46  StripOrient classifyStrip(const SpacePoint& spacePoint) const;
47 
49 
52  using HitLaySpan_t = std::vector<std::reference_wrapper<const HitVec>>;
54  using UsedHitMarker_t = std::vector<std::vector<char>>;
56  using UsedHitSpan_t = std::vector<std::reference_wrapper<std::vector<char>>>;
58  using InitialSeed_t = std::array<const SpacePoint*, 4>;
60  using InitialSeedVec_t = std::vector<InitialSeed_t>;
63  UsedHitMarker_t emptyBookKeeper(const HitLayVec& sortedSp) const;
69  enum class HitWindow{tooLow,
70  inside,
71  tooHigh};
72 
80  HitWindow hitFromIPCorridor(const SpacePoint& testHit,
81  const Amg::Vector3D& beamSpotPos,
82  const Amg::Vector3D& dirEstUp,
83  const Amg::Vector3D& dirEstDn) const;
93  const HitLaySpan_t& combinatoricLayers,
94  const UsedHitSpan_t& usedHits,
95  InitialSeedVec_t& outVec) const;
103  std::unique_ptr<SegmentSeed> buildSegmentSeed(const InitialSeed_t& initialSeed,
104  const AmgSymMatrix(2)& bMatrix,
105  const HoughMaximum& max,
106  const HitLaySpan_t& extensionLayers,
107  const UsedHitSpan_t& usedHits) const;
108  void markHitsAsUsed(const SegmentSeed& seed,
109  const HitLayVec& allSortHits,
110  UsedHitMarker_t& usedHitMarker) const;
111  //extend the seed with compatilbe hits using extrapolation to the layers
112  HitVec extendHits(const Amg::Vector3D& startPos,
113  const Amg::Vector3D& direction,
114  const HitLaySpan_t& extensionLayers,
115  const UsedHitSpan_t& usedHits) const;
116 
117  // read handle key for the input maxima (from a previous eta-transform)
118  SG::ReadHandleKey<EtaHoughMaxContainer> m_etaKey{this, "CombinatorialReadKey", "MuonHoughNswMaxima"};
119 
120  // write handle key for the otuput
121  SG::WriteHandleKey<SegmentSeedContainer> m_writeKey{this, "CombinatorialPhiWriteKey", "MuonHoughNswSegmentSeeds"};
122 
123  // access to the ACTS geometry context
124  SG::ReadHandleKey<ActsGeometryContext> m_geoCtxKey{this, "AlignmentKey", "ActsAlignment", "cond handle key"};
125 
126  // access to the Muon Id Helper
127  ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"};
128 
129  //build and return seeds from the same eta maximum
130  std::vector<std::unique_ptr<SegmentSeed>>
132  const ActsGeometryContext& gctx) const;
133 
134  //the window in theta to search for hits in the seed extension
135  DoubleProperty m_windowTheta {this, "thetaWindow", 0.5 * Gaudi::Units::deg};
136 
137  //apply a cut threshold in the pulls during the hit extension
138  DoubleProperty m_minPullThreshold{this, "maxPull", 5.};
139 
141  ToolHandle<MuonValR4::IPatternVisualizationTool> m_visionTool{this, "VisualizationTool", ""};
142 
143 
144 
145 
146 
147 };
148 
149 }
150 
151 #endif
MuonR4::CombinatorialNSWSeedFinderAlg::HitWindow
HitWindow
To fastly check whether a hit is roughly compatible with a muon trajectory a narrow corridor is opene...
Definition: CombinatorialNSWSeedFinderAlg.h:69
IPatternVisualizationTool.h
MuonR4::CombinatorialNSWSeedFinderAlg::extendHits
HitVec extendHits(const Amg::Vector3D &startPos, const Amg::Vector3D &direction, const HitLaySpan_t &extensionLayers, const UsedHitSpan_t &usedHits) const
Definition: CombinatorialNSWSeedFinderAlg.cxx:230
MuonR4::CombinatorialNSWSeedFinderAlg::initialize
virtual StatusCode initialize() override
Definition: CombinatorialNSWSeedFinderAlg.cxx:65
MuonR4::CombinatorialNSWSeedFinderAlg::buildSegmentSeed
std::unique_ptr< SegmentSeed > buildSegmentSeed(const InitialSeed_t &initialSeed, const AmgSymMatrix(2)&bMatrix, const HoughMaximum &max, const HitLaySpan_t &extensionLayers, const UsedHitSpan_t &usedHits) const
Build the final seed from the initial seed hits and then attempt to append hits from the complementar...
Definition: CombinatorialNSWSeedFinderAlg.cxx:283
MuonR4::SpacePointPerLayerSplitter::HitLayVec
std::vector< HitVec > HitLayVec
Definition: SpacePointPerLayerSplitter.h:19
MuonR4::CombinatorialNSWSeedFinderAlg::hitFromIPCorridor
HitWindow hitFromIPCorridor(const SpacePoint &testHit, const Amg::Vector3D &beamSpotPos, const Amg::Vector3D &dirEstUp, const Amg::Vector3D &dirEstDn) const
The hit is above the predefined corridor.
Definition: CombinatorialNSWSeedFinderAlg.cxx:108
max
constexpr double max()
Definition: ap_fixedTest.cxx:33
MuonR4::CombinatorialNSWSeedFinderAlg::constructPrelimnarySeeds
void constructPrelimnarySeeds(const Amg::Vector3D &beamSpot, const HitLaySpan_t &combinatoricLayers, const UsedHitSpan_t &usedHits, InitialSeedVec_t &outVec) const
Construct a set of prelimnary seeds from the selected combinatoric layers.
Definition: CombinatorialNSWSeedFinderAlg.cxx:181
deg
#define deg
Definition: SbPolyhedron.cxx:17
MuonR4::CombinatorialNSWSeedFinderAlg::StripOrient::Unknown
@ Unknown
Ordinary eta strips.
MuonR4::CombinatorialNSWSeedFinderAlg::m_visionTool
ToolHandle< MuonValR4::IPatternVisualizationTool > m_visionTool
Pattern visualization tool.
Definition: CombinatorialNSWSeedFinderAlg.h:141
SG::ReadHandleKey
Property holding a SG store/key/clid from which a ReadHandle is made.
Definition: StoreGate/StoreGate/ReadHandleKey.h:39
MuonR4::CombinatorialNSWSeedFinderAlg::classifyStrip
StripOrient classifyStrip(const SpacePoint &spacePoint) const
Determines the orientation of the strip space point.
Definition: CombinatorialNSWSeedFinderAlg.cxx:90
MuonR4::SpacePointPerLayerSplitter::HitVec
std::vector< const SpacePoint * > HitVec
Definition: SpacePointPerLayerSplitter.h:18
MuonR4::CombinatorialNSWSeedFinderAlg::StripOrient::X
@ X
Stereo strips with negative angle.
MuonR4::CombinatorialNSWSeedFinderAlg
Definition: CombinatorialNSWSeedFinderAlg.h:28
MuonR4::CombinatorialNSWSeedFinderAlg::HitWindow::inside
@ inside
The hit is below the predefined corridor.
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition: AthReentrantAlgorithm.h:74
MuonR4::CombinatorialNSWSeedFinderAlg::InitialSeedVec_t
std::vector< InitialSeed_t > InitialSeedVec_t
Vector of initial seeds.
Definition: CombinatorialNSWSeedFinderAlg.h:60
MuonR4::CombinatorialNSWSeedFinderAlg::~CombinatorialNSWSeedFinderAlg
virtual ~CombinatorialNSWSeedFinderAlg()=default
SpacePointPerLayerSplitter.h
MuonR4::CombinatorialNSWSeedFinderAlg::m_geoCtxKey
SG::ReadHandleKey< ActsGeometryContext > m_geoCtxKey
Definition: CombinatorialNSWSeedFinderAlg.h:124
MuonR4::CombinatorialNSWSeedFinderAlg::HitLayVec
SpacePointPerLayerSplitter::HitLayVec HitLayVec
Definition: CombinatorialNSWSeedFinderAlg.h:50
SG::WriteHandleKey
Property holding a SG store/key/clid from which a WriteHandle is made.
Definition: StoreGate/StoreGate/WriteHandleKey.h:40
MuonR4::CombinatorialNSWSeedFinderAlg::HitWindow::tooHigh
@ tooHigh
The hit is inside the defined window and hence an initial candidate.
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
MuonPatternContainer.h
MuonDetectorManager.h
MuonR4::CombinatorialNSWSeedFinderAlg::StripOrient::U
@ U
MuonR4::CombinatorialNSWSeedFinderAlg::m_writeKey
SG::WriteHandleKey< SegmentSeedContainer > m_writeKey
Definition: CombinatorialNSWSeedFinderAlg.h:121
MmIdHelper.h
MuonR4::CombinatorialNSWSeedFinderAlg::emptyBookKeeper
UsedHitMarker_t emptyBookKeeper(const HitLayVec &sortedSp) const
Constructs an empty HitMarker from the split space points.
Definition: CombinatorialNSWSeedFinderAlg.cxx:81
MuonR4::CombinatorialNSWSeedFinderAlg::InitialSeed_t
std::array< const SpacePoint *, 4 > InitialSeed_t
Abbrivation of the
Definition: CombinatorialNSWSeedFinderAlg.h:58
MuonR4::CombinatorialNSWSeedFinderAlg::UsedHitMarker_t
std::vector< std::vector< char > > UsedHitMarker_t
Abbrivation of the container book keeping whether a hit is used or not.
Definition: CombinatorialNSWSeedFinderAlg.h:54
MuonR4::CombinatorialNSWSeedFinderAlg::HitWindow::tooLow
@ tooLow
ActsGeometryContext
Include the GeoPrimitives which need to be put first.
Definition: ActsGeometryContext.h:27
MuonR4::SpacePoint
The muon space point is the combination of two uncalibrated measurements one of them measures the eta...
Definition: MuonSpectrometer/MuonPhaseII/Event/MuonSpacePoint/MuonSpacePoint/SpacePoint.h:19
ReadCondHandleKey.h
AthReentrantAlgorithm.h
WriteHandleKey.h
Property holding a SG store/key/clid from which a WriteHandle is made.
MuonHoughDefs.h
MuonR4::CombinatorialNSWSeedFinderAlg::UsedHitSpan_t
std::vector< std::reference_wrapper< std::vector< char > >> UsedHitSpan_t
Abbrivation of the container to pass a subset of markers wtihout copy.
Definition: CombinatorialNSWSeedFinderAlg.h:56
MuonR4::CombinatorialNSWSeedFinderAlg::m_windowTheta
DoubleProperty m_windowTheta
Definition: CombinatorialNSWSeedFinderAlg.h:135
MuonR4::CombinatorialNSWSeedFinderAlg::StripOrient::V
@ V
Stereo strips with positive angle.
MuonR4::HitVec
SpacePointPerLayerSplitter::HitVec HitVec
Definition: SpacePointPerLayerSplitter.cxx:12
MuonR4::CombinatorialNSWSeedFinderAlg::execute
virtual StatusCode execute(const EventContext &ctx) const override
Definition: CombinatorialNSWSeedFinderAlg.cxx:432
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
MuonR4::CombinatorialNSWSeedFinderAlg::m_idHelperSvc
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
Definition: CombinatorialNSWSeedFinderAlg.h:127
MuonR4::CombinatorialNSWSeedFinderAlg::m_etaKey
SG::ReadHandleKey< EtaHoughMaxContainer > m_etaKey
Definition: CombinatorialNSWSeedFinderAlg.h:118
MuonR4::CombinatorialNSWSeedFinderAlg::StripOrient
StripOrient
Enumeration to classify the orientation of a NSW strip
Definition: CombinatorialNSWSeedFinderAlg.h:39
MuonR4
This header ties the generic definitions in this package.
Definition: HoughEventData.h:16
MuonR4::CombinatorialNSWSeedFinderAlg::markHitsAsUsed
void markHitsAsUsed(const SegmentSeed &seed, const HitLayVec &allSortHits, UsedHitMarker_t &usedHitMarker) const
Definition: CombinatorialNSWSeedFinderAlg.cxx:414
MuonR4::HoughMaximum
Data class to represent an eta maximum in hough space.
Definition: HoughMaximum.h:14
SpacePointContainer.h
MuonR4::CombinatorialNSWSeedFinderAlg::HitVec
SpacePointPerLayerSplitter::HitVec HitVec
Definition: CombinatorialNSWSeedFinderAlg.h:48
MuonR4::SegmentSeed
Representation of a segment seed (a fully processed hough maximum) produced by the hough transform.
Definition: SegmentSeed.h:14
python.BuildSignatureFlags.beamSpot
AthConfigFlags beamSpot(AthConfigFlags flags, str instanceName, str recoMode)
Definition: BuildSignatureFlags.py:475
MuonR4::AmgSymMatrix
const AmgSymMatrix(2) &SpacePoint
Definition: MuonSpectrometer/MuonPhaseII/Event/MuonSpacePoint/src/SpacePoint.cxx:90
MuonR4::CombinatorialNSWSeedFinderAlg::HitLaySpan_t
std::vector< std::reference_wrapper< const HitVec > > HitLaySpan_t
Abbrivation of the space comprising multiple hit vectors without copy.
Definition: CombinatorialNSWSeedFinderAlg.h:52
MuonR4::CombinatorialNSWSeedFinderAlg::findSeedsFromMaximum
std::vector< std::unique_ptr< SegmentSeed > > findSeedsFromMaximum(const HoughMaximum &max, const ActsGeometryContext &gctx) const
Definition: CombinatorialNSWSeedFinderAlg.cxx:321
ServiceHandle< Muon::IMuonIdHelperSvc >
MuonR4::CombinatorialNSWSeedFinderAlg::m_minPullThreshold
DoubleProperty m_minPullThreshold
Definition: CombinatorialNSWSeedFinderAlg.h:138