6 @file TileDigitsFlxMonitorAlgorithm.py
7 @brief Python configuration of TileDigitsFlxMonitorAlgorithm algorithm for the Run III
11 '''Function to configures TileDigitsFlxMonAlg algorithms in the monitoring system.'''
13 kwargs.setdefault(
'TileDigitsContainerLegacy',
'TileDigitsCnt')
14 kwargs.setdefault(
'TileDigitsContainerFlx',
'TileDigitsFlxCnt')
15 kwargs.setdefault(
'FirstSample', 0)
16 kwargs.setdefault(
'LastSample', 15)
17 kwargs.setdefault(
'FelixOffset', 0)
18 kwargs.setdefault(
'FelixScale', 4)
20 felixScale = kwargs[
'FelixScale']
22 from AthenaConfiguration.ComponentAccumulator
import ComponentAccumulator
25 from TileConditions.TileCablingSvcConfig
import TileCablingSvcCfg
28 from AthenaMonitoring
import AthMonitorCfgHelper
29 helper = AthMonitorCfgHelper(flags,
'TileDigitsFlxMonitoring')
31 from AthenaConfiguration.ComponentFactory
import CompFactory
32 TileDigitsFlxMonitorAlgorithm = CompFactory.TileDigitsFlxMonitorAlgorithm
33 tileDigitsFlxMonAlg = helper.addAlgorithm(TileDigitsFlxMonitorAlgorithm,
'TileDigitsFlxMonAlg')
34 tileDigitsFlxMonAlg.TriggerChain =
''
36 for k, v
in kwargs.items():
37 setattr(tileDigitsFlxMonAlg, k, v)
40 executeTimeGroup = helper.addGroup(tileDigitsFlxMonAlg,
'TileDigitsFlxMonExecuteTime', f
'{topPath}/Felix')
41 executeTimeGroup.defineHistogram(
'TIME_execute', path =
'Digits', type=
'TH1F',
42 title =
'Time for execute TileDigitsFlxMonAlg algorithm;time [#mus]',
43 xbins = 300, xmin = 0, xmax = 300000)
45 runNumber = flags.Input.RunNumbers[0]
46 from TileCalibBlobObjs.Classes
import TileCalibUtils
as Tile
50 for fragID
in fragIDs:
52 drawer = fragID & 0x3F
53 modules += [Tile.getDrawerString(ros, drawer)]
55 for ros
in range(1, Tile.MAX_ROS):
56 for drawer
in range(0, Tile.MAX_DRAWER):
57 modules += [Tile.getDrawerString(ros, drawer)]
59 channelHFNGroup = helper.addGroup(tileDigitsFlxMonAlg,
'TileFlxMonHFN', f
'{topPath}/Felix/Digits')
60 for moduleName
in modules:
61 for gainName
in [
'HG',
'LG']:
62 title = f
'Run {runNumber} {moduleName} {gainName}: Mean RMS in event (HFN)-FELIX;Channel;HFN'
63 name = f
'{moduleName}_{gainName}_channel,{moduleName}_{gainName}_HFN;{moduleName}_HFN_{gainName}'
65 channelHFNGroup.defineHistogram(name, title = title, path = path, type =
'TProfile',
66 xbins = 48, xmin = -0.5, xmax = 47.5)
68 channelPedGroup = helper.addGroup(tileDigitsFlxMonAlg,
'TileFlxMonPed', f
'{topPath}/Felix/Digits')
69 for moduleName
in modules:
70 for gainName
in [
'HG',
'LG']:
71 title = f
'Run {runNumber} {moduleName} {gainName}: Pedestal, sample[0]-FELIX;Channel;ADC'
72 name = f
'{moduleName}_{gainName}_channel,{moduleName}_{gainName}_Pedestal;{moduleName}_Pedestal_{gainName}'
74 channelPedGroup.defineHistogram(name, title = title, path = path, type =
'TProfile',
75 xbins = 48, xmin = -0.5, xmax = 47.5)
77 channelHFNGroup = helper.addGroup(tileDigitsFlxMonAlg,
'TileLegacyMonHFN', f
'{topPath}/Legacy/Digits')
78 for moduleName
in modules:
79 for gainName
in [
'HG',
'LG']:
80 title = f
'Run {runNumber} {moduleName} {gainName}: Mean RMS in event (HFN);Channel;HFN'
81 name = f
'{moduleName}_{gainName}_channel,{moduleName}_{gainName}_HFN;{moduleName}_HFN_{gainName}'
83 channelHFNGroup.defineHistogram(name, title = title, path = path, type =
'TProfile',
84 xbins = 48, xmin = -0.5, xmax = 47.5)
86 channelPedGroup = helper.addGroup(tileDigitsFlxMonAlg,
'TileLegacyMonPed', f
'{topPath}/Legacy/Digits')
87 for moduleName
in modules:
88 for gainName
in [
'HG',
'LG']:
89 title = f
'Run {runNumber} {moduleName} {gainName}: Pedestal, sample[0];Channel;ADC'
90 name = f
'{moduleName}_{gainName}_channel,{moduleName}_{gainName}_Pedestal;{moduleName}_Pedestal_{gainName}'
92 channelPedGroup.defineHistogram(name, title = title, path = path, type =
'TProfile',
93 xbins = 48, xmin = -0.5, xmax = 47.5)
95 channelSamplesFlxGroup = helper.addGroup(tileDigitsFlxMonAlg,
'TileFlxMonSamples', f
'{topPath}/Felix/Digits')
96 for moduleName
in modules:
97 for channel
in range(0, Tile.MAX_CHAN):
98 for gainName
in [
'HG',
'LG']:
99 title = (f
'Run {runNumber} {moduleName} channel {channel} {gainName}: Samples-FELIX;Sample [ADC];N')
100 name = f
'{moduleName}_ch_{str(channel)}_{gainName}_samples'
102 channelSamplesFlxGroup.defineHistogram(name, title = title, path = path, type =
'TH1F',
103 xbins = 4096, xmin = -0.5, xmax = 4095.5)
106 channelSamplesLegacyGroup = helper.addGroup(tileDigitsFlxMonAlg,
'TileLegacyMonSamples', f
'{topPath}/Legacy/Digits')
107 for moduleName
in modules:
108 for channel
in range(0, Tile.MAX_CHAN):
109 for gainName
in [
'HG',
'LG']:
110 title = (f
'Run {runNumber} {moduleName} channel {channel} {gainName}: Samples;Sample [ADC];N')
111 name = f
'{moduleName}_ch_{str(channel)}_{gainName}_samples'
113 channelSamplesLegacyGroup.defineHistogram(name, title = title, path = path, type =
'TH1F',
114 xbins = 1024, xmin = -0.5, xmax = 1023.5)
116 channelAllSamplesDiffGroup = helper.addGroup(tileDigitsFlxMonAlg,
'TileChannelAllSamplesDiff', f
'{topPath}/Compare/Digits')
117 for moduleName
in modules:
118 for channel
in range(0, Tile.MAX_CHAN):
119 for gainName
in [
'HG',
'LG']:
120 title = (f
'Run {runNumber} {moduleName} channel {channel} {gainName}: Samples difference (FELIX-Legacy*{felixScale});Sample [ADC];N')
121 name = f
'{moduleName}_ch_{str(channel)}_{gainName}_samples_diff'
123 channelAllSamplesDiffGroup.defineHistogram(name, title = title, path = path, type =
'TH1F',
124 xbins = 200, xmin = -100, xmax = 100)
126 moduleAllSamplesGroup = helper.addGroup(tileDigitsFlxMonAlg,
'TileModuleAllSamplesDiff', f
'{topPath}/Compare/Digits')
127 for moduleName
in modules:
128 for gainName
in [
'HG',
'LG']:
129 title = (f
'Run {runNumber} {moduleName} {gainName}: All channels samples difference (FELIX-Legacy*{felixScale});Sample [ADC];N')
130 name = f
'{moduleName}_{gainName}_samples_diff;{moduleName}_{gainName}_all_channels_samples_diff'
132 moduleAllSamplesGroup.defineHistogram(name, title = title, path = path, type =
'TH1F',
133 xbins = 200, xmin = -100, xmax = 100)
135 moduleSamplesDiffGroup = helper.addGroup(tileDigitsFlxMonAlg,
'TileModuleSamplesDiff', f
'{topPath}/Compare/Digits')
136 for moduleName
in modules:
137 for gainName
in [
'HG',
'LG']:
138 title = f
'Run {runNumber} {moduleName} {gainName}: Samples difference (FELIX-Legacy*{felixScale});Channel;ADC'
139 name = f
'{moduleName}_{gainName}_channel,{moduleName}_{gainName}_samples_diff;{moduleName}_{gainName}_samples_diff'
141 moduleSamplesDiffGroup.defineHistogram(name, title = title, path = path, type =
'TProfile',
142 xbins = 48, xmin = -0.5, xmax = 47.5)
145 accumalator = helper.result()
146 result.merge(accumalator)
150 if __name__==
'__main__':
152 from AthenaCommon.Logging
import log
157 from AthenaConfiguration.AllConfigFlags
import initConfigFlags
159 parser = flags.getArgumentParser()
160 parser.add_argument(
'--postExec', help=
'Code to execute after setup')
161 parser.add_argument(
'--digits', default=
"TileDigitsCnt", help=
'Tile digits container to be monitored')
162 parser.add_argument(
'--frag-ids', dest=
'fragIDs', nargs=
"*", default=[
'0x201',
'0x402'], help=
'Tile Frag IDs of modules to be monitored. Empty=ALL')
163 args, _ = parser.parse_known_args()
165 fragIDs = [
int(fragID, base=16)
for fragID
in args.fragIDs]
167 from AthenaConfiguration.TestDefaults
import defaultGeometryTags, defaultTestFiles
168 flags.Input.Files = defaultTestFiles.RAW_RUN2
169 flags.GeoModel.AtlasVersion = defaultGeometryTags.RUN2
170 flags.Output.HISTFileName =
'TileDigitsFlxMonitorOutput.root'
171 flags.DQ.useTrigger =
False
172 flags.DQ.enableLumiAccess =
False
173 flags.Exec.MaxEvents = 3
174 flags.fillFromArgs(parser=parser)
178 from AthenaConfiguration.MainServicesConfig
import MainServicesCfg
181 from TileByteStream.TileByteStreamConfig
import TileRawDataReadingCfg
183 readDigitsFlx=(
True if 'Flx' in args.digits
else False)) )
187 TileDigitsContainerLegacy=
"TileDigitsCnt",
188 TileDigitsContainerFlx=args.digits)
190 cfg.merge(tileDigitsFlxMonitorAccumulator)
194 log.info(
'Executing postExec: %s', args.postExec)
197 cfg.printConfig(withDetails =
True, summariseProps =
True)
200 cfg.store(
open(
'TileDigitsFlxMonitorAlgorithm.pkl',
'wb') )
206 sys.exit(
not sc.isSuccess())