42 def TileTBPulseMonitoringConfig(flags, timeRange=[-100, 100], fragIDs=[0x100, 0x101, 0x200, 0x201, 0x402], useDemoCabling=2018, useFELIX=False, **kwargs):
44 ''' Function to configure TileTBPulseMonitorAlgorithm algorithm in the monitoring system.'''
46 suffix =
"Flx" if useFELIX
else ""
47 topPath =
'TestBeam/' + (
'Felix' if useFELIX
else 'Legacy')
49 from AthenaConfiguration.ComponentAccumulator
import ComponentAccumulator
52 from TileGeoModel.TileGMConfig
import TileGMCfg
55 from TileConditions.TileCablingSvcConfig
import TileCablingSvcCfg
58 from TileConditions.TileInfoLoaderConfig
import TileInfoLoaderCfg
61 from AthenaMonitoring
import AthMonitorCfgHelper
62 helper = AthMonitorCfgHelper(flags, f
'TileTBPulse{suffix}Monitoring')
64 from AthenaConfiguration.ComponentFactory
import CompFactory
65 tileTBPulseMonAlg = helper.addAlgorithm(CompFactory.TileTBPulseMonitorAlgorithm, f
'TileTBPulse{suffix}MonAlg')
67 tileTBPulseMonAlg.TriggerChain =
''
69 from TileCalibBlobObjs.Classes
import TileCalibUtils
as Tile
73 for fragID
in fragIDs:
75 drawer = fragID & 0x3F
76 modules += [Tile.getDrawerString(ros, drawer)]
78 for ros
in range(1, Tile.MAX_ROS):
79 for drawer
in range(0, Tile.MAX_DRAWER):
80 fragIDs += [(ros << 8) | drawer]
81 modules += [Tile.getDrawerString(ros, drawer)]
83 tileTBPulseMonAlg.TileFragIDs = fragIDs
85 kwargs.setdefault(
'TileDigitsContainer', f
'TileDigits{suffix}Cnt')
86 kwargs.setdefault(
'TileRawChannelContainer', flags.Tile.RawChannelContainer.replace(
'TileRawChannel', f
'TileRawChannel{suffix}'))
87 for k, v
in kwargs.items():
88 setattr(tileTBPulseMonAlg, k, v)
90 run =
str(flags.Input.RunNumbers[0])
93 executeTimeGroup = helper.addGroup(tileTBPulseMonAlg,
'TileTBPulseMonExecuteTime', topPath)
94 executeTimeGroup.defineHistogram(
'TIME_execute', path=
'PulseShape', type=
'TH1F',
95 title=
'Time for execute TileTBPulseMonAlg algorithm;time [#mus]',
96 xbins=100, xmin=0, xmax=10000)
98 from TileMonitoring.TileMonitoringCfgHelper
import getCellName
100 def addPulseShapeHistogramsArray(helper, modules, algorithm, name, title, path, type='TH2D',
101 xbins=100, xmin=-100, xmax=100, ybins=100, ymin=-0.2, ymax=1.5,
102 run='', value='', aliasPrefix='', useDemoCabling=2018):
103 ''' This function configures 2D (or 1D Profile) histograms with Tile pulse shape per module, channel, gain '''
105 pulseShapeArray = helper.addArray([modules], algorithm, name, topPath=path)
106 for postfix, tool
in pulseShapeArray.Tools.items():
107 moduleName = postfix[1:]
108 partition = moduleName[:3]
109 module =
int(moduleName[3:]) - 1
110 for channel
in range(0, Tile.MAX_CHAN):
112 pmt =
getPMT(partition, legacyChannel)
113 pmtName = f
'Channel_{channel}' if pmt < 0
else {0 :
'PMT_Up', 1 :
'PMT_Down'}[pmt]
115 cellName = cell.replace(
'B',
'BC')
if (partition
in [
'LBA',
'LBC']
and cell
and cell[0] ==
'B' and cell !=
'B9')
else cell
116 for gain
in range(0, Tile.MAX_GAIN):
117 gainName = {0 :
'lo', 1 :
'hi'}[gain]
118 fullPath = f
'{partition}/{moduleName}'
119 name = f
'time_{channel}_{gain},amplitude_{channel}_{gain};{aliasPrefix}{cellName}_{moduleName}_{pmtName}_{gainName}'
120 fullTitle = f
'Run {run} {moduleName} Channel {channel} Gain {gainName}: {title};time [ns];Normalized Units'
121 tool.defineHistogram(name, title=fullTitle, path=fullPath, type=type,
122 xbins=xbins, xmin=xmin, xmax=xmax, ybins=ybins, ymin=ymin, ymax=ymax)
123 return pulseShapeArray
125 addPulseShapeHistogramsArray(helper, modules, tileTBPulseMonAlg, name=
'TilePulseShape', title=
'Pulse shape',
126 path=f
'{topPath}/PulseShape', xbins=abs(timeRange[1]), xmin=timeRange[0], xmax=timeRange[1],
127 run=run, aliasPrefix=
'pulseShape_', useDemoCabling=useDemoCabling)
129 addPulseShapeHistogramsArray(helper, modules, tileTBPulseMonAlg, name=
'TilePulseShapeProfile',
130 title=
'Pulse shape profile', path=f
'{topPath}/PulseShape', type=
'TProfile',
131 xbins=abs(timeRange[1]), xmin=timeRange[0], xmax=timeRange[1],
132 ybins=
None, ymin=
None, ymax=
None, run=run, aliasPrefix=
'pulseShapeProfile_',
133 useDemoCabling=useDemoCabling)
135 accumalator = helper.result()
136 result.merge(accumalator)