| The Gaudi Framework v27r1

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