All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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 ( auto& i : m_output ) {
84  iret = connect(i);
85  if ( !iret.isSuccess() ) status = iret;
86  }
87  for ( auto& j : m_input ) {
88  iret = connect(j);
89  if ( !iret.isSuccess() ) status = iret;
90  }
91  }
92  }
93  return status;
94 }
95 
98  return StatusCode::SUCCESS;
99 }
100 
101 // Check if a datasource is connected
102 bool NTupleSvc::isConnected(const std::string& identifier) const {
103  auto i = m_connections.find(identifier);
104  return i!=m_connections.end();
105 }
106 
109  if ( !pRegistry ) return nullptr;
110  std::string full = pRegistry->identifier();
111  auto len = m_rootName.length();
112  auto idx = full.find(SEPARATOR,len+1);
113  std::string path = (idx==std::string::npos) ? full : full.substr(0, idx);
114  auto i = m_connections.find(path);
115  return ( i != m_connections.end() ) ? i->second.service
116  : nullptr;
117 }
118 
120  typedef std::vector<IRegistry*> Leaves;
121  long need_update = 0;
122  DataObject* pO = nullptr;
123  StatusCode iret = findObject(m_rootName, pO);
124  MsgStream log ( msgSvc(), name() );
125  // log << MSG::DEBUG << "in finalize()" << endmsg;
126  if ( iret.isSuccess() ) {
127  Leaves leaves;
128  iret = objectLeaves(pO, leaves);
129  if ( iret.isSuccess() ) {
130  // Only traverse the tree below the files
131  for ( auto d = leaves.begin(); d != leaves.end(); d++ ) {
132  if ( !(*d)->object() ) continue;
133  IOpaqueAddress* pA = (*d)->address();
134  if ( !pA ) continue;
135  unsigned long typ = pA->ipar()[1];
136  if ( typ != 'R' && typ != 'N' && typ != 'U' ) continue;
137  // ...starting from the file entries: first save the directories/ntuples
138  IConversionSvc* svc = getDataLoader(*d);
139  if ( !svc ) continue;
140 
141  StatusCode status;
142  DataSelectionAgent agent;
143  IDataSelector* sel = agent.selectedObjects();
144  traverseSubTree ( (*d)->object(), &agent ).ignore();
145  for(int i = sel->size()-1; i >= 0; i-- ) {
146  DataObject* o = (*sel)[i];
147  IRegistry* r = o->registry();
148  status = svc->updateRep(r->address(), o);
149  if ( !status.isSuccess() ) {
150  iret = status;
151  }
152  }
153  for(int j = sel->size()-1; j >= 0; j-- ) {
154  DataObject* o = (*sel)[j];
155  IRegistry* r = o->registry();
156  status = svc->updateRepRefs(r->address(), o);
157  if ( !status.isSuccess() ) iret = status;
158  }
159  if ( iret.isSuccess() ) need_update += sel->size();
160  }
161  }
162  }
163  if ( !iret.isSuccess() ) {
164  log << MSG::ERROR << "ERROR while saving NTuples" << endmsg;
165  return iret;
166  }
167  else if ( need_update > 0 ) {
168  log << MSG::INFO << "NTuples saved successfully" << endmsg;
169  }
170  return iret;
171 }
172 
173 // Finalize single service
175  SmartIF<IService> isvc( c.service );
176  if ( isvc ) isvc->finalize().ignore();
177  c.service->release();
178  c.service = nullptr;
179 }
180 
181 // Close all open connections
182 StatusCode NTupleSvc::disconnect(const std::string& nam) {
183  auto i = m_connections.find(nam);
184  if ( i != m_connections.end() ) {
185  releaseConnection(i->second);
186  m_connections.erase(i);
187  return StatusCode::SUCCESS;
188  }
189  return StatusCode::FAILURE;
190 }
191 
192 // Close all open connections
194  for(auto &i : m_connections ) releaseConnection(i.second);
195  m_connections.clear();
196  return StatusCode::SUCCESS;
197 }
198 
201  StatusCode status = updateDirectories();
202  status = clearStore();
203  status = DataSvc::finalize();
204  status = disconnectAll();
205  return status;
206 }
207 
208 StatusCode NTupleSvc::connect(const std::string& ident) {
209  std::string logName;
210  return connect(ident, logName);
211 }
212 
213 StatusCode NTupleSvc::connect(const std::string& ident, std::string& logname) {
214  MsgStream log ( msgSvc(), name() );
215  DataObject* pO = nullptr;
216  StatusCode status = findObject(m_rootName, pO);
217  if ( status.isSuccess() ) {
218  char typ=0;
219  std::vector<Prop> props;
220  long loc = ident.find(" ");
221  std::string filename, auth, svc = "", db_typ = "";
222  logname = ident.substr(0, loc);
223  using Parser = Gaudi::Utils::AttribStringParser;
224  // we assume that there is always a " "
225  // (but if it is not there, we probably will not match the pattern)
226  for (auto attrib: Parser(ident.substr(loc + 1))) {
227  switch( ::toupper(attrib.tag[0]) ) {
228  case 'A':
229  break;
230  case 'F': // FILE='<file name>'
231  case 'D': // DATAFILE='<file name>'
232  filename = std::move(attrib.value);
233  break;
234  case 'O': // OPT='<NEW<CREATE,WRITE>, UPDATE, READ>'
235  switch( ::toupper(attrib.value[0]) ) {
236  case 'C':
237  case 'N':
238  case 'W':
239  typ = 'N';
240  break;
241  case 'U':
242  typ = 'U';
243  break;
244  case 'O':
245  case 'R':
246  typ = 'O';
247  break;
248  default:
249  typ = 0;
250  break;
251  }
252  break;
253  case 'T': // TYP='<HBOOK,ROOT,OBJY,...>'
254  db_typ = std::move(attrib.value);
255  break;
256  default:
257  props.emplace_back( attrib.tag, attrib.value);
258  break;
259  }
260  }
261  if ( 0 != typ ) {
262  IConversionSvc* pSvc = nullptr;
263  status = createService(name()+'.'+logname, db_typ, props, pSvc);
264  if ( status.isSuccess() ) {
265  status = attachTuple(filename, logname, typ, pSvc->repSvcType());
266  if ( status.isSuccess() ) {
267  m_connections.insert(Connections::value_type(m_rootName+'/'+logname,Connection(pSvc)));
268  return StatusCode::SUCCESS;
269  }
270  }
271  }
272  }
273  log << MSG::ERROR << "Cannot add " << ident << " invalid filename!" << endmsg;
274  return StatusCode::FAILURE;
275 }
276 
277 StatusCode NTupleSvc::createService(const std::string& /* nam */,
278  const std::string& typ,
279  const std::vector<Prop>& /* props */,
280  IConversionSvc*& pSvc)
281 {
282  MsgStream log ( msgSvc(), name() );
284  // Get the value of the Stat persistancy mechanism from the AppMgr
285  auto appPropMgr = serviceLocator()->as<IProperty>();
286  if( !appPropMgr ) {
287  // Report an error and return the FAILURE status code
288  log << MSG::ERROR << "Could not get PropMgr" << endmsg;
289  return StatusCode::FAILURE;
290  }
291 
292  StringProperty sp("HistogramPersistency","");
293  StatusCode sts = appPropMgr->getProperty( &sp );
294  if ( !sts.isSuccess() ) {
295  log << MSG::ERROR << "Could not get NTuple Persistency format"
296  << " from ApplicationMgr properties" << endmsg;
297  return sts;
298  }
299 
300  long storage_typ = TEST_StorageType;
301  if ( sp.value() == "HBOOK" ) {
302  storage_typ = HBOOK_StorageType;
303  }
304  else if ( sp.value() == "ROOT" ) {
305  storage_typ = ROOT_StorageType;
306  }
307  else {
308  log << MSG::ERROR << "Unknown NTuple Persistency format: " << sp.value() << endmsg;
309  return StatusCode::FAILURE;
310  }
311 
312  if ( !typ.empty() && typ != sp.value() ) {
313  log << MSG::WARNING << "NTuple persistency type is "
314  << sp.value() << "." << endmsg
315  << "Type given by job option "
316  << "NTupleSvc.Input/Output ignored!" << endmsg;
317  }
318 
319  // log << MSG::DEBUG << "storage type: " << m_storageType << endmsg;
320 
321  // FIXME: (MCl) why NTupleSvc has to directly create a ConversionSvc?
322  IInterface* iface = new ConversionSvc(name()+"Conversions", serviceLocator(), storage_typ);
323  auto pService = SmartIF<IService>( iface );
324  if ( !pService ) return StatusCode::FAILURE;
325 
326  auto cnvSvc = pService.as<IConversionSvc>();
327  if (!cnvSvc) return StatusCode::FAILURE;
328 
329  pSvc = cnvSvc.get();
330  pSvc->addRef(); // make sure the caller gets a pSvc which points at something
331  // with a refCount of (at least) one...
332  auto status = pService->sysInitialize();
333  if ( !status.isSuccess() ) return status;
334  return pSvc->setDataProvider(this);
335 }
336 
338 StatusCode NTupleSvc::create(const CLID& typ, const std::string& title, NTuple::Tuple*& refpTuple) {
339  NTuple::TupleImp* pTuple = nullptr;
341  if ( typ == CLID_ColumnWiseTuple ) {
342  pTuple = new NTuple::ColumnWiseTuple( title );
343  }
344  else if ( typ == CLID_RowWiseTuple ) {
345  pTuple = new NTuple::RowWiseTuple( title );
346  }
347  else {
349  }
350  if ( pTuple ) {
351  pTuple->setTupleService(this);
352  status = StatusCode::SUCCESS;
353  }
354  refpTuple = pTuple;
355  return status;
356 }
357 
359 NTuple::Tuple* NTupleSvc::book (const std::string& fullPath, const CLID& type, const std::string& title) {
360  DataObject* pObj = nullptr;
361  std::string path = fullPath;
362  MsgStream log(msgSvc(), name());
363  if ( path[0] != SEPARATOR ) {
364  path = m_rootName;
365  path += SEPARATOR;
366  path += fullPath;
367  }
368  StatusCode status = retrieveObject(path, pObj);
369  if ( status.isSuccess() ) {
370  log << MSG::ERROR << "Cannot book N-tuple " << path << " (Exists already)" << endmsg;
371  return nullptr;
372  }
373  auto sep = path.rfind(SEPARATOR);
374  if ( sep == std::string::npos ) {
375  log << MSG::ERROR << "Cannot book N-tuple " << path << " (Invalid path)" << endmsg;
376  return nullptr;
377  }
378 
379  std::string p_path (path, 0, sep);
380  std::string o_path (path, sep, path.length());
381  DataObject* dir = createDirectory(p_path);
382  if ( !dir ) {
383  log << MSG::ERROR << "Cannot book N-tuple " << path << " (Invalid parent directory)" << endmsg;
384  return nullptr;
385  }
386 
387  NTuple::Tuple* tup = book( dir, o_path, type, title);
388  if ( !tup ) {
389  log << MSG::ERROR << "Cannot book N-tuple " << path << " (Unknown reason)" << endmsg;
390  }
391  return tup;
392 }
393 
395 NTuple::Tuple* NTupleSvc::book (const std::string& dirPath, const std::string& relPath, const CLID& type, const std::string& title) {
396  std::string full = dirPath;
397  if (relPath[0] != SEPARATOR) full += SEPARATOR;
398  full += relPath;
399  return book(full, type, title);
400 }
401 
403 NTuple::Tuple* NTupleSvc::book (const std::string& dirPath, long id, const CLID& type, const std::string& title) {
404  return book( dirPath, toStr(id), type, title);
405 }
406 
408 NTuple::Tuple* NTupleSvc::book (DataObject* pParent, const std::string& relPath, const CLID& type, const std::string& title) {
409  NTuple::Tuple* pObj = nullptr;
410  // Check if object is already present
411  StatusCode status = findObject(pParent, relPath, *pp_cast<DataObject>(&pObj));
412  // No ? Then create it!
413  if ( !status.isSuccess() ) {
414  status = create( type, title, pObj);
415  if ( status.isSuccess() ) {
416  // Finally register the created N tuple with the store
417  status = registerObject(pParent, relPath, pObj);
418  if ( status.isSuccess() ) return pObj;
419  pObj->release();
420  }
421  }
422  return nullptr;
423 }
424 
427  long id,
428  const CLID& type,
429  const std::string& title) {
430  return book( pParent, toStr(id), type, title);
431 }
432 
435  const std::string& relPath) {
436  if ( pParent ) {
437  IRegistry* pDir = pParent->registry();
438  if ( pDir ) {
439  std::string full = pDir->identifier();
440  if (relPath[0]!='/') full += "/";
441  full += relPath;
442  return createDirectory(full);
443  }
444  }
445  return nullptr;
446 }
447 
450  return createDirectory( pParent, toStr(id) );
451 }
452 
454 NTuple::Directory* NTupleSvc::createDirectory (const std::string& dirPath, long id) {
455  return createDirectory( dirPath, toStr(id) );
456 }
457 
459 NTuple::Directory* NTupleSvc::createDirectory (const std::string& dirPath, const std::string& relPath ) {
460  std::string full = dirPath;
461  if (relPath[0]!='/') full += "/";
462  full += relPath;
463  return createDirectory(full);
464 }
465 
466 StatusCode NTupleSvc::attachTuple(const std::string& filename, const std::string& logname, const char typ, const long t) {
467  MsgStream log(msgSvc(), name());
468  DataObject* p;
469  // First get the root object
470  StatusCode status = retrieveObject(m_rootName, p);
471  if ( status.isSuccess() ) {
472  // Now add the registry entry to the store
473  std::string entryname = m_rootName;
474  entryname += '/';
475  entryname += logname;
476  GenericAddress* pA =
477  new GenericAddress(t, CLID_NTupleFile, filename, entryname, 0, typ);
478  status = registerAddress(p, logname, pA);
479  if ( status.isSuccess() ) {
480  log << MSG::INFO << "Added stream file:" << filename << " as " << logname << endmsg;
481  return status;
482  }
483  pA->release();
484  }
485  log << MSG::ERROR << "Cannot add file:" << filename << " as " << logname << endmsg;
486  return status;
487 }
488 
490 NTuple::Directory* NTupleSvc::createDirectory (const std::string& fullPath) {
491  NTuple::Directory* p = nullptr;
492  StatusCode status = findObject(fullPath, *pp_cast<DataObject>(&p));
493  if ( !status.isSuccess() ) {
494  auto sep2 = fullPath.rfind(SEPARATOR);
495  if ( sep2 != std::string::npos ) {
496  std::string relPath = fullPath.substr(0, sep2);
497  p = createDirectory(relPath);
498  if ( p ) {
499  p = new NTuple::Directory();
500  // Finally register the created N tuple with the store
501  status = registerObject(fullPath, p);
502  if ( status.isSuccess() ) {
503  // ...starting from the file entries
505  if ( svc ) {
506  IOpaqueAddress* pAddr = nullptr;
507  status = svc->createRep (p, pAddr);
508  if ( status.isSuccess() ) {
509  p->registry()->setAddress(pAddr);
510  status = svc->fillRepRefs (pAddr, p);
511  if ( status.isSuccess() ) return p;
512  }
513  }
514  unregisterObject(p);
515  }
516  p->release();
517  p = nullptr;
518  }
519  }
520  }
521  return dynamic_cast<NTuple::Directory*>(p);
522 }
523 
525 NTuple::Tuple* NTupleSvc::access(const std::string&, const std::string&) {
526  MsgStream log ( msgSvc(), name() );
527  return nullptr;
528 }
529 
531 StatusCode NTupleSvc::save(const std::string& fullPath) {
532  MsgStream log ( msgSvc(), name() );
533  NTuple::Tuple* pObj = nullptr;
534  StatusCode status = findObject(fullPath, *pp_cast<DataObject>(&pObj)); // Check if object is present
535  return status.isSuccess() ? save ( pObj ) : INVALID_OBJ_PATH;
536 }
537 
540  NTuple::TupleImp* tuple = (NTuple::TupleImp*)n_tuple;
541  if ( tuple ) {
542  try {
543  IConversionSvc* pSvc = tuple->conversionService();
544  IRegistry* pReg = tuple->registry();
545  if ( pSvc && pReg ) {
546  IOpaqueAddress* pAddr = pReg->address();
547  StatusCode status = pSvc->updateRep(pAddr, n_tuple);
548  if ( status.isSuccess() ) {
549  status = pSvc->updateRepRefs(pAddr, n_tuple);
550  }
551  return status;
552  }
554  }
555  catch(...) {
556  }
557  }
558  return INVALID_OBJECT;
559 }
560 
562 StatusCode NTupleSvc::save(DataObject* pParent, const std::string& relPath) {
563  NTuple::Tuple* pObj = nullptr;
564  StatusCode status = findObject(pParent, relPath, *pp_cast<DataObject>(&pObj)); // Check if object is present
565  return status.isSuccess() ? save ( pObj ) : INVALID_OBJ_PATH;
566 }
567 
570  NTuple::TupleImp* tuple = (NTuple::TupleImp*)n_tuple;
571  if ( tuple ) {
572  try {
573  IConversionSvc* pSvc = tuple->conversionService();
574  if ( !pSvc ) {
575  pSvc = getDataLoader(n_tuple->registry());
576  tuple->setConversionService(pSvc);
577  }
578  if ( pSvc ) {
579  IRegistry* pReg = n_tuple->registry();
580  IOpaqueAddress* pAddr = pReg->address();
581  StatusCode status = pSvc->createRep(n_tuple, pAddr);
582  if ( status.isSuccess() ) {
583  pReg->setAddress(pAddr);
584  status = pSvc->fillRepRefs(pAddr, n_tuple);
585  }
586  return status;
587  }
589  }
590  catch(...) {
591  }
592  }
593  return INVALID_OBJECT;
594 }
595 
597 StatusCode NTupleSvc::writeRecord(const std::string& fullPath ) {
598  NTuple::Tuple* pObj = nullptr;
599  StatusCode status = findObject(fullPath, *pp_cast<DataObject>(&pObj)); // Check if object is present
600  return status.isSuccess() ? writeRecord ( pObj ) : INVALID_OBJ_PATH;
601 }
602 
604 StatusCode NTupleSvc::writeRecord( DataObject* pParent, const std::string& relPath) {
605  NTuple::Tuple* pObj = nullptr;
606  StatusCode status = findObject(pParent, relPath, *pp_cast<DataObject>(&pObj)); // Check if object is present
607  return status.isSuccess() ? writeRecord ( pObj ) : INVALID_OBJ_PATH;
608 }
609 
612  StatusCode status = INVALID_OBJECT;
613  NTuple::TupleImp* tuple = (NTuple::TupleImp*)n_tuple;
614  if ( tuple ) {
615  try {
616  IConversionSvc* pSvc = tuple->conversionService();
617  if ( !pSvc ) {
618  pSvc = getDataLoader(n_tuple->registry());
619  tuple->setConversionService(pSvc);
620  }
621  if ( pSvc ) {
622  IRegistry* pReg = n_tuple->registry();
623  IOpaqueAddress* pAddr = pReg->address();
624  status = pSvc->updateObj(pAddr, n_tuple);
625  if ( status.isSuccess() ) {
626  status = pSvc->updateObjRefs(pAddr, n_tuple);
627  }
628  return status;
629  }
631  }
632  catch(...) {
633  status = INVALID_OBJECT;
634  }
635  }
636  return status;
637 }
638 
640 StatusCode NTupleSvc::readRecord(const std::string& fullPath) {
641  NTuple::Tuple* pObj = nullptr;
642  StatusCode status = findObject(fullPath, *pp_cast<DataObject>(&pObj)); // Check if object is present
643  return status.isSuccess() ? readRecord ( pObj ) : INVALID_OBJ_PATH;
644 }
645 
647 StatusCode NTupleSvc::readRecord(DataObject* pParent, const std::string& relPath) {
648  NTuple::Tuple* pObj = nullptr;
649  StatusCode status = findObject(pParent, relPath, *pp_cast<DataObject>(&pObj)); // Check if object is present
650  return status.isSuccess() ? readRecord ( pObj ) : INVALID_OBJ_PATH;
651 }
void releaseConnection(Connection &c)
Finalize single service.
Definition: NTupleSvc.cpp:174
tuple c
Definition: gaudirun.py:391
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
#define DECLARE_NAMESPACE_OBJECT_FACTORY(n, x)
Definition: ObjectFactory.h:18
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
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:200
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:531
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:76
unsigned long release() override
release reference to object
list path
Definition: __init__.py:15
virtual StatusCode setDataProvider(IDataProviderSvc *pService)=0
Set Data provider service.
No data loader available.
virtual StatusCode createRep(DataObject *pObject, IOpaqueAddress *&refpAddress)=0
Convert the transient object to the requested representation.
Generic Transient Address.
virtual NTuple::Directory * createDirectory(DataObject *pParent, const std::string &title)
Create Ntuple directory and register it with the data store.
Definition: NTupleSvc.cpp:434
virtual StatusCode readRecord(NTuple::Tuple *tuple)
Read single record from N tuple.
Definition: NTupleSvc.cpp:611
virtual StatusCode updateRepRefs(IOpaqueAddress *pAddress, DataObject *pObject)=0
Update the references of an already converted object.
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
IRegistry * registry() const
Get pointer to Registry.
Definition: DataObject.h:74
StatusCode updateDirectories()
Update directory data.
Definition: NTupleSvc.cpp:119
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:277
IDataSelector * selectedObjects()
Return the set of selected DataObjects.
const char * toStr(IAuditor::StandardEventType e)
Simple mapping function from IAuditor::StandardEventType to string.
Definition: IAuditor.h:106
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
#define DECLARE_COMPONENT(type)
Definition: PluginService.h:36
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:97
const long TEST_StorageType
Definition: ClassID.h:49
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:1188
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:208
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:359
const TYPE & value() const
explicit conversion
Definition: Property.h:341
DBaseEntries m_input
Input streams.
Definition: NTupleSvc.h:124
const long HBOOK_StorageType
Definition: ClassID.h:56
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:569
virtual IConversionSvc * getDataLoader(IRegistry *pReg)
DataSvc overrides: Retrieve data loader.
Definition: NTupleSvc.cpp:108
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:1153
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
string s
Definition: gaudirun.py:245
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:525
virtual StatusCode create(const CLID &typ, const std::string &title, NTuple::Tuple *&refpTuple)
Create requested N tuple (Hide constructor)
Definition: NTupleSvc.cpp:338
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
unsigned int CLID
Class ID definition.
Definition: ClassID.h:8
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:466
virtual StatusCode disconnect(const std::string &nam)
Close open connection.
Definition: NTupleSvc.cpp:182
virtual StatusCode disconnectAll()
Close all open connections.
Definition: NTupleSvc.cpp:193
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:102
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 ROOT_StorageType
Definition: ClassID.h:52
Connections m_connections
Container of connection points.
Definition: NTupleSvc.h:126