ATLAS Offline Software
CondProxyProviderConfig.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
2 
3 # File: EventSelectorAthenaPool/python/CondProxyProviderConfig.py
4 # Created: Jun 2020, sss
5 # Purpose: Configure CondProxyProvider.
6 
7 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
8 from AthenaConfiguration.ComponentFactory import CompFactory
9 
10 
11 def CondProxyProviderCfg (flags, poolFiles):
12  if not isinstance (poolFiles, list):
13  poolFiles = [poolFiles]
14 
15  result = ComponentAccumulator()
16 
17  ProxyProviderSvc = CompFactory.ProxyProviderSvc # SGComps
18  pps = ProxyProviderSvc (ProviderNames = ['CondProxyProvider'])
19  result.addService (pps)
20 
21  CondProxyProvider = CompFactory.CondProxyProvider # EventSelectorAthenaPool
22  cpp = CondProxyProvider (InputCollections = poolFiles)
23  result.addService (cpp)
24 
25  return result
26 
27 
28 if __name__ == "__main__":
29  from AthenaConfiguration.AllConfigFlags import initConfigFlags
30  from AthenaConfiguration.Enums import LHCPeriod
31  flags = initConfigFlags()
32  flags.Input.Files = []
33  flags.GeoModel.Run = LHCPeriod.Run2 # flags validation workaround
34  flags.lock()
35 
37  acc1.merge (CondProxyProviderCfg (flags, 'file1'))
38  acc1.merge (CondProxyProviderCfg (flags, ['file2', 'file3']))
39  acc1.printConfig (summariseProps=True)
40  print ('CondProxyProvider:', acc1.getService('CondProxyProvider'))
41  acc1.wasMerged()
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
python.CondProxyProviderConfig.CondProxyProviderCfg
def CondProxyProviderCfg(flags, poolFiles)
Definition: CondProxyProviderConfig.py:11
python.AllConfigFlags.initConfigFlags
def initConfigFlags()
Definition: AllConfigFlags.py:19