ATLAS Offline Software
Loading...
Searching...
No Matches
TileJetMonitorAlgorithm Namespace Reference

Functions

 TileJetMonitoringConfig (flags, **kwargs)

Detailed Description

@file TileJetMonitorAlgorithm.py
@brief Python configuration of TileJetMonitorAlgorithm algorithm for the Run III

Function Documentation

◆ TileJetMonitoringConfig()

TileJetMonitorAlgorithm.TileJetMonitoringConfig ( flags,
** kwargs )
Function to configure TileJetMonitorAlgorithm algorithm in the monitoring system.

Definition at line 11 of file TileJetMonitorAlgorithm.py.

11def TileJetMonitoringConfig(flags, **kwargs):
12
13 ''' Function to configure TileJetMonitorAlgorithm algorithm in the monitoring system.'''
14
15 # Define one top-level monitoring algorithm. The new configuration
16 # framework uses a component accumulator.
17 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
18 result = ComponentAccumulator()
19
20 from TileGeoModel.TileGMConfig import TileGMCfg
21 result.merge(TileGMCfg(flags))
22
23 from LArGeoAlgsNV.LArGMConfig import LArGMCfg
24 result.merge(LArGMCfg(flags))
25
26 from TileConditions.TileCablingSvcConfig import TileCablingSvcCfg
27 result.merge( TileCablingSvcCfg(flags) )
28
29 from TileConditions.TileBadChannelsConfig import TileBadChanToolCfg
30 badChanTool = result.popToolsAndMerge( TileBadChanToolCfg(flags) )
31
32 # The following class will make a sequence, configure algorithms, and link
33 # them to GenericMonitoringTools
34 from AthenaMonitoring import AthMonitorCfgHelper
35 helper = AthMonitorCfgHelper(flags,'TileMonitoring')
36
37 # Adding an TileJetMonitorAlgorithm algorithm to the helper
38 from AthenaConfiguration.ComponentFactory import CompFactory
39 tileJetMonAlg = helper.addAlgorithm(CompFactory.TileJetMonitorAlgorithm, 'TileJetMonAlg')
40
41 tileJetMonAlg.TileBadChanTool = badChanTool
42 tileJetMonAlg.TriggerChain = ''
43
44 if flags.Tile.doTimingHistogramsForGain in [0, 1]:
45 kwargs.setdefault('Do1DHistograms', True)
46 if flags.Tile.doTimingHistogramsForGain == 0:
47 # Low Gain
48 kwargs.setdefault('ChannelEnergyMin', 15000)
49 kwargs.setdefault('ChannelEnergyMax', 50000)
50 kwargs.setdefault('Gain', 0)
51
52 else:
53 # High Gain
54 kwargs.setdefault('ChannelEnergyMin', 2000)
55 kwargs.setdefault('ChannelEnergyMax', 4000)
56 kwargs.setdefault('Gain', 1)
57
58 if len(flags.Tile.doTimingHistogramsForCell) > 0:
59 kwargs.setdefault('DoCellHistograms', True)
60
61 for k, v in kwargs.items():
62 setattr(tileJetMonAlg, k, v)
63
64 DoEnergyProfiles = kwargs.get('DoEnergyProfiles', tileJetMonAlg._descriptors['DoEnergyProfiles'].default)
65
66 Do1DHistograms = kwargs.get('Do1DHistograms', tileJetMonAlg._descriptors['Do1DHistograms'].default)
67 DoEnergyDiffHistograms = kwargs.get('DoEnergyDiffHistograms', tileJetMonAlg._descriptors['DoEnergyDiffHistograms'].default)
68
69 DoCellHistograms = kwargs.get('DoCellHistograms', tileJetMonAlg._descriptors['DoCellHistograms'].default)
70
71 from AthenaMonitoring.DQConfigFlags import DQDataType
72 if flags.DQ.DataType not in (DQDataType.HeavyIon, DQDataType.Cosmics):
73
74 jvtTool = CompFactory.JetVertexTaggerTool()
75 jetContainer = kwargs.get('JetContainer', tileJetMonAlg._descriptors['JetContainer'].default)
76 jvtTool.JetContainer = str(jetContainer)
77 tileJetMonAlg.JVT = jvtTool
78
79 jetCleaningTool = CompFactory.JetCleaningTool()
80 jetCleaningTool.CutLevel = "LooseBad"
81 jetCleaningTool.DoUgly = False
82 jetCleaningTool.JetContainer = str(jetContainer)
83
84 tileJetMonAlg.JetCleaningTool = jetCleaningTool
85 result.addPublicTool(jetCleaningTool)
86
87 jetPtMin = 20000
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
99
100 tileJetMonAlg.EventCleaningTool = eventCleaningTool
101 tileJetMonAlg.JetTrackingEtaLimit = jetTrackingEtaLimit
102 tileJetMonAlg.JetPtMin = jetPtMin
103
104 tileJetMonAlg.DoEventCleaning = True
105 tileJetMonAlg.DoJetCleaning = True
106
107 else:
108
109 tileJetMonAlg.DoEventCleaning = False
110 tileJetMonAlg.DoJetCleaning = False
111
112 if flags.Reco.EnableHI:
113 if flags.Tracking.doUPC:
114 tileJetMonAlg.JetContainer = 'AntiKt4EMPFlowJets'
115 else:
116 tileJetMonAlg.JetContainer = 'AntiKt4HIJets'
117
118 # 1) Configure histogram with TileJetMonAlg algorithm execution time
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)
123
124
125
126 from TileMonitoring.TileMonitoringCfgHelper import addValueVsModuleAndChannelMaps, getPartitionName, getChannelsForCell
127 runNumber = flags.Input.RunNumbers[0]
128
129
130 # 2) Configure 2D histograms (profiles/maps) with Tile channel time vs module and channel per partion (DQ summary)
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))
134
135
136 gains = ['LG', 'HG']
137 partitions = ['LBA', 'LBC', 'EBA', 'EBC']
138
139 # 3a) Configure 1D histograms with Tile channel time per partition
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
144 path = partition
145 channelTimeGroup.defineHistogram(name, title = title, path = path, type = 'TH1F',
146 xbins = 600, xmin = -30.0, xmax = 30.0)
147
148 # 3b) Configure 1D histograms with Tile channel time per partition for extended barrels without scintillators
149 for partition in ['EBA', 'EBC']:
150 title = 'Partition ' + partition + ': Tile Channel Time (without scintillators);time [ns];N'
151 name = 'channelTime' + partition + '_NoScint'
152 path = partition
153 channelTimeGroup.defineHistogram(name, title = title, path = path, type = 'TH1F',
154 xbins = 600, xmin = -30.0, xmax = 30.0)
155
156
157 # Energy upper limits of the cell-time histograms
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
163
164 samples_LB = ['A', 'B', 'D', 'B9']
165 samples_EB = ['A', 'B', 'D', 'C10', 'D4', 'E1', 'E2', 'E3', 'E4']
166
167 # 4) Configure histograms with Tile cell time in energy slices per partition and gain
168 cellTimeGroup = helper.addGroup(tileJetMonAlg, 'TileJetCellTime', 'Tile/Jet/CellTime/')
169 if DoCellHistograms:
170 selectedCellTimeGroup = helper.addGroup(tileJetMonAlg, 'TileJetSelCellTime', 'Tile/Jet/SelectedCellTime/')
171 selectedChanTimeGroup = helper.addGroup(tileJetMonAlg, 'TileJetSelChanTime', 'Tile/Jet/SelectedChanTime/')
172 for partition in partitions:
173 for gain in gains:
174 index = 0
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
179 if not toEnergy:
180 title_suffix = ' > ' + str(fromEnergy) + ' MeV; time [ns]'
181 elif not fromEnergy:
182 title_suffix = ' < ' + str(toEnergy) + ' MeV; time [ns]'
183 else:
184 title_suffix = ' [' + str(fromEnergy) + ' .. ' + str(toEnergy) + ') MeV; time [ns]'
185
186 # TD: add histograms per partition and per radial sampling
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)
193 else:
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)
199
200 # Add histograms per selected individual cell
201 if DoCellHistograms:
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)
209
210 toEnergy_ch = energies[index] / 2 if index < len(energies) else None
211 fromEnergy_ch = energies[index - 1] / 2 if index > 0 else None
212 if not toEnergy_ch:
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]'
216 else:
217 title_suffix_ch = ' [' + str(fromEnergy_ch) + ' .. ' + str(toEnergy_ch) + ') MeV; time [ns]'
218
219 # Add histograms per channels of selected individual cell
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)
225
226 if DoEnergyProfiles:
227
228 # 5) Configure 1D histograms (profiles) with Tile cell energy profile in energy slices per partition and gain
229 cellEnergyProfileGroup = helper.addGroup(tileJetMonAlg, 'TileJetCellEnergyProfile', 'Tile/Jet/CellTime/')
230 if DoCellHistograms:
231 selectedCellEnergyProfileGroup = helper.addGroup(tileJetMonAlg, 'TileJetSelCellEnergyProfile', 'Tile/Jet/SelectedCellTime/')
232 selectedChanEnergyProfileGroup = helper.addGroup(tileJetMonAlg, 'TileJetSelChanEnergyProfile', 'Tile/Jet/SelectedChanTime/')
233 for partition in partitions:
234 for gain in gains:
235 # TD: add profiles per partition and per sampling
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)
246 else:
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)
256
257 # Add profiles per selected individual cell
258 if DoCellHistograms:
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)
270
271 # Add profiles per channels of selected individual cell
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)
281
282 else:
283
284 # 6) Configure 1D histograms with Tile cell energy in energy slices per partition, gain and slice
285 cellEnergyGroup = helper.addGroup(tileJetMonAlg, 'TileJetCellEnergy', 'Tile/Jet/CellTime/')
286 if DoCellHistograms:
287 selectedCellEnergyGroup = helper.addGroup(tileJetMonAlg, 'TileJetSelCellEnergy', 'Tile/Jet/SelectedCellTime/')
288 selectedChanEnergyGroup = helper.addGroup(tileJetMonAlg, 'TileJetSelChanEnergy', 'Tile/Jet/SelectedChanTime/')
289 for partition in partitions:
290 for gain in gains:
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)
300 # TD: add histograms per partition
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)
308 else:
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)
315
316 # Add histograms per selected individual cell
317 if DoCellHistograms:
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)
326
327 # Add profiles per channels of selected individual cell
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)
334
335 from TileCalibBlobObjs.Classes import TileCalibUtils as Tile
336
337 if Do1DHistograms:
338
339 # 7) Configure 1D histograms with Tile channel time per channel
340 channelTime1DGroup = helper.addGroup(tileJetMonAlg, 'TileJetChanTime1D', 'Tile/Jet/ChanTime/')
341
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)
351
352
353
354 if DoEnergyDiffHistograms:
355
356 # 7) Configure 1D histograms with Tile cell relative energy difference between two channels per even channel
357 energyDiffGroup = helper.addGroup(tileJetMonAlg, 'TileJetEnergyDiff', 'Tile/Jet/EnergyDiff/')
358
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):
362 if not channel % 2:
363 for gain in gains:
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)
371
372
373
374 accumalator = helper.result()
375 result.merge(accumalator)
376 return result
377