Gaudi Framework, version v24r2

Home   Generated: Wed Dec 4 2013
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
EvtCollectionStream.cpp
Go to the documentation of this file.
1 // ====================================================================
2 // EvtCollectionStream.cpp
3 // --------------------------------------------------------------------
4 //
5 // Package : GaudiSvc/PersistencySvc
6 //
7 // Author : Markus Frank
8 //
9 // ====================================================================
10 #define GAUDISVC_PERSISTENCYSVC_EVTCOLLECTIONSTREAM_CPP
11 
12 // Framework include files
13 #include "GaudiKernel/AlgFactory.h"
14 #include "GaudiKernel/MsgStream.h"
15 #include "GaudiKernel/INTupleSvc.h"
17 
19 #include "EvtCollectionStream.h"
20 
21 // Define the algorithm factory for the standard output data writer
23 
24 // Standard Constructor
25 EvtCollectionStream::EvtCollectionStream(const std::string& name, ISvcLocator* pSvcLocator)
26 : Algorithm(name, pSvcLocator)
27 {
28  m_storeName = "TagCollectionSvc";
29  declareProperty("ItemList", m_itemNames);
30  declareProperty("EvtDataSvc", m_storeName);
31 }
32 
33 // Standard Destructor
35 }
36 
37 // initialize data writer
39  MsgStream log(msgSvc(), name());
40  // Use the Job options service to set the Algorithm's parameters
41  setProperties();
42  // Get access to the DataManagerSvc
44  if( !m_pTupleSvc.isValid() ) {
45  log << MSG::FATAL << "Unable to locate IDataManagerSvc interface" << endmsg;
46  return StatusCode::FAILURE;
47  }
48  // Clear the item list
49  clearItems();
50  // Take the new item list from the properties.
52  addItem( *i );
53  }
54  log << MSG::INFO << "Data source: " << m_storeName << endmsg;
55  return StatusCode::SUCCESS;
56 }
57 
58 // terminate data writer
60  m_pTupleSvc = 0; // release
61  clearItems();
62  return StatusCode::SUCCESS;
63 }
64 
65 // Work entry point
68  if ( status.isSuccess() ) {
69  for ( Items::iterator i = m_itemList.begin(); i != m_itemList.end(); i++ ) {
70  StatusCode iret = m_pTupleSvc->writeRecord((*i)->path());
71  if ( !iret.isSuccess() ) {
72  status = iret;
73  }
74  }
75  }
76  return status;
77 }
78 
79 // Remove all items from the output streamer list;
81  for ( Items::iterator i = m_itemList.begin(); i != m_itemList.end(); i++ ) {
82  delete (*i);
83  }
85 }
86 
87 // Add item to output streamer list
88 void EvtCollectionStream::addItem(const std::string& descriptor) {
89  MsgStream log(msgSvc(), name());
90  int sep = descriptor.rfind("#");
91  int level = 0;
92  std::string obj_path (descriptor,0,sep);
93  std::string slevel (descriptor,sep+1,descriptor.length());
94  if ( slevel == "*" ) {
95  level = 9999999;
96  }
97  else {
98  level = ::atoi(slevel.c_str());
99  }
100  DataStoreItem* item = new DataStoreItem(obj_path, level);
101  log << MSG::INFO << "Adding OutputStream item " << item->path()
102  << " with " << item->depth()
103  << " level(s)." << endmsg;
104  m_itemList.push_back( item );
105 }

Generated at Wed Dec 4 2013 14:33:07 for Gaudi Framework, version v24r2 by Doxygen version 1.8.2 written by Dimitri van Heesch, © 1997-2004