ATLAS Offline Software
IOVSvc.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef IOVSVC_IOVSVC_H
6 #define IOVSVC_IOVSVC_H
7 
8 /*****************************************************************************
9  *
10  * IOVSvc.h
11  * IOVSvc
12  *
13  * Author: Charles Leggett
14  *
15  * Provides automatic updating and callbacks for time dependent data
16  *
17  *****************************************************************************/
18 
20 #include "GaudiKernel/StatusCode.h"
21 #include "GaudiKernel/ClassID.h"
22 #include "GaudiKernel/MsgStream.h"
23 #include "SGTools/DataProxy.h"
24 #include "AthenaKernel/IIOVSvc.h"
25 #include "IOVEntry.h"
26 #include "SGTools/CallBackID.h"
27 #include "AthenaKernel/IOVTime.h"
29 #include "IOVSvc/IIOVSvcTool.h"
30 #include <set>
31 #include <map>
32 #include <list>
33 #include <string>
34 #include <mutex>
35 
36 #include "GaudiKernel/ServiceHandle.h"
37 #include "GaudiKernel/ICondSvc.h"
38 
39 
40 
41 class StoreGateSvc;
42 class IClassIDSvc;
43 class IProxyDict;
44 class IToolSvc;
45 class CallBackID;
46 class CBTree;
47 
48 namespace SG {
49  class TransientAddress;
50  class DataProxy;
51 }
52 
53 class IOVSvc: public extends<AthService, IIOVSvc>
54 {
55 public:
56 
57  IOVSvc( const std::string& name, ISvcLocator* svc );
58  virtual ~IOVSvc();
59 
60  virtual StatusCode initialize() override;
61  virtual StatusCode reinitialize() override;
62  virtual StatusCode finalize() override;
63 
64  virtual StatusCode createIOVTool( const std::string& storeName ) override;
65  virtual std::vector<std::string> getStoreNames() const override;
66 
68  virtual
70  const IOVSvcCallBackFcn& fcn, bool trigger=false) override;
71 
72  virtual
74  const CallBackID& c2, const IOVSvcCallBackFcn& fcn2,
75  bool trigger) override;
76 
77  virtual
78  StatusCode regFcn(const std::string& toolName,
79  const CallBackID& c2, const IOVSvcCallBackFcn& fcn2,
80  bool trigger) override;
81 
83  virtual StatusCode setRange(const CLID& clid, const std::string& key,
84  IOVRange&) override;
85  virtual StatusCode setRange(const CLID& clid, const std::string& key,
86  IOVRange& io,
87  const std::string& storeName) override;
88 
89  virtual StatusCode getRange(const CLID& clid, const std::string& key,
90  IOVRange& io) const override;
91 
94  const std::string& key,
95  const std::string& storeName) override;
96 
98  virtual StatusCode replaceProxy( SG::DataProxy *pOld,
99  SG::DataProxy *pNew,
100  const std::string& storeName) override;
101 
102 
104  virtual StatusCode regProxy( const CLID& clid, const std::string& key,
105  const std::string& storeName ) override;
106 
107 
108  virtual StatusCode deregProxy( SG::DataProxy *proxy ) override;
109  virtual StatusCode deregProxy( const CLID& clid, const std::string& key ) override;
110 
111 
112 
114  virtual StatusCode getRangeFromDB(const CLID& clid, const std::string& key,
115  IOVRange& range, std::string &tag,
116  std::unique_ptr<IOpaqueAddress>& ioa) const override;
117 
119  virtual StatusCode getRangeFromDB(const CLID& clid, const std::string& key,
120  const IOVTime& time,
121  IOVRange& range, std::string &tag,
122  std::unique_ptr<IOpaqueAddress>& ioa) const override;
123 
125  virtual StatusCode setRangeInDB(const CLID& clid, const std::string& key,
126  const IOVRange& range,
127  const std::string &tag) override;
128 
130  virtual StatusCode dropObjectFromDB(const CLID& clid, const std::string& key,
131  const std::string& storeName) override;
132 
134  virtual StatusCode preLoadTAD( const SG::TransientAddress *,
135  const std::string& storeName ) override;
136 
139  const std::string& storeName ) override;
140 
143  virtual StatusCode getTriggeredTools(const std::string& key,
144  std::set<std::string>& tools,
145  const std::string& storeName) override;
146 
147  virtual void resetAllProxies() override;
148 
149  virtual void ignoreProxy(const CLID& clid, const std::string& key,
150  const std::string& storeName) override;
151 
152  virtual StatusCode createCondObj(CondContBase*, const DataObjID&,
153  const EventIDBase&) override;
154 
155 
156 private:
157 
158  StatusCode createIOVTool(const std::string& storeName, IIOVSvcTool*& tool);
159  IIOVSvcTool* getTool( const std::string& storeName,
160  bool createIF=true );
161  IIOVSvcTool* getTool( const CLID& clid, const std::string& key) const;
163  IIOVSvcTool* getTool( const CallBackID& c1 ) const;
164  IIOVSvcTool* getTool( const IAlgTool* ia ) const;
165  std::string fullProxyName( const SG::DataProxy* proxy ) const;
166  std::string fullProxyName( const CLID& clid, const std::string& key ) const;
167 
168 
169  typedef std::map< std::string, IIOVSvcTool* > toolMap;
171 
172 
174  BooleanProperty m_sortKeys, m_forceReset;
175  std::string m_updateInterval;
176 
181 
182  // Recursive because createCondObj dereferences a DataProxy, which can
183  // eventually recursively call back to IOVSvc.
184  mutable std::recursive_mutex m_lock;
185 
186 };
187 
188 #endif
CallBackID
Definition: CallBackID.h:24
TileDCSDataPlotter.dp
dp
Definition: TileDCSDataPlotter.py:840
IIOVSvcTool.h
IOVRange
Validity Range object. Holds two IOVTimes (start and stop)
Definition: IOVRange.h:30
StateLessPT_NewConfig.proxy
proxy
Definition: StateLessPT_NewConfig.py:392
SG
Forward declaration.
Definition: CaloCellPacker_400_500.h:32
CallBackID.h
IOVSvc::setRangeInDB
virtual StatusCode setRangeInDB(const CLID &clid, const std::string &key, const IOVRange &range, const std::string &tag) override
Set a particular IOVRange in db (and memory)
Definition: IOVSvc.cxx:499
IOVSvc::m_partialPreLoadData
BooleanProperty m_partialPreLoadData
Definition: IOVSvc.h:173
IOVSvc::getTool
IIOVSvcTool * getTool(const std::string &storeName, bool createIF=true)
Definition: IOVSvc.cxx:670
IOVSvc::p_detStore
ServiceHandle< StoreGateSvc > p_detStore
Definition: IOVSvc.h:179
IOVSvc::createCondObj
virtual StatusCode createCondObj(CondContBase *, const DataObjID &, const EventIDBase &) override
Definition: IOVSvc.cxx:834
extractSporadic.c1
c1
Definition: extractSporadic.py:134
IOVSvc::m_lock
std::recursive_mutex m_lock
Definition: IOVSvc.h:184
SG::TransientAddress
Definition: TransientAddress.h:32
IOVEntry.h
IOVSvc::reinitialize
virtual StatusCode reinitialize() override
Definition: IOVSvc.cxx:605
IOVSvc::m_toolMap
toolMap m_toolMap
Definition: IOVSvc.h:170
IOVSvc::m_preLoadData
BooleanProperty m_preLoadData
Definition: IOVSvc.h:173
IProxyDict
A proxy dictionary.
Definition: AthenaKernel/AthenaKernel/IProxyDict.h:51
IOVSvc
Definition: IOVSvc.h:54
IOVSvc::getRange
virtual StatusCode getRange(const CLID &clid, const std::string &key, IOVRange &io) const override
Definition: IOVSvc.cxx:428
IOVSvc::regFcn
virtual StatusCode regFcn(SG::DataProxy *dp, const CallBackID &c, const IOVSvcCallBackFcn &fcn, bool trigger=false) override
register callback functions
Definition: IOVSvc.cxx:516
IOVSvc::initialize
virtual StatusCode initialize() override
Definition: IOVSvc.cxx:93
IOVTime.h
Basic time unit for IOVSvc. Hold time as a combination of run and event numbers.
IOVSvc::m_updateInterval
std::string m_updateInterval
Definition: IOVSvc.h:175
IIOVSvcTool
Definition: IIOVSvcTool.h:27
IOVTime
Basic time unit for IOVSvc. Hold time as a combination of run and event numbers.
Definition: IOVTime.h:33
IOVSvc::m_sortKeys
BooleanProperty m_sortKeys
Definition: IOVSvc.h:174
StoreGateSvc
The Athena Transient Store API.
Definition: StoreGateSvc.h:128
IOVSvc::p_toolSvc
ServiceHandle< IToolSvc > p_toolSvc
Definition: IOVSvc.h:177
IOVSvc::getStoreNames
virtual std::vector< std::string > getStoreNames() const override
Definition: IOVSvc.cxx:803
IOVSvc::getTriggeredTools
virtual StatusCode getTriggeredTools(const std::string &key, std::set< std::string > &tools, const std::string &storeName) override
return list of tools (or functions) that have been triggered by key will return FAILURE if no tools f...
Definition: IOVSvc.cxx:586
IOVSvc::getRangeFromDB
virtual StatusCode getRangeFromDB(const CLID &clid, const std::string &key, IOVRange &range, std::string &tag, std::unique_ptr< IOpaqueAddress > &ioa) const override
Get IOVRange from db for current event.
Definition: IOVSvc.cxx:446
IOVSvc::m_forceReset
BooleanProperty m_forceReset
Definition: IOVSvc.h:174
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
IOVSvc::fullProxyName
std::string fullProxyName(const SG::DataProxy *proxy) const
Definition: IOVSvc.cxx:769
CondContBase
Base class for all conditions containers.
Definition: CondCont.h:140
IOVSvc::toolMap
std::map< std::string, IIOVSvcTool * > toolMap
Definition: IOVSvc.h:169
DataProxy
DataProxy provides the registry services for StoreGate.
Definition: DataProxy.h:31
plotBeamSpotVxVal.range
range
Definition: plotBeamSpotVxVal.py:195
IOVSvcCallBackFcn
boost::function< StatusCode(IOVSVC_CALLBACK_ARGS) > IOVSvcCallBackFcn
the type of an IOVSvc call back: it wraps both the method and the object the method is called on
Definition: IOVSvcDefs.h:58
IOVSvc::p_CLIDSvc
ServiceHandle< IClassIDSvc > p_CLIDSvc
Definition: IOVSvc.h:178
IOVSvc::preLoadDataTAD
virtual StatusCode preLoadDataTAD(const SG::TransientAddress *, const std::string &storeName) override
supply a list of TADs whose data will be preloaded
Definition: IOVSvc.cxx:311
IOVSvc::dropObjectFromDB
virtual StatusCode dropObjectFromDB(const CLID &clid, const std::string &key, const std::string &storeName) override
Drop the associated object from the db and trigger reload.
Definition: IOVSvc.cxx:389
Handler::svc
AthROOTErrorHandlerSvc * svc
Definition: AthROOTErrorHandlerSvc.cxx:10
CLID
uint32_t CLID
The Class ID type.
Definition: Event/xAOD/xAODCore/xAODCore/ClassID_traits.h:47
fcn
void fcn(int &, double *, double &result, double par[], int)
this is where we write out chi2
Definition: Chi2LJets.cxx:183
IOVSvc::setRange
virtual StatusCode setRange(const CLID &clid, const std::string &key, IOVRange &) override
Update Range from dB.
Definition: IOVSvc.cxx:328
CBTree
Definition: CBTree.h:30
tools
Definition: DataQuality/ZLumiScripts/python/tools/__init__.py:1
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:192
compileRPVLLRates.c2
c2
Definition: compileRPVLLRates.py:361
AtlCoolConsole.tool
tool
Definition: AtlCoolConsole.py:453
IIOVSvc.h
IOVSvc::p_sgs
ServiceHandle< StoreGateSvc > p_sgs
Definition: IOVSvc.h:179
IOVSvc::regProxy
virtual StatusCode regProxy(SG::DataProxy *proxy, const std::string &key, const std::string &storeName) override
Subscribe method for DataProxy. key StoreGate key.
Definition: IOVSvc.cxx:130
IOVSvc::p_condSvc
ServiceHandle< ICondSvc > p_condSvc
Definition: IOVSvc.h:180
CaloSwCorrections.time
def time(flags, cells_name, *args, **kw)
Definition: CaloSwCorrections.py:242
IOVSvc::IOVSvc
IOVSvc(const std::string &name, ISvcLocator *svc)
Definition: IOVSvc.cxx:66
IOVSvc::~IOVSvc
virtual ~IOVSvc()
Definition: IOVSvc.cxx:87
IOVSvc::finalize
virtual StatusCode finalize() override
Definition: IOVSvc.cxx:118
IOVSvc::m_preLoadExtensibleFolders
BooleanProperty m_preLoadExtensibleFolders
Definition: IOVSvc.h:173
AthService.h
IOVSvc::deregProxy
virtual StatusCode deregProxy(SG::DataProxy *proxy) override
Deregister a DataProxy with the service.
Definition: IOVSvc.cxx:205
IOVSvcDefs.h
defines and typedefs for IOVSvc
IOVSvc::resetAllProxies
virtual void resetAllProxies() override
Definition: IOVSvc.cxx:819
CaloCondBlobAlgs_fillNoiseFromASCII.tag
string tag
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:24
IOVSvc::createIOVTool
virtual StatusCode createIOVTool(const std::string &storeName) override
Definition: IOVSvc.cxx:660
SG::DataProxy
Definition: DataProxy.h:44
IOVSvc::replaceProxy
virtual StatusCode replaceProxy(SG::DataProxy *pOld, SG::DataProxy *pNew, const std::string &storeName) override
replace a registered DataProxy with a new version
Definition: IOVSvc.cxx:268
IOVSvc::m_preLoadRanges
BooleanProperty m_preLoadRanges
Definition: IOVSvc.h:173
python.compressB64.c
def c
Definition: compressB64.py:93
IOVSvc::preLoadTAD
virtual StatusCode preLoadTAD(const SG::TransientAddress *, const std::string &storeName) override
supply a list of TADs whose proxies will be preloaded
Definition: IOVSvc.cxx:290
PhysDESDM_Quirks.trigger
trigger
Definition: PhysDESDM_Quirks.py:27
ServiceHandle< IToolSvc >
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37
IOVSvc::ignoreProxy
virtual void ignoreProxy(const CLID &clid, const std::string &key, const std::string &storeName) override
ignore proxy
Definition: IOVSvc.cxx:247
DataProxy.h