14 ''' Function to configure TileTBMonitorAlgorithm algorithm in the monitoring system.'''
16 from AthenaConfiguration.ComponentAccumulator
import ComponentAccumulator
17 result = ComponentAccumulator()
19 from TileGeoModel.TileGMConfig
import TileGMCfg
20 result.merge(TileGMCfg(flags))
22 from LArGeoAlgsNV.LArGMConfig
import LArGMCfg
23 result.merge(LArGMCfg(flags))
25 from TileConditions.TileCablingSvcConfig
import TileCablingSvcCfg
26 result.merge(TileCablingSvcCfg(flags))
28 from AthenaMonitoring
import AthMonitorCfgHelper
29 helper = AthMonitorCfgHelper(flags,
'TileTBMonitoring')
31 from AthenaConfiguration.ComponentFactory
import CompFactory
32 tileTBMonAlg = helper.addAlgorithm(CompFactory.TileTBMonitorAlgorithm,
'TileTBMonAlg')
34 tileTBMonAlg.TriggerChain =
''
36 kwargs.setdefault(
'BeamEnergy', flags.Beam.Energy)
37 kwargs.setdefault(
'CellEnergyThreshold', 0.1 * GeV)
38 energyThreshold = kwargs[
'CellEnergyThreshold']
40 masked = [
'LBA01 0 ' +
",".join([str(channel)
for channel
in range(0, 48)]),
41 'LBA01 1 ' +
",".join([str(channel)
for channel
in range(0, 48)]),
42 'LBC01 0 36,37,38,39,40,41',
43 'LBC01 1 36,37,38,39,40,41']
44 kwargs.setdefault(
'Masked', masked)
46 from TileCalibBlobObjs.Classes
import TileCalibUtils
as Tile
50 for fragID
in fragIDs:
52 drawer = fragID & 0x3F
53 modules += [Tile.getDrawerString(ros, drawer)]
55 for ros
in range(1, Tile.MAX_ROS):
56 for drawer
in range(0, Tile.MAX_DRAWER):
57 fragIDs += [(ros << 8) | drawer]
58 modules += [Tile.getDrawerString(ros, drawer)]
60 tileTBMonAlg.TileFragIDs = fragIDs
62 for k, v
in kwargs.items():
63 setattr(tileTBMonAlg, k, v)
65 run = str(flags.Input.RunNumbers[0])
68 executeTimeGroup = helper.addGroup(tileTBMonAlg,
'TileTBMonExecuteTime',
'TestBeam')
69 executeTimeGroup.defineHistogram(
'TIME_execute', path=
'', type=
'TH1F',
70 title=
'Time for execute TileTBMonAlg algorithm;time [#mus]',
71 xbins=100, xmin=0, xmax=10000)
73 totalEnergyGroup = helper.addGroup(tileTBMonAlg,
'TileTBTotalEventEnergy',
'TestBeam')
74 totalEnergyGroup.defineHistogram(
'energy;TileTBTotalEventEnergy', path=
'', type=
'TH1F',
75 title=f
'Run {run}: Total TileCal Event Energy;Event Energy [pC]',
76 xbins=400, xmin=-2, xmax=200)
78 hotCellAGroup = helper.addGroup(tileTBMonAlg,
'TileTBHotCellA_LBC02',
'TestBeam')
79 hotCellAGroup.defineHistogram(
'tower;TileTBHotCellA_LBC02', path=
'', type=
'TH1F',
80 title=f
'Run {run} LBC02: Tile TB Hot Cell A;Tower',
81 xbins=10, xmin=-0.5, xmax=9.5)
83 CtotGroup = helper.addGroup(tileTBMonAlg,
'TileTBCtot',
'TestBeam')
84 CtotGroup.defineHistogram(
'Ctot;TileTBCtot', path=
'', type=
'TH1F',
85 title=f
'Run {run} LBC02: Tile TB Ctot;Ctot',
86 xbins=100, xmin=0.03, xmax=0.22)
88 ClongGroup = helper.addGroup(tileTBMonAlg,
'TileTBClong',
'TestBeam')
89 ClongGroup.defineHistogram(
'Clong;TileTBClong', path=
'', type=
'TH1F',
90 title=f
'Run {run} LBC02: Tile TB Clong;Clong',
91 xbins=100, xmin=0., xmax=1.8)
93 CtotVsClongGroup = helper.addGroup(tileTBMonAlg,
'TileTBCtotVsClong',
'TestBeam')
94 CtotVsClongGroup.defineHistogram(
'Clong,Ctot;TileTBCtotVsClong', path=
'', type=
'TH2F',
95 title=f
'Run {run} LBC02: Tile TB Ctot Vs Clong;Clong;Ctot',
96 xbins=100, xmin=0., xmax=1.8, ybins=100, ymin=0.03, ymax=0.22)
100 nCellsVsEnergyGroup = helper.addGroup(tileTBMonAlg,
'TileTBCellsNumberVsTotalEnergy',
'TestBeam')
101 nCellsVsEnergyGroup.defineHistogram(
'nCells,energy;TileTBCellsNumberVsTotalEnergy', path=
'', type=
'TH2F',
102 title=f
'Run {run}: Tile Event energy [C side] vs # cells with energy > {energyThreshold} pC;# Cells;Energy [pC]',
103 xbins=25, xmin=-0.5, xmax=24.5, ybins=maxTotalEnergy, ymin=0.0, ymax=maxTotalEnergy)
105 hitMapGroup = helper.addGroup(tileTBMonAlg,
'TileTBHitMap',
'TestBeam')
106 hitMapGroup.defineHistogram(
'side,module,energy;TileTBHitMap', path=
'', type=
'TProfile2D',
107 title=f
'Run {run}: Tile TB setup map with average energy',
108 xlabels=[
'A Side',
'C side'], ylabels=[
'LB01',
'LB02',
'EB03'],
109 xbins=2, xmin=-0.5, xmax=1.5, ybins=3, ymin=-0.5, ymax=2.5)
111 timeArray = helper.addArray([modules], tileTBMonAlg,
'TileTBChannelTime', topPath=
'TestBeam')
112 for postfix, tool
in timeArray.Tools.items():
113 moduleName = postfix[1:]
114 name = f
'channel,time;TileTBChannelTime_{moduleName}'
115 fullTitle = f
'Run {run} {moduleName}: Tile TB channel average time from cells;Channel;Time [ns]'
116 tool.defineHistogram(name, title=fullTitle, path=
'', type=
'TProfile',
117 xbins=Tile.MAX_CHAN, xmin=-0.5, xmax=Tile.MAX_CHAN-0.5)
121 xCellLB = [[[]
for tower
in range(0, maxTowerLB)]
for sample
in range(0, maxSample)]
122 yCellLB = [[[]
for tower
in range(0, maxTowerLB)]
for sample
in range(0, maxSample)]
124 periodWidthLB = 18.22
126 nPeriodsLB = [[14, 13, 14, 14, 15, 16, 16, 17, 19, 16],
127 [16, 15, 16, 16, 17, 18, 18, 20, 18],
128 [18, 18, 18, 19, 19, 20, 22, 20],
129 [20, 0, 41, 0, 43, 0, 50]]
131 yLB = [0, 300, 690, 1140, 1520]
132 for sampleIndex
in range(0, len(nPeriodsLB)):
133 sample = sampleIndex
if sampleIndex < 2
else sampleIndex - 1
135 for tower
in range(0, len(nPeriodsLB[sampleIndex])):
136 cellWidth = nPeriodsLB[sampleIndex][tower] * periodWidthLB
138 x2 = cellOffsetX + cellWidth
140 xCellLB[sample][tower] += [x1]
141 yCellLB[sample][tower] += [yLB[sampleIndex]]
144 cellOffsetX += cellWidth
146 tileTBMonAlg.xCellLongBarrelSampleA = xCellLB[0]
147 tileTBMonAlg.xCellLongBarrelSampleBC = xCellLB[1]
148 tileTBMonAlg.xCellLongBarrelSampleD = xCellLB[2]
150 tileTBMonAlg.yCellLongBarrelSampleA = yCellLB[0]
151 tileTBMonAlg.yCellLongBarrelSampleBC = yCellLB[1]
152 tileTBMonAlg.yCellLongBarrelSampleD = yCellLB[2]
155 periodWidthEB = 18.28
156 xCellEB = [[[]
for tower
in range(0, maxTowerEB)]
for sample
in range(0, maxSample)]
157 yCellEB = [[[]
for tower
in range(0, maxTowerEB)]
for sample
in range(0, maxSample)]
159 yEB = [0, 300, 690, 840, 840, 1140, 1520]
161 nPeriodsEB = [[17, 0, 0, 9, 25, 28, 30, 48],
162 [17, 0, 16, 27, 30, 32, 35],
163 [12, 5, 16, 27, 30, 32, 35],
168 samples = [0, 1, 1, 1, 2, 2]
169 for sampleIndex
in range(0, len(nPeriodsEB)):
170 sample = samples[sampleIndex]
172 for tower
in range(0, len(nPeriodsEB[sampleIndex])):
173 cellWidth = nPeriodsEB[sampleIndex][tower] * periodWidthEB
175 x2 = cellOffsetX + cellWidth
177 xCellEB[sample][tower + 8] += [x1]
178 yCellEB[sample][tower + 8] += [yEB[sampleIndex]]
181 cellOffsetX += cellWidth
183 tileTBMonAlg.xCellExtendedBarrelSampleA = xCellEB[0]
184 tileTBMonAlg.xCellExtendedBarrelSampleBC = xCellEB[1]
185 tileTBMonAlg.xCellExtendedBarrelSampleD = xCellEB[2]
187 tileTBMonAlg.yCellExtendedBarrelSampleA = yCellEB[0]
188 tileTBMonAlg.yCellExtendedBarrelSampleBC = yCellEB[1]
189 tileTBMonAlg.yCellExtendedBarrelSampleD = yCellEB[2]
191 xBinsLB = [x * periodWidthLB
for x
in range(0, sum(nPeriodsLB[0]) + 1)]
192 yBinsLB = [0, 300, 690, 1140, 1520]
194 xBinsEB = [x * periodWidthEB
for x
in range(0, sum(nPeriodsEB[0]) + 1)]
195 yBinsEB = [0, 300, 690, 840, 1140, 1520]
196 cellMapArray = helper.addArray([modules], tileTBMonAlg,
'TileTBCellMap', topPath=
'TestBeam')
197 for postfix, tool
in cellMapArray.Tools.items():
198 moduleName = postfix[1:]
199 name = f
'x,y,energy;TileTBCellMap_{moduleName}'
200 fullTitle = f
'Run {run} {moduleName}: Tile TB cell map with average energy;z [mm];x [mm];Energy [pc]'
201 tool.defineHistogram(name, title=fullTitle, path=
'', type=
'TProfile2D',
202 xbins=xBinsLB
if moduleName.startswith(
'LB')
else xBinsEB,
203 ybins=yBinsLB
if moduleName.startswith(
'LB')
else yBinsEB)
205 accumalator = helper.result()
206 result.merge(accumalator)