NTupleSvc.cpp
Go to the documentation of this file.
1 //====================================================================
2 // NTupleSvc.cpp
3 //--------------------------------------------------------------------
4 //
5 // Package : GaudiSvc/NTupleSvc ( The LHCb Offline System)
6 //
7 // Description: implementation of the NTuple service
8 //
9 // Author : M.Frank
10 // History :
11 // +---------+----------------------------------------------+---------
12 // | Date | Comment | Who
13 // +---------+----------------------------------------------+---------
14 // | 29/10/98| Initial version | MF
15 // | 29/09/99| Added access to ICnvManager for missing |
16 // | | converters | MF
17 // | 20/09/00| Connect dynamically to conversion service |
18 // | | for N-tuple persistency | MF
19 // +---------+----------------------------------------------+---------
20 //
21 //====================================================================
22 #define GAUDISVC_NTUPLESVC_CPP
23 
24 // Framework include files
25 #include "GaudiKernel/SmartIF.h"
26 #include "GaudiKernel/AttribStringParser.h"
27 #include "GaudiKernel/DataObject.h"
28 #include "GaudiKernel/ObjectFactory.h"
29 #include "GaudiKernel/GenericAddress.h"
30 
31 #include "GaudiKernel/IProperty.h"
32 #include "GaudiKernel/ISvcLocator.h"
33 #include "GaudiKernel/IDataSelector.h"
34 
35 #include "GaudiKernel/Property.h"
36 #include "GaudiKernel/Selector.h"
37 #include "GaudiKernel/MsgStream.h"
38 #include "GaudiKernel/ConversionSvc.h"
39 #include "GaudiKernel/DataSelectionAgent.h"
40 #include "GaudiKernel/NTupleImplementation.h"
41 
42 #include "NTupleSvc.h"
43 
44 // Instantiation of a static factory class used by clients to create
45 // instances of this service
47 
50 
51 #include <sstream>
52 
53 namespace {
54  inline std::string toStr(long id) {
55  std::ostringstream s; s << id;
56  return s.str();
57  }
58 }
59 
61 NTupleSvc::NTupleSvc(const std::string& name, ISvcLocator* svc)
62  : base_class(name, svc)
63 {
64  declareProperty("Input", m_input);
65  declareProperty("Output", m_output);
66  m_rootName = "/NTUPLES";
67  m_rootCLID = CLID_DataObject;
68 }
69 
72 }
73 
77  if ( status.isSuccess() ) {
78  status = setProperties();
79  if ( status.isSuccess() ) {
82  status = setRoot(m_rootName, root);
83  for ( DBaseEntries::iterator i = m_output.begin(); i != m_output.end(); ++i ) {
84  iret = connect(*i);
85  if ( !iret.isSuccess() ) {
86  status = iret;
87  }
88  }
89  for ( DBaseEntries::iterator j = m_input.begin(); j != m_input.end(); ++j ) {
90  iret = connect(*j);
91  if ( !iret.isSuccess() ) {
92  status = iret;
93  }
94  }
95  }
96  }
97  return status;
98 }
99 
102  return StatusCode::SUCCESS;
103 }
104 
105 // Check if a datasource is connected
106 bool NTupleSvc::isConnected(const std::string& identifier) const {
107  auto i = m_connections.find(identifier);
108  return i!=m_connections.end();
109 }
110 
113  if ( !pRegistry ) return nullptr;
114  std::string full = pRegistry->identifier();
115  auto len = m_rootName.length();
116  auto idx = full.find(SEPARATOR,len+1);
117  std::string path = (idx==std::string::npos) ? full : full.substr(0, idx);
118  auto i = m_connections.find(path);
119  return ( i != m_connections.end() ) ? i->second.service
120  : nullptr;
121 }
122 
124  typedef std::vector<IRegistry*> Leaves;
125  long need_update = 0;
126  DataObject* pO = nullptr;
127  StatusCode iret = findObject(m_rootName, pO);
128  MsgStream log ( msgSvc(), name() );
129  // log << MSG::DEBUG << "in finalize()" << endmsg;
130  if ( iret.isSuccess() ) {
131  Leaves leaves;
132  iret = objectLeaves(pO, leaves);
133  if ( iret.isSuccess() ) {
134  // Only traverse the tree below the files
135  for ( auto d = leaves.begin(); d != leaves.end(); d++ ) {
136  if ( !(*d)->object() ) continue;
137  IOpaqueAddress* pA = (*d)->address();
138  if ( !pA ) continue;
139  unsigned long typ = pA->ipar()[1];
140  if ( typ != 'R' && typ != 'N' && typ != 'U' ) continue;
141  // ...starting from the file entries: first save the directories/ntuples
142  IConversionSvc* svc = getDataLoader(*d);
143  if ( !svc ) continue;
144 
145  StatusCode status;
146  DataSelectionAgent agent;
147  IDataSelector* sel = agent.selectedObjects();
148  traverseSubTree ( (*d)->object(), &agent ).ignore();
149  for(int i = sel->size()-1; i >= 0; i-- ) {
150  DataObject* o = (*sel)[i];
151  IRegistry* r = o->registry();
152  status = svc->updateRep(r->address(), o);
153  if ( !status.isSuccess() ) {
154  iret = status;
155  }
156  }
157  for(int j = sel->size()-1; j >= 0; j-- ) {
158  DataObject* o = (*sel)[j];
159  IRegistry* r = o->registry();
160  status = svc->updateRepRefs(r->address(), o);
161  if ( !status.isSuccess() ) iret = status;
162  }
163  if ( iret.isSuccess() ) need_update += sel->size();
164  }
165  }
166  }
167  if ( !iret.isSuccess() ) {
168  log << MSG::ERROR << "ERROR while saving NTuples" << endmsg;
169  return iret;
170  }
171  else if ( need_update > 0 ) {
172  log << MSG::INFO << "NTuples saved successfully" << endmsg;
173  }
174  return iret;
175 }
176 
177 // Finalize single service
179  SmartIF<IService> isvc( c.service );
180  if ( isvc ) isvc->finalize().ignore();
181  c.service->release();
182  c.service = nullptr;
183 }
184 
185 // Close all open connections
186 StatusCode NTupleSvc::disconnect(const std::string& nam) {
187  auto i = m_connections.find(nam);
188  if ( i != m_connections.end() ) {
189  releaseConnection(i->second);
190  m_connections.erase(i);
191  return StatusCode::SUCCESS;
192  }
193  return StatusCode::FAILURE;
194 }
195 
196 // Close all open connections
198  for(auto &i : m_connections ) releaseConnection(i.second);
199  m_connections.clear();
200  return StatusCode::SUCCESS;
201 }
202 
205  StatusCode status = updateDirectories();
206  status = clearStore();
207  status = DataSvc::finalize();
208  status = disconnectAll();
209  return status;
210 }
211 
212 StatusCode NTupleSvc::connect(const std::string& ident) {
213  std::string logName;
214  return connect(ident, logName);
215 }
216 
217 StatusCode NTupleSvc::connect(const std::string& ident, std::string& logname) {
218  MsgStream log ( msgSvc(), name() );
219  DataObject* pO = nullptr;
220  StatusCode status = findObject(m_rootName, pO);
221  if ( status.isSuccess() ) {
222  char typ=0;
223  std::vector<Prop> props;
224  long loc = ident.find(" ");
225  std::string filename, auth, svc = "", db_typ = "";
226  logname = ident.substr(0, loc);
227  using Parser = Gaudi::Utils::AttribStringParser;
228  // we assume that there is always a " "
229  // (but if it is not there, we probably will not match the pattern)
230  for (auto attrib: Parser(ident.substr(loc + 1))) {
231  switch( ::toupper(attrib.tag[0]) ) {
232  case 'A':
233  break;
234  case 'F': // FILE='<file name>'
235  case 'D': // DATAFILE='<file name>'
236  filename = std::move(attrib.value);
237  break;
238  case 'O': // OPT='<NEW<CREATE,WRITE>, UPDATE, READ>'
239  switch( ::toupper(attrib.value[0]) ) {
240  case 'C':
241  case 'N':
242  case 'W':
243  typ = 'N';
244  break;
245  case 'U':
246  typ = 'U';
247  break;
248  case 'O':
249  case 'R':
250  typ = 'O';
251  break;
252  default:
253  typ = 0;
254  break;
255  }
256  break;
257  case 'T': // TYP='<HBOOK,ROOT,OBJY,...>'
258  db_typ = std::move(attrib.value);
259  break;
260  default:
261  props.emplace_back( attrib.tag, attrib.value);
262  break;
263  }
264  }
265  if ( 0 != typ ) {
266  IConversionSvc* pSvc = nullptr;
267  status = createService(name()+'.'+logname, db_typ, props, pSvc);
268  if ( status.isSuccess() ) {
269  status = attachTuple(filename, logname, typ, pSvc->repSvcType());
270  if ( status.isSuccess() ) {
271  m_connections.insert(Connections::value_type(m_rootName+'/'+logname,Connection(pSvc)));
272  return StatusCode::SUCCESS;
273  }
274  }
275  }
276  }
277  log << MSG::ERROR << "Cannot add " << ident << " invalid filename!" << endmsg;
278  return StatusCode::FAILURE;
279 }
280 
281 StatusCode NTupleSvc::createService(const std::string& /* nam */,
282  const std::string& typ,
283  const std::vector<Prop>& /* props */,
284  IConversionSvc*& pSvc)
285 {
286  MsgStream log ( msgSvc(), name() );
288  // Get the value of the Stat persistancy mechanism from the AppMgr
289  auto appPropMgr = serviceLocator()->as<IProperty>();
290  if( !appPropMgr ) {
291  // Report an error and return the FAILURE status code
292  log << MSG::ERROR << "Could not get PropMgr" << endmsg;
293  return StatusCode::FAILURE;
294  }
295 
296  StringProperty sp("HistogramPersistency","");
297  StatusCode sts = appPropMgr->getProperty( &sp );
298  if ( !sts.isSuccess() ) {
299  log << MSG::ERROR << "Could not get NTuple Persistency format"
300  << " from ApplicationMgr properties" << endmsg;
301  return sts;
302  }
303 
304  long storage_typ = TEST_StorageType;
305  if ( sp.value() == "HBOOK" ) {
306  storage_typ = HBOOK_StorageType;
307  }
308  else if ( sp.value() == "ROOT" ) {
309  storage_typ = ROOT_StorageType;
310  }
311  else {
312  log << MSG::ERROR << "Unknown NTuple Persistency format: " << sp.value() << endmsg;
313  return StatusCode::FAILURE;
314  }
315 
316  if ( !typ.empty() && typ != sp.value() ) {
317  log << MSG::WARNING << "NTuple persistency type is "
318  << sp.value() << "." << endmsg
319  << "Type given by job option "
320  << "NTupleSvc.Input/Output ignored!" << endmsg;
321  }
322 
323  // log << MSG::DEBUG << "storage type: " << m_storageType << endmsg;
324 
325  // FIXME: (MCl) why NTupleSvc has to directly create a ConversionSvc?
326  IInterface* iface = new ConversionSvc(name()+"Conversions", serviceLocator(), storage_typ);
327  auto pService = SmartIF<IService>( iface );
328  if ( !pService ) return StatusCode::FAILURE;
329 
330  auto cnvSvc = pService.as<IConversionSvc>();
331  if (!cnvSvc) return StatusCode::FAILURE;
332 
333  pSvc = cnvSvc.get();
334  pSvc->addRef(); // make sure the caller gets a pSvc which points at something
335  // with a refCount of (at least) one...
336  auto status = pService->sysInitialize();
337  if ( !status.isSuccess() ) return status;
338  return pSvc->setDataProvider(this);
339 }
340 
342 StatusCode NTupleSvc::create(const CLID& typ, const std::string& title, NTuple::Tuple*& refpTuple) {
343  NTuple::TupleImp* pTuple = nullptr;
345  if ( typ == CLID_ColumnWiseTuple ) {
346  pTuple = new NTuple::ColumnWiseTuple( title );
347  }
348  else if ( typ == CLID_RowWiseTuple ) {
349  pTuple = new NTuple::RowWiseTuple( title );
350  }
351  else {
353  }
354  if ( pTuple ) {
355  pTuple->setTupleService(this);
356  status = StatusCode::SUCCESS;
357  }
358  refpTuple = pTuple;
359  return status;
360 }
361 
363 NTuple::Tuple* NTupleSvc::book (const std::string& fullPath, const CLID& type, const std::string& title) {
364  DataObject* pObj = nullptr;
365  std::string path = fullPath;
366  MsgStream log(msgSvc(), name());
367  if ( path[0] != SEPARATOR ) {
368  path = m_rootName;
369  path += SEPARATOR;
370  path += fullPath;
371  }
372  StatusCode status = retrieveObject(path, pObj);
373  if ( status.isSuccess() ) {
374  log << MSG::ERROR << "Cannot book N-tuple " << path << " (Exists already)" << endmsg;
375  return nullptr;
376  }
377  auto sep = path.rfind(SEPARATOR);
378  if ( sep == std::string::npos ) {
379  log << MSG::ERROR << "Cannot book N-tuple " << path << " (Invalid path)" << endmsg;
380  return nullptr;
381  }
382 
383  std::string p_path (path, 0, sep);
384  std::string o_path (path, sep, path.length());
385  DataObject* dir = createDirectory(p_path);
386  if ( !dir ) {
387  log << MSG::ERROR << "Cannot book N-tuple " << path << " (Invalid parent directory)" << endmsg;
388  return nullptr;
389  }
390 
391  NTuple::Tuple* tup = book( dir, o_path, type, title);
392  if ( !tup ) {
393  log << MSG::ERROR << "Cannot book N-tuple " << path << " (Unknown reason)" << endmsg;
394  }
395  return tup;
396 }
397 
399 NTuple::Tuple* NTupleSvc::book (const std::string& dirPath, const std::string& relPath, const CLID& type, const std::string& title) {
400  std::string full = dirPath;
401  if (relPath[0] != SEPARATOR) full += SEPARATOR;
402  full += relPath;
403  return book(full, type, title);
404 }
405 
407 NTuple::Tuple* NTupleSvc::book (const std::string& dirPath, long id, const CLID& type, const std::string& title) {
408  return book( dirPath, toStr(id), type, title);
409 }
410 
412 NTuple::Tuple* NTupleSvc::book (DataObject* pParent, const std::string& relPath, const CLID& type, const std::string& title) {
413  NTuple::Tuple* pObj = nullptr;
414  // Check if object is already present
415  StatusCode status = findObject(pParent, relPath, *pp_cast<DataObject>(&pObj));
416  // No ? Then create it!
417  if ( !status.isSuccess() ) {
418  status = create( type, title, pObj);
419  if ( status.isSuccess() ) {
420  // Finally register the created N tuple with the store
421  status = registerObject(pParent, relPath, pObj);
422  if ( status.isSuccess() ) return pObj;
423  pObj->release();
424  }
425  }
426  return nullptr;
427 }
428 
431  long id,
432  const CLID& type,
433  const std::string& title) {
434  return book( pParent, toStr(id), type, title);
435 }
436 
439  const std::string& relPath) {
440  if ( pParent ) {
441  IRegistry* pDir = pParent->registry();
442  if ( pDir ) {
443  std::string full = pDir->identifier();
444  if (relPath[0]!='/') full += "/";
445  full += relPath;
446  return createDirectory(full);
447  }
448  }
449  return nullptr;
450 }
451 
454  return createDirectory( pParent, toStr(id) );
455 }
456 
458 NTuple::Directory* NTupleSvc::createDirectory (const std::string& dirPath, long id) {
459  return createDirectory( dirPath, toStr(id) );
460 }
461 
463 NTuple::Directory* NTupleSvc::createDirectory (const std::string& dirPath, const std::string& relPath ) {
464  std::string full = dirPath;
465  if (relPath[0]!='/') full += "/";
466  full += relPath;
467  return createDirectory(full);
468 }
469 
470 StatusCode NTupleSvc::attachTuple(const std::string& filename, const std::string& logname, const char typ, const long t) {
471  MsgStream log(msgSvc(), name());
472  DataObject* p;
473  // First get the root object
474  StatusCode status = retrieveObject(m_rootName, p);
475  if ( status.isSuccess() ) {
476  // Now add the registry entry to the store
477  std::string entryname = m_rootName;
478  entryname += '/';
479  entryname += logname;
480  GenericAddress* pA =
481  new GenericAddress(t, CLID_NTupleFile, filename, entryname, 0, typ);
482  status = registerAddress(p, logname, pA);
483  if ( status.isSuccess() ) {
484  log << MSG::INFO << "Added stream file:" << filename << " as " << logname << endmsg;
485  return status;
486  }
487  pA->release();
488  }
489  log << MSG::ERROR << "Cannot add file:" << filename << " as " << logname << endmsg;
490  return status;
491 }
492 
494 NTuple::Directory* NTupleSvc::createDirectory (const std::string& fullPath) {
495  NTuple::Directory* p = nullptr;
496  StatusCode status = findObject(fullPath, *pp_cast<DataObject>(&p));
497  if ( !status.isSuccess() ) {
498  auto sep2 = fullPath.rfind(SEPARATOR);
499  if ( sep2 != std::string::npos ) {
500  std::string relPath = fullPath.substr(0, sep2);
501  p = createDirectory(relPath);
502  if ( p ) {
503  p = new NTuple::Directory();
504  // Finally register the created N tuple with the store
505  status = registerObject(fullPath, p);
506  if ( status.isSuccess() ) {
507  // ...starting from the file entries
509  if ( svc ) {
510  IOpaqueAddress* pAddr = nullptr;
511  status = svc->createRep (p, pAddr);
512  if ( status.isSuccess() ) {
513  p->registry()->setAddress(pAddr);
514  status = svc->fillRepRefs (pAddr, p);
515  if ( status.isSuccess() ) return p;
516  }
517  }
518  unregisterObject(p);
519  }
520  p->release();
521  p = nullptr;
522  }
523  }
524  }
525  return dynamic_cast<NTuple::Directory*>(p);
526 }
527 
529 NTuple::Tuple* NTupleSvc::access(const std::string&, const std::string&) {
530  MsgStream log ( msgSvc(), name() );
531  return nullptr;
532 }
533 
535 StatusCode NTupleSvc::save(const std::string& fullPath) {
536  MsgStream log ( msgSvc(), name() );
537  NTuple::Tuple* pObj = nullptr;
538  StatusCode status = findObject(fullPath, *pp_cast<DataObject>(&pObj)); // Check if object is present
539  return status.isSuccess() ? save ( pObj ) : INVALID_OBJ_PATH;
540 }
541 
544  NTuple::TupleImp* tuple = (NTuple::TupleImp*)n_tuple;
545  if ( tuple ) {
546  try {
547  IConversionSvc* pSvc = tuple->conversionService();
548  IRegistry* pReg = tuple->registry();
549  if ( pSvc && pReg ) {
550  IOpaqueAddress* pAddr = pReg->address();
551  StatusCode status = pSvc->updateRep(pAddr, n_tuple);
552  if ( status.isSuccess() ) {
553  status = pSvc->updateRepRefs(pAddr, n_tuple);
554  }
555  return status;
556  }
558  }
559  catch(...) {
560  }
561  }
562  return INVALID_OBJECT;
563 }
564 
566 StatusCode NTupleSvc::save(DataObject* pParent, const std::string& relPath) {
567  NTuple::Tuple* pObj = nullptr;
568  StatusCode status = findObject(pParent, relPath, *pp_cast<DataObject>(&pObj)); // Check if object is present
569  return status.isSuccess() ? save ( pObj ) : INVALID_OBJ_PATH;
570 }
571 
574  NTuple::TupleImp* tuple = (NTuple::TupleImp*)n_tuple;
575  if ( tuple ) {
576  try {
577  IConversionSvc* pSvc = tuple->conversionService();
578  if ( !pSvc ) {
579  pSvc = getDataLoader(n_tuple->registry());
580  tuple->setConversionService(pSvc);
581  }
582  if ( pSvc ) {
583  IRegistry* pReg = n_tuple->registry();
584  IOpaqueAddress* pAddr = pReg->address();
585  StatusCode status = pSvc->createRep(n_tuple, pAddr);
586  if ( status.isSuccess() ) {
587  pReg->setAddress(pAddr);
588  status = pSvc->fillRepRefs(pAddr, n_tuple);
589  }
590  return status;
591  }
593  }
594  catch(...) {
595  }
596  }
597  return INVALID_OBJECT;
598 }
599 
601 StatusCode NTupleSvc::writeRecord(const std::string& fullPath ) {
602  NTuple::Tuple* pObj = nullptr;
603  StatusCode status = findObject(fullPath, *pp_cast<DataObject>(&pObj)); // Check if object is present
604  return status.isSuccess() ? writeRecord ( pObj ) : INVALID_OBJ_PATH;
605 }
606 
608 StatusCode NTupleSvc::writeRecord( DataObject* pParent, const std::string& relPath) {
609  NTuple::Tuple* pObj = nullptr;
610  StatusCode status = findObject(pParent, relPath, *pp_cast<DataObject>(&pObj)); // Check if object is present
611  return status.isSuccess() ? writeRecord ( pObj ) : INVALID_OBJ_PATH;
612 }
613 
616  StatusCode status = INVALID_OBJECT;
617  NTuple::TupleImp* tuple = (NTuple::TupleImp*)n_tuple;
618  if ( tuple ) {
619  try {
620  IConversionSvc* pSvc = tuple->conversionService();
621  if ( !pSvc ) {
622  pSvc = getDataLoader(n_tuple->registry());
623  tuple->setConversionService(pSvc);
624  }
625  if ( pSvc ) {
626  IRegistry* pReg = n_tuple->registry();
627  IOpaqueAddress* pAddr = pReg->address();
628  status = pSvc->updateObj(pAddr, n_tuple);
629  if ( status.isSuccess() ) {
630  status = pSvc->updateObjRefs(pAddr, n_tuple);
631  }
632  return status;
633  }
635  }
636  catch(...) {
637  status = INVALID_OBJECT;
638  }
639  }
640  return status;
641 }
642 
644 StatusCode NTupleSvc::readRecord(const std::string& fullPath) {
645  NTuple::Tuple* pObj = nullptr;
646  StatusCode status = findObject(fullPath, *pp_cast<DataObject>(&pObj)); // Check if object is present
647  return status.isSuccess() ? readRecord ( pObj ) : INVALID_OBJ_PATH;
648 }
649 
651 StatusCode NTupleSvc::readRecord(DataObject* pParent, const std::string& relPath) {
652  NTuple::Tuple* pObj = nullptr;
653  StatusCode status = findObject(pParent, relPath, *pp_cast<DataObject>(&pObj)); // Check if object is present
654  return status.isSuccess() ? readRecord ( pObj ) : INVALID_OBJ_PATH;
655 }
void releaseConnection(Connection &c)
Finalize single service.
Definition: NTupleSvc.cpp:178
tuple c
Definition: gaudirun.py:392
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
Definition: ISvcLocator.h:25
const char * toStr(IAuditor::StandardEventType e)
Simple mapping function from IAuditor::StandardEventType to string.
Definition: IAuditor.h:106
DataSelectionAgent base in charge of collecting all the refereces to DataObjects in a transient store...
constexpr char SEPARATOR
virtual StatusCode finalize()
DataSvc overrides: stop the service.
Definition: NTupleSvc.cpp:204
virtual StatusCode save(const std::string &fullPath)
Save N tuple to disk. Must be called in order to close the ntuple file properly.
Definition: NTupleSvc.cpp:535
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:76
unsigned long release() override
release reference to object
#define DECLARE_NAMESPACE_OBJECT_FACTORY(n, x)
Definition: ObjectFactory.h:18
list path
Definition: __init__.py:15
virtual StatusCode setDataProvider(IDataProviderSvc *pService)=0
Set Data provider service.
const long ROOT_StorageType
Definition: ClassID.h:52
No data loader available.
virtual StatusCode createRep(DataObject *pObject, IOpaqueAddress *&refpAddress)=0
Convert the transient object to the requested representation.
Generic Transient Address.
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 NTuple::Directory * createDirectory(DataObject *pParent, const std::string &title)
Create Ntuple directory and register it with the data store.
Definition: NTupleSvc.cpp:438
virtual StatusCode readRecord(NTuple::Tuple *tuple)
Read single record from N tuple.
Definition: NTupleSvc.cpp:615
virtual StatusCode updateRepRefs(IOpaqueAddress *pAddress, DataObject *pObject)=0
Update the references of an already converted object.
IRegistry * registry() const
Get pointer to Registry.
Definition: DataObject.h:74
StatusCode updateDirectories()
Update directory data.
Definition: NTupleSvc.cpp:123
virtual StatusCode updateObj(IOpaqueAddress *pAddress, DataObject *refpObject)=0
Update the transient object from the other representation.
NTuple name space.
Definition: INTupleSvc.h:10
StatusCode createService(const std::string &nam, const std::string &typ, const std::vector< Prop > &props, IConversionSvc *&pSvc)
Create conversion service.
Definition: NTupleSvc.cpp:281
IDataSelector * selectedObjects()
Return the set of selected DataObjects.
#define DECLARE_COMPONENT(type)
Definition: PluginService.h:36
virtual long repSvcType() const =0
Retrieve the class type of the data store the converter uses.
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
IConversionSvc * service
Definition: NTupleSvc.h:29
Definition of the basic interface.
Definition: IInterface.h:234
virtual StatusCode reinitialize()
DataSvc overrides: reinitialize service.
Definition: NTupleSvc.cpp:101
virtual StatusCode updateObjRefs(IOpaqueAddress *pAddress, DataObject *pObject)=0
Update the references of an updated transient object.
NTupleSvc(const std::string &name, ISvcLocator *svc)
Standard Constructor.
Definition: NTupleSvc.cpp:61
The IRegistry represents the entry door to the environment any data object residing in a transient da...
Definition: IRegistry.h:22
StatusCode finalize() override
Service initialization.
Definition: DataSvc.cpp:1196
virtual StatusCode updateRep(IOpaqueAddress *pAddress, DataObject *pObject)=0
Update the converted representation of a transient object.
virtual StatusCode connect(const std::string &ident)
Add file to list I/O list.
Definition: NTupleSvc.cpp:212
unsigned int CLID
Class ID definition.
Definition: ClassID.h:8
virtual IOpaqueAddress * address() const =0
Retrieve opaque storage address.
virtual NTuple::Tuple * book(const std::string &fullPath, const CLID &type, const std::string &title)
Book Ntuple and register it with the data store.
Definition: NTupleSvc.cpp:363
const TYPE & value() const
explicit conversion
Definition: Property.h:341
DBaseEntries m_input
Input streams.
Definition: NTupleSvc.h:124
Abstract base class which allows the user to interact with the actual N tuple implementation.
Definition: NTuple.h:370
virtual StatusCode writeRecord(NTuple::Tuple *tuple)
Write single record to N tuple.
Definition: NTupleSvc.cpp:573
virtual IConversionSvc * getDataLoader(IRegistry *pReg)
DataSvc overrides: Retrieve data loader.
Definition: NTupleSvc.cpp:112
virtual unsigned long release()
release reference to object
Definition: DataObject.cpp:56
virtual unsigned long release()=0
Release Interface instance.
NTuple service.
Definition: NTupleSvc.h:24
Base class used to extend a class implementing other interfaces.
Definition: extends.h:10
StatusCode initialize() override
Service initialization.
Definition: DataSvc.cpp:1161
virtual void setAddress(IOpaqueAddress *pAddress)=0
Set/Update Opaque storage address.
void setTupleService(INTupleSvc *svc)
Access conversion service.
DBaseEntries m_output
Output streams.
Definition: NTupleSvc.h:122
const long TEST_StorageType
Definition: ClassID.h:49
string s
Definition: gaudirun.py:246
tuple root
Definition: IOTest.py:42
virtual unsigned long addRef()=0
Increment the reference count of Interface instance.
virtual NTuple::Tuple * access(const std::string &fullPath, const std::string &filename)
Access N tuple on disk.
Definition: NTupleSvc.cpp:529
virtual StatusCode create(const CLID &typ, const std::string &title, NTuple::Tuple *&refpTuple)
Create requested N tuple (Hide constructor)
Definition: NTupleSvc.cpp:342
virtual StatusCode initialize()
DataSvc overrides: Initialize the service.
Definition: NTupleSvc.cpp:75
virtual const id_type & identifier() const =0
Full identifier (or key)
void setConversionService(IConversionSvc *svc)
Access conversion service.
Opaque address interface definition.
Base class for all conversion services.
Definition: ConversionSvc.h:46
The IProperty is the basic interface for all components which have properties that can be set or get...
Definition: IProperty.h:21
StatusCode attachTuple(const std::string &filename, const std::string &logname, const char typ, const long t)
Attach output/input file.
Definition: NTupleSvc.cpp:470
virtual StatusCode disconnect(const std::string &nam)
Close open connection.
Definition: NTupleSvc.cpp:186
virtual StatusCode disconnectAll()
Close all open connections.
Definition: NTupleSvc.cpp:197
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:30
Small class representing an N tuple directory in the transient store.
Definition: NTuple.h:1068
list i
Definition: ana.py:128
virtual bool isConnected(const std::string &identifier) const
Check if a datasource is connected.
Definition: NTupleSvc.cpp:106
virtual ~NTupleSvc()
Standard Destructor.
Definition: NTupleSvc.cpp:71
virtual StatusCode fillRepRefs(IOpaqueAddress *pAddress, DataObject *pObject)=0
Resolve the references of the converted object.
virtual const unsigned long * ipar() const =0
Access to generic link parameters.
void toupper(std::string &s)
IConversionSvc * conversionService() const
Access conversion service.
string type
Definition: gaudirun.py:151
const long HBOOK_StorageType
Definition: ClassID.h:56
Connections m_connections
Container of connection points.
Definition: NTupleSvc.h:126