ATLAS Offline Software
Loading...
Searching...
No Matches
MuonFastReconstructionAlg.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
6
7namespace MuonR4{
8using namespace FastReco;
10
12 if (m_outSpacePoints.size() != m_inSpacePoints.size()) {
13 m_outSpacePoints.clear();
14 for (const auto& key: m_inSpacePoints) {
15 m_outSpacePoints.emplace_back(key.key() + m_outSpacePointSuffix);
16 }
17 }
18 ATH_CHECK(m_inSpacePoints.initialize());
19 ATH_CHECK(m_outSpacePoints.initialize());
20 ATH_CHECK(m_outPatterns.initialize());
21
22 ATH_CHECK(m_geoCtxKey.initialize());
23 ATH_CHECK(m_idHelperSvc.retrieve());
24 ATH_CHECK(m_visionTool.retrieve(EnableTool{!m_visionTool.empty()}));
25
27 patCfg.useMdtHits = m_useMdtHits;
40
41 if (m_seedFromInner) {
42 patCfg.layerSeedings.push_back(LayerIndex::Inner);
43 }
44 patCfg.visionTool = m_visionTool.get();
45 patCfg.idHelperSvc = m_idHelperSvc.get();
46 m_globPatFinder = std::make_unique<GlobalPatternFinder>(name(), std::move(patCfg));
47
48 //Print Configuration
49 ATH_MSG_DEBUG(" Configuration:\n"
50 << " Theta search window [rad]: " << m_thetaSearchWindow << "\n"
51 << " Base R window [mm]: " << m_baseRWindow << "\n"
52 << " Max missed layer hits in station: " << m_maxMissLayersInStation << "\n"
53 << " Min layer separation [mm]: " << m_minLayerSeparation << "\n"
54 << " Phi tolerance [rad]: " << m_phiTolerance << "\n"
55 << " Min trigger layers: " << m_minTriggerLayers << "\n"
56 << " Min precision layers: " << m_minPrecisionLayers << "\n"
57 << " Min phi layers: " << m_minPhiLayers << "\n"
58 << " Min station layers: " << m_minStationLayers << "\n"
59 << " Mean norm residual^2 cut: " << m_meanNormRes2Cut << "\n"
60 << " Seed from inner: " << m_seedFromInner << "\n"
61 << " Use MDT hits: " << m_useMdtHits << "\n"
62 << " Seed from MDT: " << m_seedFromMdt << "\n"
63 << " Max seed attempts: " << m_maxSeedAttempts << "\n");
64
65 return StatusCode::SUCCESS;
66}
67
68StatusCode FastReconstructionAlg::execute(const EventContext& ctx) const {
69 SpacePointContainerVec inSpacePoints{};
70 inSpacePoints.reserve(m_inSpacePoints.size());
71 for (const auto& key: m_inSpacePoints) {
72 auto& spc = inSpacePoints.emplace_back(nullptr);
73 ATH_CHECK(SG::get(spc, key, ctx));
74 ATH_MSG_DEBUG("Reading " << spc->size() << " SP buckets from collection: " << key);
75 }
76
77 const ActsTrk::GeometryContext* gctx{nullptr};
78 ATH_CHECK(SG::get(gctx, m_geoCtxKey, ctx));
79
80 using BucketPerContainer = GlobalPatternFinder::BucketPerContainer;
81 BucketPerContainer outBuckets{};
82 for (const SpacePointContainer* inSpc : inSpacePoints) {
83 outBuckets.emplace(inSpc, BucketPerContainer::mapped_type{});
84 }
85 PatternVec patterns {m_globPatFinder->findPatterns(*gctx, inSpacePoints, outBuckets)};
86
88 for (size_t idx = 0; idx < inSpacePoints.size(); ++idx) {
89 const SpacePointContainer* inSpc = inSpacePoints.at(idx);
90 const auto& outBucketVec = outBuckets.at(inSpc);
91
93 ATH_CHECK(writeHandle.record(std::make_unique<SpacePointContainer>()));
94
95 for (const SpacePointBucket* bucket : outBucketVec) {
96 writeHandle->push_back(std::make_unique<SpacePointBucket>(*bucket));
97 }
98
99 ATH_MSG_DEBUG("Written " << writeHandle->size()
100 << " SP Buckets into StoreGate with key "
101 << m_outSpacePoints.at(idx));
102 }
105 ATH_CHECK(writeHandle.record(std::make_unique<GlobalPatternContainer>()));
106 for (const GlobalPattern& pat : patterns) {
107 writeHandle->push_back(std::make_unique<GlobalPattern>(pat));
108 }
109 ATH_MSG_DEBUG("Written "<<writeHandle->size()<<" GlobalPatterns into StoreGate.");
110
111 /* Consume the patterns to build muon candidates. WORK IN PROGRESS */
112 return StatusCode::SUCCESS;
113}
114
115
116}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_DEBUG(x)
std::unordered_map< const SpacePointContainer *, std::vector< const SpacePointBucket * > > BucketPerContainer
Abrivation for a collection of space-point buckets grouped by their corresponding input container.
Muon::MuonStationIndex::LayerIndex LayerIndex
Type alias for the station layer index.
DoubleProperty m_phiTolerance
Maximum phi difference [rad] allowed between two hits belonging to the same pattern.
virtual StatusCode execute(const EventContext &ctx) const override
SG::WriteHandleKeyArray< SpacePointContainer > m_outSpacePoints
Write handle key for the output buckets.
ToolHandle< MuonValR4::IFastRecoVisualizationTool > m_visionTool
Handle to the visualization tool.
DoubleProperty m_baseRWindow
Çonstant term [mm] of the acceptance window for the residual between a test hit and the pattern line.
ActsTrk::GeoContextReadKey_t m_geoCtxKey
Geometry context key.
UnsignedIntegerProperty m_maxMissLayersInStation
Maximum number of missed candidate hits in different measurement layers during pattern building allow...
BooleanProperty m_seedFromMdt
Toggle the seeding from MDT hits.
UnsignedIntegerProperty m_minTriggerLayers
Requirement on trigger layers in the bending direction to accept a pattern.
SG::ReadHandleKeyArray< SpacePointContainer > m_inSpacePoints
Keys of SpacePoint containers to read.
DoubleProperty m_meanNormRes2Cut
Quality cut on pattern'mean squared normalized residual.
BooleanProperty m_useMdtHits
--------------— Configuration options for the global pattern finder --------------—
std::unique_ptr< FastReco::GlobalPatternFinder > m_globPatFinder
Pointer to the actual global pattern finder.
UnsignedIntegerProperty m_minStationLayers
Minimum number of layers in a station to be considered a good station.
StringProperty m_outSpacePointSuffix
Suffix to add to the input space point container names to create the output container names,...
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
Handle to the MuonIdHelper service.
BooleanProperty m_seedFromInner
Activate the seeding from Inner station.
UnsignedIntegerProperty m_maxSeedAttempts
Maximum number of attempts to build a pattern from hits already used in existing patterns.
DoubleProperty m_minLayerSeparation
Minimum separation [mm] between the measurement layers of two hits for being used to compute a reliab...
SG::WriteHandleKey< GlobalPatternContainer > m_outPatterns
Write handle key for the output global patterns.
UnsignedIntegerProperty m_minPhiLayers
Minimum number of phi layers required to accept a pattern.
UnsignedIntegerProperty m_minPrecisionLayers
Requirement on precision layers in the bending direction to accept a pattern.
FastReco::GlobalPatternFinder::SpacePointContainerVec SpacePointContainerVec
Abrivation for a vector of space-point containers.
virtual StatusCode initialize() override
FastReco::GlobalPatternFinder::PatternVec PatternVec
Abrivation for a vector of global patterns.
DoubleProperty m_thetaSearchWindow
Size of theta window [rad] to search for compatible hits with a seed, tailored to the target pt cutof...
Data class to represent an eta maximum in hough space.
: The muon space point bucket represents a collection of points that will bre processed together in t...
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
std::vector< std::string > patterns
Definition listroot.cxx:187
This header ties the generic definitions in this package.
DataVector< SpacePointBucket > SpacePointContainer
Abrivation of the space point container type.
LayerIndex
enum to classify the different layers in the muon spectrometer
const T * get(const ReadCondHandleKey< T > &key, const EventContext &ctx)
Convenience function to retrieve an object given a ReadCondHandleKey.
bool useMdtHits
Toggle the utilization of MDT hits to build patterns.
double thetaSearchWindow
Size of theta window in radians to search for comapatible hits with a pattern, tailored to the target...
bool seedFromMdt
Toggle the seeding from MDT hits.
unsigned int minPhiLayers
Minimum number of phi layers required to accept a pattern.
const Muon::IMuonIdHelperSvc * idHelperSvc
Pointer to the idHelperSvc.
std::vector< LayerIndex > layerSeedings
Vector configuring the seeding layers.
double minLayerSeparation
Minimum separation (in mm) between the measurement layers of two hits for being used to compute a rel...
double phiTolerance
Maximum phi difference in radians allowed between two hits.
double baseRWindow
Base radial compatibility window (in mm).
unsigned int minTriggerLayers
Minimum number of trigger layers in the bending direction required to accept a pattern.
const MuonValR4::IFastRecoVisualizationTool * visionTool
Pointer to the visualization tool.
unsigned int minStationLayers
Minimum number of layers in a station to be considered a good station.
unsigned int maxSeedAttempts
Maximum number of attempts to build a pattern from hits already used in existing patterns.
unsigned int minPrecisionLayers
Minimum number of precision layers in the bending direction required to accept a pattern.
double meanNormRes2Cut
Quality cut on pattern'mean squared normalized residual.
unsigned int maxMissLayersInStation
Maximum number of missed candidate hits in different measurement layers in a station.