3 """Define methods to construct configured Tile pulse shape 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 pulse shape conditions algorithm
13 flags -- Athena configuration flags
15 Source -- source of Tile pulse shape conditions (COOL, FILE). Defaults to COOL.
16 TilePulseShape -- name of Tile pulse shape conditions object. Defaults to TilePulseShape.
17 PulseType -- type of Tile pulse shape. Defaults to run type (PED->PHY, BILAS->LAS).
18 Possible Tile pulse shape types:
19 PHY, LAS, CIS, CIS/PULSE100, CIS/PULSE5P2, CIS/LEAK100, CIS/LEAK5P2, MURCV.
24 runType = flags.Tile.RunType
26 source = kwargs.get(
'Source',
'COOL')
27 pulseShape = kwargs.get(
'TilePulseShape',
'TilePulseShape')
28 pulseType = kwargs.get(
'PulseType', runType.getCommonType().value)
30 actualPulseType = {
'CIS' :
'CIS/PULSE100',
31 'CISPULSE100' :
'CIS/PULSE100',
'CISPULSE5P2' :
'CIS/PULSE5P2',
32 'CISLEAK100' :
'CIS/LEAK100',
'CISLEAK5P2' :
'CIS/LEAK5P2'}
34 pulse = actualPulseType.get(pulseType, pulseType)
36 if pulse
not in [
'PHY',
'LAS',
'CIS/PULSE100',
'CIS/PULSE5P2',
'CIS/LEAK100',
'CIS/LEAK5P2',
'MURCV']:
37 raise(Exception(
"Invalid Tile pulse shape type: %s" % pulse))
39 name = pulseShape +
'CondAlg'
44 if pulse
in [
'MURCV']:
45 raise(Exception(
'No Tile pulse shape [%s] in source: %s' % (pulse, source)))
47 from TileConditions.TileFolders
import TileFolders
48 folders = TileFolders(isMC = flags.Input.isMC, isOnline = flags.Common.isOnline)
50 if flags.IOVDb.DatabaseInstance ==
'CONDBR2':
51 if not flags.Common.isOnline:
52 pulseFolder = folders.add(
'/TILE/OFL02/PULSESHAPE/' + pulse,
'TILE_OFL')
54 raise(Exception(
'No Tile pulse shapes in online CONDBR2'))
56 pulseFolder = folders.addSplitOnline(
'/TILE/OFL01/PULSESHAPE/' + pulse,
'/TILE/OFL02/PULSESHAPE/' + pulse)
58 TileCondProxyCoolFlt=CompFactory.getComp(
"TileCondProxyCool<TileCalibDrawerFlt>")
61 from IOVDbSvc.IOVDbSvcConfig
import addFolderList
64 elif source ==
'FILE':
66 fileExtention = {
'PHY' :
'plsPhy',
'LAS' :
'plsLas',
'MURCV' :
'plsMuRcv',
67 'CIS/PULSE100' :
'plsCisPulse100',
'CIS/PULSE5P2' :
'plsCisPulse5p2',
68 'CIS/LEAK100' :
'plsCisLeak100',
'CIS/LEAK5P2' :
'plsCisLeak5p2'}
70 TileCondProxyFileFlt=CompFactory.getComp(
"TileCondProxyFile<TileCalibDrawerFlt>")
72 Source =
'TileDefault.' + fileExtention[pulse])
74 raise(Exception(
"Invalid source: %s" % source))
76 TilePulseShapeCondAlg = CompFactory.getComp(
"TileCondAlg<TilePulse,TileCalibDrawerFlt>")
78 ConditionsProxy = pulseProxy,
79 TileCondData = pulseShape)
81 acc.addCondAlgo(pulseShapeCondAlg)
87 """Return component accumulator with configured private Tile pulse shape conditions tool
90 flags -- Athena configuration flags
92 Source -- source of Tile pulse shape conditions (COOL, FILE). Defaults to COOL.
93 TilePulseShape -- name of Tile pulse shape conditions object. Defaults to TilePulseShape.
94 PulseType -- type of Tile pulse shape. Defaults to run type (PED->PHY, BILAS->LAS).
95 Possible Tile pulse shape types:
96 PHY, LAS, CIS/PULSE100, CIS/PULSE5P2, CIS/LEAK100, CIS/LEAK5P2, MURCV.
101 kwargs.setdefault(
'Source',
'COOL')
102 kwargs.setdefault(
'TilePulseShape',
'TilePulseShape')
104 pulseShape = kwargs[
'TilePulseShape']
105 name =
'TileCondToolPulseShape'
109 TileCondToolPulseShape=CompFactory.TileCondToolPulseShape
117 kwargs.setdefault(
'Source',
'FILE')
118 kwargs.setdefault(
'TilePulseShape',
'TileMuRcvPulseShape')
119 kwargs[
'PulseType'] =
'MURCV'
121 pulseShape = kwargs[
'TilePulseShape']
122 name =
'TileCondToolPulseShape'
126 TileCondToolPulseShape=CompFactory.TileCondToolPulseShape
132 if __name__ ==
"__main__":
134 from AthenaConfiguration.AllConfigFlags
import initConfigFlags
135 from AthenaConfiguration.TestDefaults
import defaultTestFiles
136 from AthenaCommon.Logging
import log
143 flags.Input.Files = defaultTestFiles.RAW_RUN2
144 flags.Tile.RunType = TileRunType.PHY
150 print(pulseShapeTool)
153 print(muRcvPulseShapeTool)
155 acc.printConfig(withDetails =
True, summariseProps =
True)
156 print(acc.getService(
'IOVDbSvc'))
157 acc.store(
open(
'TilePulseShape.pkl',
'wb') )