ATLAS Offline Software
TileIntegratorConfig.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
2 
3 """Define methods to construct configured Tile integrator conditions tool and algorithm"""
4 
5 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
6 from AthenaConfiguration.ComponentFactory import CompFactory
7 
8 def TileIntegratorCondAlgCfg(flags, **kwargs):
9  """Return component accumulator with configured Tile integrator conditions algorithm
10 
11  Arguments:
12  flags -- Athena configuration flags
13  Keyword arguments:
14  Source -- source of Tile integrator conditions (COOL, FILE). Defaults to COOL.
15  TileIntegrator -- name of Tile integrator conditions object. Defaults to TileIntegrator.
16  """
17 
18  acc = ComponentAccumulator()
19 
20  source = kwargs.get('Source', 'COOL')
21  integrator = kwargs.get('TileIntegrator', 'TileIntegrator')
22 
23  name = integrator + 'CondAlg'
24 
25  if source == 'COOL':
26  # Connect COOL Tile conditions proxies to the algorithm (default)
27 
28  from TileConditions.TileFolders import TileFolders
29  folders = TileFolders(isMC = flags.Input.isMC, isOnline = flags.Common.isOnline)
30 
31  if flags.IOVDb.DatabaseInstance == 'CONDBR2':
32  integratorFolder = folders.addSplitOnline('/TILE/ONL01/INTEGRATOR', '/TILE/OFL02/INTEGRATOR')
33  else:
34  integratorFolder = folders.addSplitOnline('/TILE/OFL01/INTEGRATOR', '/TILE/OFL02/INTEGRATOR')
35 
36  TileCondProxyCoolFlt=CompFactory.getComp("TileCondProxyCool<TileCalibDrawerFlt>")
37  integratorProxy = TileCondProxyCoolFlt('TileCondProxyCool_Integrator', Source = integratorFolder)
38 
39  from IOVDbSvc.IOVDbSvcConfig import addFolderList
40  acc.merge( addFolderList(flags, folders.get()) )
41 
42  elif source == 'FILE':
43  # Connect FILE Tile conditions proxies to the algorithm
44  TileCondProxyFileFlt=CompFactory.getComp("TileCondProxyFile<TileCalibDrawerFlt>")
45  integratorProxy = TileCondProxyFileFlt('TileCondProxyFile_Integrator', Source = 'TileDefault.int')
46  else:
47  raise(Exception("Invalid source: %s" % source))
48 
49  TileCalibFltCondAlg=CompFactory.getComp("TileCalibCondAlg<TileCalibDrawerFlt>")
50  integratorCondAlg = TileCalibFltCondAlg( name = name,
51  ConditionsProxy = integratorProxy,
52  TileCalibData = integrator)
53 
54  acc.addCondAlgo(integratorCondAlg)
55 
56  return acc
57 
58 
59 def TileCondToolIntegratorCfg(flags, **kwargs):
60  """Return component accumulator with configured private Tile integrator tool
61  Arguments:
62  flags -- Athena configuration flags
63  Keyword arguments:
64  Source -- source of Tile integrator conditions (COOL, FILE). Defaults to COOL.
65  TileIntegrator -- name of Tile integrator conditions object. Defaults to TileIntegrator.
66  """
67 
68  acc = ComponentAccumulator()
69 
70  kwargs.setdefault('Source', 'COOL')
71  kwargs.setdefault('TileIntegrator', 'TileIntegrator')
72 
73  integrator = kwargs['TileIntegrator']
74  name = 'TileCondToolIntegrator'
75 
76  acc.merge( TileIntegratorCondAlgCfg(flags, **kwargs) )
77 
78  TileCondToolIntegrator=CompFactory.TileCondToolIntegrator
79  acc.setPrivateTools( TileCondToolIntegrator(name, TileIntegrator = integrator) )
80 
81  return acc
82 
83 
84 if __name__ == "__main__":
85 
86  from AthenaConfiguration.AllConfigFlags import initConfigFlags
87  from AthenaConfiguration.TestDefaults import defaultTestFiles
88  from AthenaCommon.Logging import log
89  from AthenaCommon.Constants import DEBUG
90 
91  # Test setup
92  log.setLevel(DEBUG)
93 
94  flags = initConfigFlags()
95  flags.Input.Files = defaultTestFiles.RAW_RUN2
96  flags.lock()
97 
99 
100  integratorTool = acc.popToolsAndMerge( TileCondToolIntegratorCfg(flags) )
101  print(integratorTool)
102 
103  acc.printConfig(withDetails = True, summariseProps = True)
104  print(acc.getService('IOVDbSvc'))
105  acc.store( open('TileIntegrator.pkl','wb') )
106 
107  print('All OK')
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
python.TileIntegratorConfig.TileCondToolIntegratorCfg
def TileCondToolIntegratorCfg(flags, **kwargs)
Definition: TileIntegratorConfig.py:59
python.IOVDbSvcConfig.addFolderList
def addFolderList(flags, listOfFolderInfoTuple, extensible=False, db=None, modifiers='')
Definition: IOVDbSvcConfig.py:90
TileCondToolIntegrator
Definition: TileCondToolIntegrator.h:18
TileCondProxyCool
The tool to get Tile conditions data from DB.
Definition: TileCondProxyCool.h:25
python.TileIntegratorConfig.TileIntegratorCondAlgCfg
def TileIntegratorCondAlgCfg(flags, **kwargs)
Definition: TileIntegratorConfig.py:8
TileCondProxyFile
The tool to get Tile conditions data from file.
Definition: TileCondProxyFile.h:28
Constants
some useful constants -------------------------------------------------—
Trk::open
@ open
Definition: BinningType.h:40
TileCalibCondAlg
Condition algorithm to prepare TileCalibData object and put it into condition store.
Definition: TileCalibCondAlg.h:24
python.AllConfigFlags.initConfigFlags
def initConfigFlags()
Definition: AllConfigFlags.py:19
Muon::print
std::string print(const MuPatSegment &)
Definition: MuonTrackSteering.cxx:28