| The Gaudi Framework v29r1 (5cd95fa2)

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

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