OutputStream.cpp
Go to the documentation of this file.
1 // Framework include files
2 #include "GaudiKernel/IRegistry.h"
3 #include "GaudiKernel/IAlgManager.h"
4 #include "GaudiKernel/ISvcLocator.h"
5 #include "GaudiKernel/IConversionSvc.h"
6 #include "GaudiKernel/IDataManagerSvc.h"
7 #include "GaudiKernel/IDataProviderSvc.h"
8 #include "GaudiKernel/IPersistencySvc.h"
9 #include "GaudiKernel/IOpaqueAddress.h"
10 #include "GaudiKernel/Incident.h"
11 #include "GaudiKernel/IIncidentSvc.h"
12 
13 #include "GaudiKernel/MsgStream.h"
14 #include "GaudiKernel/strcasecmp.h"
15 #include "GaudiKernel/DataObject.h"
16 #include "GaudiKernel/DataStoreItem.h"
17 #include "GaudiKernel/AttribStringParser.h"
18 
19 #include "OutputStream.h"
20 #include "OutputStreamAgent.h"
21 
22 #include <set>
23 
24 // Define the algorithm factory for the standard output data writer
26 
27 #define ON_DEBUG if (log.level() <= MSG::DEBUG)
28 
29 // Standard Constructor
30 OutputStream::OutputStream(const std::string& name, ISvcLocator* pSvcLocator)
31 : Algorithm(name, pSvcLocator),
32  m_agent { new OutputStreamAgent(this) }
33 {
34  m_doPreLoad = true;
35  m_doPreLoadOpt = false;
36  m_verifyItems = true;
37  m_outputType = "UPDATE";
38  m_storeName = "EventDataSvc";
39  m_persName = "EventPersistencySvc";
42  m_fireIncidents = true;
43  declareProperty("ItemList", m_itemNames);
44  declareProperty("OptItemList", m_optItemNames);
45  declareProperty("AlgDependentItemList", m_algDependentItemList);
46  declareProperty("Preload", m_doPreLoad);
47  declareProperty("PreloadOptItems", m_doPreLoadOpt);
48  declareProperty("Output", m_output);
49  declareProperty("OutputFile", m_outputName);
50  declareProperty("EvtDataSvc", m_storeName);
51  declareProperty("EvtConversionSvc", m_persName);
52  declareProperty("AcceptAlgs", m_acceptNames);
53  declareProperty("RequireAlgs", m_requireNames);
54  declareProperty("VetoAlgs", m_vetoNames);
55  declareProperty("VerifyItems", m_verifyItems);
58 
59  // Associate action handlers with the AcceptAlgs, RequireAlgs and VetoAlgs.
60  m_acceptNames.declareUpdateHandler ( &OutputStream::acceptAlgsHandler , this );
61  m_requireNames.declareUpdateHandler( &OutputStream::requireAlgsHandler, this );
62  m_vetoNames.declareUpdateHandler ( &OutputStream::vetoAlgsHandler , this );
63 
64  //setProperty( "OutputLevel", 2 );
65 
66 }
67 
68 
69 // initialize data writer
71  MsgStream log(msgSvc(), name());
72 
73  // Reset the number of events written
74  m_events = 0;
75  // Get access to the DataManagerSvc
77  if( !m_pDataManager ) {
78  log << MSG::FATAL << "Unable to locate IDataManagerSvc interface" << endmsg;
79  return StatusCode::FAILURE;
80  }
81  // Get access to the IncidentService
82  m_incidentSvc = serviceLocator()->service("IncidentSvc");
83  if( !m_incidentSvc ) {
84  log << MSG::WARNING << "Error retrieving IncidentSvc." << endmsg;
85  return StatusCode::FAILURE;
86  }
87  // Get access to the assigned data service
89  if( !m_pDataProvider ) {
90  log << MSG::FATAL << "Unable to locate IDataProviderSvc interface of " << m_storeName << endmsg;
91  return StatusCode::FAILURE;
92  }
93  if ( hasInput() ) {
95  if( !status.isSuccess() ) {
96  log << MSG::FATAL << "Unable to connect to conversion service." << endmsg;
98  IncidentType::FailOutputFile));
99  return status;
100  }
101  }
102 
103  // Clear the list with optional items
105  // Clear the item list
107 
108  // Take the new item list from the properties.
109  ON_DEBUG log << MSG::DEBUG << "ItemList : " << m_itemNames << endmsg;
110  for( const auto& i : m_itemNames ) addItem( m_itemList, i );
111 
112  // Take the new item list from the properties.
113  ON_DEBUG log << MSG::DEBUG << "OptItemList : " << m_optItemNames << endmsg;
114  for( const auto& i : m_optItemNames ) addItem( m_optItemList, i );
115 
116  // prepare the algorithm selected dependent locations
117  ON_DEBUG log << MSG::DEBUG << "AlgDependentItemList : " << m_algDependentItemList << endmsg;
118  for ( const auto& a : m_algDependentItemList )
119  {
120  // Get the algorithm pointer
121  Algorithm * theAlgorithm = decodeAlgorithm( a.first );
122  if ( theAlgorithm )
123  {
124  // Get the item list for this alg
125  auto& items = m_algDependentItems[theAlgorithm];
126  // Clear the list for this alg
127  clearItems( items );
128  // fill the list again
129  for ( const auto& i : a.second ) addItem( items, i );
130  }
131  }
132 
133  // Take the item list to the data service preload list.
134  if ( m_doPreLoad ) {
135  for(auto& j : m_itemList) m_pDataProvider->addPreLoadItem( *j ).ignore();
136  // Not working: bad reference counting! pdataSvc->release();
137  }
138 
139  if ( m_doPreLoadOpt ) {
140  for(auto& j : m_optItemList) m_pDataProvider->addPreLoadItem( *j ).ignore();
141  }
142  log << MSG::INFO << "Data source: " << m_storeName << " output: " << m_output << endmsg;
143 
144  // Decode the accept, required and veto Algorithms. The logic is the following:
145  // a. The event is accepted if all lists are empty.
146  // b. The event is provisionally accepted if any Algorithm in the accept list
147  // has been executed and has indicated that its filter is passed. This
148  // provisional acceptance can be overridden by the other lists.
149  // c. The event is rejected unless all Algorithms in the required list have
150  // been executed and have indicated that their filter passed.
151  // d. The event is rejected if any Algorithm in the veto list has been
152  // executed and has indicated that its filter has passed.
155  decodeVetoAlgs ().ignore();
156  return StatusCode::SUCCESS;
157 }
158 
159 // terminate data writer
161  MsgStream log(msgSvc(), name());
162  log << MSG::INFO << "Events output: " << m_events << endmsg;
164  IncidentType::EndOutputFile));
171  return StatusCode::SUCCESS;
172 }
173 
174 // Work entry point
176 {
177  // Clear any previously existing item list
178  clearSelection();
179  // Test whether this event should be output
180  if ( isEventAccepted() )
181  {
182  const StatusCode sc = writeObjects();
183  clearSelection();
184  ++m_events;
185  if ( sc.isSuccess() && m_fireIncidents )
186  {
188  IncidentType::WroteToOutputFile));
189  }
190  else if ( m_fireIncidents )
191  {
193  IncidentType::FailOutputFile));
194  }
195  return sc;
196  }
197  return StatusCode::SUCCESS;
198 }
199 
200 // Select the different objects and write them to file
202 {
203  // Connect the output file to the service
204  StatusCode status = collectObjects();
205  if ( status.isSuccess() )
206  {
208  if ( sel->begin() != sel->end() )
209  {
211  if ( status.isSuccess() )
212  {
213  // Now pass the collection to the persistency service
214  IOpaqueAddress* pAddress = nullptr;
215  for ( auto& j : *sel )
216  {
217  try
218  {
219  const StatusCode iret = m_pConversionSvc->createRep( j, pAddress );
220  if ( !iret.isSuccess() )
221  {
222  status = iret;
223  continue;
224  }
225  IRegistry* pReg = j->registry();
226  pReg->setAddress(pAddress);
227  }
228  catch ( const std::exception & excpt )
229  {
230  MsgStream log( msgSvc(), name() );
231  const std::string loc = ( j->registry() ?
232  j->registry()->identifier() : "UnRegistered" );
233  log << MSG::FATAL
234  << "std::exception during createRep for '" << loc << "' "
235  << System::typeinfoName( typeid(*j) )
236  << endmsg;
237  log << MSG::FATAL << excpt.what() << endmsg;
238  throw;
239  }
240  }
241  for ( auto& j : *sel )
242  {
243  try
244  {
245  IRegistry* pReg = j->registry();
246  const StatusCode iret = m_pConversionSvc->fillRepRefs( pReg->address(), j );
247  if ( !iret.isSuccess() ) status = iret;
248  }
249  catch ( const std::exception & excpt )
250  {
251  MsgStream log( msgSvc(), name() );
252  const std::string loc = ( j->registry() ?
253  j->registry()->identifier() : "UnRegistered" );
254  log << MSG::FATAL
255  << "std::exception during fillRepRefs for '" << loc << "'"
256  << System::typeinfoName( typeid(*j) )
257  << endmsg;
258  log << MSG::FATAL << excpt.what() << endmsg;
259  throw;
260  }
261  }
262  // Commit the data if there was no error; otherwise possibly discard
263  if ( status.isSuccess() )
264  {
265  status = m_pConversionSvc->commitOutput(m_outputName, true);
266  }
267  else
268  {
270  }
271  }
272  }
273  }
274  return status;
275 }
276 
277 // Place holder to create configurable data store agent
279  if ( level < m_currentItem->depth() ) {
280  if ( dir->object() ) {
281  /*
282  std::cout << "Analysing ("
283  << dir->name()
284  << ") Object:"
285  << ((dir->object()==0) ? "UNLOADED" : "LOADED")
286  << std::endl;
287  */
288  m_objects.push_back(dir->object());
289  return true;
290  }
291  }
292  return false;
293 }
294 
297  MsgStream log(msgSvc(), name());
299 
300  // Traverse the tree and collect the requested objects
301  for ( auto& i : m_itemList) {
302  DataObject* obj = nullptr;
303  m_currentItem = i;
305  if ( iret.isSuccess() ) {
306  iret = m_pDataManager->traverseSubTree(obj, m_agent.get());
307  if ( !iret.isSuccess() ) status = iret;
308  }
309  else {
310  log << MSG::ERROR << "Cannot write mandatory object(s) (Not found) "
311  << m_currentItem->path() << endmsg;
312  status = iret;
313  }
314  }
315 
316  // Traverse the tree and collect the requested objects (tolerate missing items here)
317  for ( auto& i : m_optItemList ) {
318  DataObject* obj = nullptr;
319  m_currentItem = i;
321  if ( iret.isSuccess() ) {
322  iret = m_pDataManager->traverseSubTree(obj, m_agent.get());
323  }
324  if ( !iret.isSuccess() ) {
325  ON_DEBUG
326  log << MSG::DEBUG << "Ignore request to write non-mandatory object(s) "
327  << m_currentItem->path() << endmsg;
328  }
329  }
330 
331  // Collect objects dependent on particular algorithms
332  for ( const auto& iAlgItems : m_algDependentItems )
333  {
334  Algorithm * alg = iAlgItems.first;
335  const Items& items = iAlgItems.second;
336  if ( alg->isExecuted() && alg->filterPassed() )
337  {
338  ON_DEBUG
339  log << MSG::DEBUG << "Algorithm '" << alg->name() << "' fired. Adding " << items << endmsg;
340  for ( const auto& i : items )
341  {
342  DataObject* obj = nullptr;
343  m_currentItem = i;
345  if ( iret.isSuccess() )
346  {
347  iret = m_pDataManager->traverseSubTree(obj,m_agent.get());
348  if ( !iret.isSuccess() ) status = iret;
349  }
350  else
351  {
352  log << MSG::ERROR << "Cannot write mandatory (algorithm dependent) object(s) (Not found) "
353  << m_currentItem->path() << endmsg;
354  status = iret;
355  }
356  }
357  }
358  }
359 
360  if (status.isSuccess())
361  {
362  // Remove duplicates from the list of objects, preserving the order in the list
363  std::set<DataObject*> unique;
364  std::vector<DataObject*> tmp; // temporary vector with the reduced list
365  tmp.reserve(m_objects.size());
366  for (auto& o : m_objects ) {
367  if (!unique.count(o)) {
368  // if the pointer is not in the set, add it to both the set and the temporary vector
369  unique.insert(o);
370  tmp.push_back(o);
371  }
372  }
373  m_objects.swap(tmp); // swap the data of the two vectors
374  }
375 
376  return status;
377 }
378 
379 // Clear collected object list
381  m_objects.clear();
382 }
383 
384 // Remove all items from the output streamer list;
386  for ( auto& i : itms ) delete i;
387  itms.clear();
388 }
389 
390 // Find single item identified by its path (exact match)
392 OutputStream::findItem(const std::string& path) {
393  auto matchPath = [&](const DataStoreItem* i) { return i->path() == path; } ;
394  auto i = std::find_if( m_itemList.begin(), m_itemList.end(), matchPath );
395  if (i == m_itemList.end()) {
396  i = std::find_if( m_optItemList.begin(), m_optItemList.end(), matchPath );
397  if (i == m_optItemList.end()) return nullptr;
398  }
399  return *i;
400 }
401 
402 // Add item to output streamer list
403 void OutputStream::addItem(Items& itms, const std::string& descriptor) {
404  MsgStream log(msgSvc(), name());
405  int level = 0;
406  auto sep = descriptor.rfind("#");
407  std::string obj_path = descriptor.substr(0,sep);
408  if ( sep != std::string::npos ) {
409  std::string slevel = descriptor.substr(sep+1);
410  level = ( slevel == "*" ) ? 9999999 : std::stoi(slevel);
411  }
412  if ( m_verifyItems ) {
413  size_t idx = obj_path.find("/",1);
414  while(idx != std::string::npos) {
415  std::string sub_item = obj_path.substr(0,idx);
416  if ( !findItem(sub_item) ) addItem(itms, sub_item+"#1");
417  idx = obj_path.find("/",idx+1);
418  }
419  }
420  itms.push_back( new DataStoreItem(obj_path, level) );
421  const auto& item = itms.back();
422  ON_DEBUG
423  log << MSG::DEBUG << "Adding OutputStream item " << item->path()
424  << " with " << item->depth()
425  << " level(s)." << endmsg;
426 }
427 
428 // Connect to proper conversion service
430  StatusCode status = StatusCode(StatusCode::FAILURE, true);
431  MsgStream log(msgSvc(), name());
432  // Get output file from input
433  std::string dbType, svc, shr;
434  for(auto attrib: Gaudi::Utils::AttribStringParser(m_output)) {
435  const std::string& tag = attrib.tag;
436  const std::string& val = attrib.value;
437  switch( ::toupper(tag[0]) ) {
438  case 'D':
439  m_outputName = val;
440  break;
441  case 'T':
442  dbType = val;
443  break;
444  case 'S':
445  switch( ::toupper(tag[1]) ) {
446  case 'V': svc = val; break;
447  case 'H': shr = "YES"; break;
448  }
449  break;
450  case 'O': // OPT='<NEW<CREATE,WRITE,RECREATE>, UPDATE>'
451  switch( ::toupper(val[0]) ) {
452  case 'R':
453  if ( ::strncasecmp(val.c_str(),"RECREATE",3)==0 )
454  m_outputType = "RECREATE";
455  else if ( ::strncasecmp(val.c_str(),"READ",3)==0 )
456  m_outputType = "READ";
457  break;
458  case 'C':
459  case 'N':
460  case 'W':
461  m_outputType = "NEW";
462  break;
463  case 'U':
464  m_outputType = "UPDATE";
465  break;
466  default:
467  m_outputType = "???";
468  break;
469  }
470  break;
471  default:
472  break;
473  }
474  }
475  if ( !shr.empty() ) m_outputType += "|SHARED";
476  // Get access to the default Persistency service
477  // The default service is the same for input as for output.
478  // If this is not desired, then a specialized OutputStream must overwrite
479  // this value.
480  if ( !dbType.empty() || !svc.empty() ) {
481  std::string typ = !dbType.empty() ? dbType : svc;
483  if( !ipers ) {
484  log << MSG::FATAL << "Unable to locate IPersistencySvc interface of " << m_persName << endmsg;
485  return StatusCode::FAILURE;
486  }
487  IConversionSvc *cnvSvc = nullptr;
488  status = ipers->getService(typ, cnvSvc);
489  if( !status.isSuccess() ) {
490  log << MSG::FATAL << "Unable to locate IConversionSvc interface of database type " << typ << endmsg;
491  return status;
492  }
493  // Increase reference count and keep service.
494  m_pConversionSvc = cnvSvc;
495  }
496  else
497  {
498  log << MSG::FATAL
499  << "Unable to locate IConversionSvc interface (Unknown technology) " << endmsg
500  << "You either have to specify a technology name or a service name!" << endmsg
501  << "Please correct the job option \"" << name() << ".Output\" !" << endmsg;
502  return StatusCode::FAILURE;
503  }
504  return StatusCode::SUCCESS;
505 }
506 
508  MsgStream log(msgSvc(), name());
509  ON_DEBUG
510  log << MSG::DEBUG << "AcceptAlgs : " << m_acceptNames.value() << endmsg;
512 }
513 
516  if (sc.isFailure()) {
517  throw GaudiException("Failure in OutputStream::decodeAlgorithms",
518  "OutputStream::acceptAlgsHandler",sc);
519  }
520 }
521 
523  MsgStream log(msgSvc(), name());
524  ON_DEBUG
525  log << MSG::DEBUG << "RequireAlgs : " << m_requireNames.value() << endmsg;
527 }
528 
531  if (sc.isFailure()) {
532  throw GaudiException("Failure in OutputStream::decodeAlgorithms",
533  "OutputStream::requireAlgsHandler",sc);
534  }
535 }
536 
538  MsgStream log(msgSvc(), name());
539  ON_DEBUG
540  log << MSG::DEBUG << "VetoAlgs : " << m_vetoNames.value() << endmsg;
542 }
543 
544 void OutputStream::vetoAlgsHandler( Property& /* theProp */ ) {
546  if (sc.isFailure()) {
547  throw GaudiException("Failure in OutputStream::decodeAlgorithms",
548  "OutputStream::vetoAlgsHandler",sc);
549  }
550 }
551 
552 Algorithm* OutputStream::decodeAlgorithm( const std::string& theName )
553 {
554  Algorithm * theAlgorithm = nullptr;
555 
556  auto theAlgMgr = serviceLocator()->as<IAlgManager>();
557  if ( theAlgMgr )
558  {
559  // Check whether the supplied name corresponds to an existing
560  // Algorithm object.
561  SmartIF<IAlgorithm> &theIAlg = theAlgMgr->algorithm(theName);
562  if ( theIAlg )
563  {
564  try
565  {
566  theAlgorithm = dynamic_cast<Algorithm*>(theIAlg.get());
567  }
568  catch(...)
569  {
570  // do nothing
571  }
572  }
573  }
574  else
575  {
576  MsgStream log( msgSvc( ), name( ) );
577  log << MSG::FATAL << "Can't locate ApplicationMgr!!!" << endmsg;
578  }
579 
580  if ( !theAlgorithm )
581  {
582  MsgStream log( msgSvc( ), name( ) );
583  log << MSG::WARNING
584  << "Failed to decode Algorithm name " << theName << endmsg;
585  }
586 
587  return theAlgorithm;
588 }
589 
591  std::vector<Algorithm*>& theAlgs )
592 {
593  // Reset the list of Algorithms
594  theAlgs.clear( );
595 
597 
598  // Build the list of Algorithms from the names list
599  for ( const auto& it : theNames.value() )
600  {
601 
602  Algorithm * theAlgorithm = decodeAlgorithm( it );
603  if ( theAlgorithm )
604  {
605  // Check that the specified algorithm doesn't already exist in the list
606  if ( std::find( std::begin(theAlgs), std::end(theAlgs), theAlgorithm ) == std::end(theAlgs) ) {
607  theAlgorithm->addRef();
608  theAlgs.push_back( theAlgorithm );
609  }
610  }
611  else
612  {
613  MsgStream log( msgSvc( ), name( ) );
614  log << MSG::INFO << it << " doesn't exist - ignored" << endmsg;
615  }
616 
617  }
618  result = StatusCode::SUCCESS;
619 
620  return result;
621 }
622 
624  auto passed = [](const Algorithm* alg) { return alg->isExecuted()
625  && alg->filterPassed(); };
626 
627  // Loop over all Algorithms in the accept list to see
628  // whether any have been executed and have their filter
629  // passed flag set. Any match causes the event to be
630  // provisionally accepted.
631  bool result = m_acceptAlgs.empty() ||
632  std::any_of( std::begin(m_acceptAlgs), std::end(m_acceptAlgs), passed);
633 
634  // Loop over all Algorithms in the required list to see
635  // whether all have been executed and have their filter
636  // passed flag set. Any mismatch causes the event to be
637  // rejected.
638  if ( result && !m_requireAlgs.empty() ) {
639  result = std::all_of( std::begin(m_requireAlgs), std::end(m_requireAlgs), passed);
640  }
641 
642  // Loop over all Algorithms in the veto list to see
643  // whether any have been executed and have their filter
644  // passed flag set. Any match causes the event to be
645  // rejected.
646  if ( result && !m_vetoAlgs.empty() ) {
647  result = std::none_of( std::begin(m_vetoAlgs), std::end(m_vetoAlgs), passed);
648  }
649  return result;
650 }
651 
653  return !(m_itemNames.empty() && m_optItemNames.empty() &&
654  m_algDependentItemList.empty());
655 }
StringArrayProperty m_acceptNames
Vector of names of Algorithms that this stream accepts.
Definition: OutputStream.h:82
bool isEventAccepted() const
Test whether this event should be output.
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
void clearItems(Items &itms)
Clear item list.
virtual bool hasInput() const
Tell if the instance has been configured with input items or not.
Define general base for Gaudi exception.
StatusCode decodeRequireAlgs()
Decode list of Algorithms that this stream requires.
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
Definition: ISvcLocator.h:25
IDataSelector m_objects
Collection of objects being selected.
Definition: OutputStream.h:78
StatusCode finalize() override
Terminate OutputStream.
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
std::string m_storeName
Name of the service managing the data store.
Definition: OutputStream.h:45
SmartIF< ISvcLocator > & serviceLocator() const
The standard service locator.
Definition: Algorithm.cpp:1045
int m_events
Number of events written to this output stream.
Definition: OutputStream.h:80
virtual StatusCode addPreLoadItem(const DataStoreItem &item)=0
Add an item to the preload list.
std::string m_outputType
Output type: NEW(NEW,CREATE,WRITE,RECREATE), UPDATE)
Definition: OutputStream.h:53
DataStoreItem * m_currentItem
Keep track of the current item.
Definition: OutputStream.h:63
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:76
auto begin(reverse_wrapper< T > &w)
Definition: reverse.h:45
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
Definition: System.cpp:297
list path
Definition: __init__.py:15
StringArrayProperty m_vetoNames
Vector of names of Algorithms that this stream is vetoed by.
Definition: OutputStream.h:86
The IAlgManager is the interface implemented by the Algorithm Factory in the Application Manager to s...
Definition: IAlgManager.h:27
std::string m_outputName
Name of the output file.
Definition: OutputStream.h:51
bool filterPassed() const override
Did this algorithm pass or fail its filter criterion for the last event?
Definition: Algorithm.cpp:948
void requireAlgsHandler(Property &theProp)
Handler for RequireAlgs Property.
std::string m_persName
Name of the persistency service capable to write data from the store.
Definition: OutputStream.h:47
virtual StatusCode createRep(DataObject *pObject, IOpaqueAddress *&refpAddress)=0
Convert the transient object to the requested representation.
std::vector< Algorithm * > m_requireAlgs
Vector of Algorithms that this stream requires.
Definition: OutputStream.h:90
IDataSelector * selectedObjects()
Return the list of selected objects.
Definition: OutputStream.h:152
SmartIF< IFace > as()
Definition: ISvcLocator.h:106
SmartIF< IDataProviderSvc > m_pDataProvider
Keep reference to the data provider service.
Definition: OutputStream.h:57
AlgDependentItemNames m_algDependentItemList
Mapping between algorithm names, and a list of items for which, if the algorithm in question accepted...
Definition: OutputStream.h:74
Description of the DataStoreItem class.
Definition: DataStoreItem.h:17
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:86
std::vector< DataObject * > IDataSelector
This is only a placeholder to allow me compiling until the responsible guy does his work! M...
Definition: IDataSelector.h:8
std::unique_ptr< OutputStreamAgent > m_agent
Keep reference of agent.
Definition: OutputStream.h:55
const std::string & path() const
Accessor: Retrieve load path.
Definition: DataStoreItem.h:65
A small to stream Data I/O.
Definition: OutputStream.h:29
std::vector< Algorithm * > m_acceptAlgs
Vector of Algorithms that this stream accepts.
Definition: OutputStream.h:88
const std::string & name() const override
The identifying name of the algorithm object.
Definition: Algorithm.cpp:919
virtual bool collect(IRegistry *dir, int level)
Store agent's classback.
TYPE * get() const
Get interface pointer.
Definition: SmartIF.h:76
DataStoreItem * findItem(const std::string &path)
Find single item identified by its path (exact match)
StatusCode service(const Gaudi::Utils::TypeNameString &name, T *&svc, bool createIf=true)
Templated method to access a service by name.
Definition: ISvcLocator.h:78
virtual StatusCode writeObjects()
Select the different objects and write them to file.
SmartIF< IConversionSvc > m_pConversionSvc
Keep reference to the data conversion service.
Definition: OutputStream.h:61
virtual StatusCode connectOutput(const std::string &outputFile)=0
Connect the output file to the service.
StatusCode initialize() override
Initialize OutputStream.
virtual void fireIncident(const Incident &incident)=0
Fire an Incident.
virtual StatusCode connectConversionSvc()
AlgDependentItems m_algDependentItems
Items to be saved for specific algorithms.
Definition: OutputStream.h:76
virtual StatusCode commitOutput(const std::string &outputFile, bool do_commit)=0
Commit pending output.
bool m_verifyItems
Flag to indicate that item consistency should be checked.
Definition: OutputStream.h:43
std::vector< DataStoreItem * > Items
Definition: OutputStream.h:31
unsigned long addRef() override
Reference Interface instance.
Definition: implements.h:44
auto end(reverse_wrapper< T > &w)
Definition: reverse.h:47
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
#define DECLARE_COMPONENT(type)
Definition: PluginService.h:36
bool isExecuted() const override
Has this algorithm been executed since the last reset?
Definition: Algorithm.cpp:931
Items m_itemList
Vector of items to be saved to this stream.
Definition: OutputStream.h:67
bool m_doPreLoad
Flag indicating whether data pre-loading should be performed.
Definition: OutputStream.h:39
void addItem(Items &itms, const std::string &descriptor)
Add item to output streamer list.
bool m_doPreLoadOpt
Flag indicating whether optional items should be preloaded.
Definition: OutputStream.h:41
The IRegistry represents the entry door to the environment any data object residing in a transient da...
Definition: IRegistry.h:22
SmartIF< IDataManagerSvc > m_pDataManager
Keep reference to the data manager service.
Definition: OutputStream.h:59
void clearSelection()
Clear list of selected objects.
SmartIF< IIncidentSvc > m_incidentSvc
Reference to the incident service.
Definition: OutputStream.h:37
virtual IOpaqueAddress * address() const =0
Retrieve opaque storage address.
const TYPE & value() const
explicit conversion
Definition: Property.h:341
virtual DataObject * object() const =0
Retrieve object behind the link.
StatusCode decodeVetoAlgs()
Decode list of Algorithms that this stream is vetoed by.
StatusCode execute() override
Working entry point.
Base class from which all concrete algorithm classes should be derived.
Definition: Algorithm.h:77
ItemNames m_itemNames
Vector of item names.
Definition: OutputStream.h:65
Property base class allowing Property* collections to be "homogeneous".
Definition: Property.h:38
ItemNames m_optItemNames
Vector of item names.
Definition: OutputStream.h:69
StatusCode decodeAlgorithms(StringArrayProperty &theNames, std::vector< Algorithm * > &theAlgs)
Decode specified list of Algorithms.
virtual void setAddress(IOpaqueAddress *pAddress)=0
Set/Update Opaque storage address.
Base class for all Incidents (computing events).
Definition: Incident.h:16
void acceptAlgsHandler(Property &theProp)
Handler for AcceptAlgs Property.
StringArrayProperty m_requireNames
Vector of names of Algorithms that this stream requires.
Definition: OutputStream.h:84
tuple item
print s1,s2
Definition: ana.py:146
#define ON_DEBUG
Algorithm * decodeAlgorithm(const std::string &theName)
Decode a single algorithm name.
OutputStream(const std::string &name, ISvcLocator *pSvcLocator)
Standard algorithm Constructor.
Data persistency service interface.
void reset(TYPE *ptr=nullptr)
Set the internal pointer to the passed one disposing of the old one.
Definition: SmartIF.h:88
Opaque address interface definition.
void ignore() const
Definition: StatusCode.h:108
std::string m_output
Name of the output file specification.
Definition: OutputStream.h:49
list itms
Definition: ana.py:135
std::vector< Algorithm * > m_vetoAlgs
Vector of Algorithms that this stream is vetoed by.
Definition: OutputStream.h:92
virtual StatusCode traverseSubTree(const std::string &sub_path, IDataStoreAgent *pAgent)=0
Analyse by traversing all data objects below the sub tree identified by its full path name...
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:30
list i
Definition: ana.py:128
virtual StatusCode collectObjects()
Collect all objects to be written to the output stream.
virtual StatusCode fillRepRefs(IOpaqueAddress *pAddress, DataObject *pObject)=0
Resolve the references of the converted object.
SmartIF< IMessageSvc > & msgSvc() const
The standard message service.
Definition: Algorithm.cpp:1001
void toupper(std::string &s)
void vetoAlgsHandler(Property &theProp)
Handler for VetoAlgs Property.
StatusCode decodeAcceptAlgs()
Decode list of Algorithms that this stream accepts.
bool m_fireIncidents
should I fire incidents for writing opening/closing etc?
Definition: OutputStream.h:125
Items m_optItemList
Vector of optional items to be saved to this stream.
Definition: OutputStream.h:71
virtual StatusCode retrieveObject(IRegistry *pDirectory, const std::string &path, DataObject *&pObject)=0
Retrieve object identified by its directory entry.