| The Gaudi Framework v32r1 (f65d50dc)

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 #include "GaudiUtils/IIODataManager.h"
15
16 // C++ include files
17 #include <set>
18
19 // Forward declarations
20 struct IDataManagerSvc;
21 class IIncidentSvc;
22 class TClass;
23
24 // ROOT include files
25 #include "TBranch.h"
26 #include "TClass.h"
27 #include "TROOT.h"
28 #include "TTree.h"
29
30 //#include "RootCnv/RootPerfMonSvc.h"
31
32 /*
33 * Gaudi namespace declaration
34 */
35 namespace Gaudi {
36
37 // Forward declarations
38 class IDataConnection;
39 class RootDataConnection;
40 class RootConnectionSetup;
41
52 class GAUDI_API RootCnvSvc : public ConversionSvc {
53 protected:
54 Gaudi::Property<std::string> m_ioPerfStats{this, "IOPerfStats", "",
55 "Enable TTree IOperfStats if not empty; otherwise perf stat file name"};
56 Gaudi::Property<std::string> m_shareFiles{this, "ShareFiles", "NO",
57 "Share files? If set to YES, files will not be closed on finalize"};
58 Gaudi::Property<bool> m_incidentEnabled{this, "EnableIncident", true, "Flag to enable incidents on FILE_OPEN"};
59 Gaudi::Property<std::string> m_recordName{this, "RecordsName", "/FileRecords",
60 "Records name to fire incident for file records"};
61
62 // ROOT Write parameters
63 Gaudi::Property<int> m_autoFlush{this, "AutoFlush", 100,
64 "AutoFlush parameter for ROOT TTree (Number of events between auto flushes)"};
65 Gaudi::Property<int> m_basketSize{this, "BasketSize", 2 * 1024 * 1024 /*MBYTE*/,
66 "Basket optimization parameter for ROOT TTree (total basket size)"};
67 Gaudi::Property<int> m_bufferSize{this, "BufferSize", 2 * 1024 /*kBYTE*/,
68 "Buffer size optimization parameter for ROOT TTree"};
69 Gaudi::Property<int> m_splitLevel{this, "SplitLevel", 0, "Split level optimization parameter for ROOT TTree"};
70 Gaudi::Property<std::string> m_compression{this, "GlobalCompression", "",
71 "Compression-algorithm:compression-level, empty: do nothing"};
72
74 SmartIF<Gaudi::IIODataManager> m_ioMgr;
76 SmartIF<IIncidentSvc> m_incidentSvc;
78 Gaudi::RootDataConnection* m_current = nullptr;
80 TClass* m_classRefs = nullptr;
82 TClass* m_classDO = nullptr;
84 std::shared_ptr<RootConnectionSetup> m_setup;
86 std::string m_currSection;
87
89 std::set<std::string> m_badFiles;
90
92 std::unique_ptr<MsgStream> m_log;
93
95 TClass* getClass( DataObject* pObject );
97 MsgStream& log() const { return *m_log; }
98
99 public:
101 RootCnvSvc( const std::string& name, ISvcLocator* svc );
102
104 StatusCode updateServiceState( IOpaqueAddress* /* pAddress */ ) override { return StatusCode::SUCCESS; }
105
111 StatusCode error( const std::string& msg );
112
119 StatusCode connectDatabase( const std::string& dataset, int mode, RootDataConnection** con );
120
122 StatusCode initialize() override;
123
125 StatusCode finalize() override;
126
128 IConverter* createConverter( long typ, const CLID& wanted, const ICnvFactory* fac ) override;
129
131 void loadConverter( DataObject* pObj ) override;
132
139 StatusCode connectOutput( const std::string& outputFile, const std::string& openMode ) override;
140
146 StatusCode connectOutput( const std::string& outputFile ) override;
147
158 StatusCode commitOutput( const std::string& outputFile, bool do_commit ) override;
159
165 virtual StatusCode disconnect( const std::string& dbName );
166
178 StatusCode createAddress( long svc_type, const CLID& clid, const std::string* par, const unsigned long* ip,
179 IOpaqueAddress*& refpAddress ) override;
180
190 StatusCode createAddress( long svc_type, const CLID& clid, const std::string& refAddress,
191 IOpaqueAddress*& refpAddress ) override {
192 return this->ConversionSvc::createAddress( svc_type, clid, refAddress, refpAddress );
193 }
194
201 virtual StatusCode createNullRep( const std::string& path );
202
209 virtual StatusCode createNullRef( const std::string& path );
210
218 virtual StatusCode i__createRep( DataObject* pObj, IOpaqueAddress*& refpAddr );
219
227 virtual StatusCode i__fillRepRefs( IOpaqueAddress* pAddr, DataObject* pObj );
228
236 virtual StatusCode i__createObj( IOpaqueAddress* pAddr, DataObject*& refpObj );
237
245 virtual StatusCode i__fillObjRefs( IOpaqueAddress* pAddr, DataObject* pObj );
246 };
247 } // namespace Gaudi
248
249 #endif // GAUDIROOTCNV_GAUDIROOTCNVSVC_H
MsgStream
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
std::shared_ptr
STL class.
SmartIF< Gaudi::IIODataManager >
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::m_currSection
std::string m_currSection
Property: ROOT section name.
Definition: RootCnvSvc.h:86
GaudiPython.HistoUtils.path
path
Definition: HistoUtils.py:932
gaudiComponentHelp.name
name
Definition: gaudiComponentHelp.py:41
Gaudi::RootCnvSvc::m_incidentSvc
SmartIF< IIncidentSvc > m_incidentSvc
Reference to incident service.
Definition: RootCnvSvc.h:76
Gaudi::Property
Implementation of property with value of concrete type.
Definition: Property.h:352
IDataManagerSvc
Definition: IDataManagerSvc.h:45
ConversionSvc.h
Gaudi::RootCnvSvc::m_setup
std::shared_ptr< RootConnectionSetup > m_setup
Setup structure (ref-counted) and passed to data connections.
Definition: RootCnvSvc.h:84
GaudiPython.Bindings.getClass
def getClass(name, libs=[])
Definition: Bindings.py:152
StatusCode::SUCCESS
constexpr static const auto SUCCESS
Definition: StatusCode.h:85
Gaudi::RootCnvSvc
Description:
Definition: RootCnvSvc.h:52
Gaudi::RootCnvSvc::log
MsgStream & log() const
Helper: Use message streamer.
Definition: RootCnvSvc.h:97
IIODataManager.h
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:190
compareOutputFiles.par
string par
Definition: compareOutputFiles.py:465
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:50
Gaudi::RootCnvSvc::m_log
std::unique_ptr< MsgStream > m_log
Message streamer.
Definition: RootCnvSvc.h:92
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:289
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:89
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:74
GaudiMP.FdsRegistry.msg
msg
Definition: FdsRegistry.py:8
Gaudi::RootCnvSvc::updateServiceState
StatusCode updateServiceState(IOpaqueAddress *) override
Update state of the service.
Definition: RootCnvSvc.h:104
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:71
DataObject
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:30
Gaudi::RootDataConnection
Concrete implementation of the IDataConnection interface to access ROOT files.
Definition: RootDataConnection.h:93
Gaudi
Header file for std:chrono::duration-based Counters.
Definition: __init__.py:1
IIncidentSvc
The interface implemented by the IncidentSvc service.
Definition: IIncidentSvc.h:23
DataObject.h