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

374 {
376 return {
377 [n=name, g=getter](const xAOD::Vertex& j,
378 const std::vector<const T*>& t) {
379 return std::make_pair(n, g(j, t));
380 },
381 deps
382 };
383 }
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 425 of file InnerDetector/InDetRecTools/InDetGNNHardScatterSelection/Root/CustomGetterUtils.cxx.

427 {
430 int num_cnsts = 0;
431
432 int cnst_var_idx = 0;
433 for (const auto& seq_builder: m_sequencesFromConstituents){
435
436 if (cnst_var_idx==0){
437 num_cnsts = static_cast<int>(double_vec.size());
439 }
440
441 // need to transpose + flatten
442 for (unsigned int cnst_idx=0; cnst_idx<double_vec.size(); cnst_idx++){
443 const double value = double_vec.at(cnst_idx);
444 if (!std::isfinite(value)) {
446 msg << "Non-finite sequence feature '"
448 << "' for constituent index " << cnst_idx
449 << " with value " << value;
450 throw std::runtime_error(msg.str());
451 }
453 = value;
454 }
455 cnst_var_idx++;
456 }
458 return {cnsts_feats, cnsts_feat_dim};
459 }

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

388 {
389 switch (cfg.type) {
390 case ConstituentsEDMType::INT: return {
391 SequenceGetter<int, T>(cfg.name), {cfg.name}
392 };
393 case ConstituentsEDMType::FLOAT: return {
394 SequenceGetter<float, T>(cfg.name), {cfg.name}
395 };
396 case ConstituentsEDMType::CHAR: return {
397 SequenceGetter<char, T>(cfg.name), {cfg.name}
398 };
399 case ConstituentsEDMType::UCHAR: return {
401 };
404 cfg.name);
405 }
406 default: {
407 throw std::logic_error("Unknown EDM type for constituent.");
408 }
409 }
410 }
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: