The Gaudi Framework  master (ff829712)
Loading...
Searching...
No Matches
RootCnvSvc.h
Go to the documentation of this file.
1/***********************************************************************************\
2* (c) Copyright 1998-2025 CERN for the benefit of the LHCb and ATLAS collaborations *
3* *
4* This software is distributed under the terms of the Apache version 2 licence, *
5* copied verbatim in the file "LICENSE". *
6* *
7* In applying this licence, CERN does not waive the privileges and immunities *
8* granted to it by virtue of its status as an Intergovernmental Organization *
9* or submit itself to any jurisdiction. *
10\***********************************************************************************/
11//====================================================================
12// RootCnvSvc definition
13//--------------------------------------------------------------------
14//
15// Author : M.Frank
16//====================================================================
17#pragma once
18
19// Framework include files
20#include <GaudiKernel/ClassID.h>
24
25// C++ include files
26#include <set>
27
28// Forward declarations
29struct IDataManagerSvc;
30class IIncidentSvc;
31class TClass;
32
33// ROOT include files
34#include <TBranch.h>
35#include <TClass.h>
36#include <TROOT.h>
37#include <TTree.h>
38
39// #include "RootCnv/RootPerfMonSvc.h"
40
41/*
42 * Gaudi namespace declaration
43 */
44namespace Gaudi {
45
46 // Forward declarations
47 class IDataConnection;
50
62 protected:
64 this, "IOPerfStats", "", "Enable TTree IOperfStats if not empty; otherwise perf stat file name" };
65 Gaudi::Property<std::string> m_shareFiles{ this, "ShareFiles", "NO",
66 "Share files? If set to YES, files will not be closed on finalize" };
67 Gaudi::Property<bool> m_incidentEnabled{ this, "EnableIncident", true, "Flag to enable incidents on FILE_OPEN" };
68 Gaudi::Property<std::string> m_recordName{ this, "RecordsName", "/FileRecords",
69 "Records name to fire incident for file records" };
70
71 // ROOT Write parameters
72 Gaudi::Property<int> m_minBufferSize{ this, "MinBufferSize", 2 * 1024 /*kBYTE*/,
73 "Minimum buffer size to use for writing TTree baskets" };
74 Gaudi::Property<int> m_maxBufferSize{ this, "MaxBufferSize", 100 * 1024 * 1024 /*MBYTE*/,
75 "Maximum buffer size to use for writing TTree baskets" };
76 Gaudi::Property<int> m_approxEventsPerBasket{ this, "ApproxEventsPerBasket", 1000,
77 "Resize TBasket buffers to fit approximately this many events" };
78 Gaudi::Property<int> m_splitLevel{ this, "SplitLevel", 0, "Split level optimization parameter for ROOT TTree" };
79 Gaudi::Property<std::string> m_compression{ this, "GlobalCompression", "",
80 "Compression-algorithm:compression-level, empty: do nothing" };
81
89 TClass* m_classRefs = nullptr;
91 TClass* m_classDO = nullptr;
93 std::shared_ptr<RootConnectionSetup> m_setup;
95 std::string m_currSection;
96
98 std::set<std::string> m_badFiles;
99
101 std::unique_ptr<MsgStream> m_log;
102
104 TClass* getClass( DataObject* pObject );
106 MsgStream& log() const { return *m_log; }
107
108 public:
110 RootCnvSvc( const std::string& name, ISvcLocator* svc );
111
113 StatusCode updateServiceState( IOpaqueAddress* /* pAddress */ ) override { return StatusCode::SUCCESS; }
114
120 StatusCode error( const std::string& msg );
121
128 StatusCode connectDatabase( const std::string& dataset, int mode, RootDataConnection** con );
129
131 StatusCode initialize() override;
132
134 StatusCode finalize() override;
135
137 IConverter* createConverter( long typ, const CLID& wanted, const ICnvFactory* fac ) override;
138
140 void loadConverter( DataObject* pObj ) override;
141
148 StatusCode connectOutput( const std::string& outputFile, const std::string& openMode ) override;
149
155 StatusCode connectOutput( const std::string& outputFile ) override;
156
167 StatusCode commitOutput( const std::string& outputFile, bool do_commit ) override;
168
174 virtual StatusCode disconnect( const std::string& dbName );
175
187 StatusCode createAddress( long svc_type, const CLID& clid, const std::string* par, const unsigned long* ip,
188 IOpaqueAddress*& refpAddress ) override;
189
199 StatusCode createAddress( long svc_type, const CLID& clid, const std::string& refAddress,
200 IOpaqueAddress*& refpAddress ) override {
201 return this->ConversionSvc::createAddress( svc_type, clid, refAddress, refpAddress );
202 }
203
210 virtual StatusCode createNullRep( const std::string& path );
211
218 virtual StatusCode createNullRef( const std::string& path );
219
227 virtual StatusCode i__createRep( DataObject* pObj, IOpaqueAddress*& refpAddr );
228
236 virtual StatusCode i__fillRepRefs( IOpaqueAddress* pAddr, DataObject* pObj );
237
245 virtual StatusCode i__createObj( IOpaqueAddress* pAddr, DataObject*& refpObj );
246
254 virtual StatusCode i__fillObjRefs( IOpaqueAddress* pAddr, DataObject* pObj );
255 };
256} // namespace Gaudi
unsigned int CLID
Class ID definition.
Definition ClassID.h:16
#define GAUDI_API
Definition Kernel.h:49
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.
ConversionSvc(const std::string &name, ISvcLocator *svc, long type)
Standard Constructor.
A DataObject is the base class of any identifiable object on any data store.
Definition DataObject.h:37
ABC describing basic data connection.
Implementation of property with value of concrete type.
Definition PropertyFwd.h:27
Description:
Definition RootCnvSvc.h:61
virtual StatusCode disconnect(const std::string &dbName)
Disconnect from an existing data stream.
TClass * m_classDO
TClass pointer to DataObject class.
Definition RootCnvSvc.h:91
StatusCode connectOutput(const std::string &outputFile, const std::string &openMode) override
Connect the output file to the service with open mode.
Gaudi::Property< int > m_approxEventsPerBasket
Definition RootCnvSvc.h:76
SmartIF< IIncidentSvc > m_incidentSvc
Reference to incident service.
Definition RootCnvSvc.h:85
TClass * getClass(DataObject *pObject)
Helper: Get TClass for a given DataObject pointer.
MsgStream & log() const
Helper: Use message streamer.
Definition RootCnvSvc.h:106
StatusCode connectOutput(const std::string &outputFile) override
Connect the output file to the service.
StatusCode updateServiceState(IOpaqueAddress *) override
Update state of the service.
Definition RootCnvSvc.h:113
Gaudi::Property< int > m_maxBufferSize
Definition RootCnvSvc.h:74
Gaudi::Property< bool > m_incidentEnabled
Definition RootCnvSvc.h:67
Gaudi::Property< int > m_splitLevel
Definition RootCnvSvc.h:78
Gaudi::RootDataConnection * m_current
On writing: reference to active output stream.
Definition RootCnvSvc.h:87
StatusCode createAddress(long svc_type, const CLID &clid, const std::string *par, const unsigned long *ip, IOpaqueAddress *&refpAddress) override
IAddressCreator implementation: Address creation.
TClass * m_classRefs
TClass pointer to reference class.
Definition RootCnvSvc.h:89
SmartIF< Gaudi::IIODataManager > m_ioMgr
Reference to the I/O data manager.
Definition RootCnvSvc.h:83
RootCnvSvc(const std::string &name, ISvcLocator *svc)
Standard constructor.
std::string m_currSection
Property: ROOT section name.
Definition RootCnvSvc.h:95
Gaudi::Property< std::string > m_compression
Definition RootCnvSvc.h:79
StatusCode commitOutput(const std::string &outputFile, bool do_commit) override
Commit pending output.
std::shared_ptr< RootConnectionSetup > m_setup
Setup structure (ref-counted) and passed to data connections.
Definition RootCnvSvc.h:93
Gaudi::Property< std::string > m_ioPerfStats
Definition RootCnvSvc.h:63
Gaudi::Property< std::string > m_recordName
Definition RootCnvSvc.h:68
std::unique_ptr< MsgStream > m_log
Message streamer.
Definition RootCnvSvc.h:101
Gaudi::Property< int > m_minBufferSize
Definition RootCnvSvc.h:72
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:199
std::set< std::string > m_badFiles
Set with bad files/tables.
Definition RootCnvSvc.h:98
Gaudi::Property< std::string > m_shareFiles
Definition RootCnvSvc.h:65
Concrete implementation of the IDataConnection interface to access ROOT files.
The data converters are responsible to translate data from one representation into another.
Definition IConverter.h:65
The interface implemented by the IncidentSvc service.
Opaque address interface definition.
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
Definition ISvcLocator.h:42
Definition of the MsgStream class used to transmit messages.
Definition MsgStream.h:29
Small smart pointer class with automatic reference counting for IInterface.
Definition SmartIF.h:28
This class is used for returning status codes from appropriate routines.
Definition StatusCode.h:64
constexpr static const auto SUCCESS
Definition StatusCode.h:99
This file provides a Grammar for the type Gaudi::Accumulators::Axis It allows to use that type from p...
Definition __init__.py:1