ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
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
Inputs
FlowElementsLoader::getData
(
const
xAOD::IParticle
&
jet
)
const
{
74
FlowElements
sorted_flows =
getFlowElementsFromJet
(
jet
);
75
return
m_seqGetter
.getFeats(
jet
, sorted_flows);
76
}
77
78
const
FTagDataDependencyNames
&
FlowElementsLoader::getDependencies
()
const
{
79
return
m_deps
;
80
}
81
const
std::set<std::string>&
FlowElementsLoader::getUsedRemap
()
const
{
82
return
m_used_remap
;
83
}
84
const
std::string&
FlowElementsLoader::getName
()
const
{
85
return
m_name
;
86
}
87
const
ConstituentsType
&
FlowElementsLoader::getType
()
const
{
88
return
m_config
.type;
89
}
90
91
}
IParticle.h
FlowElement.h
FlowElementsLoader.h
ElementLink
ElementLink implementation for ROOT usage.
Definition
A/AthLinks/ElementLink.h:40
FlavorTagInference::FlowElementsLoader::Jet
xAOD::IParticle Jet
Definition
FlowElementsLoader.h:37
FlavorTagInference::FlowElementsLoader::getData
Inputs getData(const xAOD::IParticle &jet) const override
Definition
FlowElementsLoader.cxx:73
FlavorTagInference::FlowElementsLoader::getType
const ConstituentsType & getType() const override
Definition
FlowElementsLoader.cxx:87
FlavorTagInference::FlowElementsLoader::m_associator
std::function< FEV(const Jet &)> m_associator
Definition
FlowElementsLoader.h:60
FlavorTagInference::FlowElementsLoader::getDependencies
const FTagDataDependencyNames & getDependencies() const override
Definition
FlowElementsLoader.cxx:78
FlavorTagInference::FlowElementsLoader::FlowElementsLoader
FlowElementsLoader(const ConstituentsInputConfig &cfg, const FTagOptions &options)
Definition
FlowElementsLoader.cxx:28
FlavorTagInference::FlowElementsLoader::FlowElementSortVar
std::function< double(const xAOD::FlowElement *, const Jet &)> FlowElementSortVar
Definition
FlowElementsLoader.h:43
FlavorTagInference::FlowElementsLoader::m_flowElementSortVar
FlowElementSortVar m_flowElementSortVar
Definition
FlowElementsLoader.h:58
FlavorTagInference::FlowElementsLoader::m_seqGetter
getter_utils::SeqGetter< xAOD::FlowElement > m_seqGetter
Definition
FlowElementsLoader.h:59
FlavorTagInference::FlowElementsLoader::getUsedRemap
const std::set< std::string > & getUsedRemap() const override
Definition
FlowElementsLoader.cxx:81
FlavorTagInference::FlowElementsLoader::getName
const std::string & getName() const override
Definition
FlowElementsLoader.cxx:84
FlavorTagInference::FlowElementsLoader::getFlowElementsFromJet
std::vector< const xAOD::FlowElement * > getFlowElementsFromJet(const xAOD::IParticle &jet) const
Definition
FlowElementsLoader.cxx:57
FlavorTagInference::FlowElementsLoader::FEV
std::vector< const xAOD::FlowElement * > FEV
Definition
FlowElementsLoader.h:52
FlavorTagInference::FlowElementsLoader::FlowElements
std::vector< const xAOD::FlowElement * > FlowElements
Definition
FlowElementsLoader.h:41
FlavorTagInference::FlowElementsLoader::flowElementSortVar
FlowElementSortVar flowElementSortVar(ConstituentsSortOrder)
Definition
FlowElementsLoader.cxx:14
FlavorTagInference::IConstituentsLoader::m_config
ConstituentsInputConfig m_config
Definition
PhysicsAnalysis/JetTagging/FlavorTagInference/FlavorTagInference/ConstituentsLoader.h:100
FlavorTagInference::IConstituentsLoader::m_used_remap
std::set< std::string > m_used_remap
Definition
PhysicsAnalysis/JetTagging/FlavorTagInference/FlavorTagInference/ConstituentsLoader.h:101
FlavorTagInference::IConstituentsLoader::m_name
std::string m_name
Definition
PhysicsAnalysis/JetTagging/FlavorTagInference/FlavorTagInference/ConstituentsLoader.h:102
FlavorTagInference::IConstituentsLoader::IConstituentsLoader
IConstituentsLoader(const ConstituentsInputConfig &cfg)
Definition
PhysicsAnalysis/JetTagging/FlavorTagInference/FlavorTagInference/ConstituentsLoader.h:86
FlavorTagInference::IConstituentsLoader::m_deps
FTagDataDependencyNames m_deps
Definition
PhysicsAnalysis/JetTagging/FlavorTagInference/FlavorTagInference/ConstituentsLoader.h:99
xAOD::IParticle
Class providing the definition of the 4-vector interface.
Definition
Event/xAOD/xAODBase/xAODBase/IParticle.h:41
FlavorTagInference::getter_utils
Definition
PhysicsAnalysis/JetTagging/FlavorTagInference/FlavorTagInference/CustomGetterUtils.h:39
FlavorTagInference
This file contains "getter" functions used for accessing tagger inputs from the EDM.
Definition
CaloClusterLoader.h:27
FlavorTagInference::ConstituentsType
ConstituentsType
Definition
PhysicsAnalysis/JetTagging/FlavorTagInference/FlavorTagInference/ConstituentsLoader.h:48
FlavorTagInference::ConstituentsSortOrder
ConstituentsSortOrder
Definition
PhysicsAnalysis/JetTagging/FlavorTagInference/FlavorTagInference/ConstituentsLoader.h:29
FlavorTagInference::ConstituentsSortOrder::PT_DESCENDING
@ PT_DESCENDING
Definition
PhysicsAnalysis/JetTagging/FlavorTagInference/FlavorTagInference/ConstituentsLoader.h:32
jet
Definition
JetCalibTools_PlotJESFactors.cxx:23
std::sort
void sort(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of sort for DataVector/List.
Definition
DVL_algorithms.h:554
xAOD
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.
Definition
ICaloAffectedTool.h:24
xAOD::FlowElement
FlowElement_v1 FlowElement
Definition of the current "pfo version".
Definition
FlowElement.h:16
FlavorTagInference::ConstituentsInputConfig
Definition
PhysicsAnalysis/JetTagging/FlavorTagInference/FlavorTagInference/ConstituentsLoader.h:67
FlavorTagInference::FTagDataDependencyNames
Definition
FTagDataDependencyNames.h:12
FlavorTagInference::FTagOptions
Definition
PhysicsAnalysis/JetTagging/FlavorTagInference/FlavorTagInference/DataPrepUtilities.h:45
Generated on
for ATLAS Offline Software by
1.17.0