| The Gaudi Framework v32r1 (f65d50dc)

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 protected:
25 struct Connection final {
26 IConversionSvc* service;
27 Connection( IConversionSvc* s ) : service( s ) {}
28 Connection( const Connection& c ) : service( c.service ) {}
29 };
30 typedef std::vector<std::string> DBaseEntries;
31 typedef std::pair<std::string, std::string> Prop;
32
33 public:
35 StatusCode initialize() override;
37 StatusCode reinitialize() override;
39 StatusCode finalize() override;
41 IConversionSvc* getDataLoader( IRegistry* pReg ) override;
42
44 NTuple::Directory* createDirectory( DataObject* pParent, const std::string& title ) override;
46 NTuple::Directory* createDirectory( DataObject* pParent, long id ) override;
48 NTuple::Directory* createDirectory( const std::string& dirPath, long id ) override;
50 NTuple::Directory* createDirectory( const std::string& dirPath, const std::string& title ) override;
52 NTuple::Directory* createDirectory( const std::string& fullPath ) override;
53
55 StatusCode create( const CLID& typ, const std::string& title, NTuple::Tuple*& refpTuple ) override;
57 NTuple::Tuple* book( const std::string& fullPath, const CLID& type, const std::string& title ) override;
59 NTuple::Tuple* book( const std::string& dirPath, const std::string& relPath, const CLID& type,
60 const std::string& title ) override;
62 NTuple::Tuple* book( const std::string& dirPath, long id, const CLID& type, const std::string& title ) override;
64 NTuple::Tuple* book( DataObject* pParent, const std::string& relPath, const CLID& type,
65 const std::string& title ) override;
67 NTuple::Tuple* book( DataObject* pParent, long id, const CLID& type, const std::string& title ) override;
69 NTuple::Tuple* access( const std::string& fullPath, const std::string& filename ) override;
71 StatusCode save( const std::string& fullPath ) override;
73 StatusCode save( NTuple::Tuple* tuple ) override;
75 StatusCode save( DataObject* pParent, const std::string& relPath ) override;
77 StatusCode writeRecord( NTuple::Tuple* tuple ) override;
79 StatusCode writeRecord( const std::string& fullPath ) override;
81 StatusCode writeRecord( DataObject* pParent, const std::string& relPath ) override;
83 StatusCode readRecord( NTuple::Tuple* tuple ) override;
85 StatusCode readRecord( const std::string& fullPath ) override;
87 StatusCode readRecord( DataObject* pParent, const std::string& relPath ) override;
88
90 bool isConnected( const std::string& identifier ) const override;
92 StatusCode connect( const std::string& ident ) override;
94 StatusCode connect( const std::string& ident, std::string& logname ) override;
96 StatusCode disconnect( const std::string& nam ) override;
98 StatusCode disconnectAll() override;
99
101 NTupleSvc( const std::string& name, ISvcLocator* svc );
102
103 protected:
105 StatusCode createService( const std::string& nam, const std::string& typ, const std::vector<Prop>& props,
106 IConversionSvc*& pSvc );
108 void releaseConnection( Connection& c );
110 StatusCode attachTuple( const std::string& filename, const std::string& logname, const char typ, const long t );
112 StatusCode updateDirectories();
113
114 Gaudi::Property<DBaseEntries> m_input{this, "Input", {}, "input streams"};
115 Gaudi::Property<DBaseEntries> m_output{this, "Output", {}, "output streams"};
116
118 std::map<std::string, Connection> m_connections;
119 };
120
121 #endif // GAUDI_NTUPLESVC_H
NTupleSvc::releaseConnection
void releaseConnection(Connection &c)
Finalize single service.
Definition: NTupleSvc.cpp:148
NTupleSvc::DBaseEntries
std::vector< std::string > DBaseEntries
Definition: NTupleSvc.h:30
NTupleSvc::writeRecord
StatusCode writeRecord(NTuple::Tuple *tuple) override
Write single record to N tuple.
Definition: NTupleSvc.cpp:520
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:487
IConversionSvc
Definition: IConversionSvc.h:37
Gaudi::Property
Implementation of property with value of concrete type.
Definition: Property.h:352
NTupleSvc::initialize
StatusCode initialize() override
DataSvc overrides: Initialize the service.
Definition: NTupleSvc.cpp:57
NTupleSvc::isConnected
bool isConnected(const std::string &identifier) const override
Check if a datasource is connected.
Definition: NTupleSvc.cpp:82
NTupleSvc::reinitialize
StatusCode reinitialize() override
DataSvc overrides: reinitialize service.
Definition: NTupleSvc.cpp:79
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
NTupleSvc::Connection::Connection
Connection(IConversionSvc *s)
Definition: NTupleSvc.h:27
NTupleSvc::disconnect
StatusCode disconnect(const std::string &nam) override
Close open connection.
Definition: NTupleSvc.cpp:156
graphanalysis.filename
string filename
Definition: graphanalysis.py:119
std::map
STL class.
IDataSourceMgr.h
NTupleSvc::updateDirectories
StatusCode updateDirectories()
Update directory data.
Definition: NTupleSvc.cpp:98
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.
DataSvc.h
Service::name
const std::string & name() const override
Retrieve name of the service.
Definition: Service.cpp:274
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:50
NTupleSvc::Prop
std::pair< std::string, std::string > Prop
Definition: NTupleSvc.h:31
NTupleSvc::Connection::service
IConversionSvc * service
Definition: NTupleSvc.h:26
gaudirun.type
type
Definition: gaudirun.py:142
NTupleSvc::readRecord
StatusCode readRecord(NTuple::Tuple *tuple) override
Read single record from N tuple.
Definition: NTupleSvc.cpp:560
NTupleSvc::NTupleSvc
NTupleSvc(const std::string &name, ISvcLocator *svc)
Standard Constructor.
Definition: NTupleSvc.cpp:51
NTupleSvc::m_output
Gaudi::Property< DBaseEntries > m_output
Definition: NTupleSvc.h:115
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
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:375
std::pair< std::string, std::string >
NTupleSvc::finalize
StatusCode finalize() override
DataSvc overrides: stop the service.
Definition: NTupleSvc.cpp:172
std::vector< std::string >
NTupleSvc::getDataLoader
IConversionSvc * getDataLoader(IRegistry *pReg) override
DataSvc overrides: Retrieve data loader.
Definition: NTupleSvc.cpp:88
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:25
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
gaudirun.s
string s
Definition: gaudirun.py:316
NTupleSvc::m_input
Gaudi::Property< DBaseEntries > m_input
Definition: NTupleSvc.h:114
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
NTupleSvc::disconnectAll
StatusCode disconnectAll() override
Close all open connections.
Definition: NTupleSvc.cpp:165
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
DataObject
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:30
NTupleSvc::Connection::Connection
Connection(const Connection &c)
Definition: NTupleSvc.h:28
INTupleSvc.h