ATLAS Offline Software
Loading...
Searching...
No Matches
InDetGNNHardScatterSelection::getter_utils::CustomSequenceGetter< T > Class Template Reference

Template class to extract features from sequence of constituents. More...

#include <CustomGetterUtils.h>

Collaboration diagram for InDetGNNHardScatterSelection::getter_utils::CustomSequenceGetter< T >:

Public Types

using Constituents = std::vector<const T*>
using NamedSequenceFromConstituents

Public Member Functions

 CustomSequenceGetter (const std::vector< InputVariableConfig > &inputs)
std::pair< std::vector< float >, std::vector< int64_t > > getFeats (const xAOD::Vertex &jet, const Constituents &constituents) const

Private Member Functions

std::pair< NamedSequenceFromConstituents, std::set< std::string > > customNamedSeqGetterWithDeps (const std::string &name)
std::pair< NamedSequenceFromConstituents, std::set< std::string > > seqFromConsituents (const InputVariableConfig &cfg)

Private Attributes

std::vector< std::string > m_sequenceNames
std::vector< NamedSequenceFromConstituentsm_sequencesFromConstituents

Detailed Description

template<typename T>
class InDetGNNHardScatterSelection::getter_utils::CustomSequenceGetter< T >

Template class to extract features from sequence of constituents.

Template Parameters
Tconstituent type

It supports the following types of constituents:

Definition at line 81 of file InnerDetector/InDetRecTools/InDetGNNHardScatterSelection/InDetGNNHardScatterSelection/CustomGetterUtils.h.

Member Typedef Documentation

◆ Constituents

◆ NamedSequenceFromConstituents

template<typename T>
using InDetGNNHardScatterSelection::getter_utils::CustomSequenceGetter< T >::NamedSequenceFromConstituents

Constructor & Destructor Documentation

◆ CustomSequenceGetter()

template<typename T>
InDetGNNHardScatterSelection::getter_utils::CustomSequenceGetter< T >::CustomSequenceGetter ( const std::vector< InputVariableConfig > & inputs)

Member Function Documentation

◆ customNamedSeqGetterWithDeps()

template<typename T>
std::pair< typename CustomSequenceGetter< T >::NamedSequenceFromConstituents, std::set< std::string > > InDetGNNHardScatterSelection::getter_utils::CustomSequenceGetter< T >::customNamedSeqGetterWithDeps ( const std::string & name)
private

Definition at line 400 of file InnerDetector/InDetRecTools/InDetGNNHardScatterSelection/Root/CustomGetterUtils.cxx.

400 {
402 return {
403 [n=name, g=getter](const xAOD::Vertex& j,
404 const std::vector<const T*>& t) {
405 return std::make_pair(n, g(j, t));
406 },
407 deps
408 };
409 }
std::pair< std::function< std::vector< double >(const xAOD::Vertex &, const std::vector< const T * > &)>, std::set< std::string > > customSequenceGetterWithDeps(const std::string &name, const std::string &prefix)

◆ getFeats()

template<typename T>
std::pair< std::vector< float >, std::vector< int64_t > > InDetGNNHardScatterSelection::getter_utils::CustomSequenceGetter< T >::getFeats ( const xAOD::Vertex & jet,
const Constituents & constituents ) const

Definition at line 451 of file InnerDetector/InDetRecTools/InDetGNNHardScatterSelection/Root/CustomGetterUtils.cxx.

453 {
456 int num_cnsts = 0;
457
458 int cnst_var_idx = 0;
459 for (const auto& seq_builder: m_sequencesFromConstituents){
461
462 if (cnst_var_idx==0){
463 num_cnsts = static_cast<int>(double_vec.size());
465 }
466
467 // need to transpose + flatten
468 for (unsigned int cnst_idx=0; cnst_idx<double_vec.size(); cnst_idx++){
469 const double value = double_vec.at(cnst_idx);
470 if (!std::isfinite(value)) {
472 msg << "Non-finite sequence feature '"
474 << "' for constituent index " << cnst_idx
475 << " with value " << value;
476 throw std::runtime_error(msg.str());
477 }
479 = value;
480 }
481 cnst_var_idx++;
482 }
484 return {cnsts_feats, cnsts_feat_dim};
485 }

◆ seqFromConsituents()

template<typename T>
std::pair< typename CustomSequenceGetter< T >::NamedSequenceFromConstituents, std::set< std::string > > InDetGNNHardScatterSelection::getter_utils::CustomSequenceGetter< T >::seqFromConsituents ( const InputVariableConfig & cfg)
private

Definition at line 413 of file InnerDetector/InDetRecTools/InDetGNNHardScatterSelection/Root/CustomGetterUtils.cxx.

414 {
415 switch (cfg.type) {
416 case ConstituentsEDMType::INT: return {
417 SequenceGetter<int, T>(cfg.name), {cfg.name}
418 };
419 case ConstituentsEDMType::FLOAT: return {
420 SequenceGetter<float, T>(cfg.name), {cfg.name}
421 };
422 case ConstituentsEDMType::CHAR: return {
423 SequenceGetter<char, T>(cfg.name), {cfg.name}
424 };
425 case ConstituentsEDMType::UCHAR: return {
427 };
430 cfg.name);
431 }
432 default: {
433 throw std::logic_error("Unknown EDM type for constituent.");
434 }
435 }
436 }
std::pair< NamedSequenceFromConstituents, std::set< std::string > > customNamedSeqGetterWithDeps(const std::string &name)

Member Data Documentation

◆ m_sequenceNames

◆ m_sequencesFromConstituents


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