5 from TileConfiguration.TileConfigFlags
import TileRunType
8 @file TileRawChannelMonitorAlgorithm.py
9 @brief Python configuration of TileRawChannelMonitorAlgorithm algorithm for the Run III
13 ''' Function to configure TileRawChannelMonitorAlgorithm algorithm in the monitoring system.'''
17 from AthenaConfiguration.ComponentAccumulator
import ComponentAccumulator
20 from TileConditions.TileCablingSvcConfig
import TileCablingSvcCfg
22 run3Period = (result.getService(
'TileCablingSvc').CablingType == 6)
24 from TileRecUtils.TileDQstatusConfig
import TileDQstatusAlgCfg
27 from TileGeoModel.TileGMConfig
import TileGMCfg
30 from TileConditions.TileInfoLoaderConfig
import TileInfoLoaderCfg
32 is12bit = (result.getService(
'TileInfoLoader').ADCmax == 4095)
34 from TileConditions.TileEMScaleConfig
import TileEMScaleCondAlgCfg
37 runType = flags.Tile.RunType
39 kwargs.setdefault(
'name',
'TileRawChannelMonAlg')
40 kwargs.setdefault(
'RunType', runType.getIntValue())
42 if 'TileRawChannelContainer' not in kwargs:
43 if flags.Tile.readDigits:
45 rawChannelContainer =
'TileRawChannelOpt2'
46 elif flags.Tile.doFit:
47 rawChannelContainer =
'TileRawChannelFit'
48 elif flags.Tile.doOptATLAS:
49 rawChannelContainer =
'TileRawChannelFixed'
50 elif flags.Tile.doOptOF1:
51 rawChannelContainer =
'TileRawChannelOF1'
54 rawChannelContainer =
'TileRawChannelCnt'
56 kwargs.setdefault(
'TileRawChannelContainer', rawChannelContainer)
58 if overlapHistograms
is None:
59 overlapHistograms = runType
is TileRunType.LAS
61 if 'fillHistogramsForDSP' not in kwargs:
63 fillHistogramsForDSP = runType
not in [TileRunType.CIS, TileRunType.PED]
64 kwargs.setdefault(
'fillHistogramsForDSP', fillHistogramsForDSP)
66 if 'CalibUnit' not in kwargs:
70 calibUnit = 2
if runType
is TileRunType.PHY
else 1
71 kwargs.setdefault(
'CalibUnit', calibUnit)
74 demonstratorFragID = 0x10d
75 if 'FragIDsDemonstrators' not in kwargs:
76 kwargs.setdefault(
'FragIDsDemonstrators', [demonstratorFragID])
78 if 'FragIDsToIgnoreDMUErrors' not in kwargs:
79 kwargs.setdefault(
'FragIDsToIgnoreDMUErrors', [demonstratorFragID])
81 unit = {1:
'[pC]', 2 :
'[Cesium pC], but MBTS [pc]'}.
get(kwargs[
'CalibUnit'],
"")
85 from AthenaMonitoring
import AthMonitorCfgHelper
86 helper = AthMonitorCfgHelper(flags,
'TileRawChannelMonitoring')
89 from AthenaConfiguration.ComponentFactory
import CompFactory
90 tileRawChannelMonAlg = helper.addAlgorithm(CompFactory.TileRawChannelMonitorAlgorithm, kwargs[
'name'])
92 for k, v
in kwargs.items():
93 setattr(tileRawChannelMonAlg, k, v)
95 run =
str(flags.Input.RunNumbers[0])
98 executeTimeGroup = helper.addGroup(tileRawChannelMonAlg,
'TileRawChannelMonExecuteTime',
'Tile/')
99 executeTimeGroup.defineHistogram(
'TIME_execute', path =
'RawChannel', type=
'TH1F',
100 title =
'Time for execute TileRawChannelMonAlg algorithm;time [#mus]',
101 xbins = 200, xmin = 0, xmax = 200000)
104 from TileMonitoring.TileMonitoringCfgHelper
import addTileChannelHistogramsArray
106 if kwargs[
'fillHistogramsForDSP']:
109 title=f
'DSP Amplitude;{unit}', path=
'Tile/RawChannel', type=
'TH1I', run=run,
110 xvalue=
'dsp_amp', xbins=[491,413], xmin=[-50.5,-1.01], xmax=[1049.34,15.51])
114 title=
'DSP Time;[ns]', path=
'Tile/RawChannel', type=
'TH1I',
115 xvalue=
'dsp_time', xbins=101, xmin=-100.5, xmax= 100.5, run=run)
119 title=f
'DSP-OF Amplitude difference;{unit}', path=
'Tile/RawChannel', type=
'TH1I',
120 run=run, xvalue=
'dsp-fit_amp_diff', xbins=404, xmin=-1.01, xmax=1.01)
124 title=
'DSP-OF Time difference;[ns]', path=
'Tile/RawChannel', type=
'TH1I',
125 xvalue=
'dsp-fit_time_diff', xbins=101, xmin=-2.02, xmax=2.02, run=run)
129 title=
'DSP #chi^{2}', path=
'Tile/RawChannel', type=
'TH1I',
130 xvalue=
'dsp_chi2', xbins=16, xmin=-0.5, xmax=15.5, run=run)
133 title=f
'DSP #chi^{2} vs Amplitude;{unit}', path=
'Tile/RawChannel', aliasSuffix=
'chi2_amp',
134 xvalue=
'dsp_amp', xbins=[200,150], xmin=[-45.1,-7.0], xmax=[855.1,12.0],
135 yvalue=
'dsp_chi2', ybins=16, ymin=-0.5, ymax=15.5, run=run)
137 if runType
is not TileRunType.CIS:
140 if runType
is TileRunType.PED:
141 ampXbins = [101, 101]
142 ampXmin = [-10.1, -0.404]
143 ampXmax = [10.1, 0.404]
144 elif runType
is TileRunType.PHY:
148 elif overlapHistograms:
149 lgXbins = [-50.5 + 1.0 * i
for i
in range(0, 50) ]
150 lgXbins += [-1.5 + 0.05 * i
for i
in range(1, 501)]
151 lgXbins += [23.5 + 1.0 * i
for i
in range(1, 1028)]
152 ampXbins = [lgXbins, 500]
153 ampXmin = [lgXbins[0], -1.5]
154 ampXmax = [lgXbins[len(lgXbins) - 1], 23.5]
156 ampXbins = [1101, 826]
157 ampXmin = [-50.5, -1.01]
158 ampXmax = [1050.5, 15.51]
161 title=f
'Amplitude;{unit}', path=
'Tile/RawChannel', type=
'TH1I',
162 xvalue=
'amp', xbins=ampXbins, xmin=ampXmin, xmax=ampXmax, run=run)
166 title=
'Time;[ns]', path=
'Tile/RawChannel', type=
'TH1I',
167 xvalue=
'time', xbins=201, xmin=-100.5, xmax= 100.5, run=run)
171 title=
'Time corrected;[ns]', path=
'Tile/RawChannel', type=
'TH1I',
172 xvalue=
'time_corr', xbins=201, xmin=-100.5, xmax= 100.5, run=run)
176 chargeFactor = 2.
if is12bit
else 1.
177 adcFactor = 4.
if is12bit
else 1.
179 chargeXmin = { 5 : [-0.5, -0.0625 * chargeFactor], 100 : [-4., -0.0625 * chargeFactor]}
180 chargeXmax = { 5 : [50.5, 12.5625 * chargeFactor], 100 : [804., 12.5625 * chargeFactor]}
182 if kwargs[
'CalibUnit'] == 2:
183 ampYmin = { 5 : [-5.3125, -0.391 * adcFactor], 100 : [-25., -0.391 * adcFactor]}
184 ampYmax = { 5 : [60.3125, 16.02 * adcFactor], 100 : [1025., 16.02 * adcFactor]}
186 ampYmin = { 5 : [-5.3125, -25. * adcFactor], 100 : [-25., -25. * adcFactor]}
187 ampYmax = { 5 : [60.3125, 1025. * adcFactor], 100 : [1025., 1025. * adcFactor]}
189 for capacitor
in [5, 100]:
192 title=f
'Amplitude vs Charge for {capacitor} pF;Charge, [pC];Amplitude, {unit}',
193 path=
'Tile/RawChannel',type=
'TH2F', run=run,
194 aliasSuffix=f
'amp_vs_q_{capacitor}', xvalue=
'charge', yvalue=
'amp',
195 xbins=51, xmin=chargeXmin[capacitor], xmax=chargeXmax[capacitor],
196 ybins=160, ymin=ampYmin[capacitor], ymax=ampYmax[capacitor])
200 title=f
'Time vs Injection Time for {capacitor} pF;Injection Time, [ns];Time, [ns]',
201 path=
'Tile/RawChannel', type=
'TH2F', run=run,
202 xvalue=
'inj_time', yvalue=
'time', aliasSuffix=f
'time_vs_time_{capacitor}',
203 xbins=51, xmin=-0.25, xmax=25.25, ybins=160, ymin=-64., ymax=32.)
207 title=f
'Amplitude over charge ratio for {capacitor} pF;{unit}/[pC]', path=
'Tile/RawChannel',
208 type=
'TH1I', xvalue=
'amp_ratio', run=run, aliasSuffix=f
'amp_ratio_{capacitor}',
209 xbins=101, xmin=-0.01, xmax=2.01)
213 title=f
'Time for {capacitor};[ns]', path=
'Tile/RawChannel', type=
'TH1I',
214 xvalue=
'time', xbins=101, xmin=-101, xmax=101, aliasSuffix=f
'time_{capacitor}')
217 accumalator = helper.result()
218 result.merge(accumalator)
221 if __name__==
'__main__':
224 from AthenaCommon.Logging
import log
229 from AthenaConfiguration.AllConfigFlags
import initConfigFlags
230 from AthenaConfiguration.TestDefaults
import defaultTestFiles
232 flags.Input.Files = defaultTestFiles.RAW_RUN2
233 flags.Output.HISTFileName =
'TileRawChannelMonitorOutput.root'
234 flags.DQ.useTrigger =
False
235 flags.DQ.enableLumiAccess =
False
236 flags.Exec.MaxEvents = 3
241 from AthenaConfiguration.MainServicesConfig
import MainServicesCfg
244 from TileByteStream.TileByteStreamConfig
import TileRawDataReadingCfg
248 TileRawChannelContainer=
'TileRawChannelCnt',
249 fillHistogramsForDSP=
True) )
253 cfg.store(
open(
'TileRawChannelMonitorAlgorithm.pkl',
'wb') )
259 sys.exit(
not sc.isSuccess())