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

#include <IParticlesLoader.h>

Inheritance diagram for InDetGNNHardScatterSelection::IParticlesLoader:
Collaboration diagram for InDetGNNHardScatterSelection::IParticlesLoader:

Public Member Functions

 IParticlesLoader (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::IParticle * > IParticles
 
typedef std::function< double(const xAOD::IParticle *, const Vertex &)> IParticleSortVar
 
typedef std::function< NamedSeq(const Vertex &, const IParticles &)> SeqFromIParticles
 
using AE = SG::AuxElement
 
using IPC = xAOD::IParticleContainer
 
using PartLinks = std::vector< ElementLink< IPC > >
 
using IPV = std::vector< const xAOD::IParticle * >
 

Protected Member Functions

IParticleSortVar iparticleSortVar (ConstituentsSortOrder)
 
std::vector< const xAOD::IParticle * > getIParticlesFromVertex (const xAOD::Vertex &vertex) const
 

Protected Attributes

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

Detailed Description

Definition at line 29 of file InnerDetector/InDetRecTools/InDetGNNHardScatterSelection/InDetGNNHardScatterSelection/IParticlesLoader.h.

Member Typedef Documentation

◆ AE

◆ IParticles

◆ IParticleSortVar

◆ IPC

◆ IPV

◆ NamedSeq

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

◆ NamedVar

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

◆ PartLinks

◆ SeqFromIParticles

◆ Vertex

Constructor & Destructor Documentation

◆ IParticlesLoader()

InDetGNNHardScatterSelection::IParticlesLoader::IParticlesLoader ( ConstituentsInputConfig  cfg)

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

29  :
32  m_customSequenceGetter(getter_utils::CustomSequenceGetter<xAOD::IParticle>(
33  cfg.inputs))
34  {
35  const SG::AuxElement::ConstAccessor<PartLinks> acc("particleLinks");
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::IParticlesLoader::getData ( const xAOD::Vertex vertex) const
overridevirtual

Implements InDetGNNHardScatterSelection::IConstituentsLoader.

Definition at line 65 of file InnerDetector/InDetRecTools/InDetGNNHardScatterSelection/Root/IParticlesLoader.cxx.

66  {
67  IParticles sorted_particles = getIParticlesFromVertex(vertex);
68  return std::make_tuple(m_config.output_name, m_customSequenceGetter.getFeats(vertex, sorted_particles), sorted_particles);
69  }

◆ getIParticlesFromVertex()

std::vector< const xAOD::IParticle * > InDetGNNHardScatterSelection::IParticlesLoader::getIParticlesFromVertex ( const xAOD::Vertex vertex) const
protected

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

52  {
53  std::vector<std::pair<double, const xAOD::IParticle*>> particles;
54  for (const xAOD::IParticle *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::IParticle*> 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::IParticlesLoader::getName ( ) const
overridevirtual

◆ getType()

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

◆ iparticleSortVar()

IParticlesLoader::IParticleSortVar InDetGNNHardScatterSelection::IParticlesLoader::iparticleSortVar ( ConstituentsSortOrder  config)
protected

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

15  {
16  typedef xAOD::IParticle 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::IParticlesLoader::m_associator
protected

◆ m_config

ConstituentsInputConfig InDetGNNHardScatterSelection::IConstituentsLoader::m_config
protectedinherited

◆ m_customSequenceGetter

getter_utils::CustomSequenceGetter<xAOD::IParticle> InDetGNNHardScatterSelection::IParticlesLoader::m_customSequenceGetter
protected

◆ m_iparticleSortVar

IParticleSortVar InDetGNNHardScatterSelection::IParticlesLoader::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
Trk::ParticleSwitcher::particle
constexpr ParticleHypothesis particle[PARTICLEHYPOTHESES]
the array of masses
Definition: ParticleHypothesis.h:76
InDetGNNHardScatterSelection::IParticlesLoader::IPV
std::vector< const xAOD::IParticle * > IPV
Definition: InnerDetector/InDetRecTools/InDetGNNHardScatterSelection/InDetGNNHardScatterSelection/IParticlesLoader.h:53
InDetGNNHardScatterSelection::getter_utils::CustomSequenceGetter::getFeats
std::pair< std::vector< float >, std::vector< int64_t > > getFeats(const xAOD::Vertex &jet, const Constituents &constituents) const
Definition: InnerDetector/InDetRecTools/InDetGNNHardScatterSelection/Root/CustomGetterUtils.cxx:274
ParticleTest.tp
tp
Definition: ParticleTest.py:25
SG::ConstAccessor
Helper class to provide constant type-safe access to aux data.
Definition: ConstAccessor.h:55
xAOD::IParticle
Class providing the definition of the 4-vector interface.
Definition: Event/xAOD/xAODBase/xAODBase/IParticle.h:41
InDetGNNHardScatterSelection::ConstituentsInputConfig::type
ConstituentsType type
Definition: InnerDetector/InDetRecTools/InDetGNNHardScatterSelection/InDetGNNHardScatterSelection/ConstituentsLoader.h:49
config
Definition: PhysicsAnalysis/AnalysisCommon/AssociationUtils/python/config.py:1
InDetGNNHardScatterSelection::IParticlesLoader::m_associator
std::function< IPV(const Vertex &)> m_associator
Definition: InnerDetector/InDetRecTools/InDetGNNHardScatterSelection/InDetGNNHardScatterSelection/IParticlesLoader.h:61
InDetGNNHardScatterSelection::IParticlesLoader::iparticleSortVar
IParticleSortVar iparticleSortVar(ConstituentsSortOrder)
Definition: InnerDetector/InDetRecTools/InDetGNNHardScatterSelection/Root/IParticlesLoader.cxx:13
InDetGNNHardScatterSelection::IParticlesLoader::m_customSequenceGetter
getter_utils::CustomSequenceGetter< xAOD::IParticle > m_customSequenceGetter
Definition: InnerDetector/InDetRecTools/InDetGNNHardScatterSelection/InDetGNNHardScatterSelection/IParticlesLoader.h:60
InDetGNNHardScatterSelection::IParticlesLoader::Vertex
xAOD::Vertex Vertex
Definition: InnerDetector/InDetRecTools/InDetGNNHardScatterSelection/InDetGNNHardScatterSelection/IParticlesLoader.h:38
AthenaPoolTestRead.acc
acc
Definition: AthenaPoolTestRead.py:16
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
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:74
LArG4FSStartPointFilter.particles
list particles
Definition: LArG4FSStartPointFilter.py:84
InDetGNNHardScatterSelection::IParticlesLoader::getIParticlesFromVertex
std::vector< const xAOD::IParticle * > getIParticlesFromVertex(const xAOD::Vertex &vertex) const
Definition: InnerDetector/InDetRecTools/InDetGNNHardScatterSelection/Root/IParticlesLoader.cxx:49
InDetGNNHardScatterSelection::IParticlesLoader::IParticles
std::vector< const xAOD::IParticle * > IParticles
Definition: InnerDetector/InDetRecTools/InDetGNNHardScatterSelection/InDetGNNHardScatterSelection/IParticlesLoader.h:42
InDetGNNHardScatterSelection::IParticlesLoader::m_iparticleSortVar
IParticleSortVar m_iparticleSortVar
Definition: InnerDetector/InDetRecTools/InDetGNNHardScatterSelection/InDetGNNHardScatterSelection/IParticlesLoader.h:59
InDetGNNHardScatterSelection::IConstituentsLoader::IConstituentsLoader
IConstituentsLoader(ConstituentsInputConfig cfg)
Definition: InnerDetector/InDetRecTools/InDetGNNHardScatterSelection/InDetGNNHardScatterSelection/ConstituentsLoader.h:63