ATLAS Offline Software
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 
9 namespace FlavorTagDiscriminants {
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 
22  MultifoldGNNTool::~MultifoldGNNTool() {}
23 
25 
26  auto opts = getOptions(m_props);
27  if (!m_nnsvc.empty()) {
28  ATH_CHECK(m_nnsvc.retrieve());
29  std::vector<std::shared_ptr<const GNN>> gnns;
30  for (const auto& file: m_nn_files) {
31  gnns.emplace_back(m_nnsvc->get(file, opts));
32  }
33  m_gnn.reset(new MultifoldGNN(gnns, m_fold_hash_name));
34  } else {
35  ATH_MSG_INFO("Initialize multi-fold GNN");
37  }
38 
39  return StatusCode::SUCCESS;
40  }
41 
42  void MultifoldGNNTool::decorate(const xAOD::BTagging& btag) const {
43  m_gnn->decorate(btag);
44  }
46  m_gnn->decorate(jet);
47  }
49  m_gnn->decorateWithDefaults(jet);
50  }
51 
52  // Dependencies
53  std::set<std::string> MultifoldGNNTool::getDecoratorKeys() const {
54  return m_gnn->getDecoratorKeys();
55  }
56  std::set<std::string> MultifoldGNNTool::getAuxInputKeys() const {
57  return m_gnn->getAuxInputKeys();
58  }
59  std::set<std::string> MultifoldGNNTool::getConstituentAuxInputKeys() const {
60  return m_gnn->getConstituentAuxInputKeys();
61  }
62 
63 }
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
FlavorTagDiscriminants
This file contains "getter" functions used for accessing tagger inputs from the EDM.
Definition: AssociationEnums.h:11
SG::AuxElement
Base class for elements of a container that can have aux data.
Definition: AuxElement.h:446
FlavorTagDiscriminants::MultifoldGNNTool::m_gnn
std::shared_ptr< const MultifoldGNN > m_gnn
Definition: MultifoldGNNTool.h:62
FlavorTagDiscriminants::MultifoldGNNTool::getConstituentAuxInputKeys
virtual std::set< std::string > getConstituentAuxInputKeys() const override
Definition: MultifoldGNNTool.cxx:59
asg
Definition: DataHandleTestTool.h:28
FlavorTagDiscriminants::MultifoldGNNTool::decorate
virtual void decorate(const xAOD::BTagging &btag) const override
Method to decorate a jet.
Definition: MultifoldGNNTool.cxx:42
GNNOptions.h
FlavorTagDiscriminants::MultifoldGNNTool::m_nn_files
std::vector< std::string > m_nn_files
Definition: MultifoldGNNTool.h:59
jet
Definition: JetCalibTools_PlotJESFactors.cxx:23
FlavorTagDiscriminants::MultifoldGNNTool::getDecoratorKeys
virtual std::set< std::string > getDecoratorKeys() const override
Definition: MultifoldGNNTool.cxx:53
FlavorTagDiscriminants::MultifoldGNNTool::m_fold_hash_name
std::string m_fold_hash_name
Definition: MultifoldGNNTool.h:60
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
file
TFile * file
Definition: tile_monitor.h:29
FlavorTagDiscriminants::MultifoldGNNTool::m_nnsvc
ServiceHandle< INNSharingSvc > m_nnsvc
Definition: MultifoldGNNTool.h:57
FlavorTagDiscriminants::MultifoldGNNTool::initialize
StatusCode initialize() override
Dummy implementation of the initialisation function.
Definition: MultifoldGNNTool.cxx:24
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
MultifoldGNNTool.h
xAOD::BTagging_v1
Definition: BTagging_v1.h:39
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:192
MultifoldGNN.h
FlavorTagDiscriminants::MultifoldGNNTool::decorateWithDefaults
virtual void decorateWithDefaults(const SG::AuxElement &jet) const override
Method to decorate a jet with defaults.
Definition: MultifoldGNNTool.cxx:48
xAOD::Jet_v1
Class describing a jet.
Definition: Jet_v1.h:57
FlavorTagDiscriminants::MultifoldGNNTool::getAuxInputKeys
virtual std::set< std::string > getAuxInputKeys() const override
Definition: MultifoldGNNTool.cxx:56
FlavorTagDiscriminants::MultifoldGNNTool::m_props
GNNToolProperties m_props
Definition: MultifoldGNNTool.h:61
declareProperty
#define declareProperty(n, p, h)
Definition: BaseFakeBkgTool.cxx:15
FlavorTagDiscriminants::MultifoldGNN
Definition: MultifoldGNN.h:22
athena.opts
opts
Definition: athena.py:86
FlavorTagDiscriminants::getOptions
GNNOptions getOptions(const GNNToolProperties &)
Definition: GNNToolifiers.cxx:22
FlavorTagDiscriminants::propify
void propify(asg::AsgTool &tool, GNNToolProperties *props)
Definition: GNNToolifiers.cxx:12