ATLAS Offline Software
InnerDetector
InDetRecTools
InDetGNNHardScatterSelection
Root
MuonsLoader.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/MuonsLoader.h
"
6
7
#include "
xAODMuon/Muon.h
"
8
9
namespace
InDetGNNHardScatterSelection
{
10
11
// factory for functions which return the sort variable we
12
// use to order iparticles
13
MuonsLoader::MuonSortVar
MuonsLoader::iparticleSortVar
(
14
ConstituentsSortOrder
config
)
15
{
16
typedef
xAOD::Muon
Ip;
17
typedef
xAOD::Vertex
Vertex
;
18
switch
(
config
) {
19
case
ConstituentsSortOrder::PT_DESCENDING
:
20
return
[](
const
Ip*
tp
,
const
Vertex
&) {
return
tp
->pt();};
21
default
: {
22
throw
std::logic_error(
"Unknown sort function"
);
23
}
24
}
25
}
// end of iparticle sort getter
26
27
MuonsLoader::MuonsLoader
(
28
ConstituentsInputConfig
cfg
29
):
30
IConstituentsLoader
(
cfg
),
31
m_iparticleSortVar(
MuonsLoader
::iparticleSortVar(
cfg
.
order
)),
32
m_customSequenceGetter(getter_utils::CustomSequenceGetter<
xAOD
::
Muon
>(
33
cfg
.
inputs
))
34
{
35
const
SG::AuxElement::ConstAccessor<PartLinks>
acc
(
"muonLinks"
);
36
m_associator
= [
acc
](
const
xAOD::Vertex
&
vertex
) ->
IPV
{
37
IPV
particles
;
38
for
(
const
ElementLink<IPC>
& link :
acc
(
vertex
)){
39
if
(!link.isValid()) {
40
throw
std::logic_error(
"invalid particle link"
);
41
}
42
particles
.push_back(*link);
43
}
44
return
particles
;
45
};
46
m_name
=
cfg
.name;
47
}
48
49
std::vector<const xAOD::Muon*>
MuonsLoader::getMuonsFromVertex
(
50
const
xAOD::Vertex
&
vertex
51
)
const
52
{
53
std::vector<std::pair<double, const xAOD::Muon*>>
particles
;
54
for
(
const
xAOD::Muon
*
tp
:
m_associator
(
vertex
)) {
55
particles
.push_back({
m_iparticleSortVar
(
tp
,
vertex
),
tp
});
56
}
57
std::sort(
particles
.begin(),
particles
.end(), std::greater<>());
58
std::vector<const xAOD::Muon*> only_particles;
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, FlavorTagDiscriminants::Inputs, std::vector<const xAOD::IParticle*>>
MuonsLoader::getData
(
66
const
xAOD::Vertex
&
vertex
)
const
{
67
Muons
sorted_particles =
getMuonsFromVertex
(
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
MuonsLoader::getName
()
const
{
76
return
m_name
;
77
}
78
ConstituentsType
MuonsLoader::getType
()
const
{
79
return
m_config
.
type
;
80
}
81
82
}
InDetGNNHardScatterSelection::ConstituentsInputConfig::output_name
std::string output_name
Definition:
InnerDetector/InDetRecTools/InDetGNNHardScatterSelection/InDetGNNHardScatterSelection/ConstituentsLoader.h:47
Trk::ParticleSwitcher::particle
constexpr ParticleHypothesis particle[PARTICLEHYPOTHESES]
the array of masses
Definition:
ParticleHypothesis.h:76
InDetGNNHardScatterSelection::MuonsLoader::getMuonsFromVertex
std::vector< const xAOD::Muon * > getMuonsFromVertex(const xAOD::Vertex &vertex) const
Definition:
MuonsLoader.cxx:49
Muon.h
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
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
Muon
This class provides conversion from CSC RDO data to CSC Digits.
Definition:
TrackSystemController.h:45
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
xAOD::Muon_v1
Class describing a Muon.
Definition:
Muon_v1.h:38
config
Definition:
PhysicsAnalysis/AnalysisCommon/AssociationUtils/python/config.py:1
InDetGNNHardScatterSelection::ConstituentsSortOrder
ConstituentsSortOrder
Definition:
InnerDetector/InDetRecTools/InDetGNNHardScatterSelection/InDetGNNHardScatterSelection/ConstituentsLoader.h:25
python.utils.AtlRunQueryDQUtils.p
p
Definition:
AtlRunQueryDQUtils.py:210
InDetGNNHardScatterSelection::MuonsLoader::getType
ConstituentsType getType() const override
Definition:
MuonsLoader.cxx:78
InDetGNNHardScatterSelection::MuonsLoader::m_associator
std::function< IPV(const Vertex &)> m_associator
Definition:
MuonsLoader.h:62
MuonsLoader.h
mc.order
order
Configure Herwig7.
Definition:
mc.Herwig7_Dijet.py:12
InDetGNNHardScatterSelection::MuonsLoader::IPV
std::vector< const xAOD::Muon * > IPV
Definition:
MuonsLoader.h:54
AthenaPoolTestRead.acc
acc
Definition:
AthenaPoolTestRead.py:16
InDetGNNHardScatterSelection::MuonsLoader
Definition:
MuonsLoader.h:32
InDetGNNHardScatterSelection::MuonsLoader::Vertex
xAOD::Vertex Vertex
Definition:
MuonsLoader.h:41
ElementLink
ElementLink implementation for ROOT usage.
Definition:
AthLinks/ElementLink.h:121
InDetGNNHardScatterSelection::MuonsLoader::m_iparticleSortVar
MuonSortVar m_iparticleSortVar
Definition:
MuonsLoader.h:60
InDetGNNHardScatterSelection::IConstituentsLoader::m_config
ConstituentsInputConfig m_config
Definition:
InnerDetector/InDetRecTools/InDetGNNHardScatterSelection/InDetGNNHardScatterSelection/ConstituentsLoader.h:73
InDetGNNHardScatterSelection::MuonsLoader::iparticleSortVar
MuonSortVar iparticleSortVar(ConstituentsSortOrder)
Definition:
MuonsLoader.cxx:13
InDetGNNHardScatterSelection::MuonsLoader::m_customSequenceGetter
getter_utils::CustomSequenceGetter< xAOD::Muon > m_customSequenceGetter
Definition:
MuonsLoader.h:61
InDetGNNHardScatterSelection::MuonsLoader::getName
std::string getName() const override
Definition:
MuonsLoader.cxx:75
WriteCaloSwCorrections.cfg
cfg
Definition:
WriteCaloSwCorrections.py:23
InDetGNNHardScatterSelection::ConstituentsSortOrder::PT_DESCENDING
@ PT_DESCENDING
Trk::vertex
@ vertex
Definition:
MeasurementType.h:21
InDetGNNHardScatterSelection::MuonsLoader::getData
std::tuple< std::string, FlavorTagDiscriminants::Inputs, std::vector< const xAOD::IParticle * > > getData(const xAOD::Vertex &vertex) const override
Definition:
MuonsLoader.cxx:65
xAOD::Vertex_v1
Class describing a Vertex.
Definition:
Vertex_v1.h:42
Muons
Definition:
Muons.py:1
InDetGNNHardScatterSelection
Definition:
InnerDetector/InDetRecTools/InDetGNNHardScatterSelection/InDetGNNHardScatterSelection/ConstituentsLoader.h:22
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::MuonsLoader::MuonsLoader
MuonsLoader(ConstituentsInputConfig)
Definition:
MuonsLoader.cxx:27
InDetGNNHardScatterSelection::MuonsLoader::MuonSortVar
std::function< double(const xAOD::Muon *, const Vertex &)> MuonSortVar
Definition:
MuonsLoader.h:48
Generated on Thu Nov 7 2024 21:22:23 for ATLAS Offline Software by
1.8.18