ATLAS Offline Software
Loading...
Searching...
No Matches
AthenaPoolCnvSvc.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef ATHENAPOOLCNVSVC_ATHENAPOOLCNVSVC_H
6#define ATHENAPOOLCNVSVC_ATHENAPOOLCNVSVC_H
7
12
14
15#include "GaudiKernel/IClassIDSvc.h"
16#include "GaudiKernel/IIncidentListener.h"
17#include "GaudiKernel/IIoComponent.h"
18#include "GaudiKernel/ServiceHandle.h"
19#include "GaudiKernel/ToolHandle.h"
20
21#include "StorageSvc/DbType.h"
25#include "PoolSvc/IPoolSvc.h"
26
27#include <vector>
28#include <map>
29#include <mutex>
30#include <limits>
31
32// Forward declarations
33class Guid;
34
35template <class TYPE> class SvcFactory;
36
40class AthenaPoolCnvSvc : public extends<AthCnvSvc,
41 IAthenaPoolCnvSvc,
42 IIncidentListener,
43 IIoComponent> {
44 // Allow the factory class access to the constructor
45 friend class SvcFactory<AthenaPoolCnvSvc>;
46
47public:
48
50 virtual StatusCode initialize() override;
51 virtual StatusCode io_reinit() override;
53 virtual StatusCode finalize() override;
54 virtual StatusCode io_finalize() override;
55 virtual StatusCode stop() override;
56
60 virtual StatusCode createObj(IOpaqueAddress* pAddress, DataObject*& refpObject) override;
61
65 virtual StatusCode createRep(DataObject* pObject, IOpaqueAddress*& refpAddress) override;
66
70 virtual StatusCode fillRepRefs(IOpaqueAddress* pAddress, DataObject* pObject) override;
71
75 virtual StatusCode connectOutput(const std::string& outputConnectionSpec,
76 const std::string& openMode) override;
77
81 virtual StatusCode connectOutput(const std::string& outputConnectionSpec) override;
82
85 virtual StatusCode commitOutput(const std::string& outputConnectionSpec, bool doCommit) override;
86
88 virtual StatusCode disconnectOutput(const std::string& outputConnectionSpec) override;
89
91 virtual IPoolSvc* getPoolSvc() override;
92
97 virtual Token* registerForWrite(Placement* placement, const void* obj, const RootType& classDesc) override;
98
101 virtual void setObjPtr(void*& obj, const Token* token) override;
102
104 virtual bool useDetailChronoStat() const override;
105
112 StatusCode createAddress(long svcType,
113 const CLID& clid,
114 const std::string* par,
115 const unsigned long* ip,
116 IOpaqueAddress*& refpAddress) override;
117
123 virtual StatusCode createAddress(long svcType,
124 const CLID& clid,
125 const std::string& refAddress,
126 IOpaqueAddress*& refpAddress) override;
127
131 virtual StatusCode convertAddress(const IOpaqueAddress* pAddress, std::string& refAddress) override;
132
135 virtual StatusCode decodeOutputSpec(std::string& connectionSpec, int& outputTech) const override;
136
138 virtual StatusCode registerCleanUp(IAthenaPoolCleanUp* cnv) override;
139
141 virtual StatusCode cleanUp(const std::string& connection) override;
142
145 virtual StatusCode setInputAttributes(const std::string& fileName) override;
146
148 virtual void handle(const Incident& incident) override;
149
151 void flushDataHeaderForms(const std::string& streamName = "*");
152
154 AthenaPoolCnvSvc(const std::string& name, ISvcLocator* pSvcLocator);
156 virtual ~AthenaPoolCnvSvc() = default;
157
158private: // member functions
160 void extractPoolAttributes(const Gaudi::Property<std::vector<std::string>>& property,
161 std::vector<std::vector<std::string> >* contAttr,
162 std::vector<std::vector<std::string> >* dbAttr,
163 std::vector<std::vector<std::string> >* domAttr = 0) const;
164
166 StatusCode processPoolAttributes(std::vector<std::vector<std::string> >& attr,
167 const std::string& fileName,
168 unsigned long contextId,
169 bool doGet = true,
170 bool doSet = true,
171 bool doClear = true) const;
172
173private: // data
176 ServiceHandle<IPoolSvc> m_poolSvc{this,"PoolSvc","PoolSvc"};
177 ServiceHandle<IClassIDSvc> m_clidSvc{this,"ClassIDSvc","ClassIDSvc"};
178
179protected: // shared with derived services
182
183private: // properties
186 Gaudi::Property<bool> m_useDetailChronoStat{this,"UseDetailChronoStat",false};
187
189 Gaudi::Property<std::map<std::string, std::string>> m_storageTechProp{this, "StorageTechnology", {{"*","ROOTTREEINDEX"}}};
190 std::map<std::string, int> m_storageTechMap;
193 Gaudi::Property<std::string> m_containerPrefixProp{this,"PoolContainerPrefix","Default"};
195 Gaudi::Property<std::string> m_containerNameHintProp{this,"TopLevelContainerName",""};
197 Gaudi::Property<std::string> m_branchNameHintProp{this,"SubLevelBranchName", "<type>/<key>"};
198
200 Gaudi::Property<std::vector<std::string>> m_poolAttr{this,"PoolAttributes",{},"Pool Attributes","OrderedSet<std::string>"};
201 std::vector<std::vector<std::string> > m_domainAttr;
202 std::vector<std::vector<std::string> > m_databaseAttr;
203 std::vector<std::vector<std::string> > m_containerAttr;
204
206 Gaudi::Property<std::vector<std::string>> m_inputPoolAttr{this,"InputPoolAttributes",{}};
207 std::vector<std::vector<std::string> > m_inputAttr;
210 Gaudi::Property<std::vector<std::string>> m_inputPoolAttrPerEvent{this,"PrintInputAttrPerEvt",{}};
211 std::vector<std::vector<std::string> > m_inputAttrPerEvent;
212
214 std::string m_defContainerType{};
215
216protected: // properties
219 Gaudi::Property<bool> m_persSvcPerOutput{this,"PersSvcPerOutput",true};
220 unsigned outputContextId(const std::string& outputConnection);
221
224 Gaudi::Property<std::string> m_persSvcPerInputType{this,"PersSvcPerInputType",""};
225 std::mutex m_mutex;
226
228 std::set<unsigned int> m_processedContextIds;
229
231 Gaudi::Property<bool> m_oneDataHeaderForm { this, "OneDataHeaderForm", false };
232
234 Gaudi::Property<int> m_DHFormCacheSize { this, "maxDHFormCacheSize", 100 };
235
237 Gaudi::Property<bool> m_DHFilterAliases { this, "doFilterDHAliases", true };
238
239};
240
241#endif
uint32_t CLID
The Class ID type.
This file contains the class definition for the IAthenaPoolCnvSvc interface class.
This file contains the class definition for the IPoolSvc interface class.
TTypeAdapter RootType
Definition RootType.h:211
Gaudi::Property< int > m_DHFormCacheSize
Property for DataHeaderCnv input DHForm cache size.
ServiceHandle< IClassIDSvc > m_clidSvc
virtual IPoolSvc * getPoolSvc() override
StatusCode createAddress(long svcType, 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.
virtual void handle(const Incident &incident) override
Implementation of IIncidentListener: Handle for EndEvent incidence.
Gaudi::Property< bool > m_useDetailChronoStat
UseDetailChronoStat, enable detailed output for time and size statistics for AthenaPOOL: default = fa...
StatusCode processPoolAttributes(std::vector< std::vector< std::string > > &attr, const std::string &fileName, unsigned long contextId, bool doGet=true, bool doSet=true, bool doClear=true) const
Set/get technology dependent POOL attributes.
Gaudi::Property< std::string > m_containerNameHintProp
TopLevelContainerName, naming hint policy for top level POOL container: default = "<type>".
std::map< std::string, int > m_storageTechMap
std::vector< std::vector< std::string > > m_inputAttrPerEvent
virtual StatusCode io_finalize() override
virtual StatusCode stop() override
virtual StatusCode io_reinit() override
Gaudi::Property< std::string > m_containerPrefixProp
POOL Container name prefix - will be part of or whole TTree/RNTuple name 'Default' takes the prefix f...
virtual StatusCode registerCleanUp(IAthenaPoolCleanUp *cnv) override
Implement registerCleanUp to register a IAthenaPoolCleanUp to be called during cleanUp.
virtual StatusCode fillRepRefs(IOpaqueAddress *pAddress, DataObject *pObject) override
Implementation of IConversionSvc: Resolve the references of the converted object.
virtual StatusCode decodeOutputSpec(std::string &connectionSpec, int &outputTech) const override
Extract/deduce the DB technology from the connection string/file specification.
std::vector< std::vector< std::string > > m_databaseAttr
virtual StatusCode createObj(IOpaqueAddress *pAddress, DataObject *&refpObject) override
Implementation of IConversionSvc: Create the transient representation of an object from persistent st...
void extractPoolAttributes(const Gaudi::Property< std::vector< std::string > > &property, std::vector< std::vector< std::string > > *contAttr, std::vector< std::vector< std::string > > *dbAttr, std::vector< std::vector< std::string > > *domAttr=0) const
Extract POOL ItechnologySpecificAttributes for Domain, Database and Container from property.
virtual bool useDetailChronoStat() const override
std::vector< std::vector< std::string > > m_containerAttr
virtual Token * registerForWrite(Placement *placement, const void *obj, const RootType &classDesc) override
virtual StatusCode disconnectOutput(const std::string &outputConnectionSpec) override
Disconnect to the output connection.
Gaudi::Property< bool > m_oneDataHeaderForm
If true, use only one DataHeaderForm per Stream.
Gaudi::Property< std::string > m_persSvcPerInputType
PersSvcPerInputType, string property, tree name to use multiple persistency services,...
Gaudi::Property< std::vector< std::string > > m_inputPoolAttr
Input PoolAttributes, vector with names and values of technology specific attributes for POOL.
virtual StatusCode createRep(DataObject *pObject, IOpaqueAddress *&refpAddress) override
Implementation of IConversionSvc: Convert the transient object to the requested representation.
PMonUtils::BasicStopWatchResultMap_t m_chronoMap
Map that holds chrono information.
std::string m_defContainerType
Default container type (from PoolSvc)
virtual StatusCode connectOutput(const std::string &outputConnectionSpec, const std::string &openMode) override
Implementation of IConversionSvc: Connect to the output connection specification with open mode.
Gaudi::Property< bool > m_persSvcPerOutput
PersSvcPerOutput, boolean property to use multiple persistency services, one per output stream.
std::string m_lastInputFileName
decoded storage tech requested in "StorageTechnology" property
Gaudi::Property< bool > m_DHFilterAliases
Flag to control SG alias filtering when writing out DataHeader (see DataHeaderCnv_p6)
virtual StatusCode finalize() override
Required of all Gaudi Services.
Gaudi::Property< std::string > m_branchNameHintProp
SubLevelBranchName, naming hint policy for POOL branching: ("" = no branching)
virtual StatusCode commitOutput(const std::string &outputConnectionSpec, bool doCommit) override
Implementation of IConversionSvc: Commit pending output.
void flushDataHeaderForms(const std::string &streamName="*")
Tell DataHeaderCnv to write out all DataHeaderForms for a given streamName (default is all)
ServiceHandle< IPoolSvc > m_poolSvc
std::set< unsigned int > m_processedContextIds
Track context IDs for which extractPoolAttributes has been called.
virtual StatusCode cleanUp(const std::string &connection) override
Implement cleanUp to call all registered IAthenaPoolCleanUp cleanUp() function.
std::vector< std::vector< std::string > > m_inputAttr
virtual ~AthenaPoolCnvSvc()=default
Destructor.
virtual StatusCode convertAddress(const IOpaqueAddress *pAddress, std::string &refAddress) override
Convert address to string form.
Gaudi::Property< std::map< std::string, std::string > > m_storageTechProp
Default Storage Tech for containers (ROOTTREE, ROOTTREEINDEX, ROOTRNTUPLE)
virtual void setObjPtr(void *&obj, const Token *token) override
std::vector< std::vector< std::string > > m_domainAttr
Gaudi::Property< std::vector< std::string > > m_poolAttr
Output PoolAttributes, vector with names and values of technology specific attributes for POOL.
virtual StatusCode setInputAttributes(const std::string &fileName) override
Set the input file attributes, if any are requested from jobOpts.
Gaudi::Property< std::vector< std::string > > m_inputPoolAttrPerEvent
Print input PoolAttributes per event, vector with names of technology specific attributes for POOL to...
This class provides a encapsulation of a GUID/UUID/CLSID/IID data structure (128 bit number).
Definition Guid.h:25
This class provides the interface for the AthenaPoolCleanUp which is used to clean up AthenaPoolConve...
This class provides the interface to the LCG POOL persistency software.
Definition IPoolSvc.h:36
This class holds all the necessary information to guide the writing of an object in a physical place.
Definition Placement.h:19
This class provides a token that identifies in a unique way objects on the persistent storage.
Definition Token.h:21
tbb::concurrent_hash_map< std::string, double > BasicStopWatchResultMap_t
void initialize()