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

Functions

 getPMT (partition, channel)
 TileTBPulseMonitoringConfig (flags, timeRange=[-100, 100], fragIDs=[0x100, 0x101, 0x200, 0x201, 0x402], useDemoCabling=2018, useFELIX=False, **kwargs)

Detailed Description

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

Function Documentation

◆ getPMT()

TileTBPulseMonitorAlgorithm.getPMT ( partition,
channel )
Function to get PMT number: 0,1 

Definition at line 13 of file TileTBPulseMonitorAlgorithm.py.

13def getPMT(partition, channel):
14 ''' Function to get PMT number: 0,1 '''
15
16 channelToPMT = [
17 # LBA,LBC:
18 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
19 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
20 0, 1, 0, 1, 0, 1, -1, -1, 0, 1, 0, 1,
21 0, 1, 0, 1, 0, 1, 0, -1, 0, 1, 0, 1,
22 # EBA,EBC:
23 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
24 0, 0, 0, 1, 0, 1, -1, -1, 0, 1, 0, 1,
25 -1, -1, -1, -1, -1, -1, 0, 0, 1, -1, -1, 1,
26 1, 1, 0, 0, 1, 0, -1, -1, -1, -1, -1, -1 ]
27
28 # In gap scintillators (E3,E4,E1,E2) there is only one pmt per cell
29 if partition in ['EBA', 'EBC'] and channel in [0, 1, 12, 13]:
30 pmt = 0
31 else:
32 pmt = channelToPMT[channel+48] if partition in ['EBA', 'EBC'] else channelToPMT[channel]
33
34 # Mirroring of odd/even numbers in negative side
35 # (central symmetry of negative/positive drawers)
36 if (pmt != -1 and partition in ['LBC', 'EBC']):
37 pmt = 1 - pmt
38
39 return pmt
40
41

◆ TileTBPulseMonitoringConfig()

TileTBPulseMonitorAlgorithm.TileTBPulseMonitoringConfig ( flags,
timeRange = [-100, 100],
fragIDs = [0x100, 0x101, 0x200, 0x201, 0x402],
useDemoCabling = 2018,
useFELIX = False,
** kwargs )
Function to configure TileTBPulseMonitorAlgorithm algorithm in the monitoring system.

Definition at line 42 of file TileTBPulseMonitorAlgorithm.py.

42def TileTBPulseMonitoringConfig(flags, timeRange=[-100, 100], fragIDs=[0x100, 0x101, 0x200, 0x201, 0x402], useDemoCabling=2018, useFELIX=False, **kwargs):
43
44 ''' Function to configure TileTBPulseMonitorAlgorithm algorithm in the monitoring system.'''
45
46 suffix = "Flx" if useFELIX else ""
47 topPath = 'TestBeam/' + ('Felix' if useFELIX else 'Legacy')
48
49 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
50 result = ComponentAccumulator()
51
52 from TileGeoModel.TileGMConfig import TileGMCfg
53 result.merge(TileGMCfg(flags))
54
55 from TileConditions.TileCablingSvcConfig import TileCablingSvcCfg
56 result.merge(TileCablingSvcCfg(flags))
57
58 from TileConditions.TileInfoLoaderConfig import TileInfoLoaderCfg
59 result.merge(TileInfoLoaderCfg(flags))
60
61 from AthenaMonitoring import AthMonitorCfgHelper
62 helper = AthMonitorCfgHelper(flags, f'TileTBPulse{suffix}Monitoring')
63
64 from AthenaConfiguration.ComponentFactory import CompFactory
65 tileTBPulseMonAlg = helper.addAlgorithm(CompFactory.TileTBPulseMonitorAlgorithm, f'TileTBPulse{suffix}MonAlg')
66
67 tileTBPulseMonAlg.TriggerChain = ''
68
69 from TileCalibBlobObjs.Classes import TileCalibUtils as Tile
70
71 modules = []
72 if fragIDs:
73 for fragID in fragIDs:
74 ros = fragID >> 8
75 drawer = fragID & 0x3F
76 modules += [Tile.getDrawerString(ros, drawer)]
77 else:
78 for ros in range(1, Tile.MAX_ROS):
79 for drawer in range(0, Tile.MAX_DRAWER):
80 fragIDs += [(ros << 8) | drawer]
81 modules += [Tile.getDrawerString(ros, drawer)]
82
83 tileTBPulseMonAlg.TileFragIDs = fragIDs
84
85 kwargs.setdefault('TileDigitsContainer', f'TileDigits{suffix}Cnt')
86 kwargs.setdefault('TileRawChannelContainer', flags.Tile.RawChannelContainer.replace('TileRawChannel', f'TileRawChannel{suffix}'))
87 for k, v in kwargs.items():
88 setattr(tileTBPulseMonAlg, k, v)
89
90 run = str(flags.Input.RunNumbers[0])
91
92 # Configure histogram with TileTBPulseMonAlg algorithm execution time
93 executeTimeGroup = helper.addGroup(tileTBPulseMonAlg, 'TileTBPulseMonExecuteTime', topPath)
94 executeTimeGroup.defineHistogram('TIME_execute', path='PulseShape', type='TH1F',
95 title='Time for execute TileTBPulseMonAlg algorithm;time [#mus]',
96 xbins=100, xmin=0, xmax=10000)
97
98 from TileMonitoring.TileMonitoringCfgHelper import getCellName
99
100 def addPulseShapeHistogramsArray(helper, modules, algorithm, name, title, path, type='TH2D',
101 xbins=100, xmin=-100, xmax=100, ybins=100, ymin=-0.2, ymax=1.5,
102 run='', value='', aliasPrefix='', useDemoCabling=2018):
103 ''' This function configures 2D (or 1D Profile) histograms with Tile pulse shape per module, channel, gain '''
104
105 pulseShapeArray = helper.addArray([modules], algorithm, name, topPath=path)
106 for postfix, tool in pulseShapeArray.Tools.items():
107 moduleName = postfix[1:]
108 partition = moduleName[:3]
109 module = int(moduleName[3:]) - 1
110 for channel in range(0, Tile.MAX_CHAN):
111 legacyChannel = getLegacyChannelForDemonstrator(useDemoCabling, partition, module, channel)
112 pmt = getPMT(partition, legacyChannel)
113 pmtName = f'Channel_{channel}' if pmt < 0 else {0 : 'PMT_Up', 1 : 'PMT_Down'}[pmt]
114 cell = getCellName(partition, legacyChannel)
115 cellName = cell.replace('B', 'BC') if (partition in ['LBA','LBC'] and cell and cell[0] == 'B' and cell != 'B9') else cell
116 for gain in range(0, Tile.MAX_GAIN):
117 gainName = {0 : 'lo', 1 : 'hi'}[gain]
118 fullPath = f'{partition}/{moduleName}'
119 name = f'time_{channel}_{gain},amplitude_{channel}_{gain};{aliasPrefix}{cellName}_{moduleName}_{pmtName}_{gainName}'
120 fullTitle = f'Run {run} {moduleName} Channel {channel} Gain {gainName}: {title};time [ns];Normalized Units'
121 tool.defineHistogram(name, title=fullTitle, path=fullPath, type=type,
122 xbins=xbins, xmin=xmin, xmax=xmax, ybins=ybins, ymin=ymin, ymax=ymax)
123 return pulseShapeArray
124
125 addPulseShapeHistogramsArray(helper, modules, tileTBPulseMonAlg, name='TilePulseShape', title='Pulse shape',
126 path=f'{topPath}/PulseShape', xbins=abs(timeRange[1]), xmin=timeRange[0], xmax=timeRange[1],
127 run=run, aliasPrefix='pulseShape_', useDemoCabling=useDemoCabling)
128
129 addPulseShapeHistogramsArray(helper, modules, tileTBPulseMonAlg, name='TilePulseShapeProfile',
130 title='Pulse shape profile', path=f'{topPath}/PulseShape', type='TProfile',
131 xbins=abs(timeRange[1]), xmin=timeRange[0], xmax=timeRange[1],
132 ybins=None, ymin=None, ymax=None, run=run, aliasPrefix='pulseShapeProfile_',
133 useDemoCabling=useDemoCabling)
134
135 accumalator = helper.result()
136 result.merge(accumalator)
137 return result
138
139