3 """Define methods to construct configured Tile bad channels"""
5 from AthenaConfiguration.ComponentAccumulator
import ComponentAccumulator
6 from AthenaConfiguration.ComponentFactory
import CompFactory
8 _validSources = [
'COOL',
'FILE']
11 """Return component accumulator with configured Tile bad channels conditions algorithm
14 flags: -- Athena configuration flags
16 Source: -- source of Tile bad channels (COOL, FILE). Defaults to COOL.
17 TileBadChannels -- name of Tile bad channels object. Defaults to TileBadChannels.
22 source = kwargs.get(
'Source',
'COOL')
23 badChannels = kwargs.get(
'TileBadChannels',
'TileBadChannels')
25 if source
not in _validSources:
26 raise(Exception(
"Invalid source: %s" % source))
28 name = badChannels +
'CondAlg'
33 from TileConditions.TileFolders
import TileFolders
34 folders = TileFolders(isMC = flags.Input.isMC, isOnline = flags.Common.isOnline)
36 TileCondProxyCoolBch=CompFactory.getComp(
"TileCondProxyCool<TileCalibDrawerBch>")
38 if flags.Tile.useOnlineChannelStatus:
39 onlineFolder = folders.addSplitMC(
'/TILE/ONL01/STATUS/ADC',
'/TILE/ONL01/STATUS/ADC')
42 onlineBadChannelsProxy =
None
44 if flags.IOVDb.DatabaseInstance ==
'CONDBR2':
45 if not flags.Common.isOnline:
46 oflineFolder = folders.add(
'/TILE/OFL02/STATUS/ADC',
'TILE_OFL')
47 offlineBadChannelsProxy =
TileCondProxyCoolBch(
'TileCondProxyCool_OflBch', Source = oflineFolder)
49 offlineBadChannelsProxy =
None
51 oflineFolder = folders.addSplitOnline(
'/TILE/OFL01/STATUS/ADC',
'/TILE/OFL02/STATUS/ADC')
52 offlineBadChannelsProxy =
TileCondProxyCoolBch(
'TileCondProxyCool_OflBch', Source = oflineFolder)
54 from IOVDbSvc.IOVDbSvcConfig
import addFolderList
59 TileCondProxyFileBch=CompFactory.getComp(
"TileCondProxyFile<TileCalibDrawerBch>")
60 if flags.Tile.useOnlineChannelStatus:
61 onlineBadChannelsProxy =
TileCondProxyFileBch(
'TileCondProxyFile_OnlBch', Source =
'TileDefault.onlBch')
63 onlineBadChannelsProxy =
None
64 offlineBadChannelsProxy =
TileCondProxyFileBch(
'TileCondProxyFile_OflBch', Source =
'TileDefault.oflBch')
67 TileCondIdTransforms=CompFactory.TileCondIdTransforms
68 TileBadChannelsCondAlg=CompFactory.TileBadChannelsCondAlg
70 OnlBchProxy = onlineBadChannelsProxy,
71 OflBchProxy = offlineBadChannelsProxy,
73 TileBadChannels = badChannels)
75 acc.addCondAlgo(badChannelsCondAlg)
77 from TileConditions.TileCablingSvcConfig
import TileCablingSvcCfg
84 """Return component accumulator with configured private Tile bad channel tool
86 flags: -- Athena configuration flags
88 Source: -- source of Tile bad channels (COOL, FILE). Defaults to COOL.
89 TileBadChannels -- name of Tile bad channels object. Defaults to TileBadChannels.
94 kwargs.setdefault(
'Source',
'COOL')
95 kwargs.setdefault(
'TileBadChannels',
'TileBadChannels')
97 badChannels = kwargs[
'TileBadChannels']
98 name =
'TileBadChanTool'
100 from TileGeoModel.TileGMConfig
import TileGMCfg
103 from TileConditions.TileBadChannelsConfig
import TileBadChannelsCondAlgCfg
106 TileBadChanTool=CompFactory.TileBadChanTool
107 acc.setPrivateTools(
TileBadChanTool(name, TileBadChannels = badChannels) )
112 if __name__ ==
"__main__":
114 from AthenaConfiguration.AllConfigFlags
import initConfigFlags
115 from AthenaConfiguration.TestDefaults
import defaultTestFiles
116 from AthenaCommon.Logging
import log
123 flags.Input.Files = defaultTestFiles.RAW_RUN2
131 acc.printConfig(withDetails =
True, summariseProps =
True)
132 print(acc.getService(
'IOVDbSvc'))
133 acc.store(
open(
'TileBadChannels.pkl',
'wb') )