| The Gaudi Framework v30r0 (c919700c)

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

- File List
- File Members

NTupleSvc.h
Go to the documentation of this file.
1 #ifndef GAUDI_NTUPLESVC_H
2 #define GAUDI_NTUPLESVC_H 1
3
4 // Framework include files
5 #include "GaudiKernel/DataSvc.h"
6 #include "GaudiKernel/IDataSourceMgr.h"
7 #include "GaudiKernel/INTupleSvc.h"
8
9 // STL include files
10 #include <map>
11
23 class NTupleSvc : public extends<DataSvc, INTupleSvc, IDataSourceMgr>
24 {
25 protected:
26 struct Connection final {
27 IConversionSvc* service;
28 Connection( IConversionSvc* s ) : service( s ) {}
29 Connection( const Connection& c ) : service( c.service ) {}
30 };
31 typedef std::vector<std::string> DBaseEntries;
32 typedef std::map<std::string, Connection> Connections;
33 typedef std::pair<std::string, std::string> Prop;
34
35 public:
37 StatusCode initialize() override;
39 StatusCode reinitialize() override;
41 StatusCode finalize() override;
43 IConversionSvc* getDataLoader( IRegistry* pReg ) override;
44
46 NTuple::Directory* createDirectory( DataObject* pParent, const std::string& title ) override;
48 NTuple::Directory* createDirectory( DataObject* pParent, long id ) override;
50 NTuple::Directory* createDirectory( const std::string& dirPath, long id ) override;
52 NTuple::Directory* createDirectory( const std::string& dirPath, const std::string& title ) override;
54 NTuple::Directory* createDirectory( const std::string& fullPath ) override;
55
57 StatusCode create( const CLID& typ, const std::string& title, NTuple::Tuple*& refpTuple ) override;
59 NTuple::Tuple* book( const std::string& fullPath, const CLID& type, const std::string& title ) override;
61 NTuple::Tuple* book( const std::string& dirPath, const std::string& relPath, const CLID& type,
62 const std::string& title ) override;
64 NTuple::Tuple* book( const std::string& dirPath, long id, const CLID& type, const std::string& title ) override;
66 NTuple::Tuple* book( DataObject* pParent, const std::string& relPath, const CLID& type,
67 const std::string& title ) override;
69 NTuple::Tuple* book( DataObject* pParent, long id, const CLID& type, const std::string& title ) override;
71 NTuple::Tuple* access( const std::string& fullPath, const std::string& filename ) override;
73 StatusCode save( const std::string& fullPath ) override;
75 StatusCode save( NTuple::Tuple* tuple ) override;
77 StatusCode save( DataObject* pParent, const std::string& relPath ) override;
79 StatusCode writeRecord( NTuple::Tuple* tuple ) override;
81 StatusCode writeRecord( const std::string& fullPath ) override;
83 StatusCode writeRecord( DataObject* pParent, const std::string& relPath ) override;
85 StatusCode readRecord( NTuple::Tuple* tuple ) override;
87 StatusCode readRecord( const std::string& fullPath ) override;
89 StatusCode readRecord( DataObject* pParent, const std::string& relPath ) override;
90
92 bool isConnected( const std::string& identifier ) const override;
94 StatusCode connect( const std::string& ident ) override;
96 StatusCode connect( const std::string& ident, std::string& logname ) override;
98 StatusCode disconnect( const std::string& nam ) override;
100 StatusCode disconnectAll() override;
101
103 NTupleSvc( const std::string& name, ISvcLocator* svc );
105 ~NTupleSvc() override = default;
106
107 protected:
109 StatusCode createService( const std::string& nam, const std::string& typ, const std::vector<Prop>& props,
110 IConversionSvc*& pSvc );
112 void releaseConnection( Connection& c );
114 StatusCode attachTuple( const std::string& filename, const std::string& logname, const char typ, const long t );
116 StatusCode updateDirectories();
117
118 Gaudi::Property<DBaseEntries> m_input{this, "Input", {}, "input streams"};
119 Gaudi::Property<DBaseEntries> m_output{this, "Output", {}, "output streams"};
120
122 Connections m_connections;
123 };
124
125 #endif // GAUDI_NTUPLESVC_H
NTupleSvc::Connections
std::map< std::string, Connection > Connections
Definition: NTupleSvc.h:32
NTupleSvc::releaseConnection
void releaseConnection(Connection &c)
Finalize single service.
Definition: NTupleSvc.cpp:167
NTupleSvc::DBaseEntries
std::vector< std::string > DBaseEntries
Definition: NTupleSvc.h:31
NTupleSvc::writeRecord
StatusCode writeRecord(NTuple::Tuple *tuple) override
Write single record to N tuple.
Definition: NTupleSvc.cpp:564
ISvcLocator
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
Definition: ISvcLocator.h:25
gaudirun.c
c
Definition: gaudirun.py:407
Service::name
const std::string & name() const override
Retrieve name of the service.
Definition: Service.cpp:289
IConversionSvc
Definition: IConversionSvc.h:37
Gaudi::Property
Implementation of property with value of concrete type.
Definition: Property.h:319
NTupleSvc::initialize
StatusCode initialize() override
DataSvc overrides: Initialize the service.
Definition: NTupleSvc.cpp:69
NTupleSvc::reinitialize
StatusCode reinitialize() override
DataSvc overrides: reinitialize service.
Definition: NTupleSvc.cpp:92
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
NTupleSvc::Connection::Connection
Connection(IConversionSvc *s)
Definition: NTupleSvc.h:28
NTupleSvc::disconnect
StatusCode disconnect(const std::string &nam) override
Close open connection.
Definition: NTupleSvc.cpp:176
graphanalysis.filename
string filename
Definition: graphanalysis.py:117
std::map< std::string, Connection >
IDataSourceMgr.h
NTupleSvc::updateDirectories
StatusCode updateDirectories()
Update directory data.
Definition: NTupleSvc.cpp:113
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
std::string
STL class.
DataSvc.h
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
NTupleSvc::Prop
std::pair< std::string, std::string > Prop
Definition: NTupleSvc.h:33
NTupleSvc::Connection::service
IConversionSvc * service
Definition: NTupleSvc.h:27
gaudirun.type
type
Definition: gaudirun.py:133
NTupleSvc::readRecord
StatusCode readRecord(NTuple::Tuple *tuple) override
Read single record from N tuple.
Definition: NTupleSvc.cpp:608
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
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
IRegistry
The IRegistry represents the entry door to the environment any data object residing in a transient da...
Definition: IRegistry.h:22
CLID
unsigned int CLID
Class ID definition.
Definition: ClassID.h:8
NTuple::Tuple
Abstract base class which allows the user to interact with the actual N tuple implementation.
Definition: NTuple.h:412
std::pair< std::string, std::string >
NTupleSvc::finalize
StatusCode finalize() override
DataSvc overrides: stop the service.
Definition: NTupleSvc.cpp:196
std::vector< std::string >
NTupleSvc::getDataLoader
IConversionSvc * getDataLoader(IRegistry *pReg) override
DataSvc overrides: Retrieve data loader.
Definition: NTupleSvc.cpp:102
NTupleSvc
NTuple service.
Definition: NTupleSvc.h:23
extends
Base class used to extend a class implementing other interfaces.
Definition: extends.h:10
NTupleSvc::Connection
Definition: NTupleSvc.h:26
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
NTupleSvc::m_input
Gaudi::Property< DBaseEntries > m_input
Definition: NTupleSvc.h:118
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
NTupleSvc::disconnectAll
StatusCode disconnectAll() override
Close all open connections.
Definition: NTupleSvc.cpp:188
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
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:986
NTupleSvc::Connection::Connection
Connection(const Connection &c)
Definition: NTupleSvc.h:29
INTupleSvc.h
NTupleSvc::~NTupleSvc
~NTupleSvc() override=default
Standard Destructor.
NTupleSvc::m_connections
Connections m_connections
Container of connection points.
Definition: NTupleSvc.h:122