ATLAS Offline Software
StoreGate/StoreGate/HandleKeyArray.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef STOREGATE_HANDLEKEYARRAY_H
6 #define STOREGATE_HANDLEKEYARRAY_H 1
7 
9 #include "GaudiKernel/EventContext.h"
10 #include "GaudiKernel/ThreadLocalContext.h"
11 
12 #include <vector>
13 #include <string>
14 
15 namespace SG {
16 
37  template <class T_Handle, class T_HandleKey, Gaudi::DataHandle::Mode MODE>
38  class HandleKeyArray : public VarHandleKeyArrayCommon< T_HandleKey > {
39  public:
44 
50  HandleKeyArray( const std::vector<T_HandleKey>& v ) :
51  VarHandleKeyArrayCommon<T_HandleKey> ( v ) {}
52 
58  HandleKeyArray( std::initializer_list<T_HandleKey> l ):
59  VarHandleKeyArrayCommon<T_HandleKey> {l} {}
60 
67  HandleKeyArray( std::initializer_list<std::string> key_names):
68  VarHandleKeyArrayCommon<T_HandleKey> {key_names} {}
69 
79  template <class OWNER,
81  inline HandleKeyArray( OWNER* owner,
82  std::string name,
83  std::initializer_list<std::string> l,
84  std::string doc="") :
85  VarHandleKeyArrayCommon<T_HandleKey> {l} {
86  auto p = owner->declareProperty(std::move(name), *this, std::move(doc));
87  p->template setOwnerType<OWNER>();
88  }
89 
90 
94  Gaudi::DataHandle::Mode mode() const { return MODE; }
95 
100  std::vector< T_Handle > makeHandles() const {
101  const EventContext& ctx = Gaudi::Hive::currentContext();
102  std::vector< T_Handle > hndl;
103  for (const T_HandleKey& k : *this) {
104  hndl.emplace_back ( k, ctx );
105  }
106  return hndl;
107  }
108 
113  std::vector< T_Handle > makeHandles (const EventContext& ctx) const
114  {
115  std::vector< T_Handle > hndl;
116  for (const T_HandleKey& k : *this) {
117  hndl.emplace_back ( k, ctx);
118  }
119  return hndl;
120  }
121 
122  };
123 
124 } // namespace SG
125 
126 #endif
SG
Forward declaration.
Definition: CaloCellPacker_400_500.h:32
SG::HandleKeyArray::HandleKeyArray
HandleKeyArray(const std::vector< T_HandleKey > &v)
Constructor from a HandleKeyArray that takes a vector of ReadHandleKeys.
Definition: StoreGate/StoreGate/HandleKeyArray.h:50
VarHandleKeyArray.h
Base class for VarHandleKeyArray for reading from StoreGate.
SG::VarHandleKeyArrayCommon
Definition: StoreGate/StoreGate/VarHandleKeyArray.h:62
athena.value
value
Definition: athena.py:124
SG::HandleKeyArray
Definition: StoreGate/StoreGate/HandleKeyArray.h:38
UploadAMITag.l
list l
Definition: UploadAMITag.larcaf.py:158
SG::HandleKeyArray::HandleKeyArray
HandleKeyArray(OWNER *owner, std::string name, std::initializer_list< std::string > l, std::string doc="")
auto-declaring Property Constructor from a HandleKeyArray that takes an initializer list of std::stri...
Definition: StoreGate/StoreGate/HandleKeyArray.h:81
SG::HandleKeyArray::HandleKeyArray
HandleKeyArray()
default Constructor from a HandleKeyArray
Definition: StoreGate/StoreGate/HandleKeyArray.h:43
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
SG::VarHandleKeyArrayCommon< T_HandleKey >::owner
virtual const IDataHandleHolder * owner() const override
Definition: StoreGate/StoreGate/VarHandleKeyArray.h:135
MODE
#define MODE
Definition: CellClusterLinkTool.h:24
SG::HandleKeyArray::HandleKeyArray
HandleKeyArray(std::initializer_list< std::string > key_names)
Constructor from a HandleKeyArray that takes an initializer list of std::strings.
Definition: StoreGate/StoreGate/HandleKeyArray.h:67
SG::HandleKeyArray::mode
Gaudi::DataHandle::Mode mode() const
return the type (Read/Write/Update) of handle
Definition: StoreGate/StoreGate/HandleKeyArray.h:94
merge_scale_histograms.doc
string doc
Definition: merge_scale_histograms.py:9
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
EventContainers::Mode
Mode
Definition: IdentifiableContainerBase.h:13
SG::HandleKeyArray::makeHandles
std::vector< T_Handle > makeHandles(const EventContext &ctx) const
create a vector of Handles from the HandleKeys in the array, with explicit EventContext.
Definition: StoreGate/StoreGate/HandleKeyArray.h:113
python.PyAthena.v
v
Definition: PyAthena.py:154
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
SG::HandleKeyArray::makeHandles
std::vector< T_Handle > makeHandles() const
create a vector of Handles from the HandleKeys in the array
Definition: StoreGate/StoreGate/HandleKeyArray.h:100
SG::HandleKeyArray::HandleKeyArray
HandleKeyArray(std::initializer_list< T_HandleKey > l)
Constructor from a HandleKeyArray that takes an initializer list of HandleKeys.
Definition: StoreGate/StoreGate/HandleKeyArray.h:58
fitman.k
k
Definition: fitman.py:528