Loading [MathJax]/extensions/tex2jax.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
Public Member Functions | Public Attributes | Private Types | Private Attributes | List of all members
VariableMule< T, C > Class Template Reference

#include <VariableMule.h>

Collaboration diagram for VariableMule< T, C >:

Public Member Functions

 VariableMule (const T &default_value)
 
StatusCode initialize (Gaudi::Algorithm *parent, const std::vector< std::string > &froms, const std::string &to)
 
void copy (const std::vector< MatchedPair< C >> &pairs, const EventContext &cxt) const
 

Public Attributes

std::map< std::string, std::string > toCopy
 

Private Types

using RC = SG::ReadDecorHandleKeyArray< C >
 
using WC = SG::WriteDecorHandleKeyArray< C >
 

Private Attributes

RC m_fromKeys
 
WC m_toKeys
 
m_default
 
std::vector< SG::AuxElement::ConstAccessor< T > > m_fromAcc
 

Detailed Description

template<typename T, typename C>
class VariableMule< T, C >

Definition at line 23 of file VariableMule.h.

Member Typedef Documentation

◆ RC

template<typename T , typename C >
using VariableMule< T, C >::RC = SG::ReadDecorHandleKeyArray<C>
private

Definition at line 28 of file VariableMule.h.

◆ WC

template<typename T , typename C >
using VariableMule< T, C >::WC = SG::WriteDecorHandleKeyArray<C>
private

Definition at line 29 of file VariableMule.h.

Constructor & Destructor Documentation

◆ VariableMule()

template<typename T , typename C >
VariableMule< T, C >::VariableMule ( const T &  default_value)
inline

Definition at line 35 of file VariableMule.h.

35 : m_default(default_value) {}

Member Function Documentation

◆ copy()

template<typename T , typename C >
void VariableMule< T, C >::copy ( const std::vector< MatchedPair< C >> &  pairs,
const EventContext &  cxt 
) const
inline

Definition at line 53 of file VariableMule.h.

54  {
55  std::vector<SG::ReadDecorHandle<C,T>> from;
56  std::vector<SG::WriteDecorHandle<C,T>> to;
57  for (const auto& k: m_fromKeys) {
58  from.emplace_back(k, cxt);
59  }
60  for (const auto& k: m_toKeys) {
61  to.emplace_back(k, cxt);
62  }
63  size_t n_keys = m_fromAcc.size();
64  for (const auto& pair: pairs) {
65  for (size_t iii = 0; iii < n_keys; iii++) {
66  if (pair.from) {
67  to.at(iii)(*pair.to) = m_fromAcc.at(iii)(*pair.from);
68  } else {
69  to.at(iii)(*pair.to) = m_default;
70  }
71  }
72  }
73  }

◆ initialize()

template<typename T , typename C >
StatusCode VariableMule< T, C >::initialize ( Gaudi::Algorithm *  parent,
const std::vector< std::string > &  froms,
const std::string &  to 
)
inline

Definition at line 36 of file VariableMule.h.

38  {
39  for (const auto& key: toCopy) {
40  std::string fullto = to + "." + key.second;
41  std::string doc = "Key to move " + key.first + "->" + key.second;
42  for (const auto& from: froms) {
43  std::string fullfrom = from + "." + key.first;
44  m_fromKeys.emplace_back(parent, "read_" + key.first, fullfrom, doc);
45  }
46  m_fromAcc.emplace_back(key.first);
47  m_toKeys.emplace_back(parent, "write_" + key.second, fullto, doc);
48  }
51  return StatusCode::SUCCESS;
52  }

Member Data Documentation

◆ m_default

template<typename T , typename C >
T VariableMule< T, C >::m_default
private

Definition at line 32 of file VariableMule.h.

◆ m_fromAcc

template<typename T , typename C >
std::vector<SG::AuxElement::ConstAccessor<T> > VariableMule< T, C >::m_fromAcc
private

Definition at line 33 of file VariableMule.h.

◆ m_fromKeys

template<typename T , typename C >
RC VariableMule< T, C >::m_fromKeys
private

Definition at line 30 of file VariableMule.h.

◆ m_toKeys

template<typename T , typename C >
WC VariableMule< T, C >::m_toKeys
private

Definition at line 31 of file VariableMule.h.

◆ toCopy

template<typename T , typename C >
std::map<std::string,std::string> VariableMule< T, C >::toCopy

Definition at line 26 of file VariableMule.h.


The documentation for this class was generated from the following file:
VariableMule::m_toKeys
WC m_toKeys
Definition: VariableMule.h:31
VariableMule::toCopy
std::map< std::string, std::string > toCopy
Definition: VariableMule.h:26
VariableMule::m_fromAcc
std::vector< SG::AuxElement::ConstAccessor< T > > m_fromAcc
Definition: VariableMule.h:33
python.CreateTierZeroArgdict.pairs
pairs
Definition: CreateTierZeroArgdict.py:201
test_pyathena.parent
parent
Definition: test_pyathena.py:15
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
merge_scale_histograms.doc
string doc
Definition: merge_scale_histograms.py:9
SG::VarHandleKeyArrayCommon::initialize
StatusCode initialize(bool used=true)
forward the initialization to the member VarHandleKeys
VariableMule::m_fromKeys
RC m_fromKeys
Definition: VariableMule.h:30
CxxUtils::to
CONT to(RANGE &&r)
Definition: ranges.h:39
VariableMule::m_default
T m_default
Definition: VariableMule.h:32
fitman.k
k
Definition: fitman.py:528
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37