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;
34 patCfg.minPhiHits = m_minPhiHits;
43
44 if (m_seedFromInner) {
45 patCfg.layerSeedings.push_back(LayerIndex::Inner);
46 }
47 patCfg.visionTool = m_visionTool.get();
48 patCfg.idHelperSvc = m_idHelperSvc.get();
49 m_globPatFinder = std::make_unique<GlobalPatternFinder>(name(), std::move(patCfg));
50
51 //Print Configuration
52 ATH_MSG_DEBUG(" Configuration:\n"
53 << " Theta search window [rad]: " << m_thetaSearchWindow << "\n"
54 << " Base R window [mm]: " << m_baseRWindow << "\n"
55 << " Max missed layer hits: " << m_maxMissedLayerHits << "\n"
56 << " Min layer separation [mm]: " << m_minLayerSeparation << "\n"
57 << " Phi tolerance [rad]: " << m_phiTolerance << "\n"
58 << " Min bending trigger hits: " << m_minBendingTriggerHits << "\n"
59 << " Min bending precision hits: " << m_minBendingPrecisionHits << "\n"
60 << " Min phi hits: " << m_minPhiHits << "\n"
61 << " Seed from inner: " << m_seedFromInner << "\n"
62 << " Use MDT hits: " << m_useMdtHits << "\n"
63 << " Seed from MDT: " << m_seedFromMdt << "\n"
64 << " Max seed attempts: " << m_maxSeedAttempts << "\n"
65 << " Hit score saturation: " << m_hitScoreSaturation << "\n"
66 << " Residual penalty: " << m_residualPenalty << "\n"
67 << " Phi bonus saturation: " << m_phiBonusSaturation);
68
69 return StatusCode::SUCCESS;
70}
71
72StatusCode FastReconstructionAlg::execute(const EventContext& ctx) const {
73 SpacePointContainerVec inSpacePoints{};
74 inSpacePoints.reserve(m_inSpacePoints.size());
75 for (const auto& key: m_inSpacePoints) {
76 auto& spc = inSpacePoints.emplace_back(nullptr);
77 ATH_CHECK(SG::get(spc, key, ctx));
78 ATH_MSG_DEBUG("Reading " << spc->size() << " SP buckets from collection: " << key);
79 }
80
81 const ActsTrk::GeometryContext* gctx{nullptr};
82 ATH_CHECK(SG::get(gctx, m_geoCtxKey, ctx));
83
84 using BucketPerContainer = GlobalPatternFinder::BucketPerContainer;
85 BucketPerContainer outBuckets{};
86 for (const SpacePointContainer* inSpc : inSpacePoints) {
87 outBuckets.emplace(inSpc, BucketPerContainer::mapped_type{});
88 }
89 PatternVec patterns {m_globPatFinder->findPatterns(*gctx, inSpacePoints, outBuckets)};
90
92 for (size_t idx = 0; idx < inSpacePoints.size(); ++idx) {
93 const SpacePointContainer* inSpc = inSpacePoints.at(idx);
94 const auto& outBucketVec = outBuckets.at(inSpc);
95
97 ATH_CHECK(writeHandle.record(std::make_unique<SpacePointContainer>()));
98
99 for (const SpacePointBucket* bucket : outBucketVec) {
100 writeHandle->push_back(std::make_unique<SpacePointBucket>(*bucket));
101 }
102
103 ATH_MSG_DEBUG("Written " << writeHandle->size()
104 << " SP Buckets into StoreGate with key "
105 << m_outSpacePoints.at(idx));
106 }
109 ATH_CHECK(writeHandle.record(std::make_unique<GlobalPatternContainer>()));
110 for (const GlobalPattern& pat : patterns) {
111 writeHandle->push_back(std::make_unique<GlobalPattern>(pat));
112 }
113 ATH_MSG_DEBUG("Written "<<writeHandle->size()<<" GlobalPatterns into StoreGate.");
114
115 /* Consume the patterns to build muon candidates. WORK IN PROGRESS */
116 return StatusCode::SUCCESS;
117}
118
119
120}
#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.
DoubleProperty m_residualPenalty
How strongly to penalize residual — higher = stricter quality requirement.
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.
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.
DoubleProperty m_hitScoreSaturation
number of eta hits per station at which the pattern score saturates
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.
DoubleProperty m_precisionWeight
Weight of precision hits in the score of a pattern, w.r.t trigger hits.
StringProperty m_outSpacePointSuffix
Suffix to add to the input space point container names to create the output container names,...
UnsignedIntegerProperty m_minPhiHits
Minimum number of phi measurements required to accept a pattern.
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 allow...
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.
DoubleProperty m_phiBonusSaturation
Saturation for phi bonus — beyond this many phi hits the bonus is maxed.
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.
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.
unsigned int minBendingTriggerHits
Minimum number of trigger hits in the bending direction required to accept a pattern.
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.
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 precisionWeight
Weight of precision hits in the score, w.r.t trigger hits.
double phiTolerance
Maximum phi difference in radians allowed between two hits.
double baseRWindow
Base radial compatibility window (in mm).
double phiBonusSaturation
Saturation for phi bonus — beyond this many phi hits the bonus is maxed.
double hitScoreSaturation
Hit counts saturates at nStations * this value.
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.
unsigned int minPhiHits
Minimum number of phi measurements required to accept a pattern.
unsigned int maxSeedAttempts
Maximum number of attempts to build a pattern from hits already used in existing patterns.
double meanNormRes2Cut
Quality cut on pattern'mean squared normalized residual.
unsigned int minBendingPrecisionHits
Minimum number of precision hits in the bending direction required to accept a pattern.
double residualPenalty
How strongly to penalize residual — higher = stricter quality requirement.