ATLAS Offline Software
StoreGate/StoreGate/ReadDecorHandle.h
Go to the documentation of this file.
1 // This file's extension implies that it's C, but it's really -*- C++ -*-.
2 /*
3  * Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration.
4  */
13 #ifndef STOREGATE_READDECORHANDLE_H
14 #define STOREGATE_READDECORHANDLE_H
15 
16 
18 #include "StoreGate/ReadHandle.h"
21 #include "GaudiKernel/EventContext.h"
22 #include <type_traits>
23 
24 
25 namespace SG {
26 
27 
91 template <class T, class D>
93  : public ReadHandle<T>
94 {
95 public:
98 
101 
104 
107 
110 
111 
120 
121 
134  const EventContext& ctx);
135 
136 
141 
142 
147 
148 
153 
154 
159 
160 
169  bool isPresent() const;
170 
171 
177 
178 
188  const_reference_type withDefault (size_t index, const D& deflt);
189 
190 
198  const_reference_type withDefault (const AuxElement& e, const D& deflt) const;
199 
200 
209 
210 
215  template <class POINTER_TYPE = const_container_pointer_type,
216  typename = std::enable_if_t<!std::is_void_v<POINTER_TYPE> > >
217  POINTER_TYPE
219 
220 
225  const_span
227 
228 
233  bool isAvailable();
234 
235 
240 
241 
245  std::string decorKey() const;
246 
247 
248 private:
254  const SG::AuxVectorData* vectorData (std::true_type);
255 
256 
262  const SG::AuxVectorData* vectorData (std::false_type);
263 
264 
273 
274 
276  std::string m_decorKey;
277 
278 
281 };
282 
283 
300 template <class D, class T>
302 
303 
324 template <class D, class T>
326  const EventContext& ctx);
327 
328 
336 template <class T>
338 template <class T>
340  const EventContext& ctx);
341 
342 
343 } // namespace SG
344 
345 
347 
348 
349 #endif // not STOREGATE_READDECORHANDLE_READDECORHANDLE_H
SG::ReadDecorHandle::ReadDecorHandle
ReadDecorHandle(const ReadDecorHandleKey< T > &key, const EventContext &ctx)
Constructor from a ReadDecorHandleKey and an explicit event context.
SG::ReadDecorHandle::withDefault
const_reference_type withDefault(size_t index, const D &deflt)
Fetch the variable for one element, as a const reference.
ReadDecorHandleKey.h
Property holding a SG store/key/clid/attr name from which a ReadDecorHandle is made.
SG
Forward declaration.
Definition: CaloCellPacker_400_500.h:32
SG::ReadDecorHandle::getDataArray
POINTER_TYPE getDataArray()
Get a pointer to the start of the auxiliary data array, for the referenced object.
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
index
Definition: index.py:1
SG::AuxElement
Base class for elements of a container that can have aux data.
Definition: AuxElement.h:446
SG::ConstAccessor::const_container_pointer_type
typename AuxDataTraits< T, ALLOC >::const_container_pointer_type const_container_pointer_type
Pointer into the container holding this item.
Definition: ConstAccessor.h:65
SG::ConstAccessor::const_span
typename AuxDataTraits< T, ALLOC >::const_span const_span
A span over elements in the container.
Definition: ConstAccessor.h:68
SG::ReadDecorHandle::ReadDecorHandle
ReadDecorHandle(ReadDecorHandle &&rhs)
Move constructor.
SG::ReadDecorHandle::isPresent
bool isPresent() const
Is the referenced container present in SG?
SG::ConstAccessor
Helper class to provide constant type-safe access to aux data.
Definition: ConstAccessor.h:54
SG::ReadDecorHandle::operator()
const_reference_type operator()(const AuxElement &e) const
Fetch the variable for one element, as a const reference.
SG::ReadDecorHandle::vectorData
const SG::AuxVectorData * vectorData(std::false_type)
Return the referenced object as a SG::AuxVectorData.
DecorKeyHelpers.h
Some common helper functions used by decoration handles.
SG::ReadDecorHandle< T_Cont, T_src >::const_span
typename accessor_t::const_span const_span
Span of aux data items.
Definition: StoreGate/StoreGate/ReadDecorHandle.h:109
SG::ReadDecorHandle::operator=
ReadDecorHandle & operator=(const ReadDecorHandle &rhs)
Assignment operator.
SG::ReadDecorHandle::vectorData
const SG::AuxVectorData * vectorData(std::true_type)
Return the referenced object as a SG::AuxVectorData.
SG::ConstAccessor::const_reference_type
typename AuxDataTraits< T, ALLOC >::const_reference_type const_reference_type
Type referencing an item.
Definition: ConstAccessor.h:61
ReadHandle< T >
a smart pointer to an object of a given type in an IProxyDict (such as StoreGateSvc)....
SG::makeHandle
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
Definition: ReadCondHandle.h:269
SG::auxid_t
size_t auxid_t
Identifier for a particular aux data item.
Definition: AuxTypes.h:27
SG::ReadDecorHandle
Handle class for reading a decoration on an object.
Definition: StoreGate/StoreGate/ReadDecorHandle.h:94
SG::ReadDecorHandle::withDefault
const_reference_type withDefault(const AuxElement &e, const D &deflt) const
Fetch the variable for one element, as a const reference.
SG::ReadDecorHandle::auxid
SG::auxid_t auxid() const
Return the aux id for this variable.
SG::ReadDecorHandle::getDataSpan
const_span getDataSpan()
Get a span over the auxilary data array, for the referenced object.
SG::ReadDecorHandle< T_Cont, T_src >::const_container_pointer_type
typename accessor_t::const_container_pointer_type const_container_pointer_type
Pointer into the vector holding an aux data item.
Definition: StoreGate/StoreGate/ReadDecorHandle.h:106
SG::ReadDecorHandle::ReadDecorHandle
ReadDecorHandle(const ReadDecorHandleKey< T > &key)
Constructor from a ReadDecorHandleKey.
SG::ReadDecorHandle< T_Cont, T_src >::const_reference_type
typename accessor_t::const_reference_type const_reference_type
Type referencing an aux data item.
Definition: StoreGate/StoreGate/ReadDecorHandle.h:103
ReadDecorHandle.icc
SG::ReadDecorHandle::ReadDecorHandle
ReadDecorHandle(const ReadDecorHandle &rhs)
Copy constructor.
DiTauMassTools::MaxHistStrategyV2::e
e
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:26
SG::ReadDecorHandle::decorKey
std::string decorKey() const
Return the name of the decoration alias (CONT.DECOR).
SG::ReadDecorHandle::vectorData
const SG::AuxVectorData * vectorData()
Return the referenced object as a SG::AuxVectorData.
SG::AuxVectorData
Manage lookup of vectors of auxiliary data.
Definition: AuxVectorData.h:167
ReadHandle.h
Handle class for reading from StoreGate.
SG::ReadDecorHandleKey
Property holding a SG store/key/clid/attr name from which a ReadDecorHandle is made.
Definition: StoreGate/StoreGate/ReadDecorHandleKey.h:85
SG::ReadDecorHandle::isAvailable
bool isAvailable()
Test to see if this variable exists in the store, for the referenced object.
AuxElement.h
Base class for elements of a container that can have aux data.
SG::ReadDecorHandle::m_decorKey
std::string m_decorKey
Name of the decoration alias.
Definition: StoreGate/StoreGate/ReadDecorHandle.h:276
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37
SG::ReadDecorHandle::m_acc
accessor_t m_acc
Accessor for the aux data item.
Definition: StoreGate/StoreGate/ReadDecorHandle.h:280