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

#include <WriteDataReentrant.h>

Inheritance diagram for WriteDataReentrant:
Collaboration diagram for WriteDataReentrant:

Public Member Functions

 WriteDataReentrant (const std::string &name, ISvcLocator *pSvcLocator)
 
virtual StatusCode initialize () override final
 
virtual StatusCode finalize () override final
 
virtual StatusCode execute (const EventContext &ctx) const override final
 
virtual StatusCode sysInitialize () override
 Override sysInitialize. More...
 
virtual bool isClonable () const override
 Specify if the algorithm is clonable. More...
 
virtual unsigned int cardinality () const override
 Cardinality (Maximum number of clones that can exist) special value 0 means that algorithm is reentrant. More...
 
virtual StatusCode sysExecute (const EventContext &ctx) override
 Execute an algorithm. More...
 
virtual const DataObjIDColl & extraOutputDeps () const override
 Return the list of extra output dependencies. More...
 
virtual bool filterPassed (const EventContext &ctx) const
 
virtual void setFilterPassed (bool state, const EventContext &ctx) const
 
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 () const
 
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

SG::WriteHandleKey< MyDataObjm_dobjKey
 
SG::WriteHandleKey< MyDataObjm_dobjKey2
 
SG::WriteHandleKey< MyDataObjm_dobjKey3
 
SG::WriteHandleKey< DataVector< MyContObj > > m_cobjKey
 
SG::WriteHandleKey< std::vector< float > > m_vFloatKey
 
SG::WriteHandleKey< MapStringFloatm_mKey
 
SG::WriteHandleKey< std::list< ElementLink< std::vector< float > > > > m_pLinkListKey
 
SG::WriteHandleKey< std::vector< ElementLink< MapStringFloat > > > m_linkVectorKey
 
SG::WriteHandleKey< TestDataObjectm_testObjectKey
 
SG::WriteHandleKeyArray< MyDataObjm_dobjKeyArray
 
SG::DataObjectSharedPtr< TestDataObjectm_testObject
 
DataObjIDColl m_extendedExtraObjects
 Extra output dependency collection, extended by AthAlgorithmDHUpdate to add symlinks. More...
 
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 28 of file WriteDataReentrant.h.

Member Typedef Documentation

◆ StoreGateSvc_t

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

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ WriteDataReentrant()

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

Definition at line 37 of file WriteDataReentrant.cxx.

38  :
39  AthReentrantAlgorithm(name, pSvcLocator)
40 {
41  declareProperty ("DObjKey", m_dobjKey = "dobj");
42  declareProperty ("DObjKey2", m_dobjKey2 = "dobj2");
43  declareProperty ("DObjKey3", m_dobjKey3);
44  //declareProperty ("DObjKey4", m_dobjKey4 = "dobj4");
45  declareProperty ("CObjKey", m_cobjKey = "cobj");
46  declareProperty ("VFloatKey", m_vFloatKey = "vFloat");
47  declareProperty ("PLinkListKey", m_pLinkListKey);
48  declareProperty ("MKey", m_mKey = "mkey");
49  declareProperty ("LinkVectorKey", m_linkVectorKey = "linkvec");
50  declareProperty ("TestObjectKey", m_testObjectKey = "testobj");
51  declareProperty ("DObjKeyArray", m_dobjKeyArray = {"dobj_a1", "dobj_a2"});
52 }

Member Function Documentation

◆ cardinality()

unsigned int AthReentrantAlgorithm::cardinality ( ) const
overridevirtualinherited

Cardinality (Maximum number of clones that can exist) special value 0 means that algorithm is reentrant.

Override this to return 0 for reentrant algorithms.

Override this to return 0 for reentrant algorithms.

Definition at line 55 of file AthReentrantAlgorithm.cxx.

56 {
57  return 0;
58 }

◆ declareGaudiProperty() [1/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< Gaudi::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< Gaudi::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< Gaudi::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< Gaudi::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< Gaudi::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< Gaudi::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< Gaudi::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< Gaudi::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< Gaudi::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< Gaudi::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< Gaudi::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< Gaudi::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< Gaudi::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 WriteDataReentrant::execute ( const EventContext &  ctx) const
finaloverridevirtual

Definition at line 85 of file WriteDataReentrant.cxx.

86 {
87  //this example illustrates how to record objects into the StoreGate(SG)
88  //with and without providing a key
89  //It then covers the new DataLink class and its usage as a persistable
90  //reference among objects in the SG
91  //Finally it shows how to use symlinks to record an object using its
92  //concrete type and its base class(es).
93 
94  ATH_MSG_INFO ("in execute()");
95 
96  // For algorithms that produce new data objects like this one
97  // the SG works like a bulletin board: the algorithm posts the
98  // new object to the SG (optionally providing a "name" for it).
99  // The SG assigns a unique identifier to the object and puts it on display
100  // alongside others of the same type.
101  // At preset intervals all objects are removed from the board to make room
102  // for new ones and filed.
103 
104  // Part 1: Recording objects to SG
106  dobj = std::make_unique<MyDataObj>(1);
107 
108  //now we create a second MyDataObj instance...
109  //...try to record it as we did for the first. Since dobj2 is also a
110  //MyDataObj we expect to see an error
111  ATH_MSG_WARNING ("we expect an error message here");
112  EXPECT_EXCEPTION (std::runtime_error,
113  dobj = std::make_unique<MyDataObj>(2));
114  ATH_MSG_WARNING ("end of error message");
115 
116  //here we go again...
117  //... but this time we register the dobj3 using this algo name as key
118  auto dobj3 = SG::makeHandle (m_dobjKey3, ctx);
119  dobj3 = std::make_unique<MyDataObj>(3);
120 
122  if (m_testObject->refCount() != 1) std::abort();
123  ATH_CHECK( testobj.record (m_testObject) );
124  if (m_testObject->refCount() != 2) std::abort();
125 
126 #if 0
127  {
128  SG::WriteHandle<MyDataObj> dobj4 (m_dobjKey4, ctx);
129  ATH_CHECK( dobj4.recordOrRetrieve (std::make_unique<MyDataObj>(4)) );
130  MyDataObj* pp = &*dobj4;
131  ATH_CHECK( dobj4.recordOrRetrieve (std::make_unique<MyDataObj>(4)) );
132  assert (pp == &*dobj4);
133  }
134 #endif
135 
136  // Writing an array of objects.
137  size_t i = 0;
140  ATH_CHECK( h.record (std::make_unique<MyDataObj> (i+100)) );
141  ++i;
142  }
143 
145 
146  // Part 2: storing collections in the SG
147 
149  ATH_CHECK( cobj.record (std::make_unique<DataVector<MyContObj> >()) );
150  cobj->reserve(10);
151  cobj->push_back (std::make_unique<MyContObj> (11.3, 132));
152  cobj->push_back (std::make_unique<MyContObj> (41.7, 291));
153 
154  // as above with a vector of integers
156  vFloat = std::make_unique<std::vector<float> >();
157  vFloat->push_back(1.0);
158  vFloat->push_back(2.0);
159  vFloat->push_back(3.0);
160 
162  ATH_CHECK( m.record (std::make_unique<MapStringFloat>()) );
163  (*m)["uno"]=1.0;
164  (*m)["due"]=2.0;
165 
167  //
168  // Part 3: Data Links
169  //
170  // Data links are persistable references. Typically they will replace
171  // pointers from one object in the event to another, hence they have
172  // the usual "pointer" syntax (op *, op ->, op !, ...)
173  // (to be pedantic they have the moniker syntax as they don't define ++, --)
174  // For example in Atlfast::Cell
175  // class Cell {
176  // ...
177  // private:
178  // std::vector<const HepMC::Particle*> m_particles;
179  // };
180  // m_particles would become
181  // std::vector<HepMCLink<Particle>::type > m_particles;
182  //
183  // To understand data links it is important to observe that the SG
184  // is not able to identify every single object in the event.
185  // In particular individual elements of a container (the MyContObj
186  // in the vector above or the Particles in McEventCollection) are not
187  // recorded individually into SG, only their owner (the container) is.
188  // For this reason data links are supported by two class templates:
189  // DataLink<DATAOBJ> is a link to a data object i.e. an object
190  // identified by SG
191  // ElementLink<CONTAINER> is a link to an element of a container (which
192  // in turn is a SG data object)
193  // To make a DataLink persistable we need to provide its SG identifier
194  // (its type and key).
195  // To make an ElementLink persistable we need two pieces of information:
196  // i) the SG identifier (type/key) of the data object owning the element
197  // ii) the identifier of the contained object within the owner
198  // For example when we write out a link to the third element of
199  // our vector<float> we want to write the SG id of the vector
200  // and the index (2) of the element in the vector
201  //
202  // Since the indexing mechanism of a container depends on the container
203  // type we need to specialize ElementLink for different containers
204  // Elements of STL sequences (lists, vectors, deques but also DataVector
205  // and DataList) are dealt with automatically.
206  // For other STL or STL-like containers, the data object designer (or the
207  // client must "help" ElementLink identifying the type of container
208  // Three macros in the header StoreGate/DeclareIndexingPolicy.h
209  // are provided to this end:
210  // for sequences use CONTAINER_IS_SEQUENCE( MySequence )
211  // for sets use CONTAINER_IS_SET( MySet )
212  // for maps and related containers use CONTAINER_IS_MAP( MyMap )
213  //
214  // It is also possible to define custom specializations of ElementLink
215  // for custom containers (e.g. GenParticleLink for McEventCollection).
216  //
217  //Enough! Let's now create our first DataLink. It refers to the first
218  // MyDataObj we recorded. DataLink constructors use references
219  // as input arguments
220  //
221  // DataLink referring to a storable object
222  //
223  DataLink<MyDataObj> dobjLink(*dobj);
224  //since dobj is identifiable in the SG a reference to it is all we need
225 
227  dobj2 = std::make_unique<MyDataObj> (2);
228 
229  //Otherwise one could first create an empty link
230  DataLink<MyDataObj> dobjLink2;
231  //and later on set it to refer to its target
232  dobjLink2.toStorableObject(*dobj2);
233 
234 
235  // Added Aug 30, 2001 HMA
236  // DataLink made from a key. This should work for either an object
237  // already registered in the store, or an object that has a
238  // persistency for it. we use dobj3, which is an object registered with
239  // a key.
240 
241  DataLink<MyDataObj> dobjLink3(name());
242  // now access it. DataLink will do a retrieve to get it from the store.
243  dobjLink3->val();
244 
245  //
246  // ElementLinks referring to contained objects
247  //
248  typedef ElementLink<std::vector<float> > VecElemLink;
249 
250 
251  VecElemLink thirdElementLink(*vFloat, 2); //THIS CRASHES SUN CC
252 
253  //sometimes we would not know the index of the element we want to refer to
254 
255  //reference to an element of the vector
256  float& anElement = vFloat->operator[](0);
257 
258  //starting from an empty link
259  VecElemLink aLink;
260  //we can refer it to its target without knowing its index
261  aLink.toContainedElement(*vFloat, anElement);
262  //it is better though to remember that toContainedElement for an
263  //ElementLink performs a linear search of "anElement" into "vFloat".
264  // If vFloat has a million elements think twice before using
265  // toContainedElement!
266 
268  pLinkList = std::make_unique<std::list<VecElemLink> >();
269  pLinkList->push_back(aLink);
270  pLinkList->push_back(thirdElementLink);
271 
272  //
273  // Part 3b: create a vector of links to the elements of the map above
274  //
275  typedef ElementLink<MapStringFloat> MapElemLink;
277  linkVector = std::make_unique<std::vector<MapElemLink> >();
278  linkVector->push_back(MapElemLink(*m, "uno"));
279  MapElemLink mLink;
280  mLink.toContainedElement(*m, (*m)["due"]);
281  linkVector->push_back(mLink);
282 
283  // Part 4
284  // make a link to dobj as its base class after it has been registered
285  // this allows later to retrieve different concrete types as a common ABC
286 
287  const BaseClass * pDO = 0;
288  if ( (evtStore()->symLink(dobj.cptr(), pDO)).isFailure() ) {
289  ATH_MSG_ERROR (" could not make link to BaseClass");
290  return( onError() );
291  }
292 
293  // make a link as its base class, with the same name
294  if ( ( evtStore()->symLink(dobj3.cptr(), pDO)).isFailure() ) {
295  ATH_MSG_ERROR (" could not make link to BaseClass");
296  return( onError() );
297  }
298 
299  // Part 5
300  // finally dump the structure of the StoreGate before returning
301  ATH_MSG_INFO (" registered all data objects");
302  ATH_MSG_INFO (" StoreGate structure before returning from execute \n"
303  << evtStore()->dump());
304 
305  return StatusCode::SUCCESS;
306 }

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< Gaudi::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 & AthReentrantAlgorithm::extraOutputDeps ( ) const
overridevirtualinherited

Return the list of extra output dependencies.

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

Definition at line 79 of file AthReentrantAlgorithm.cxx.

80 {
81  // If we didn't find any symlinks to add, just return the collection
82  // from the base class. Otherwise, return the extended collection.
83  if (!m_extendedExtraObjects.empty()) {
85  }
86  return Algorithm::extraOutputDeps();
87 }

◆ filterPassed()

virtual bool AthReentrantAlgorithm::filterPassed ( const EventContext &  ctx) const
inlinevirtualinherited

Definition at line 135 of file AthReentrantAlgorithm.h.

135  {
136  return execState( ctx ).filterPassed();
137  }

◆ finalize()

StatusCode WriteDataReentrant::finalize ( )
finaloverridevirtual

Definition at line 310 of file WriteDataReentrant.cxx.

311 {
312  ATH_MSG_INFO ("in finalize()");
313  return StatusCode::SUCCESS;
314 }

◆ initialize()

StatusCode WriteDataReentrant::initialize ( )
finaloverridevirtual

Definition at line 56 of file WriteDataReentrant.cxx.

57 {
59 
60  // If user did not set a key, use our own name. This cannot be done in the
61  // constructor as "DefaultName" is used during configurable generation (genconf).
62  if (m_dobjKey3.empty()) m_dobjKey3 = name();
64 
65  ATH_MSG_INFO ("in initialize()");
69  //ATH_CHECK( m_dobjKey4.initialize() );
76  ATH_CHECK( m_dobjKeyArray.initialize() );
77 
78  m_testObject =
80  return StatusCode::SUCCESS;
81 }

◆ inputHandles()

virtual std::vector<Gaudi::DataHandle*> AthCommonDataStore< AthCommonMsg< Gaudi::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.

◆ isClonable()

bool AthReentrantAlgorithm::isClonable ( ) const
overridevirtualinherited

◆ msg() [1/2]

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

Definition at line 24 of file AthCommonMsg.h.

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

◆ msg() [2/2]

MsgStream& AthCommonMsg< Gaudi::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< Gaudi::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 WriteDataReentrant::onError ( ) const
private

Definition at line 317 of file WriteDataReentrant.cxx.

318 {
319  ATH_MSG_ERROR ("Dumping StoreGate after error occurred\n"
320  << evtStore()->dump());
321  return StatusCode::FAILURE;
322 }

◆ outputHandles()

virtual std::vector<Gaudi::DataHandle*> AthCommonDataStore< AthCommonMsg< Gaudi::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< Gaudi::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< Gaudi::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  }

◆ setFilterPassed()

virtual void AthReentrantAlgorithm::setFilterPassed ( bool  state,
const EventContext &  ctx 
) const
inlinevirtualinherited

Definition at line 139 of file AthReentrantAlgorithm.h.

139  {
140  execState( ctx ).setFilterPassed( state );
141  }

◆ sysExecute()

StatusCode AthReentrantAlgorithm::sysExecute ( const EventContext &  ctx)
overridevirtualinherited

Execute an algorithm.

We override this in order to work around an issue with the Algorithm base class storing the event context in a member variable that can cause crashes in MT jobs.

Definition at line 67 of file AthReentrantAlgorithm.cxx.

68 {
69  return Gaudi::Algorithm::sysExecute (ctx);
70 }

◆ sysInitialize()

StatusCode AthReentrantAlgorithm::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< Gaudi::Algorithm > >.

Reimplemented in InputMakerBase, and HypoBase.

Definition at line 96 of file AthReentrantAlgorithm.cxx.

96  {
98 
99  if (sc.isFailure()) {
100  return sc;
101  }
102 
103  ServiceHandle<ICondSvc> cs("CondSvc",name());
104  for (auto h : outputHandles()) {
105  if (h->isCondition() && h->mode() == Gaudi::DataHandle::Writer) {
106  // do this inside the loop so we don't create the CondSvc until needed
107  if ( cs.retrieve().isFailure() ) {
108  ATH_MSG_WARNING("no CondSvc found: won't autoreg WriteCondHandles");
109  return StatusCode::SUCCESS;
110  }
111  if (cs->regHandle(this,*h).isFailure()) {
112  sc = StatusCode::FAILURE;
113  ATH_MSG_ERROR("unable to register WriteCondHandle " << h->fullKey()
114  << " with CondSvc");
115  }
116  }
117  }
118  return sc;
119 }

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< Gaudi::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< Gaudi::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_cobjKey

SG::WriteHandleKey<DataVector<MyContObj> > WriteDataReentrant::m_cobjKey
private

Definition at line 42 of file WriteDataReentrant.h.

◆ m_detStore

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

Pointer to StoreGate (detector store by default)

Definition at line 393 of file AthCommonDataStore.h.

◆ m_dobjKey

SG::WriteHandleKey<MyDataObj> WriteDataReentrant::m_dobjKey
private

Definition at line 38 of file WriteDataReentrant.h.

◆ m_dobjKey2

SG::WriteHandleKey<MyDataObj> WriteDataReentrant::m_dobjKey2
private

Definition at line 39 of file WriteDataReentrant.h.

◆ m_dobjKey3

SG::WriteHandleKey<MyDataObj> WriteDataReentrant::m_dobjKey3
private

Definition at line 40 of file WriteDataReentrant.h.

◆ m_dobjKeyArray

SG::WriteHandleKeyArray<MyDataObj> WriteDataReentrant::m_dobjKeyArray
private

Definition at line 49 of file WriteDataReentrant.h.

◆ m_evtStore

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

Pointer to StoreGate (event store by default)

Definition at line 390 of file AthCommonDataStore.h.

◆ m_extendedExtraObjects

DataObjIDColl AthReentrantAlgorithm::m_extendedExtraObjects
privateinherited

Extra output dependency collection, extended by AthAlgorithmDHUpdate to add symlinks.

Empty if no symlinks were found.

Definition at line 153 of file AthReentrantAlgorithm.h.

◆ m_linkVectorKey

SG::WriteHandleKey<std::vector<ElementLink<MapStringFloat> > > WriteDataReentrant::m_linkVectorKey
private

Definition at line 46 of file WriteDataReentrant.h.

◆ m_mKey

SG::WriteHandleKey<MapStringFloat> WriteDataReentrant::m_mKey
private

Definition at line 44 of file WriteDataReentrant.h.

◆ m_pLinkListKey

SG::WriteHandleKey<std::list<ElementLink<std::vector<float> > > > WriteDataReentrant::m_pLinkListKey
private

Definition at line 45 of file WriteDataReentrant.h.

◆ m_testObject

SG::DataObjectSharedPtr<TestDataObject> WriteDataReentrant::m_testObject
private

Definition at line 51 of file WriteDataReentrant.h.

◆ m_testObjectKey

SG::WriteHandleKey<TestDataObject> WriteDataReentrant::m_testObjectKey
private

Definition at line 47 of file WriteDataReentrant.h.

◆ m_varHandleArraysDeclared

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

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vFloatKey

SG::WriteHandleKey<std::vector<float> > WriteDataReentrant::m_vFloatKey
private

Definition at line 43 of file WriteDataReentrant.h.

◆ m_vhka

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

Definition at line 398 of file AthCommonDataStore.h.


The documentation for this class was generated from the following files:
WriteDataReentrant::m_cobjKey
SG::WriteHandleKey< DataVector< MyContObj > > m_cobjKey
Definition: WriteDataReentrant.h:42
python.SystemOfUnits.m
int m
Definition: SystemOfUnits.py:91
python.PerfMonSerializer.p
def p
Definition: PerfMonSerializer.py:743
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
WriteDataReentrant::m_vFloatKey
SG::WriteHandleKey< std::vector< float > > m_vFloatKey
Definition: WriteDataReentrant.h:43
make_unique
std::unique_ptr< T > make_unique(Args &&... args)
Definition: SkimmingToolEXOT5.cxx:23
AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
WriteDataReentrant::m_linkVectorKey
SG::WriteHandleKey< std::vector< ElementLink< MapStringFloat > > > m_linkVectorKey
Definition: WriteDataReentrant.h:46
EXPECT_EXCEPTION
#define EXPECT_EXCEPTION(EXC, CODE)
Helper to check that an exception is thrown.
Definition: expect_exception.h:33
AthCommonDataStore::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 > renounce(T &h)
Definition: AthCommonDataStore.h:380
AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::m_evtStore
StoreGateSvc_t m_evtStore
Pointer to StoreGate (event store by default)
Definition: AthCommonDataStore.h:390
AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::m_vhka
std::vector< SG::VarHandleKeyArray * > m_vhka
Definition: AthCommonDataStore.h:398
TestDataObject
Definition: AthExStoreGateExample/MyDataObj.h:35
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
WriteDataReentrant::m_pLinkListKey
SG::WriteHandleKey< std::list< ElementLink< std::vector< float > > > > m_pLinkListKey
Definition: WriteDataReentrant.h:45
SG::VarHandleKey::empty
bool empty() const
Test if the key is blank.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:150
WriteDataReentrant::m_dobjKey3
SG::WriteHandleKey< MyDataObj > m_dobjKey3
Definition: WriteDataReentrant.h:40
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
SG::VarHandleKeyArray::setOwner
virtual void setOwner(IDataHandleHolder *o)=0
WriteDataReentrant::m_testObject
SG::DataObjectSharedPtr< TestDataObject > m_testObject
Definition: WriteDataReentrant.h:51
WriteDataReentrant::onError
StatusCode onError() const
Definition: WriteDataReentrant.cxx:317
SG::makeHandle
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
Definition: ReadCondHandle.h:269
AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::evtStore
ServiceHandle< StoreGateSvc > & evtStore()
The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:85
WriteDataReentrant::m_dobjKey
SG::WriteHandleKey< MyDataObj > m_dobjKey
Definition: WriteDataReentrant.h:38
AthCommonDataStore
Definition: AthCommonDataStore.h:52
AthReentrantAlgorithm::AthReentrantAlgorithm
AthReentrantAlgorithm()
Default constructor:
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
SG::WriteHandleKey< MyDataObj >
AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::outputHandles
virtual std::vector< Gaudi::DataHandle * > outputHandles() const override
Return this algorithm's output handles.
lumiFormat.i
int i
Definition: lumiFormat.py:92
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
extractSporadic.h
list h
Definition: extractSporadic.py:97
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::m_detStore
StoreGateSvc_t m_detStore
Pointer to StoreGate (detector store by default)
Definition: AthCommonDataStore.h:393
SG::VarHandleKey::initialize
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:103
python.ChapPy.dump
def dump(buf, stdout=sys.stdout)
Definition: ChapPy.py:25
DataVector
Derived DataVector<T>.
Definition: DataVector.h:581
AthReentrantAlgorithm::m_extendedExtraObjects
DataObjIDColl m_extendedExtraObjects
Extra output dependency collection, extended by AthAlgorithmDHUpdate to add symlinks.
Definition: AthReentrantAlgorithm.h:153
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
WriteDataReentrant::m_dobjKey2
SG::WriteHandleKey< MyDataObj > m_dobjKey2
Definition: WriteDataReentrant.h:39
WriteDataReentrant::m_dobjKeyArray
SG::WriteHandleKeyArray< MyDataObj > m_dobjKeyArray
Definition: WriteDataReentrant.h:49
merge_scale_histograms.doc
string doc
Definition: merge_scale_histograms.py:9
errorcheck::ReportMessage::hideErrorLocus
static void hideErrorLocus(bool flag=true)
If set to true, hide the source file and line number in the output.
Definition: errorcheck.cxx:197
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:192
AthReentrantAlgorithm::sysInitialize
virtual StatusCode sysInitialize() override
Override sysInitialize.
Definition: AthReentrantAlgorithm.cxx:96
WriteDataReentrant::m_mKey
SG::WriteHandleKey< MapStringFloat > m_mKey
Definition: WriteDataReentrant.h:44
SG::WriteHandle
Definition: StoreGate/StoreGate/WriteHandle.h:76
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:616
declareProperty
#define declareProperty(n, p, h)
Definition: BaseFakeBkgTool.cxx:15
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:790
LHEF::Writer
Pythia8::Writer Writer
Definition: Prophecy4fMerger.cxx:12
SG::DataObjectSharedPtr< TestDataObject >
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
ServiceHandle< ICondSvc >
WriteDataReentrant::m_testObjectKey
SG::WriteHandleKey< TestDataObject > m_testObjectKey
Definition: WriteDataReentrant.h:47