3 """Define methods to construct configured Tile auto correlation tool and conditions algorithm"""
5 from AthenaConfiguration.ComponentAccumulator
import ComponentAccumulator
6 from AthenaConfiguration.ComponentFactory
import CompFactory
9 """Return component accumulator with configured Tile auto correlation conditions algorithm
12 flags -- Athena configuration flags
14 Source -- source of Tile auto correlation conditions (COOL, FILE). Defaults to COOL.
15 TileAutoCorrelation -- name of Tile auto correlation conditions object. Defaults to TileAutoCorrelaton.
20 source = kwargs.get(
'Source',
'COOL')
21 autoCorrelation = kwargs.get(
'TileAutoCorrelation',
'TileAutoCorrelation')
23 name = autoCorrelation +
'CondAlg'
28 from TileConditions.TileFolders
import TileFolders
29 folders = TileFolders(isMC = flags.Input.isMC, isOnline = flags.Common.isOnline)
31 if flags.IOVDb.DatabaseInstance ==
'CONDBR2':
32 if not flags.Common.isOnline:
33 autoCorrelationFolder = folders.add(
'/TILE/OFL02/NOISE/AUTOCR',
'TILE_OFL')
35 raise(Exception(
"No online auto correlation folder in CONDBR2 DB"))
37 autoCorrelationFolder = folders.addSplitOnline(
'/TILE/OFL01/NOISE/AUTOCR',
'/TILE/OFL02/NOISE/AUTOCR')
39 TileCondProxyCoolFlt=CompFactory.getComp(
"TileCondProxyCool<TileCalibDrawerFlt>")
40 autoCorrelationProxy =
TileCondProxyCoolFlt(
'TileCondProxyCool_NoiseAutoCr', Source = autoCorrelationFolder)
42 from IOVDbSvc.IOVDbSvcConfig
import addFolderList
45 elif source ==
'FILE':
47 TileCondProxyFileFlt=CompFactory.getComp(
"TileCondProxyFile<TileCalibDrawerFlt>")
48 autoCorrelationProxy =
TileCondProxyFileFlt(
'TileCondProxyFile_NoiseAutoCr', Source =
'TileDefault.acr')
51 raise(Exception(
"Invalid source: %s" % source))
53 TileCalibFltCondAlg=CompFactory.getComp(
"TileCalibCondAlg<TileCalibDrawerFlt>")
55 ConditionsProxy = autoCorrelationProxy,
56 TileCalibData = autoCorrelation)
58 acc.addCondAlgo(autoCorrelationCondAlg)
64 """Return component accumulator with configured private Tile auto correlation tool
66 flags -- Athena configuration flags
68 Source -- source of Tile auto correlation conditions (COOL, FILE). Defaults to COOL.
69 TileAutoCorrelation -- name of Tile auto correlation conditions object. Defaults to TileAutoCorrelaton.
74 kwargs.setdefault(
'Source',
'COOL')
75 kwargs.setdefault(
'TileAutoCorrelation',
'TileAutoCorrelation')
77 autoCorrelation = kwargs[
'TileAutoCorrelation']
78 name =
'TileCondToolAutoCr'
82 TileCondToolAutoCr=CompFactory.TileCondToolAutoCr
88 if __name__ ==
"__main__":
90 from AthenaConfiguration.AllConfigFlags
import initConfigFlags
91 from AthenaConfiguration.TestDefaults
import defaultTestFiles
92 from AthenaCommon.Logging
import log
99 flags.Input.Files = defaultTestFiles.RAW_RUN2
105 print(autoCorrelationTool)
107 acc.printConfig(withDetails =
True, summariseProps =
True)
108 print(acc.getService(
'IOVDbSvc'))
109 acc.store(
open(
'TileAutoCorrelation.pkl',
'wb') )