4 '''@file TileTMDBRawChannelMonitorAlgorithm.py
7 @brief Python configuration of TileTMDBRawChannelMonitorAlgorithm algorithm for the Run III
11 from AthenaConfiguration.ComponentAccumulator
import ComponentAccumulator
14 from TileConditions.TileInfoLoaderConfig
import TileInfoLoaderCfg
17 kwargs.setdefault(
'name',
'TileMuRcvRChMaker')
18 kwargs.setdefault(
'TileDigitsContainer',
'MuRcvDigitsCnt')
20 if 'TileRawChannelBuilder' not in kwargs:
22 from TileConditions.TilePulseShapeConfig
import TileCondToolMuRcvPulseShapeCfg
25 from TileConditions.TileOFCConfig
import TileCondToolOfcCfg
27 OptFilterDeltaCorrelation =
True,
28 TileCondToolPulseShape = pulseShapeTool) )
30 from TileRecUtils.TileRawChannelBuilderOptConfig
import TileRawChannelBuilderOpt2FilterCfg
35 NoiseFilterTools = [],
36 TileCondToolOfc = ofcTool,
37 TileRawChannelContainer = MuRcvRawChCnt) )
40 kwargs.setdefault(
'TileRawChannelBuilder', [rawChanBuilder])
42 from AthenaConfiguration.ComponentFactory
import CompFactory
43 TileRawChannelMaker=CompFactory.TileRawChannelMaker
50 '''Function to configure Tile TMDB raw channel monitoring algorithm.'''
51 from AthenaConfiguration.ComponentAccumulator
import ComponentAccumulator
54 from TileConditions.TileCablingSvcConfig
import TileCablingSvcCfg
57 from AthenaConfiguration.Enums
import Format
58 if flags.Input.Format == Format.BS:
59 from TileByteStream.TileByteStreamConfig
import TileRawDataReadingCfg
61 readMuRcv=
True, readMuRcvDigits=
True, readMuRcvRawCh=
True))
63 isDSP = (MuRcvRawChCnt ==
"MuRcvRawChCnt")
67 name = kwargs.get(
'name',
'TileTMDBRawChanDspMonAlg' if isDSP
else 'TileTMDBRawChanMonAlg')
69 from AthenaMonitoring
import AthMonitorCfgHelper
70 helper = AthMonitorCfgHelper(flags,
'TileTMDBRawChannelDspMonitoring' if isDSP
else 'TileTMDBRawChannelMonitoring')
72 from AthenaConfiguration.ComponentFactory
import CompFactory
73 tileTMDBRawChanMonAlg = helper.addAlgorithm(CompFactory.TileTMDBRawChannelMonitorAlgorithm, name)
74 tileTMDBRawChanMonAlg.TriggerChain =
''
75 tileTMDBRawChanMonAlg.MuRcvRawChCnt = MuRcvRawChCnt
76 tileTMDBRawChanMonAlg.DSP = isDSP
77 tileTMDBRawChanMonAlg.FillEfficiencyHistograms = FillEfficiencyHistograms
78 tileTMDBRawChanMonAlg.FillRawChannelHistograms = FillRawChannelHistograms
80 topPath =
'Tile/TMDBRawChannel/DSP' if isDSP
else 'Tile/TMDBRawChannel'
81 run =
str(flags.Input.RunNumbers[0])
83 if FillRawChannelHistograms:
92 from TileMonitoring.TileMonitoringCfgHelper
import addTileTMDB_1DHistogramsArray, addTileTMDB_2DHistogramsArray
95 value =
'amplitude', title =
'Amplitude Map',
96 path = topPath, type=
'TProfile2D', run = run)
99 value =
'time', title =
'Time Map',
100 path = topPath, type=
'TProfile2D', run = run)
103 xvalue =
'time', title =
'Time;[ns]',
104 path = topPath, type=
'TH1D', run = run,
105 xbins = 120, xmin = -60, xmax = 60)
108 xvalue =
'amplitude', title =
'Amplitude;[ADC]',
109 path = topPath, type=
'TH1D', run = run,
110 xbins = 276, xmin = minAmplitude, xmax = maxAmplitude)
113 if FillEfficiencyHistograms:
115 from TileConditions.TileTMDBConfig
import TileTMDBCondAlgCfg
118 from TileCalibBlobObjs.Classes
import TileCalibUtils
as Tile
119 from TileMonitoring.TileMonitoringCfgHelper
import getLabels, getPartitionName
121 arrayTGC = helper.addArray([2], tileTMDBRawChanMonAlg,
'TGC_TrSec_number_Good_Muons')
122 for postfix, tool
in arrayTGC.Tools.items():
123 ros =
int(postfix.split(
'_').pop()) + 3
126 fullName =
'sector;TGC_TrSec_number_Good_Muons_{}'.
format(partition)
127 fullTitle =
'Number of Good Muons in TGC trigger sectors {}'.
format(partition)
129 tool.defineHistogram(fullName, path = topPath, type =
'TH1D', title = fullTitle,
130 xbins = 48, xmin = -0.5, xmax = 47.5)
133 cells = [
'D6',
'D5+D6']
134 thresholds = [
'500MeV',
'600MeV']
135 tileTMDBRawChanMonAlg.NumberOfThresholds = len(thresholds)
136 arrayThreshD = helper.addArray([2, len(thresholds), len(cells)], tileTMDBRawChanMonAlg,
'TMDB_coincidence_threshold')
137 for postfix, tool
in arrayThreshD.Tools.items():
138 elements = postfix.split(
'_')
139 cell =
int(elements.pop())
140 threshold =
int(elements.pop())
141 ros =
int(elements.pop()) + 3
144 labels =
getLabels((
'modules'), partition)
146 fullName =
'module;TMDB_{}_{}_coincidence_{}'.
format(partition, cells[cell], thresholds[threshold])
147 fullTitle =
'Number coincidence from all Good Muons in TMDB {} {} over {} threshold'.
format(partition, cells[cell], thresholds[threshold])
149 tool.defineHistogram(fullName, path = topPath, type =
'TH1D', title = fullTitle, xlabels = labels,
150 xbins = Tile.MAX_DRAWER, xmin = -0.5, xmax = Tile.MAX_DRAWER - 0.5)
153 accumalator = helper.result()
154 result.merge(accumalator)
159 if __name__==
'__main__':
161 from AthenaCommon.Logging
import log
166 from AthenaConfiguration.AllConfigFlags
import initConfigFlags
168 flags.Input.Files = [
'/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/Tier0ChainTests/q431/22.0/v1/myESD.pool.root']
169 flags.Output.HISTFileName =
'TileTMDBRawChannelMonitorOutput.root'
170 flags.DQ.useTrigger =
False
171 flags.DQ.enableLumiAccess =
False
172 flags.Exec.MaxEvents = 3
177 from AthenaConfiguration.MainServicesConfig
import MainServicesCfg
180 from AthenaPoolCnvSvc.PoolReadConfig
import PoolReadCfg
186 cfg.printConfig(withDetails =
True, summariseProps =
True)
189 cfg.store(
open(
'TileTMDBRawChannelMonitorAlgorithm.pkl',
'wb') )
194 sys.exit(
not sc.isSuccess())