ATLAS Offline Software
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
typedef
xAOD::Jet
Ip;
18
typedef
xAOD::Vertex
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
(
29
ConstituentsInputConfig
cfg
30
):
31
IConstituentsLoader
(
cfg
),
32
m_iparticleSortVar(
JetsLoader
::iparticleSortVar(
cfg
.
order
)),
33
m_customSequenceGetter(getter_utils::CustomSequenceGetter<
xAOD
::
Jet
>(
34
cfg
.
inputs
))
35
{
36
const
SG::AuxElement::ConstAccessor<PartLinks>
acc
(
"jetLinks"
);
37
m_associator
= [
acc
](
const
xAOD::Vertex
&
vertex
) ->
IPV
{
38
IPV
particles
;
39
for
(
const
ElementLink<IPC>
& link :
acc
(
vertex
)){
40
if
(!link.isValid()) {
41
throw
std::logic_error(
"invalid particle link"
);
42
}
43
particles
.push_back(*link);
44
}
45
return
particles
;
46
};
47
m_name
=
cfg
.name;
48
}
49
50
std::vector<const xAOD::Jet*>
JetsLoader::getJetsFromVertex
(
51
const
xAOD::Vertex
&
vertex
52
)
const
53
{
54
std::vector<std::pair<double, const xAOD::Jet*>>
particles
;
55
for
(
const
xAOD::Jet
*
tp
:
m_associator
(
vertex
)) {
56
particles
.push_back({
m_iparticleSortVar
(
tp
,
vertex
),
tp
});
57
}
58
std::sort(
particles
.begin(),
particles
.end(), std::greater<>());
59
std::vector<const xAOD::Jet*> only_particles;
60
for
(
const
auto
&
particle
:
particles
) {
61
only_particles.push_back(
particle
.second);
62
}
63
return
only_particles;
64
}
65
66
std::tuple<std::string, FlavorTagDiscriminants::Inputs, std::vector<const xAOD::IParticle*>>
JetsLoader::getData
(
67
const
xAOD::Vertex
&
vertex
)
const
{
68
Jets
sorted_particles =
getJetsFromVertex
(
vertex
);
69
std::vector<const xAOD::IParticle*> sorted_particles_ip;
70
for
(
const
auto
&
p
: sorted_particles) {
71
sorted_particles_ip.push_back(
p
);
72
}
73
return
std::make_tuple(
m_config
.
output_name
,
m_customSequenceGetter
.getFeats(
vertex
, sorted_particles), sorted_particles_ip);
74
}
75
76
std::string
JetsLoader::getName
()
const
{
77
return
m_name
;
78
}
79
ConstituentsType
JetsLoader::getType
()
const
{
80
return
m_config
.
type
;
81
}
82
83
}
InDetGNNHardScatterSelection::ConstituentsInputConfig::output_name
std::string output_name
Definition:
InnerDetector/InDetRecTools/InDetGNNHardScatterSelection/InDetGNNHardScatterSelection/ConstituentsLoader.h:47
InDetGNNHardScatterSelection::JetsLoader::getType
ConstituentsType getType() const override
Definition:
JetsLoader.cxx:79
Jet.h
Trk::ParticleSwitcher::particle
constexpr ParticleHypothesis particle[PARTICLEHYPOTHESES]
the array of masses
Definition:
ParticleHypothesis.h:76
Jet
Basic data class defines behavior for all Jet objects The Jet class is the principal data class for...
Definition:
Reconstruction/Jet/JetEvent/JetEvent/Jet.h:47
InDetGNNHardScatterSelection::JetsLoader::getData
std::tuple< std::string, FlavorTagDiscriminants::Inputs, std::vector< const xAOD::IParticle * > > getData(const xAOD::Vertex &vertex) const override
Definition:
JetsLoader.cxx:66
Jets
Definition:
Jets.py:1
InDetGNNHardScatterSelection::JetsLoader::Vertex
xAOD::Vertex Vertex
Definition:
JetsLoader.h:41
InDetGNNHardScatterSelection::JetsLoader::m_associator
std::function< IPV(const Vertex &)> m_associator
Definition:
JetsLoader.h:62
ParticleTest.tp
tp
Definition:
ParticleTest.py:25
InDetGNNHardScatterSelection::ConstituentsInputConfig
Definition:
InnerDetector/InDetRecTools/InDetGNNHardScatterSelection/InDetGNNHardScatterSelection/ConstituentsLoader.h:45
InDetGNNHardScatterSelection::ConstituentsType
ConstituentsType
Definition:
InnerDetector/InDetRecTools/InDetGNNHardScatterSelection/InDetGNNHardScatterSelection/ConstituentsLoader.h:31
InDetGNNHardScatterSelection::JetsLoader::JetSortVar
std::function< double(const xAOD::Jet *, const Vertex &)> JetSortVar
Definition:
JetsLoader.h:48
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
InDetGNNHardScatterSelection::JetsLoader::IPV
std::vector< const xAOD::Jet * > IPV
Definition:
JetsLoader.h:54
InDetGNNHardScatterSelection::IConstituentsLoader
Definition:
InnerDetector/InDetRecTools/InDetGNNHardScatterSelection/InDetGNNHardScatterSelection/ConstituentsLoader.h:61
postInclude.inputs
inputs
Definition:
postInclude.SortInput.py:15
InDetGNNHardScatterSelection::ConstituentsInputConfig::type
ConstituentsType type
Definition:
InnerDetector/InDetRecTools/InDetGNNHardScatterSelection/InDetGNNHardScatterSelection/ConstituentsLoader.h:49
config
Definition:
PhysicsAnalysis/AnalysisCommon/AssociationUtils/python/config.py:1
InDetGNNHardScatterSelection::JetsLoader::m_iparticleSortVar
JetSortVar m_iparticleSortVar
Definition:
JetsLoader.h:60
InDetGNNHardScatterSelection::ConstituentsSortOrder
ConstituentsSortOrder
Definition:
InnerDetector/InDetRecTools/InDetGNNHardScatterSelection/InDetGNNHardScatterSelection/ConstituentsLoader.h:25
python.utils.AtlRunQueryDQUtils.p
p
Definition:
AtlRunQueryDQUtils.py:210
mc.order
order
Configure Herwig7.
Definition:
mc.Herwig7_Dijet.py:12
AthenaPoolTestRead.acc
acc
Definition:
AthenaPoolTestRead.py:16
JetsLoader.h
InDetGNNHardScatterSelection::JetsLoader
Definition:
JetsLoader.h:32
InDetGNNHardScatterSelection::JetsLoader::getName
std::string getName() const override
Definition:
JetsLoader.cxx:76
ElementLink
ElementLink implementation for ROOT usage.
Definition:
AthLinks/ElementLink.h:121
InDetGNNHardScatterSelection::IConstituentsLoader::m_config
ConstituentsInputConfig m_config
Definition:
InnerDetector/InDetRecTools/InDetGNNHardScatterSelection/InDetGNNHardScatterSelection/ConstituentsLoader.h:73
WriteCaloSwCorrections.cfg
cfg
Definition:
WriteCaloSwCorrections.py:23
InDetGNNHardScatterSelection::ConstituentsSortOrder::PT_DESCENDING
@ PT_DESCENDING
xAOD::Jet_v1
Class describing a jet.
Definition:
Jet_v1.h:57
InDetGNNHardScatterSelection::JetsLoader::getJetsFromVertex
std::vector< const xAOD::Jet * > getJetsFromVertex(const xAOD::Vertex &vertex) const
Definition:
JetsLoader.cxx:50
Trk::vertex
@ vertex
Definition:
MeasurementType.h:21
xAOD::Vertex_v1
Class describing a Vertex.
Definition:
Vertex_v1.h:42
InDetGNNHardScatterSelection
Definition:
InnerDetector/InDetRecTools/InDetGNNHardScatterSelection/InDetGNNHardScatterSelection/ConstituentsLoader.h:22
InDetGNNHardScatterSelection::JetsLoader::m_customSequenceGetter
getter_utils::CustomSequenceGetter< xAOD::Jet > m_customSequenceGetter
Definition:
JetsLoader.h:61
InDetGNNHardScatterSelection::IConstituentsLoader::m_name
std::string m_name
Definition:
InnerDetector/InDetRecTools/InDetGNNHardScatterSelection/InDetGNNHardScatterSelection/ConstituentsLoader.h:74
LArG4FSStartPointFilter.particles
list particles
Definition:
LArG4FSStartPointFilter.py:84
InDetGNNHardScatterSelection::JetsLoader::iparticleSortVar
JetSortVar iparticleSortVar(ConstituentsSortOrder)
Definition:
JetsLoader.cxx:14
InDetGNNHardScatterSelection::JetsLoader::JetsLoader
JetsLoader(ConstituentsInputConfig)
Definition:
JetsLoader.cxx:28
Generated on Thu Nov 7 2024 21:18:21 for ATLAS Offline Software by
1.8.18