ATLAS Offline Software
Loading...
Searching...
No Matches
InDetGNNHardScatterSelection::IParticlesLoader Class Reference

#include <IParticlesLoader.h>

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

Public Member Functions

 IParticlesLoader (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::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

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

Static Protected Member Functions

static IParticleSortVar iparticleSortVar (ConstituentsSortOrder)

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 IParticlesLoader.h.

Member Typedef Documentation

◆ AE

◆ IParticles

Definition at line 42 of file IParticlesLoader.h.

◆ IParticleSortVar

typedef std::function<double(const xAOD::IParticle*, const Vertex&)> InDetGNNHardScatterSelection::IParticlesLoader::IParticleSortVar
protected

Definition at line 44 of file IParticlesLoader.h.

◆ IPC

◆ IPV

Definition at line 53 of file IParticlesLoader.h.

◆ NamedSeq

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

Definition at line 40 of file IParticlesLoader.h.

◆ NamedVar

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

Definition at line 39 of file IParticlesLoader.h.

◆ PartLinks

Definition at line 52 of file IParticlesLoader.h.

◆ SeqFromIParticles

Definition at line 47 of file IParticlesLoader.h.

◆ Vertex

Constructor & Destructor Documentation

◆ IParticlesLoader()

InDetGNNHardScatterSelection::IParticlesLoader::IParticlesLoader ( const ConstituentsInputConfig & cfg)

Definition at line 27 of file 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 {
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 }
getter_utils::CustomSequenceGetter< xAOD::IParticle > m_customSequenceGetter
std::vector< const xAOD::IParticle * > IPV
static IParticleSortVar iparticleSortVar(ConstituentsSortOrder)
std::function< IPV(const Vertex &)> m_associator
SG::ConstAccessor< T, ALLOC > ConstAccessor
Definition AuxElement.h:569
Vertex_v1 Vertex
Define the latest version of the vertex class.

Member Function Documentation

◆ getData()

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

Implements InDetGNNHardScatterSelection::IConstituentsLoader.

Definition at line 66 of file IParticlesLoader.cxx.

67 {
68 IParticles sorted_particles = getIParticlesFromVertex(vertex);
69 return std::make_tuple(m_config.output_name, m_customSequenceGetter.getFeats(vertex, sorted_particles), sorted_particles);
70 }
std::vector< const xAOD::IParticle * > IParticles
std::vector< const xAOD::IParticle * > getIParticlesFromVertex(const xAOD::Vertex &vertex) const

◆ getIParticlesFromVertex()

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

Definition at line 49 of file IParticlesLoader.cxx.

52 {
53 std::vector<std::pair<double, const xAOD::IParticle*>> particles;
54 for (const xAOD::IParticle *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::IParticle*> only_particles;
59 only_particles.reserve(particles.size());
60for (const auto& particle: particles) {
61 only_particles.push_back(particle.second);
62 }
63 return only_particles;
64 }
constexpr ParticleHypothesis particle[PARTICLEHYPOTHESES]
the array of masses
void sort(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of sort for DataVector/List.

◆ getName()

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

Implements InDetGNNHardScatterSelection::IConstituentsLoader.

Definition at line 72 of file IParticlesLoader.cxx.

72 {
73 return m_name;
74 }

◆ getType()

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

Implements InDetGNNHardScatterSelection::IConstituentsLoader.

Definition at line 75 of file IParticlesLoader.cxx.

75 {
76 return m_config.type;
77 }

◆ iparticleSortVar()

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

Definition at line 13 of file IParticlesLoader.cxx.

15 {
16 using Ip = xAOD::IParticle;
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::IParticlesLoader::m_associator
protected

Definition at line 61 of file IParticlesLoader.h.

◆ m_config

ConstituentsInputConfig InDetGNNHardScatterSelection::IConstituentsLoader::m_config
protectedinherited

◆ m_customSequenceGetter

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

Definition at line 60 of file IParticlesLoader.h.

◆ m_iparticleSortVar

IParticleSortVar InDetGNNHardScatterSelection::IParticlesLoader::m_iparticleSortVar
protected

Definition at line 59 of file IParticlesLoader.h.

◆ m_name

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

The documentation for this class was generated from the following files: