The Gaudi Framework  v29r0 (ff2e7097)
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"
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 
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 
80  Gaudi::RootDataConnection* m_current = nullptr;
82  TClass* m_classRefs = nullptr;
84  TClass* m_classDO = nullptr;
89 
92 
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
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
MsgStream & log() const
Helper: Use message streamer.
Definition: RootCnvSvc.h:99
Small smart pointer class with automatic reference counting for IInterface.
Definition: IConverter.h:15
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
Definition: ISvcLocator.h:25
The data converters are responsible to translate data from one representation into another...
Definition: IConverter.h:58
virtual StatusCode updateServiceState(IOpaqueAddress *) override
Update state of the service.
Definition: RootCnvSvc.h:109
std::string m_currSection
Property: ROOT section name.
Definition: RootCnvSvc.h:88
SmartIF< IIncidentSvc > m_incidentSvc
Reference to incident service.
Definition: RootCnvSvc.h:78
Implementation of property with value of concrete type.
Definition: Property.h:319
std::shared_ptr< RootConnectionSetup > m_setup
Setup structure (ref-counted) and passed to data connections.
Definition: RootCnvSvc.h:86
def getClass(name, libs=[])
Definition: Bindings.py:143
Description:
Definition: RootCnvSvc.h:53
STL class.
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
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:28
std::unique_ptr< MsgStream > m_log
Message streamer.
Definition: RootCnvSvc.h:94
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.
unsigned int CLID
Class ID definition.
Definition: ClassID.h:8
std::set< std::string > m_badFiles
Set with bad files/tables.
Definition: RootCnvSvc.h:91
SmartIF< Gaudi::IIODataManager > m_ioMgr
Reference to the I/O data manager.
Definition: RootCnvSvc.h:76
Opaque address interface definition.
Base class for all conversion services.
Definition: ConversionSvc.h:45
#define GAUDI_API
Definition: Kernel.h:110
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:29
Concrete implementation of the IDataConnection interface to access ROOT files.
Helper functions to set/get the application return code.
Definition: __init__.py:1
The interface implemented by the IncidentSvc service.
Definition: IIncidentSvc.h:23