ATLAS Offline Software
Loading...
Searching...
No Matches
PhysicsAnalysis
JetTagging
FlavorTagInference
Root
SaltModelGraphConfig.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
FlavorTagInference/SaltModelGraphConfig.h
"
6
7
namespace
FlavorTagInference
{
8
namespace
SaltModelGraphConfig
{
9
Input
get_input
(
const
nlohmann::json& v) {
10
std::string name = v.at(
"name"
).get<std::string>();
11
auto
offset = v.at(
"offset"
).get<
double
>();
12
auto
scale = v.at(
"scale"
).get<
double
>();
13
return
{std::move(name), offset, scale};
14
}
15
16
InputNodeConfig
get_input_node
(
const
nlohmann::json& v) {
17
InputNodeConfig
cfg;
18
cfg.name = v.at(
"name"
).get<std::string>();
19
for
(
const
auto
& var: v.at(
"variables"
)) {
20
cfg.variables.push_back(
get_input
(var));
21
if
(var.contains(
"default"
)) {
22
std::string name = var.at(
"name"
).get<std::string>();
23
cfg.defaults.emplace(name, var.at(
"default"
).get<
double
>());
24
}
25
}
26
return
cfg;
27
}
28
29
OutputNodeConfig
get_output_node
(
const
nlohmann::json& v) {
30
OutputNodeConfig
cfg;
31
for
(
const
auto
& lab: v.at(
"labels"
)) {
32
cfg.labels.push_back(lab.get<std::string>());
33
}
34
int
idx = v.at(
"node_index"
).get<
int
>();
35
if
(idx < 0)
throw
std::logic_error(
"output node index is negative"
);
36
cfg.node_index = idx;
37
return
cfg;
38
}
39
40
GraphConfig
parse_json_graph
(
const
nlohmann::json& metadata) {
41
GraphConfig
cfg;
42
for
(
const
auto
& v: metadata.at(
"inputs"
)) {
43
cfg.inputs.push_back(
get_input_node
(v));
44
}
45
for
(
const
auto
& v: metadata.at(
"input_sequences"
)) {
46
cfg.input_sequences.push_back(
get_input_node
(v));
47
}
48
if
(metadata.contains(
"outputs"
)) {
49
for
(
const
auto
& v: metadata.at(
"outputs"
).items()) {
50
std::string name = v.key();
51
cfg.outputs.emplace(name,
get_output_node
(v.value()));
52
}
53
}
54
return
cfg;
55
}
56
}
57
}
SaltModelGraphConfig.h
FlavorTagInference::SaltModelGraphConfig
Definition
SaltModelGraphConfig.h:13
FlavorTagInference::SaltModelGraphConfig::parse_json_graph
GraphConfig parse_json_graph(const nlohmann::json &metadata)
Definition
SaltModelGraphConfig.cxx:40
FlavorTagInference::SaltModelGraphConfig::get_input
Input get_input(const nlohmann::json &v)
Definition
SaltModelGraphConfig.cxx:9
FlavorTagInference::SaltModelGraphConfig::get_output_node
OutputNodeConfig get_output_node(const nlohmann::json &v)
Definition
SaltModelGraphConfig.cxx:29
FlavorTagInference::SaltModelGraphConfig::get_input_node
InputNodeConfig get_input_node(const nlohmann::json &v)
Definition
SaltModelGraphConfig.cxx:16
FlavorTagInference
This file contains "getter" functions used for accessing tagger inputs from the EDM.
Definition
PhysicsAnalysis/JetTagging/FlavorTagInference/FlavorTagInference/ConstituentsLoader.h:27
FlavorTagInference::SaltModelGraphConfig::GraphConfig
Definition
SaltModelGraphConfig.h:36
FlavorTagInference::SaltModelGraphConfig::InputNodeConfig
Definition
SaltModelGraphConfig.h:22
FlavorTagInference::SaltModelGraphConfig::Input
Definition
SaltModelGraphConfig.h:15
FlavorTagInference::SaltModelGraphConfig::OutputNodeConfig
Definition
SaltModelGraphConfig.h:30
Generated on
for ATLAS Offline Software by
1.14.0