14 ''' Function to configure TileTBBeamMonitorAlgorithm 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 TileConditions.TileCablingSvcConfig
import TileCablingSvcCfg
23 result.merge(TileCablingSvcCfg(flags))
25 from AthenaMonitoring
import AthMonitorCfgHelper
26 helper = AthMonitorCfgHelper(flags,
'TileTBBeamMonitoring')
28 from AthenaConfiguration.ComponentFactory
import CompFactory
29 tileTBBeamMonAlg = helper.addAlgorithm(CompFactory.TileTBBeamMonitorAlgorithm,
'TileTBBeamMonAlg')
31 tileTBBeamMonAlg.TriggerChain =
''
33 kwargs.setdefault(
'CaloCellContainer',
'AllCalo')
34 cellContainer = kwargs[
'CaloCellContainer']
36 kwargs.setdefault(
'TBperiod', 2023)
37 kwargs.setdefault(
'MaskMuonPMTs', [7])
38 kwargs.setdefault(
'TOFDifferencePairs', [[2, 1], [2, 3], [3, 1]])
40 from TileCalibBlobObjs.Classes
import TileCalibUtils
as Tile
44 for fragID
in fragIDs:
46 drawer = fragID & 0x3F
47 modules += [Tile.getDrawerString(ros, drawer)]
49 for ros
in range(1, Tile.MAX_ROS):
50 for drawer
in range(0, Tile.MAX_DRAWER):
51 fragIDs += [(ros << 8) | drawer]
52 modules += [Tile.getDrawerString(ros, drawer)]
54 tileTBBeamMonAlg.TileFragIDs = fragIDs
56 for k, v
in kwargs.items():
57 setattr(tileTBBeamMonAlg, k, v)
59 from TileMonitoring.TileTBBeamChambersCalibration
import updateBeamChambersCalibrations
60 updateBeamChambersCalibrations(tileTBBeamMonAlg, flags.Input.RunNumbers[0])
62 run = str(flags.Input.RunNumbers[0])
65 executeTimeGroup = helper.addGroup(tileTBBeamMonAlg,
'TileTBBeamMonExecuteTime',
'TestBeam')
66 executeTimeGroup.defineHistogram(
'TIME_execute', path=
'BeamElements', type=
'TH1F',
67 title=
'Time for execute TileTBBeamMonAlg algorithm;time [#mus]',
68 xbins=100, xmin=0, xmax=10000)
71 muonWallPMTArray = helper.addArray([nMuonWallPMT], tileTBBeamMonAlg,
'MuonWallPMT', topPath=
'TestBeam')
72 for postfix, tool
in muonWallPMTArray.Tools.items():
73 pmt = int(postfix[1:]) + 1
74 title = f
'Run {run}: Muon Wall PMT{pmt} Amplitude;Amplitude [ADC];Counts'
75 name = f
'amplitude;MuonWallPMT{pmt}'
76 tool.defineHistogram(name, title=title, path=
'BeamElements', type=
'TH1F',
77 xbins=410, xmin=0, xmax=4096)
79 totalMuEnergyGroup = helper.addGroup(tileTBBeamMonAlg,
'TileTBTotalMuonEnergy',
'TestBeam')
80 totalMuEnergyGroup.defineHistogram(
'TotalMuonEnergy', path=
'BeamElements', type=
'TH1F',
81 title=f
'Run {run}: Muon Wall Total Energy; [ADC]',
82 xbins=1500, xmin=0, xmax=10000)
85 sCountersArray = helper.addArray([nScounters], tileTBBeamMonAlg,
'Scounter', topPath=
'TestBeam')
86 for postfix, tool
in sCountersArray.Tools.items():
87 counter = int(postfix[1:]) + 1
88 title = f
'Run {run}: S{counter} Counter Amplitude;Amplitude [ADC];Counts'
89 name = f
'amplitude;S{counter}hist'
90 tool.defineHistogram(name, title=title, path=
'BeamElements', type=
'TH1F',
91 xbins=410, xmin=0, xmax=4096)
94 cherenkovArray = helper.addArray([nCherenkov], tileTBBeamMonAlg,
'Cherenkov', topPath=
'TestBeam')
95 for postfix, tool
in cherenkovArray.Tools.items():
96 cherenkov = int(postfix[1:]) + 1
97 title = f
'Run {run}: Cherenkov {cherenkov} Amplitude;Amplitude [ADC];Counts'
98 name = f
'amplitude;Cher{cherenkov}hist'
99 tool.defineHistogram(name, title=title, path=
'BeamElements', type=
'TH1F',
100 xbins=410, xmin=0, xmax=4096)
103 cherCompGroup = helper.addGroup(tileTBBeamMonAlg,
'CherCompare',
'TestBeam')
104 cherCompGroup.defineHistogram(
'amplitude1,amplitude2;CherCompare', path=
'BeamElements', type=
'TH2F',
105 title=f
'Run {run}: Cherenkov2 vs Cherenkov1;Amplitude [ADC];Amplitude [ADC]',
106 xbins=410, xmin=0, xmax=4096, ybins=410, ymin=0, ymax=4096)
109 tofArray = helper.addArray([nTOF], tileTBBeamMonAlg,
'TOF', topPath=
'TestBeam')
110 for postfix, tool
in tofArray.Tools.items():
111 tof = int(postfix[1:]) + 1
112 title = f
'Run {run}: TOF{tof};[ADC];Counts'
113 name = f
'amplitude;TOF{tof}'
114 tool.defineHistogram(name, title=title, path=
'BeamElements', type=
'TH1F',
115 xbins=4096, xmin=-0.5, xmax=4095.5)
117 tofDiffPairs = kwargs[
'TOFDifferencePairs']
118 tofDiffArray = helper.addArray([len(tofDiffPairs)], tileTBBeamMonAlg,
'TOFDiff', topPath=
'TestBeam')
119 for postfix, tool
in tofDiffArray.Tools.items():
120 pairIdx = int(postfix.split(
'_').pop())
121 tof1,tof2 = tofDiffPairs[pairIdx]
122 title = f
'Run {run}: TOF{tof1} - TOF{tof2} Amplitude difference;[ADC];Counts'
123 tool.defineHistogram(f
'TOFDiff;TOFDiff{tof1}{tof2}', title=title, path=
'BeamElements',
124 type=
'TH1F', xbins=4096, xmin=-0.5, xmax=4095.5)
126 cherenkovVsTOFArray = helper.addArray([nTOF, nCherenkov], tileTBBeamMonAlg,
'CherenkovVsTOF', topPath=
'TestBeam')
127 for postfix, tool
in cherenkovVsTOFArray.Tools.items():
128 cherenkovTof = postfix.split(
'_')
129 cherenkov = int(cherenkovTof.pop()) + 1
130 tof = int(cherenkovTof.pop()) + 1
131 title = f
'Run {run}: Cherenkov {cherenkov} Amplitude vs TOF{tof} Amplitude'
132 title += f
';TOF{tof} Amplitude [ADC];Cherenkov{cherenkov} Amplitude [ADC]'
133 name = f
'amplitudeTOF,amplitudeCherenkov;Cher{cherenkov}TOF{tof}'
134 tool.defineHistogram(name, title=title, path=
'BeamElements', type=
'TH2F',
135 xbins=410, xmin=0, xmax=4096, ybins=410, ymin=0, ymax=4096)
137 pmtHitMapGroup = helper.addGroup(tileTBBeamMonAlg,
'PMTHitMap',
'TestBeam')
138 pmtHitMapGroup.defineHistogram(
'column,row,amplitude;PMTHitMap', path=
'BeamElements', type=
'TProfile2D',
139 title=f
'Run {run}: Muon Wall PMT Hit Map',
140 xbins=4, xmin=0, xmax=4, ybins=2, ymin=0, ymax=2)
143 scalerArray = helper.addArray([nScaler], tileTBBeamMonAlg,
'Scaler', topPath=
'TestBeam')
144 for postfix, tool
in scalerArray.Tools.items():
145 scaler = int(postfix[1:]) + 1
146 title = f
'Run {run}: Scaler S{scaler};Counts;# Events'
147 name = f
'counts;Scaler{scaler}'
148 tool.defineHistogram(name, title=title, path=
'BeamElements', type=
'TH1F',
149 xbins=20000, xmin=-0.5, xmax=19999.5)
151 scalerCoincedenceGroup = helper.addGroup(tileTBBeamMonAlg,
'Scaler12',
'TestBeam')
152 scalerCoincedenceGroup.defineHistogram(
'counts12;Scaler12', path=
'BeamElements', type=
'TH1F',
153 title=f
'Run {run}: Scaler S1 and S2 coincedence;counts;# Events',
154 xbins=20000, xmin=-0.5, xmax=19999.5)
157 beamChambers = [
'BC1',
'BC2']
158 beamChambersArray = helper.addArray([beamChambers], tileTBBeamMonAlg,
'BeamChamber', topPath=
'TestBeam')
159 for postfix, tool
in beamChambersArray.Tools.items():
160 beamChamber = postfix[1:]
162 for coordinate
in [
'X',
'Y']:
163 title = f
'Run {run}: {beamChamber}{coordinate} Coordinate;{coordinate}[mm];Counts'
164 name = f
'{beamChamber}{coordinate};{beamChamber}{coordinate}hist'
165 tool.defineHistogram(name, title=title, path=
'BeamElements', type=
'TH1F',
166 xbins=201, xmin=-100.5, xmax=100.5)
168 tool.defineHistogram(f
'{beamChamber}X,{beamChamber}Y;{beamChamber}Profile', path=
'BeamElements',
169 type=
'TH2D', title=f
'Run {run}: {beamChamber} Beam Profile;X[mm];Y[mm]',
170 xbins=1000, xmin=-100, xmax=100, ybins=1000, ymin=-100, ymax=100)
172 tool.defineHistogram(f
'{beamChamber}Xsum,{beamChamber}Ysum;{beamChamber}ProfileSum', path=
'BeamElements',
173 type=
'TH2D', title=f
'Run {run}: {beamChamber} Beam Profile Sum;X [mm];Y [mm]',
174 xbins=1000, xmin=-300, xmax=0, ybins=1000, ymin=-300, ymax=0)
177 impactProfileGroup = helper.addGroup(tileTBBeamMonAlg,
'ImpactProfile',
'TestBeam')
178 impactProfileGroup.defineHistogram(
'Ximp,Yimp;ImpactProfile', path=
'BeamElements', type=
'TH2F',
179 title=f
'Run {run}: {beamChamber} Impact Profile;X [mm];Y [mm]',
180 xbins=200, xmin=-100, xmax=100, ybins=200, ymin=-100, ymax=100)
184 cherenkovEnergyArray = helper.addArray([nCherenkov], tileTBBeamMonAlg,
'CherenkovVsEnergy', topPath=
'TestBeam')
185 for postfix, tool
in cherenkovEnergyArray.Tools.items():
186 cherenkov = int(postfix[1:]) + 1
187 title = f
'Run {run}: Cherenkov {cherenkov} Amplitude vs Total Energy;Energy [pC]; Amplitude [ADC]'
188 name = f
'totalEnergy,amplitude;Cher{cherenkov}Energy'
189 tool.defineHistogram(name, title=title, path=
'BeamElements', type=
'TH2F',
190 xbins=150, xmin=0, xmax=150, ybins=410, ymin=0, ymax=4096)
192 cellEneXimpGroup = helper.addGroup(tileTBBeamMonAlg,
'CellEnergyImpactX',
'TestBeam')
193 cellEneXimpGroup.defineHistogram(
'Ximp,cellEnergy;CellEnergyImpactX', path=
'BeamElements', type=
'TH2F',
194 title=f
'Run {run}: Maximum Cell Energy vs Impact X;X [mm];Cell Energy [pc]',
195 xbins=200, xmin=-100, xmax=100, ybins=150, ymin=0, ymax=150)
197 cellEneYimpGroup = helper.addGroup(tileTBBeamMonAlg,
'CellEnergyImpactY',
'TestBeam')
198 cellEneYimpGroup.defineHistogram(
'Yimp,cellEnergy;CellEnergyImpactY', path=
'BeamElements', type=
'TH2F',
199 title=f
'Run {run}: Maximum Cell Energy vs Impact Y;Y [mm];Cell Energy [pc]',
200 xbins=200, xmin=-100, xmax=100, ybins=150, ymin=0, ymax=150)
202 totalEneXimpGroup = helper.addGroup(tileTBBeamMonAlg,
'TotalEnergyImpactX',
'TestBeam')
203 totalEneXimpGroup.defineHistogram(
'Ximp,totalEnergy;TotalEnergyImpactX', path=
'BeamElements', type=
'TH2F',
204 title=f
'Run {run}: Total Energy vs Impact X;X [mm];Total Energy [pc]',
205 xbins=200, xmin=-100, xmax=100, ybins=150, ymin=0, ymax=150)
207 totalEneYimpGroup = helper.addGroup(tileTBBeamMonAlg,
'TotalEnergyImpactY',
'TestBeam')
208 totalEneYimpGroup.defineHistogram(
'Yimp,totalEnergy;TotalEnergyImpactY', path=
'BeamElements', type=
'TH2F',
209 title=f
'Run {run}: Total Energy vs Impact Y;Y [mm];Total Energy [pc]',
210 xbins=200, xmin=-100, xmax=100, ybins=150, ymin=0, ymax=150)
213 totalEneS1Group = helper.addGroup(tileTBBeamMonAlg,
'ScinCalEnergy',
'TestBeam')
214 totalEneS1Group.defineHistogram(
'amplitude,totalEnergy;ScinCalEnergy', path=
'BeamElements', type=
'TH2F',
215 title=f
'Run {run}: Total Energy vs S1 amplitude; Amplitude [ADC];Total Energy [pc]',
216 xbins=410, xmin=0, xmax=4096, ybins=150, ymin=0, ymax=150)
219 accumalator = helper.result()
220 result.merge(accumalator)