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

#include <ElectronsLoader.h>

Inheritance diagram for InDetGNNHardScatterSelection::ElectronsLoader:
Collaboration diagram for InDetGNNHardScatterSelection::ElectronsLoader:

Public Member Functions

 ElectronsLoader (const ConstituentsInputConfig &)
 
std::tuple< std::string, FlavorTagInference::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::Electron * > Electrons
 
typedef std::vector< const xAOD::IParticle * > Particles
 
typedef std::function< double(const xAOD::Electron *, const Vertex &)> ElectronSortVar
 
typedef std::function< NamedSeq(const Vertex &, const Electrons &)> SeqFromElectrons
 
using AE = SG::AuxElement
 
using IPC = xAOD::ElectronContainer
 
using PartLinks = std::vector< ElementLink< IPC > >
 
using IPV = std::vector< const xAOD::Electron * >
 

Protected Member Functions

std::vector< const xAOD::Electron * > getElectronsFromVertex (const xAOD::Vertex &vertex) const
 

Static Protected Member Functions

static ElectronSortVar iparticleSortVar (ConstituentsSortOrder)
 

Protected Attributes

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

Detailed Description

Definition at line 32 of file InnerDetector/InDetRecTools/InDetGNNHardScatterSelection/InDetGNNHardScatterSelection/ElectronsLoader.h.

Member Typedef Documentation

◆ AE

◆ Electrons

◆ ElectronSortVar

◆ IPC

◆ IPV

◆ NamedSeq

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

◆ NamedVar

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

◆ Particles

◆ PartLinks

◆ SeqFromElectrons

◆ Vertex

Constructor & Destructor Documentation

◆ ElectronsLoader()

InDetGNNHardScatterSelection::ElectronsLoader::ElectronsLoader ( const ConstituentsInputConfig cfg)

Definition at line 27 of file InnerDetector/InDetRecTools/InDetGNNHardScatterSelection/Root/ElectronsLoader.cxx.

29  :
32  m_customSequenceGetter(getter_utils::CustomSequenceGetter<xAOD::Electron>(
33  cfg.inputs))
34  {
35  const SG::AuxElement::ConstAccessor<PartLinks> acc("electronLinks");
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, FlavorTagInference::Inputs, std::vector< const xAOD::IParticle * > > InDetGNNHardScatterSelection::ElectronsLoader::getData ( const xAOD::Vertex vertex) const
overridevirtual

Implements InDetGNNHardScatterSelection::IConstituentsLoader.

Definition at line 66 of file InnerDetector/InDetRecTools/InDetGNNHardScatterSelection/Root/ElectronsLoader.cxx.

67  {
68  Electrons sorted_particles = getElectronsFromVertex(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  }

◆ getElectronsFromVertex()

std::vector< const xAOD::Electron * > InDetGNNHardScatterSelection::ElectronsLoader::getElectronsFromVertex ( const xAOD::Vertex vertex) const
protected

Definition at line 49 of file InnerDetector/InDetRecTools/InDetGNNHardScatterSelection/Root/ElectronsLoader.cxx.

52  {
53  std::vector<std::pair<double, const xAOD::Electron*>> particles;
54  for (const xAOD::Electron *tp : m_associator(vertex)) {
55  particles.emplace_back(m_iparticleSortVar(tp, vertex), tp);
56  }
57  std::sort(particles.begin(), particles.end(), std::greater<>());
58  std::vector<const xAOD::Electron*> only_particles;
59  only_particles.reserve(particles.size());
60 for (const auto& particle: particles) {
61  only_particles.push_back(particle.second);
62  }
63  return only_particles;
64  }

◆ getName()

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

◆ getType()

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

◆ iparticleSortVar()

ElectronsLoader::ElectronSortVar InDetGNNHardScatterSelection::ElectronsLoader::iparticleSortVar ( ConstituentsSortOrder  config)
staticprotected

Definition at line 13 of file InnerDetector/InDetRecTools/InDetGNNHardScatterSelection/Root/ElectronsLoader.cxx.

15  {
16  using Ip = xAOD::Electron;
17  using Vertex = xAOD::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::ElectronsLoader::m_associator
protected

◆ m_config

ConstituentsInputConfig InDetGNNHardScatterSelection::IConstituentsLoader::m_config
protectedinherited

◆ m_customSequenceGetter

getter_utils::CustomSequenceGetter<xAOD::Electron> InDetGNNHardScatterSelection::ElectronsLoader::m_customSequenceGetter
protected

◆ m_iparticleSortVar

ElectronSortVar InDetGNNHardScatterSelection::ElectronsLoader::m_iparticleSortVar
protected

◆ 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
InDetGNNHardScatterSelection::ElectronsLoader::Vertex
xAOD::Vertex Vertex
Definition: InnerDetector/InDetRecTools/InDetGNNHardScatterSelection/InDetGNNHardScatterSelection/ElectronsLoader.h:41
Trk::ParticleSwitcher::particle
constexpr ParticleHypothesis particle[PARTICLEHYPOTHESES]
the array of masses
Definition: ParticleHypothesis.h:79
xAOD::Electron
Electron_v1 Electron
Definition of the current "egamma version".
Definition: Event/xAOD/xAODEgamma/xAODEgamma/Electron.h:17
xAOD::Vertex
Vertex_v1 Vertex
Define the latest version of the vertex class.
Definition: Event/xAOD/xAODTracking/xAODTracking/Vertex.h:16
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::ElectronsLoader::IPV
std::vector< const xAOD::Electron * > IPV
Definition: InnerDetector/InDetRecTools/InDetGNNHardScatterSelection/InDetGNNHardScatterSelection/ElectronsLoader.h:57
InDetGNNHardScatterSelection::ElectronsLoader::m_customSequenceGetter
getter_utils::CustomSequenceGetter< xAOD::Electron > m_customSequenceGetter
Definition: InnerDetector/InDetRecTools/InDetGNNHardScatterSelection/InDetGNNHardScatterSelection/ElectronsLoader.h:64
InDetGNNHardScatterSelection::ConstituentsInputConfig::type
ConstituentsType type
Definition: InnerDetector/InDetRecTools/InDetGNNHardScatterSelection/InDetGNNHardScatterSelection/ConstituentsLoader.h:49
InDetGNNHardScatterSelection::ElectronsLoader::m_iparticleSortVar
ElectronSortVar m_iparticleSortVar
Definition: InnerDetector/InDetRecTools/InDetGNNHardScatterSelection/InDetGNNHardScatterSelection/ElectronsLoader.h:63
config
Definition: PhysicsAnalysis/AnalysisCommon/AssociationUtils/python/config.py:1
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:209
AthenaPoolTestRead.acc
acc
Definition: AthenaPoolTestRead.py:16
InDetGNNHardScatterSelection::ElectronsLoader::getElectronsFromVertex
std::vector< const xAOD::Electron * > getElectronsFromVertex(const xAOD::Vertex &vertex) const
Definition: InnerDetector/InDetRecTools/InDetGNNHardScatterSelection/Root/ElectronsLoader.cxx:49
InDetGNNHardScatterSelection::IConstituentsLoader::m_config
ConstituentsInputConfig m_config
Definition: InnerDetector/InDetRecTools/InDetGNNHardScatterSelection/InDetGNNHardScatterSelection/ConstituentsLoader.h:71
InDetGNNHardScatterSelection::ElectronsLoader::m_associator
std::function< IPV(const Vertex &)> m_associator
Definition: InnerDetector/InDetRecTools/InDetGNNHardScatterSelection/InDetGNNHardScatterSelection/ElectronsLoader.h:65
WriteCaloSwCorrections.cfg
cfg
Definition: WriteCaloSwCorrections.py:23
xAOD::Electron_v1
Definition: Electron_v1.h:34
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
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:72
LArG4FSStartPointFilter.particles
list particles
Definition: LArG4FSStartPointFilter.py:84
InDetGNNHardScatterSelection::IConstituentsLoader::IConstituentsLoader
IConstituentsLoader(const ConstituentsInputConfig &cfg)
Definition: InnerDetector/InDetRecTools/InDetGNNHardScatterSelection/InDetGNNHardScatterSelection/ConstituentsLoader.h:63
InDetGNNHardScatterSelection::ElectronsLoader::iparticleSortVar
static ElectronSortVar iparticleSortVar(ConstituentsSortOrder)
Definition: InnerDetector/InDetRecTools/InDetGNNHardScatterSelection/Root/ElectronsLoader.cxx:13
InDetGNNHardScatterSelection::ElectronsLoader::Electrons
std::vector< const xAOD::Electron * > Electrons
Definition: InnerDetector/InDetRecTools/InDetGNNHardScatterSelection/InDetGNNHardScatterSelection/ElectronsLoader.h:45