ATLAS Offline Software
CondProxyProviderConfig.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2025 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  ConversionService="AthenaPoolSharedIOCnvSvc" if flags.MP.UseSharedReader or flags.MP.UseSharedWriter else "AthenaPoolCnvSvc")
24  result.addService (cpp)
25 
26  return result
27 
28 
29 if __name__ == "__main__":
30  from AthenaConfiguration.AllConfigFlags import initConfigFlags
31  from AthenaConfiguration.Enums import LHCPeriod
32  flags = initConfigFlags()
33  flags.Input.Files = []
34  flags.GeoModel.Run = LHCPeriod.Run2 # flags validation workaround
35  flags.lock()
36 
38  acc1.merge (CondProxyProviderCfg (flags, 'file1'))
39  acc1.merge (CondProxyProviderCfg (flags, ['file2', 'file3']))
40  acc1.printConfig (summariseProps=True)
41  print ('CondProxyProvider:', acc1.getService('CondProxyProvider'))
42  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