ATLAS Offline Software
Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | List of all members
InDetGNNHardScatterSelection::MuonsLoader Class Reference

#include <MuonsLoader.h>

Inheritance diagram for InDetGNNHardScatterSelection::MuonsLoader:
Collaboration diagram for InDetGNNHardScatterSelection::MuonsLoader:

Public Member Functions

 MuonsLoader (ConstituentsInputConfig)
 
std::tuple< std::string, FlavorTagDiscriminants::Inputs, std::vector< const xAOD::IParticle * > > getData (const xAOD::Vertex &vertex) const override
 
std::string getName () const override
 
ConstituentsType getType () const override
 

Protected Types

typedef xAOD::Vertex Vertex
 
typedef std::pair< std::string, double > NamedVar
 
typedef std::pair< std::string, std::vector< double > > NamedSeq
 
typedef std::vector< const xAOD::Muon * > Muons
 
typedef std::vector< const xAOD::IParticle * > Particles
 
typedef std::function< double(const xAOD::Muon *, const Vertex &)> MuonSortVar
 
using AE = SG::AuxElement
 
using IPC = xAOD::MuonContainer
 
using PartLinks = std::vector< ElementLink< IPC > >
 
using IPV = std::vector< const xAOD::Muon * >
 

Protected Member Functions

MuonSortVar iparticleSortVar (ConstituentsSortOrder)
 
std::vector< const xAOD::Muon * > getMuonsFromVertex (const xAOD::Vertex &vertex) const
 

Protected Attributes

MuonSortVar m_iparticleSortVar
 
getter_utils::CustomSequenceGetter< xAOD::Muonm_customSequenceGetter
 
std::function< IPV(const Vertex &)> m_associator
 
ConstituentsInputConfig m_config
 
std::string m_name
 

Detailed Description

Definition at line 32 of file MuonsLoader.h.

Member Typedef Documentation

◆ AE

Definition at line 51 of file MuonsLoader.h.

◆ IPC

Definition at line 52 of file MuonsLoader.h.

◆ IPV

Definition at line 54 of file MuonsLoader.h.

◆ Muons

Definition at line 45 of file MuonsLoader.h.

◆ MuonSortVar

Definition at line 48 of file MuonsLoader.h.

◆ NamedSeq

typedef std::pair<std::string, std::vector<double> > InDetGNNHardScatterSelection::MuonsLoader::NamedSeq
protected

Definition at line 43 of file MuonsLoader.h.

◆ NamedVar

typedef std::pair<std::string, double> InDetGNNHardScatterSelection::MuonsLoader::NamedVar
protected

Definition at line 42 of file MuonsLoader.h.

◆ Particles

Definition at line 46 of file MuonsLoader.h.

◆ PartLinks

Definition at line 53 of file MuonsLoader.h.

◆ Vertex

Definition at line 41 of file MuonsLoader.h.

Constructor & Destructor Documentation

◆ MuonsLoader()

InDetGNNHardScatterSelection::MuonsLoader::MuonsLoader ( ConstituentsInputConfig  cfg)

Definition at line 27 of file MuonsLoader.cxx.

29  :
32  m_customSequenceGetter(getter_utils::CustomSequenceGetter<xAOD::Muon>(
33  cfg.inputs))
34  {
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  }

Member Function Documentation

◆ getData()

std::tuple< std::string, FlavorTagDiscriminants::Inputs, std::vector< const xAOD::IParticle * > > InDetGNNHardScatterSelection::MuonsLoader::getData ( const xAOD::Vertex vertex) const
overridevirtual

Implements InDetGNNHardScatterSelection::IConstituentsLoader.

Definition at line 65 of file MuonsLoader.cxx.

66  {
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  }

◆ getMuonsFromVertex()

std::vector< const xAOD::Muon * > InDetGNNHardScatterSelection::MuonsLoader::getMuonsFromVertex ( const xAOD::Vertex vertex) const
protected

Definition at line 49 of file MuonsLoader.cxx.

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  }

◆ getName()

std::string InDetGNNHardScatterSelection::MuonsLoader::getName ( ) const
overridevirtual

Implements InDetGNNHardScatterSelection::IConstituentsLoader.

Definition at line 75 of file MuonsLoader.cxx.

75  {
76  return m_name;
77  }

◆ getType()

ConstituentsType InDetGNNHardScatterSelection::MuonsLoader::getType ( ) const
overridevirtual

Implements InDetGNNHardScatterSelection::IConstituentsLoader.

Definition at line 78 of file MuonsLoader.cxx.

78  {
79  return m_config.type;
80  }

◆ iparticleSortVar()

MuonsLoader::MuonSortVar InDetGNNHardScatterSelection::MuonsLoader::iparticleSortVar ( ConstituentsSortOrder  config)
protected

Definition at line 13 of file MuonsLoader.cxx.

15  {
16  typedef xAOD::Muon Ip;
17  typedef xAOD::Vertex Vertex;
18  switch(config) {
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

Member Data Documentation

◆ m_associator

std::function<IPV(const Vertex&)> InDetGNNHardScatterSelection::MuonsLoader::m_associator
protected

Definition at line 62 of file MuonsLoader.h.

◆ m_config

ConstituentsInputConfig InDetGNNHardScatterSelection::IConstituentsLoader::m_config
protectedinherited

◆ m_customSequenceGetter

getter_utils::CustomSequenceGetter<xAOD::Muon> InDetGNNHardScatterSelection::MuonsLoader::m_customSequenceGetter
protected

Definition at line 61 of file MuonsLoader.h.

◆ m_iparticleSortVar

MuonSortVar InDetGNNHardScatterSelection::MuonsLoader::m_iparticleSortVar
protected

Definition at line 60 of file MuonsLoader.h.

◆ m_name

std::string InDetGNNHardScatterSelection::IConstituentsLoader::m_name
protectedinherited

The documentation for this class was generated from the following files:
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
ParticleTest.tp
tp
Definition: ParticleTest.py:25
SG::ConstAccessor
Helper class to provide constant type-safe access to aux data.
Definition: ConstAccessor.h:55
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
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
InDetGNNHardScatterSelection::MuonsLoader::m_associator
std::function< IPV(const Vertex &)> m_associator
Definition: MuonsLoader.h:62
InDetGNNHardScatterSelection::MuonsLoader::IPV
std::vector< const xAOD::Muon * > IPV
Definition: MuonsLoader.h:54
AthenaPoolTestRead.acc
acc
Definition: AthenaPoolTestRead.py:16
InDetGNNHardScatterSelection::MuonsLoader::Vertex
xAOD::Vertex Vertex
Definition: MuonsLoader.h:41
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
WriteCaloSwCorrections.cfg
cfg
Definition: WriteCaloSwCorrections.py:23
InDetGNNHardScatterSelection::ConstituentsSortOrder::PT_DESCENDING
@ PT_DESCENDING
Trk::vertex
@ vertex
Definition: MeasurementType.h:21
xAOD::Vertex_v1
Class describing a Vertex.
Definition: Vertex_v1.h:42
Muons
Definition: Muons.py:1
std::sort
void sort(typename std::reverse_iterator< DataModel_detail::iterator< DVL > > beg, typename std::reverse_iterator< DataModel_detail::iterator< DVL > > end, const Compare &comp)
Specialization of sort for DataVector/List.
Definition: DVL_algorithms.h:623
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::IConstituentsLoader::IConstituentsLoader
IConstituentsLoader(ConstituentsInputConfig cfg)
Definition: InnerDetector/InDetRecTools/InDetGNNHardScatterSelection/InDetGNNHardScatterSelection/ConstituentsLoader.h:63