ATLAS Offline Software
Loading...
Searching...
No Matches
MultifoldGNNTool.cxx
Go to the documentation of this file.
1/*
2+ Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
5#if __GNUC__ >= 16
6// Suppress false-positive warning seen with gcc16.
7# pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
8#endif
9
13
14namespace FlavorTagInference {
15
16 MultifoldGNNTool::MultifoldGNNTool(const std::string& name):
17 asg::AsgTool(name),
18 m_props()
19 {
20 declareProperty("nnFiles", m_nn_files,
21 "the path to the netowrk file used to run inference");
22 declareProperty("foldHashName", m_fold_hash_name,
23 "the path to the netowrk file used to run inference");
24 propify(*this, &m_props);
25 }
26
28
30
31 const auto opts = FlavorTagInference::getOptions(m_props);
32 if (!m_nnsvc.empty()) {
33 ATH_CHECK(m_nnsvc.retrieve());
34 std::vector<std::shared_ptr<const FlavorTagInference::GNN>> gnns;
35 for (const auto& file: m_nn_files) {
36 auto newopts = opts;
37 if (auto def_handle = m_defaults.value().extract(file)) {
38 newopts.default_output_values = def_handle.mapped();
39 }
40 gnns.emplace_back(m_nnsvc->get(file, newopts));
41 }
42 if (!m_defaults.empty()) {
43 ATH_MSG_ERROR("unused per-fold defaults!");
44 return StatusCode::FAILURE;
45 }
46 m_gnn.reset(new MultifoldGNN(gnns, m_fold_hash_name));
47 } else {
48 ATH_MSG_INFO("Initialize multi-fold GNN");
50 }
51
52 return StatusCode::SUCCESS;
53 }
54
56 m_gnn->decorate(i_jet);
57 }
59 m_gnn->decorateWithDefaults(i_jet);
60 }
61
62 // Dependencies
64 return m_gnn->getDependencies();
65 }
66
67}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_INFO(x)
ASG_TOOL_CLASS(MultifoldGNNTool, IJetTagConditionalDecorator) public ~MultifoldGNNTool()
FlavorTagInference::GNNToolProperties m_props
std::vector< std::string > m_nn_files
std::shared_ptr< const MultifoldGNN > m_gnn
StatusCode initialize() override
Dummy implementation of the initialisation function.
virtual void decorateWithDefaults(const xAOD::IParticle &i_jet) const override
Method to decorate a jet with defaults.
FTagDataDependencyNames getDependencies() const override
virtual void decorate(const xAOD::IParticle &i_jet) const override
Method to decorate a jet.
ServiceHandle< FlavorTagInference::INNSharingSvc > m_nnsvc
Class providing the definition of the 4-vector interface.
This file contains "getter" functions used for accessing tagger inputs from the EDM.
GNNOptions getOptions(const GNNToolProperties &)
void propify(asg::AsgTool &tool, GNNToolProperties *props)
TFile * file