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
35 patCfg.useMdtHits = m_useMdtHits;
38 if (m_seedFromInner) {
39 patCfg.layerSeedings.push_back(LayerIndex::Inner);
40 }
41 patCfg.visionTool = m_visionTool.get();
42 patCfg.idHelperSvc = m_idHelperSvc.get();
43 m_globPatFinder = std::make_unique<GlobalPatternFinder>(name(), std::move(patCfg));
44
45 return StatusCode::SUCCESS;
46}
47
48StatusCode FastReconstructionAlg::execute(const EventContext& ctx) const {
49 SpacePointContainerVec inSpacePoints{};
50 inSpacePoints.reserve(m_inSpacePoints.size());
51 for (const auto& key: m_inSpacePoints) {
52 auto& spc = inSpacePoints.emplace_back(nullptr);
53 ATH_CHECK(SG::get(spc, key, ctx));
54 ATH_MSG_DEBUG("Reading " << spc->size() << " SP buckets from collection: " << key);
55 }
56
57 const ActsTrk::GeometryContext* gctx{nullptr};
58 ATH_CHECK(SG::get(gctx, m_geoCtxKey, ctx));
59
60 using BucketPerContainer = GlobalPatternFinder::BucketPerContainer;
61 BucketPerContainer outBuckets{};
62 for (const SpacePointContainer* inSpc : inSpacePoints) {
63 outBuckets.emplace(inSpc, BucketPerContainer::mapped_type{});
64 }
65 PatternVec patterns {m_globPatFinder->findPatterns(*gctx, inSpacePoints, outBuckets)};
66
68 for (size_t idx = 0; idx < inSpacePoints.size(); ++idx) {
69 const SpacePointContainer* inSpc = inSpacePoints.at(idx);
70 const auto& outBucketVec = outBuckets.at(inSpc);
71
73 ATH_CHECK(writeHandle.record(std::make_unique<SpacePointContainer>()));
74
75 for (const SpacePointBucket* bucket : outBucketVec) {
76 writeHandle->push_back(std::make_unique<SpacePointBucket>(*bucket));
77 }
78
79 ATH_MSG_DEBUG("Written " << writeHandle->size()
80 << " SP Buckets into StoreGate with key "
81 << m_outSpacePoints.at(idx));
82 }
83
86 ATH_CHECK(writeHandle.record(std::make_unique<GlobalPatternContainer>()));
87 for (GlobalPattern& pat : patterns) {
88 writeHandle->push_back(std::make_unique<GlobalPattern>(std::move(pat)));
89 }
90 ATH_MSG_DEBUG("Written "<<writeHandle->size()<<" GlobalPatterns into StoreGate.");
91 return StatusCode::SUCCESS;
92}
93
94
95}
#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 in radiants allowed between two hits.
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
Base radial compatibility window (in mm).
BooleanProperty m_seedFromMdt
Toggle the seeding from MDT hits.
SG::ReadHandleKey< ActsTrk::GeometryContext > m_geoCtxKey
Geometry context key.
SG::ReadHandleKeyArray< SpacePointContainer > m_inSpacePoints
Keys of SpacePoint containers to read.
BooleanProperty m_useMdtHits
Toggle the utilization of MDT hits to build patterns.
std::unique_ptr< FastReco::GlobalPatternFinder > m_globPatFinder
Pointer to the actual global pattern finder.
DoubleProperty m_minZDiff4Line
Minumum difference in global Z between the seed and the pattern hit to be used to compute the pattern...
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.
UnsignedIntegerProperty m_maxMissedLayerHits
Maximum number of missed candidate hits in different measurement layers during pattern building.
BooleanProperty m_seedFromInner
Activate the seeding from Inner stations outward.
UnsignedIntegerProperty m_maxSeedAttempts
Maximum number of attempts to build a pattern from hits already used in existing patterns.
SG::WriteHandleKey< GlobalPatternContainer > m_outPatterns
Write handle key for the output global patterns.
UnsignedIntegerProperty m_minBendingPrecisionHits
Requirement on precision hits in the bending direction to accept a pattern.
FastReco::GlobalPatternFinder::SpacePointContainerVec SpacePointContainerVec
Abrivation for a vector of space-point containers.
UnsignedIntegerProperty m_minBendingTriggerHits
Requirement on trigger hits in the bending direction to accept a pattern.
DoubleProperty m_minRDiff4Line
Minumum difference in global R between the seed and the pattern hit to be used to compute the pattern...
virtual StatusCode initialize() override
FastReco::GlobalPatternFinder::PatternVec PatternVec
Abrivation for a vector of global patterns.
DoubleProperty m_thetaSearchWindow
--------------— Configuration options for the global pattern finder --------------—
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.
unsigned int minBendingTriggerHits
Minimum number of trigger hits in the bending direction required to accept a pattern.
double thetaSearchWindow
Size of theta window in radiants to search for comapatible hits with a pattern, tailored to the targe...
bool seedFromMdt
Toggle the seeding from MDT hits.
const Muon::IMuonIdHelperSvc * idHelperSvc
Pointer to the idHelperSvc.
std::vector< LayerIndex > layerSeedings
Vector configuring the seeding layers.
double phiTolerance
Maximum phi difference in radiants allowed between two hits.
double baseRWindow
Base radial compatibility window (in mm).
double minRDiff4Line
Minimum difference in global R between the seed and the pattern hit to be used to compute the pattern...
unsigned int maxMissedLayerHits
Maximum number of missed candidate hits in different measurement layers during pattern building.
const MuonValR4::IFastRecoVisualizationTool * visionTool
Pointer to the visualization tool.
double minZDiff4Line
Minimum difference in global Z between the seed and the pattern hit to be used to compute the pattern...
unsigned int maxSeedAttempts
Maximum number of attempts to build a pattern from hits already used in existing patterns.
unsigned int minBendingPrecisionHits
Minimum number of precision hits in the bending direction required to accept a pattern.