ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
PhysicsAnalysis
JetTagging
FlavorTagInference
FlavorTagInference
GNN.h
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3
4
This class is used in conjunction with SaltModel to run inference on a GNN model.
5
Whereas SaltModel handles the interfacing with the ONNX runtime, this class handles
6
the interfacing with the ATLAS EDM. It is responsible for collecting all the inputs
7
needed for inference, running inference (via SaltModel), and decorating the results
8
back to ATLAS EDM.
9
*/
10
11
#ifndef FLAVORTAGINFERENCE_GNN_H
12
#define FLAVORTAGINFERENCE_GNN_H
13
14
// Tool includes
15
#include "
FlavorTagInference/DataPrepUtilities.h
"
16
#include "
FlavorTagInference/FTagDataDependencyNames.h
"
17
#include "
FlavorTagInference/FlipTagEnums.h
"
18
#include "
FlavorTagInference/GNNDataLoader.h
"
19
#include "
FlavorTagInference/GNNOptions.h
"
20
#include "
FlavorTagInference/ISaltModel.h
"
21
22
// EDM includes
23
#include "
xAODBase/IParticle.h
"
24
25
#include <string>
26
#include <map>
27
28
namespace
FlavorTagInference
{
29
30
struct
GNNOptions
;
31
32
//
33
// Tool to to flavor tag jet/btagging object
34
// using GNN based taggers
35
class
GNN
36
{
37
public
:
38
// recommended constructor, file path + options
39
GNN
(
const
std::string& nnFile,
const
GNNOptions
& opts);
40
// Formerly private constructor, promoted to public to contain
41
// preprocessor macros within a single class in the package: NNSharingSvc
42
GNN
(
ISaltModelPtr
,
const
GNNOptions
& opts);
43
// redefined options constructor, will share underlying network
44
GNN
(
const
GNN
&,
const
GNNOptions
& opts);
45
// legacy constructor
46
GNN
(
const
std::string& nnFile,
47
const
FlipTagConfig
& flip_config =
FlipTagConfig::STANDARD
,
48
const
std::map<std::string, std::string>& variableRemapping = {},
49
float
defaultOutputValue = NAN);
50
GNN
(
GNN
&&);
51
GNN
(
const
GNN
&);
52
virtual
~GNN
();
53
54
virtual
void
decorate
(
const
xAOD::IParticle
& i_jet)
const
;
55
virtual
void
decorateWithDefaults
(
const
xAOD::IParticle
&
jet
)
const
;
56
57
// cppcheck-suppress returnByReference
58
FTagDataDependencyNames
getDependencies
()
const
;
59
60
private
:
61
template
<
typename
T>
62
using
Dec
=
SG::Decorator<T>
;
63
64
template
<
typename
T>
65
using
Decs
= std::vector<std::pair<std::string, Dec<T>>>;
66
67
struct
Decorators
{
68
Decs<float>
jetFloat
;
69
Decs<std::vector<char>
>
jetVecChar
;
70
Decs<std::vector<float>
>
jetVecFloat
;
71
Decs<std::vector<int>
>
jetVecInt
;
72
Decs<std::vector<float>
>
jetVecTruncFloat
;
73
Decs<char>
trackChar
;
74
Decs<float>
trackFloat
;
75
};
76
77
/* create all decorators */
78
std::tuple<FTagDataDependencyNames, std::set<std::string>>
79
createDecorators
(
const
OutputConfig
& outConfig,
const
FTagOptions
& options);
80
81
ISaltModelPtr
m_saltModel
;
82
std::string
m_input_node_name
;
83
GNNDataLoader
m_dataLoader
;
84
85
Decorators
m_decorators
;
86
std::vector<float>
m_truncFloatScales
;
// per-entry scale for jetVecTruncFloat
87
std::vector<std::pair<int,int>>
m_truncFloatBits
;
// (exp_bits, man_bits) per VECTRUNCFLOAT output
88
std::vector<std::pair<Dec<float>,
float
>>
m_defaultValues
;
89
bool
m_defaultZeroTracks
;
90
};
91
}
// end namespace FlavorTagInference
92
#endif
//GNN_H
IParticle.h
FTagDataDependencyNames.h
FlipTagEnums.h
GNNDataLoader.h
GNNOptions.h
ISaltModel.h
DataPrepUtilities.h
FlavorTagInference::GNNDataLoader
Definition
GNNDataLoader.h:16
FlavorTagInference::GNN::createDecorators
std::tuple< FTagDataDependencyNames, std::set< std::string > > createDecorators(const OutputConfig &outConfig, const FTagOptions &options)
Definition
GNN.cxx:192
FlavorTagInference::GNN::m_defaultZeroTracks
bool m_defaultZeroTracks
Definition
GNN.h:89
FlavorTagInference::GNN::m_truncFloatBits
std::vector< std::pair< int, int > > m_truncFloatBits
Definition
GNN.h:87
FlavorTagInference::GNN::Decs
std::vector< std::pair< std::string, Dec< T > > > Decs
Definition
GNN.h:65
FlavorTagInference::GNN::m_truncFloatScales
std::vector< float > m_truncFloatScales
Definition
GNN.h:86
FlavorTagInference::GNN::GNN
GNN(GNN &&)
FlavorTagInference::GNN::~GNN
virtual ~GNN()
FlavorTagInference::GNN::GNN
GNN(const GNN &)
FlavorTagInference::GNN::m_saltModel
ISaltModelPtr m_saltModel
Definition
GNN.h:81
FlavorTagInference::GNN::m_dataLoader
GNNDataLoader m_dataLoader
Definition
GNN.h:83
FlavorTagInference::GNN::m_decorators
Decorators m_decorators
Definition
GNN.h:85
FlavorTagInference::GNN::m_input_node_name
std::string m_input_node_name
Definition
GNN.h:82
FlavorTagInference::GNN::decorateWithDefaults
virtual void decorateWithDefaults(const xAOD::IParticle &jet) const
Definition
GNN.cxx:97
FlavorTagInference::GNN::Dec
SG::Decorator< T > Dec
Definition
GNN.h:62
FlavorTagInference::GNN::decorate
virtual void decorate(const xAOD::IParticle &i_jet) const
Definition
GNN.cxx:123
FlavorTagInference::GNN::GNN
GNN(const std::string &nnFile, const GNNOptions &opts)
Definition
GNN.cxx:38
FlavorTagInference::GNN::getDependencies
FTagDataDependencyNames getDependencies() const
Definition
GNN.cxx:187
FlavorTagInference::GNN::m_defaultValues
std::vector< std::pair< Dec< float >, float > > m_defaultValues
Definition
GNN.h:88
xAOD::IParticle
Class providing the definition of the 4-vector interface.
Definition
Event/xAOD/xAODBase/xAODBase/IParticle.h:41
FlavorTagInference
This file contains "getter" functions used for accessing tagger inputs from the EDM.
Definition
CaloClusterLoader.h:27
FlavorTagInference::OutputConfig
std::vector< SaltModelOutput > OutputConfig
Definition
ISaltModel.h:38
FlavorTagInference::FlipTagConfig
FlipTagConfig
Definition
FlipTagEnums.h:17
FlavorTagInference::FlipTagConfig::STANDARD
@ STANDARD
Definition
FlipTagEnums.h:18
FlavorTagInference::ISaltModelPtr
std::shared_ptr< const ISaltModel > ISaltModelPtr
Definition
ISaltModel.h:56
SG::Decorator
SG::Decorator< T, ALLOC > Decorator
Helper class to provide type-safe access to aux data, specialized for JaggedVecElt.
Definition
AuxElement.h:576
jet
Definition
JetCalibTools_PlotJESFactors.cxx:23
FlavorTagInference::FTagDataDependencyNames
Definition
FTagDataDependencyNames.h:12
FlavorTagInference::FTagOptions
Definition
PhysicsAnalysis/JetTagging/FlavorTagInference/FlavorTagInference/DataPrepUtilities.h:45
FlavorTagInference::GNNOptions
Definition
GNNOptions.h:15
FlavorTagInference::GNN::Decorators
Definition
GNN.h:67
FlavorTagInference::GNN::Decorators::jetVecFloat
Decs< std::vector< float > > jetVecFloat
Definition
GNN.h:70
FlavorTagInference::GNN::Decorators::jetVecChar
Decs< std::vector< char > > jetVecChar
Definition
GNN.h:69
FlavorTagInference::GNN::Decorators::trackChar
Decs< char > trackChar
Definition
GNN.h:73
FlavorTagInference::GNN::Decorators::jetVecInt
Decs< std::vector< int > > jetVecInt
Definition
GNN.h:71
FlavorTagInference::GNN::Decorators::jetVecTruncFloat
Decs< std::vector< float > > jetVecTruncFloat
Definition
GNN.h:72
FlavorTagInference::GNN::Decorators::trackFloat
Decs< float > trackFloat
Definition
GNN.h:74
FlavorTagInference::GNN::Decorators::jetFloat
Decs< float > jetFloat
Definition
GNN.h:68
Generated on
for ATLAS Offline Software by
1.17.0