10 ''' Function to configure TileCellMonitorAlgorithm algorithm in the monitoring system.'''
14 from AthenaConfiguration.ComponentAccumulator
import ComponentAccumulator
17 from TileRecUtils.TileDQstatusConfig
import TileDQstatusAlgCfg
20 from TileGeoModel.TileGMConfig
import TileGMCfg
23 from LArGeoAlgsNV.LArGMConfig
import LArGMCfg
26 from TileConditions.TileCablingSvcConfig
import TileCablingSvcCfg
29 from TileConditions.TileBadChannelsConfig
import TileBadChannelsCondAlgCfg
34 from AthenaMonitoring
import AthMonitorCfgHelper
35 helper = AthMonitorCfgHelper(flags,
'TileMonitoring')
38 from AthenaConfiguration.ComponentFactory
import CompFactory
39 tileCellMonAlg = helper.addAlgorithm(CompFactory.TileCellMonitorAlgorithm,
'TileCellMonAlg')
41 tileCellMonAlg.TriggerChain =
''
44 kwargs.setdefault(
'EnergyThreshold', 300.0 * MeV)
45 kwargs.setdefault(
'EnergyThresholdForGain', [10 * GeV, 300.0 * MeV])
46 kwargs.setdefault(
'NegativeEnergyThreshold', -2000.0 * MeV)
47 kwargs.setdefault(
'EnergyBalanceThreshold', 3)
48 kwargs.setdefault(
'TimeBalanceThreshold', 25 * ns)
49 kwargs.setdefault(
'EnergyThresholdForGapScintilator', 0 * MeV)
50 kwargs.setdefault(
'fillChannelTimeHistograms',
True)
51 kwargs.setdefault(
'fillTimeAndEnergyDiffHistograms', flags.Common.isOnline)
52 kwargs.setdefault(
'fillGapScintilatorHistograms',
False)
53 kwargs.setdefault(
'EnergyLimitForTime', 750.0 * GeV)
55 from AthenaConfiguration.Enums
import BeamType
56 if flags.Beam.Type
in [BeamType.Cosmics, BeamType.SingleBeam]:
57 kwargs.setdefault(
'fillTimeHistograms',
True)
58 kwargs.setdefault(
'EnergyThresholdForTime', 150.0 * MeV)
60 kwargs.setdefault(
'fillTimeHistograms',
False)
61 kwargs.setdefault(
'EnergyThresholdForTime', 500.0 * MeV)
66 kwargs.setdefault(
'fillHistogramsForL1Triggers', [
'AnyPhysTrig',
'bit7_Calib'])
67 l1Triggers = kwargs[
'fillHistogramsForL1Triggers']
69 for k, v
in kwargs.items():
70 setattr(tileCellMonAlg, k, v)
72 run =
str(flags.Input.RunNumbers[0])
75 executeTimeGroup = helper.addGroup(tileCellMonAlg,
'TileCellMonExecuteTime',
'Tile/')
76 executeTimeGroup.defineHistogram(
'TIME_execute', path =
'Cell', type=
'TH1F',
77 title =
'Time for execute TileCellMonAlg algorithm;time [#mus]',
78 xbins = 100, xmin = 0, xmax = 100000)
81 from TileCalibBlobObjs.Classes
import TileCalibUtils
as Tile
82 from TileMonitoring.TileMonitoringCfgHelper
import getPartitionName, getGainName
86 badCellGroup = helper.addGroup(tileCellMonAlg,
'TileBadCell',
'Tile/')
87 badCellGroup.defineHistogram(
'Partition,nBadCells;TileBadCell', path =
'Cell', type=
'TProfile',
88 xlabels = labelsPartitions, title = (
'Run %s: Average number of Bad Tile Cells' % run),
89 xbins = Tile.MAX_ROS - 1, xmin = -0.5, xmax = Tile.MAX_ROS - 1.5)
92 from TileMonitoring.TileMonitoringCfgHelper
import addTileModulePartitionMapsArray
95 eneBalModPartTitle = (
'Tile Cell Energy Ratio > %s' % kwargs[
'EnergyBalanceThreshold'])
97 title = eneBalModPartTitle, path =
'Tile/Cell', type=
'TH2D',
98 run = run, triggers = l1Triggers, separator =
'_')
101 timeBalModPartTitle = (
'Tile Cell Time difference > %s ns. E_{ch} > %s [MeV]')
102 timeBalModPartTitle = (timeBalModPartTitle % (kwargs[
'TimeBalanceThreshold'], kwargs[
'EnergyThresholdForTime']))
104 title = timeBalModPartTitle, path =
'Tile/Cell', type=
'TH2D',
105 run = run, triggers = l1Triggers, separator =
'_')
108 from TileMonitoring.TileMonitoringCfgHelper
import addTileModuleChannelMapsArray, addTileModuleDigitizerMapsArray
111 chanTimeTitle = (
'TileCal Average Channel Time [ns]. E_{ch} > %s MeV' % kwargs[
'EnergyThresholdForTime'])
113 value =
'time', title = chanTimeTitle, path =
'Tile/Cell',
114 subDirectory =
True, run = run, triggers = l1Triggers, separator =
'_')
117 digiTimeTitle = (
'TileCal Average Digitizer Time [ns]. E_{ch} > %s MeV' % kwargs[
'EnergyThresholdForTime'])
119 value =
'time', title = digiTimeTitle, path =
'Tile/Cell',
120 subDirectory =
True, run = run, triggers = l1Triggers, separator =
'_')
125 value =
'energy', title =
'Occupancy Map [MeV]', path =
'Tile/Cell',
126 subDirectory =
True, run = run, triggers = l1Triggers, separator =
'_')
131 value =
'energy', title =
'Occupancy Map [MeV]', path =
'Tile/Cell',
132 subDirectory =
True, run = run, triggers = l1Triggers, perGain =
True, separator =
'_')
136 titleMapOvThr = (
'Occupancy Map Over Threshod %s MeV' % kwargs[
'EnergyThreshold'])
138 weight =
'weight', title = titleMapOvThr, path =
'Tile/Cell',
139 subDirectory =
True, run = run, triggers = l1Triggers, separator =
'_')
144 title =
'Occupancy Map Over Threshod 30 GeV', path =
'Tile/Cell',
145 subDirectory =
True, run = run, triggers = l1Triggers, separator =
'_')
150 title =
'Occupancy Map Over Threshod 300 GeV', path =
'Tile/Cell',
151 subDirectory =
True, run = run, triggers = l1Triggers, separator =
'_')
155 title =
'Tile Cell energy difference between PMTs [MeV]', path =
'Tile/Cell',
156 subDirectory =
True, type =
'TProfile2D', value =
'energyDiff',
157 run = run, triggers = l1Triggers, separator =
'_')
160 titleMapOvThrGain = {}
161 for gain
in range(0, Tile.MAX_GAIN):
163 energyThresholdForGain = kwargs[
'EnergyThresholdForGain'][gain]
164 energyThreshold = f
'{energyThresholdForGain} MeV' if energyThresholdForGain < 1000.0
else f
'{energyThresholdForGain/GeV} GeV'
165 titleMapOvThrGain[gainName] = f
'Occupancy Map Over Threshod {energyThreshold}'
167 weight =
'weight', title = titleMapOvThrGain, path =
'Tile/Cell', subDirectory =
True,
168 run = run, triggers = l1Triggers, perGain =
True, separator =
'_')
173 title =
'Cell channel status in DB', path =
'Tile/Cell',
174 run = run, perGain =
True, separator =
'_')
178 title =
'Channels masked on the fly', path =
'Tile/Cell',
179 run = run, perGain =
False, separator =
'_')
183 titleNegOcc =
'Occupancy Map Below %s GeV' % (kwargs[
'NegativeEnergyThreshold'] / GeV)
185 title = titleNegOcc, path =
'Tile/Cell', run = run, separator =
'_')
188 from TileMonitoring.TileMonitoringCfgHelper
import addTileModuleCorrelionMapsArray
190 title =
'Tile Cell Module correlation', path =
'Tile/Cell',
191 weight =
'weight', subDirectory =
True, run = run,
192 triggers = l1Triggers, allPartitions =
True, separator =
'_')
195 from TileMonitoring.TileMonitoringCfgHelper
import addTile1DHistogramsArray
198 titleMaskOnFlyLB =
'Number of masked channels on the fly'
199 titleMaskOnFlyLB +=
';LumiBlock;Number of masked channels'
201 xvalue =
'lumiBlock', value=
'nMaskedChannelsOnFly', title = titleMaskOnFlyLB,
202 xbins = 1000, xmin = -0.5, xmax = 999.5, type =
'TProfile', run = run, triggers = [],
203 perPartition =
True, perSample =
False, perGain =
False, subDirectory =
False,
204 opt =
'kAddBinsDynamically', merge =
'merge', allPartitions =
True)
207 titleMaskCellLB =
'Number of masked cells on the fly'
208 titleMaskCellLB +=
';LumiBlock;Number of masked cells'
210 xvalue =
'lumiBlock', value =
'nMaskedCells', title = titleMaskCellLB,
211 xbins = 1000, xmin = -0.5, xmax = 999.5, type=
'TProfile', run = run, triggers = [],
212 subDirectory =
False, perPartition =
True, perSample =
False, perGain =
False,
213 opt =
'kAddBinsDynamically', merge =
'merge', allPartitions =
True)
216 titleMaskDueDQ =
'Number of masked channels on the fly due to bad DQ status'
217 titleMaskDueDQ +=
';LumiBlock;Number of masked channels'
219 xvalue =
'lumiBlock', value =
'nMaskedChannelsDueDQ', title = titleMaskDueDQ,
220 xbins = 1000, xmin = -0.5, xmax = 999.5, type=
'TProfile', run = run, triggers = [],
221 subDirectory =
False, perPartition =
True, perSample =
False, perGain =
False,
222 opt =
'kAddBinsDynamically', merge =
'merge', allPartitions =
True)
225 titleMaskCellDueDQ =
'Number of masked cells on the fly due to bad DQ status'
226 titleMaskCellDueDQ +=
';LumiBlock;Number of masked cells'
228 xvalue =
'lumiBlock', value =
'nMaskedCellsDueDQ', title = titleMaskCellDueDQ,
229 xbins = 1000, xmin = -0.5, xmax = 999.5, type=
'TProfile', run = run, triggers = [],
230 subDirectory =
False, perPartition =
True, perSample =
False, perGain =
False,
231 opt =
'kAddBinsDynamically', merge =
'merge', allPartitions =
True)
233 if kwargs[
'fillChannelTimeHistograms']:
235 titleChanTimeSamp =
'Channel Time, E_{ch} > %s MeV;time [ns]' % (kwargs[
'EnergyThresholdForTime'] / MeV)
237 xvalue =
'time', title = titleChanTimeSamp, path =
'Tile/Cell',
238 xbins = 121, xmin = -60.5, xmax = 60.5, type=
'TH1D',
239 run = run, triggers = l1Triggers, subDirectory =
True,
240 perPartition =
True, perSample =
True, perGain =
False)
244 title =
'Energy difference [MeV] between PMTs;Energy difference [MeV]',
245 path =
'Tile/Cell', xbins = 50, xmin = -1000., xmax = 1000., type=
'TH1D',
246 run = run, triggers = l1Triggers, subDirectory =
True,
247 perPartition =
True, perSample =
True, perGain =
False)
250 titleTimeDiffSamp =
'Time difference [ns] between PMTs with '
251 titleTimeDiffSamp +=
'E_{ch} > %s MeV' % (kwargs[
'EnergyThresholdForTime'] / MeV)
252 titleTimeDiffSamp +=
';time [ns]'
254 xvalue =
'timeDiff', title = titleTimeDiffSamp, path =
'Tile/Cell',
255 xbins = 50, xmin = -10., xmax = 10., type=
'TH1D', run = run, triggers = l1Triggers,
256 subDirectory =
True, perPartition =
True, perSample =
True, perGain =
False)
259 titleCellsNumber =
'Tile Cells number per luminosity block;LumiBlock;Number of reconstructed cells'
260 addTile1DHistogramsArray(helper, tileCellMonAlg, name =
'TileCellsNumberLB', opt =
'kAddBinsDynamically', merge =
'merge',
261 xvalue =
'lumiBlock', value =
'nCells', title = titleCellsNumber, path =
'Tile/Cell',
262 xbins = 1000, xmin = -0.5, xmax = 999.5, type=
'TProfile', run = run, triggers = l1Triggers,
263 subDirectory =
True, perPartition =
True, perSample =
False, perGain =
False, allPartitions =
True)
266 titleCellsOvThrBCID =
'Tile Cell Occupancy over Threshold %s MeV' % (kwargs[
'EnergyThresholdForTime'] / MeV)
267 titleCellsOvThrBCID +=
';BCID;Average number of cells over threshold'
269 xvalue =
'BCID', value =
'nCells', title = titleCellsOvThrBCID, path =
'Tile/Cell',
270 xbins = 3565, xmin = 0., xmax = 3565., type=
'TProfile', run = run, triggers = l1Triggers,
271 subDirectory =
True, perPartition =
True, perSample =
False, perGain =
False, allPartitions =
True)
274 titleEvEnergy =
'Tile Event SampE Energy;Event Energy [MeV]'
276 xvalue =
'energy', title = titleEvEnergy, path =
'Tile/Cell',
277 xbins = 120, xmin = -2000., xmax = 10000., type=
'TH1D', run = run, triggers = l1Triggers,
278 subDirectory =
True, perPartition =
True, perSample =
False, perGain =
False, allPartitions =
True)
281 titleSynch =
'Tile Time of Flight - Tile measured;Time of Flight - Tile measured [ns]'
283 xvalue =
'timeDifference', title = titleSynch, path =
'Tile/Cell',
284 xbins = 50, xmin = -100., xmax = 100., type=
'TH1D', run = run, triggers = l1Triggers,
285 subDirectory =
False, perPartition =
False, perSample =
False, perGain =
False)
288 from TileMonitoring.TileMonitoringCfgHelper
import addTileEtaPhiMapsArray
292 value =
'energy', title =
'Energy Average depostion [MeV]',
293 path =
'Tile/Cell', run = run, triggers = l1Triggers, perSample =
True)
296 titleEtaPhiOvThr = (
'Position of cells over threshold %s MeV' % kwargs[
'EnergyThreshold'])
298 type=
'TH2D', title = titleEtaPhiOvThr, path =
'Tile/Cell',
299 run = run, triggers = l1Triggers, perSample =
True)
302 from TileMonitoring.TileMonitoringCfgHelper
import addTileModuleArray
305 titleEnergyBal =
"Cell's PMTs Energy Balance"
306 titleEnergyBal +=
";;Energy balance between cell's PMTs (u-d)/(u+d)"
307 addTileModuleArray(helper, tileCellMonAlg, name =
'TileCellEnergyBalance', type=
'TProfile',
308 title = titleEnergyBal, path =
'Tile/Cell', value =
'energyBalance', run = run)
312 titleTimeBal =
"Cell's PMTs Time Difference with "
313 titleTimeBal +=
'E_{ch} > %s MeV' % (kwargs[
'EnergyThresholdForTime'] / MeV)
314 titleTimeBal +=
";;Time balance between cell's PMTs [ns]"
315 addTileModuleArray(helper, tileCellMonAlg, name =
'TileCellTimeBalance', type=
'TProfile',
316 title = titleTimeBal, path =
'Tile/Cell', value =
'timeBalance', run = run)
319 if kwargs[
'fillGapScintilatorHistograms']:
320 rangeScalFactor = [1, 1, 1, 1]
321 gapScintDimentions = [2, Tile.MAX_DRAWER, 4]
322 gapScintArray = helper.addArray(gapScintDimentions, tileCellMonAlg,
'TileGapScintilatorEnergy', topPath =
'Tile/Cell')
323 for postfix, tool
in gapScintArray.Tools.items():
324 ros, module, cellIdx = [
int(x)
for x
in postfix.split(
'_')[1:]]
328 moduleName = Tile.getDrawerString(ros, module)
330 fullName = f
'energy;TileGapScintilatorEnergy{moduleName}_E{cellIdx + 1}'
331 fullTitle = f
'Run {run} {moduleName} E{cellIdx + 1}: Energy;Energy [MeV]'
333 tool.defineHistogram(fullName, title = fullTitle, path = f
'GapScint/{partionName}', type =
'TH1F',
334 xbins = 1000, xmin = -1.5, xmax = 25000.5 * rangeScalFactor[cellIdx])
337 accumalator = helper.result()
338 result.merge(accumalator)