5 @file TileMonitoringHelper.py
6 @brief Helper functions for Run 3 Tile monitoring algorithm configuration
9 from TileCalibBlobObjs.Classes
import TileCalibUtils
as Tile
10 _cellNameEB = [
'E3',
'E4',
'D4',
'D4',
'C10',
'C10',
'A12',
'A12',
'B11',
'B11',
'A13',
'A13',
11 'E1',
'E2',
'B12',
'B12',
'D5',
'D5',
'E3*',
'E4*',
'A14',
'A14',
'B13',
'B13',
12 '',
'',
'',
'',
'',
'',
'B14',
'A15',
'A15',
'',
'',
'B14',
13 'B15',
'D6',
'D6',
'B15',
'A16',
'A16',
'',
'',
'',
'',
'',
'']
16 _cellNameLB = [
'D0',
'A1',
'B1',
'B1',
'A1',
'A2',
'B2',
'B2',
'A2',
'A3',
'A3',
'B3',
17 'B3',
'D1',
'D1',
'A4',
'B4',
'B4',
'A4',
'A5',
'A5',
'B5',
'B5',
'A6',
18 'D2',
'D2',
'A6',
'B6',
'B6',
'A7',
'',
'',
'A7',
'B7',
'B7',
'A8',
19 'A9',
'A9',
'A8',
'B8',
'B8',
'D3',
'B9',
'',
'D3',
'A10',
'A10',
'B9']
22 _partitionName = {0:
'AUX', 1 :
'LBA', 2 :
'LBC', 3 :
'EBA', 4 :
'EBC', 5 :
'AllPart'}
23 _gainName = {0 :
'LG', 1 :
'HG'}
24 _sampleName = {0 :
'SampA', 1 :
'SampB', 2 :
'SampD', 3 :
'SampE', 4 :
'AllSamp'}
26 _cellNameTMDB_LB = [
"D0",
"D1L",
"D1R",
"D2R",
"D2L",
"D3L",
"D3R",
""]
27 _cellNameTMDB_EB = [
"D5L",
"D5R",
"D6L",
"D6R"]
31 This function returns name of Tile cell for given partition and channel.
34 partition -- Tile partition name (LBA, LBC, EBA, EBC)
35 channel -- Tile channel number ([0..47])
37 return _cellNameLB[channel]
if partition.startswith(
'L')
else _cellNameEB[channel]
42 This function returns name of Tile partition for given ROS.
45 ros -- Tile ROS ([0..5])
47 return _partitionName[ros]
52 This function returns name of Tile gain name
55 gain -- Tile gain ([0,1])
57 return _gainName[
int(gain)]
62 This function returns name of Tile sample name
65 sample -- Tile sample ([0..4])
67 return _sampleName[
int(sample)]
72 This function returns name of Tile histogram.
75 name -- Name of histogram, actual name is constructed dynamicaly like:
76 name [+ partition] [+ sample] [+gain] [+ trigger]
77 separator -- Separtor between name, partition, sample, gain, and trigger
80 partition = kwargs.get(
'partition',
'')
81 trigger = kwargs.get(
'trigger',
'')
82 sample = kwargs.get(
'sample',
'')
83 gain = kwargs.get(
'gain',
'')
86 fullName += separator + partition
if partition
else ''
87 fullName += separator + sample
if sample
else ''
88 fullName += separator + gain
if gain
else ''
89 fullName += separator + trigger
if trigger
else ''
96 This function returns title of Tile histogram.
99 title -- Title of histogram, actual title is constructed dynamicaly like:
100 [run +] [trigger +] [partion +] [sample +] [gain +] title
103 partition = kwargs.get(
'partition',
'')
104 trigger = kwargs.get(
'trigger',
'')
105 sample = kwargs.get(
'sample',
'')
106 gain = kwargs.get(
'gain',
'')
107 run = kwargs.get(
'run',
'')
109 fullTitle =
'Partition ' + partition
if partition
else ''
110 fullTitle +=
' Tile Cell ' + sample +
' ' if sample
else ''
111 fullTitle +=
' ' + gain
if gain
else ''
112 fullTitle +=
': ' + title
114 fullTitle =
'Trigger ' + trigger +
' ' + fullTitle
if trigger
else fullTitle
115 fullTitle =
'Run ' + run +
' ' + fullTitle
if run
else fullTitle
122 This function returns path of Tile histogram.
125 path -- Path of histogram, actual path is constructed dynamicaly like:
126 path [+ trigger] [+ partition]
129 partition = kwargs.get(
'partition',
'')
130 trigger = kwargs.get(
'trigger',
'')
131 subDirectory = kwargs.get(
'subDirectory',
False)
133 fullPath = path +
'/' + trigger
if trigger
else path
134 fullPath +=
'/' + partition
if partition
and subDirectory
else ''
142 This function returns list of Tile module names for given partition.
145 partition -- Tile partition name (LBA, LBC, EBA, EBC)
148 if partition ==
'AllPart':
149 labels = [
str(module)
for module
in range(1, Tile.MAX_DRAWER + 1)]
151 ros = {
'LBA' : 1,
'LBC' : 2,
'EBA' : 3,
'EBC' : 4}
152 labels = [Tile.getDrawerString(ros[partition], module)
for module
in range(0, Tile.MAX_DRAWER)]
159 This function returns list of Tile cell names with channes for given partition.
162 partition -- Tile partition name (LBA, LBC, EBA, EBC)
166 for channel
in range(0, Tile.MAX_CHAN):
168 label = cellName +
'_' +
'ch' +
str(channel)
if cellName
else 'ch' +
str(channel)
175 This function returns list of labels for Tile histograms.
177 This function returns list of Tile module or channel names for given partition
178 in the case of input labels is modules or channels. Otherwise it returns given labels.
181 labels -- List of labels, "modules" and "channels" have special meaning,
182 in this case corresponding labels will be generated dynamicaly
183 partition -- Tile partition name (LBA, LBC, EBA, EBC)
186 if 'modules' in labels:
188 elif 'channels' in labels:
195 return _cellNameTMDB_LB[channel]
if partition.startswith(
'L')
else _cellNameTMDB_EB[channel]
198 return _cellNameTMDB_LB
if partition.startswith(
'L')
else _cellNameTMDB_EB
202 ''' Function to get legacy channel number from Tile Demonatrator '''
204 legacyChannel = channel
205 if (useDemoCabling == 2015
and partition ==
'EBC' and drawer == 1):
206 demo2legacy = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
207 26, 25, 24, 29, 31, 32, 27, 28, 30, 35, 34, 33, 38, 37, 43, 44, 41, 40, 39, 36, 42, 47, 46, 45]
208 legacyChannel = demo2legacy[channel]
209 elif useDemoCabling >= 2016
and useDemoCabling <= 2019
and partition ==
'LBC' and (drawer == 1
or drawer > 2):
210 demo2legacy = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
211 26, 25, 24, 29, 28, 27, 32, 31, 30, 35, 34, 33, 38, 37, 36, 41, 40, 39, 44, 43, 42, 47, 46, 45]
212 legacyChannel = demo2legacy[channel]
213 elif useDemoCabling >= 2018
and partition ==
'EBC' and drawer >= 2:
214 demo2legacyEB = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
215 31, 32, 30, 35, 33, 34, 38, 37, 41, 40, 39, 36, 26, 25, 24, 29, 28, 27, 44, 43, 42, 47, 46, 45]
216 legacyChannel = demo2legacyEB[channel]
223 This function configures 2D histograms (maps) with Tile monitored value vs module and channel per partion.
226 group -- Group (technically, a GenericMonitoringTool instance)
227 name -- Name of histogram (actual name is constructed dynamicaly like: name + partition + trigger)
228 title -- Title of histogram (actual title is constructed dynamicaly like: run + trigger + partion + title)
229 path -- Path in file for histogram (relative to the path of given group)
230 subDirectory -- Put the configured histograms into sub directory named like partion (True, False)
231 type -- Type of histogram (TH2D, TProfile2D)
232 value -- Name of monitored value (needed for TProfile2D)
233 trigger -- Name of trigger (given it will be put into title and name of histogram)
234 run -- Run number (given it will be put into the title)
237 for ros
in range(1, Tile.MAX_ROS):
241 for module
in range(1, Tile.MAX_DRAWER + 1):
242 label = partition +
'0' +
str(module)
if module < 10
else partition +
str(module)
243 xlabels.append(label)
245 for channel
in range(0, Tile.MAX_CHAN):
247 label = cellName +
'_' +
'ch' +
str(channel)
if cellName
else 'ch' +
str(channel)
248 ylabels.append(label)
250 fullName =
'module' + partition +
',channel' + partition
251 if 'Profile' in type:
252 fullName += (
',' + value + partition)
253 fullName +=
';' + name + partition + trigger
255 fullPath = path +
'/' + partition
if subDirectory
else path
257 fullTitle =
'Partition ' + partition +
': ' + title
259 fullTitle =
'Trigger ' + trigger +
' ' + fullTitle
261 fullTitle =
'Run ' + run +
' ' + fullTitle
263 group.defineHistogram( fullName, path = fullPath, type = type, title = fullTitle,
264 xbins = 64, xmin = 0.5, xmax = 64.5, ybins = 48, ymin = -0.5, ymax = 47.5,
265 xlabels = xlabels, ylabels = ylabels )
268 def _getDimensions(triggers = [], perPartition = False, perSample = False, perGain = False, allPartitions = False):
272 dimensions += [
int(Tile.MAX_ROS)]
if allPartitions
else [
int(Tile.MAX_ROS - 1)]
274 dimensions += [len(_sampleName)]
276 dimensions += [
int(Tile.MAX_GAIN)]
278 dimensions += [len(triggers)]
283 def _parsePostfix(postfix, triggers = [], perPartition = False, perSample = False, perGain = False):
286 elements = postfix.split(
'_')
289 kwargs[
'trigger'] = triggers[
int(elements.pop())]
295 kwargs[
'ros'] =
int(elements.pop()) + 1
301 title = '', path = '', weight = '', xbins = 0, xmin = 0., xmax = 0.,
302 ybins = 0, ymin = 0., ymax = 0., type = 'TH2D', run = '', triggers = [],
303 xlabels = (), ylabels = (), opt =
'', subDirectory =
False, perPartition =
False,
304 perSample =
False, perGain =
False, allPartitions =
False, separator =
'_', merge =
None ):
306 This function configures 2D histograms with Tile monitored value per L1 trigger, partition, sample, gain.
310 algorithm -- Monitoring algorithm
311 name -- Name of histogram, actual name is constructed dynamicaly like:
312 name + partition + sample + gain + trigger
313 xvalue -- Name of monitored value for x axis
314 yvalue -- Name of monitored value for y axis
315 value -- Name of monitored value for profile (needed for TProfile2D)
316 title -- Title of histogram, actual title is constructed dynamicaly like:
317 run + trigger + partion + sample + title
318 path -- Path in file for histogram (relative to the path of given group)
319 subDirectory -- Put the configured histograms into sub directory named like partion (True, False)
320 type -- Type of histogram (TH2D, TProfile2D)
321 run -- Run number (given it will be put into the title)
322 triggers -- Name of triggers (given it will be put into title and name of histogram)
323 xlabels -- List of bin labels for x axis, "modules" and "channels" have special meaning,
324 in this case corresponding labels will be generated dynamicaly
325 ylabels -- List of bin labels for y axis, "modules" and "channels" have special meaning,
326 in this case corresponding labels will be generated dynamicaly
327 perPartition -- Configure histograms per partition (if True partition name will be put into the title)
328 perSample -- Configure histograms per sample (if True sample name will be put into the title)
329 perGain -- Configure histograms per gain (if True gain name will be put into the title)
330 allPartitions -- Configure additional histogram with information from all partitions
331 separator -- Given it will be used as separtor between name and trigger
332 merge -- Whether to use a different histogram merging algorithm (must be "merge" for opt=kAddBinsDynamically)
337 dimensions =
_getDimensions(triggers = triggers, perPartition = perPartition, perSample = perSample,
338 perGain = perGain, allPartitions = allPartitions)
340 array = helper.addArray(dimensions, algorithm, name, topPath = path)
341 for postfix, tool
in array.Tools.items():
343 kwargs =
_parsePostfix(postfix, triggers = triggers, perPartition = perPartition,
344 perSample = perSample, perGain = perGain)
346 partition = kwargs[
'partition']
if 'partition' in kwargs
else ''
351 fullName = xvalue +
',' + yvalue + (
',' + value
if 'Profile' in type
else '') +
';'
356 gain = kwargs.get(
'gain',
None)
357 gainTitle = title.get(gain, title)
if gain
and builtins.type(title)
is dict
else title
358 partitionTitle = gainTitle[partition]
if builtins.type(gainTitle)
is dict
else gainTitle
361 tool.defineHistogram( fullName, path = subPath, type = type, title = fullTitle,
362 xlabels = nxlabels, ylabels = nylabels,
363 xbins = xbins, xmin = xmin, xmax = xmax,
364 ybins = ybins, ymin = ymin, ymax = ymax,
365 weight = weight, opt = opt, merge = merge)
371 subDirectory = False, type = 'TH2D', value = '',
372 run = '', triggers = [], perGain = False, separator = '_'):
374 This function configures 2D histograms (maps) with Tile monitored value vs module and channel per partition.
378 algorithm -- Monitoring algorithm
379 name -- Name of histogram, actual name is constructed dynamicaly like:
380 name + partition + gain + trigger
381 title -- Title of histogram, actual title is constructed dynamicaly like:
382 run + trigger + partion + gain + title
383 path -- Path in file for histogram (relative to the path of given group)
384 subDirectory -- Put the configured histograms into sub directory named like partion (True, False)
385 type -- Type of histogram (TH2D, TProfile2D)
386 value -- Name of monitored value (needed for TProfile2D)
387 run -- Run number (given it will be put into the title)
388 triggers -- Name of triggers (given it will be put into title and name of histogram)
389 perGain -- Configure histograms per gain (if True gain name will be put into the title)
390 separator -- Given it will be used as separtor between name, gain, and trigger
394 xvalue =
'module', yvalue =
'channel', value = value, type = type,
395 xbins = Tile.MAX_DRAWER, xmin = -0.5, xmax = Tile.MAX_DRAWER - 0.5,
396 ybins = Tile.MAX_CHAN, ymin = -0.5, ymax = Tile.MAX_CHAN - 0.5,
397 run = run, xlabels = (
'modules'), ylabels = (
'channels'),
398 triggers = triggers, subDirectory = subDirectory, perGain = perGain,
399 perPartition =
True, separator = separator)
403 subDirectory = False, type = 'TH2D', value = '', run = '',
404 triggers = [], perGain = False, allPartitions = False, separator = '_'):
406 This function configures 2D histograms (maps) with Tile monitored value vs module and channel per partition.
410 algorithm -- Monitoring algorithm
411 name -- Name of histogram, actual name is constructed dynamicaly like:
412 name + partition + gain + trigger
413 title -- Title of histogram, actual title is constructed dynamicaly like:
414 run + trigger + partion + gain + title
415 path -- Path in file for histogram (relative to the path of given group)
416 subDirectory -- Put the configured histograms into sub directory named like partion (True, False)
417 type -- Type of histogram (TH2D, TProfile2D)
418 value -- Name of monitored value (needed for TProfile2D)
419 run -- Run number (given it will be put into the title)
420 triggers -- Name of triggers (given it will be put into title and name of histogram)
421 perGain -- Configure histograms per gain (if True gain name will be put into the title)
422 allPartitions -- Configure additional histogram with information from all partitions
423 separator -- Given it will be used as separtor between name, gain, and trigger
427 xvalue =
'firstModule', yvalue =
'secondModule', value = value,
428 xbins = Tile.MAX_DRAWER, xmin = -0.5, xmax = Tile.MAX_DRAWER - 0.5,
429 ybins = Tile.MAX_DRAWER, ymin = -0.5, ymax = Tile.MAX_DRAWER - 0.5,
430 run = run, xlabels = (
'modules'), ylabels = (
'modules'), type = type,
431 triggers = triggers, subDirectory = subDirectory, perGain = perGain,
432 perPartition =
True, allPartitions = allPartitions, separator = separator)
437 type = 'TH2D', value = '', run = '', triggers = [],
438 perGain = False, separator = '_'):
440 This function configures 2D histograms (maps) with Tile monitored value vs module and partition.
444 algorithm -- Monitoring algorithm
445 name -- Name of histogram, actual name is constructed dynamicaly like:
446 name + partition + gain + trigger
447 title -- Title of histogram, actual title is constructed dynamicaly like:
448 run + trigger + partion + gain + title
449 path -- Path in file for histogram (relative to the path of given group)
450 type -- Type of histogram (TH2D, TProfile2D)
451 value -- Name of monitored value (needed for TProfile2D)
452 run -- Run number (given it will be put into the title)
453 triggers -- Name of triggers (given it will be put into title and name of histogram)
454 perGain -- Configure histograms per gain (if True gain name will be put into the title)
455 separator -- Given it will be used as separtor between name, gain, and trigger
459 path = path, weight = weight, run = run, type = type,
460 xvalue =
'module', yvalue =
'partition', value = value,
461 xbins = Tile.MAX_DRAWER, xmin = -0.5, xmax = Tile.MAX_DRAWER - 0.5,
462 ybins = Tile.MAX_ROS - 1, ymin = -0.5, ymax = Tile.MAX_ROS - 1.5,
463 xlabels = [
str(module)
for module
in range(1, Tile.MAX_DRAWER + 1)],
465 triggers = triggers, perGain = perGain, separator = separator)
470 subDirectory = False, type = 'TH2D', value = '',
471 run = '', triggers = [], perGain = False, separator = '_'):
473 This function configures 2D histograms (maps) with Tile monitored value vs module and digitizer per partition.
477 algorithm -- Monitoring algorithm
478 name -- Name of histogram, actual name is constructed dynamicaly like:
479 name + partition + gain + trigger
480 title -- Title of histogram, actual title is constructed dynamicaly like:
481 run + trigger + partion + gain + title
482 path -- Path in file for histogram (relative to the path of given group)
483 subDirectory -- Put the configured histograms into sub directory named like partion (True, False)
484 type -- Type of histogram (TH2D, TProfile2D)
485 value -- Name of monitored value (needed for TProfile2D)
486 run -- Run number (given it will be put into the title)
487 triggers -- Name of triggers (given it will be put into title and name of histogram)
488 perGain -- Configure histograms per gain (if True gain name will be put into the title)
489 separator -- Given it will be used as separtor between name, gain, and trigger
493 weight = weight, xvalue =
'module', yvalue =
'digitizer', value = value,
494 xbins = Tile.MAX_DRAWER, xmin = -0.5, xmax = Tile.MAX_DRAWER - 0.5,
495 ybins = 8, ymin = 0.5, ymax = 8.5, run = run, xlabels = (
'modules'),
496 ylabels = (), triggers = triggers, type = type,subDirectory = subDirectory,
497 perGain = perGain, perPartition =
True, separator = separator)
502 run = '', triggers = [], perSample = True, perGain = False, separator = '_',
503 etaTitle= '#eta', etabins = 21, etamin = -2.025, etamax = 2.025,
504 phiTitle = '#phi', phibins = Tile.MAX_DRAWER, phimin = -3.15, phimax = 3.15):
506 This function configures 2D histograms (maps) with Tile monitored value vs eta and phi.
510 algorithm -- Monitoring algorithm
511 name -- Name of histogram, actual name is constructed dynamicaly like:
512 name + sample + gain + trigger
513 title -- Title of histogram, actual title is constructed dynamicaly like:
514 run + trigger + sample + gain + title
515 path -- Path in file for histogram (relative to the path of given group)
516 type -- Type of histogram (TH2D, TProfile2D)
517 value -- Name of monitored value (needed for TProfile2D)
518 run -- Run number (given it will be put into the title)
519 triggers -- Name of trigger (given it will be put into title and name of histogram)
520 perSample -- Configure histograms per sample (if True sample name will be put into the title)
521 perGain -- Configure histograms per gain (if True gain name will be put into the title)
522 separator -- Given it will be used as separtor between name, gain, and trigger
526 title = title +
';' + etaTitle +
';' + phiTitle,
527 path = path, weight = weight, type = type,
528 xvalue =
'eta', yvalue =
'phi', value = value,
529 xbins = etabins, xmin = etamin, xmax = etamax,
530 ybins = phibins, ymin = phimin, ymax = phimax,
531 run = run, triggers = triggers, perGain = perGain,
532 perSample = perSample, separator = separator)
537 weight = '', xbins = 0, xmin = 0., xmax = 0., type = 'TH1D', run = '', triggers = [],
538 subDirectory = False, perPartition = True, perSample = False, opt = '',
539 perGain = False, xlabels = (), allPartitions =
False, separator =
'_', merge =
None ):
541 This function configures 1D histograms with Tile monitored value per L1 trigger, partition, sample, gain.
545 algorithm -- Monitoring algorithm
546 name -- Name of histogram, actual name is constructed dynamicaly like:
547 name + partition + sample + trigger
548 xvalue -- Name of monitored value for x axis
549 value -- Name of monitored value (needed for TProfile)
550 title -- Title of histogram, actual title is constructed dynamicaly like:
551 run + trigger + partion + sample + title
552 path -- Path in file for histogram (relative to the path of given group)
553 subDirectory -- Put the configured histograms into sub directory named like partion (True, False)
554 type -- Type of histogram (TH1D, TProfile)
555 run -- Run number (given it will be put into the title)
556 triggers -- Name of triggers (given it will be put into title and name of histogram)
557 perPartition -- Configure histograms per partition (if True partition name will be put into the title)
558 perSample -- Configure histograms per sample (if True sample name will be put into the title)
559 perGain -- Configure histograms per gain (if True gain name will be put into the title)
560 xlabels -- List of bin labels
561 allPartitions -- Configure additional histogram with information from all partitions
562 separator -- Given it will be used as separtor between name and trigger
563 merge -- Whether to use a different histogram merging algorithm (must be "merge" for opt=kAddBinsDynamically)
566 dimensions =
_getDimensions(triggers = triggers, perPartition = perPartition, perSample = perSample,
567 perGain = perGain, allPartitions = allPartitions)
569 array = helper.addArray(dimensions, algorithm, name, topPath = path)
570 for postfix, tool
in array.Tools.items():
572 kwargs =
_parsePostfix(postfix, triggers = triggers, perPartition = perPartition,
573 perSample = perSample, perGain = perGain)
575 partition = kwargs[
'partition']
if 'partition' in kwargs
else ''
578 fullName = xvalue + (
',' + value
if 'Profile' in type
else '') +
';'
584 tool.defineHistogram( fullName, path = subPath, weight = weight, type = type, title = fullTitle,
585 xlabels = nxlabels, xbins = xbins, xmin = xmin, xmax = xmax, opt = opt, merge = merge)
593 type = 'TH1D', value = '', subDirectory = False,
594 triggers = [], run = '', separator = '_'):
596 This function configures 1D histograms with Tile monitored value vs module per partition.
600 algorithm -- Monitoring algorithm
601 name -- Name of histogram, actual name is constructed dynamicaly like:
602 name + partition + trigger
603 title -- Title of histogram, actual title is constructed dynamicaly like:
604 run + trigger + partion + title
605 path -- Path in file for histogram (relative to the path of given group)
606 type -- Type of histogram (TH1D, TProfile)
607 value -- Name of monitored value (needed for TProfile)
608 subDirectory -- Put the configured histograms into sub directory named like partion (True, False)
609 run -- Run number (given it will be put into the title)
610 separator -- Given it will be used as separtor between name and trigger
614 xvalue =
'module', value = value, title = title, path = path,
615 xbins = Tile.MAX_DRAWER, xmin = -0.5, xmax = Tile.MAX_DRAWER - 0.5,
616 run = run, triggers = triggers, subDirectory = subDirectory,
617 xlabels = (
'modules'), perPartition =
True, separator = separator )
621 xbins = 0, xmin = 0, xmax = 0,
622 title = '', path = '', type = 'TH2D', run = ''):
623 for ros
in range(1, Tile.MAX_ROS):
625 baseName =
"{}_{}".
format(name, partition)
626 nChannels = len(_cellNameTMDB_LB)
if partition.startswith(
'L')
else len(_cellNameTMDB_EB)
628 dimensions = [
int(Tile.MAX_DRAWER), nChannels, nChannels]
629 array = helper.addArray(dimensions, algorithm, baseName, topPath = path)
630 for postfix, tool
in array.Tools.items():
631 elements = postfix.split(
'_')
633 channel1 =
int(elements.pop())
634 channel2 =
int(elements.pop())
638 module =
'{}'.
format(
int(elements.pop()) + 1).rjust(2,
'0')
640 fullName =
'{},{};{}{}_{}_{}'.
format(xvalue, yvalue,
641 baseName, module, cell1, cell2)
642 hist_path = partition + module
644 moduleOrPartition =
'Module ' + partition + module + partition
645 fullTitle =
'Run {} {} TMDB {}x{}: {};{};{}'.
format(run, moduleOrPartition, cell1, cell2, title, cell1, cell2)
647 tool.defineHistogram(fullName, path = hist_path, type = type, title = fullTitle,
648 xbins = xbins, xmin = xmin, xmax = xmax,
649 ybins = xbins, ymin = xmin, ymax = xmax)
653 title = '', path = '', type = 'TH2D', run = ''):
654 array = helper.addArray([
int(Tile.MAX_ROS - 1)], algorithm, name, topPath = path)
655 for postfix, tool
in array.Tools.items():
656 ros =
int(postfix.split(
'_').pop()) + 1
661 ybins = len(nylabels)
663 fullName =
'module,channel' + (
',' + value
if 'Profile' in type
else '') +
';'
668 tool.defineHistogram( fullName, path =
'', type = type, title = fullTitle,
669 xlabels = nxlabels, ylabels = nylabels,
670 xbins = Tile.MAX_DRAWER, xmin = -0.5, xmax = Tile.MAX_DRAWER - 0.5,
671 ybins = ybins, ymin = -0.5, ymax = ybins - 0.5)
674 path = '', xbins = 0, xmin = 0., xmax = 0., type = 'TH1D', run = '',
675 perModule = False, isCorr=False):
677 for ros
in range(1, Tile.MAX_ROS):
679 baseName =
"{}_{}".
format(name, partition)
680 nChannels = len(_cellNameTMDB_LB)
if partition.startswith(
'L')
else len(_cellNameTMDB_EB)
682 dimensions = [
int(Tile.MAX_DRAWER), nChannels]
if perModule
else [nChannels]
684 dimensions = [
int(Tile.MAX_DRAWER), nChannels, nChannels]
686 array = helper.addArray(dimensions, algorithm, baseName, topPath = path)
687 for postfix, tool
in array.Tools.items():
688 elements = postfix.split(
'_')
690 channel =
int(elements.pop())
692 module =
'{}'.
format(
int(elements.pop()) + 1).rjust(2,
'0')
if perModule
else ''
694 fullName =
'{}{};{}{}_{}'.
format(xvalue, (
',' + value
if 'Profile' in type
else ''),
695 baseName, (module
if perModule
else ''), cell)
697 moduleOrPartition =
'Module ' + partition + module
if perModule
else 'Partition ' + partition
698 fullTitle =
'Run {} {} TMDB {}: {}'.
format(run, moduleOrPartition, cell, title)
700 channel1 =
int(elements.pop())
701 channel2 =
int(elements.pop())
705 module =
'{}'.
format(
int(elements.pop()) + 1).rjust(2,
'0')
if perModule
else ''
707 fullName =
'{}{};{}{}_{}_{}'.
format(xvalue, (
',' + value
if 'Profile' in type
else ''),
708 baseName, (module
if perModule
else ''), cell1, cell2)
710 moduleOrPartition =
'Module ' + partition + module
if perModule
else 'Partition ' + partition
711 fullTitle =
'Run {} {} TMDB {}x{}: {}'.
format(run, moduleOrPartition, cell1, cell2, title)
713 tool.defineHistogram(fullName, path =
'', type = type, title = fullTitle,
714 xbins = xbins, xmin = xmin, xmax = xmax)
718 xvalue, xbins, xmin, xmax, type='TH1D',
719 yvalue=None, ybins=None, ymin=None, ymax=None,
720 run='', value='', aliasSuffix=''):
722 This function configures 1D histograms with Tile monitored value per module, channel, gain.
726 algorithm -- Monitoring algorithm
727 name -- Name of histogram, actual name is constructed dynamicaly like:
728 name + mudule + channel + gain
729 title -- Title of histogram, actual title is constructed dynamicaly like:
730 run + module + channel + gain + title
731 path -- Path in file for histogram (relative to the path of given group)
732 xvalue -- Name of monitored value for x axis
733 yvalue -- Name of monitored value for y axis
734 type -- Type of histogram (TH1D, TProfile, TH2D)
735 value -- Name of monitored value (needed for TProfile)
736 run -- Run number (given it will be put into the title)
737 xlabels -- List of bin labels
741 dimensions = [
int(Tile.MAX_ROS) - 1,
int(Tile.MAX_DRAWER)]
742 array = helper.addArray(dimensions, algorithm, name, topPath = path)
744 for postfix, tool
in array.Tools.items():
745 ros, module = [
int(x)
for x
in postfix.split(
'_')[1:]]
746 moduleName = Tile.getDrawerString(ros + 1, module)
747 fullPath = moduleName
749 for channel
in range(0,
int(Tile.MAX_CHAN)):
750 channelName = f
'0{channel}' if channel < 10
else str(channel)
751 for gain
in range(0, Tile.MAX_GAIN):
752 gainName = {0 :
'low', 1 :
'high'}[gain]
753 nameSuffix = aliasSuffix
if aliasSuffix
else xvalue
754 fullName = f
'{xvalue}_{channel}_{gain}'
755 fullName += f
',{yvalue}_{channel}_{gain}' if yvalue
else ""
756 fullName += f
',{value}_{channel}_{gain};' if 'Profile' in type
else ';'
757 fullName += f
'{moduleName}_ch_{channelName}_{gainName[:2]}_{nameSuffix}'
758 fullTitle = f
'Run {run} {moduleName} Channel {channelName} {gainName} gain: {title}'
760 xbinsInGain = xbins[gain]
if builtins.type(xbins)
is list
else xbins
761 xminInGain = xmin[gain]
if builtins.type(xmin)
is list
else xmin
762 xmaxInGain = xmax[gain]
if builtins.type(xmax)
is list
else xmax
764 ybinsInGain = ybins[gain]
if builtins.type(ybins)
is list
else ybins
765 yminInGain = ymin[gain]
if builtins.type(ymin)
is list
else ymin
766 ymaxInGain = ymax[gain]
if builtins.type(ymax)
is list
else ymax
768 tool.defineHistogram(fullName, title = fullTitle, path = fullPath, type = type,
769 xbins = xbinsInGain, xmin = xminInGain, xmax = xmaxInGain,
770 ybins = ybinsInGain, ymin = yminInGain, ymax = ymaxInGain)