ATLAS Offline Software
Public Member Functions | Private Attributes | List of all members
ExpressionParsing::AccessorWrapper< T > Class Template Reference

#include <xAODVariableProxyLoaders.h>

Inheritance diagram for ExpressionParsing::AccessorWrapper< T >:
Collaboration diagram for ExpressionParsing::AccessorWrapper< T >:

Public Member Functions

 AccessorWrapper (const std::string &elementName)
 
virtual ~AccessorWrapper ()
 
virtual bool isValid (const SG::AuxElement *auxElement) const
 
virtual bool isValid (const SG::AuxVectorData *auxVectorData) const
 
virtual int getIntValue (const SG::AuxElement *auxElement) const
 
virtual double getDoubleValue (const SG::AuxElement *auxElement) const
 
virtual std::vector< int > getVecIntValue (const SG::AuxVectorData *auxVectorData)
 
virtual std::vector< double > getVecDoubleValue (const SG::AuxVectorData *auxVectorData)
 

Private Attributes

std::string m_elementName
 
SG::AuxElement::ConstAccessor< T > m_acc
 

Detailed Description

template<typename T>
class ExpressionParsing::AccessorWrapper< T >

Definition at line 44 of file xAODVariableProxyLoaders.h.

Constructor & Destructor Documentation

◆ AccessorWrapper()

template<typename T >
ExpressionParsing::AccessorWrapper< T >::AccessorWrapper ( const std::string &  elementName)
inline

Definition at line 46 of file xAODVariableProxyLoaders.h.

46  :
47  m_elementName(elementName), m_acc(elementName)
48  {
49  }

◆ ~AccessorWrapper()

template<typename T >
virtual ExpressionParsing::AccessorWrapper< T >::~AccessorWrapper ( )
inlinevirtual

Definition at line 51 of file xAODVariableProxyLoaders.h.

51 { }

Member Function Documentation

◆ getDoubleValue()

template<typename T >
virtual double ExpressionParsing::AccessorWrapper< T >::getDoubleValue ( const SG::AuxElement auxElement) const
inlinevirtual

Implements ExpressionParsing::BaseAccessorWrapper.

Definition at line 75 of file xAODVariableProxyLoaders.h.

75  {
76  return (double) m_acc(*auxElement);
77  }

◆ getIntValue()

template<typename T >
virtual int ExpressionParsing::AccessorWrapper< T >::getIntValue ( const SG::AuxElement auxElement) const
inlinevirtual

Implements ExpressionParsing::BaseAccessorWrapper.

Definition at line 71 of file xAODVariableProxyLoaders.h.

71  {
72  return (int) m_acc(*auxElement);
73  }

◆ getVecDoubleValue()

template<typename T >
virtual std::vector<double> ExpressionParsing::AccessorWrapper< T >::getVecDoubleValue ( const SG::AuxVectorData auxVectorData)
inlinevirtual

Implements ExpressionParsing::BaseAccessorWrapper.

Definition at line 88 of file xAODVariableProxyLoaders.h.

88  {
89  size_t N = auxVectorData->size_v();
90  std::vector<double> result(N);
91  for (size_t i = 0; i < N; ++i) {
92  result[i] = (double) m_acc(*auxVectorData, i);
93  }
94  return result;
95  }

◆ getVecIntValue()

template<typename T >
virtual std::vector<int> ExpressionParsing::AccessorWrapper< T >::getVecIntValue ( const SG::AuxVectorData auxVectorData)
inlinevirtual

Implements ExpressionParsing::BaseAccessorWrapper.

Definition at line 79 of file xAODVariableProxyLoaders.h.

79  {
80  size_t N = auxVectorData->size_v();
81  std::vector<int> result(N);
82  for (size_t i = 0; i < N; ++i) {
83  result[i] = (int) m_acc(*auxVectorData, i);
84  }
85  return result;
86  }

◆ isValid() [1/2]

template<typename T >
virtual bool ExpressionParsing::AccessorWrapper< T >::isValid ( const SG::AuxElement auxElement) const
inlinevirtual

Implements ExpressionParsing::BaseAccessorWrapper.

Definition at line 53 of file xAODVariableProxyLoaders.h.

53  {
54  return m_acc.isAvailable(*auxElement);
55  }

◆ isValid() [2/2]

template<typename T >
virtual bool ExpressionParsing::AccessorWrapper< T >::isValid ( const SG::AuxVectorData auxVectorData) const
inlinevirtual

Implements ExpressionParsing::BaseAccessorWrapper.

Definition at line 57 of file xAODVariableProxyLoaders.h.

57  {
58  // TPSG: A bit hacky - implementation copied from AuxElement.icc
60  SG::auxid_t auxid = r.findAuxID(m_elementName);
61  if (!auxVectorData || !auxVectorData->getConstStore()) return false;
62 
63  // At this point we just have to cross our fingers and hope...
64  if (auxVectorData->size_v() == 0) return true;
65 
66  const SG::auxid_set_t& ids = auxVectorData->getConstStore()->getAuxIDs();
67  if( ids.find (auxid) != ids.end() ) return true;
68  return auxVectorData->getConstStore()->getData( auxid ) != 0;
69  }

Member Data Documentation

◆ m_acc

template<typename T >
SG::AuxElement::ConstAccessor<T> ExpressionParsing::AccessorWrapper< T >::m_acc
private

Definition at line 99 of file xAODVariableProxyLoaders.h.

◆ m_elementName

template<typename T >
std::string ExpressionParsing::AccessorWrapper< T >::m_elementName
private

Definition at line 98 of file xAODVariableProxyLoaders.h.


The documentation for this class was generated from the following file:
SG::AuxVectorData::getConstStore
const SG::IConstAuxStore * getConstStore() const
Return the current store, as a const interface.
beamspotman.r
def r
Definition: beamspotman.py:676
SG::IConstAuxStore::getData
virtual const void * getData(SG::auxid_t auxid) const =0
Return the data vector for one aux data item.
get_generator_info.result
result
Definition: get_generator_info.py:21
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
SG::AuxTypeRegistry::instance
static AuxTypeRegistry & instance()
Return the singleton registry instance.
Definition: AuxTypeRegistry.cxx:640
JetTiledMap::N
@ N
Definition: TiledEtaPhiMap.h:44
SG::AuxTypeRegistry
Handle mappings between names and auxid_t.
Definition: AuxTypeRegistry.h:61
SG::auxid_t
size_t auxid_t
Identifier for a particular aux data item.
Definition: AuxTypes.h:27
lumiFormat.i
int i
Definition: lumiFormat.py:85
xAOD::double
double
Definition: CompositeParticle_v1.cxx:159
python.subdetectors.mmg.ids
ids
Definition: mmg.py:8
ExpressionParsing::AccessorWrapper::m_acc
SG::AuxElement::ConstAccessor< T > m_acc
Definition: xAODVariableProxyLoaders.h:99
SG::auxid_set_t
A set of aux data identifiers.
Definition: AuxTypes.h:47
SG::IConstAuxStore::getAuxIDs
virtual const SG::auxid_set_t & getAuxIDs() const =0
Return a set of identifiers for existing data items in this store.
SG::AuxVectorData::size_v
virtual size_t size_v() const =0
Return the size of the container.
ExpressionParsing::AccessorWrapper::m_elementName
std::string m_elementName
Definition: xAODVariableProxyLoaders.h:98