Loading [MathJax]/extensions/tex2jax.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
AthenaOutputStreamTool.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
10 #include "AthenaOutputStreamTool.h"
11 
12 // Gaudi
13 #include "GaudiKernel/IConversionSvc.h"
14 #include "GaudiKernel/IOpaqueAddress.h"
15 #include "GaudiKernel/INamedInterface.h"
16 #include "GaudiKernel/IClassIDSvc.h"
17 #include "GaudiKernel/ThreadLocalContext.h"
18 
19 // Athena
22 #include "StoreGate/StoreGateSvc.h"
23 #include "SGTools/DataProxy.h"
24 #include "SGTools/SGIFolder.h"
28 
29 namespace {
30 
33 bool hasInputAlias (const SG::DataProxy& dp)
34 {
35  std::string inputName = dp.name() + "_Input";
36  return dp.hasAlias (inputName);
37 }
38 
39 
40 } // anonymous namespace
41 
44  const std::string& name,
45  const IInterface* parent) : base_class(type, name, parent),
46  m_store("DetectorStore", name),
47  m_conversionSvc("AthenaPoolCnvSvc", name),
48  m_clidSvc("ClassIDSvc", name),
49  m_decSvc("DecisionSvc/DecisionSvc", name),
50  m_dataHeader(nullptr),
51  m_connectionOpen(false),
52  m_extendProvenanceRecord(false) {
53  // Declare IAthenaOutputStreamTool interface
54  declareInterface<IAthenaOutputStreamTool>(this);
55 
56  declareProperty("SaveDecisions", m_extend = false, "Set to true to add streaming decisions to an attributeList");
57 }
58 //__________________________________________________________________________
60 }
61 //__________________________________________________________________________
63  ATH_MSG_INFO("Initializing " << name());
64 
65  ATH_CHECK( m_clidSvc.retrieve() );
66  ATH_CHECK( m_conversionSvc.retrieve() );
67 
68  // Autoconfigure
69  if (m_dataHeaderKey.empty()) {
70  m_dataHeaderKey.setValue(name());
71  // Remove "ToolSvc." from m_dataHeaderKey.
72  if (m_dataHeaderKey.value().starts_with( "ToolSvc.")) {
73  m_dataHeaderKey.setValue(m_dataHeaderKey.value().substr(8));
74  // Remove "Tool" from m_dataHeaderKey.
75  if (m_dataHeaderKey.value().find("Tool") == m_dataHeaderKey.size() - 4) {
76  m_dataHeaderKey.setValue(m_dataHeaderKey.value().substr(0, m_dataHeaderKey.size() - 4));
77  }
78  } else {
79  const INamedInterface* parentAlg = dynamic_cast<const INamedInterface*>(parent());
80  if (parentAlg != 0) {
81  m_dataHeaderKey.setValue(parentAlg->name());
82  }
83  }
84  }
85  if (m_processTag.empty()) {
86  m_processTag.setValue(m_dataHeaderKey);
87  }
88 
89  { // handle the AttrKey overwrite
90  const std::string keyword = "[AttributeListKey=";
91  std::string::size_type pos = m_outputName.value().find(keyword);
92  if( (pos != std::string::npos) ) {
93  ATH_MSG_INFO("The AttrListKey will be overwritten/set by the value from the OutputName: " << m_outputName);
94  const std::string attrListKey = m_outputName.value().substr(pos + keyword.size(),
95  m_outputName.value().find(']', pos + keyword.size()) - pos - keyword.size());
96  m_attrListKey = attrListKey;
97  }
98  }
99  if ( ! m_attrListKey.key().empty() ) {
101  m_attrListWrite = m_attrListKey.key() + "Decisions";
102  //ATH_CHECK(m_attrListWrite.initialize());
103  }
104 
105  if (!m_outputCollection.value().empty()) {
106  m_outputAttributes += "[OutputCollection=" + m_outputCollection.value() + "]";
107  }
108  if (!m_containerPrefix.value().empty()) {
109  m_outputAttributes += "[PoolContainerPrefix=" + m_containerPrefix.value() + "]";
110  }
111  if (m_containerNameHint.value() != "0") {
112  m_outputAttributes += "[TopLevelContainerName=" + m_containerNameHint.value() + "]";
113  }
114  if (m_branchNameHint.value() != "0") {
115  m_outputAttributes += "[SubLevelBranchName=" + m_branchNameHint.value() + "]";
116  }
117  if (!m_metaDataOutputCollection.value().empty()) {
118  m_metaDataOutputAttributes += "[OutputCollection=" + m_metaDataOutputCollection.value() + "]";
119  }
120  if (!m_metaDataContainerPrefix.value().empty()) {
121  m_metaDataOutputAttributes += "[PoolContainerPrefix=" + m_metaDataContainerPrefix.value() + "]";
122  }
123 
124  if (m_extend) ATH_CHECK(m_decSvc.retrieve());
125  return(StatusCode::SUCCESS);
126 }
127 //__________________________________________________________________________
129  m_decSvc.release().ignore();
130  if (m_conversionSvc.release().isFailure()) {
131  ATH_MSG_WARNING("Cannot release AthenaPoolCnvSvc");
132  }
133  if (m_clidSvc.release().isFailure()) {
134  ATH_MSG_WARNING("Cannot release the CLIDSvc");
135  }
136  return(StatusCode::SUCCESS);
137 }
138 //__________________________________________________________________________
140  const std::string& cnvSvc,
141  bool extendProvenenceRecord) {
142  // Release old data store
143  if (m_store.isValid()) {
144  if (m_store.release().isFailure()) {
145  ATH_MSG_ERROR("Could not release " << m_store.typeAndName() << " store");
146  }
147  }
148  m_store = ServiceHandle<StoreGateSvc>(dataStore, this->name());
149  if (cnvSvc != m_conversionSvc.type() && cnvSvc != "EventPersistencySvc") {
150  if (m_conversionSvc.release().isFailure()) {
151  ATH_MSG_ERROR("Could not release " << m_conversionSvc.type());
152  }
154  if (m_conversionSvc.retrieve().isFailure() || m_conversionSvc == 0) {
155  ATH_MSG_ERROR("Could not locate " << m_conversionSvc.type());
156  return(StatusCode::FAILURE);
157  }
158  }
159  m_extendProvenanceRecord = extendProvenenceRecord;
160  return(connectServices());
161 }
162 //__________________________________________________________________________
164  // Find the data store
165  if (m_store.retrieve().isFailure() || m_store == 0) {
166  ATH_MSG_ERROR("Could not locate " << m_store.typeAndName() << " store");
167  return(StatusCode::FAILURE);
168  }
169  return(StatusCode::SUCCESS);
170 }
171 //__________________________________________________________________________
173  ATH_MSG_DEBUG("In connectOutput " << outputName);
174 
175  // Use arg if not empty, save the output name
176  if (!outputName.empty()) {
177  m_outputName.setValue(outputName);
178  }
179  if (m_outputName.value().empty()) {
180  ATH_MSG_ERROR("No OutputName provided");
181  return(StatusCode::FAILURE);
182  }
183  // Connect services if not already available
184  if (m_store == 0 || m_conversionSvc == 0) {
185  if (connectServices().isFailure()) {
186  ATH_MSG_ERROR("Unable to connect services");
187  return(StatusCode::FAILURE);
188  }
189  }
190  // Connect the output file to the service
191  if (m_conversionSvc->connectOutput(m_outputName.value()).isFailure()) {
192  ATH_MSG_ERROR("Unable to connect output " << m_outputName.value());
193  return(StatusCode::FAILURE);
194  } else {
195  ATH_MSG_DEBUG("Connected to " << m_outputName.value());
196  }
197 
198  // Remove DataHeader with same key if it exists
199  if (m_store->contains<DataHeader>(m_dataHeaderKey)) {
200  const DataHeader* preDh = nullptr;
201  if (m_store->retrieve(preDh, m_dataHeaderKey).isSuccess()) {
202  if (m_store->removeDataAndProxy(preDh).isFailure()) {
203  ATH_MSG_ERROR("Unable to get proxy for the DataHeader with key " << m_dataHeaderKey);
204  return(StatusCode::FAILURE);
205  }
206  ATH_MSG_DEBUG("Released DataHeader with key " << m_dataHeaderKey);
207  }
208  }
209 
210  // Create new DataHeader
211  m_dataHeader = new DataHeader();
213 
214  // Retrieve all existing DataHeaders from StoreGate
215  const DataHeader* dh = nullptr;
216  std::vector<std::string> dhKeys;
217  m_store->keys<DataHeader>(dhKeys);
218  for (const std::string& dhKey : dhKeys) {
219  bool primaryDH = false;
220  if (!m_store->transientContains<DataHeader>(dhKey)) {
221  if (dhKey == "EventSelector") primaryDH = true;
222  ATH_MSG_DEBUG("No transientContains DataHeader with key " << dhKey);
223  }
224  if (m_store->retrieve(dh, dhKey).isFailure()) {
225  ATH_MSG_DEBUG("Unable to retrieve the DataHeader with key " << dhKey);
226  }
227  SG::DataProxy* dhProxy = m_store->proxy(dh);
228  if (dh->isInput() || hasInputAlias (*dhProxy) || primaryDH) {
229  // Add DataHeader token to new DataHeader
231  std::string pTag;
232  SG::TransientAddress* dhTransAddr = 0;
233  for (const DataHeaderElement& dhe : *dh) {
234  if (dhe.getPrimaryClassID() == ClassID_traits<DataHeader>::ID()) {
235  pTag = dhe.getKey();
236  delete dhTransAddr; dhTransAddr = dhe.getAddress(0);
237  }
238  }
239  // Update dhTransAddr to handle fast merged files.
240  if (dhProxy != 0 && dhProxy->address() != 0) {
241  delete dhTransAddr; dhTransAddr = 0;
243  dhProxy->address(),
244  pTag));
245  }
246  else if (dhTransAddr != nullptr) {
248  dhTransAddr->address(),
249  pTag));
250  delete dhTransAddr; dhTransAddr = 0;
251  }
252  }
253  // Each stream tag is written only once in the provenance record
254  // In files where there are multiple entries per stream tag
255  // the record is in reverse, i.e., the latest appears first.
256  // Therefore, only keep the first entry if there are multiple
257  // matches so that we retain the latest one.
258  std::set<std::string> insertedTags{};
259  for(auto iter=dh->beginProvenance(), iEnd=dh->endProvenance(); iter != iEnd; ++iter) {
260  const auto & currentKey = (*iter).getKey();
261  if(!insertedTags.contains(currentKey)) {
262  insertedTags.insert(currentKey);
264  }
265  }
266  }
267  }
268 
269  // Attach the attribute list to the DataHeader if requested
270  if (!m_attrListKey.key().empty() && m_store->storeID() == StoreID::EVENT_STORE) {
271  auto attrListHandle = SG::makeHandle(m_attrListKey);
272  if (!attrListHandle.isValid()) {
273  ATH_MSG_WARNING("Unable to retrieve AttributeList with key " << m_attrListKey);
274  } else {
275  m_dataHeader->setAttributeList(attrListHandle.cptr());
276  if (m_extend) { // Add streaming decisions
277  ATH_MSG_DEBUG("Adding stream decisions to " << m_attrListWrite);
278  // Look for attribute list created for mini-EventInfo
279  const AthenaAttributeList* attlist(attrListHandle.cptr());
280 
281  // Build new attribute list for modification
282  AthenaAttributeList* newone = new AthenaAttributeList(attlist->specification());
283  newone->copyData(*attlist);
284 
285  // Now loop over stream definitions and add decisions
286  auto streams = m_decSvc->getStreams();
287  for (auto it = streams.begin();
288  it != streams.end(); ++it) {
289  newone->extend(*it,"bool");
290  (*newone)[*it].data<bool>() = m_decSvc->isEventAccepted(*it,Gaudi::Hive::currentContext());
291  ATH_MSG_DEBUG("Added stream decision for " << *it << " to " << m_attrListKey);
292  }
293  // record new attribute list with old key + suffix
294  const AthenaAttributeList* attrList2 = nullptr;
295  if (!m_store->contains<AthenaAttributeList>(m_attrListWrite)) {
296  if (m_store->record(newone,m_attrListWrite).isFailure()) {
297  ATH_MSG_ERROR("Unable to record att list " << m_attrListWrite);
298  }
299  } else {
300  ATH_MSG_DEBUG("Decisions already added by a different stream");
301  }
302  if (m_store->retrieve(attrList2,m_attrListWrite).isFailure()) {
303  ATH_MSG_ERROR("Unable to record att list " << m_attrListWrite);
304  } else {
305  m_dataHeader->setAttributeList(attrList2);
306  }
307 /*
308  SG::WriteHandle<AthenaAttributeList> attrWrite(m_attrListWrite);
309  std::unique_ptr<AthenaAttributeList> uptr = std::make_unique<AthenaAttributeList>(*newone);
310  if ( attrWrite.record(std::move(uptr)).isFailure() ) {
311  ATH_MSG_ERROR("Unable to record att list " << m_attrListWrite);
312  } else {
313  ATH_MSG_DEBUG("Decisions already added by a different stream");
314  }
315 */
316  //m_dataHeader->setAttributeList(newone);
317  } // list extend check
318  } // list retrieve check
319  } // list property check
320 
321  // Record DataHeader in StoreGate
323  if (wh.record(std::unique_ptr<DataHeader>(m_dataHeader)).isFailure()) {
324  ATH_MSG_ERROR("Unable to record DataHeader with key " << m_dataHeaderKey);
325  return(StatusCode::FAILURE);
326  } else {
327  ATH_MSG_DEBUG("Recorded DataHeader with key " << m_dataHeaderKey);
328  }
330  // Set flag that connection is open
331  m_connectionOpen = true;
332  return(StatusCode::SUCCESS);
333 }
334 //__________________________________________________________________________
336  ATH_MSG_DEBUG("In commitOutput");
337  // Connect the output file to the service
338  if (m_conversionSvc->commitOutput(m_outputName.value(), doCommit).isFailure()) {
339  ATH_MSG_ERROR("Unable to commit output " << m_outputName.value());
340  return(StatusCode::FAILURE);
341  }
342  // Set flag that connection is closed
343  m_connectionOpen = false;
344  return(StatusCode::SUCCESS);
345 }
346 //__________________________________________________________________________
348  AthCnvSvc* athConversionSvc = dynamic_cast<AthCnvSvc*>(m_conversionSvc.get());
349  if (athConversionSvc != 0) {
350  if (athConversionSvc->disconnectOutput(m_outputName.value()).isFailure()) {
351  ATH_MSG_ERROR("Unable to finalize output " << m_outputName.value());
352  return(StatusCode::FAILURE);
353  }
354  }
355  return(StatusCode::SUCCESS);
356 }
357 //__________________________________________________________________________
359  ATH_MSG_DEBUG("In streamObjects");
360  // Check that a connection has been opened
361  if (!m_connectionOpen) {
362  ATH_MSG_ERROR("Connection NOT open. Please open a connection before streaming out objects.");
363  return(StatusCode::FAILURE);
364  }
365  // Use arg if not empty, save the output name
366  if (!outputName.empty()) {
367  m_outputName.setValue(outputName);
368  }
369  if (m_outputName.value().empty()) {
370  ATH_MSG_ERROR("No OutputName provided");
371  return(StatusCode::FAILURE);
372  }
373  // Now iterate over the type/key pairs and stream out each object
374  std::vector<DataObject*> dataObjects;
375  for (TypeKeyPairs::const_iterator first = typeKeys.begin(), last = typeKeys.end();
376  first != last; ++first) {
377  const std::string& type = (*first).first;
378  const std::string& key = (*first).second;
379  // Find the clid for type name from the CLIDSvc
380  CLID clid;
381  if (m_clidSvc->getIDOfTypeName(type, clid).isFailure()) {
382  ATH_MSG_ERROR("Could not get clid for typeName " << type);
383  return(StatusCode::FAILURE);
384  }
385  DataObject* dObj = 0;
386  // Two options: no key or explicit key
387  if (key.empty()) {
388  ATH_MSG_DEBUG("Get data object with no key");
389  // Get DataObject without key
390  dObj = m_store->accessData(clid);
391  } else {
392  ATH_MSG_DEBUG("Get data object with key");
393  // Get DataObjects with key
394  dObj = m_store->accessData(clid, key);
395  }
396  if (dObj == 0) {
397  // No object - print warning and return
398  ATH_MSG_DEBUG("No object found for type " << type << " key " << key);
399  return(StatusCode::SUCCESS);
400  } else {
401  ATH_MSG_DEBUG("Found object for type " << type << " key " << key);
402  }
403  // Save the dObj
404  dataObjects.push_back(dObj);
405  }
406  // Stream out objects
407  if (dataObjects.size() == 0) {
408  ATH_MSG_DEBUG("No data objects found");
409  return(StatusCode::SUCCESS);
410  }
411  StatusCode status = streamObjects(dataObjects, m_outputName.value());
412  if (!status.isSuccess()) {
413  ATH_MSG_ERROR("Could not stream out objects");
414  return(status);
415  }
416  return(StatusCode::SUCCESS);
417 }
418 //__________________________________________________________________________
420  // Check that a connection has been opened
421  if (!m_connectionOpen) {
422  ATH_MSG_ERROR("Connection NOT open. Please open a connection before streaming out objects.");
423  return(StatusCode::FAILURE);
424  }
425  // Connect the output file to the service
426  std::string outputConnectionString = outputName;
427  const std::string defaultMetaDataString = "[OutputCollection=MetaDataHdr][PoolContainerPrefix=MetaData]";
428  if (std::string::size_type mpos = outputConnectionString.find(defaultMetaDataString); mpos!=std::string::npos) {
429  // If we're in here we're writing MetaData
430  // Now let's see if we should be overwriting the MetaData attributes
431  // For the time-being this happens when we're writing MetaData in the augmentation mode
432  if (!m_metaDataOutputAttributes.empty()) {
433  // Note: This won't work quite right if only one attribute is set though!
434  outputConnectionString.replace(mpos, defaultMetaDataString.length(), m_metaDataOutputAttributes);
435  }
436  }
437  for (std::string::size_type pos = m_outputAttributes.find('['); pos != std::string::npos; pos = m_outputAttributes.find('[', ++pos)) {
438  if (outputConnectionString.find(m_outputAttributes.substr(pos, m_outputAttributes.find('=', pos) + 1 - pos)) == std::string::npos) {
439  outputConnectionString += m_outputAttributes.substr(pos, m_outputAttributes.find(']', pos) + 1 - pos);
440  }
441  }
442 
443  // Check that the DataHeader is still valid
444  DataObject* dataHeaderObj = m_store->accessData(ClassID_traits<DataHeader>::ID(), m_dataHeaderKey);
445  std::map<DataObject*, IOpaqueAddress*> written;
446  for (DataObject* dobj : dataObjects) {
447  // Do not write the DataHeader via the explicit list
448  if (dobj->clID() == ClassID_traits<DataHeader>::ID()) {
449  ATH_MSG_DEBUG("Explicit request to write DataHeader: " << dobj->name() << " - skipping it.");
450  // Do not stream out same object twice
451  } else if (written.find(dobj) != written.end()) {
452  // Print warning and skip
453  ATH_MSG_DEBUG("Trying to write DataObject twice (clid/key): " << dobj->clID() << " " << dobj->name());
454  ATH_MSG_DEBUG(" Skipping this one.");
455  } else {
456  // Write object
457  IOpaqueAddress* addr = new TokenAddress(0, dobj->clID(), outputConnectionString);
458  addr->addRef();
459  if (m_conversionSvc->createRep(dobj, addr).isSuccess()) {
460  written.insert(std::pair<DataObject*, IOpaqueAddress*>(dobj, addr));
461  } else {
462  ATH_MSG_ERROR("Could not create Rep for DataObject (clid/key):" << dobj->clID() << " " << dobj->name());
463  return(StatusCode::FAILURE);
464  }
465  }
466  }
467  // End of loop over DataObjects, write DataHeader
468  if (m_conversionSvc.type() == "AthenaPoolCnvSvc" && dataHeaderObj != nullptr) {
469  IOpaqueAddress* addr = new TokenAddress(0, dataHeaderObj->clID(), outputConnectionString);
470  addr->addRef();
471  if (m_conversionSvc->createRep(dataHeaderObj, addr).isSuccess()) {
472  written.insert(std::pair<DataObject*, IOpaqueAddress*>(dataHeaderObj, addr));
473  } else {
474  ATH_MSG_ERROR("Could not create Rep for DataHeader");
475  return(StatusCode::FAILURE);
476  }
477  }
478  for (DataObject* dobj : dataObjects) {
479  // call fillRepRefs of persistency service
480  SG::DataProxy* proxy = dynamic_cast<SG::DataProxy*>(dobj->registry());
481  if (proxy != nullptr && written.find(dobj) != written.end()) {
482  IOpaqueAddress* addr(written.find(dobj)->second);
483  if ((m_conversionSvc->fillRepRefs(addr, dobj)).isSuccess()) {
484  if (dobj->clID() != 1 || addr->par()[0] != "\n") {
485  if (dobj->clID() != ClassID_traits<DataHeader>::ID()) {
486  m_dataHeader->insert(proxy, addr);
487  } else {
489  }
490  if (proxy->address() == nullptr) {
491  proxy->setAddress(addr);
492  }
493  addr->release();
494  }
495  } else {
496  ATH_MSG_ERROR("Could not fill Object Refs for DataObject (clid/key):" << dobj->clID() << " " << dobj->name());
497  return(StatusCode::FAILURE);
498  }
499  } else {
500  ATH_MSG_WARNING("Could cast DataObject " << dobj->clID() << " " << dobj->name());
501  }
502  }
504  if (m_conversionSvc.type() == "AthenaPoolCnvSvc" && dataHeaderObj != nullptr) {
505  // End of DataObjects, fill refs for DataHeader
506  SG::DataProxy* proxy = dynamic_cast<SG::DataProxy*>(dataHeaderObj->registry());
507  if (proxy != nullptr && written.find(dataHeaderObj) != written.end()) {
508  IOpaqueAddress* addr(written.find(dataHeaderObj)->second);
509  if ((m_conversionSvc->fillRepRefs(addr, dataHeaderObj)).isSuccess()) {
510  if (dataHeaderObj->clID() != 1 || addr->par()[0] != "\n") {
511  if (dataHeaderObj->clID() != ClassID_traits<DataHeader>::ID()) {
512  m_dataHeader->insert(proxy, addr);
513  } else {
515  }
516  addr->release();
517  }
518  } else {
519  ATH_MSG_ERROR("Could not fill Object Refs for DataHeader");
520  return(StatusCode::FAILURE);
521  }
522  } else {
523  ATH_MSG_ERROR("Could not cast DataHeader");
524  return(StatusCode::FAILURE);
525  }
526  }
527  return(StatusCode::SUCCESS);
528 }
529 //__________________________________________________________________________
531  const std::string hltKey = "HLTAutoKey";
534  if (m_store->retrieve(beg, ending).isFailure() || beg == ending) {
535  ATH_MSG_DEBUG("No DataHeaders present in StoreGate");
536  } else {
537  for ( ; beg != ending; ++beg) {
538  if (m_store->transientContains<DataHeader>(beg.key()) && beg->isInput()) {
539  for (std::vector<DataHeaderElement>::const_iterator it = beg->begin(), itLast = beg->end();
540  it != itLast; ++it) {
541  // Only insert the primary clid, not the ones for the symlinks!
542  CLID clid = it->getPrimaryClassID();
543  if (clid != ClassID_traits<DataHeader>::ID()) {
544  //check the typename is known ... we make an exception if the key contains 'Aux.' ... aux containers may not have their keys known yet in some cases
545  //see https://its.cern.ch/jira/browse/ATLASG-59 for the solution
546  std::string typeName;
547  if (m_clidSvc->getTypeNameOfID(clid, typeName).isFailure() && it->getKey().find("Aux.") == std::string::npos) {
548  if (m_skippedItems.find(it->getKey()) == m_skippedItems.end()) {
549  ATH_MSG_WARNING("Skipping " << it->getKey() << " with unknown clid " << clid << " . Further warnings for this item are suppressed" );
550  m_skippedItems.insert(it->getKey());
551  }
552  continue;
553  }
554  ATH_MSG_DEBUG("Adding " << typeName << "#" << it->getKey() << " (clid " << clid << ") to itemlist");
555  const std::string keyName = it->getKey();
556  if (keyName.size() > 10 && keyName.compare(0, 10,hltKey)==0) {
557  p2BWrittenFromTool->add(clid, hltKey + "*").ignore();
558  } else if (keyName.size() > 10 && keyName.compare(keyName.size() - 10, 10, hltKey)==0) {
559  p2BWrittenFromTool->add(clid, "*" + hltKey).ignore();
560  } else {
561  p2BWrittenFromTool->add(clid, keyName).ignore();
562  }
563  }
564  }
565  }
566  }
567  }
568  ATH_MSG_DEBUG("Adding DataHeader for stream " << name());
569  return(StatusCode::SUCCESS);
570 }
AthenaOutputStreamTool::finalizeOutput
StatusCode finalizeOutput()
Finalize the output stream after the last commit, e.g.
Definition: AthenaOutputStreamTool.cxx:347
DataHeader::setProcessTag
void setProcessTag(const std::string &processTag)
Set ProcessTag for DataHeader.
Definition: DataHeader.cxx:243
TileDCSDataPlotter.dp
dp
Definition: TileDCSDataPlotter.py:840
AthenaOutputStreamTool::streamObjects
virtual StatusCode streamObjects(const TypeKeyPairs &typeKeys, const std::string &outputName="")
Definition: AthenaOutputStreamTool.cxx:358
SGIFolder.h
StateLessPT_NewConfig.proxy
proxy
Definition: StateLessPT_NewConfig.py:392
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
python.outputTest_v2.streams
streams
Definition: outputTest_v2.py:55
DataHeader::setAttributeList
void setAttributeList(const coral::AttributeList *attrList)
Definition: DataHeader.cxx:308
AthenaOutputStreamTool::m_extend
bool m_extend
Flag to extend attribute list with stream flags from DecisionSvc.
Definition: AthenaOutputStreamTool.h:115
DataHeader::addHash
void addHash(IStringPool *pool)
Add new entry to hash map.
Definition: DataHeader.cxx:297
skel.it
it
Definition: skel.GENtoEVGEN.py:407
SG::TransientAddress
Definition: TransientAddress.h:32
AthCnvSvc.h
AthenaOutputStreamTool::m_dataHeader
DataHeader * m_dataHeader
Current DataHeader for streamed objects.
Definition: AthenaOutputStreamTool.h:109
AthenaOutputStreamTool::m_skippedItems
std::set< std::string > m_skippedItems
set of skipped item keys, because of missing CLID
Definition: AthenaOutputStreamTool.h:118
AthenaOutputStreamTool::m_metaDataContainerPrefix
StringProperty m_metaDataContainerPrefix
Definition: AthenaOutputStreamTool.h:93
AthenaOutputStreamTool::finalize
StatusCode finalize()
Definition: AthenaOutputStreamTool.cxx:128
PyPoolBrowser.dh
dh
Definition: PyPoolBrowser.py:102
AthenaOutputStreamTool::m_processTag
StringProperty m_processTag
Definition: AthenaOutputStreamTool.h:88
SG::VarHandleKey::key
const std::string & key() const
Return the StoreGate ID for the referenced object.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:141
AthenaOutputStreamTool::connectServices
virtual StatusCode connectServices()
Do the real connection to services.
Definition: AthenaOutputStreamTool.cxx:163
DataHeader::insertProvenance
void insertProvenance(const DataHeaderElement &dhe)
Insert a new element into the "Provenance" vector.
Definition: DataHeader.cxx:293
SG::IFolder
a run-time configurable list of data objects
Definition: SGIFolder.h:24
python.CaloAddPedShiftConfig.type
type
Definition: CaloAddPedShiftConfig.py:42
TokenAddress
This class provides a Generic Transient Address for POOL tokens.
Definition: TokenAddress.h:23
SG::makeHandle
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
Definition: ReadCondHandle.h:270
AthenaOutputStreamTool::m_containerNameHint
StringProperty m_containerNameHint
Definition: AthenaOutputStreamTool.h:91
DataHeaderElement
This class provides a persistent form for the TransientAddress.
Definition: DataHeader.h:36
SG::DataProxy::address
virtual IOpaqueAddress * address() const override final
Retrieve IOpaqueAddress.
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
DataHeader
This class provides the layout for summary information stored for data written to POOL.
Definition: DataHeader.h:124
DataHeader::Output
@ Output
Definition: DataHeader.h:126
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
AthenaOutputStreamTool::m_dataHeaderKey
StringProperty m_dataHeaderKey
Definition: AthenaOutputStreamTool.h:87
ClassID_traits
Default, invalid implementation of ClassID_traits.
Definition: Control/AthenaKernel/AthenaKernel/ClassID_traits.h:37
AthenaOutputStreamTool::getInputItemList
virtual StatusCode getInputItemList(SG::IFolder *m_p2BWrittenFromTool)
Definition: AthenaOutputStreamTool.cxx:530
test_pyathena.parent
parent
Definition: test_pyathena.py:15
parseDir.wh
wh
Definition: parseDir.py:46
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
AthenaAttributeList
An AttributeList represents a logical row of attributes in a metadata table. The name and type of eac...
Definition: PersistentDataModel/PersistentDataModel/AthenaAttributeList.h:45
plotmaker.keyName
keyName
Definition: plotmaker.py:145
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
jobOptions.pTag
string pTag
Definition: jobOptions.py:28
DataHeader.h
This file contains the class definition for the DataHeader and DataHeaderElement classes.
AthenaOutputStreamTool::AthenaOutputStreamTool
AthenaOutputStreamTool(const std::string &type, const std::string &name, const IInterface *parent)
Standard AlgTool Constructor.
Definition: AthenaOutputStreamTool.cxx:43
CLID
uint32_t CLID
The Class ID type.
Definition: Event/xAOD/xAODCore/xAODCore/ClassID_traits.h:47
AthenaOutputStreamTool::m_containerPrefix
StringProperty m_containerPrefix
Definition: AthenaOutputStreamTool.h:90
IDecisionSvc.h
AthenaOutputStreamTool::TypeKeyPairs
std::vector< TypeKeyPair > TypeKeyPairs
Definition: AthenaOutputStreamTool.h:68
DataHeader::insert
void insert(const SG::TransientAddress *sgAddress, IOpaqueAddress *tokAddress=0, const std::string &pTag="")
Insert a new element into the "DataObject" vector.
Definition: DataHeader.cxx:267
AthenaOutputStreamTool::m_branchNameHint
StringProperty m_branchNameHint
Definition: AthenaOutputStreamTool.h:94
AthenaOutputStreamTool::m_outputCollection
StringProperty m_outputCollection
Definition: AthenaOutputStreamTool.h:89
DataHeader::setStatus
void setStatus(statusFlag status)
Set StatusFlag enum for DataHeader.
Definition: DataHeader.cxx:235
AthenaOutputStreamTool::m_conversionSvc
ServiceHandle< IConversionSvc > m_conversionSvc
Keep reference to the data conversion service.
Definition: AthenaOutputStreamTool.h:103
AthenaOutputStreamTool::DataObjectVec
std::vector< DataObject * > DataObjectVec
Stream out a vector of objects Must convert to DataObject, e.g.
Definition: AthenaOutputStreamTool.h:76
WriteBchToCool.beg
beg
Definition: WriteBchToCool.py:69
AthenaOutputStreamTool::m_metaDataOutputCollection
StringProperty m_metaDataOutputCollection
Definition: AthenaOutputStreamTool.h:92
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
AthenaOutputStreamTool::m_metaDataOutputAttributes
std::string m_metaDataOutputAttributes
Definition: AthenaOutputStreamTool.h:96
lumiFormat.outputName
string outputName
Definition: lumiFormat.py:65
AthenaOutputStreamTool::m_outputAttributes
std::string m_outputAttributes
Definition: AthenaOutputStreamTool.h:95
AthenaAttributeList.h
An AttributeList represents a logical row of attributes in a metadata table. The name and type of eac...
python.LumiBlobConversion.pos
pos
Definition: LumiBlobConversion.py:18
AthenaOutputStreamTool::initialize
StatusCode initialize()
AthAlgTool Interface method implementations:
Definition: AthenaOutputStreamTool.cxx:62
AthenaOutputStreamTool::m_attrListKey
SG::ReadHandleKey< AthenaAttributeList > m_attrListKey
Definition: AthenaOutputStreamTool.h:97
TokenAddress.h
This file contains the class definition for the TokenAddress class.
SG::WriteHandle
Definition: StoreGate/StoreGate/WriteHandle.h:76
AthenaOutputStreamTool::m_extendProvenanceRecord
bool m_extendProvenanceRecord
Flag as to whether to extend provenance via the DataHeader.
Definition: AthenaOutputStreamTool.h:113
AthenaOutputStreamTool::connectOutput
StatusCode connectOutput(const std::string &outputName="")
Connect to the output stream Must connectOutput BEFORE streaming Only specify "outputName" if one wan...
Definition: AthenaOutputStreamTool.cxx:172
AthenaOutputStreamTool::m_store
ServiceHandle< StoreGateSvc > m_store
Definition: AthenaOutputStreamTool.h:101
SG::IFolder::add
virtual StatusCode add(const std::string &typeName, const std::string &skey)=0
add a data object identifier to the list
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
AthenaOutputStreamTool::m_connectionOpen
bool m_connectionOpen
Flag to tell whether connectOutput has been called.
Definition: AthenaOutputStreamTool.h:111
DeMoScan.first
bool first
Definition: DeMoScan.py:536
AthenaOutputStreamTool.h
This is the implementation of IAthenaOutputStreamTool.
ReadCalibFromCool.typeName
typeName
Definition: ReadCalibFromCool.py:477
AthCnvSvc::disconnectOutput
virtual StatusCode disconnectOutput(const std::string &output)
Disconnect output files from the service.
Definition: AthCnvSvc.cxx:408
merge.status
status
Definition: merge.py:17
StoreID::EVENT_STORE
@ EVENT_STORE
Definition: StoreID.h:26
AthenaOutputStreamTool::m_clidSvc
ServiceHandle< IClassIDSvc > m_clidSvc
Ref to ClassIDSvc to convert type name to clid.
Definition: AthenaOutputStreamTool.h:105
AthenaOutputStreamTool::m_decSvc
ServiceHandle< IDecisionSvc > m_decSvc
Ref to DecisionSvc.
Definition: AthenaOutputStreamTool.h:107
SG::DataProxy
Definition: DataProxy.h:45
LArParamsProperties::keyword
std::string keyword(const std::string &classname)
Definition: LArParamsProperties.cxx:160
StoreGateSvc.h
SG::ConstIterator
Definition: SGIterator.h:164
AthCnvSvc
Definition: AthCnvSvc.h:66
AthenaOutputStreamTool::m_attrListWrite
std::string m_attrListWrite
Definition: AthenaOutputStreamTool.h:99
AthenaOutputStreamTool::commitOutput
StatusCode commitOutput(bool doCommit=false)
Commit the output stream after having streamed out objects Must commitOutput AFTER streaming.
Definition: AthenaOutputStreamTool.cxx:335
AthenaOutputStreamTool::~AthenaOutputStreamTool
virtual ~AthenaOutputStreamTool()
Destructor.
Definition: AthenaOutputStreamTool.cxx:59
ServiceHandle< StoreGateSvc >
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37
DataProxy.h
AthenaOutputStreamTool::m_outputName
StringProperty m_outputName
Definition: AthenaOutputStreamTool.h:86