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 {
33  m_doPreLoad = true;
34  m_doPreLoadOpt = false;
35  m_verifyItems = true;
36  m_output = "";
37  m_outputName = "";
38  m_outputType = "UPDATE";
39  m_storeName = "EventDataSvc";
40  m_persName = "EventPersistencySvc";
41  m_agent = new OutputStreamAgent(this);
42  m_acceptAlgs = new std::vector<Algorithm*>();
43  m_requireAlgs = new std::vector<Algorithm*>();
44  m_vetoAlgs = new std::vector<Algorithm*>();
47  m_fireIncidents = true;
48  declareProperty("ItemList", m_itemNames);
49  declareProperty("OptItemList", m_optItemNames);
50  declareProperty("AlgDependentItemList", m_algDependentItemList);
51  declareProperty("Preload", m_doPreLoad);
52  declareProperty("PreloadOptItems", m_doPreLoadOpt);
53  declareProperty("Output", m_output);
54  declareProperty("OutputFile", m_outputName);
55  declareProperty("EvtDataSvc", m_storeName);
56  declareProperty("EvtConversionSvc", m_persName);
57  declareProperty("AcceptAlgs", m_acceptNames);
58  declareProperty("RequireAlgs", m_requireNames);
59  declareProperty("VetoAlgs", m_vetoNames);
60  declareProperty("VerifyItems", m_verifyItems);
63 
64  // Associate action handlers with the AcceptAlgs, RequireAlgs and VetoAlgs.
68 
69  //setProperty( "OutputLevel", 2 );
70 
71 }
72 
73 // Standard Destructor
75  delete m_agent;
76  delete m_acceptAlgs;
77  delete m_requireAlgs;
78  delete m_vetoAlgs;
79 }
80 
81 // initialize data writer
83  MsgStream log(msgSvc(), name());
84 
85  // Reset the number of events written
86  m_events = 0;
87  // Get access to the DataManagerSvc
89  if( !m_pDataManager.isValid() ) {
90  log << MSG::FATAL << "Unable to locate IDataManagerSvc interface" << endmsg;
91  return StatusCode::FAILURE;
92  }
93  // Get access to the IncidentService
94  m_incidentSvc = serviceLocator()->service("IncidentSvc");
95  if( !m_incidentSvc.isValid() ) {
96  log << MSG::WARNING << "Error retrieving IncidentSvc." << endmsg;
97  return StatusCode::FAILURE;
98  }
99  // Get access to the assigned data service
101  if( !m_pDataProvider.isValid() ) {
102  log << MSG::FATAL << "Unable to locate IDataProviderSvc interface of " << m_storeName << endmsg;
103  return StatusCode::FAILURE;
104  }
105  if ( hasInput() ) {
106  StatusCode status = connectConversionSvc();
107  if( !status.isSuccess() ) {
108  log << MSG::FATAL << "Unable to connect to conversion service." << endmsg;
111  return status;
112  }
113  }
114 
115  // Clear the list with optional items
117  // Clear the item list
119 
120  // Take the new item list from the properties.
121  ON_DEBUG log << MSG::DEBUG << "ItemList : " << m_itemNames << endmsg;
122  for( ItemNames::const_iterator i = m_itemNames.begin();
123  i != m_itemNames.end(); ++i )
124  {
125  addItem( m_itemList, *i );
126  }
127 
128  // Take the new item list from the properties.
129  ON_DEBUG log << MSG::DEBUG << "OptItemList : " << m_optItemNames << endmsg;
130  for( ItemNames::const_iterator i = m_optItemNames.begin();
131  i != m_optItemNames.end(); ++i )
132  {
133  addItem( m_optItemList, *i );
134  }
135 
136  // prepare the algorithm selected dependent locations
137  ON_DEBUG log << MSG::DEBUG << "AlgDependentItemList : " << m_algDependentItemList << endmsg;
138  for ( AlgDependentItemNames::const_iterator a = m_algDependentItemList.begin();
139  a != m_algDependentItemList.end(); ++a )
140  {
141  // Get the algorithm pointer
142  Algorithm * theAlgorithm = decodeAlgorithm( a->first );
143  if ( theAlgorithm )
144  {
145  // Get the item list for this alg
146  Items& items = m_algDependentItems[theAlgorithm];
147  // Clear the list for this alg
148  clearItems( items );
149  // fill the list again
150  for ( ItemNames::const_iterator i = a->second.begin();
151  i != a->second.end(); ++i )
152  {
153  addItem( items, *i );
154  }
155  }
156  }
157 
158  // Take the item list to the data service preload list.
159  if ( m_doPreLoad ) {
160  for(Items::iterator j = m_itemList.begin(); j != m_itemList.end(); j++) {
162  }
163  // Not working: bad reference counting! pdataSvc->release();
164  }
165 
166  if ( m_doPreLoadOpt ) {
167  for(Items::iterator j=m_optItemList.begin(); j!=m_optItemList.end(); j++) {
169  }
170  }
171  log << MSG::INFO << "Data source: " << m_storeName << " output: " << m_output << endmsg;
172 
173  // Decode the accept, required and veto Algorithms. The logic is the following:
174  // a. The event is accepted if all lists are empty.
175  // b. The event is provisionally accepted if any Algorithm in the accept list
176  // has been executed and has indicated that its filter is passed. This
177  // provisional acceptance can be overridden by the other lists.
178  // c. The event is rejected unless all Algorithms in the required list have
179  // been executed and have indicated that their filter passed.
180  // d. The event is rejected if any Algorithm in the veto list has been
181  // executed and has indicated that its filter has passed.
184  decodeVetoAlgs ().ignore();
185  return StatusCode::SUCCESS;
186 }
187 
188 // terminate data writer
190  MsgStream log(msgSvc(), name());
191  log << MSG::INFO << "Events output: " << m_events << endmsg;
200  return StatusCode::SUCCESS;
201 }
202 
203 // Work entry point
205 {
206  // Clear any previously existing item list
207  clearSelection();
208  // Test whether this event should be output
209  if ( isEventAccepted() )
210  {
211  const StatusCode sc = writeObjects();
212  clearSelection();
213  ++m_events;
214  if ( sc.isSuccess() && m_fireIncidents )
215  {
218  }
219  else if ( m_fireIncidents )
220  {
223  }
224  return sc;
225  }
226  return StatusCode::SUCCESS;
227 }
228 
229 // Select the different objects and write them to file
231 {
232  // Connect the output file to the service
233  StatusCode status = collectObjects();
234  if ( status.isSuccess() )
235  {
237  if ( sel->begin() != sel->end() )
238  {
240  if ( status.isSuccess() )
241  {
242  // Now pass the collection to the persistency service
243  IOpaqueAddress* pAddress = NULL;
244  for ( IDataSelector::iterator j = sel->begin(); j != sel->end(); ++j )
245  {
246  try
247  {
248  const StatusCode iret = m_pConversionSvc->createRep( *j, pAddress );
249  if ( !iret.isSuccess() )
250  {
251  status = iret;
252  continue;
253  }
254  IRegistry* pReg = (*j)->registry();
255  pReg->setAddress(pAddress);
256  }
257  catch ( const std::exception & excpt )
258  {
259  MsgStream log( msgSvc(), name() );
260  const std::string loc = ( (*j)->registry() ?
261  (*j)->registry()->identifier() : "UnRegistered" );
262  log << MSG::FATAL
263  << "std::exception during createRep for '" << loc << "' "
264  << System::typeinfoName( typeid(**j) )
265  << endmsg;
266  log << MSG::FATAL << excpt.what() << endmsg;
267  throw;
268  }
269  }
270  for ( IDataSelector::iterator j = sel->begin(); j != sel->end(); ++j )
271  {
272  try
273  {
274  IRegistry* pReg = (*j)->registry();
275  const StatusCode iret = m_pConversionSvc->fillRepRefs( pReg->address(), *j );
276  if ( !iret.isSuccess() )
277  {
278  status = iret;
279  }
280  }
281  catch ( const std::exception & excpt )
282  {
283  MsgStream log( msgSvc(), name() );
284  const std::string loc = ( (*j)->registry() ?
285  (*j)->registry()->identifier() : "UnRegistered" );
286  log << MSG::FATAL
287  << "std::exception during fillRepRefs for '" << loc << "'"
288  << System::typeinfoName( typeid(**j) )
289  << endmsg;
290  log << MSG::FATAL << excpt.what() << endmsg;
291  throw;
292  }
293  }
294  // Commit the data if there was no error; otherwise possibly discard
295  if ( status.isSuccess() )
296  {
297  status = m_pConversionSvc->commitOutput(m_outputName, true);
298  }
299  else
300  {
302  }
303  }
304  }
305  }
306  return status;
307 }
308 
309 // Place holder to create configurable data store agent
311  if ( level < m_currentItem->depth() ) {
312  if ( dir->object() != 0 ) {
313  /*
314  std::cout << "Analysing ("
315  << dir->name()
316  << ") Object:"
317  << ((dir->object()==0) ? "UNLOADED" : "LOADED")
318  << std::endl;
319  */
320  m_objects.push_back(dir->object());
321  return true;
322  }
323  }
324  return false;
325 }
326 
329  MsgStream log(msgSvc(), name());
331 
332  // Traverse the tree and collect the requested objects
333  for ( Items::iterator i = m_itemList.begin(); i != m_itemList.end(); i++ ) {
334  DataObject* obj = 0;
335  m_currentItem = (*i);
337  if ( iret.isSuccess() ) {
338  iret = m_pDataManager->traverseSubTree(obj, m_agent);
339  if ( !iret.isSuccess() ) {
340  status = iret;
341  }
342  }
343  else {
344  log << MSG::ERROR << "Cannot write mandatory object(s) (Not found) "
345  << m_currentItem->path() << endmsg;
346  status = iret;
347  }
348  }
349 
350  // Traverse the tree and collect the requested objects (tolerate missing items here)
351  for ( Items::iterator i = m_optItemList.begin(); i != m_optItemList.end(); i++ ) {
352  DataObject* obj = 0;
353  m_currentItem = (*i);
355  if ( iret.isSuccess() ) {
356  iret = m_pDataManager->traverseSubTree(obj, m_agent);
357  }
358  if ( !iret.isSuccess() ) {
359  ON_DEBUG
360  log << MSG::DEBUG << "Ignore request to write non-mandatory object(s) "
361  << m_currentItem->path() << endmsg;
362  }
363  }
364 
365  // Collect objects dependent on particular algorithms
366  for ( AlgDependentItems::const_iterator iAlgItems = m_algDependentItems.begin();
367  iAlgItems != m_algDependentItems.end(); ++iAlgItems )
368  {
369  Algorithm * alg = iAlgItems->first;
370  const Items& items = iAlgItems->second;
371  if ( alg->isExecuted() && alg->filterPassed() )
372  {
373  ON_DEBUG
374  log << MSG::DEBUG << "Algorithm '" << alg->name() << "' fired. Adding " << items << endmsg;
375  for ( Items::const_iterator i = items.begin(); i != items.end(); ++i )
376  {
377  DataObject* obj = NULL;
378  m_currentItem = (*i);
380  if ( iret.isSuccess() )
381  {
383  if ( !iret.isSuccess() ) { status = iret; }
384  }
385  else
386  {
387  log << MSG::ERROR << "Cannot write mandatory (algorithm dependent) object(s) (Not found) "
388  << m_currentItem->path() << endmsg;
389  status = iret;
390  }
391  }
392  }
393  }
394 
395  if (status.isSuccess())
396  {
397  // Remove duplicates from the list of objects, preserving the order in the list
398  std::set<DataObject*> unique;
399  std::vector<DataObject*> tmp; // temporary vector with the reduced list
400  tmp.reserve(m_objects.size());
401  for (std::vector<DataObject*>::iterator o = m_objects.begin(); o != m_objects.end(); ++o) {
402  if (!unique.count(*o)) {
403  // if the pointer is not in the set, add it to both the set and the temporary vector
404  unique.insert(*o);
405  tmp.push_back(*o);
406  }
407  }
408  m_objects.swap(tmp); // swap the data of the two vectors
409  }
410 
411  return status;
412 }
413 
414 // Clear collected object list
416  m_objects.erase(m_objects.begin(), m_objects.end());
417 }
418 
419 // Remove all items from the output streamer list;
421  for ( Items::iterator i = itms.begin(); i != itms.end(); i++ ) {
422  delete (*i);
423  }
424  itms.erase(itms.begin(), itms.end());
425 }
426 
427 // Find single item identified by its path (exact match)
429 OutputStream::findItem(const std::string& path) {
430  for(Items::const_iterator i=m_itemList.begin(); i != m_itemList.end(); ++i) {
431  if ( (*i)->path() == path ) return (*i);
432  }
433  for(Items::const_iterator j=m_optItemList.begin(); j != m_optItemList.end(); ++j) {
434  if ( (*j)->path() == path ) return (*j);
435  }
436  return 0;
437 }
438 
439 // Add item to output streamer list
440 void OutputStream::addItem(Items& itms, const std::string& descriptor) {
441  MsgStream log(msgSvc(), name());
442  int level = 0;
443  size_t sep = descriptor.rfind("#");
444  std::string obj_path (descriptor,0,sep);
445  std::string slevel (descriptor,sep+1,descriptor.length());
446  if ( slevel == "*" ) {
447  level = 9999999;
448  }
449  else {
450  level = atoi(slevel.c_str());
451  }
452  if ( m_verifyItems ) {
453  size_t idx = obj_path.find("/",1);
454  while(idx != std::string::npos) {
455  std::string sub_item = obj_path.substr(0,idx);
456  if ( 0 == findItem(sub_item) ) {
457  addItem(itms, sub_item+"#1");
458  }
459  idx = obj_path.find("/",idx+1);
460  }
461  }
462  DataStoreItem* item = new DataStoreItem(obj_path, level);
463  ON_DEBUG
464  log << MSG::DEBUG << "Adding OutputStream item " << item->path()
465  << " with " << item->depth()
466  << " level(s)." << endmsg;
467  itms.push_back( item );
468 }
469 
470 // Connect to proper conversion service
472  StatusCode status = StatusCode(StatusCode::FAILURE, true);
473  MsgStream log(msgSvc(), name());
474  // Get output file from input
475  std::string dbType, svc, shr;
476  for(auto attrib: Gaudi::Utils::AttribStringParser(m_output)) {
477  const std::string& tag = attrib.tag;
478  const std::string& val = attrib.value;
479  switch( ::toupper(tag[0]) ) {
480  case 'D':
481  m_outputName = val;
482  break;
483  case 'T':
484  dbType = val;
485  break;
486  case 'S':
487  switch( ::toupper(tag[1]) ) {
488  case 'V': svc = val; break;
489  case 'H': shr = "YES"; break;
490  }
491  break;
492  case 'O': // OPT='<NEW<CREATE,WRITE,RECREATE>, UPDATE>'
493  switch( ::toupper(val[0]) ) {
494  case 'R':
495  if ( ::strncasecmp(val.c_str(),"RECREATE",3)==0 )
496  m_outputType = "RECREATE";
497  else if ( ::strncasecmp(val.c_str(),"READ",3)==0 )
498  m_outputType = "READ";
499  break;
500  case 'C':
501  case 'N':
502  case 'W':
503  m_outputType = "NEW";
504  break;
505  case 'U':
506  m_outputType = "UPDATE";
507  break;
508  default:
509  m_outputType = "???";
510  break;
511  }
512  break;
513  default:
514  break;
515  }
516  }
517  if ( !shr.empty() ) m_outputType += "|SHARED";
518  // Get access to the default Persistency service
519  // The default service is the same for input as for output.
520  // If this is not desired, then a specialized OutputStream must overwrite
521  // this value.
522  if ( dbType.length() > 0 || svc.length() > 0 ) {
523  std::string typ = dbType.length()>0 ? dbType : svc;
525  if( !ipers.isValid() ) {
526  log << MSG::FATAL << "Unable to locate IPersistencySvc interface of " << m_persName << endmsg;
527  return StatusCode::FAILURE;
528  }
529  IConversionSvc *cnvSvc = 0;
530  status = ipers->getService(typ, cnvSvc);
531  if( !status.isSuccess() ) {
532  log << MSG::FATAL << "Unable to locate IConversionSvc interface of database type " << typ << endmsg;
533  return status;
534  }
535  // Increase reference count and keep service.
536  m_pConversionSvc = cnvSvc;
537  }
538  else
539  {
540  log << MSG::FATAL
541  << "Unable to locate IConversionSvc interface (Unknown technology) " << endmsg
542  << "You either have to specify a technology name or a service name!" << endmsg
543  << "Please correct the job option \"" << name() << ".Output\" !" << endmsg;
544  return StatusCode::FAILURE;
545  }
546  return StatusCode::SUCCESS;
547 }
548 
550  MsgStream log(msgSvc(), name());
551  ON_DEBUG
552  log << MSG::DEBUG << "AcceptAlgs : " << m_acceptNames.value() << endmsg;
554 }
555 
558  if (sc.isFailure()) {
559  throw GaudiException("Failure in OutputStream::decodeAlgorithms",
560  "OutputStream::acceptAlgsHandler",sc);
561  }
562 }
563 
565  MsgStream log(msgSvc(), name());
566  ON_DEBUG
567  log << MSG::DEBUG << "RequireAlgs : " << m_requireNames.value() << endmsg;
569 }
570 
573  if (sc.isFailure()) {
574  throw GaudiException("Failure in OutputStream::decodeAlgorithms",
575  "OutputStream::requireAlgsHandler",sc);
576  }
577 }
578 
580  MsgStream log(msgSvc(), name());
581  ON_DEBUG
582  log << MSG::DEBUG << "VetoAlgs : " << m_vetoNames.value() << endmsg;
584 }
585 
586 void OutputStream::vetoAlgsHandler( Property& /* theProp */ ) {
588  if (sc.isFailure()) {
589  throw GaudiException("Failure in OutputStream::decodeAlgorithms",
590  "OutputStream::vetoAlgsHandler",sc);
591  }
592 }
593 
594 Algorithm* OutputStream::decodeAlgorithm( const std::string& theName )
595 {
596  Algorithm * theAlgorithm = NULL;
597 
599  if ( theAlgMgr.isValid() )
600  {
601  // Check whether the supplied name corresponds to an existing
602  // Algorithm object.
603  SmartIF<IAlgorithm> &theIAlg = theAlgMgr->algorithm(theName);
604  if ( theIAlg.isValid() )
605  {
606  try
607  {
608  theAlgorithm = dynamic_cast<Algorithm*>(theIAlg.get());
609  }
610  catch(...)
611  {
612  // do nothing
613  }
614  }
615  }
616  else
617  {
618  MsgStream log( msgSvc( ), name( ) );
619  log << MSG::FATAL << "Can't locate ApplicationMgr!!!" << endmsg;
620  }
621 
622  if ( !theAlgorithm )
623  {
624  MsgStream log( msgSvc( ), name( ) );
625  log << MSG::WARNING
626  << "Failed to decode Algorithm name " << theName << endmsg;
627  }
628 
629  return theAlgorithm;
630 }
631 
633  std::vector<Algorithm*>* theAlgs )
634 {
635  // Reset the list of Algorithms
636  theAlgs->clear( );
637 
639 
640  // Build the list of Algorithms from the names list
641  const std::vector<std::string> nameList = theNames.value( );
642  for ( std::vector<std::string>::const_iterator it = nameList.begin();
643  it != nameList.end(); ++it )
644  {
645 
646  Algorithm * theAlgorithm = decodeAlgorithm( *it );
647  if ( theAlgorithm )
648  {
649  // Check that the specified algorithm doesn't already exist in the list
650  for ( std::vector<Algorithm*>::iterator ita = theAlgs->begin();
651  ita != theAlgs->end(); ++ita )
652  {
653  Algorithm * existAlgorithm = (*ita);
654  if ( theAlgorithm == existAlgorithm )
655  {
656  result = StatusCode::FAILURE;
657  break;
658  }
659  }
660  if ( result.isSuccess( ) )
661  {
662  theAlgorithm->addRef();
663  theAlgs->push_back( theAlgorithm );
664  }
665  }
666  else
667  {
668  MsgStream log( msgSvc( ), name( ) );
669  log << MSG::INFO << *it << " doesn't exist - ignored" << endmsg;
670  }
671 
672  }
673  result = StatusCode::SUCCESS;
674 
675  return result;
676 }
677 
679  typedef std::vector<Algorithm*>::iterator AlgIter;
680  bool result = true;
681 
682  // Loop over all Algorithms in the accept list to see
683  // whether any have been executed and have their filter
684  // passed flag set. Any match causes the event to be
685  // provisionally accepted.
686  if ( ! m_acceptAlgs->empty() ) {
687  result = false;
688  for(AlgIter i=m_acceptAlgs->begin(),end=m_acceptAlgs->end(); i != end; ++i) {
689  if ( (*i)->isExecuted() && (*i)->filterPassed() ) {
690  result = true;
691  break;
692  }
693  }
694  }
695 
696  // Loop over all Algorithms in the required list to see
697  // whether all have been executed and have their filter
698  // passed flag set. Any mismatch causes the event to be
699  // rejected.
700  if ( result && ! m_requireAlgs->empty() ) {
701  for(AlgIter i=m_requireAlgs->begin(),end=m_requireAlgs->end(); i != end; ++i) {
702  if ( !(*i)->isExecuted() || !(*i)->filterPassed() ) {
703  result = false;
704  break;
705  }
706  }
707  }
708 
709  // Loop over all Algorithms in the veto list to see
710  // whether any have been executed and have their filter
711  // passed flag set. Any match causes the event to be
712  // rejected.
713  if ( result && ! m_vetoAlgs->empty() ) {
714  for(AlgIter i=m_vetoAlgs->begin(),end=m_vetoAlgs->end(); i != end; ++i) {
715  if ( (*i)->isExecuted() && (*i)->filterPassed() ) {
716  result = false;
717  break;
718  }
719  }
720  }
721  return result;
722 }
723 
725  return !(m_itemNames.empty() && m_optItemNames.empty() &&
726  m_algDependentItemList.empty());
727 }
StringArrayProperty m_acceptNames
Vector of names of Algorithms that this stream accepts.
Definition: OutputStream.h:80
StatusCode decodeAlgorithms(StringArrayProperty &theNames, std::vector< Algorithm * > *theAlgs)
Decode specified list of Algorithms.
bool isEventAccepted() const
Test whether this event should be output.
virtual SmartIF< IAlgorithm > & algorithm(const Gaudi::Utils::TypeNameString &typeName, const bool createIf=true)=0
Returns a smart pointer to a service.
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.
Small smart pointer class with automatic reference counting for IInterface.
Definition: IConverter.h:14
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:26
IDataSelector m_objects
Collection of objects being selected.
Definition: OutputStream.h:76
int depth() const
Accessor: Retrieve load depth.
Definition: DataStoreItem.h:70
std::string m_storeName
Name of the service managing the data store.
Definition: OutputStream.h:43
SmartIF< ISvcLocator > & serviceLocator() const
The standard service locator.
Definition: Algorithm.cpp:1091
int m_events
Number of events written to this output stream.
Definition: OutputStream.h:78
virtual StatusCode addPreLoadItem(const DataStoreItem &item)=0
Add an item to the preload list.
virtual bool filterPassed() const
Did this algorithm pass or fail its filter criterion for the last event?
Definition: Algorithm.cpp:862
std::string m_outputType
Output type: NEW(NEW,CREATE,WRITE,RECREATE), UPDATE)
Definition: OutputStream.h:51
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
DataStoreItem * m_currentItem
Keep track of the current item.
Definition: OutputStream.h:61
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:75
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
Definition: System.cpp:299
list path
Definition: __init__.py:15
StringArrayProperty m_vetoNames
Vector of names of Algorithms that this stream is vetoed by.
Definition: OutputStream.h:84
virtual bool isExecuted() const
Has this algorithm been executed since the last reset?
Definition: Algorithm.cpp:845
Property * declareProperty(const std::string &name, T &property, const std::string &doc="none") const
Declare the named property.
Definition: Algorithm.h:402
std::string m_outputName
Name of the output file.
Definition: OutputStream.h:49
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:45
virtual StatusCode createRep(DataObject *pObject, IOpaqueAddress *&refpAddress)=0
Convert the transient object to the requested representation.
IDataSelector * selectedObjects()
Return the list of selected objects.
Definition: OutputStream.h:148
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
virtual StatusCode execute()
Working entry point.
SmartIF< IDataProviderSvc > m_pDataProvider
Keep reference to the data provider service.
Definition: OutputStream.h:55
virtual StatusCode getService(long service_type, IConversionSvc *&refpSvc)=0
Retrieve conversion service identified by technology.
AlgDependentItemNames m_algDependentItemList
Mapping between algorithm names, and a list of items for which, if the algorithm in question accepted...
Definition: OutputStream.h:72
Description of the DataStoreItem class.
Definition: DataStoreItem.h:18
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:85
const std::string & path() const
Accessor: Retrieve load path.
Definition: DataStoreItem.h:66
A small to stream Data I/O.
Definition: OutputStream.h:27
virtual bool collect(IRegistry *dir, int level)
Store agent's classback.
TYPE * get() const
Get interface pointer.
Definition: SmartIF.h:62
DataStoreItem * findItem(const std::string &path)
Find single item identified by its path (exact match)
virtual void declareUpdateHandler(PropertyCallbackFunctor *pf)
set new callback for update
Definition: Property.cpp:141
StatusCode service(const Gaudi::Utils::TypeNameString &name, T *&svc, bool createIf=true)
Templated method to access a service by name.
Definition: ISvcLocator.h:82
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:59
virtual StatusCode connectOutput(const std::string &outputFile)=0
Connect the output file to the service.
const std::string EndOutputFile
an output file has been finished
Definition: Incident.h:75
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:74
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:41
std::vector< DataStoreItem * > Items
Definition: OutputStream.h:29
#define DECLARE_COMPONENT(type)
Definition: PluginService.h:36
OutputStreamAgent * m_agent
Keep reference of agent.
Definition: OutputStream.h:53
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
virtual StatusCode finalize()
Terminate OutputStream.
Items m_itemList
Vector of items to be saved to this stream.
Definition: OutputStream.h:65
bool m_doPreLoad
Flag indicating whether data pre-loading should be performed.
Definition: OutputStream.h:37
virtual const std::string & name() const
The identifying name of the algorithm object.
Definition: Algorithm.cpp:837
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:39
std::vector< Algorithm * > * m_requireAlgs
Vector of Algorithms that this stream requires.
Definition: OutputStream.h:88
SmartIF< IMessageSvc > & msgSvc() const
The standard message service.
Definition: Algorithm.cpp:896
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:57
std::vector< Algorithm * > * m_acceptAlgs
Vector of Algorithms that this stream accepts.
Definition: OutputStream.h:86
void clearSelection()
Clear list of selected objects.
SmartIF< IIncidentSvc > m_incidentSvc
Reference to the incident service.
Definition: OutputStream.h:35
virtual IOpaqueAddress * address() const =0
Retrieve opaque storage address.
const TYPE & value() const
explicit conversion
Definition: Property.h:355
virtual DataObject * object() const =0
Retrieve object behind the link.
StatusCode decodeVetoAlgs()
Decode list of Algorithms that this stream is vetoed by.
void reset(TYPE *ptr=0)
Set the internal pointer to the passed one disposing of the old one.
Definition: SmartIF.h:74
tuple end
Definition: IOTest.py:101
virtual ~OutputStream()
Standard Destructor.
Base class from which all concrete algorithm classes should be derived.
Definition: Algorithm.h:61
ItemNames m_itemNames
Vector of item names.
Definition: OutputStream.h:63
Property base class allowing Property* collections to be "homogeneous".
Definition: Property.h:43
ItemNames m_optItemNames
Vector of item names.
Definition: OutputStream.h:67
bool isValid() const
Allow for check if smart pointer is valid.
Definition: SmartIF.h:51
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:82
tuple item
print s1,s2
Definition: ana.py:146
#define ON_DEBUG
Algorithm * decodeAlgorithm(const std::string &theName)
Decode a single algorithm name.
virtual unsigned long addRef()=0
Increment the reference count of Interface instance.
OutputStream(const std::string &name, ISvcLocator *pSvcLocator)
Standard algorithm Constructor.
const std::string WroteToOutputFile
the output file was written to in this event
Definition: Incident.h:74
const std::string FailOutputFile
could not create or write to this file
Definition: Incident.h:73
StatusCode service(const std::string &name, T *&psvc, bool createIf=true) const
Access a service by name, creating it if it doesn't already exist.
Definition: Algorithm.h:210
Opaque address interface definition.
void ignore() const
Definition: StatusCode.h:107
std::string m_output
Name of the output file specification.
Definition: OutputStream.h:47
list itms
Definition: ana.py:135
std::vector< Algorithm * > * m_vetoAlgs
Vector of Algorithms that this stream is vetoed by.
Definition: OutputStream.h:90
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:31
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.
virtual StatusCode initialize()
Initialize OutputStream.
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:123
Items m_optItemList
Vector of optional items to be saved to this stream.
Definition: OutputStream.h:69
virtual StatusCode retrieveObject(IRegistry *pDirectory, const std::string &path, DataObject *&pObject)=0
Retrieve object identified by its directory entry.