ATLAS Offline Software
AthToolSupport/AsgDataHandles/AsgDataHandles/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 /*
4  * Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration.
5  */
6 
15 #ifndef ASG_DATA_HANDLES_READ_DECOR_HANDLE_H
16 #define ASG_DATA_HANDLES_READ_DECOR_HANDLE_H
17 
18 #ifndef XAOD_STANDALONE
20 #else
21 
26 // #include "GaudiKernel/EventContext.h"
27 // #include <type_traits>
28 
29 
30 namespace SG {
31 
32 
45 template <class T, class D>
46 class ReadDecorHandle
47  : public ReadHandle<T>
48 {
49 public:
51  typedef ReadHandle<T> Base;
52 
55 
57  typedef typename accessor_t::const_reference_type
59 
63 
64 
72  explicit ReadDecorHandle (const ReadDecorHandleKey<T>& key);
73 
74 
86  explicit ReadDecorHandle (const ReadDecorHandleKey<T>& key,
87  const EventContext& ctx);
88 
89 
90 // /**
91 // * @brief Copy constructor.
92 // */
93 // ReadDecorHandle (const ReadDecorHandle& rhs);
94 
95 
96 // /**
97 // * @brief Move constructor.
98 // */
99 // ReadDecorHandle (ReadDecorHandle&& rhs);
100 
101 
102 // /**
103 // * @brief Assignment operator.
104 // */
105 // ReadDecorHandle& operator= (const ReadDecorHandle& rhs);
106 
107 
108 // /**
109 // * @brief Move operator.
110 // */
111 // ReadDecorHandle& operator= (ReadDecorHandle&& rhs);
112 
113 
122  bool isPresent() const;
123 
124 
129  const_reference_type operator() (const AuxElement& e) const;
130 
131 
140 
141 
142 // /**
143 // * @brief Get a pointer to the start of the auxiliary data array,
144 // * for the referenced object.
145 // */
146 // const_container_pointer_type
147 // getDataArray();
148 
149 
154  bool isAvailable();
155 
156 
157 // /**
158 // * @brief Return the aux id for this variable.
159 // */
160 // SG::auxid_t auxid() const;
161 
162 
166  std::string decorKey() const;
167 
168 
169 private:
175  const SG::AuxVectorData* vectorData (std::true_type);
176 
177 
183  const SG::AuxVectorData* vectorData (std::false_type);
184 
185 
193  const SG::AuxVectorData* vectorData();
194 
195 
197  std::string m_decorKey;
198 
199 
202 };
203 
204 
205 // /**
206 // * @brief Return a @c ReadDecorHandle referencing @c key.
207 // * @param key The key object holding the clid/key/store.
208 // *
209 // * This will raise an exception if the StoreGate key is blank,
210 // * or if the event store cannot be found.
211 // *
212 // * The type of the decoration must be included as an explicit template parameter:
213 // *
214 // *@code
215 // * auto handle = SG::makeHandle<float> (key);
216 // @endcode
217 // *
218 // * Note that @c D comes first in the argument list. It's given explicitly,
219 // * while @c T is inferred from @c key.
220 // */
221 // template <class D, class T>
222 // ReadDecorHandle<T, D> makeHandle (const ReadDecorHandleKey<T>& key);
223 
224 
225 // /**
226 // * @brief Return a @c ReadDecorHandle referencing @c key for an explicit context.
227 // * @param key The key object holding the clid/key/store.
228 // * @param ctx The event context.
229 // *
230 // * This will raise an exception if the StoreGate key is blank,
231 // * or if the event store cannot be found.
232 // *
233 // * If the default event store has been requested, then the thread-specific
234 // * store from the event context will be used.
235 // *
236 // * The type of the decoration must be included as an explicit template parameter:
237 // *
238 // *@code
239 // * auto handle = SG::makeHandle<float> (key, ctx);
240 // @endcode
241 // *
242 // * Note that @c D comes first in the argument list. It's given explicitly,
243 // * while @c T is inferred from @c key.
244 // */
245 // template <class D, class T>
246 // ReadDecorHandle<T, D> makeHandle (const ReadDecorHandleKey<T>& key,
247 // const EventContext& ctx);
248 
249 
250 // /**
251 // * @brief These two signatures are to catch cases where the explicit
252 // * template argument is omitted from the @c makeHandle call
253 // * and give an error tailored to that. Otherwise, the @c makeHandle
254 // * call for @c ReadHandle would match, potentially giving a much
255 // * more confusing error.
256 // */
257 // template <class T>
258 // void makeHandle (const ReadDecorHandleKey<T>& key);
259 // template <class T>
260 // void makeHandle (const ReadDecorHandleKey<T>& key,
261 // const EventContext& ctx);
262 
263 
264 } // namespace SG
265 
266 
268 
269 #endif
270 
271 #endif // not STOREGATE_READDECORHANDLE_READDECORHANDLE_H
SG
Forward declaration.
Definition: CaloCellPacker_400_500.h:32
index
Definition: index.py:1
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::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::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)....
ReadDecorHandleKey.h
Property holding a SG store/key/clid/attr name from which a ReadDecorHandle is made.
SG::ReadDecorHandle::accessor_t
SG::AuxElement::ConstAccessor< D > accessor_t
Accessor type for aux data.
Definition: StoreGate/StoreGate/ReadDecorHandle.h:100
SG::ReadDecorHandle::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::Base
ReadHandle< T > Base
Base class.
Definition: StoreGate/StoreGate/ReadDecorHandle.h:97
ReadHandle.h
Handle class for reading from StoreGate.
SG::ReadDecorHandle::const_reference_type
typename accessor_t::const_reference_type const_reference_type
Type referencing an aux data item.
Definition: StoreGate/StoreGate/ReadDecorHandle.h:103
DecorKeyHelpers.h
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).
ReadDecorHandle.h
Handle class for reading a decoration on an object.
SG::ReadDecorHandle::vectorData
const SG::AuxVectorData * vectorData()
Return the referenced object as a SG::AuxVectorData.
ReadDecorHandle.icc
SG::AuxVectorData
Manage lookup of vectors of auxiliary data.
Definition: AuxVectorData.h:167
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