13 ''' Function to configure TileJetMonitorAlgorithm algorithm in the monitoring system.'''
17 from AthenaConfiguration.ComponentAccumulator
import ComponentAccumulator
18 result = ComponentAccumulator()
20 from TileGeoModel.TileGMConfig
import TileGMCfg
21 result.merge(TileGMCfg(flags))
23 from LArGeoAlgsNV.LArGMConfig
import LArGMCfg
24 result.merge(LArGMCfg(flags))
26 from TileConditions.TileCablingSvcConfig
import TileCablingSvcCfg
27 result.merge( TileCablingSvcCfg(flags) )
29 from TileConditions.TileBadChannelsConfig
import TileBadChanToolCfg
30 badChanTool = result.popToolsAndMerge( TileBadChanToolCfg(flags) )
34 from AthenaMonitoring
import AthMonitorCfgHelper
35 helper = AthMonitorCfgHelper(flags,
'TileMonitoring')
38 from AthenaConfiguration.ComponentFactory
import CompFactory
39 tileJetMonAlg = helper.addAlgorithm(CompFactory.TileJetMonitorAlgorithm,
'TileJetMonAlg')
41 tileJetMonAlg.TileBadChanTool = badChanTool
42 tileJetMonAlg.TriggerChain =
''
44 if flags.Tile.doTimingHistogramsForGain
in [0, 1]:
45 kwargs.setdefault(
'Do1DHistograms',
True)
46 if flags.Tile.doTimingHistogramsForGain == 0:
48 kwargs.setdefault(
'ChannelEnergyMin', 15000)
49 kwargs.setdefault(
'ChannelEnergyMax', 50000)
50 kwargs.setdefault(
'Gain', 0)
54 kwargs.setdefault(
'ChannelEnergyMin', 2000)
55 kwargs.setdefault(
'ChannelEnergyMax', 4000)
56 kwargs.setdefault(
'Gain', 1)
58 if len(flags.Tile.doTimingHistogramsForCell) > 0:
59 kwargs.setdefault(
'DoCellHistograms',
True)
61 for k, v
in kwargs.items():
62 setattr(tileJetMonAlg, k, v)
64 DoEnergyProfiles = kwargs.get(
'DoEnergyProfiles', tileJetMonAlg._descriptors[
'DoEnergyProfiles'].default)
66 Do1DHistograms = kwargs.get(
'Do1DHistograms', tileJetMonAlg._descriptors[
'Do1DHistograms'].default)
67 DoEnergyDiffHistograms = kwargs.get(
'DoEnergyDiffHistograms', tileJetMonAlg._descriptors[
'DoEnergyDiffHistograms'].default)
69 DoCellHistograms = kwargs.get(
'DoCellHistograms', tileJetMonAlg._descriptors[
'DoCellHistograms'].default)
71 from AthenaMonitoring.DQConfigFlags
import DQDataType
72 if flags.DQ.DataType
not in (DQDataType.HeavyIon, DQDataType.Cosmics):
74 jvtTool = CompFactory.JetVertexTaggerTool()
75 jetContainer = kwargs.get(
'JetContainer', tileJetMonAlg._descriptors[
'JetContainer'].default)
76 jvtTool.JetContainer = str(jetContainer)
77 tileJetMonAlg.JVT = jvtTool
79 jetCleaningTool = CompFactory.JetCleaningTool()
80 jetCleaningTool.CutLevel =
"LooseBad"
81 jetCleaningTool.DoUgly =
False
82 jetCleaningTool.JetContainer = str(jetContainer)
84 tileJetMonAlg.JetCleaningTool = jetCleaningTool
85 result.addPublicTool(jetCleaningTool)
88 jetTrackingEtaLimit = 2.4
89 eventCleaningTool = CompFactory.ECUtils.EventCleaningTool()
90 eventCleaningTool.JetCleaningTool = jetCleaningTool
91 eventCleaningTool.PtCut = jetPtMin
92 eventCleaningTool.EtaCut = jetTrackingEtaLimit
93 eventCleaningTool.JvtDecorator =
"passJvt"
94 eventCleaningTool.OrDecorator =
"passOR"
95 eventCleaningTool.CleaningLevel = jetCleaningTool.CutLevel
96 eventCleaningTool.JetContainer = str(jetContainer)
97 eventCleaningTool.SuppressInputDependence =
True
98 eventCleaningTool.SuppressOutputDependence =
True
100 tileJetMonAlg.EventCleaningTool = eventCleaningTool
101 tileJetMonAlg.JetTrackingEtaLimit = jetTrackingEtaLimit
102 tileJetMonAlg.JetPtMin = jetPtMin
104 tileJetMonAlg.DoEventCleaning =
True
105 tileJetMonAlg.DoJetCleaning =
True
109 tileJetMonAlg.DoEventCleaning =
False
110 tileJetMonAlg.DoJetCleaning =
False
112 if flags.Reco.EnableHI:
113 if flags.Tracking.doUPC:
114 tileJetMonAlg.JetContainer =
'AntiKt4EMPFlowJets'
116 tileJetMonAlg.JetContainer =
'AntiKt4HIJets'
119 executeTimeGroup = helper.addGroup(tileJetMonAlg,
'TileJetMonExecuteTime',
'Tile/')
120 executeTimeGroup.defineHistogram(
'TIME_execute', path =
'Jet', type=
'TH1F',
121 title =
'Time for execute TileJetMonAlg algorithm;time [#mus]',
122 xbins = 300, xmin = 0, xmax = 300000)
126 from TileMonitoring.TileMonitoringCfgHelper
import addValueVsModuleAndChannelMaps, getPartitionName, getChannelsForCell
127 runNumber = flags.Input.RunNumbers[0]
131 channelTimeDQGroup = helper.addGroup(tileJetMonAlg,
'TileJetChanTimeDQ',
'Tile/Jet/')
132 addValueVsModuleAndChannelMaps(channelTimeDQGroup, name =
'tileJetChanTime', title =
'Average time with jets',
133 path =
'DQ', type =
'TProfile2D', value=
'time', run = str(runNumber))
137 partitions = [
'LBA',
'LBC',
'EBA',
'EBC']
140 channelTimeGroup = helper.addGroup(tileJetMonAlg,
'TileJetChanTime',
'Tile/Jet/ChanTime/')
141 for partition
in partitions:
142 title =
'Partition ' + partition +
': Tile Channel Time;time [ns];N'
143 name =
'channelTime' + partition
145 channelTimeGroup.defineHistogram(name, title = title, path = path, type =
'TH1F',
146 xbins = 600, xmin = -30.0, xmax = 30.0)
149 for partition
in [
'EBA',
'EBC']:
150 title =
'Partition ' + partition +
': Tile Channel Time (without scintillators);time [ns];N'
151 name =
'channelTime' + partition +
'_NoScint'
153 channelTimeGroup.defineHistogram(name, title = title, path = path, type =
'TH1F',
154 xbins = 600, xmin = -30.0, xmax = 30.0)
158 energiesHG = [500, 1000, 2000, 4000, 6000, 8000, 10000, 13000, 16000, 20000]
159 energiesLG = [25000, 30000, 40000, 50000, 65000, 80000]
160 energiesALL = {
'LG' : energiesLG,
'HG' : energiesHG}
161 tileJetMonAlg.CellEnergyUpperLimitsHG = energiesHG
162 tileJetMonAlg.CellEnergyUpperLimitsLG = energiesLG
164 samples_LB = [
'A',
'B',
'D',
'B9']
165 samples_EB = [
'A',
'B',
'D',
'C10',
'D4',
'E1',
'E2',
'E3',
'E4']
168 cellTimeGroup = helper.addGroup(tileJetMonAlg,
'TileJetCellTime',
'Tile/Jet/CellTime/')
170 selectedCellTimeGroup = helper.addGroup(tileJetMonAlg,
'TileJetSelCellTime',
'Tile/Jet/SelectedCellTime/')
171 selectedChanTimeGroup = helper.addGroup(tileJetMonAlg,
'TileJetSelChanTime',
'Tile/Jet/SelectedChanTime/')
172 for partition
in partitions:
175 energies = energiesALL[gain]
176 for index
in range(0, len(energies) + 1):
177 toEnergy = energies[index]
if index < len(energies)
else None
178 fromEnergy = energies[index - 1]
if index > 0
else None
180 title_suffix =
' > ' + str(fromEnergy) +
' MeV; time [ns]'
182 title_suffix =
' < ' + str(toEnergy) +
' MeV; time [ns]'
184 title_suffix =
' [' + str(fromEnergy) +
' .. ' + str(toEnergy) +
') MeV; time [ns]'
187 if (partition ==
'LBA')
or (partition ==
'LBC'):
188 for samp
in range(0,len(samples_LB)):
189 name =
'Cell_time_' + partition +
'_' + samples_LB[samp] +
'_' + gain +
'_slice_' + str(index)
190 title =
'Partition ' + partition +
', sampling ' + samples_LB[samp] +
': ' + gain +
' Tile Cell time in energy range' + title_suffix
191 cellTimeGroup.defineHistogram(name, title = title, path = partition, type =
'TH1F',
192 xbins = 600, xmin = -30.0, xmax = 30.0)
194 for samp
in range(0,len(samples_EB)):
195 name =
'Cell_time_' + partition +
'_' + samples_EB[samp] +
'_' + gain +
'_slice_' + str(index)
196 title =
'Partition ' + partition +
', sampling ' + samples_EB[samp] +
': ' + gain +
' Tile Cell time in energy range' + title_suffix
197 cellTimeGroup.defineHistogram(name, title = title, path = partition, type =
'TH1F',
198 xbins = 600, xmin = -30.0, xmax = 30.0)
202 for module
in flags.Tile.doTimingHistogramsForCell:
203 if partition
in module:
204 for cell
in flags.Tile.doTimingHistogramsForCell[module]:
205 name =
'Cell_time_' + module +
'_' + cell +
'_' + gain +
'_slice_' + str(index)
206 title =
'Module ' + module +
', cell ' + cell +
': ' + gain +
' Tile Cell time in energy range' + title_suffix
207 selectedCellTimeGroup.defineHistogram(name, title = title, path = partition, type =
'TH1F',
208 xbins = 600, xmin = -30.0, xmax = 30.0)
210 toEnergy_ch = energies[index] / 2
if index < len(energies)
else None
211 fromEnergy_ch = energies[index - 1] / 2
if index > 0
else None
213 title_suffix_ch =
' > ' + str(fromEnergy_ch) +
' MeV; time [ns]'
214 elif not fromEnergy_ch:
215 title_suffix_ch =
' < ' + str(toEnergy_ch) +
' MeV; time [ns]'
217 title_suffix_ch =
' [' + str(fromEnergy_ch) +
' .. ' + str(toEnergy_ch) +
') MeV; time [ns]'
220 for channel
in getChannelsForCell(module, cell):
221 name =
'Cell_time_' + module +
'_' + cell +
'_ch' + str(channel) +
'_' + gain +
'_slice_' + str(index)
222 title =
'Module ' + module +
', cell ' + cell +
', channel ' + str(channel) +
': ' + gain +
' Tile Channel time in energy range' + title_suffix_ch
223 selectedChanTimeGroup.defineHistogram(name, title = title, path = partition, type =
'TH1F',
224 xbins = 600, xmin = -30.0, xmax = 30.0)
229 cellEnergyProfileGroup = helper.addGroup(tileJetMonAlg,
'TileJetCellEnergyProfile',
'Tile/Jet/CellTime/')
231 selectedCellEnergyProfileGroup = helper.addGroup(tileJetMonAlg,
'TileJetSelCellEnergyProfile',
'Tile/Jet/SelectedCellTime/')
232 selectedChanEnergyProfileGroup = helper.addGroup(tileJetMonAlg,
'TileJetSelChanEnergyProfile',
'Tile/Jet/SelectedChanTime/')
233 for partition
in partitions:
236 if (partition ==
'LBA')
or (partition ==
'LBC'):
237 for samp
in range(0,len(samples_LB)):
238 name =
'index_' + partition +
'_' + samples_LB[samp] +
'_' + gain
239 name +=
',energy_' + partition +
'_' + samples_LB[samp] +
'_' + gain
240 name +=
';Cell_ene_' + partition +
'_' + samples_LB[samp] +
'_' + gain +
'_prof'
241 title =
'Partition ' + partition +
', sampling ' + samples_LB[samp] +
': ' + gain +
' Tile Cell energy profile;Slice;Energy [MeV]'
242 xmax = len(energiesALL[gain]) + 0.5
243 nbins = len(energiesALL[gain]) + 1
244 cellEnergyProfileGroup.defineHistogram(name, title = title, path = partition, type =
'TProfile',
245 xbins = nbins, xmin = -0.5, xmax = xmax)
247 for samp
in range(0,len(samples_EB)):
248 name =
'index_' + partition +
'_' + samples_EB[samp] +
'_' + gain
249 name +=
',energy_' + partition +
'_' + samples_EB[samp] +
'_' + gain
250 name +=
';Cell_ene_' + partition +
'_' + samples_EB[samp] +
'_' + gain +
'_prof'
251 title =
'Partition ' + partition +
', sampling ' + samples_EB[samp] +
': ' + gain +
' Tile Cell energy profile;Slice;Energy [MeV]'
252 xmax = len(energiesALL[gain]) + 0.5
253 nbins = len(energiesALL[gain]) + 1
254 cellEnergyProfileGroup.defineHistogram(name, title = title, path = partition, type =
'TProfile',
255 xbins = nbins, xmin = -0.5, xmax = xmax)
259 for module
in flags.Tile.doTimingHistogramsForCell:
260 if partition
in module:
261 for cell
in flags.Tile.doTimingHistogramsForCell[module]:
262 name =
'index_' + module +
'_' + cell +
'_' + gain
263 name +=
',energy_' + module +
'_' + cell +
'_' + gain
264 name +=
';Cell_ene_' + module +
'_' + cell +
'_' + gain +
'_prof'
265 title =
'Module ' + module +
', cell ' + cell +
': ' + gain +
' Tile Cell energy profile;Slice;Energy [MeV]'
266 xmax = len(energiesALL[gain]) + 0.5
267 nbins = len(energiesALL[gain]) + 1
268 selectedCellEnergyProfileGroup.defineHistogram(name, title = title, path = partition, type =
'TProfile',
269 xbins = nbins, xmin = -0.5, xmax = xmax)
272 for channel
in getChannelsForCell(module, cell):
273 name =
'index_' + module +
'_' + cell +
'_ch' + str(channel) +
'_' + gain
274 name +=
',energy_' + module +
'_' + cell +
'_ch' + str(channel) +
'_' + gain
275 name +=
';Cell_ene_' + module +
'_' + cell +
'_ch' + str(channel) +
'_' + gain +
'_prof'
276 title =
'Module ' + module +
', cell ' + cell +
', channel ' + str(channel) +
': ' + gain +
' Tile Channel energy profile;Slice;Energy [MeV]'
277 xmax = len(energiesALL[gain]) + 0.5
278 nbins = len(energiesALL[gain]) + 1
279 selectedChanEnergyProfileGroup.defineHistogram(name, title = title, path = partition, type =
'TProfile',
280 xbins = nbins, xmin = -0.5, xmax = xmax)
285 cellEnergyGroup = helper.addGroup(tileJetMonAlg,
'TileJetCellEnergy',
'Tile/Jet/CellTime/')
287 selectedCellEnergyGroup = helper.addGroup(tileJetMonAlg,
'TileJetSelCellEnergy',
'Tile/Jet/SelectedCellTime/')
288 selectedChanEnergyGroup = helper.addGroup(tileJetMonAlg,
'TileJetSelChanEnergy',
'Tile/Jet/SelectedChanTime/')
289 for partition
in partitions:
291 energies = energiesALL[gain]
292 for index
in range(0, len(energies) + 1):
293 toEnergy = energies[index]
if index < len(energies)
else 2 * energies[index - 1]
294 fromEnergy = energies[index - 1]
if index > 0
else -1000
295 name =
'Cell_ene_' + partition +
'_' + gain +
'_slice_' + str(index)
296 title =
'Partition ' + partition +
': ' + gain +
' Tile Cell Energy'
297 title +=
' in energy range [' + str(fromEnergy) +
' .. ' + str(toEnergy) +
') MeV;Energy [MeV]'
298 cellEnergyGroup.defineHistogram(name, title = title, path = partition, type =
'TH1F',
299 xbins = 100, xmin = fromEnergy, xmax = toEnergy)
301 if (partition ==
'LBA')
or (partition ==
'LBC'):
302 for samp
in range(0,len(samples_LB)):
303 name =
'Cell_ene_' + partition +
'_' + samples_LB[samp] +
'_' + gain +
'_slice_' + str(index)
304 title =
'Partition ' + partition +
', sampling ' + samples_LB[samp] +
': ' + gain +
' Tile Cell Energy'
305 title +=
' in energy range [' + str(fromEnergy) +
' .. ' + str(toEnergy) +
') MeV;Energy [MeV]'
306 cellEnergyGroup.defineHistogram(name, title = title, path = partition, type =
'TH1F',
307 xbins = 100, xmin = fromEnergy, xmax = toEnergy)
309 for samp
in range(0,len(samples_EB)):
310 name =
'Cell_ene_' + partition +
'_' + samples_EB[samp] +
'_' + gain +
'_slice_' + str(index)
311 title =
'Partition ' + partition +
', sampling ' + samples_EB[samp] +
': ' + gain +
' Tile Cell Energy'
312 title +=
' in energy range [' + str(fromEnergy) +
' .. ' + str(toEnergy) +
') MeV;Energy [MeV]'
313 cellEnergyGroup.defineHistogram(name, title = title, path = partition, type =
'TH1F',
314 xbins = 100, xmin = fromEnergy, xmax = toEnergy)
318 for module
in flags.Tile.doTimingHistogramsForCell:
319 if partition
in module:
320 for cell
in flags.Tile.doTimingHistogramsForCell[module]:
321 name =
'Cell_ene_' + module +
'_' + cell +
'_' + gain +
'_slice_' + str(index)
322 title =
'Module ' + module +
', cell ' + cell +
': ' + gain +
' Tile Cell Energy'
323 title +=
' in energy range [' + str(fromEnergy) +
' .. ' + str(toEnergy) +
') MeV;Energy [MeV]'
324 selectedCellEnergyGroup.defineHistogram(name, title = title, path = partition, type =
'TH1F',
325 xbins = 100, xmin = fromEnergy, xmax = toEnergy)
328 for channel
in getChannelsForCell(module, cell):
329 name =
'Cell_ene_' + module +
'_' + cell +
'_ch' + str(channel) +
'_' + gain +
'_slice_' + str(index)
330 title =
'Module ' + module +
', cell ' + cell +
', channel ' + str(channel) +
': ' + gain +
' Tile Channel Energy'
331 title +=
' in energy range [' + str(fromEnergy / 2) +
' .. ' + str(toEnergy / 2) +
') MeV;Energy [MeV]'
332 selectedChanEnergyGroup.defineHistogram(name, title = title, path = partition, type =
'TH1F',
333 xbins = 100, xmin = fromEnergy / 2, xmax = toEnergy / 2)
335 from TileCalibBlobObjs.Classes
import TileCalibUtils
as Tile
340 channelTime1DGroup = helper.addGroup(tileJetMonAlg,
'TileJetChanTime1D',
'Tile/Jet/ChanTime/')
342 for ros
in range(1, Tile.MAX_ROS):
343 for module
in range(0, Tile.MAX_DRAWER):
344 for channel
in range(0, Tile.MAX_CHAN):
345 moduleName = Tile.getDrawerString(ros, module)
346 title =
'Time in ' + moduleName +
' channel ' + str(channel) +
';time [ns];N'
347 name = moduleName +
'_ch_' + str(channel) +
'_1d'
348 path = getPartitionName(ros) +
'/' + moduleName
349 channelTime1DGroup.defineHistogram(name, title = title, path = path, type =
'TH1F',
350 xbins = 600, xmin = -30.0, xmax = 30.0)
354 if DoEnergyDiffHistograms:
357 energyDiffGroup = helper.addGroup(tileJetMonAlg,
'TileJetEnergyDiff',
'Tile/Jet/EnergyDiff/')
359 for ros
in range(1, Tile.MAX_ROS):
360 for module
in range(0, Tile.MAX_DRAWER):
361 for channel
in range(0, Tile.MAX_CHAN):
364 moduleName = Tile.getDrawerString(ros, module)
365 title =
'Tile Cell Energy difference in ' + moduleName +
' channel ' + str(channel) +
' ' + gain
366 title +=
';#frac{ene1 - ene2}{ene1 + ene2}'
367 name = moduleName +
'_enediff_' + gain +
'_ch1_' + str(channel)
368 path = getPartitionName(ros) +
'/' + moduleName
369 energyDiffGroup.defineHistogram(name, title = title, path = path, type =
'TH1F',
370 xbins = 100, xmin = -1.0, xmax = 1.0)
374 accumalator = helper.result()
375 result.merge(accumalator)