3"""Define method to construct configured Tile correction tools and algorithm"""
5from AthenaConfiguration.ComponentAccumulator
import ComponentAccumulator
6from AthenaConfiguration.ComponentFactory
import CompFactory
7from TileConfiguration.TileConfigFlags
import TileRunType
10 """Return component accumulator with configured private Tile OF1 raw channel correction tool
13 flags -- Athena configuration flags
16 acc = ComponentAccumulator()
18 kwargs.setdefault(
'CorrectPedestalDifference', flags.Tile.correctPedestalDifference)
19 kwargs.setdefault(
'ZeroAmplitudeWithoutDigits', flags.Tile.zeroAmplitudeWithoutDigits)
20 kwargs.setdefault(
'TileDigitsContainer',
'TileDigitsCnt')
22 if kwargs[
'CorrectPedestalDifference']:
23 from TileConditions.TileSampleNoiseConfig
import TileSampleNoiseCondAlgCfg
24 acc.merge( TileSampleNoiseCondAlgCfg(flags, TileSampleNoise=
"TileSampleNoise") )
25 acc.merge( TileSampleNoiseCondAlgCfg(flags, ForceOnline=
True, TileSampleNoise=
"TileOnlineSampleNoise") )
27 if 'TileCondToolTiming' not in kwargs:
28 from TileConditions.TileTimingConfig
import TileCondToolOnlineTimingCfg
29 kwargs[
'TileCondToolTiming'] = acc.popToolsAndMerge( TileCondToolOnlineTimingCfg(flags) )
31 if 'TileCondToolOfc' not in kwargs:
32 from TileConditions.TileOFCConfig
import TileCondToolOfcCoolCfg
33 kwargs[
'TileCondToolOfc'] = acc.popToolsAndMerge( TileCondToolOfcCoolCfg(flags, OfcType =
'OF1') )
35 if kwargs[
'ZeroAmplitudeWithoutDigits']:
37 if 'TileCondToolDspThreshold' not in kwargs:
38 from TileConditions.TileDSPThresholdConfig
import TileCondToolDspThresholdCfg
39 kwargs[
'TileCondToolDspThreshold'] = acc.popToolsAndMerge( TileCondToolDspThresholdCfg(flags) )
41 if kwargs[
'CorrectPedestalDifference']
or kwargs[
'ZeroAmplitudeWithoutDigits']:
42 from TileConditions.TileEMScaleConfig
import TileEMScaleCondAlgCfg
43 acc.merge( TileEMScaleCondAlgCfg(flags) )
45 TileRawChannelOF1Corrector=CompFactory.TileRawChannelOF1Corrector
53 """Return component accumulator with configured private Tile raw channel noise filter tool
56 flags -- Athena configuration flags (ConfigFlags)
59 acc = ComponentAccumulator()
61 from TileRecUtils.TileDQstatusConfig
import TileDQstatusAlgCfg
62 acc.merge( TileDQstatusAlgCfg(flags) )
64 from TileConditions.TileInfoLoaderConfig
import TileInfoLoaderCfg
65 acc.merge( TileInfoLoaderCfg(flags) )
67 from TileConditions.TileEMScaleConfig
import TileEMScaleCondAlgCfg
68 acc.merge( TileEMScaleCondAlgCfg(flags) )
70 from TileConditions.TileSampleNoiseConfig
import TileSampleNoiseCondAlgCfg
71 acc.merge( TileSampleNoiseCondAlgCfg(flags) )
73 from TileConditions.TileBadChannelsConfig
import TileBadChannelsCondAlgCfg
74 acc.merge( TileBadChannelsCondAlgCfg(flags) )
76 TileRawChannelNoiseFilter=CompFactory.TileRawChannelNoiseFilter
84 """Return component accumulator with configured private Tile raw channel timing jump correction tool
87 flags -- Athena configuration flags (ConfigFlags)
88 EneThreshold3 - energy threshold on 3 channels in one DMU (in MeV)
89 EneThreshold1 - energy threshold on 1 channel (in MeV)
90 TimeThreshold - threshold on time difference (in ns)
93 acc = ComponentAccumulator()
94 kwargs.setdefault(
'CheckDCS', flags.Tile.useDCS)
95 kwargs.setdefault(
'EneThreshold3', 1000)
96 kwargs.setdefault(
'EneThreshold1', 3000)
97 kwargs.setdefault(
'TimeThreshold', 15)
98 kwargs.setdefault(
'AverTimeEneThreshold', 500)
99 kwargs.setdefault(
'RefTimeThreshold', 10)
100 kwargs.setdefault(
'SampleDiffMaxMin_HG', 15)
101 kwargs.setdefault(
'SampleDiffMaxMin_LG', -1)
103 from TileRecUtils.TileDQstatusConfig
import TileDQstatusAlgCfg
104 acc.merge( TileDQstatusAlgCfg(flags) )
106 from TileConditions.TileCablingSvcConfig
import TileCablingSvcCfg
107 acc.merge(TileCablingSvcCfg(flags))
109 from TileConditions.TileEMScaleConfig
import TileEMScaleCondAlgCfg
110 acc.merge( TileEMScaleCondAlgCfg(flags) )
112 from TileConditions.TileBadChannelsConfig
import TileBadChannelsCondAlgCfg
113 acc.merge( TileBadChannelsCondAlgCfg(flags) )
115 if kwargs[
'CheckDCS']:
116 from TileConditions.TileDCSConfig
import TileDCSCondAlgCfg
117 acc.merge( TileDCSCondAlgCfg(flags) )
119 TileTimeBCOffsetFilter=CompFactory.TileTimeBCOffsetFilter
127 """Return component accumulator with configured private Tile raw channel correction tools
130 flags -- Athena configuration flags (ConfigFlags)
133 acc = ComponentAccumulator()
135 noiseFilterTools = []
137 if flags.Tile.correctPedestalDifference
or flags.Tile.zeroAmplitudeWithoutDigits:
140 if flags.Tile.NoiseFilter == 1:
143 if flags.Tile.correctTimeJumps:
146 acc.setPrivateTools( noiseFilterTools )
152 """Return component accumulator with configured Tile raw channel correction algorithm
155 flags -- Athena configuration flags (ConfigFlags)
158 InputRawChannelContainer -- input Tile raw channel container. Defaults to TileRawChannelCnt.
159 OutputRawChannelContainer -- output Tile raw channel container. Defaults to TileRawChannelCntCorrected.
162 acc = ComponentAccumulator()
164 kwargs.setdefault(
'InputRawChannelContainer',
'TileRawChannelCnt')
165 kwargs.setdefault(
'OutputRawChannelContainer',
'TileRawChannelCntCorrected')
167 if 'NoiseFilterTools' not in kwargs:
170 TileRawChannelCorrectionAlg=CompFactory.TileRawChannelCorrectionAlg
177if __name__ ==
"__main__":
179 from AthenaConfiguration.AllConfigFlags
import initConfigFlags
180 from AthenaConfiguration.TestDefaults
import defaultConditionsTags, defaultGeometryTags, defaultTestFiles
181 from AthenaCommon.Logging
import log
187 flags = initConfigFlags()
188 flags.Input.Files = defaultTestFiles.RAW_RUN2
189 flags.GeoModel.AtlasVersion = defaultGeometryTags.RUN2
190 flags.IOVDb.GlobalTag = defaultConditionsTags.RUN2_DATA
191 flags.Tile.RunType = TileRunType.PHY
192 flags.Tile.correctPedestalDifference =
True
193 flags.Tile.zeroAmplitudeWithoutDigits =
True
196 from AthenaConfiguration.MainServicesConfig
import MainServicesCfg
197 acc = MainServicesCfg(flags)
199 from TileByteStream.TileByteStreamConfig
import TileRawDataReadingCfg
200 acc.merge( TileRawDataReadingCfg(flags, readMuRcv=
False) )
205 acc.printConfig(withDetails =
True, summariseProps =
True)
206 acc.store( open(
'TileRawChannelCorrection.pkl',
'wb') )
208 sc = acc.run(maxEvents = 3)
212 sys.exit(
not sc.isSuccess())
This algorithm applies noise filter tools to input Tile raw channel container.
This tool subtracts common-mode noise from all TileRawChannels in one container.
This tool correct TileRawChannels amplitudes which came from OF1 DSP if pedestal changed.
This tool sets bad status for channels with 25ns or 50ns timing jump.
TileTimeBCOffsetFilterCfg(flags, **kwargs)
TileRawChannelCorrectionToolsCfg(flags, **kwargs)
TileRawChannelCorrectionAlgCfg(flags, **kwargs)
TileRawChannelOF1CorrectorCfg(flags, **kwargs)
TileRawChannelNoiseFilterCfg(flags, **kwargs)