ATLAS Offline Software
Loading...
Searching...
No Matches
MultifoldGNNTool.cxx
Go to the documentation of this file.
1/*
2+ Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3*/
4
8
9namespace FlavorTagInference {
10
11 MultifoldGNNTool::MultifoldGNNTool(const std::string& name):
12 asg::AsgTool(name),
13 m_props()
14 {
15 declareProperty("nnFiles", m_nn_files,
16 "the path to the netowrk file used to run inference");
17 declareProperty("foldHashName", m_fold_hash_name,
18 "the path to the netowrk file used to run inference");
19 propify(*this, &m_props);
20 }
21
23
25
26 const auto opts = FlavorTagInference::getOptions(m_props);
27 if (!m_nnsvc.empty()) {
28 ATH_CHECK(m_nnsvc.retrieve());
29 std::vector<std::shared_ptr<const FlavorTagInference::GNN>> gnns;
30 for (const auto& file: m_nn_files) {
31 auto newopts = opts;
32 if (auto def_handle = m_defaults.value().extract(file)) {
33 newopts.default_output_values = def_handle.mapped();
34 }
35 gnns.emplace_back(m_nnsvc->get(file, newopts));
36 }
37 if (!m_defaults.empty()) {
38 ATH_MSG_ERROR("unused per-fold defaults!");
39 return StatusCode::FAILURE;
40 }
41 m_gnn.reset(new MultifoldGNN(gnns, m_fold_hash_name));
42 } else {
43 ATH_MSG_INFO("Initialize multi-fold GNN");
45 }
46
47 return StatusCode::SUCCESS;
48 }
49
51 m_gnn->decorate(i_jet);
52 }
54 m_gnn->decorateWithDefaults(i_jet);
55 }
56
57 // Dependencies
59 return m_gnn->getDependencies();
60 }
61
62}
#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