12 ''' Function to configure TileDQFragMonitorAlgorithm algorithm in the monitoring system.'''
14 from AthenaConfiguration.ComponentAccumulator
import ComponentAccumulator
17 from DetDescrCnvSvc.DetDescrCnvSvcConfig
import DetDescrCnvSvcCfg
20 from TileConditions.TileCablingSvcConfig
import TileCablingSvcCfg
23 from TileRecUtils.TileDQstatusConfig
import TileDQstatusAlgCfg
26 from TileConditions.TileInfoLoaderConfig
import TileInfoLoaderCfg
29 from TileConditions.TileEMScaleConfig
import TileEMScaleCondAlgCfg
32 from TileConditions.TileBadChannelsConfig
import TileBadChannelsCondAlgCfg
35 kwargs.setdefault(
'CheckDCS', flags.Tile.useDCS)
36 if kwargs[
'CheckDCS']:
37 from TileConditions.TileDCSConfig
import TileDCSCondAlgCfg
40 rawChannelContainer = flags.Tile.RawChannelContainer
42 from AthenaConfiguration.Enums
import Format
43 if flags.Input.Format
is Format.POOL:
44 kwargs.setdefault(
'TileDigitsContainer',
'TileDigitsFlt')
45 if rawChannelContainer
not in flags.Input.Collections:
46 rawChannelContainer =
''
48 kwargs.setdefault(
'TileRawChannelContainer', rawChannelContainer)
51 kwargs.setdefault(
'MinEnergyChan', -5.0 * GeV)
52 kwargs.setdefault(
'MinEnergyGap', -10.0 * GeV)
53 kwargs.setdefault(
'fillDigiErrorsHistogramsPerLB', flags.Common.isOnline)
54 fillDigiErrorsHistogramsPerLB = kwargs[
'fillDigiErrorsHistogramsPerLB']
56 runNumber = flags.Input.RunNumbers[0]
61 from AthenaMonitoring
import AthMonitorCfgHelper
62 helper = AthMonitorCfgHelper(flags,
'TileDQFragMonAlgCfg')
64 from AthenaConfiguration.ComponentFactory
import CompFactory
65 tileDQFragMonAlg = helper.addAlgorithm(CompFactory.TileDQFragMonitorAlgorithm,
'TileDQFragMonAlg')
67 for k, v
in kwargs.items():
68 setattr(tileDQFragMonAlg, k, v)
71 executeTimeGroup = helper.addGroup(tileDQFragMonAlg,
'TileDQFragMonExecuteTime',
'Tile/')
72 executeTimeGroup.defineHistogram(
'TIME_execute', path =
'DMUErrors', type=
'TH1F',
73 title =
'Time for execute TileDQFragMonAlg algorithm;time [#mus]',
74 xbins = 300, xmin = 0, xmax = 300000)
77 errorStateGroup = helper.addGroup(tileDQFragMonAlg,
'TileEventsWithErrEventInfoLB',
'Tile/DMUErrors')
78 errorStateGroup.defineHistogram(
'lumiBlock;TileEventsWithErrEventInfo', path =
'BadDrawers', type=
'TH1F',
79 title =
'Run ' + run +
': # events with Tile error state in EventInfo;LumiBlock;# events with error',
80 xbins = 1000, xmin = -0.5, xmax = 999.5, opt =
'kAddBinsDynamically', merge =
'merge')
83 consecutiveBadGroup = helper.addGroup(tileDQFragMonAlg,
'TileConsecutiveBadModules',
'Tile/DMUErrors')
84 consecutiveBadGroup.defineHistogram(
'TileConsecutiveBad', path =
'BadDrawers', type=
'TH1F',
85 title =
'Run ' + run +
': Max # Tile consecutive bad modules;# consecutive bad modules;N',
86 xbins = 17, xmin = -0.5, xmax = 16.5)
89 consecutiveBadLBGroup = helper.addGroup(tileDQFragMonAlg,
'TileConsecutiveBadModulesLB',
'Tile/DMUErrors')
90 consecutiveBadLBGroup.defineHistogram(
'lumiBlock,TileConsecutiveBad;TileConsecutiveBadLB', path =
'BadDrawers', type=
'TH2F',
91 title =
'Run ' + run +
': Max # Tile consecutive bad modules;LumiBlock;# consecutive bad modules',
92 xbins = 1000, xmin = -0.5, xmax = 999.5, ybins = 17, ymin = -0.5, ymax = 16.5,
93 opt =
'kAddBinsDynamically', merge =
'merge')
96 from TileMonitoring.TileMonitoringCfgHelper
import getPartitionName
97 from TileCalibBlobObjs.Classes
import TileCalibUtils
as Tile
100 moduleLabels = [
str(module)
for module
in range(1, Tile.MAX_DRAWER + 1)]
103 mismatchedLVL1Group = helper.addGroup(tileDQFragMonAlg,
'TileMismatchedL1TriggerType',
'Tile/')
104 mismatchedLVL1Group.defineHistogram(
'module,ROS;TileMismatchedL1TriggerType', path =
'DMUErrors',
105 title =
'Run ' + run +
': Tile mismatched L1 Trigger Type;Module;Partition',
106 type =
'TH2F', xlabels = moduleLabels, ylabels = partitionLabels,
107 xbins = Tile.MAX_DRAWER, xmin = -0.5, xmax = Tile.MAX_DRAWER - 0.5,
108 ybins = Tile.MAX_ROS - 1, ymin = 1.0, ymax = Tile.MAX_ROS)
111 noAllDigitsGroup = helper.addGroup(tileDQFragMonAlg,
'TileNoAllDigits',
'Tile/')
112 noAllDigitsGroup.defineHistogram(
'module,ROS;TileNoalldigits', path =
'DMUErrors', type =
'TH2F',
113 title =
'Run ' + run +
': No All Tile digits in event with Trigger Type = 0x82;Module;Partition',
114 xlabels = moduleLabels, ylabels = partitionLabels,
115 xbins = Tile.MAX_DRAWER, xmin = -0.5, xmax = Tile.MAX_DRAWER - 0.5,
116 ybins = Tile.MAX_ROS - 1, ymin = 1.0, ymax = Tile.MAX_ROS)
119 globalCRCGroup = helper.addGroup(tileDQFragMonAlg,
'TileBadGlobalCRC',
'Tile/')
120 globalCRCGroup.defineHistogram(
'module,ROS;TileBadGlobalCRC', path =
'DMUErrors', type =
'TH2F',
121 title =
'Run ' + run +
': Global CRC errors;Module;Partition',
122 xlabels = moduleLabels, ylabels = partitionLabels,
123 xbins = Tile.MAX_DRAWER, xmin = -0.5, xmax = Tile.MAX_DRAWER - 0.5,
124 ybins = Tile.MAX_ROS - 1, ymin = 1.0, ymax = Tile.MAX_ROS)
128 dmuLabels = [
str(dmu)
for dmu
in range(0, maxDMUs)]
130 dmuErrorLabels = [
'OK',
'HEADER_FORM',
'HEADER_PAR',
'MEMO_PAR',
'FE_CRC',
'ROD_CRC',
'BCID']
131 dmuErrorLabels += [
'SAMPLE_FORM',
'SAMPLE_PAR',
'DOUBLE_STB',
'SINGLE_STB',
'GLOBAL_CRC']
132 dmuErrorLabels += [
'DUMMY_FRAG',
'NO_RECO_FRAG',
'MASKED',
'ALL_M_BAD_DCS',
'ANY_CH_BAD_HV']
134 dmuErrorLabels += [
'0 -> 1023',
'Zeros',
'Two 1023 + ped',
'Jump 2 levels',
'Single Up + ped']
135 dmuErrorLabels += [
'Single Dn + ped',
'Single Up + sig',
'Single Dn + sig',
'Ped > 200 LG']
136 dmuErrorLabels += [
'Single Dn LG_s0',
'Single Dn LG_s6',
'Up LG_s0_s6 or Gap',
'Dn LG_s0_s6 or Gap']
137 dmuErrorLabels += [
'Bad quality',
'Big negative ene']
139 maxErrors = len(dmuErrorLabels)
141 errorsArray = helper.addArray([
int(Tile.MAX_ROS - 1),
int(Tile.MAX_DRAWER)],
142 tileDQFragMonAlg,
'TileDigiErrors', topPath =
'Tile/')
143 for postfix, tool
in errorsArray.Tools.items():
144 ros, module = [
int(x)
for x
in postfix.split(
'_')[1:]]
146 moduleName = Tile.getDrawerString(ros + 1, module)
147 title =
'Run ' + run +
': ' + moduleName +
' Channel and DMU Header Errors;DMU'
148 name =
'DMU,Error;TileDigiErrors' + moduleName
150 tool.defineHistogram(name, title = title, type =
'TH2F', path =
'DMUErrors',
151 xlabels = dmuLabels, ylabels = dmuErrorLabels,
152 xbins = maxDMUs, xmin = 0.0, xmax = maxDMUs,
153 ybins = maxErrors, ymin = 0.0, ymax = maxErrors)
156 if fillDigiErrorsHistogramsPerLB:
158 errorsInLBArray = helper.addArray([
int(Tile.MAX_ROS - 1),
int(Tile.MAX_DRAWER)],
159 tileDQFragMonAlg,
'TileDigiErrorsInLB', topPath =
'Tile/')
160 for postfix, tool
in errorsInLBArray.Tools.items():
161 ros, module = [
int(x)
for x
in postfix.split(
'_')[1:]]
163 moduleName = Tile.getDrawerString(ros + 1, module)
164 title =
'Run ' + run +
': ' + moduleName + f
' Channel and DMU Header Errors (reset every {kLBNHistoryDepth} LBs);DMU'
165 name =
'DMU,Error;TileDigiErrors' + moduleName
167 tool.defineHistogram(name, title = title, type =
'TH2F', path =
'DMUErrors/LB',
168 opt = f
'kLBNHistoryDepth={kLBNHistoryDepth}', xlabels = dmuLabels, ylabels = dmuErrorLabels,
169 xbins = maxDMUs, xmin = 0.0, xmax = maxDMUs,
170 ybins = maxErrors, ymin = 0.0, ymax = maxErrors)
174 errorsVsLBArray = helper.addArray([
int(Tile.MAX_ROS - 1),
int(Tile.MAX_DRAWER)],
175 tileDQFragMonAlg,
'FracTileDigiErrors', topPath =
'Tile/')
176 for postfix, tool
in errorsVsLBArray.Tools.items():
177 ros, module = [
int(x)
for x
in postfix.split(
'_')[1:]]
179 moduleName = Tile.getDrawerString(ros + 1, module)
180 title =
'Run ' + run +
': ' + moduleName +
' (#total_events - #ok_events)/(#total_events)'
181 title +=
';LumiBlock;Fraction of Digital errors'
182 name =
'lumiBlock,fractionOfBadDMUs;FracTileDigiErrors' + moduleName
184 tool.defineHistogram(name, title = title, path =
'DMUErrors', type =
'TProfile',
185 xbins = 1000, xmin = -0.5, xmax = 999.5, opt =
'kAddBinsDynamically', merge =
'merge')
189 from TileMonitoring.TileMonitoringCfgHelper
import addTileModuleChannelMapsArray
193 name =
'TileBadChannelsJumpMap', title =
'# Jump errors',
198 name =
'TileBadChannelsJumpNotMaskMap', title =
'# Not masked Jump errors',
204 name =
'TileBadPulseQualityMap', run = run,
205 title =
'Bad pulse shape or #chi^{2} from Optimal Filtering algirithm')
209 name =
'TileBadChannelsNegMap', title =
'# Negative amplitude',
214 name =
'TileBadChannelsNegNotMaskMap', run = run,
215 title =
'# Not masked negative amplitude')
219 negEneMapTitle = f
"# Negative energy below {kwargs['MinEnergyChan']/GeV} ({kwargs['MinEnergyGap']/GeV} for E cels) GeV"
221 name =
'TileNegativeEnergyMap', run = run, title = negEneMapTitle)
223 accumalator = helper.result()
224 result.merge(accumalator)