The Gaudi Framework  v33r0 (d5ea422b)
NTupleSvc.cpp
Go to the documentation of this file.
1 /***********************************************************************************\
2 * (c) Copyright 1998-2019 CERN for the benefit of the LHCb and ATLAS collaborations *
3 * *
4 * This software is distributed under the terms of the Apache version 2 licence, *
5 * copied verbatim in the file "LICENSE". *
6 * *
7 * In applying this licence, CERN does not waive the privileges and immunities *
8 * granted to it by virtue of its status as an Intergovernmental Organization *
9 * or submit itself to any jurisdiction. *
10 \***********************************************************************************/
11 //====================================================================
12 // NTupleSvc.cpp
13 //--------------------------------------------------------------------
14 //
15 // Package : GaudiSvc/NTupleSvc ( The LHCb Offline System)
16 //
17 // Description: implementation of the NTuple service
18 //
19 // Author : M.Frank
20 // History :
21 // +---------+----------------------------------------------+---------
22 // | Date | Comment | Who
23 // +---------+----------------------------------------------+---------
24 // | 29/10/98| Initial version | MF
25 // | 29/09/99| Added access to ICnvManager for missing |
26 // | | converters | MF
27 // | 20/09/00| Connect dynamically to conversion service |
28 // | | for N-tuple persistency | MF
29 // +---------+----------------------------------------------+---------
30 //
31 //====================================================================
32 #define GAUDISVC_NTUPLESVC_CPP
33 
34 // Framework include files
36 #include "GaudiKernel/DataObject.h"
39 #include "GaudiKernel/SmartIF.h"
40 
42 #include "GaudiKernel/IProperty.h"
43 #include "GaudiKernel/IRegistry.h"
45 
48 #include "GaudiKernel/Property.h"
49 #include "GaudiKernel/Selector.h"
50 #include "GaudiKernel/reverse.h"
51 
52 #include "NTupleSvc.h"
53 
54 // Instantiation of a static factory class used by clients to create
55 // instances of this service
57 
58 // Selector factory instantiation
60 
61 NTupleSvc::NTupleSvc( const std::string& name, ISvcLocator* svc ) : base_class( name, svc ) {
62  m_rootName = "/NTUPLES";
63  m_rootCLID = CLID_DataObject;
64 }
65 
66 // Initialize the service.
69  if ( status.isSuccess() ) {
70  status = setProperties();
71  if ( status.isSuccess() ) {
72  StatusCode iret( StatusCode::SUCCESS, true );
74  status = setRoot( m_rootName, root );
75  for ( auto& i : m_output ) {
76  iret = connect( i );
77  if ( !iret.isSuccess() ) status = iret;
78  }
79  for ( auto& j : m_input ) {
80  iret = connect( j );
81  if ( !iret.isSuccess() ) status = iret;
82  }
83  }
84  }
85  return status;
86 }
87 
90 
91 // Check if a datasource is connected
92 bool NTupleSvc::isConnected( const std::string& identifier ) const {
93  auto i = m_connections.find( identifier );
94  return i != m_connections.end();
95 }
96 
99  if ( !pRegistry ) return nullptr;
100  std::string full = pRegistry->identifier();
101  auto len = m_rootName.length();
102  auto idx = full.find( SEPARATOR, len + 1 );
103  std::string path = ( idx == std::string::npos ) ? full : full.substr( 0, idx );
104  auto i = m_connections.find( path );
105  return ( i != m_connections.end() ) ? i->second.service : nullptr;
106 }
107 
109  long need_update = 0;
110  DataObject* pO = nullptr;
111  StatusCode iret = findObject( m_rootName.value(), pO );
112  // debug() << "in finalize()" << endmsg;
113  if ( iret.isSuccess() ) {
115  iret = objectLeaves( pO, leaves );
116  if ( iret.isSuccess() ) {
117  // Only traverse the tree below the files
118  for ( auto d = leaves.begin(); d != leaves.end(); d++ ) {
119  if ( !( *d )->object() ) continue;
120  IOpaqueAddress* pA = ( *d )->address();
121  if ( !pA ) continue;
122  unsigned long typ = pA->ipar()[1];
123  if ( typ != 'R' && typ != 'N' && typ != 'U' ) continue;
124  // ...starting from the file entries: first save the directories/ntuples
125  IConversionSvc* svc = getDataLoader( *d );
126  if ( !svc ) continue;
127 
129  IDataManagerSvc::traverseSubTree( ( *d )->object(), [&sel]( IRegistry* r, int ) {
130  DataObject* obj = r->object();
131  if ( obj ) sel.push_back( obj );
132  return true;
133  } ).ignore();
134  for ( DataObject* o : reverse( sel ) ) {
135  IRegistry* r = o->registry();
136  auto status = svc->updateRep( r->address(), o );
137  if ( !status.isSuccess() ) iret = status;
138  }
139  for ( DataObject* o : reverse( sel ) ) {
140  IRegistry* r = o->registry();
141  auto status = svc->updateRepRefs( r->address(), o );
142  if ( !status.isSuccess() ) iret = status;
143  }
144 
145  if ( iret.isSuccess() ) need_update += sel.size();
146  }
147  }
148  }
149  if ( !iret.isSuccess() ) {
150  error() << "ERROR while saving NTuples" << endmsg;
151  return iret;
152  }
153  if ( need_update > 0 ) { info() << "NTuples saved successfully" << endmsg; }
154  return iret;
155 }
156 
157 // Finalize single service
159  SmartIF<IService> isvc( c.service );
160  if ( isvc ) isvc->finalize().ignore();
161  c.service->release();
162  c.service = nullptr;
163 }
164 
165 // Close all open connections
167  auto i = m_connections.find( nam );
168  if ( i == m_connections.end() ) return StatusCode::FAILURE;
169  releaseConnection( i->second );
170  m_connections.erase( i );
171  return StatusCode::SUCCESS;
172 }
173 
174 // Close all open connections
176  for ( auto& i : m_connections ) releaseConnection( i.second );
177  m_connections.clear();
178  return StatusCode::SUCCESS;
179 }
180 
183  StatusCode status = updateDirectories();
184  status = clearStore();
185  status = DataSvc::finalize();
186  status = disconnectAll();
187  return status;
188 }
189 
191  std::string logName;
192  return connect( ident, logName );
193 }
194 
196  DataObject* pO = nullptr;
197  StatusCode status = findObject( m_rootName.value(), pO );
198  if ( status.isSuccess() ) {
199  char typ = 0;
200  std::vector<Prop> props;
201  long loc = ident.find( " " );
202  std::string filename, auth, svc = "", db_typ = "";
203  logname = ident.substr( 0, loc );
204  using Parser = Gaudi::Utils::AttribStringParser;
205  // we assume that there is always a " "
206  // (but if it is not there, we probably will not match the pattern)
207  for ( auto attrib : Parser( ident.substr( loc + 1 ) ) ) {
208  switch ( ::toupper( attrib.tag[0] ) ) {
209  case 'A':
210  break;
211  case 'F': // FILE='<file name>'
212  case 'D': // DATAFILE='<file name>'
213  filename = std::move( attrib.value );
214  break;
215  case 'O': // OPT='<NEW<CREATE,WRITE>, UPDATE, READ>'
216  switch ( ::toupper( attrib.value[0] ) ) {
217  case 'C':
218  case 'N':
219  case 'W':
220  typ = 'N';
221  break;
222  case 'U':
223  typ = 'U';
224  break;
225  case 'O':
226  case 'R':
227  typ = 'O';
228  break;
229  default:
230  typ = 0;
231  break;
232  }
233  break;
234  case 'T': // TYP='<HBOOK,ROOT,OBJY,...>'
235  db_typ = std::move( attrib.value );
236  break;
237  default:
238  props.emplace_back( attrib.tag, attrib.value );
239  break;
240  }
241  }
242  if ( 0 != typ ) {
243  IConversionSvc* pSvc = nullptr;
244  status = createService( name() + '.' + logname, db_typ, props, pSvc );
245  if ( status.isSuccess() ) {
246  status = attachTuple( filename, logname, typ, pSvc->repSvcType() );
247  if ( status.isSuccess() ) {
248  m_connections.insert( {m_rootName + '/' + logname, Connection( pSvc )} );
249  return StatusCode::SUCCESS;
250  }
251  }
252  }
253  }
254  error() << "Cannot add " << ident << " invalid filename!" << endmsg;
255  return StatusCode::FAILURE;
256 }
257 
259  const std::vector<Prop>& /* props */, IConversionSvc*& pSvc ) {
261  // Get the value of the Stat persistancy mechanism from the AppMgr
262  auto appPropMgr = serviceLocator()->as<IProperty>();
263  if ( !appPropMgr ) {
264  // Report an error and return the FAILURE status code
265  error() << "Could not get PropMgr" << endmsg;
266  return StatusCode::FAILURE;
267  }
268 
269  Gaudi::Property<std::string> sp( "HistogramPersistency", "" );
270  StatusCode sts = appPropMgr->getProperty( &sp );
271  if ( !sts.isSuccess() ) {
272  error() << "Could not get NTuple Persistency format"
273  << " from ApplicationMgr properties" << endmsg;
274  return sts;
275  }
276 
277  long storage_typ = TEST_StorageType;
278  if ( sp.value() == "HBOOK" ) {
279  storage_typ = HBOOK_StorageType;
280  } else if ( sp.value() == "ROOT" ) {
281  storage_typ = ROOT_StorageType;
282  } else {
283  error() << "Unknown NTuple Persistency format: " << sp.value() << endmsg;
284  return StatusCode::FAILURE;
285  }
286 
287  if ( !typ.empty() && typ != sp.value() ) {
288  warning() << "NTuple persistency type is " << sp.value() << "." << endmsg << "Type given by job option "
289  << "NTupleSvc.Input/Output ignored!" << endmsg;
290  }
291 
292  // debug() << "storage type: " << m_storageType << endmsg;
293 
294  // FIXME: (MCl) why NTupleSvc has to directly create a ConversionSvc?
295  IInterface* iface = new ConversionSvc( name() + "Conversions", serviceLocator(), storage_typ );
296  auto pService = SmartIF<IService>( iface );
297  if ( !pService ) return StatusCode::FAILURE;
298 
299  auto cnvSvc = pService.as<IConversionSvc>();
300  if ( !cnvSvc ) return StatusCode::FAILURE;
301 
302  pSvc = cnvSvc.get();
303  pSvc->addRef(); // make sure the caller gets a pSvc which points at something
304  // with a refCount of (at least) one...
305  auto status = pService->sysInitialize();
306  if ( !status.isSuccess() ) return status;
307  return pSvc->setDataProvider( this );
308 }
309 
311 StatusCode NTupleSvc::create( const CLID& typ, const std::string& title, NTuple::Tuple*& refpTuple ) {
312  NTuple::TupleImp* pTuple = nullptr;
314  if ( typ == CLID_ColumnWiseTuple ) {
315  pTuple = new NTuple::ColumnWiseTuple( title );
316  } else if ( typ == CLID_RowWiseTuple ) {
317  pTuple = new NTuple::RowWiseTuple( title );
318  } else {
320  }
321  if ( pTuple ) {
322  pTuple->setTupleService( this );
323  status = StatusCode::SUCCESS;
324  }
325  refpTuple = pTuple;
326  return status;
327 }
328 
330 NTuple::Tuple* NTupleSvc::book( const std::string& fullPath, const CLID& type, const std::string& title ) {
331  DataObject* pObj = nullptr;
332  std::string path = fullPath;
333  assert( !path.empty() );
334  if ( path[0] != SEPARATOR ) {
335  path = m_rootName;
336  path += SEPARATOR;
337  path += fullPath;
338  }
339  StatusCode status = retrieveObject( path, pObj );
340  if ( status.isSuccess() ) {
341  error() << "Cannot book N-tuple " << path << " (Exists already)" << endmsg;
342  return nullptr;
343  }
344  auto sep = path.rfind( SEPARATOR );
345  if ( sep == std::string::npos ) {
346  error() << "Cannot book N-tuple " << path << " (Invalid path)" << endmsg;
347  return nullptr;
348  }
349 
350  std::string p_path( path, 0, sep );
351  std::string o_path( path, sep, path.length() );
352  DataObject* dir = createDirectory( p_path );
353  if ( !dir ) {
354  error() << "Cannot book N-tuple " << path << " (Invalid parent directory)" << endmsg;
355  return nullptr;
356  }
357 
358  NTuple::Tuple* tup = book( dir, o_path, type, title );
359  if ( !tup ) { error() << "Cannot book N-tuple " << path << " (Unknown reason)" << endmsg; }
360  return tup;
361 }
362 
364 NTuple::Tuple* NTupleSvc::book( const std::string& dirPath, const std::string& relPath, const CLID& type,
365  const std::string& title ) {
366  std::string full = dirPath;
367  assert( !relPath.empty() );
368  if ( relPath[0] != SEPARATOR ) full += SEPARATOR;
369  full += relPath;
370  return book( full, type, title );
371 }
372 
374 NTuple::Tuple* NTupleSvc::book( const std::string& dirPath, long id, const CLID& type, const std::string& title ) {
375  return book( dirPath, std::to_string( id ), type, title );
376 }
377 
379 NTuple::Tuple* NTupleSvc::book( DataObject* pParent, const std::string& relPath, const CLID& type,
380  const std::string& title ) {
381  NTuple::Tuple* pObj = nullptr;
382  // Check if object is already present
383  StatusCode status = findObject( pParent, relPath, *pp_cast<DataObject>( &pObj ) );
384  // No ? Then create it!
385  if ( !status.isSuccess() ) {
386  status = create( type, title, pObj );
387  if ( status.isSuccess() ) {
388  // Finally register the created N tuple with the store
389  status = registerObject( pParent, relPath, pObj );
390  if ( status.isSuccess() ) return pObj;
391  pObj->release();
392  }
393  }
394  return nullptr;
395 }
396 
398 NTuple::Tuple* NTupleSvc::book( DataObject* pParent, long id, const CLID& type, const std::string& title ) {
399  return book( pParent, std::to_string( id ), type, title );
400 }
401 
404  assert( !relPath.empty() );
405  if ( pParent ) {
406  IRegistry* pDir = pParent->registry();
407  if ( pDir ) {
408  std::string full = pDir->identifier();
409  if ( relPath[0] != '/' ) full += "/";
410  full += relPath;
411  return createDirectory( full );
412  }
413  }
414  return nullptr;
415 }
416 
419  return createDirectory( pParent, std::to_string( id ) );
420 }
421 
424  return createDirectory( dirPath, std::to_string( id ) );
425 }
426 
429  assert( !relPath.empty() );
430  std::string full = dirPath;
431  if ( relPath[0] != '/' ) full += "/";
432  full += relPath;
433  return createDirectory( full );
434 }
435 
436 StatusCode NTupleSvc::attachTuple( const std::string& filename, const std::string& logname, const char typ,
437  const long t ) {
438  DataObject* p;
439  // First get the root object
440  StatusCode status = retrieveObject( m_rootName.value(), p );
441  if ( status.isSuccess() ) {
442  // Now add the registry entry to the store
443  std::string entryname = m_rootName;
444  entryname += '/';
445  entryname += logname;
446  GenericAddress* pA = new GenericAddress( t, CLID_NTupleFile, filename, entryname, 0, typ );
447  status = registerAddress( p, logname, pA );
448  if ( status.isSuccess() ) {
449  info() << "Added stream file:" << filename << " as " << logname << endmsg;
450  return status;
451  }
452  pA->release();
453  }
454  error() << "Cannot add file:" << filename << " as " << logname << endmsg;
455  return status;
456 }
457 
460  NTuple::Directory* p = nullptr;
461  StatusCode status = findObject( fullPath, *pp_cast<DataObject>( &p ) );
462  if ( !status.isSuccess() ) {
463  auto sep2 = fullPath.rfind( SEPARATOR );
464  if ( sep2 != std::string::npos ) {
465  std::string relPath = fullPath.substr( 0, sep2 );
466  p = createDirectory( relPath );
467  if ( p ) {
468  p = new NTuple::Directory();
469  // Finally register the created N tuple with the store
470  status = registerObject( fullPath, p );
471  if ( status.isSuccess() ) {
472  // ...starting from the file entries
473  IConversionSvc* svc = getDataLoader( p->registry() );
474  if ( svc ) {
475  IOpaqueAddress* pAddr = nullptr;
476  status = svc->createRep( p, pAddr );
477  if ( status.isSuccess() ) {
478  p->registry()->setAddress( pAddr );
479  status = svc->fillRepRefs( pAddr, p );
480  if ( status.isSuccess() ) return p;
481  }
482  }
483  unregisterObject( p );
484  }
485  p->release();
486  p = nullptr;
487  }
488  }
489  }
490  return p;
491 }
492 
494 NTuple::Tuple* NTupleSvc::access( const std::string&, const std::string& ) { return nullptr; }
495 
498  NTuple::Tuple* pObj = nullptr;
499  StatusCode status = findObject( fullPath, *pp_cast<DataObject>( &pObj ) ); // Check if object is present
500  return status.isSuccess() ? save( pObj ) : Status::INVALID_OBJ_PATH;
501 }
502 
505  NTuple::TupleImp* tuple = (NTuple::TupleImp*)n_tuple;
506  if ( tuple ) {
507  try {
508  IConversionSvc* pSvc = tuple->conversionService();
509  IRegistry* pReg = tuple->registry();
510  if ( pSvc && pReg ) {
511  IOpaqueAddress* pAddr = pReg->address();
512  StatusCode sc = pSvc->updateRep( pAddr, n_tuple );
513  if ( sc.isSuccess() ) sc = pSvc->updateRepRefs( pAddr, n_tuple );
514  return sc;
515  }
516  return Status::NO_DATA_LOADER;
517  } catch ( ... ) {}
518  }
519  return Status::INVALID_OBJECT;
520 }
521 
523 StatusCode NTupleSvc::save( DataObject* pParent, const std::string& relPath ) {
524  NTuple::Tuple* pObj = nullptr;
525  StatusCode status = findObject( pParent, relPath, *pp_cast<DataObject>( &pObj ) ); // Check if object is present
526  return status.isSuccess() ? save( pObj ) : Status::INVALID_OBJ_PATH;
527 }
528 
531  NTuple::TupleImp* tuple = (NTuple::TupleImp*)n_tuple;
532  if ( tuple ) {
533  try {
534  IConversionSvc* pSvc = tuple->conversionService();
535  if ( !pSvc ) {
536  pSvc = getDataLoader( n_tuple->registry() );
537  tuple->setConversionService( pSvc );
538  }
539  if ( pSvc ) {
540  IRegistry* pReg = n_tuple->registry();
541  IOpaqueAddress* pAddr = pReg->address();
542  StatusCode status = pSvc->createRep( n_tuple, pAddr );
543  if ( status.isSuccess() ) {
544  pReg->setAddress( pAddr );
545  status = pSvc->fillRepRefs( pAddr, n_tuple );
546  }
547  return status;
548  }
549  return Status::NO_DATA_LOADER;
550  } catch ( ... ) {}
551  }
552  return Status::INVALID_OBJECT;
553 }
554 
557  NTuple::Tuple* pObj = nullptr;
558  StatusCode status = findObject( fullPath, *pp_cast<DataObject>( &pObj ) ); // Check if object is present
559  return status.isSuccess() ? writeRecord( pObj ) : Status::INVALID_OBJ_PATH;
560 }
561 
564  NTuple::Tuple* pObj = nullptr;
565  StatusCode status = findObject( pParent, relPath, *pp_cast<DataObject>( &pObj ) ); // Check if object is present
566  return status.isSuccess() ? writeRecord( pObj ) : Status::INVALID_OBJ_PATH;
567 }
568 
571  StatusCode status = Status::INVALID_OBJECT;
572  NTuple::TupleImp* tuple = (NTuple::TupleImp*)n_tuple;
573  if ( tuple ) {
574  try {
575  IConversionSvc* pSvc = tuple->conversionService();
576  if ( !pSvc ) {
577  pSvc = getDataLoader( n_tuple->registry() );
578  tuple->setConversionService( pSvc );
579  }
580  if ( pSvc ) {
581  IRegistry* pReg = n_tuple->registry();
582  IOpaqueAddress* pAddr = pReg->address();
583  status = pSvc->updateObj( pAddr, n_tuple );
584  if ( status.isSuccess() ) { status = pSvc->updateObjRefs( pAddr, n_tuple ); }
585  return status;
586  }
587  status = Status::NO_DATA_LOADER;
588  } catch ( ... ) { status = Status::INVALID_OBJECT; }
589  }
590  return status;
591 }
592 
595  NTuple::Tuple* pObj = nullptr;
596  StatusCode status = findObject( fullPath, *pp_cast<DataObject>( &pObj ) ); // Check if object is present
597  return status.isSuccess() ? readRecord( pObj ) : Status::INVALID_OBJ_PATH;
598 }
599 
602  NTuple::Tuple* pObj = nullptr;
603  StatusCode status = findObject( pParent, relPath, *pp_cast<DataObject>( &pObj ) ); // Check if object is present
604  return status.isSuccess() ? readRecord( pObj ) : Status::INVALID_OBJ_PATH;
605 }
Parse attribute strings allowing iteration over the various attributes.
void releaseConnection(Connection &c)
Finalize single service.
Definition: NTupleSvc.cpp:158
const long TEST_StorageType
Definition: ClassID.h:59
SmartIF< ISvcLocator > & serviceLocator() const override
Retrieve pointer to service locator.
Definition: Service.cpp:287
T empty(T... args)
StatusCode writeRecord(NTuple::Tuple *tuple) override
Write single record to N tuple.
Definition: NTupleSvc.cpp:530
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
Definition: ISvcLocator.h:35
const long HBOOK_StorageType
Definition: ClassID.h:66
IRegistry * registry() const
Get pointer to Registry.
Definition: DataObject.h:82
constexpr char SEPARATOR
Implementation of property with value of concrete type.
Definition: Property.h:370
virtual StatusCode traverseSubTree(std::string_view sub_tree_path, IDataStoreAgent *pAgent)=0
Analyse by traversing all data objects below the sub tree identified by its full path name.
MsgStream & warning() const
shortcut for the method msgStream(MSG::WARNING)
StatusCode initialize() override
DataSvc overrides: Initialize the service.
Definition: NTupleSvc.cpp:67
bool isConnected(const std::string &identifier) const override
Check if a datasource is connected.
Definition: NTupleSvc.cpp:92
StatusCode reinitialize() override
DataSvc overrides: reinitialize service.
Definition: NTupleSvc.cpp:89
unsigned long release() override
release reference to object
StatusCode setRoot(std::string root_name, DataObject *pRootObj) override
Initialize data store for new event by giving new event path and root object.
Definition: DataSvc.cpp:142
::details::reverse_wrapper< T > reverse(T &&iterable)
Definition: reverse.h:59
T rfind(T... args)
T to_string(T... args)
Gaudi::Property< std::string > m_rootName
Definition: DataSvc.h:62
virtual StatusCode setDataProvider(IDataProviderSvc *pService)=0
Set Data provider service.
constexpr static const auto SUCCESS
Definition: StatusCode.h:96
STL namespace.
std::map< std::string, Connection > m_connections
Container of connection points.
Definition: NTupleSvc.h:128
NTuple::Tuple * book(const std::string &fullPath, const CLID &type, const std::string &title) override
Book Ntuple and register it with the data store.
Definition: NTupleSvc.cpp:330
NTuple::Tuple * access(const std::string &fullPath, const std::string &filename) override
Access N tuple on disk.
Definition: NTupleSvc.cpp:494
T end(T... args)
virtual StatusCode createRep(DataObject *pObject, IOpaqueAddress *&refpAddress)=0
Convert the transient object to the requested representation.
StatusCode disconnect(const std::string &nam) override
Close open connection.
Definition: NTupleSvc.cpp:166
SmartIF< IFace > as()
Definition: ISvcLocator.h:113
MsgStream & info() const
shortcut for the method msgStream(MSG::INFO)
Generic Transient Address.
virtual StatusCode updateRepRefs(IOpaqueAddress *pAddress, DataObject *pObject)=0
Update the references of an already converted object.
IConversionSvc * conversionService() const
Access conversion service.
StatusCode updateDirectories()
Update directory data.
Definition: NTupleSvc.cpp:108
virtual StatusCode updateObj(IOpaqueAddress *pAddress, DataObject *refpObject)=0
Update the transient object from the other representation.
NTuple name space.
Definition: INTupleSvc.h:19
StatusCode createService(const std::string &nam, const std::string &typ, const std::vector< Prop > &props, IConversionSvc *&pSvc)
Create conversion service.
Definition: NTupleSvc.cpp:258
STL class.
#define DECLARE_COMPONENT(type)
const std::string & name() const override
Retrieve name of the service.
Definition: Service.cpp:284
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
StatusCode unregisterObject(std::string_view fullPath) override
Unregister object from the data store.
Definition: DataSvc.cpp:383
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:61
Definition of the basic interface.
Definition: IInterface.h:254
virtual StatusCode updateObjRefs(IOpaqueAddress *pAddress, DataObject *pObject)=0
Update the references of an updated transient object.
StatusCode readRecord(NTuple::Tuple *tuple) override
Read single record from N tuple.
Definition: NTupleSvc.cpp:570
Gaudi::Property< DBaseEntries > m_output
Definition: NTupleSvc.h:125
StatusCode objectLeaves(const DataObject *pObject, std::vector< IRegistry * > &refLeaves) override
IDataManagerSvc: Explore the object store: retrieve all leaves attached to the object.
Definition: DataSvc.cpp:208
NTuple::Directory * createDirectory(DataObject *pParent, const std::string &title) override
Create Ntuple directory and register it with the data store.
Definition: NTupleSvc.cpp:403
The IRegistry represents the entry door to the environment any data object residing in a transient da...
Definition: IRegistry.h:32
const long ROOT_StorageType
Definition: ClassID.h:62
StatusCode finalize() override
Service initialization.
Definition: DataSvc.cpp:855
virtual StatusCode updateRep(IOpaqueAddress *pAddress, DataObject *pObject)=0
Update the converted representation of a transient object.
unsigned int CLID
Class ID definition.
Definition: ClassID.h:18
bool isSuccess() const
Definition: StatusCode.h:361
virtual IOpaqueAddress * address() const =0
Retrieve opaque storage address.
T move(T... args)
StatusCode setProperties()
Method for setting declared properties to the values specified for the job.
Definition: Service.cpp:290
virtual DataObject * object() const =0
Retrieve object behind the link.
Abstract base class which allows the user to interact with the actual N tuple implementation.
Definition: NTuple.h:385
StatusCode registerAddress(std::string_view fullPath, IOpaqueAddress *pAddress) override
IDataManagerSvc: Register object address with the data store.
Definition: DataSvc.cpp:225
virtual unsigned long release()
release reference to object
Definition: DataObject.cpp:56
T find(T... args)
StatusCode finalize() override
DataSvc overrides: stop the service.
Definition: NTupleSvc.cpp:182
#define DECLARE_NAMESPACE_OBJECT_FACTORY(n, x)
Definition: ObjectFactory.h:26
IConversionSvc * getDataLoader(IRegistry *pReg) override
DataSvc overrides: Retrieve data loader.
Definition: NTupleSvc.cpp:98
NTuple service.
Definition: NTupleSvc.h:33
StatusCode initialize() override
Service initialization.
Definition: DataSvc.cpp:822
T begin(T... args)
virtual void setAddress(IOpaqueAddress *pAddress)=0
Set/Update Opaque storage address.
void setTupleService(INTupleSvc *svc)
Access conversion service.
StatusCode save(const std::string &fullPath) override
Save N tuple to disk. Must be called in order to close the ntuple file properly.
Definition: NTupleSvc.cpp:497
constexpr static const auto FAILURE
Definition: StatusCode.h:97
StatusCode registerObject(std::string_view parentPath, std::string_view objPath, DataObject *pObject) override
Register object with the data store.
Definition: DataSvc.cpp:303
Gaudi::Property< DBaseEntries > m_input
Definition: NTupleSvc.h:124
virtual unsigned long addRef()=0
Increment the reference count of Interface instance.
T substr(T... args)
StatusCode connect(const std::string &ident) override
Add file to list I/O list.
Definition: NTupleSvc.cpp:190
StatusCode create(const CLID &typ, const std::string &title, NTuple::Tuple *&refpTuple) override
Create requested N tuple (Hide constructor)
Definition: NTupleSvc.cpp:311
Small class representing an N tuple directory in the transient store.
Definition: NTuple.h:911
virtual const id_type & identifier() const =0
Full identifier (or key)
void setConversionService(IConversionSvc *svc)
Access conversion service.
StatusCode disconnectAll() override
Close all open connections.
Definition: NTupleSvc.cpp:175
StatusCode findObject(std::string_view fullPath, DataObject *&pObject) override
Find object identified by its full path in the data store.
Definition: DataSvc.cpp:650
Opaque address interface definition.
Base class for all conversion services.
Definition: ConversionSvc.h:55
The IProperty is the basic interface for all components which have properties that can be set or get.
Definition: IProperty.h:30
StatusCode attachTuple(const std::string &filename, const std::string &logname, const char typ, const long t)
Attach output/input file.
Definition: NTupleSvc.cpp:436
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:40
StatusCode retrieveObject(IRegistry *pDirectory, std::string_view path, DataObject *&pObject) override
Retrieve object from data store.
Definition: DataSvc.cpp:628
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)
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:202
StatusCode clearStore() override
IDataManagerSvc: Remove all data objects in the data store.
Definition: DataSvc.cpp:111
T emplace_back(T... args)