ATLAS Offline Software
Public Member Functions | Protected Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
WriteData Class Reference

#include <WriteData.h>

Inheritance diagram for WriteData:
Collaboration diagram for WriteData:

Public Member Functions

 WriteData (const std::string &name, ISvcLocator *pSvcLocator)
 
StatusCode initialize ()
 
StatusCode execute ()
 
StatusCode finalize ()
 
virtual StatusCode sysInitialize () override
 Override sysInitialize. More...
 
virtual const DataObjIDColl & extraOutputDeps () const override
 Return the list of extra output dependencies. More...
 
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc. More...
 
const ServiceHandle< StoreGateSvc > & evtStore () const
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc. More...
 
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc. More...
 
virtual StatusCode sysStart () override
 Handle START transition. More...
 
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles. More...
 
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles. More...
 
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T > &t)
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleKey &hndl, const std::string &doc, const SG::VarHandleKeyType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleBase &hndl, const std::string &doc, const SG::VarHandleType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleKeyArray &hndArr, const std::string &doc, const SG::VarHandleKeyArrayType &)
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, T &property, const std::string &doc, const SG::NotHandleType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, T &property, const std::string &doc="none")
 Declare a new Gaudi property. More...
 
void updateVHKA (Gaudi::Details::PropertyBase &)
 
MsgStream & msg () const
 
MsgStream & msg (const MSG::Level lvl) const
 
bool msgLvl (const MSG::Level lvl) const
 

Protected Member Functions

void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution More...
 
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce (T &h)
 
void extraDeps_update_handler (Gaudi::Details::PropertyBase &ExtraDeps)
 Add StoreName to extra input/output deps as needed. More...
 

Private Types

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t
 

Private Member Functions

StatusCode onError ()
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleKeyArrayType &)
 specialization for handling Gaudi::Property<SG::VarHandleKeyArray> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleType &)
 specialization for handling Gaudi::Property<SG::VarHandleBase> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &t, const SG::NotHandleType &)
 specialization for handling everything that's not a Gaudi::Property<SG::VarHandleKey> or a <SG::VarHandleKeyArray> More...
 

Private Attributes

DataObjIDColl m_extendedExtraObjects
 
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default) More...
 
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default) More...
 
std::vector< SG::VarHandleKeyArray * > m_vhka
 
bool m_varHandleArraysDeclared
 

Detailed Description

Definition at line 15 of file Control/AthenaExamples/AthExStoreGateExample/src/WriteData.h.

Member Typedef Documentation

◆ StoreGateSvc_t

typedef ServiceHandle<StoreGateSvc> AthCommonDataStore< AthCommonMsg< Algorithm > >::StoreGateSvc_t
privateinherited

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ WriteData()

WriteData::WriteData ( const std::string &  name,
ISvcLocator *  pSvcLocator 
)

Definition at line 26 of file Control/AthenaExamples/AthExStoreGateExample/src/WriteData.cxx.

26  :
27  AthAlgorithm(name, pSvcLocator)
28 {
29 }

Member Function Documentation

◆ declareGaudiProperty() [1/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< Algorithm > >::declareGaudiProperty ( Gaudi::Property< T > &  hndl,
const SG::VarHandleKeyArrayType  
)
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKeyArray>

Definition at line 170 of file AthCommonDataStore.h.

172  {
173  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
174  hndl.value(),
175  hndl.documentation());
176 
177  }

◆ declareGaudiProperty() [2/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< Algorithm > >::declareGaudiProperty ( Gaudi::Property< T > &  hndl,
const SG::VarHandleKeyType  
)
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKey>

Definition at line 156 of file AthCommonDataStore.h.

158  {
159  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
160  hndl.value(),
161  hndl.documentation());
162 
163  }

◆ declareGaudiProperty() [3/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< Algorithm > >::declareGaudiProperty ( Gaudi::Property< T > &  hndl,
const SG::VarHandleType  
)
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleBase>

Definition at line 184 of file AthCommonDataStore.h.

186  {
187  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
188  hndl.value(),
189  hndl.documentation());
190  }

◆ declareGaudiProperty() [4/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< Algorithm > >::declareGaudiProperty ( Gaudi::Property< T > &  t,
const SG::NotHandleType  
)
inlineprivateinherited

specialization for handling everything that's not a Gaudi::Property<SG::VarHandleKey> or a <SG::VarHandleKeyArray>

Definition at line 199 of file AthCommonDataStore.h.

200  {
201  return PBASE::declareProperty(t);
202  }

◆ declareProperty() [1/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty ( const std::string &  name,
SG::VarHandleBase hndl,
const std::string &  doc,
const SG::VarHandleType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
hndlObject holding the property value.
docDocumentation string for the property.

This is the version for types that derive from SG::VarHandleBase. The property value object is put on the input and output lists as appropriate; then we forward to the base class.

Definition at line 245 of file AthCommonDataStore.h.

249  {
250  this->declare(hndl.vhKey());
251  hndl.vhKey().setOwner(this);
252 
253  return PBASE::declareProperty(name,hndl,doc);
254  }

◆ declareProperty() [2/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty ( const std::string &  name,
SG::VarHandleKey hndl,
const std::string &  doc,
const SG::VarHandleKeyType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
hndlObject holding the property value.
docDocumentation string for the property.

This is the version for types that derive from SG::VarHandleKey. The property value object is put on the input and output lists as appropriate; then we forward to the base class.

Definition at line 221 of file AthCommonDataStore.h.

225  {
226  this->declare(hndl);
227  hndl.setOwner(this);
228 
229  return PBASE::declareProperty(name,hndl,doc);
230  }

◆ declareProperty() [3/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty ( const std::string &  name,
SG::VarHandleKeyArray hndArr,
const std::string &  doc,
const SG::VarHandleKeyArrayType  
)
inlineinherited

Definition at line 259 of file AthCommonDataStore.h.

263  {
264 
265  // std::ostringstream ost;
266  // ost << Algorithm::name() << " VHKA declareProp: " << name
267  // << " size: " << hndArr.keys().size()
268  // << " mode: " << hndArr.mode()
269  // << " vhka size: " << m_vhka.size()
270  // << "\n";
271  // debug() << ost.str() << endmsg;
272 
273  hndArr.setOwner(this);
274  m_vhka.push_back(&hndArr);
275 
276  Gaudi::Details::PropertyBase* p = PBASE::declareProperty(name, hndArr, doc);
277  if (p != 0) {
278  p->declareUpdateHandler(&AthCommonDataStore<PBASE>::updateVHKA, this);
279  } else {
280  ATH_MSG_ERROR("unable to call declareProperty on VarHandleKeyArray "
281  << name);
282  }
283 
284  return p;
285 
286  }

◆ declareProperty() [4/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty ( const std::string &  name,
T &  property,
const std::string &  doc,
const SG::NotHandleType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
propertyObject holding the property value.
docDocumentation string for the property.

This is the generic version, for types that do not derive from SG::VarHandleKey. It just forwards to the base class version of declareProperty.

Definition at line 333 of file AthCommonDataStore.h.

337  {
338  return PBASE::declareProperty(name, property, doc);
339  }

◆ declareProperty() [5/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty ( const std::string &  name,
T &  property,
const std::string &  doc = "none" 
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
propertyObject holding the property value.
docDocumentation string for the property.

This dispatches to either the generic declareProperty or the one for VarHandle/Key/KeyArray.

Definition at line 352 of file AthCommonDataStore.h.

355  {
356  typedef typename SG::HandleClassifier<T>::type htype;
357  return declareProperty (name, property, doc, htype());
358  }

◆ declareProperty() [6/6]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty ( Gaudi::Property< T > &  t)
inlineinherited

Definition at line 145 of file AthCommonDataStore.h.

145  {
146  typedef typename SG::HandleClassifier<T>::type htype;
148  }

◆ detStore()

const ServiceHandle<StoreGateSvc>& AthCommonDataStore< AthCommonMsg< Algorithm > >::detStore ( ) const
inlineinherited

The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 95 of file AthCommonDataStore.h.

95 { return m_detStore; }

◆ evtStore() [1/2]

ServiceHandle<StoreGateSvc>& AthCommonDataStore< AthCommonMsg< Algorithm > >::evtStore ( )
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 85 of file AthCommonDataStore.h.

85 { return m_evtStore; }

◆ evtStore() [2/2]

const ServiceHandle<StoreGateSvc>& AthCommonDataStore< AthCommonMsg< Algorithm > >::evtStore ( ) const
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 90 of file AthCommonDataStore.h.

90 { return m_evtStore; }

◆ execute()

StatusCode WriteData::execute ( )

Definition at line 43 of file Control/AthenaExamples/AthExStoreGateExample/src/WriteData.cxx.

43  {
44  //this example illustrates how to record objects into the StoreGate(SG)
45  //with and without providing a key
46  //It then covers the new DataLink class and its usage as a persistable
47  //reference among objects in the SG
48  //Finally it shows how to use symlinks to record an object using its
49  //concrete type and its base class(es).
50 
51  ATH_MSG_INFO ("in execute()");
52 
53  // For algorithms that produce new data objects like this one
54  // the SG works like a bulletin board: the algorithm posts the
55  // new object to the SG (optionally providing a "name" for it).
56  // The SG assigns a unique identifier to the object and puts it on display
57  // alongside others of the same type.
58  // At preset intervals all objects are removed from the board to make room
59  // for new ones and filed.
60 
61  // Part 1: Recording objects to the SG
62  // We create a MyDataObj on the heap (using "new")
63  // (so that later we can pass ownership to SG)
64  //
65  MyDataObj *dobj = new MyDataObj;
66  dobj->val(1);
67 
68  // now we record dobj. SG will identify dobj as the first obj
69  // of type MyDataObj
70  StatusCode sc = evtStore()->record(dobj, SG::DEFAULTKEY, false);
71  // Remember NEVER delete an object recorded in the SG:
72  // SG owns the object after it has been recorded
73  if ( sc.isFailure() ) {
74  ATH_MSG_ERROR (" could not register dobj");
75  return( onError() );
76  }
77 
78  //now we create a second MyDataObj instance...
79  MyDataObj *dobj2 = new MyDataObj;
80  dobj2->val(2);
81 
82  //...try to record it as we did for the first. Since dobj2 is also a
83  //MyDataObj we expect to see an error printed
84  ATH_MSG_WARNING ("we expect an error message here");
85  sc = evtStore()->record(dobj2, SG::DEFAULTKEY, false);
86  ATH_MSG_WARNING ("end of error message");
87  if ( !sc.isFailure() ) {
89  (" allowed to register two default objects for type MyDataObj");
90  return( onError() );
91  }
92  // The error handling will have deleted dobj2.
93 
94  //here we go again...
95  MyDataObj *dobj3 = new MyDataObj;
96  dobj3->val(3);
97 
98  //... but this time we register the dobj3 using this algo name as key
99  //sc = evtStore()->record(dobj3, name(), true);
100  sc = evtStore()->record(dobj3, name());
101  //the last argument of record, which for now defaults to true, is "allowMods"
102  //by setting it to true we allow downstream algorithms to modify dobj3
103  if ( sc.isFailure() ) {
104  ATH_MSG_ERROR (" could not register Data Object");
105  return( onError() );
106  }
107  //now dobj3 is known both as the default MyDataObj and the MyDataObj
108  //with key "WriteData"
109  //Notice that while in this case we used a std::string as key, this
110  //need not be the case. Any type satisfying the constraints specified
111  //in StoreGate/constraints/KeyConcept.h is a valid key
112  //Currently (release 1.3.5) KeyConcept requires a key to be convertible
113  //to and from a std::string (hence a string is a valid key)
114  //From release 2.0.0 (or 1.3.6) the only requirement on the key type
115  //will be to be sortable, i.e. to provide a "less than" operator <
116 
117 
119 
120  // Part 2: storing collections in the SG
121 
122  //first we create two instances on MyContObj
123  //(they can be created on the stack as std::vector copies them anyway
124 
125  MyContObj* mco1 = new MyContObj;
126  MyContObj* mco2 = new MyContObj;
127  mco1->set(11.3, 132);
128  mco2->set(41.7, 291);
129 
131  cobj->reserve(10);
132  cobj->push_back(mco1);
133  cobj->push_back(mco2); // if I push back this, it core dumps in map record
134 
135  //finally we record the list itself. As before we don't need to specify
136  //a key. This make sense for collections, as in many applications (Atlfast)
137  //there is only one instance of each collection in the whole app
138  sc = evtStore()->record(cobj, SG::DEFAULTKEY, false);
139  if ( sc.isFailure() ) {
140  ATH_MSG_ERROR (" could not register list<MyContObj>");
141  return( onError() );
142  }
143 
144  //
145  // as above with a vector of integers
146  //
147 
148  //again notice how the vector is created on the heap
149  std::vector<float> *vFloat = new std::vector<float>;
150  vFloat->push_back(1.0);
151  vFloat->push_back(2.0);
152  vFloat->push_back(3.0);
153 
154  sc = evtStore()->record(vFloat, SG::DEFAULTKEY, false);
155  if ( sc.isFailure() ) {
156  ATH_MSG_ERROR (" could not register vector<float>");
157  return( onError() );
158  }
159 
160  //
161  // now we record a map
162  //
163 
165  (*m)["uno"]=1.0;
166  (*m)["due"]=2.0;
167 
168  sc = evtStore()->record(m, SG::DEFAULTKEY, false);
169  if ( sc.isFailure() ) {
170  ATH_MSG_ERROR (" could not register MapStringFloat");
171  return( onError() );
172  }
173 
175  //
176  // Part 3: Data Links
177  //
178  // Data links are persistable references. Typically they will replace
179  // pointers from one object in the event to another, hence they have
180  // the usual "pointer" syntax (op *, op ->, op !, ...)
181  // (to be pedantic they have the moniker syntax as they don't define ++, --)
182  // For example in Atlfast::Cell
183  // class Cell {
184  // ...
185  // private:
186  // std::vector<const HepMC::Particle*> m_particles;
187  // };
188  // m_particles would become
189  // std::vector<HepMCLink<Particle>::type > m_particles;
190  //
191  // To understand data links it is important to observe that the SG
192  // is not able to identify every single object in the event.
193  // In particular individual elements of a container (the MyContObj
194  // in the vector above or the Particles in McEventCollection) are not
195  // recorded individually into SG, only their owner (the container) is.
196  // For this reason data links are supported by two class templates:
197  // DataLink<DATAOBJ> is a link to a data object i.e. an object
198  // identified by SG
199  // ElementLink<CONTAINER> is a link to an element of a container (which
200  // in turn is a SG data object)
201  // To make a DataLink persistable we need to provide its SG identifier
202  // (its type and key).
203  // To make an ElementLink persistable we need two pieces of information:
204  // i) the SG identifier (type/key) of the data object owning the element
205  // ii) the identifier of the contained object within the owner
206  // For example when we write out a link to the third element of
207  // our vector<float> we want to write the SG id of the vector
208  // and the index (2) of the element in the vector
209  //
210  // Since the indexing mechanism of a container depends on the container
211  // type we need to specialize ElementLink for different containers
212  // Elements of STL sequences (lists, vectors, deques but also DataVector
213  // and DataList) are dealt with automatically.
214  // For other STL or STL-like containers, the data object designer (or the
215  // client must "help" ElementLink identifying the type of container
216  // Three macros in the header StoreGate/DeclareIndexingPolicy.h
217  // are provided to this end:
218  // for sequences use CONTAINER_IS_SEQUENCE( MySequence )
219  // for sets use CONTAINER_IS_SET( MySet )
220  // for maps and related containers use CONTAINER_IS_MAP( MyMap )
221  //
222  // It is also possible to define custom specializations of ElementLink
223  // for custom containers (e.g. GenParticleLink for McEventCollection).
224  //
225  //Enough! Let's now create our first DataLink. It refers to the first
226  // MyDataObj we recorded. DataLink constructors use references
227  // as input arguments
228  //
229  // DataLink referring to a storable object
230  //
231  DataLink<MyDataObj> dobjLink(*dobj);
232  //since dobj is identifiable in the SG a reference to it is all we need
233 
234  dobj2 = new MyDataObj;
235  dobj2->val(2);
236  CHECK( evtStore()->record(dobj2, "dobj2") );
237 
238  //Otherwise one could first create an empty link
239  DataLink<MyDataObj> dobjLink2;
240  //and later on set it to refer to its target
241  dobjLink2.toStorableObject(*dobj2);
242 
243 
244  // Added Aug 30, 2001 HMA
245  // DataLink made from a key. This should work for either an object
246  // already registered in the store, or an object that has a
247  // persistency for it. we use dobj3, which is an object registered with
248  // a key.
249 
250  DataLink<MyDataObj> dobjLink3(name());
251  // now access it. DataLink will do a retrieve to get it from the store.
252  dobjLink3->val();
253 
254  //
255  // ElementLinks referring to contained objects
256  //
257  typedef ElementLink<std::vector<float> > VecElemLink;
258 
259 
260  VecElemLink thirdElementLink(*vFloat, 2); //THIS CRASHES SUN CC
261 
262  //sometimes we would not know the index of the element we want to refer to
263 
264  //reference to an element of the vector
265  float& anElement = vFloat->operator[](0);
266 
267  //starting from an empty link
268  VecElemLink aLink;
269  //we can refer it to its target without knowing its index
270  aLink.toContainedElement(*vFloat, anElement);
271  //it is better though to remember that toContainedElement for an
272  //ElementLink performs a linear search of "anElement" into "vFloat".
273  // If vFloat has a million elements think twice before using
274  // toContainedElement!
275 
276 
277  //Now let's put all this VecElemLink in a list
278  std::list<VecElemLink> *pLinkList = new std::list<VecElemLink>;
279  pLinkList->push_back(aLink);
280  pLinkList->push_back(thirdElementLink);
281 
282  //and finally let's record the list of links into SG
283  sc = evtStore()->record(pLinkList, name(), false);
284  if ( sc.isFailure() ) {
285  ATH_MSG_ERROR (" could not register the list of DataLinks");
286  return( onError() );
287  }
288  //
289  // Part 3b: create a vector of links to the elements of the map above
290  //
291  typedef ElementLink<MapStringFloat> MapElemLink;
292  std::vector<MapElemLink>* linkVector = new std::vector<MapElemLink>;
293 
294  linkVector->push_back(MapElemLink(*m, "uno"));
295  MapElemLink mLink;
296  mLink.toContainedElement(*m, (*m)["due"]);
297  linkVector->push_back(mLink);
298 
299  sc = evtStore()->record(linkVector, SG::DEFAULTKEY, false);
300  if ( sc.isFailure() ) {
301  ATH_MSG_ERROR (" could not register the vector of DataLinks");
302  return( onError() );
303  }
304 
305  // Part 4
306  // make a link to dobj as its base class after it has been registered
307  // this allows later to retrieve different concrete types as a common ABC
308 
309  const BaseClass * pDO = 0;
310  if ( (evtStore()->symLink(dobj, pDO)).isFailure() ) {
311  ATH_MSG_ERROR (" could not make link to BaseClass");
312  return( onError() );
313  }
314 
315  // make a link as its base class, with the same name
316  if ( ( evtStore()->symLink(dobj3, pDO)).isFailure() ) {
317  ATH_MSG_ERROR (" could not make link to BaseClass");
318  return( onError() );
319  }
320 
321  // Part 5
322  // finally dump the sturcture of the StoreGate before returning
323  ATH_MSG_INFO (" registered all data objects");
324  ATH_MSG_INFO (" StoreGate structure before returning from execute \n"
325  << evtStore()->dump());
326 
327  return StatusCode::SUCCESS;
328 }

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< Algorithm > >::extraDeps_update_handler ( Gaudi::Details::PropertyBase &  ExtraDeps)
protectedinherited

Add StoreName to extra input/output deps as needed.

use the logic of the VarHandleKey to parse the DataObjID keys supplied via the ExtraInputs and ExtraOuputs Properties to add the StoreName if it's not explicitly given

◆ extraOutputDeps()

const DataObjIDColl & AthAlgorithm::extraOutputDeps ( ) const
overridevirtualinherited

Return the list of extra output dependencies.

This list is extended to include symlinks implied by inheritance relations.

Definition at line 50 of file AthAlgorithm.cxx.

51 {
52  // If we didn't find any symlinks to add, just return the collection
53  // from the base class. Otherwise, return the extended collection.
54  if (!m_extendedExtraObjects.empty()) {
56  }
57  return Algorithm::extraOutputDeps();
58 }

◆ finalize()

StatusCode WriteData::finalize ( )

Definition at line 332 of file Control/AthenaExamples/AthExStoreGateExample/src/WriteData.cxx.

332  {
333 
334  ATH_MSG_INFO ("in finalize()");
335  return StatusCode::SUCCESS;
336 }

◆ initialize()

StatusCode WriteData::initialize ( )

Definition at line 33 of file Control/AthenaExamples/AthExStoreGateExample/src/WriteData.cxx.

33  {
34  ATH_MSG_INFO ("in initialize()");
35  //locate the StoreGateSvc and initialize our local ptr
36  StatusCode sc = evtStore().retrieve();
37  if (!sc.isSuccess()) ATH_MSG_ERROR ("Could not find StoreGateSvc");
38  return sc;
39 }

◆ inputHandles()

virtual std::vector<Gaudi::DataHandle*> AthCommonDataStore< AthCommonMsg< Algorithm > >::inputHandles ( ) const
overridevirtualinherited

Return this algorithm's input handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ msg() [1/2]

MsgStream& AthCommonMsg< Algorithm >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

24  {
25  return this->msgStream();
26  }

◆ msg() [2/2]

MsgStream& AthCommonMsg< Algorithm >::msg ( const MSG::Level  lvl) const
inlineinherited

Definition at line 27 of file AthCommonMsg.h.

27  {
28  return this->msgStream(lvl);
29  }

◆ msgLvl()

bool AthCommonMsg< Algorithm >::msgLvl ( const MSG::Level  lvl) const
inlineinherited

Definition at line 30 of file AthCommonMsg.h.

30  {
31  return this->msgLevel(lvl);
32  }

◆ onError()

StatusCode WriteData::onError ( )
private

Definition at line 339 of file Control/AthenaExamples/AthExStoreGateExample/src/WriteData.cxx.

339  {
340 
341  ATH_MSG_ERROR ("Dumping StoreGate after error occurred\n"
342  << evtStore()->dump());
343  return StatusCode::FAILURE;
344 }

◆ outputHandles()

virtual std::vector<Gaudi::DataHandle*> AthCommonDataStore< AthCommonMsg< Algorithm > >::outputHandles ( ) const
overridevirtualinherited

Return this algorithm's output handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ renounce()

std::enable_if_t<std::is_void_v<std::result_of_t<decltype(&T::renounce)(T)> > && !std::is_base_of_v<SG::VarHandleKeyArray, T> && std::is_base_of_v<Gaudi::DataHandle, T>, void> AthCommonDataStore< AthCommonMsg< Algorithm > >::renounce ( T &  h)
inlineprotectedinherited

Definition at line 380 of file AthCommonDataStore.h.

381  {
382  h.renounce();
383  PBASE::renounce (h);
384  }

◆ renounceArray()

void AthCommonDataStore< AthCommonMsg< Algorithm > >::renounceArray ( SG::VarHandleKeyArray handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364  {
365  handlesArray.renounce();
366  }

◆ sysInitialize()

StatusCode AthAlgorithm::sysInitialize ( )
overridevirtualinherited

Override sysInitialize.

Override sysInitialize from the base class.

Loop through all output handles, and if they're WriteCondHandles, automatically register them and this Algorithm with the CondSvc

Scan through all outputHandles, and if they're WriteCondHandles, register them with the CondSvc

Reimplemented from AthCommonDataStore< AthCommonMsg< Algorithm > >.

Reimplemented in AthAnalysisAlgorithm, AthFilterAlgorithm, PyAthena::Alg, and AthHistogramAlgorithm.

Definition at line 66 of file AthAlgorithm.cxx.

66  {
68 
69  if (sc.isFailure()) {
70  return sc;
71  }
72  ServiceHandle<ICondSvc> cs("CondSvc",name());
73  for (auto h : outputHandles()) {
74  if (h->isCondition() && h->mode() == Gaudi::DataHandle::Writer) {
75  // do this inside the loop so we don't create the CondSvc until needed
76  if ( cs.retrieve().isFailure() ) {
77  ATH_MSG_WARNING("no CondSvc found: won't autoreg WriteCondHandles");
78  return StatusCode::SUCCESS;
79  }
80  if (cs->regHandle(this,*h).isFailure()) {
81  sc = StatusCode::FAILURE;
82  ATH_MSG_ERROR("unable to register WriteCondHandle " << h->fullKey()
83  << " with CondSvc");
84  }
85  }
86  }
87  return sc;
88 }

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< Algorithm > >::sysStart ( )
overridevirtualinherited

Handle START transition.

We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.

◆ updateVHKA()

void AthCommonDataStore< AthCommonMsg< Algorithm > >::updateVHKA ( Gaudi::Details::PropertyBase &  )
inlineinherited

Definition at line 308 of file AthCommonDataStore.h.

308  {
309  // debug() << "updateVHKA for property " << p.name() << " " << p.toString()
310  // << " size: " << m_vhka.size() << endmsg;
311  for (auto &a : m_vhka) {
312  std::vector<SG::VarHandleKey*> keys = a->keys();
313  for (auto k : keys) {
314  k->setOwner(this);
315  }
316  }
317  }

Member Data Documentation

◆ m_detStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< Algorithm > >::m_detStore
privateinherited

Pointer to StoreGate (detector store by default)

Definition at line 393 of file AthCommonDataStore.h.

◆ m_evtStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< Algorithm > >::m_evtStore
privateinherited

Pointer to StoreGate (event store by default)

Definition at line 390 of file AthCommonDataStore.h.

◆ m_extendedExtraObjects

DataObjIDColl AthAlgorithm::m_extendedExtraObjects
privateinherited

Definition at line 79 of file AthAlgorithm.h.

◆ m_varHandleArraysDeclared

bool AthCommonDataStore< AthCommonMsg< Algorithm > >::m_varHandleArraysDeclared
privateinherited

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vhka

std::vector<SG::VarHandleKeyArray*> AthCommonDataStore< AthCommonMsg< Algorithm > >::m_vhka
privateinherited

Definition at line 398 of file AthCommonDataStore.h.


The documentation for this class was generated from the following files:
DataVector::reserve
void reserve(size_type n)
Attempt to preallocate enough memory for a specified number of elements.
python.SystemOfUnits.m
int m
Definition: SystemOfUnits.py:91
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
AthCommonDataStore::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
MyDataObj::val
void val(int i)
Definition: AthExStoreGateExample/MyDataObj.h:24
AthCommonDataStore< AthCommonMsg< Algorithm > >::m_evtStore
StoreGateSvc_t m_evtStore
Pointer to StoreGate (event store by default)
Definition: AthCommonDataStore.h:390
AthCommonDataStore< AthCommonMsg< Algorithm > >::m_vhka
std::vector< SG::VarHandleKeyArray * > m_vhka
Definition: AthCommonDataStore.h:398
WriteData::onError
StatusCode onError()
Definition: Control/AthenaExamples/AthExStoreGateExample/src/WriteData.cxx:339
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
SG::VarHandleKeyArray::setOwner
virtual void setOwner(IDataHandleHolder *o)=0
run_Egamma1_LArStrip_Fex.dump
dump
Definition: run_Egamma1_LArStrip_Fex.py:88
IDTPMcnv.htype
htype
Definition: IDTPMcnv.py:27
AthCommonDataStore< AthCommonMsg< Algorithm > >::evtStore
ServiceHandle< StoreGateSvc > & evtStore()
The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:85
MyContObj::set
void set(float t, int i)
Definition: MyContObj.h:18
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
AthCommonDataStore
Definition: AthCommonDataStore.h:52
AthAlgorithm::sysInitialize
virtual StatusCode sysInitialize() override
Override sysInitialize.
Definition: AthAlgorithm.cxx:66
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
AthCommonDataStore< AthCommonMsg< Algorithm > >::outputHandles
virtual std::vector< Gaudi::DataHandle * > outputHandles() const override
Return this algorithm's output handles.
MyContObj
Definition: MyContObj.h:11
MyDataObj
Definition: AthExStoreGateExample/MyDataObj.h:16
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
BaseClass
Definition: HiveDataObj.h:12
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition: Control/AthenaKernel/AthenaKernel/errorcheck.h:422
AthCommonDataStore< AthCommonMsg< Algorithm > >::m_detStore
StoreGateSvc_t m_detStore
Pointer to StoreGate (detector store by default)
Definition: AthCommonDataStore.h:393
SG::DEFAULTKEY
const std::string DEFAULTKEY
Definition: DefaultKey.h:12
DataVector
Derived DataVector<T>.
Definition: DataVector.h:581
SG::VarHandleKeyArray::renounce
virtual void renounce()=0
SG::HandleClassifier::type
std::conditional< std::is_base_of< SG::VarHandleKeyArray, T >::value, VarHandleKeyArrayType, type2 >::type type
Definition: HandleClassifier.h:54
merge_scale_histograms.doc
string doc
Definition: merge_scale_histograms.py:9
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
DataVector::push_back
value_type push_back(value_type pElem)
Add an element to the end of the collection.
AthAlgorithm::m_extendedExtraObjects
DataObjIDColl m_extendedExtraObjects
Definition: AthAlgorithm.h:79
a
TList * a
Definition: liststreamerinfos.cxx:10
h
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
SG::VarHandleBase::vhKey
SG::VarHandleKey & vhKey()
Return a non-const reference to the HandleKey.
Definition: StoreGate/src/VarHandleBase.cxx:623
AthAlgorithm::AthAlgorithm
AthAlgorithm()
Default constructor:
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:798
LHEF::Writer
Pythia8::Writer Writer
Definition: Prophecy4fMerger.cxx:12
AthCommonDataStore::declareGaudiProperty
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>
Definition: AthCommonDataStore.h:156
fitman.k
k
Definition: fitman.py:528
MapStringFloat
std::map< std::string, float > MapStringFloat
Definition: MapStringFloat.h:21
ServiceHandle< ICondSvc >