ATLAS Offline Software
Loading...
Searching...
No Matches
SegmentEdgeClassifierTool.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4#ifndef MUONINFERENCE_SEGMENTEDGECLASSIFIERTOOL_H
5#define MUONINFERENCE_SEGMENTEDGECLASSIFIERTOOL_H
6
9#include "MuonMLEvent.h"
10#include "Gaudi/Property.h"
11
12#include <atomic>
13#include <cstdint>
14#include <mutex>
15#include <string>
16#include <vector>
17
18namespace MuonML {
19
28 int chamberIndex{0};
29 int layers{0};
30 int sector{0};
31 int nSegments{0};
32 };
33
62 virtual public ISegmentEdgeClassifierTool {
63 public:
64 using BucketInferenceToolBase::BucketInferenceToolBase;
65
67 StatusCode initialize() override;
68
71 StatusCode runGraphInference(const EventContext& ctx,
72 GraphRawData& graphData) const override;
73
76 StatusCode buildGraph(const EventContext& ctx,
77 const xAOD::MuonSegmentContainer& segments,
78 SegmentEdgeGraph& graph) const override;
79
82 StatusCode classifyEdges(const EventContext& ctx,
83 const SegmentEdgeGraph& graph,
84 std::vector<SegmentEdgeScore>& scores) const override;
85
86 private:
87 StatusCode dumpDebugEvent(const EventContext& ctx,
88 const SegmentEdgeGraph& graph,
89 const std::vector<SegmentEdgeScore>& scores) const;
90
91 Gaudi::Property<float> m_maxDeltaThetaDeg{this, "MaxDeltaThetaDeg", 35.f};
92 Gaudi::Property<int> m_maxDeltaSector{this, "MaxDeltaSector", 1};
93 Gaudi::Property<int> m_sectorModulo{this, "SectorModulo", 16};
94 Gaudi::Property<std::string> m_inputNodeName{this, "InputNodeName", "x"};
95 Gaudi::Property<std::string> m_inputEdgeIndexName{this, "InputEdgeIndexName", "edge_index"};
96 Gaudi::Property<std::string> m_inputEdgeAttrName{this, "InputEdgeAttrName", "edge_attr"};
97 Gaudi::Property<std::string> m_outputName{this, "OutputName", "logits"};
98 Gaudi::Property<std::string> m_debugDumpFile{this, "DebugDumpFile", ""};
99 Gaudi::Property<unsigned int> m_debugDumpMaxEvents{this, "DebugDumpMaxEvents", 0};
100 float m_cosMin{0.f};
101
103 std::vector<std::string> m_nodeFeatureNames{};
104 std::vector<SegmentNodeFeatureId> m_nodeFeatureIds{};
105
106 mutable std::mutex m_debugDumpMutex;
107 mutable std::atomic<unsigned int> m_debugDumpEvents{0};
108 };
109}
110#endif
Generic feature definitions and utilities shared across ML inference tools.
Interface for segment-edge GNN classification.
Runs a segment-level GNN on reconstructed muon segments to classify segment-pair edges as "good" or "...
Gaudi::Property< unsigned int > m_debugDumpMaxEvents
Gaudi::Property< std::string > m_outputName
std::atomic< unsigned int > m_debugDumpEvents
Gaudi::Property< std::string > m_inputEdgeAttrName
StatusCode runGraphInference(const EventContext &ctx, GraphRawData &graphData) const override
Not supported by this tool; returns FAILURE.
StatusCode classifyEdges(const EventContext &ctx, const SegmentEdgeGraph &graph, std::vector< SegmentEdgeScore > &scores) const override
Run ONNX inference on graph and populate scores with logit and probability for each edge; called afte...
Gaudi::Property< std::string > m_debugDumpFile
StatusCode buildGraph(const EventContext &ctx, const xAOD::MuonSegmentContainer &segments, SegmentEdgeGraph &graph) const override
Build a GNN graph from segments, computing node and edge features and storing the graph structure in ...
std::vector< std::string > m_nodeFeatureNames
Node feature order expected by the model metadata (resolved at initialize).
Gaudi::Property< std::string > m_inputEdgeIndexName
Gaudi::Property< std::string > m_inputNodeName
std::vector< SegmentNodeFeatureId > m_nodeFeatureIds
StatusCode initialize() override
Retrieve the ONNX model and resolve node feature ordering from metadata.
StatusCode dumpDebugEvent(const EventContext &ctx, const SegmentEdgeGraph &graph, const std::vector< SegmentEdgeScore > &scores) const
MuonSegmentContainer_v1 MuonSegmentContainer
Definition of the current "MuonSegment container version".
Segment features derived from or stored in bucket metadata.
int chamberIndex
Muon chamber index of the segment.
int sector
Sector number (typically 0–15).
int layers
Total number of active layers in the segment.
int nSegments
Count of segments in the same chamber/sector/eta group.
Helper struct to ship the Graph from the space point buckets to ONNX.
Definition GraphData.h:25