ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
InnerDetector
InDetRecTools
InDetGNNHardScatterSelection
Root
JetsLoader.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
InDetGNNHardScatterSelection/JetsLoader.h
"
6
7
#include "
xAODJet/Jet.h
"
8
9
namespace
InDetGNNHardScatterSelection
{
10
11
12
// factory for functions which return the sort variable we
13
// use to order iparticles
14
JetsLoader::JetSortVar
JetsLoader::iparticleSortVar
(
15
ConstituentsSortOrder
config)
16
{
17
using
Ip =
xAOD::Jet
;
18
using
Vertex
=
xAOD::Vertex
;
19
switch
(config) {
20
case
ConstituentsSortOrder::PT_DESCENDING
:
21
return
[](
const
Ip* tp,
const
Vertex
&) {
return
tp->pt();};
22
default
: {
23
throw
std::logic_error(
"Unknown sort function"
);
24
}
25
}
26
}
// end of iparticle sort getter
27
28
JetsLoader::JetsLoader
(
const
ConstituentsInputConfig
& cfg):
29
IConstituentsLoader
(cfg),
30
m_iparticleSortVar
(
JetsLoader
::
iparticleSortVar
(cfg.order)),
31
m_customSequenceGetter
(
getter_utils
::CustomSequenceGetter<
xAOD
::
Jet
>(
32
cfg.inputs))
33
{
34
const
SG::AuxElement::ConstAccessor<PartLinks> acc(
"jetLinks"
);
35
m_associator
= [acc](
const
xAOD::Vertex
& vertex) ->
IPV
{
36
IPV
particles;
37
for
(
const
ElementLink<IPC>
& link : acc(vertex)){
38
if
(!link.isValid()) {
39
throw
std::logic_error(
"invalid particle link"
);
40
}
41
particles.push_back(*link);
42
}
43
return
particles;
44
};
45
m_name
= cfg.name;
46
}
47
48
std::vector<const xAOD::Jet*>
JetsLoader::getJetsFromVertex
(
49
const
xAOD::Vertex
& vertex
50
)
const
51
{
52
std::vector<std::pair<double, const xAOD::Jet*>> particles;
53
for
(
const
xAOD::Jet
*tp :
m_associator
(vertex)) {
54
particles.emplace_back(
m_iparticleSortVar
(tp, vertex), tp);
55
}
56
std::sort
(particles.begin(), particles.end(), std::greater<>());
57
std::vector<const xAOD::Jet*> only_particles;
58
only_particles.reserve(particles.size());
59
for
(
const
auto
& particle: particles) {
60
only_particles.push_back(particle.second);
61
}
62
return
only_particles;
63
}
64
65
std::tuple<std::string, FlavorTagInference::Inputs, std::vector<const xAOD::IParticle*>>
JetsLoader::getData
(
66
const
xAOD::Vertex
& vertex)
const
{
67
Jets
sorted_particles =
getJetsFromVertex
(vertex);
68
std::vector<const xAOD::IParticle*> sorted_particles_ip;
69
for
(
const
auto
& p: sorted_particles) {
70
sorted_particles_ip.push_back(p);
71
}
72
return
std::make_tuple(
m_config
.output_name,
m_customSequenceGetter
.getFeats(vertex, sorted_particles), sorted_particles_ip);
73
}
74
75
std::string
JetsLoader::getName
()
const
{
76
return
m_name
;
77
}
78
ConstituentsType
JetsLoader::getType
()
const
{
79
return
m_config
.type;
80
}
81
82
}
Jet.h
JetsLoader.h
ElementLink
ElementLink implementation for ROOT usage.
Definition
A/AthLinks/ElementLink.h:40
InDetGNNHardScatterSelection::IConstituentsLoader::m_name
std::string m_name
Definition
InnerDetector/InDetRecTools/InDetGNNHardScatterSelection/InDetGNNHardScatterSelection/ConstituentsLoader.h:72
InDetGNNHardScatterSelection::IConstituentsLoader::IConstituentsLoader
IConstituentsLoader(const ConstituentsInputConfig &cfg)
Definition
InnerDetector/InDetRecTools/InDetGNNHardScatterSelection/InDetGNNHardScatterSelection/ConstituentsLoader.h:63
InDetGNNHardScatterSelection::IConstituentsLoader::m_config
ConstituentsInputConfig m_config
Definition
InnerDetector/InDetRecTools/InDetGNNHardScatterSelection/InDetGNNHardScatterSelection/ConstituentsLoader.h:71
InDetGNNHardScatterSelection::JetsLoader::IPV
std::vector< const xAOD::Jet * > IPV
Definition
JetsLoader.h:54
InDetGNNHardScatterSelection::JetsLoader::JetSortVar
std::function< double(const xAOD::Jet *, const Vertex &)> JetSortVar
Definition
JetsLoader.h:48
InDetGNNHardScatterSelection::JetsLoader::getData
std::tuple< std::string, FlavorTagInference::Inputs, std::vector< const xAOD::IParticle * > > getData(const xAOD::Vertex &vertex) const override
Definition
JetsLoader.cxx:65
InDetGNNHardScatterSelection::JetsLoader::m_customSequenceGetter
getter_utils::CustomSequenceGetter< xAOD::Jet > m_customSequenceGetter
Definition
JetsLoader.h:61
InDetGNNHardScatterSelection::JetsLoader::m_associator
std::function< IPV(const Vertex &)> m_associator
Definition
JetsLoader.h:62
InDetGNNHardScatterSelection::JetsLoader::m_iparticleSortVar
JetSortVar m_iparticleSortVar
Definition
JetsLoader.h:60
InDetGNNHardScatterSelection::JetsLoader::getJetsFromVertex
std::vector< const xAOD::Jet * > getJetsFromVertex(const xAOD::Vertex &vertex) const
Definition
JetsLoader.cxx:48
InDetGNNHardScatterSelection::JetsLoader::iparticleSortVar
static JetSortVar iparticleSortVar(ConstituentsSortOrder)
Definition
JetsLoader.cxx:14
InDetGNNHardScatterSelection::JetsLoader::JetsLoader
JetsLoader(const ConstituentsInputConfig &)
Definition
JetsLoader.cxx:28
InDetGNNHardScatterSelection::JetsLoader::Vertex
xAOD::Vertex Vertex
Definition
JetsLoader.h:41
InDetGNNHardScatterSelection::JetsLoader::getName
std::string getName() const override
Definition
JetsLoader.cxx:75
InDetGNNHardScatterSelection::JetsLoader::getType
ConstituentsType getType() const override
Definition
JetsLoader.cxx:78
Jet
Definition
Reconstruction/Jet/JetEvent/JetEvent/Jet.h:47
InDetGNNHardScatterSelection::getter_utils
Utils to produce Constituent -> vector<double> functions.
Definition
InnerDetector/InDetRecTools/InDetGNNHardScatterSelection/InDetGNNHardScatterSelection/CustomGetterUtils.h:46
InDetGNNHardScatterSelection
Definition
InnerDetector/InDetRecTools/InDetGNNHardScatterSelection/InDetGNNHardScatterSelection/ConstituentsLoader.h:22
InDetGNNHardScatterSelection::ConstituentsType
ConstituentsType
Definition
InnerDetector/InDetRecTools/InDetGNNHardScatterSelection/InDetGNNHardScatterSelection/ConstituentsLoader.h:31
InDetGNNHardScatterSelection::ConstituentsSortOrder
ConstituentsSortOrder
Definition
InnerDetector/InDetRecTools/InDetGNNHardScatterSelection/InDetGNNHardScatterSelection/ConstituentsLoader.h:25
InDetGNNHardScatterSelection::ConstituentsSortOrder::PT_DESCENDING
@ PT_DESCENDING
Definition
InnerDetector/InDetRecTools/InDetGNNHardScatterSelection/InDetGNNHardScatterSelection/ConstituentsLoader.h:26
Jets
Definition
Jets.py:1
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::Jet
Jet_v1 Jet
Definition of the current "jet version".
Definition
Event/xAOD/xAODJet/xAODJet/Jet.h:17
xAOD::Vertex
Vertex_v1 Vertex
Define the latest version of the vertex class.
Definition
Event/xAOD/xAODTracking/xAODTracking/Vertex.h:16
InDetGNNHardScatterSelection::ConstituentsInputConfig
Definition
InnerDetector/InDetRecTools/InDetGNNHardScatterSelection/InDetGNNHardScatterSelection/ConstituentsLoader.h:45
Generated on
for ATLAS Offline Software by
1.17.0