| The Gaudi Framework v32r1 (f65d50dc)

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