ATLAS Offline Software
Functions
TileRawChannelTimeMonitorAlgorithm Namespace Reference

Functions

def TileRawChannelTimeMonitoringConfig (flags, amplitudeFragIDs=None, **kwargs)
 

Function Documentation

◆ TileRawChannelTimeMonitoringConfig()

def TileRawChannelTimeMonitorAlgorithm.TileRawChannelTimeMonitoringConfig (   flags,
  amplitudeFragIDs = None,
**  kwargs 
)
Function to configure TileRawChannelTimeMonitorAlgorithm algorithm in the monitoring system.

Definition at line 11 of file TileRawChannelTimeMonitorAlgorithm.py.

11 def TileRawChannelTimeMonitoringConfig(flags, amplitudeFragIDs=None, **kwargs):
12 
13  ''' Function to configure TileRawChannelTimeMonitorAlgorithm 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 TileRecUtils.TileDQstatusConfig import TileDQstatusAlgCfg
21  result.merge( TileDQstatusAlgCfg(flags) )
22 
23  from TileGeoModel.TileGMConfig import TileGMCfg
24  result.merge(TileGMCfg(flags))
25 
26  from TileConditions.TileCablingSvcConfig import TileCablingSvcCfg
27  result.merge( TileCablingSvcCfg(flags) )
28 
29  from TileConditions.TileBadChannelsConfig import TileBadChannelsCondAlgCfg
30  result.merge( TileBadChannelsCondAlgCfg(flags, **kwargs) )
31 
32  from TileConditions.TileEMScaleConfig import TileEMScaleCondAlgCfg
33  result.merge( TileEMScaleCondAlgCfg(flags) )
34 
35  kwargs.setdefault('CheckDCS', flags.Tile.useDCS)
36  if kwargs['CheckDCS']:
37  from TileConditions.TileDCSConfig import TileDCSCondAlgCfg
38  result.merge( TileDCSCondAlgCfg(flags) )
39 
40  kwargs.setdefault('TriggerChain', '')
41  kwargs.setdefault('TriggerTypes', [0x34]) # Laser event Trigger type - 0x34, CIS trigger type - 0x32
42 
43  # Partition pairs to monitor average time difference between partitions (ROS - 1)
44  partitionPairs = [[0, 1], [0, 2], [0, 3], [1, 2], [1, 3], [2, 3]]
45  kwargs.setdefault('PartitionTimeDiffferncePairs', partitionPairs)
46 
47  runType = flags.Tile.RunType
48  partitionTimeCorrections = [0, 0, 0, 0]
49  if flags.Input.RunNumbers[0] > 400000: # Update partition time corrections for Run 3
50  if runType is TileRunType.GAPLAS:
51  partitionTimeCorrections = [-28.65, -45.2, 25.24, 24.94]
52  elif runType is TileRunType.GAPCIS:
53  partitionTimeCorrections = [0, 0, 0, 0]
54  else:
55  partitionTimeCorrections = [-15.18, -15.37, 47.65, 47.42]
56 
57  kwargs.setdefault('PartitionTimeCorrections', partitionTimeCorrections)
58 
59  # The following class will make a sequence, configure algorithms, and link
60  # them to GenericMonitoringTools
61  from AthenaMonitoring import AthMonitorCfgHelper
62  helper = AthMonitorCfgHelper(flags,'TileRawChannelTimeMonitoring')
63 
64  # Adding an TileCellMonitorAlgorithm algorithm to the helper
65  from AthenaConfiguration.ComponentFactory import CompFactory
66  TileRawChannelTimeMonitorAlgorithm = CompFactory.TileRawChannelTimeMonitorAlgorithm
67  tileRawChanTimeMonAlg = helper.addAlgorithm(TileRawChannelTimeMonitorAlgorithm, 'TileRawChanTimeMonAlg')
68 
69  if amplitudeFragIDs is not None:
70  tileRawChanTimeMonAlg.AmplitudeFragIDs = amplitudeFragIDs
71  for k, v in kwargs.items():
72  setattr(tileRawChanTimeMonAlg, k, v)
73 
74  run = str(flags.Input.RunNumbers[0])
75  eventsType = 'CIS' if runType.getCommonType() is TileRunType.CIS else 'Laser'
76 
77  # 1) Configure histogram with TileRawChannelTimeMonAlg algorithm execution time
78  executeTimeGroup = helper.addGroup(tileRawChanTimeMonAlg, 'TileRawChanTimeMonExecuteTime', 'Tile/')
79  executeTimeGroup.defineHistogram('TIME_execute', path = 'RawChannelTime', type='TH1F',
80  title = 'Time for execute TileRawChanTimeMonAlg algorithm;time [#mus]',
81  xbins = 100, xmin = 0, xmax = 100000)
82 
83 
84  from TileMonitoring.TileMonitoringCfgHelper import addTileModuleChannelMapsArray, getPartitionName
85 
86  # 2) Configure histograms with status of Tile channel time per partition
87  addTileModuleChannelMapsArray(helper, tileRawChanTimeMonAlg, name = 'TileAverageTime',
88  title = f'Tile average time with {eventsType} (partition average time is subracted)',
89  path = 'Tile/RawChannelTime/Summary',
90  type = 'TProfile2D', value = 'time', run = run)
91 
92  # 2.b) Configure histograms with average of Tile channel uncorrected time per partition
93  addTileModuleChannelMapsArray(helper, tileRawChanTimeMonAlg, name = 'TileAverageUncorrectedTime',
94  title = f'Tile average uncorrected time with {eventsType}',
95  path = 'Tile/RawChannelTime/Summary',
96  type = 'TProfile2D', value = 'time', run = run)
97 
98  # 2.c) Configure histograms with average of Tile channel amplitude per partition
99  addTileModuleChannelMapsArray(helper, tileRawChanTimeMonAlg, name = 'TileAverageAmplitude',
100  title = f'Tile average amplitude [pC] with {eventsType}',
101  path = 'Tile/RawChannelTime/Summary',
102  type = 'TProfile2D', value = 'amplitude', run = run)
103 
104  from TileMonitoring.TileMonitoringCfgHelper import addTile2DHistogramsArray
105 
106  # 3) Configure histograms with Tile partition average time vs luminosity block per partition
107  partitionAverageTimeTitle = {}
108  partitionAverageTimeTitleTemplate = f'Tile average time with {eventsType} corrected by %+0.0f [ns] vs LumiBlock;LumiBlock;t [ns]'
109  for ros in range(1,5):
110  partitionAverageTimeTitle[getPartitionName(ros)] = partitionAverageTimeTitleTemplate % (-partitionTimeCorrections[ros - 1])
111  addTile2DHistogramsArray(helper, tileRawChanTimeMonAlg, name = 'TileAverageTimeLB',
112  xvalue = 'lumiBlock', yvalue = 'time', type='TH2D',
113  title = partitionAverageTimeTitle, opt = 'kAddBinsDynamically', merge = 'merge',
114  path = 'Tile/RawChannelTime/Summary', run = run, perPartition = True,
115  xbins = 3000, xmin = -0.5, xmax = 2999.5, ybins = 149, ymin = -74.5, ymax = 74.5)
116 
117 
118  # 4) Configure histograms with Tile partition average time difference vs luminosity block
119  partitionPairs = kwargs['PartitionTimeDiffferncePairs']
120  partTimeDiffVsLBArray = helper.addArray([len(partitionPairs)], tileRawChanTimeMonAlg,
121  'TileAverageTimeDifferenceLB', topPath = 'Tile/RawChannelTime')
122  for postfix, tool in partTimeDiffVsLBArray.Tools.items():
123  pairIdx = int(postfix.split('_').pop())
124  partitionName1, partitionName2 = [getPartitionName(ros + 1) for ros in partitionPairs[pairIdx]]
125  ros1, ros2 = partitionPairs[pairIdx]
126  partitionTimeCorrection1 = partitionTimeCorrections[ros1]
127  partitionTimeCorrection2 = partitionTimeCorrections[ros2]
128 
129  title = f'Run {run}: Average time with {eventsType} between {partitionName1} and {partitionName2}'
130  title += ' corrected by %+0.0f [ns]' % (partitionTimeCorrection1 - partitionTimeCorrection2)
131  title += ' vs luminosity block;LumiBlock;t [ns]'
132  name = 'lumiBlock,time;TileAverageTimeDifferenceLB_%s-%s' % (partitionName1, partitionName2)
133 
134  tool.defineHistogram(name, title = title, path = 'Summary', type = 'TProfile',
135  xbins = 1000, xmin = -0.5, xmax = 999.5, opt = 'kAddBinsDynamically', merge = 'merge')
136 
137 
138  from TileCalibBlobObjs.Classes import TileCalibUtils as Tile
139 
140  # 5) Configure histograms with Tile digitizer time vs luminosity block per digitizer
141  maxDigitizer = 8
142  digiTimeVsLBArray = helper.addArray([int(Tile.MAX_ROS - 1), int(Tile.MAX_DRAWER), maxDigitizer],
143  tileRawChanTimeMonAlg, 'TileDigitizerTimeLB', topPath = 'Tile/RawChannelTime')
144  for postfix, tool in digiTimeVsLBArray.Tools.items():
145  ros, module, digitizer = [int(x) for x in postfix.split('_')[1:]]
146  digitizer += 1
147 
148  moduleName = Tile.getDrawerString(ros + 1, module)
149  title = 'Run ' + run + ' ' + moduleName + ' Digitizer ' + str(digitizer)
150  title += ': Time vs luminosity block (partition average time is subracted);LumiBlock;t [ns]'
151  name = 'lumiBlock,time;TileDigitizerTimeLB_' + moduleName + '_DIGI_' + str(digitizer)
152  path = getPartitionName(ros + 1) + '/' + moduleName
153 
154  tool.defineHistogram(name, title = title, path = path, type = 'TProfile',
155  xbins = 1000, xmin = -0.5, xmax = 999.5, opt = 'kAddBinsDynamically', merge = 'merge')
156 
157 
158  modules = []
159  if amplitudeFragIDs is not None:
160  # Preapare module names for which monitoring histograms with amplitude vs LB should be produced
161  for fragID in amplitudeFragIDs:
162  ros = fragID >> 8
163  drawer = fragID & 0x3F
164  modules += [Tile.getDrawerString(ros, drawer)]
165 
166  ampVsLBArray = helper.addArray([modules], tileRawChanTimeMonAlg, 'TileAmplitudeVsLB', topPath='Tile/RawChannelTime')
167  for postfix, tool in ampVsLBArray.Tools.items():
168  # Define set of monitoring histograms with amplitude vs LB for each specified module
169  moduleName = postfix[1:]
170  partition = moduleName[:3]
171  for channel in range(0, Tile.MAX_CHAN):
172  # Define monitoring histogram with amplitude vs LB for each channel in the module
173  title = f'Run {run} {moduleName} Channel {channel}: Amplitude vs luminosity block;LumiBlock;Amplitude [pC]'
174  name = f'lumiBlock,amplitude_{channel};TileAmplitudeVsLB_{moduleName}_ch_{channel}'
175  path = f'{partition}/{moduleName}'
176 
177  tool.defineHistogram(name, title=title, path=path, type='TProfile',
178  xbins=1000, xmin=-0.5, xmax=999.5, opt='kAddBinsDynamically', merge='merge')
179 
180 
181  accumalator = helper.result()
182  result.merge(accumalator)
183  return result
184 
TileMonitoringCfgHelper.addTileModuleChannelMapsArray
def addTileModuleChannelMapsArray(helper, algorithm, name, title, path, weight='', subDirectory=False, type='TH2D', value='', run='', triggers=[], perGain=False, separator='_')
Definition: TileMonitoringCfgHelper.py:370
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
TileMonitoringCfgHelper.addTile2DHistogramsArray
def addTile2DHistogramsArray(helper, algorithm, name='', xvalue='', yvalue='', value='', title='', path='', weight='', xbins=0, xmin=0., xmax=0., ybins=0, ymin=0., ymax=0., type='TH2D', run='', triggers=[], xlabels=(), ylabels=(), opt='', subDirectory=False, perPartition=False, perSample=False, perGain=False, allPartitions=False, separator='_', merge=None)
Definition: TileMonitoringCfgHelper.py:300
TileDQstatusConfig.TileDQstatusAlgCfg
def TileDQstatusAlgCfg(flags, **kwargs)
Definition: TileDQstatusConfig.py:31
python.TileBadChannelsConfig.TileBadChannelsCondAlgCfg
def TileBadChannelsCondAlgCfg(flags, **kwargs)
Definition: TileBadChannelsConfig.py:10
plotBeamSpotVxVal.range
range
Definition: plotBeamSpotVxVal.py:195
TileMonitoringCfgHelper.getPartitionName
def getPartitionName(ros)
Definition: TileMonitoringCfgHelper.py:40
python.TileEMScaleConfig.TileEMScaleCondAlgCfg
def TileEMScaleCondAlgCfg(flags, **kwargs)
Definition: TileEMScaleConfig.py:10
python.TileDCSConfig.TileDCSCondAlgCfg
def TileDCSCondAlgCfg(flags, **kwargs)
Definition: TileDCSConfig.py:8
str
Definition: BTagTrackIpAccessor.cxx:11
python.TileCablingSvcConfig.TileCablingSvcCfg
def TileCablingSvcCfg(flags)
Definition: TileCablingSvcConfig.py:11
TileGMConfig.TileGMCfg
def TileGMCfg(flags)
Definition: TileGMConfig.py:7
TileRawChannelTimeMonitorAlgorithm.TileRawChannelTimeMonitoringConfig
def TileRawChannelTimeMonitoringConfig(flags, amplitudeFragIDs=None, **kwargs)
Definition: TileRawChannelTimeMonitorAlgorithm.py:11