ATLAS Offline Software
Loading...
Searching...
No Matches
MuonML::SegmentEdgeInferenceAlg Class Referencefinal

#include <SegmentEdgeInferenceAlg.h>

Inheritance diagram for MuonML::SegmentEdgeInferenceAlg:
Collaboration diagram for MuonML::SegmentEdgeInferenceAlg:

Public Member Functions

StatusCode initialize () override
StatusCode execute (const EventContext &ctx) const override
virtual StatusCode sysInitialize () override
 Override sysInitialize.
virtual bool isClonable () const override
 Specify if the algorithm is clonable.
virtual StatusCode sysExecute (const EventContext &ctx) override
 Execute an algorithm.
virtual const DataObjIDColl & extraOutputDeps () const override
 Return the list of extra output dependencies.
virtual bool filterPassed (const EventContext &ctx) const
 Get filter decision:
virtual void setFilterPassed (bool state, const EventContext &ctx) const
 Set filter decision:
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
virtual StatusCode sysStart () override
 Handle START transition.
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles.
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles.
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T, V, H > &t)
void updateVHKA (Gaudi::Details::PropertyBase &)
MsgStream & msg () const
bool msgLvl (const MSG::Level lvl) const

Protected Member Functions

void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce (T &h)
void extraDeps_update_handler (Gaudi::Details::PropertyBase &ExtraDeps)
 Add StoreName to extra input/output deps as needed.

Private Types

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t

Private Member Functions

Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

SG::ReadHandleKey< xAOD::MuonSegmentContainerm_segmentKey {this, "SegmentKey", "MuonSegmentsFromR4"}
SG::WriteDecorHandleKey< xAOD::MuonSegmentContainerm_pairGateDecorKey
 Per-segment payload consumed by MlMsTrackSeeder: [componentId, isSeedAnchor] Empty means that the segment was rejected by the ML preselection.
SG::WriteHandleKey< ConstDataVector< xAOD::MuonSegmentContainer > > m_filteredSegmentKey
Gaudi::Property< float > m_pairGateThreshold
Gaudi::Property< unsigned int > m_maxEdgesPerNode
Gaudi::Property< bool > m_useDegreeCappedComponents
Gaudi::Property< bool > m_requireMutualTopKEdges
Gaudi::Property< bool > m_recoverOrphanNodes
Gaudi::Property< unsigned int > m_seedAnchorsPerComponent
Gaudi::Property< bool > m_keepBestSegmentPerChamber
Gaudi::Property< unsigned int > m_minSegmentsPerComponent
ToolHandle< ISegmentEdgeClassifierToolm_edgeClassifier {this, "EdgeClassifierTool", "MuonML::SegmentEdgeClassifierTool/SegmentEdgeClassifierTool"}
DataObjIDColl m_extendedExtraObjects
 Extra output dependency collection, extended by AthAlgorithmDHUpdate to add symlinks.
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default).
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default).
std::vector< SG::VarHandleKeyArray * > m_vhka
bool m_varHandleArraysDeclared

Detailed Description

Definition at line 17 of file SegmentEdgeInferenceAlg.h.

Member Typedef Documentation

◆ StoreGateSvc_t

typedef ServiceHandle<StoreGateSvc> AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::StoreGateSvc_t
privateinherited

Definition at line 388 of file AthCommonDataStore.h.

Member Function Documentation

◆ declareGaudiProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::declareGaudiProperty ( Gaudi::Property< T, V, H > & hndl,
const SG::VarHandleKeyType &  )
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKey>

Definition at line 156 of file AthCommonDataStore.h.

158 {
160 hndl.value(),
161 hndl.documentation());
162
163 }
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)

◆ declareProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::declareProperty ( Gaudi::Property< T, V, H > & t)
inlineinherited

Definition at line 145 of file AthCommonDataStore.h.

145 {
146 typedef typename SG::HandleClassifier<T>::type htype;
148 }
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>

◆ detStore()

const ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::detStore ( ) const
inlineinherited

The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 95 of file AthCommonDataStore.h.

◆ evtStore()

ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::evtStore ( )
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 85 of file AthCommonDataStore.h.

◆ execute()

StatusCode MuonML::SegmentEdgeInferenceAlg::execute ( const EventContext & ctx) const
override

Definition at line 64 of file SegmentEdgeInferenceAlg.cxx.

64 {
65 const xAOD::MuonSegmentContainer* segments{};
66 ATH_CHECK(SG::get(segments, m_segmentKey, ctx));
67 ATH_MSG_DEBUG("Event " << ctx.eventID().event_number()
68 << ": input segments in '" << m_segmentKey.key()
69 << "' = " << segments->size());
70
71 SegmentEdgeGraph graph{};
72 std::vector<SegmentEdgeScore> scores{};
73 ATH_CHECK(m_edgeClassifier->buildGraph(ctx, *segments, graph));
74 ATH_MSG_DEBUG("Event " << ctx.eventID().event_number()
75 << ": built graph with nodes=" << graph.nNodes
76 << ", edges=" << graph.nEdges);
77
78 ATH_CHECK(m_edgeClassifier->classifyEdges(ctx, graph, scores));
79 if (!scores.empty()) {
80 float minProb = std::numeric_limits<float>::max();
81 float maxProb = std::numeric_limits<float>::lowest();
82 for (const SegmentEdgeScore& score : scores) {
83 minProb = std::min(minProb, score.probability);
84 maxProb = std::max(maxProb, score.probability);
85 }
86 ATH_MSG_DEBUG("Event " << ctx.eventID().event_number()
87 << ": edge scores=" << scores.size()
88 << ", prob range=[" << minProb << ", " << maxProb << "]");
89 } else {
90 ATH_MSG_DEBUG("Event " << ctx.eventID().event_number()
91 << ": no edge scores produced");
92 }
93
94 // Symmetrise directed model outputs once. Everything downstream uses the
95 // score of an undirected segment association.
96 std::unordered_map<std::uint64_t, float> pairProbability;
97 pairProbability.reserve(scores.size());
98 for (const SegmentEdgeScore& score : scores) {
99 if (score.src >= graph.nNodes || score.dst >= graph.nNodes ||
100 score.src == score.dst) {
101 continue;
102 }
103 const std::uint64_t key = undirectedPairKey(score.src, score.dst);
104 auto [it, inserted] = pairProbability.emplace(key, score.probability);
105 if (!inserted) it->second = std::max(it->second, score.probability);
106 }
107
108 // Form a sparse, score-ranked topology. Mutual top-K associations retain
109 // locally consistent paths while suppressing one-sided bridges.
110 using WeightedEdge = std::pair<std::uint64_t, float>;
111 const auto betterWeightedEdge = [](const WeightedEdge& first,
112 const WeightedEdge& second) {
113 const int probabilityOrder = InferenceUtils::compareFloatDescending(
114 first.second, second.second);
115 if (probabilityOrder != 0) {
116 return probabilityOrder < 0;
117 }
118 return first.first < second.first;
119 };
120 std::vector<std::vector<WeightedEdge>> edgesByNode(graph.nNodes);
121 std::size_t thresholdPairs = 0;
122 for (const auto& [key, probability] : pairProbability) {
123 if (probability < m_pairGateThreshold.value()) continue;
124 const std::size_t first = static_cast<std::size_t>(key >> 32);
125 const std::size_t second = static_cast<std::size_t>(key & 0xffffffffu);
126 if (first >= graph.nNodes || second >= graph.nNodes) continue;
127 edgesByNode[first].emplace_back(key, probability);
128 edgesByNode[second].emplace_back(key, probability);
129 ++thresholdPairs;
130 }
131
132 std::size_t thresholdedNodes = 0;
133 for (const std::vector<WeightedEdge>& nodeEdges : edgesByNode) {
134 thresholdedNodes += !nodeEdges.empty();
135 }
136
137 std::unordered_map<std::uint64_t, unsigned char> nominations;
138 nominations.reserve(thresholdPairs);
139 for (std::vector<WeightedEdge>& nodeEdges : edgesByNode) {
140 std::sort(nodeEdges.begin(), nodeEdges.end(), betterWeightedEdge);
141 if (m_maxEdgesPerNode.value() != 0 &&
142 nodeEdges.size() > m_maxEdgesPerNode.value()) {
143 nodeEdges.resize(m_maxEdgesPerNode.value());
144 }
145 for (const WeightedEdge& edge : nodeEdges) {
146 ++nominations[edge.first];
147 }
148 }
149
150 std::size_t mutualTopKPairs = 0;
151 std::size_t oneSidedTopKPairs = 0;
152 for (const auto& [_, count] : nominations) {
153 if (count == 2) {
154 ++mutualTopKPairs;
155 } else {
156 ++oneSidedTopKPairs;
157 }
158 }
159
160 std::unordered_set<std::uint64_t> selectedPairKeys;
161 selectedPairKeys.reserve(thresholdPairs);
162 if (m_useDegreeCappedComponents.value()) {
163 // Apply a score-ordered global degree cap when explicitly requested.
164 std::vector<WeightedEdge> acceptedPairs;
165 acceptedPairs.reserve(thresholdPairs);
166 for (const auto& [key, probability] : pairProbability) {
167 if (probability < m_pairGateThreshold.value()) continue;
168 acceptedPairs.emplace_back(key, probability);
169 }
170 std::sort(acceptedPairs.begin(), acceptedPairs.end(), betterWeightedEdge);
171
172 const unsigned int maxDegree = m_maxEdgesPerNode.value();
173 std::vector<unsigned int> degree(graph.nNodes, 0);
174 for (const WeightedEdge& edge : acceptedPairs) {
175 const std::size_t first = static_cast<std::size_t>(edge.first >> 32);
176 const std::size_t second = static_cast<std::size_t>(edge.first & 0xffffffffu);
177 if (maxDegree != 0 &&
178 (degree[first] >= maxDegree || degree[second] >= maxDegree)) {
179 continue;
180 }
181 selectedPairKeys.insert(edge.first);
182 ++degree[first];
183 ++degree[second];
184 }
185 } else {
186 for (const auto& [key, count] : nominations) {
187 if (m_requireMutualTopKEdges.value() && count != 2) continue;
188 selectedPairKeys.insert(key);
189 }
190 }
191
192 // A mutual top-K selection can leave an endpoint without an association.
193 // Add its best thresholded edge, at most once per orphaned endpoint.
194 std::size_t orphanRecoveryPairs = 0;
195 if (!m_useDegreeCappedComponents.value() &&
196 m_requireMutualTopKEdges.value() &&
197 m_recoverOrphanNodes.value()) {
198 std::vector<unsigned char> selectedNode(graph.nNodes, 0);
199 for (const std::uint64_t key : selectedPairKeys) {
200 const std::size_t first = static_cast<std::size_t>(key >> 32);
201 const std::size_t second =
202 static_cast<std::size_t>(key & 0xffffffffu);
203 if (first < graph.nNodes) selectedNode[first] = 1;
204 if (second < graph.nNodes) selectedNode[second] = 1;
205 }
206 for (std::size_t node = 0; node < graph.nNodes; ++node) {
207 if (selectedNode[node] || edgesByNode[node].empty()) continue;
208 const std::uint64_t key = edgesByNode[node].front().first;
209 const std::size_t first = static_cast<std::size_t>(key >> 32);
210 const std::size_t second =
211 static_cast<std::size_t>(key & 0xffffffffu);
212 if (first >= graph.nNodes || second >= graph.nNodes) continue;
213 if (selectedPairKeys.insert(key).second) ++orphanRecoveryPairs;
214 selectedNode[first] = 1;
215 selectedNode[second] = 1;
216 }
217 }
218
219 std::vector<std::uint64_t> selectedPairs{selectedPairKeys.begin(),
220 selectedPairKeys.end()};
221 std::sort(selectedPairs.begin(), selectedPairs.end());
222
223 DisjointSet components{graph.nNodes};
224 std::vector<bool> activeNode(graph.nNodes, false);
225 for (const std::uint64_t key : selectedPairs) {
226 const std::size_t first = static_cast<std::size_t>(key >> 32);
227 const std::size_t second = static_cast<std::size_t>(key & 0xffffffffu);
228 components.unite(first, second);
229 activeNode[first] = true;
230 activeNode[second] = true;
231 }
232
233 std::unordered_map<std::size_t, std::vector<std::size_t>> byRoot;
234 byRoot.reserve(graph.nNodes);
235 for (std::size_t node = 0; node < graph.nNodes; ++node) {
236 if (activeNode[node]) byRoot[components.find(node)].push_back(node);
237 }
238
239 // Deterministic component IDs make debugging and validation reproducible.
240 std::vector<std::vector<std::size_t>> componentNodes;
241 componentNodes.reserve(byRoot.size());
242 for (auto& [_, nodes] : byRoot) {
243 std::sort(nodes.begin(), nodes.end());
244 componentNodes.push_back(std::move(nodes));
245 }
246 std::ranges::sort(componentNodes,
247 [](const auto& first, const auto& second) {
248 return first.front() < second.front();
249 });
250
251 xAOD::ContainerDecorator<xAOD::MuonSegmentContainer, std::vector<unsigned>>
252 decor{m_pairGateDecorKey, ctx};
253
254 if (!m_filteredSegmentKey.empty()) {
255 auto connectedSegments =
256 std::make_unique<ConstDataVector<xAOD::MuonSegmentContainer>>(
258 connectedSegments->reserve(graph.nNodes);
259 for (std::size_t node = 0; node < graph.nNodes; ++node) {
260 if (!activeNode[node] || !graph.segments[node]) continue;
261 connectedSegments->push_back(graph.segments[node]);
262 }
263
264 const std::size_t nConnectedSegments = connectedSegments->size();
265 SG::WriteHandle<ConstDataVector<xAOD::MuonSegmentContainer>> connectedHandle{
267 ATH_CHECK(connectedHandle.record(std::move(connectedSegments)));
268 ATH_MSG_DEBUG("Event " << ctx.eventID().event_number()
269 << ": wrote " << nConnectedSegments
270 << " ML-connected segment(s) to '"
271 << m_filteredSegmentKey.key() << "'");
272 }
273
274 std::size_t topologyNodes = 0;
275 std::size_t retainedNodes = 0;
276 std::size_t chamberSuppressedNodes = 0;
277 std::size_t rejectedComponents = 0;
278 std::size_t componentsKept = 0;
279 std::size_t anchors = 0;
280 std::size_t nodesRejectedByMinComponent = 0;
281 unsigned nextComponentId = 1;
282 const InferenceUtils::SegmentQualityOrder betterSegment{};
283
284 const auto isBetterNode = [&](std::size_t candidate, std::size_t incumbent) {
285 if (betterSegment(graph.segments[candidate], graph.segments[incumbent])) {
286 return true;
287 }
288 if (betterSegment(graph.segments[incumbent], graph.segments[candidate])) {
289 return false;
290 }
291 return candidate < incumbent;
292 };
293
294 for (const std::vector<std::size_t>& rawNodes : componentNodes) {
295 topologyNodes += rawNodes.size();
296 std::vector<std::size_t> retained = rawNodes;
297
298 // The seeder resolves same-chamber alternatives while building a seed.
299 // Retaining only the highest-ranked representative is therefore optional.
300 if (m_keepBestSegmentPerChamber.value()) {
301 std::unordered_map<int, std::size_t> bestByChamber;
302 bestByChamber.reserve(rawNodes.size());
303 for (const std::size_t node : rawNodes) {
304 const int chamber =
305 static_cast<int>(graph.segments[node]->chamberIndex());
306 const auto found = bestByChamber.find(chamber);
307 if (found == bestByChamber.end() || isBetterNode(node, found->second)) {
308 bestByChamber[chamber] = node;
309 }
310 }
311 retained.clear();
312 retained.reserve(bestByChamber.size());
313 for (const auto& [_, node] : bestByChamber) retained.push_back(node);
314 std::sort(retained.begin(), retained.end());
315 chamberSuppressedNodes += rawNodes.size() - retained.size();
316 }
317
318 if (retained.size() < m_minSegmentsPerComponent.value()) {
319 nodesRejectedByMinComponent += retained.size();
320 ++rejectedComponents;
321 continue;
322 }
323
324 // Only ranked component members launch seeds. The edge score therefore
325 // reduces seed attempts directly rather than serving only as a label.
326 std::vector<std::size_t> rankedNodes{retained};
327 std::ranges::sort(rankedNodes, isBetterNode);
328 const std::size_t nAnchors = m_seedAnchorsPerComponent.value() == 0
329 ? rankedNodes.size()
330 : std::min<std::size_t>(m_seedAnchorsPerComponent.value(),
331 rankedNodes.size());
332 if (nAnchors == 0) {
333 ++rejectedComponents;
334 continue;
335 }
336 rankedNodes.resize(nAnchors);
337 std::ranges::sort(rankedNodes);
338
339 const unsigned componentId = nextComponentId++;
340 for (const std::size_t node : retained) {
341 const bool isAnchor = Acts::rangeContainsValue(rankedNodes, node);
342 decor(*graph.segments[node]) = {
343 componentId, static_cast<unsigned int>(isAnchor)};
344 }
345 retainedNodes += retained.size();
346 anchors += nAnchors;
347 ++componentsKept;
348 }
349
350 ATH_MSG_DEBUG("Event " << ctx.eventID().event_number()
351 << ": ML components graphNodes=" << graph.nNodes
352 << ", thresholdedNodes=" << thresholdedNodes
353 << ", thresholdPairs=" << thresholdPairs
354 << ", mutualTopKPairs=" << mutualTopKPairs
355 << ", oneSidedTopKPairs=" << oneSidedTopKPairs
356 << ", selectedPairs=" << selectedPairKeys.size()
357 << ", components=" << componentsKept
358 << ", topologyNodes=" << topologyNodes
359 << ", retainedNodes=" << retainedNodes
360 << ", chamberSuppressedNodes=" << chamberSuppressedNodes
361 << ", nodesRejectedByMinComponent=" << nodesRejectedByMinComponent
362 << ", keepBestSegmentPerChamber=" << m_keepBestSegmentPerChamber.value()
363 << ", seedAnchors=" << anchors
364 << ", rejectedComponents=" << rejectedComponents
365 << ", threshold=" << m_pairGateThreshold.value()
366 << ", maxEdgesPerNode=" << m_maxEdgesPerNode.value()
367 << ", orphanRecoveryPairs=" << orphanRecoveryPairs
368 << ", mutualTopK=" << m_requireMutualTopKEdges.value()
369 << ", degreeCapped=" << m_useDegreeCappedComponents.value());
370 return StatusCode::SUCCESS;
371}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_DEBUG(x,...)
static const Attributes_t empty
size_type size() const noexcept
Returns the number of elements in the collection.
Gaudi::Property< bool > m_keepBestSegmentPerChamber
SG::WriteDecorHandleKey< xAOD::MuonSegmentContainer > m_pairGateDecorKey
Per-segment payload consumed by MlMsTrackSeeder: [componentId, isSeedAnchor] Empty means that the seg...
Gaudi::Property< bool > m_useDegreeCappedComponents
ToolHandle< ISegmentEdgeClassifierTool > m_edgeClassifier
Gaudi::Property< unsigned int > m_maxEdgesPerNode
Gaudi::Property< bool > m_requireMutualTopKEdges
Gaudi::Property< unsigned int > m_minSegmentsPerComponent
SG::WriteHandleKey< ConstDataVector< xAOD::MuonSegmentContainer > > m_filteredSegmentKey
Gaudi::Property< bool > m_recoverOrphanNodes
SG::ReadHandleKey< xAOD::MuonSegmentContainer > m_segmentKey
Gaudi::Property< unsigned int > m_seedAnchorsPerComponent
Gaudi::Property< float > m_pairGateThreshold
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
int count(std::string s, const std::string &regx)
count how many occurances of a regx are in a string
Definition hcg.cxx:148
bool first
Definition DeMoScan.py:534
int compareFloatDescending(float first, float second)
Three-way descending comparison which also orders NaN last.
@ VIEW_ELEMENTS
this data object is a view, it does not own its elmts
const T * get(const ReadCondHandleKey< T > &key, const EventContext &ctx)
Convenience function to retrieve an object given a ReadCondHandleKey.
void sort(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of sort for DataVector/List.
MuonSegmentContainer_v1 MuonSegmentContainer
Definition of the current "MuonSegment container version".

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::extraDeps_update_handler ( Gaudi::Details::PropertyBase & ExtraDeps)
protectedinherited

Add StoreName to extra input/output deps as needed.

use the logic of the VarHandleKey to parse the DataObjID keys supplied via the ExtraInputs and ExtraOuputs Properties to add the StoreName if it's not explicitly given

◆ extraOutputDeps()

const DataObjIDColl & AthCommonAlgorithm< Gaudi::Algorithm >::extraOutputDeps ( ) const
overridevirtualinherited

Return the list of extra output dependencies.

This list is extended to include symlinks implied by inheritance relations.

Definition at line 89 of file AthCommonAlgorithm.cxx.

54{
55 // If we didn't find any symlinks to add, just return the collection
56 // from the base class. Otherwise, return the extended collection.
57 if (!m_extendedExtraObjects.empty()) {
59 }
61}
Common base class for algorithms.

◆ filterPassed()

virtual bool AthCommonAlgorithm< Gaudi::Algorithm >::filterPassed ( const EventContext & ctx) const
inlinevirtualinherited

Get filter decision:

Definition at line 93 of file AthCommonAlgorithm.h.

93 {
94 return execState( ctx ).filterPassed();
95 }
virtual bool filterPassed(const EventContext &ctx) const
Get filter decision:

◆ initialize()

StatusCode MuonML::SegmentEdgeInferenceAlg::initialize ( )
override

Definition at line 56 of file SegmentEdgeInferenceAlg.cxx.

56 {
57 ATH_CHECK(m_segmentKey.initialize());
58 ATH_CHECK(m_pairGateDecorKey.initialize());
60 ATH_CHECK(m_edgeClassifier.retrieve());
61 return StatusCode::SUCCESS;
62}

◆ inputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::inputHandles ( ) const
overridevirtualinherited

Return this algorithm's input handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ isClonable()

virtual bool AthCommonAlgorithm< Gaudi::Algorithm >::isClonable ( ) const
inlineoverridevirtualinherited

Specify if the algorithm is clonable.

Only relevant for non-reentrant algorithms. Actual number of clones needs to be set via the "Cardinality" property.

Reimplemented in AFP_DigiTop, AlgB, AlgT, BCM_Digitization, CscDigitBuilder, CscDigitToCscRDO, G4AtlasAlg, G4RunAlg, HGTD_Digitization, HiveAlgBase, InDet::GNNSeedingTrackMaker, InDet::SCT_Clusterization, InDet::SiSPGNNTrackMaker, InDet::SiSPSeededTrackFinder, InDet::SiTrackerSpacePointFinder, ISF::SimKernelMT, ITk::StripDigitization, ITkPixelCablingAlg, ITkStripCablingAlg, LArHitEMapMaker, LArTTL1Maker, LUCID_DigiTop, LVL1::L1TopoSimulation, MergeCalibHits, MergeGenericMuonSimHitColl, MergeHijingPars, MergeMcEventCollection, MergeTrackRecordCollection, MergeTruthJets, MergeTruthParticles, MuonDigitizer, PileUpMTAlg, PixelDigitization, RoIBResultToxAOD, SCT_ByteStreamErrorsTestAlg, SCT_CablingCondAlgFromCoraCool, SCT_CablingCondAlgFromText, SCT_ConditionsParameterTestAlg, SCT_ConditionsSummaryTestAlg, SCT_ConfigurationConditionsTestAlg, SCT_Digitization, SCT_FlaggedConditionTestAlg, SCT_LinkMaskingTestAlg, SCT_MajorityConditionsTestAlg, SCT_ModuleVetoTestAlg, SCT_MonitorConditionsTestAlg, SCT_PrepDataToxAOD, SCT_RawDataToxAOD, SCT_ReadCalibChipDataTestAlg, SCT_ReadCalibDataTestAlg, SCT_RODVetoTestAlg, SCT_SensorsTestAlg, SCT_SiliconConditionsTestAlg, SCT_StripVetoTestAlg, SCT_TdaqEnabledTestAlg, SCT_TestCablingAlg, SCTEventFlagWriter, SCTRawDataProvider, SCTSiLorentzAngleTestAlg, SCTSiPropertiesTestAlg, SGInputLoader, Simulation::BeamEffectsAlg, TileHitVecToCnt, TileMuonFitter, TilePulseForTileMuonReceiver, TileRawChannelMaker, TRTDigitization, and ZDC_DigiTop.

Definition at line 68 of file AthCommonAlgorithm.h.

68 {
69 return true;
70 }

◆ msg()

MsgStream & AthCommonMsg< Gaudi::Algorithm >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

24 {
25 return this->msgStream();
26 }

◆ msgLvl()

bool AthCommonMsg< Gaudi::Algorithm >::msgLvl ( const MSG::Level lvl) const
inlineinherited

Definition at line 30 of file AthCommonMsg.h.

30 {
31 return this->msgLevel(lvl);
32 }

◆ outputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::outputHandles ( ) const
overridevirtualinherited

Return this algorithm's output handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ renounce()

std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::renounce ( T & h)
inlineprotectedinherited

Definition at line 380 of file AthCommonDataStore.h.

381 {
382 h.renounce();
384 }
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce(T &h)

◆ renounceArray()

void AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::renounceArray ( SG::VarHandleKeyArray & handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364 {
366 }

◆ setFilterPassed()

virtual void AthCommonAlgorithm< Gaudi::Algorithm >::setFilterPassed ( bool state,
const EventContext & ctx ) const
inlinevirtualinherited

Set filter decision:

Reimplemented in AthFilterAlgorithm.

Definition at line 99 of file AthCommonAlgorithm.h.

99 {
101 }
virtual void setFilterPassed(bool state, const EventContext &ctx) const
Set filter decision:

◆ sysExecute()

StatusCode AthCommonAlgorithm< Gaudi::Algorithm >::sysExecute ( const EventContext & ctx)
overridevirtualinherited

Execute an algorithm.

We override this in order to work around an issue with the Algorithm base class storing the event context in a member variable that can cause crashes in MT jobs.

Reimplemented in AthAnalysisAlgorithm.

Definition at line 80 of file AthCommonAlgorithm.cxx.

41{
42 return BaseAlg::sysExecute (ctx);
43}

◆ sysInitialize()

StatusCode AthCommonAlgorithm< Gaudi::Algorithm >::sysInitialize ( )
overridevirtualinherited

Override sysInitialize.

Override sysInitialize from the base class.

Loop through all output handles, and if they're WriteCondHandles, automatically register them and this Algorithm with the CondSvc

Scan through all outputHandles, and if they're WriteCondHandles, register them with the CondSvc

Reimplemented from AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >.

Reimplemented in AthAnalysisAlgorithm, AthFilterAlgorithm, AthHistogramAlgorithm, HypoBase, InputMakerBase, and PyAthena::Alg.

Definition at line 60 of file AthCommonAlgorithm.cxx.

71 {
73
74 if (sc.isFailure()) {
75 return sc;
76 }
77
78 ServiceHandle<ICondSvc> cs("CondSvc",name());
79 for (auto h : outputHandles()) {
80 if (h->isCondition() && h->mode() == Gaudi::DataHandle::Writer) {
81 // do this inside the loop so we don't create the CondSvc until needed
82 if ( cs.retrieve().isFailure() ) {
83 ATH_MSG_WARNING("no CondSvc found: won't autoreg WriteCondHandles");
85 }
86 if (cs->regHandle(this,*h).isFailure()) {
88 ATH_MSG_ERROR("unable to register WriteCondHandle " << h->fullKey()
89 << " with CondSvc");
90 }
91 }
92 }
93 return sc;
94}
#define ATH_MSG_ERROR(x,...)
#define ATH_MSG_WARNING(x,...)
virtual StatusCode sysInitialize() override
virtual std::vector< Gaudi::DataHandle * > outputHandles() const override

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::sysStart ( )
overridevirtualinherited

Handle START transition.

We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.

◆ updateVHKA()

void AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::updateVHKA ( Gaudi::Details::PropertyBase & )
inlineinherited

Definition at line 308 of file AthCommonDataStore.h.

308 {
309 // debug() << "updateVHKA for property " << p.name() << " " << p.toString()
310 // << " size: " << m_vhka.size() << endmsg;
311 for (auto &a : m_vhka) {
313 for (auto k : keys) {
314 k->setOwner(this);
315 }
316 }
317 }

Member Data Documentation

◆ m_detStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::m_detStore
privateinherited

Pointer to StoreGate (detector store by default).

Definition at line 393 of file AthCommonDataStore.h.

◆ m_edgeClassifier

ToolHandle<ISegmentEdgeClassifierTool> MuonML::SegmentEdgeInferenceAlg::m_edgeClassifier {this, "EdgeClassifierTool", "MuonML::SegmentEdgeClassifierTool/SegmentEdgeClassifierTool"}
private

Definition at line 61 of file SegmentEdgeInferenceAlg.h.

61{this, "EdgeClassifierTool", "MuonML::SegmentEdgeClassifierTool/SegmentEdgeClassifierTool"};

◆ m_evtStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::m_evtStore
privateinherited

Pointer to StoreGate (event store by default).

Definition at line 390 of file AthCommonDataStore.h.

◆ m_extendedExtraObjects

DataObjIDColl AthCommonAlgorithm< Gaudi::Algorithm >::m_extendedExtraObjects
privateinherited

Extra output dependency collection, extended by AthAlgorithmDHUpdate to add symlinks.

Empty if no symlinks were found.

Definition at line 108 of file AthCommonAlgorithm.h.

◆ m_filteredSegmentKey

SG::WriteHandleKey<ConstDataVector<xAOD::MuonSegmentContainer> > MuonML::SegmentEdgeInferenceAlg::m_filteredSegmentKey
private
Initial value:
{
this, "FilteredSegmentKey", "",
"Optional VIEW container containing only segments incident to a "
"post-classifier selected edge; empty disables the output"}

Definition at line 33 of file SegmentEdgeInferenceAlg.h.

33 {
34 this, "FilteredSegmentKey", "",
35 "Optional VIEW container containing only segments incident to a "
36 "post-classifier selected edge; empty disables the output"};

◆ m_keepBestSegmentPerChamber

Gaudi::Property<bool> MuonML::SegmentEdgeInferenceAlg::m_keepBestSegmentPerChamber
private
Initial value:
{
this, "KeepBestSegmentPerChamber", true,
"Keep only the ML-best segment in each chamber within a component"}

Definition at line 55 of file SegmentEdgeInferenceAlg.h.

55 {
56 this, "KeepBestSegmentPerChamber", true,
57 "Keep only the ML-best segment in each chamber within a component"};

◆ m_maxEdgesPerNode

Gaudi::Property<unsigned int> MuonML::SegmentEdgeInferenceAlg::m_maxEdgesPerNode
private
Initial value:
{
this, "MaxEdgesPerNode", 2,
"Keep at most this many highest-score neighbours per segment when forming the ML path graph; zero keeps all"}

Definition at line 40 of file SegmentEdgeInferenceAlg.h.

40 {
41 this, "MaxEdgesPerNode", 2,
42 "Keep at most this many highest-score neighbours per segment when forming the ML path graph; zero keeps all"};

◆ m_minSegmentsPerComponent

Gaudi::Property<unsigned int> MuonML::SegmentEdgeInferenceAlg::m_minSegmentsPerComponent
private
Initial value:
{
this, "MinSegmentsPerComponent", 2,
"Discard ML components with fewer retained segments"}

Definition at line 58 of file SegmentEdgeInferenceAlg.h.

58 {
59 this, "MinSegmentsPerComponent", 2,
60 "Discard ML components with fewer retained segments"};

◆ m_pairGateDecorKey

SG::WriteDecorHandleKey<xAOD::MuonSegmentContainer> MuonML::SegmentEdgeInferenceAlg::m_pairGateDecorKey
private
Initial value:
{
this, "PairGateDecoration", "MuonSegmentsFromR4.mlTrackComponent"}

Per-segment payload consumed by MlMsTrackSeeder: [componentId, isSeedAnchor] Empty means that the segment was rejected by the ML preselection.

The anchor bit nominates an ML-supported segment that launches direct component seeding.

Definition at line 31 of file SegmentEdgeInferenceAlg.h.

31 {
32 this, "PairGateDecoration", "MuonSegmentsFromR4.mlTrackComponent"};

◆ m_pairGateThreshold

Gaudi::Property<float> MuonML::SegmentEdgeInferenceAlg::m_pairGateThreshold
private
Initial value:
{
this, "PairGateThreshold", 0.5f,
"Minimum edge probability used to form ML track components"}

Definition at line 37 of file SegmentEdgeInferenceAlg.h.

37 {
38 this, "PairGateThreshold", 0.5f,
39 "Minimum edge probability used to form ML track components"};

◆ m_recoverOrphanNodes

Gaudi::Property<bool> MuonML::SegmentEdgeInferenceAlg::m_recoverOrphanNodes
private
Initial value:
{
this, "RecoverOrphanNodes", true,
"For a thresholded node without a mutual top-K edge, retain its best one-sided top-K association"}

Definition at line 49 of file SegmentEdgeInferenceAlg.h.

49 {
50 this, "RecoverOrphanNodes", true,
51 "For a thresholded node without a mutual top-K edge, retain its best one-sided top-K association"};

◆ m_requireMutualTopKEdges

Gaudi::Property<bool> MuonML::SegmentEdgeInferenceAlg::m_requireMutualTopKEdges
private
Initial value:
{
this, "RequireMutualTopKEdges", true,
"Retain an ML association only when both endpoint segments rank it in their top MaxEdgesPerNode scores"}

Definition at line 46 of file SegmentEdgeInferenceAlg.h.

46 {
47 this, "RequireMutualTopKEdges", true,
48 "Retain an ML association only when both endpoint segments rank it in their top MaxEdgesPerNode scores"};

◆ m_seedAnchorsPerComponent

Gaudi::Property<unsigned int> MuonML::SegmentEdgeInferenceAlg::m_seedAnchorsPerComponent
private
Initial value:
{
this, "SeedAnchorsPerComponent", 0,
"Number of highest-score segments that may seed each ML component; zero keeps every retained segment"}

Definition at line 52 of file SegmentEdgeInferenceAlg.h.

52 {
53 this, "SeedAnchorsPerComponent", 0,
54 "Number of highest-score segments that may seed each ML component; zero keeps every retained segment"};

◆ m_segmentKey

SG::ReadHandleKey<xAOD::MuonSegmentContainer> MuonML::SegmentEdgeInferenceAlg::m_segmentKey {this, "SegmentKey", "MuonSegmentsFromR4"}
private

Definition at line 23 of file SegmentEdgeInferenceAlg.h.

23{this, "SegmentKey", "MuonSegmentsFromR4"};

◆ m_useDegreeCappedComponents

Gaudi::Property<bool> MuonML::SegmentEdgeInferenceAlg::m_useDegreeCappedComponents
private
Initial value:
{
this, "UseDegreeCappedComponents", false,
"Use a global greedy degree cap instead of the mutual top-K path graph"}

Definition at line 43 of file SegmentEdgeInferenceAlg.h.

43 {
44 this, "UseDegreeCappedComponents", false,
45 "Use a global greedy degree cap instead of the mutual top-K path graph"};

◆ m_varHandleArraysDeclared

bool AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::m_varHandleArraysDeclared
privateinherited

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vhka

std::vector<SG::VarHandleKeyArray*> AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::m_vhka
privateinherited

Definition at line 398 of file AthCommonDataStore.h.


The documentation for this class was generated from the following files: