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

#include <JetsLoader.h>

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

Public Member Functions

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

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

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

Definition at line 52 of file JetsLoader.h.

◆ IPV

Definition at line 54 of file JetsLoader.h.

◆ Jets

Definition at line 45 of file JetsLoader.h.

◆ JetSortVar

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 ( ConstituentsInputConfig  cfg)

Definition at line 28 of file JetsLoader.cxx.

30  :
33  m_customSequenceGetter(getter_utils::CustomSequenceGetter<xAOD::Jet>(
34  cfg.inputs))
35  {
37  m_associator = [acc](const xAOD::Vertex& vertex) -> IPV {
38  IPV particles;
39  for (const ElementLink<IPC>& link : acc(vertex)){
40  if (!link.isValid()) {
41  throw std::logic_error("invalid particle link");
42  }
43  particles.push_back(*link);
44  }
45  return particles;
46  };
47  m_name = cfg.name;
48  }

Member Function Documentation

◆ getData()

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

Implements InDetGNNHardScatterSelection::IConstituentsLoader.

Definition at line 66 of file JetsLoader.cxx.

67  {
68  Jets sorted_particles = getJetsFromVertex(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  }

◆ getJetsFromVertex()

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

Definition at line 50 of file JetsLoader.cxx.

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

◆ getName()

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

Implements InDetGNNHardScatterSelection::IConstituentsLoader.

Definition at line 76 of file JetsLoader.cxx.

76  {
77  return m_name;
78  }

◆ getType()

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

Implements InDetGNNHardScatterSelection::IConstituentsLoader.

Definition at line 79 of file JetsLoader.cxx.

79  {
80  return m_config.type;
81  }

◆ iparticleSortVar()

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

Definition at line 14 of file JetsLoader.cxx.

16  {
17  typedef xAOD::Jet Ip;
18  typedef xAOD::Vertex 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:
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
Jets
Definition: Jets.py:1
InDetGNNHardScatterSelection::JetsLoader::Vertex
xAOD::Vertex Vertex
Definition: JetsLoader.h:41
InDetGNNHardScatterSelection::JetsLoader::m_associator
std::function< IPV(const Vertex &)> m_associator
Definition: JetsLoader.h:62
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::JetsLoader::IPV
std::vector< const xAOD::Jet * > IPV
Definition: JetsLoader.h:54
InDetGNNHardScatterSelection::ConstituentsInputConfig::type
ConstituentsType type
Definition: InnerDetector/InDetRecTools/InDetGNNHardScatterSelection/InDetGNNHardScatterSelection/ConstituentsLoader.h:49
config
Definition: PhysicsAnalysis/AnalysisCommon/AssociationUtils/python/config.py:1
InDetGNNHardScatterSelection::JetsLoader::m_iparticleSortVar
JetSortVar m_iparticleSortVar
Definition: JetsLoader.h:60
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
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
xAOD::Jet_v1
Class describing a jet.
Definition: Jet_v1.h:57
InDetGNNHardScatterSelection::JetsLoader::getJetsFromVertex
std::vector< const xAOD::Jet * > getJetsFromVertex(const xAOD::Vertex &vertex) const
Definition: JetsLoader.cxx:50
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::JetsLoader::m_customSequenceGetter
getter_utils::CustomSequenceGetter< xAOD::Jet > m_customSequenceGetter
Definition: JetsLoader.h:61
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::JetsLoader::iparticleSortVar
JetSortVar iparticleSortVar(ConstituentsSortOrder)
Definition: JetsLoader.cxx:14
InDetGNNHardScatterSelection::IConstituentsLoader::IConstituentsLoader
IConstituentsLoader(ConstituentsInputConfig cfg)
Definition: InnerDetector/InDetRecTools/InDetGNNHardScatterSelection/InDetGNNHardScatterSelection/ConstituentsLoader.h:63