Loading [MathJax]/extensions/tex2jax.js
The Gaudi Framework  v31r0 (aeb156f0)
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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"
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 
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 
78  Gaudi::RootDataConnection* m_current = nullptr;
80  TClass* m_classRefs = nullptr;
82  TClass* m_classDO = nullptr;
87 
90 
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
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
MsgStream & log() const
Helper: Use message streamer.
Definition: RootCnvSvc.h:97
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
std::string m_currSection
Property: ROOT section name.
Definition: RootCnvSvc.h:86
SmartIF< IIncidentSvc > m_incidentSvc
Reference to incident service.
Definition: RootCnvSvc.h:76
Implementation of property with value of concrete type.
Definition: Property.h:352
std::shared_ptr< RootConnectionSetup > m_setup
Setup structure (ref-counted) and passed to data connections.
Definition: RootCnvSvc.h:84
def getClass(name, libs=[])
Definition: Bindings.py:152
constexpr static const auto SUCCESS
Definition: StatusCode.h:85
Description:
Definition: RootCnvSvc.h:52
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:190
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:50
std::unique_ptr< MsgStream > m_log
Message streamer.
Definition: RootCnvSvc.h:92
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:89
SmartIF< Gaudi::IIODataManager > m_ioMgr
Reference to the I/O data manager.
Definition: RootCnvSvc.h:74
StatusCode updateServiceState(IOpaqueAddress *) override
Update state of the service.
Definition: RootCnvSvc.h:104
Opaque address interface definition.
Base class for all conversion services.
Definition: ConversionSvc.h:45
#define GAUDI_API
Definition: Kernel.h:71
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:30
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