3 """Define methods to construct configured Tile timing conditions tool and algorithm"""
5 from AthenaConfiguration.ComponentAccumulator
import ComponentAccumulator
6 from AthenaConfiguration.ComponentFactory
import CompFactory
7 from TileConfiguration.TileConfigFlags
import TileRunType
10 """Return component accumulator with configured Tile timing conditions algorithm
13 flags -- Athena configuration flags
15 Source -- source of Tile timing conditions (COOL, FILE). Defaults to COOL.
16 TileTiming -- name of Tile timing conditions object. Defaults to TileTiming.
17 ForceOnline -- flag to use online timing in offline. Defaults to False.
22 source = kwargs.get(
'Source',
'COOL')
23 timing = kwargs.get(
'TileTiming',
'TileTiming')
24 forceOnline = kwargs.get(
'ForceOnline',
False)
26 runType = flags.Tile.RunType
27 timingType = runType.getTimingType().value
29 name = timing +
'CondAlg'
34 from TileConditions.TileFolders
import TileFolders
35 folders = TileFolders(isMC = flags.Input.isMC, isOnline = flags.Common.isOnline)
37 if flags.IOVDb.DatabaseInstance ==
'CONDBR2':
38 onlineTimingFolder =
'/TILE/ONL01/TIME/CHANNELOFFSET/' + timingType
40 if timingType ==
'GAP/LAS':
41 raise(Exception(
"No Tile GAP/LAS timing in DB: %s" % flags.IOVDb.DatabaseInstance))
43 onlineTimingFolder =
'/TILE/OFL01/TIME/CHANNELOFFSET/' + timingType
46 timingFolder = folders.add(onlineTimingFolder,
'TILE')
48 timingFolder = folders.addSplitOnline(onlineTimingFolder,
'/TILE/OFL02/TIME/CHANNELOFFSET/' + timingType)
50 TileCondProxyCoolFlt=CompFactory.getComp(
"TileCondProxyCool<TileCalibDrawerFlt>")
53 from IOVDbSvc.IOVDbSvcConfig
import addFolderList
56 elif source ==
'FILE':
58 fileExtention = {
'PHY' :
'tcphy',
'LAS' :
'tclas',
'CIS' :
'tccis'}
60 TileCondProxyFileFlt=CompFactory.getComp(
"TileCondProxyFile<TileCalibDrawerFlt>")
62 Source =
'TileDefault.' + fileExtention[timingType])
64 raise(Exception(
"Invalid source: %s" % source))
66 TileTimingCondAlg = CompFactory.getComp(
"TileCondAlg<TileTiming,TileCalibDrawerFlt>")
68 ConditionsProxy = timingProxy,
69 TileCondData = timing)
71 acc.addCondAlgo(timingCondAlg)
78 """Return component accumulator with configured private Tile timing conditions tool
81 flags -- Athena configuration flags
83 Source -- source of Tile timing conditions (COOL, FILE). Defaults to COOL.
84 TileTiming -- name of Tile timing conditions object. Defaults to TileTiming (TileOnlineTiming if ForceOnline).
85 TimingType -- type of Tile timing. Defaults to run type (PED->PHY, BILAS->LAS, MONOCIS->CIS).
86 Possible Tile timing types: PHY, LAS, GAP/LAS, CIS.
87 ForceOnline -- flag to use online timing in offline. Defaults to False.
92 kwargs.setdefault(
'Source',
'COOL')
93 kwargs.setdefault(
'ForceOnline',
False)
95 forceOnline = kwargs[
'ForceOnline']
96 kwargs.setdefault(
'TileTiming',
'TileOnlineTiming' if forceOnline
else 'TileTiming')
98 timing = kwargs[
'TileTiming']
100 name =
'TileCondToolTiming'
104 TileCondToolTiming=CompFactory.TileCondToolTiming
114 if __name__ ==
"__main__":
116 from AthenaConfiguration.AllConfigFlags
import initConfigFlags
117 from AthenaConfiguration.TestDefaults
import defaultTestFiles
118 from AthenaCommon.Logging
import log
125 flags.Input.Files = defaultTestFiles.RAW_RUN2
126 flags.Tile.RunType = TileRunType.PHY
135 print(onlineTimingTool)
137 acc.printConfig(withDetails =
True, summariseProps =
True)
138 print(acc.getService(
'IOVDbSvc'))
139 acc.store(
open(
'TileTiming.pkl',
'wb') )