ATLAS Offline Software
PhysicsAnalysis
JetTagging
FlavorTagDiscriminants
Root
DL2HighLevel.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
FlavorTagDiscriminants/DL2HighLevel.h
"
6
#include "
FlavorTagDiscriminants/DL2.h
"
7
#include "
FlavorTagInference/FTagDataDependencyNames.h
"
8
9
#include "
PathResolver/PathResolver.h
"
10
11
#include "lwtnn/parse_json.hh"
12
#include "lwtnn/LightweightGraph.hh"
13
#include "lwtnn/NanReplacer.hh"
14
15
#define BOOST_BIND_GLOBAL_PLACEHOLDERS // Needed to silence Boost pragma message
16
#include <boost/property_tree/json_parser.hpp>
17
#include <boost/property_tree/exceptions.hpp>
18
19
#include <fstream>
20
#include <utility>
21
22
23
namespace
FlavorTagDiscriminants
{
24
25
DL2HighLevel::DL2HighLevel
(
const
std::string& nn_file_name,
26
FlipTagConfig
flip_config,
27
std::map<std::string,std::string> remap_scalar,
28
float
default_output_value):
29
m_dl2(nullptr)
30
{
31
// get the graph
32
std::string nn_path =
PathResolverFindCalibFile
(nn_file_name);
33
if
(nn_path.size() == 0) {
34
throw
std::runtime_error(
"no file found at '"
+ nn_file_name +
"'"
);
35
}
36
std::ifstream input_stream(nn_path);
37
lwt::GraphConfig
config
=
lwt::parse_json_graph
(input_stream);
38
39
if
(
config
.inputs.size() > 1) {
40
throw
std::logic_error(
"DL2 doesn't support multiple inputs"
);
41
}
42
auto
[input_config, constituents_configs,
options
] = dataprep::createGetterConfig<lwt::GraphConfig, lwt::OutputNodeConfig>(
43
config
, flip_config, std::move(remap_scalar));
44
options
.default_output_value = default_output_value;
45
46
m_dl2
.reset(
47
new
DL2
(
48
config
,
// lwtnn config
49
input_config,
// EDM input config
50
constituents_configs,
// edm track input config
51
options
52
));
53
}
54
55
DL2HighLevel::~DL2HighLevel
() =
default
;
56
DL2HighLevel::DL2HighLevel
(
DL2HighLevel
&&) =
default
;
57
DL2HighLevel::DL2HighLevel
(
const
DL2HighLevel
&) =
default
;
58
59
void
DL2HighLevel::decorate
(
const
xAOD::IParticle
& i_jet)
const
{
60
m_dl2
->decorate(i_jet);
61
}
62
void
DL2HighLevel::decorateWithDefaults
(
const
xAOD::IParticle
& i_jet)
const
{
63
m_dl2
->decorateWithDefaults(i_jet);
64
}
65
66
FTagDataDependencyNames
DL2HighLevel::getDataDependencyNames
()
const
67
{
68
return
m_dl2
->getDataDependencyNames();
69
}
70
}
FlavorTagDiscriminants::DL2
Definition:
DL2.h:22
FlavorTagDiscriminants::DL2HighLevel::getDataDependencyNames
FTagDataDependencyNames getDataDependencyNames() const
Definition:
DL2HighLevel.cxx:66
FlavorTagDiscriminants
Definition:
DL2.h:18
FlavorTagInference::SaltModelGraphConfig::parse_json_graph
GraphConfig parse_json_graph(const nlohmann::json &metadata)
Definition:
SaltModelGraphConfig.cxx:40
FlavorTagDiscriminants::DL2HighLevel::~DL2HighLevel
~DL2HighLevel()
FlavorTagDiscriminants::DL2HighLevel
Definition:
DL2HighLevel.h:29
xAOD::IParticle
Class providing the definition of the 4-vector interface.
Definition:
Event/xAOD/xAODBase/xAODBase/IParticle.h:41
config
Definition:
PhysicsAnalysis/AnalysisCommon/AssociationUtils/python/config.py:1
FlavorTagInference::FlipTagConfig
FlipTagConfig
Definition:
FlipTagEnums.h:14
FlavorTagInference::FTagDataDependencyNames
Definition:
FTagDataDependencyNames.h:12
FlavorTagDiscriminants::DL2HighLevel::DL2HighLevel
DL2HighLevel(const std::string &nn_file_name, FlipTagConfig=FlipTagConfig::STANDARD, std::map< std::string, std::string > remap_scalar={}, float default_output_value=NAN)
Definition:
DL2HighLevel.cxx:25
python.AtlRunQueryLib.options
options
Definition:
AtlRunQueryLib.py:378
FlavorTagDiscriminants::DL2HighLevel::decorate
void decorate(const xAOD::IParticle &i_jet) const
Definition:
DL2HighLevel.cxx:59
PathResolver.h
FTagDataDependencyNames.h
DL2.h
DL2HighLevel.h
PathResolverFindCalibFile
std::string PathResolverFindCalibFile(const std::string &logical_file_name)
Definition:
PathResolver.cxx:283
FlavorTagDiscriminants::DL2HighLevel::decorateWithDefaults
void decorateWithDefaults(const xAOD::IParticle &i_jet) const
Definition:
DL2HighLevel.cxx:62
FlavorTagDiscriminants::DL2HighLevel::m_dl2
std::shared_ptr< const DL2 > m_dl2
Definition:
DL2HighLevel.h:42
Generated on Mon Sep 29 2025 21:09:14 for ATLAS Offline Software by
1.8.18