| The Gaudi Framework v29r1 (5cd95fa2)

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

- File List
- File Members

RootCnvSvc.h
Go to the documentation of this file.
1 //====================================================================
2 // RootCnvSvc definition
3 //--------------------------------------------------------------------
4 //
5 // Author : M.Frank
6 //====================================================================
7 #ifndef GAUDIROOTCNV_GAUDIROOTCNVSVC_H
8 #define GAUDIROOTCNV_GAUDIROOTCNVSVC_H
9
10 // Framework include files
11 #include "GaudiKernel/ClassID.h"
12 #include "GaudiKernel/ConversionSvc.h"
13 #include "GaudiKernel/DataObject.h"
14
15 // C++ include files
16 #include <set>
17
18 // Forward declarations
19 class IDataManagerSvc;
20 class IIncidentSvc;
21 class TClass;
22
23 // ROOT include files
24 #include "TBranch.h"
25 #include "TClass.h"
26 #include "TROOT.h"
27 #include "TTree.h"
28
29 //#include "RootCnv/RootPerfMonSvc.h"
30
31 /*
32 * Gaudi namespace declaration
33 */
34 namespace Gaudi
35 {
36
37 // Forward declarations
38 class IIODataManager;
39 class IDataConnection;
40 class RootDataConnection;
41 class RootConnectionSetup;
42
53 class GAUDI_API RootCnvSvc : public ConversionSvc
54 {
55 protected:
56 Gaudi::Property<std::string> m_ioPerfStats{this, "IOPerfStats", "",
57 "Enable TTree IOperfStats if not empty; otherwise perf stat file name"};
58 Gaudi::Property<std::string> m_shareFiles{this, "ShareFiles", "NO",
59 "Share files? If set to YES, files will not be closed on finalize"};
60 Gaudi::Property<bool> m_incidentEnabled{this, "EnableIncident", true, "Flag to enable incidents on FILE_OPEN"};
61 Gaudi::Property<std::string> m_recordName{this, "RecordsName", "/FileRecords",
62 "Records name to fire incident for file records"};
63
64 // ROOT Write parameters
65 Gaudi::Property<int> m_autoFlush{this, "AutoFlush", 100,
66 "AutoFlush parameter for ROOT TTree (Number of events between auto flushes)"};
67 Gaudi::Property<int> m_basketSize{this, "BasketSize", 2 * 1024 * 1024 /*MBYTE*/,
68 "Basket optimization parameter for ROOT TTree (total basket size)"};
69 Gaudi::Property<int> m_bufferSize{this, "BufferSize", 2 * 1024 /*kBYTE*/,
70 "Buffer size optimization parameter for ROOT TTree"};
71 Gaudi::Property<int> m_splitLevel{this, "SplitLevel", 0, "Split level optimization parameter for ROOT TTree"};
72 Gaudi::Property<std::string> m_compression{this, "GlobalCompression", "",
73 "Compression-algorithm:compression-level, empty: do nothing"};
74
76 SmartIF<Gaudi::IIODataManager> m_ioMgr;
78 SmartIF<IIncidentSvc> m_incidentSvc;
80 Gaudi::RootDataConnection* m_current = nullptr;
82 TClass* m_classRefs = nullptr;
84 TClass* m_classDO = nullptr;
86 std::shared_ptr<RootConnectionSetup> m_setup;
88 std::string m_currSection;
89
91 std::set<std::string> m_badFiles;
92
94 std::unique_ptr<MsgStream> m_log;
95
97 TClass* getClass( DataObject* pObject );
99 MsgStream& log() const { return *m_log; }
100
101 public:
103 RootCnvSvc( const std::string& name, ISvcLocator* svc );
104
106 ~RootCnvSvc() override = default;
107
109 virtual StatusCode updateServiceState( IOpaqueAddress* /* pAddress */ ) override { return StatusCode::SUCCESS; }
110
116 StatusCode error( const std::string& msg );
117
124 StatusCode connectDatabase( const std::string& dataset, int mode, RootDataConnection** con );
125
127 StatusCode initialize() override;
128
130 StatusCode finalize() override;
131
133 IConverter* createConverter( long typ, const CLID& wanted, const ICnvFactory* fac ) override;
134
136 void loadConverter( DataObject* pObj ) override;
137
144 StatusCode connectOutput( const std::string& outputFile, const std::string& openMode ) override;
145
151 StatusCode connectOutput( const std::string& outputFile ) override;
152
163 StatusCode commitOutput( const std::string& outputFile, bool do_commit ) override;
164
170 virtual StatusCode disconnect( const std::string& dbName );
171
183 StatusCode createAddress( long svc_type, const CLID& clid, const std::string* par, const unsigned long* ip,
184 IOpaqueAddress*& refpAddress ) override;
185
195 StatusCode createAddress( long svc_type, const CLID& clid, const std::string& refAddress,
196 IOpaqueAddress*& refpAddress ) override
197 {
198 return this->ConversionSvc::createAddress( svc_type, clid, refAddress, refpAddress );
199 }
200
207 virtual StatusCode createNullRep( const std::string& path );
208
215 virtual StatusCode createNullRef( const std::string& path );
216
224 virtual StatusCode i__createRep( DataObject* pObj, IOpaqueAddress*& refpAddr );
225
233 virtual StatusCode i__fillRepRefs( IOpaqueAddress* pAddr, DataObject* pObj );
234
242 virtual StatusCode i__createObj( IOpaqueAddress* pAddr, DataObject*& refpObj );
243
251 virtual StatusCode i__fillObjRefs( IOpaqueAddress* pAddr, DataObject* pObj );
252 };
253 }
254
255 #endif // GAUDIROOTCNV_GAUDIROOTCNVSVC_H
MsgStream
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
StatusCode::SUCCESS
Definition: StatusCode.h:31
Gaudi::RootCnvSvc::log
MsgStream & log() const
Helper: Use message streamer.
Definition: RootCnvSvc.h:99
std::shared_ptr
SmartIF
Small smart pointer class with automatic reference counting for IInterface.
Definition: IConverter.h:15
ClassID.h
ISvcLocator
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
Definition: ISvcLocator.h:25
IConverter
The data converters are responsible to translate data from one representation into another...
Definition: IConverter.h:58
Gaudi::RootCnvSvc::updateServiceState
virtual StatusCode updateServiceState(IOpaqueAddress *) override
Update state of the service.
Definition: RootCnvSvc.h:109
Gaudi::RootCnvSvc::m_currSection
std::string m_currSection
Property: ROOT section name.
Definition: RootCnvSvc.h:88
GaudiPython.HistoUtils.path
path
Definition: HistoUtils.py:895
gaudiComponentHelp.name
name
Definition: gaudiComponentHelp.py:32
Gaudi::RootCnvSvc::m_incidentSvc
SmartIF< IIncidentSvc > m_incidentSvc
Reference to incident service.
Definition: RootCnvSvc.h:78
Gaudi::Property
Implementation of property with value of concrete type.
Definition: Property.h:319
ConversionSvc.h
Gaudi::RootCnvSvc::m_setup
std::shared_ptr< RootConnectionSetup > m_setup
Setup structure (ref-counted) and passed to data connections.
Definition: RootCnvSvc.h:86
GaudiPython.Bindings.getClass
def getClass(name, libs=[])
Definition: Bindings.py:143
Gaudi::RootCnvSvc
Description:
Definition: RootCnvSvc.h:53
std::string
STL class.
Gaudi::RootCnvSvc::createAddress
StatusCode createAddress(long svc_type, const CLID &clid, const std::string &refAddress, IOpaqueAddress *&refpAddress) override
IAddressCreator implementation: Creates an address in string form to object form. ...
Definition: RootCnvSvc.h:195
compareOutputFiles.par
string par
Definition: compareOutputFiles.py:437
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:28
Gaudi::RootCnvSvc::m_log
std::unique_ptr< MsgStream > m_log
Message streamer.
Definition: RootCnvSvc.h:94
ConversionSvc::createAddress
StatusCode createAddress(long svc_type, const CLID &clid, const std::string *par, const unsigned long *ip, IOpaqueAddress *&refpAddress) override
Create a Generic address using explicit arguments to identify a single object.
Definition: ConversionSvc.cpp:323
CLID
unsigned int CLID
Class ID definition.
Definition: ClassID.h:8
Gaudi::RootCnvSvc::m_badFiles
std::set< std::string > m_badFiles
Set with bad files/tables.
Definition: RootCnvSvc.h:91
std::set< std::string >
std::unique_ptr< MsgStream >
Gaudi::RootCnvSvc::m_ioMgr
SmartIF< Gaudi::IIODataManager > m_ioMgr
Reference to the I/O data manager.
Definition: RootCnvSvc.h:76
IDataManagerSvc
Definition: IDataManagerSvc.h:45
GaudiMP.FdsRegistry.msg
msg
Definition: FdsRegistry.py:8
IOpaqueAddress
Opaque address interface definition.
Definition: IOpaqueAddress.h:23
ConversionSvc
Base class for all conversion services.
Definition: ConversionSvc.h:45
GAUDI_API
#define GAUDI_API
Definition: Kernel.h:110
DataObject
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:29
Gaudi::RootDataConnection
Concrete implementation of the IDataConnection interface to access ROOT files.
Definition: RootDataConnection.h:94
Gaudi
Helper functions to set/get the application return code.
Definition: __init__.py:1
IIncidentSvc
The interface implemented by the IncidentSvc service.
Definition: IIncidentSvc.h:23
DataObject.h