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]
44 runSplitOnline = 314449
45 if flags.IOVDb.DatabaseInstance ==
'CONDBR2' and runType.getCommonType()
is TileRunType.PHY
and runNumber > runSplitOnline:
46 ofcFolder = folders.addSplitOnline(
'/TILE/ONL01/FILTER/' + ofcType,
'/TILE/OFL02/FILTER/' + ofcType)
47 elif runNumber >= runSplitMC:
48 ofcFolder = folders.addSplitMC(
'/TILE/ONL01/FILTER/' + ofcType,
'/TILE/OFL02/FILTER/' + ofcType)
50 ofcFolder = folders.addSplitMC(
'/TILE/ONL01/FILTER/' + ofcType,
'/TILE/ONL01/FILTER/' + ofcType)
52 TileCondProxyCoolOfc=CompFactory.getComp(
"TileCondProxyCool<TileCalibDrawerOfc>")
55 from IOVDbSvc.IOVDbSvcConfig
import addFolderList
59 raise(Exception(
"Invalid source: %s" % source))
61 TileCalibOfcCondAlg=CompFactory.getComp(
"TileCalibCondAlg<TileCalibDrawerOfc>")
62 ofcCondAlg =
TileCalibOfcCondAlg( name = name, ConditionsProxy = ofcProxy, TileCalibData = ofc)
64 acc.addCondAlgo(ofcCondAlg)
70 """Return component accumulator with configured Tile OFC conditions algorithm
73 flags -- Athena configuration flags
75 Source -- source of Tile OFC conditions (COOL, FILE). Defaults to COOL.
76 TileOfc -- name of Tile OFC conditions. Defaults to TileOfc + OfcType (capitalized).
77 OfcType -- type of Tile OFC. Defaults to OF2. Possible OFC types: OF1, OF2.
82 kwargs.setdefault(
'Source',
'COOL')
83 kwargs.setdefault(
'OfcType',
'OF2')
85 ofcType = kwargs[
'OfcType']
86 ofc =
'TileOfc' + ofcType.capitalize()
88 kwargs.setdefault(
'TileOfc', ofc)
90 ofc = kwargs[
'TileOfc']
91 name =
'TileCondToolOfcCool'
95 TileCondToolOfcCool=CompFactory.TileCondToolOfcCool
102 """Return component accumulator with configured Tile OFC conditions algorithm
105 flags -- Athena configuration flags
107 OfcType -- type of Tile OFC. Defaults to OF2. Possible OFC types: OF1, OF2.
108 OptFilterDeltaCorrelation -- flag to use delta correlation. Defaults to False.
109 If it is False auto correlation obtained from data will be used.
110 TileCondToolPulseShape - Tile conditions tool to get pulse shape.
111 Provided it will be used. By default new one will be configured.
112 TileCondToolAutoCr - Tile conditions tool to get auto correlation.
113 Provided it will be used. By default new one will be configured.
118 optFilterDeltaCorrelation = kwargs.get(
'OptFilterDeltaCorrelation',
False)
120 from TileConditions.TileInfoLoaderConfig
import TileInfoLoaderCfg
123 if 'TileCondToolPulseShape' in kwargs:
124 pulseShapeTool = kwargs[
'TileCondToolPulseShape']
126 from TileConditions.TilePulseShapeConfig
import TileCondToolPulseShapeCfg
129 if optFilterDeltaCorrelation:
130 autoCorrelationTool =
None
132 if 'TileCondToolAutoCr' in kwargs:
133 autoCorrelationTool = kwargs[
'TileCondToolAutoCr']
135 from TileConditions.TileAutoCorrelationConfig
import TileCondToolAutoCrCfg
138 name =
'TileCondToolOfc'
139 TileCondToolOfc=CompFactory.TileCondToolOfc
141 OptFilterDeltaCorrelation = optFilterDeltaCorrelation,
142 TileCondToolPulseShape = pulseShapeTool,
143 TileCondToolAutoCr = autoCorrelationTool) )
149 if __name__ ==
"__main__":
151 from AthenaConfiguration.AllConfigFlags
import initConfigFlags
152 from AthenaConfiguration.TestDefaults
import defaultTestFiles
153 from AthenaCommon.Logging
import log
160 flags.Input.Files = defaultTestFiles.RAW_RUN2
161 flags.Tile.RunType = TileRunType.PHY
172 acc.printConfig(withDetails =
True, summariseProps =
True)
173 print(acc.getService(
'IOVDbSvc'))
174 acc.store(
open(
'TileOFC.pkl',
'wb') )