Loading [MathJax]/extensions/tex2jax.js
The Gaudi Framework  v31r0 (aeb156f0)
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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"
8 
9 // STL include files
10 #include <map>
11 
23 class NTupleSvc : public extends<DataSvc, INTupleSvc, IDataSourceMgr> {
24 protected:
25  struct Connection final {
27  Connection( IConversionSvc* s ) : service( s ) {}
28  Connection( const Connection& c ) : service( c.service ) {}
29  };
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 );
113 
114  Gaudi::Property<DBaseEntries> m_input{this, "Input", {}, "input streams"};
115  Gaudi::Property<DBaseEntries> m_output{this, "Output", {}, "output streams"};
116 
119 };
120 
121 #endif // GAUDI_NTUPLESVC_H
void releaseConnection(Connection &c)
Finalize single service.
Definition: NTupleSvc.cpp:150
std::vector< std::string > DBaseEntries
Definition: NTupleSvc.h:30
StatusCode writeRecord(NTuple::Tuple *tuple) override
Write single record to N tuple.
Definition: NTupleSvc.cpp:522
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
Definition: ISvcLocator.h:25
const std::string & name() const override
Retrieve name of the service.
Definition: Service.cpp:274
Implementation of property with value of concrete type.
Definition: Property.h:352
StatusCode initialize() override
DataSvc overrides: Initialize the service.
Definition: NTupleSvc.cpp:57
StatusCode reinitialize() override
DataSvc overrides: reinitialize service.
Definition: NTupleSvc.cpp:79
std::map< std::string, Connection > m_connections
Container of connection points.
Definition: NTupleSvc.h:118
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:322
NTuple::Tuple * access(const std::string &fullPath, const std::string &filename) override
Access N tuple on disk.
Definition: NTupleSvc.cpp:486
Connection(IConversionSvc *s)
Definition: NTupleSvc.h:27
StatusCode disconnect(const std::string &nam) override
Close open connection.
Definition: NTupleSvc.cpp:158
STL class.
StatusCode updateDirectories()
Update directory data.
Definition: NTupleSvc.cpp:98
StatusCode createService(const std::string &nam, const std::string &typ, const std::vector< Prop > &props, IConversionSvc *&pSvc)
Create conversion service.
Definition: NTupleSvc.cpp:250
STL class.
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:50
std::pair< std::string, std::string > Prop
Definition: NTupleSvc.h:31
IConversionSvc * service
Definition: NTupleSvc.h:26
StatusCode readRecord(NTuple::Tuple *tuple) override
Read single record from N tuple.
Definition: NTupleSvc.cpp:562
NTupleSvc(const std::string &name, ISvcLocator *svc)
Standard Constructor.
Definition: NTupleSvc.cpp:51
Gaudi::Property< DBaseEntries > m_output
Definition: NTupleSvc.h:115
NTuple::Directory * createDirectory(DataObject *pParent, const std::string &title) override
Create Ntuple directory and register it with the data store.
Definition: NTupleSvc.cpp:395
bool isConnected(const std::string &identifier) const override
Check if a datasource is connected.
Definition: NTupleSvc.cpp:82
The IRegistry represents the entry door to the environment any data object residing in a transient da...
Definition: IRegistry.h:22
unsigned int CLID
Class ID definition.
Definition: ClassID.h:8
Abstract base class which allows the user to interact with the actual N tuple implementation.
Definition: NTuple.h:375
StatusCode finalize() override
DataSvc overrides: stop the service.
Definition: NTupleSvc.cpp:174
IConversionSvc * getDataLoader(IRegistry *pReg) override
DataSvc overrides: Retrieve data loader.
Definition: NTupleSvc.cpp:88
NTuple service.
Definition: NTupleSvc.h:23
Base class used to extend a class implementing other interfaces.
Definition: extends.h:10
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:489
string s
Definition: gaudirun.py:312
Gaudi::Property< DBaseEntries > m_input
Definition: NTupleSvc.h:114
StatusCode connect(const std::string &ident) override
Add file to list I/O list.
Definition: NTupleSvc.cpp:182
StatusCode create(const CLID &typ, const std::string &title, NTuple::Tuple *&refpTuple) override
Create requested N tuple (Hide constructor)
Definition: NTupleSvc.cpp:303
Small class representing an N tuple directory in the transient store.
Definition: NTuple.h:901
StatusCode disconnectAll() override
Close all open connections.
Definition: NTupleSvc.cpp:167
StatusCode attachTuple(const std::string &filename, const std::string &logname, const char typ, const long t)
Attach output/input file.
Definition: NTupleSvc.cpp:428
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:30
Connection(const Connection &c)
Definition: NTupleSvc.h:28