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

#include <JetsLoader.h>

Inheritance diagram for InDetGNNHardScatterSelection::JetsLoader:
Collaboration diagram for InDetGNNHardScatterSelection::JetsLoader:

Public Member Functions

 JetsLoader (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::Jet * > Jets
typedef std::vector< const xAOD::IParticle * > Particles
typedef std::function< double(const xAOD::Jet *, const Vertex &)> JetSortVar
using AE = SG::AuxElement
using IPC = xAOD::JetContainer
using PartLinks = std::vector<ElementLink<IPC>>
using IPV = std::vector<const xAOD::Jet*>

Protected Member Functions

std::vector< const xAOD::Jet * > getJetsFromVertex (const xAOD::Vertex &vertex) const

Static Protected Member Functions

static JetSortVar iparticleSortVar (ConstituentsSortOrder)

Protected Attributes

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

Detailed Description

Definition at line 32 of file JetsLoader.h.

Member Typedef Documentation

◆ AE

Definition at line 51 of file JetsLoader.h.

◆ IPC

◆ IPV

using InDetGNNHardScatterSelection::JetsLoader::IPV = std::vector<const xAOD::Jet*>
protected

Definition at line 54 of file JetsLoader.h.

◆ Jets

typedef std::vector<const xAOD::Jet*> InDetGNNHardScatterSelection::JetsLoader::Jets
protected

Definition at line 45 of file JetsLoader.h.

◆ JetSortVar

typedef std::function<double(const xAOD::Jet*, const Vertex&)> InDetGNNHardScatterSelection::JetsLoader::JetSortVar
protected

Definition at line 48 of file JetsLoader.h.

◆ NamedSeq

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

Definition at line 43 of file JetsLoader.h.

◆ NamedVar

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

Definition at line 42 of file JetsLoader.h.

◆ Particles

Definition at line 46 of file JetsLoader.h.

◆ PartLinks

Definition at line 53 of file JetsLoader.h.

◆ Vertex

Definition at line 41 of file JetsLoader.h.

Constructor & Destructor Documentation

◆ JetsLoader()

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

Definition at line 28 of file JetsLoader.cxx.

28 :
31 m_customSequenceGetter(getter_utils::CustomSequenceGetter<xAOD::Jet>(
32 cfg.inputs))
33 {
35 m_associator = [acc](const xAOD::Vertex& vertex) -> IPV {
37 for (const ElementLink<IPC>& link : acc(vertex)){
38 if (!link.isValid()) {
39 throw std::logic_error("invalid particle link");
40 }
41 particles.push_back(*link);
42 }
43 return particles;
44 };
45 m_name = cfg.name;
46 }
std::vector< const xAOD::Jet * > IPV
Definition JetsLoader.h:54
getter_utils::CustomSequenceGetter< xAOD::Jet > m_customSequenceGetter
Definition JetsLoader.h:61
std::function< IPV(const Vertex &)> m_associator
Definition JetsLoader.h:62
static JetSortVar iparticleSortVar(ConstituentsSortOrder)
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::JetsLoader::getData ( const xAOD::Vertex & vertex) const
overridevirtual

Implements InDetGNNHardScatterSelection::IConstituentsLoader.

Definition at line 65 of file JetsLoader.cxx.

66 {
67 Jets sorted_particles = getJetsFromVertex(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 }
std::vector< const xAOD::Jet * > getJetsFromVertex(const xAOD::Vertex &vertex) const
std::vector< const xAOD::Jet * > Jets
Definition JetsLoader.h:45

◆ getJetsFromVertex()

std::vector< const xAOD::Jet * > InDetGNNHardScatterSelection::JetsLoader::getJetsFromVertex ( const xAOD::Vertex & vertex) const
protected

Definition at line 48 of file JetsLoader.cxx.

51 {
52 std::vector<std::pair<double, const xAOD::Jet*>> particles;
53 for (const xAOD::Jet *tp : m_associator(vertex)) {
54 particles.emplace_back(m_iparticleSortVar(tp, vertex), tp);
55 }
56 std::sort(particles.begin(), particles.end(), std::greater<>());
57 std::vector<const xAOD::Jet*> only_particles;
58 only_particles.reserve(particles.size());
59for (const auto& particle: particles) {
60 only_particles.push_back(particle.second);
61 }
62 return only_particles;
63 }
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.
Jet_v1 Jet
Definition of the current "jet version".

◆ getName()

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

Implements InDetGNNHardScatterSelection::IConstituentsLoader.

Definition at line 75 of file JetsLoader.cxx.

75 {
76 return m_name;
77 }

◆ getType()

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

Implements InDetGNNHardScatterSelection::IConstituentsLoader.

Definition at line 78 of file JetsLoader.cxx.

78 {
79 return m_config.type;
80 }

◆ iparticleSortVar()

JetsLoader::JetSortVar InDetGNNHardScatterSelection::JetsLoader::iparticleSortVar ( ConstituentsSortOrder config)
staticprotected

Definition at line 14 of file JetsLoader.cxx.

16 {
17 using Ip = xAOD::Jet;
18 using Vertex = xAOD::Vertex;
19 switch(config) {
21 return [](const Ip* tp, const Vertex&) {return tp->pt();};
22 default: {
23 throw std::logic_error("Unknown sort function");
24 }
25 }
26 } // end of iparticle sort getter

Member Data Documentation

◆ m_associator

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

Definition at line 62 of file JetsLoader.h.

◆ m_config

ConstituentsInputConfig InDetGNNHardScatterSelection::IConstituentsLoader::m_config
protectedinherited

◆ m_customSequenceGetter

getter_utils::CustomSequenceGetter<xAOD::Jet> InDetGNNHardScatterSelection::JetsLoader::m_customSequenceGetter
protected

Definition at line 61 of file JetsLoader.h.

◆ m_iparticleSortVar

JetSortVar InDetGNNHardScatterSelection::JetsLoader::m_iparticleSortVar
protected

Definition at line 60 of file JetsLoader.h.

◆ m_name

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

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