3 """Define methods to construct configured Tile OFC 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 OFC conditions algorithm
13 flags -- Athena configuration flags
15 Source -- source of Tile OFC conditions (COOL, FILE). Defaults to COOL.
16 TileOfc -- name of Tile OFC conditions object starts with. Defaults to TileOfc.
17 OfcType -- type of Tile OFC. Defaults to OF2. Possible OFC types: OF1, OF2.
22 runType = flags.Tile.RunType
24 source = kwargs.get(
'Source',
'COOL')
25 ofc = kwargs.get(
'TileOfc',
'TileOfc')
26 ofcType = kwargs.get(
'OfcType',
'OF2')
28 ofcType = ofcType.upper()
29 if ofcType
not in [
'OF1',
'OF2']:
30 raise(Exception(
"Invalid Tile OFC type: %s" % ofcType))
32 name = ofc +
'CondAlg'
37 from TileConditions.TileFolders
import TileFolders
38 folders = TileFolders(isMC = flags.Input.isMC, isOnline = flags.Common.isOnline)
40 ofcType = ofcType +
'/' + runType.getCommonType().value
42 runNumber = flags.Input.RunNumbers[0]
43 runSplitOnline = 314449
44 if flags.IOVDb.DatabaseInstance ==
'CONDBR2' and runType
is TileRunType.PHY
and runNumber > runSplitOnline:
45 ofcFolder = folders.addSplitOnline(
'/TILE/ONL01/FILTER/' + ofcType,
'/TILE/OFL02/FILTER/' + ofcType)
47 ofcFolder = folders.addSplitMC(
'/TILE/ONL01/FILTER/' + ofcType,
'/TILE/ONL01/FILTER/' + ofcType)
49 TileCondProxyCoolOfc=CompFactory.getComp(
"TileCondProxyCool<TileCalibDrawerOfc>")
52 from IOVDbSvc.IOVDbSvcConfig
import addFolderList
56 raise(Exception(
"Invalid source: %s" % source))
58 TileCalibOfcCondAlg=CompFactory.getComp(
"TileCalibCondAlg<TileCalibDrawerOfc>")
59 ofcCondAlg =
TileCalibOfcCondAlg( name = name, ConditionsProxy = ofcProxy, TileCalibData = ofc)
61 acc.addCondAlgo(ofcCondAlg)
67 """Return component accumulator with configured Tile OFC conditions algorithm
70 flags -- Athena configuration flags
72 Source -- source of Tile OFC conditions (COOL, FILE). Defaults to COOL.
73 TileOfc -- name of Tile OFC conditions. Defaults to TileOfc + OfcType (capitalized).
74 OfcType -- type of Tile OFC. Defaults to OF2. Possible OFC types: OF1, OF2.
79 kwargs.setdefault(
'Source',
'COOL')
80 kwargs.setdefault(
'OfcType',
'OF2')
82 ofcType = kwargs[
'OfcType']
83 ofc =
'TileOfc' + ofcType.capitalize()
85 kwargs.setdefault(
'TileOfc', ofc)
87 ofc = kwargs[
'TileOfc']
88 name =
'TileCondToolOfcCool'
92 TileCondToolOfcCool=CompFactory.TileCondToolOfcCool
99 """Return component accumulator with configured Tile OFC conditions algorithm
102 flags -- Athena configuration flags
104 OfcType -- type of Tile OFC. Defaults to OF2. Possible OFC types: OF1, OF2.
105 OptFilterDeltaCorrelation -- flag to use delta correlation. Defaults to False.
106 If it is False auto correlation obtained from data will be used.
107 TileCondToolPulseShape - Tile conditions tool to get pulse shape.
108 Provided it will be used. By default new one will be configured.
109 TileCondToolAutoCr - Tile conditions tool to get auto correlation.
110 Provided it will be used. By default new one will be configured.
115 optFilterDeltaCorrelation = kwargs.get(
'OptFilterDeltaCorrelation',
False)
117 from TileConditions.TileInfoLoaderConfig
import TileInfoLoaderCfg
120 if 'TileCondToolPulseShape' in kwargs:
121 pulseShapeTool = kwargs[
'TileCondToolPulseShape']
123 from TileConditions.TilePulseShapeConfig
import TileCondToolPulseShapeCfg
126 if optFilterDeltaCorrelation:
127 autoCorrelationTool =
None
129 if 'TileCondToolAutoCr' in kwargs:
130 autoCorrelationTool = kwargs[
'TileCondToolAutoCr']
132 from TileConditions.TileAutoCorrelationConfig
import TileCondToolAutoCrCfg
135 name =
'TileCondToolOfc'
136 TileCondToolOfc=CompFactory.TileCondToolOfc
138 OptFilterDeltaCorrelation = optFilterDeltaCorrelation,
139 TileCondToolPulseShape = pulseShapeTool,
140 TileCondToolAutoCr = autoCorrelationTool) )
146 if __name__ ==
"__main__":
148 from AthenaConfiguration.AllConfigFlags
import initConfigFlags
149 from AthenaConfiguration.TestDefaults
import defaultTestFiles
150 from AthenaCommon.Logging
import log
157 flags.Input.Files = defaultTestFiles.RAW_RUN2
158 flags.Tile.RunType = TileRunType.PHY
169 acc.printConfig(withDetails =
True, summariseProps =
True)
170 print(acc.getService(
'IOVDbSvc'))
171 acc.store(
open(
'TileOFC.pkl',
'wb') )