9def TilePulseShapeCondAlgCfg(flags, **kwargs):
10 """Return component accumulator with configured Tile pulse shape conditions algorithm
11
12 Arguments:
13 flags -- Athena configuration flags
14 Keyword arguments:
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.
20 """
21
22 acc = ComponentAccumulator()
23
24 runType = flags.Tile.RunType
25
26 source = kwargs.get('Source', 'COOL')
27 pulseShape = kwargs.get('TilePulseShape', 'TilePulseShape')
28 pulseType = kwargs.get('PulseType', runType.getCommonType().value)
29
30 actualPulseType = {'CIS' : 'CIS/PULSE100',
31 'CISPULSE100' : 'CIS/PULSE100', 'CISPULSE5P2' : 'CIS/PULSE5P2',
32 'CISLEAK100' : 'CIS/LEAK100', 'CISLEAK5P2' : 'CIS/LEAK5P2'}
33
34 pulse = actualPulseType.get(pulseType, pulseType)
35
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))
38
39 name = pulseShape + 'CondAlg'
40
41 if source == 'COOL':
42
43
44 if pulse in ['MURCV']:
45 raise(Exception('No Tile pulse shape [%s] in source: %s' % (pulse, source)))
46
47 from TileConditions.TileFolders import TileFolders
48 folders = TileFolders(isMC = flags.Input.isMC, isOnline = flags.Common.isOnline)
49
50 if flags.IOVDb.DatabaseInstance == 'CONDBR2':
51 if not flags.Common.isOnline:
52 pulseFolder = folders.add('/TILE/OFL02/PULSESHAPE/' + pulse, 'TILE_OFL')
53 else:
54 raise(Exception('No Tile pulse shapes in online CONDBR2'))
55 else:
56 pulseFolder = folders.addSplitOnline('/TILE/OFL01/PULSESHAPE/' + pulse, '/TILE/OFL02/PULSESHAPE/' + pulse)
57
58 TileCondProxyCoolFlt=CompFactory.getComp("TileCondProxyCool<TileCalibDrawerFlt>")
60
61 from IOVDbSvc.IOVDbSvcConfig import addFolderList
62 acc.merge( addFolderList(flags, folders.get()) )
63
64 elif source == 'FILE':
65
66 fileExtention = {'PHY' : 'plsPhy', 'LAS' : 'plsLas', 'MURCV' : 'plsMuRcv',
67 'CIS/PULSE100' : 'plsCisPulse100', 'CIS/PULSE5P2' : 'plsCisPulse5p2',
68 'CIS/LEAK100' : 'plsCisLeak100', 'CIS/LEAK5P2' : 'plsCisLeak5p2'}
69
70 TileCondProxyFileFlt=CompFactory.getComp("TileCondProxyFile<TileCalibDrawerFlt>")
72 Source = 'TileDefault.' + fileExtention[pulse])
73 else:
74 raise(Exception("Invalid source: %s" % source))
75
76 TilePulseShapeCondAlg = CompFactory.getComp("TileCondAlg<TilePulse,TileCalibDrawerFlt>")
78 ConditionsProxy = pulseProxy,
79 TileCondData = pulseShape)
80
81 acc.addCondAlgo(pulseShapeCondAlg)
82
83 return acc
84
85