ATLAS Offline Software
PhysicsAnalysis
JetTagging
FlavorTagInference
Root
FlowElementsLoader.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/FlowElementsLoader.h
"
6
#include "
xAODBase/IParticle.h
"
7
#include "
xAODPFlow/FlowElement.h
"
8
#include <vector>
9
10
namespace
FlavorTagInference
{
11
12
// factory for functions which return the sort variable we
13
// use to order flow elements
14
FlowElementsLoader::FlowElementSortVar
FlowElementsLoader::flowElementSortVar
(
15
ConstituentsSortOrder
config
)
16
{
17
typedef
xAOD::FlowElement
FE;
18
typedef
xAOD::IParticle
Jet
;
19
switch
(
config
) {
20
case
ConstituentsSortOrder::PT_DESCENDING
:
21
return
[](
const
FE*
p
,
const
Jet
&) {
return
p
->pt();};
22
default
: {
23
throw
std::logic_error(
"Unknown sort function"
);
24
}
25
}
26
}
// end of FlowElements sort getter
27
28
FlowElementsLoader::FlowElementsLoader
(
29
const
ConstituentsInputConfig
&
cfg
,
30
const
FTagOptions
&
options
31
):
32
IConstituentsLoader
(
cfg
),
33
m_flowElementSortVar(
FlowElementsLoader
::flowElementSortVar(
cfg
.
order
)),
34
m_seqGetter(getter_utils::SeqGetter<
xAOD
::
FlowElement
>(
35
cfg
.
inputs
,
options
))
36
{
37
static
const
SG::AuxElement::ConstAccessor<PartLinks>
acc
(
"constituentLinks"
);
38
m_associator
= [](
const
xAOD::IParticle
&
jet
) ->
FEV
{
39
FEV
particles
;
40
for
(
const
ElementLink<IPC>
& link :
acc
(
jet
)){
41
if
(!link.isValid()) {
42
throw
std::logic_error(
"invalid particle link"
);
43
}
44
const
auto
*
flow
=
dynamic_cast<
const
xAOD::FlowElement
*
>
(*link);
45
if
(!
flow
){
46
throw
std::runtime_error(
"FlowsLoader: Dynamic cast to FlowElement failed"
);
47
}
48
particles
.push_back(
flow
);
49
}
50
return
particles
;
51
};
52
53
m_used_remap
=
m_seqGetter
.getUsedRemap();
54
m_name
=
cfg
.name;
55
}
56
57
std::vector<const xAOD::FlowElement*>
FlowElementsLoader::getFlowElementsFromJet
(
58
const
xAOD::IParticle
&
jet
59
)
const
60
{
61
std::vector<std::pair<double, const xAOD::FlowElement*>>
particles
;
62
for
(
const
xAOD::FlowElement
*
p
:
m_associator
(
jet
)) {
63
particles
.push_back({
m_flowElementSortVar
(
p
,
jet
),
p
});
64
}
65
std::sort(
particles
.begin(),
particles
.end(), std::greater<>());
66
std::vector<const xAOD::FlowElement*> only_particles;
67
for
(
const
auto
&
particle
:
particles
) {
68
only_particles.push_back(
particle
.second);
69
}
70
return
only_particles;
71
}
72
73
std::tuple<Inputs, std::vector<const xAOD::IParticle*>>
FlowElementsLoader::getData
(
74
const
xAOD::IParticle
&
jet
)
const
{
75
FlowElements
sorted_flows =
getFlowElementsFromJet
(
jet
);
76
77
// We return a dummy vector of IParticles as we don't decorate flow elements
78
return
std::make_tuple(
m_seqGetter
.getFeats(
jet
, sorted_flows), std::vector<const xAOD::IParticle *>{});
79
}
80
81
const
FTagDataDependencyNames
&
FlowElementsLoader::getDependencies
()
const
{
82
return
m_deps
;
83
}
84
const
std::set<std::string>&
FlowElementsLoader::getUsedRemap
()
const
{
85
return
m_used_remap
;
86
}
87
const
std::string&
FlowElementsLoader::getName
()
const
{
88
return
m_name
;
89
}
90
const
ConstituentsType
&
FlowElementsLoader::getType
()
const
{
91
return
m_config
.
type
;
92
}
93
94
}
Trk::ParticleSwitcher::particle
constexpr ParticleHypothesis particle[PARTICLEHYPOTHESES]
the array of masses
Definition:
ParticleHypothesis.h:79
FlavorTagInference::IConstituentsLoader
Definition:
PhysicsAnalysis/JetTagging/FlavorTagInference/FlavorTagInference/ConstituentsLoader.h:77
FlavorTagInference
This file contains "getter" functions used for accessing tagger inputs from the EDM.
Definition:
PhysicsAnalysis/JetTagging/FlavorTagInference/FlavorTagInference/ConstituentsLoader.h:27
IParticle.h
FlavorTagInference::FlowElementsLoader::FlowElements
std::vector< const xAOD::FlowElement * > FlowElements
Definition:
FlowElementsLoader.h:42
FlavorTagInference::FlowElementsLoader::FlowElementSortVar
std::function< double(const xAOD::FlowElement *, const Jet &)> FlowElementSortVar
Definition:
FlowElementsLoader.h:44
FlavorTagInference::ConstituentsSortOrder::PT_DESCENDING
@ PT_DESCENDING
FlavorTagInference::FTagOptions
Definition:
PhysicsAnalysis/JetTagging/FlavorTagInference/FlavorTagInference/DataPrepUtilities.h:45
FlavorTagInference::FlowElementsLoader::m_seqGetter
getter_utils::SeqGetter< xAOD::FlowElement > m_seqGetter
Definition:
FlowElementsLoader.h:60
xAOD
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.
Definition:
ICaloAffectedTool.h:24
SG::ConstAccessor
Helper class to provide constant type-safe access to aux data.
Definition:
ConstAccessor.h:55
FlavorTagInference::FlowElementsLoader::getType
const ConstituentsType & getType() const override
Definition:
FlowElementsLoader.cxx:90
xAOD::IParticle
Class providing the definition of the 4-vector interface.
Definition:
Event/xAOD/xAODBase/xAODBase/IParticle.h:41
FlavorTagInference::FlowElementsLoader::m_associator
std::function< FEV(const Jet &)> m_associator
Definition:
FlowElementsLoader.h:61
postInclude.inputs
inputs
Definition:
postInclude.SortInput.py:15
FlowElementsLoader.h
FlavorTagInference::FlowElementsLoader::FlowElementsLoader
FlowElementsLoader(const ConstituentsInputConfig &cfg, const FTagOptions &options)
Definition:
FlowElementsLoader.cxx:28
config
Definition:
PhysicsAnalysis/AnalysisCommon/AssociationUtils/python/config.py:1
FlavorTagInference::FlowElementsLoader::m_flowElementSortVar
FlowElementSortVar m_flowElementSortVar
Definition:
FlowElementsLoader.h:59
FlavorTagInference::FlowElementsLoader::FEV
std::vector< const xAOD::FlowElement * > FEV
Definition:
FlowElementsLoader.h:53
FlavorTagInference::FlowElementsLoader::getDependencies
const FTagDataDependencyNames & getDependencies() const override
Definition:
FlowElementsLoader.cxx:81
FlavorTagInference::FlowElementsLoader::getName
const std::string & getName() const override
Definition:
FlowElementsLoader.cxx:87
python.utils.AtlRunQueryDQUtils.p
p
Definition:
AtlRunQueryDQUtils.py:209
FlavorTagInference::ConstituentsSortOrder
ConstituentsSortOrder
Definition:
PhysicsAnalysis/JetTagging/FlavorTagInference/FlavorTagInference/ConstituentsLoader.h:30
jet
Definition:
JetCalibTools_PlotJESFactors.cxx:23
FlowElement.h
HepMC::flow
int flow(const T &a, int i)
Definition:
Flow.h:51
FlavorTagInference::IConstituentsLoader::m_deps
FTagDataDependencyNames m_deps
Definition:
PhysicsAnalysis/JetTagging/FlavorTagInference/FlavorTagInference/ConstituentsLoader.h:91
FlavorTagInference::ConstituentsInputConfig
Definition:
PhysicsAnalysis/JetTagging/FlavorTagInference/FlavorTagInference/ConstituentsLoader.h:61
xAOD::FlowElement
FlowElement_v1 FlowElement
Definition of the current "pfo version".
Definition:
FlowElement.h:16
mc.order
order
Configure Herwig7.
Definition:
mc.Herwig7_Dijet.py:12
FlavorTagInference::FTagDataDependencyNames
Definition:
FTagDataDependencyNames.h:12
AthenaPoolTestRead.acc
acc
Definition:
AthenaPoolTestRead.py:16
python.AtlRunQueryLib.options
options
Definition:
AtlRunQueryLib.py:378
FlavorTagInference::FlowElementsLoader::Jet
xAOD::IParticle Jet
Definition:
FlowElementsLoader.h:38
ElementLink
ElementLink implementation for ROOT usage.
Definition:
AthLinks/ElementLink.h:123
FlavorTagInference::ConstituentsType
ConstituentsType
Definition:
PhysicsAnalysis/JetTagging/FlavorTagInference/FlavorTagInference/ConstituentsLoader.h:47
FlavorTagInference::FlowElementsLoader
Definition:
FlowElementsLoader.h:27
WriteCaloSwCorrections.cfg
cfg
Definition:
WriteCaloSwCorrections.py:23
FlavorTagInference::FlowElementsLoader::getFlowElementsFromJet
std::vector< const xAOD::FlowElement * > getFlowElementsFromJet(const xAOD::IParticle &jet) const
Definition:
FlowElementsLoader.cxx:57
FlavorTagInference::FlowElementsLoader::flowElementSortVar
FlowElementSortVar flowElementSortVar(ConstituentsSortOrder)
Definition:
FlowElementsLoader.cxx:14
FlavorTagInference::IConstituentsLoader::m_config
ConstituentsInputConfig m_config
Definition:
PhysicsAnalysis/JetTagging/FlavorTagInference/FlavorTagInference/ConstituentsLoader.h:92
LArG4FSStartPointFilter.particles
list particles
Definition:
LArG4FSStartPointFilter.py:84
FlavorTagInference::ConstituentsInputConfig::type
ConstituentsType type
Definition:
PhysicsAnalysis/JetTagging/FlavorTagInference/FlavorTagInference/ConstituentsLoader.h:64
FlavorTagInference::FlowElementsLoader::getUsedRemap
const std::set< std::string > & getUsedRemap() const override
Definition:
FlowElementsLoader.cxx:84
FlavorTagInference::IConstituentsLoader::m_used_remap
std::set< std::string > m_used_remap
Definition:
PhysicsAnalysis/JetTagging/FlavorTagInference/FlavorTagInference/ConstituentsLoader.h:93
FlavorTagInference::FlowElementsLoader::getData
std::tuple< Inputs, std::vector< const xAOD::IParticle * > > getData(const xAOD::IParticle &jet) const override
Definition:
FlowElementsLoader.cxx:73
FlavorTagInference::IConstituentsLoader::m_name
std::string m_name
Definition:
PhysicsAnalysis/JetTagging/FlavorTagInference/FlavorTagInference/ConstituentsLoader.h:94
xAOD::FlowElement_v1
A detector object made of other lower level object(s)
Definition:
FlowElement_v1.h:25
Generated on Tue Sep 30 2025 21:10:00 for ATLAS Offline Software by
1.8.18