ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
PhysicsAnalysis
JetTagging
FlavorTagDiscriminants
Root
HbbGraphConfig.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
// Note: please don't include any ROOT in here (i.e. xAOD::Jet or
6
// anything from the EDM), it's not a stable dependency (in particular
7
// the TString overloads change between releases).
8
9
#include "
FlavorTagDiscriminants/HbbGraphConfig.h
"
10
#include "
FlavorTagDiscriminants/HbbConstants.h
"
11
12
#include "lwtnn/lightweight_network_config.hh"
13
14
#include <regex>
15
16
namespace
{
17
std::string formatSet(
const
std::set<std::string>& s) {
18
std::string
out
(
"{"
);
19
for
(
const
std::string& var: s) {
20
out
.append(var);
21
if
(var != *
s
.rbegin())
out
.append(
", "
);
22
}
23
out
.append(
"}"
);
24
return
out
;
25
}
26
}
27
28
namespace
FlavorTagDiscriminants
{
29
HbbGraphConfig
getHbbGraphConfig
(
const
lwt::GraphConfig& graph_cfg){
30
namespace
hk =
FlavorTagDiscriminants::hbb_key
;
31
HbbGraphConfig
k;
32
k.n_subjets = 0;
33
std::regex subjet_match(hk::subjet +
"[0-9]+"
);
34
std::string first_match;
35
for
(
const
auto
&
node
: graph_cfg.inputs) {
36
for
(
const
auto
& var:
node
.variables) {
37
const
std::string& name = var.name;
38
k.defaults[
node
.
name
][name] =
node
.defaults.at(name);
39
}
40
if
(
node
.
name
== hk::fatjet) {
41
for
(
const
auto
& var:
node
.variables) {
42
k.fatjet.insert(var.name);
43
}
44
}
else
if
(std::regex_match(
node
.
name
, subjet_match)) {
45
std::set<std::string> subjet_set;
46
for
(
const
auto
& var:
node
.variables) {
47
subjet_set.insert(var.name);
48
}
49
if
(k.n_subjets == 0) {
50
k.subjet = std::move(subjet_set);
51
first_match =
node
.
name
;
52
}
else
if
(k.subjet != subjet_set) {
53
std::string
error
=
"mismatch in subjet keys: we expect the same"
54
" variables to be read from each subjet. "
;
55
error
.append(
"first subjet ("
+ first_match +
") "
56
+ formatSet(k.subjet) +
", match "
57
+ std::to_string(k.n_subjets)
58
+
", ("
+
node
.
name
+
") "
+ formatSet(subjet_set));
59
throw
std::runtime_error(
error
);
60
}
61
k.n_subjets++;
62
}
else
{
63
throw
std::runtime_error(
"no way to match '"
+
node
.
name
+
"'"
);
64
}
65
}
66
return
k;
67
}
68
}
HbbConstants.h
HbbGraphConfig.h
node
Definition
node.h:24
node::name
void name(const std::string &n)
Definition
node.h:40
FlavorTagDiscriminants::hbb_key
Definition
HbbConstants.h:14
FlavorTagDiscriminants
Definition
CaloChargedFlowDecoratorAlg.h:15
FlavorTagDiscriminants::getHbbGraphConfig
HbbGraphConfig getHbbGraphConfig(const lwt::GraphConfig &cfg)
Definition
HbbGraphConfig.cxx:29
error
Definition
IImpactPoint3dEstimator.h:72
python.AthDsoLogger.out
out
Definition
AthDsoLogger.py:70
python.SystemOfUnits.s
float s
Definition
SystemOfUnits.py:147
FlavorTagDiscriminants::HbbGraphConfig
Definition
HbbGraphConfig.h:23
Generated on
for ATLAS Offline Software by
1.17.0