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 399 of file InnerDetector/InDetRecTools/InDetGNNHardScatterSelection/Root/CustomGetterUtils.cxx.

399 {
401 return {
402 [n=name, g=std::move(getter)](const xAOD::Vertex& j,
403 const std::vector<const T*>& t) {
404 return std::make_pair(n, g(j, t));
405 },
406 deps
407 };
408 }
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 450 of file InnerDetector/InDetRecTools/InDetGNNHardScatterSelection/Root/CustomGetterUtils.cxx.

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

◆ 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 412 of file InnerDetector/InDetRecTools/InDetGNNHardScatterSelection/Root/CustomGetterUtils.cxx.

413 {
414 switch (cfg.type) {
415 case ConstituentsEDMType::INT: return {
416 SequenceGetter<int, T>(cfg.name), {cfg.name}
417 };
418 case ConstituentsEDMType::FLOAT: return {
419 SequenceGetter<float, T>(cfg.name), {cfg.name}
420 };
421 case ConstituentsEDMType::CHAR: return {
422 SequenceGetter<char, T>(cfg.name), {cfg.name}
423 };
424 case ConstituentsEDMType::UCHAR: return {
426 };
429 cfg.name);
430 }
431 default: {
432 throw std::logic_error("Unknown EDM type for constituent.");
433 }
434 }
435 }
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: