3 """Define method to construct configured Tile correction tools and algorithm"""
5 from AthenaConfiguration.ComponentAccumulator
import ComponentAccumulator
6 from AthenaConfiguration.ComponentFactory
import CompFactory
7 from TileConfiguration.TileConfigFlags
import TileRunType
10 """Return component accumulator with configured private Tile OF1 raw channel correction tool
13 flags -- Athena configuration flags
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
27 if 'TileCondToolTiming' not in kwargs:
28 from TileConditions.TileTimingConfig
import TileCondToolOnlineTimingCfg
31 if 'TileCondToolOfc' not in kwargs:
32 from TileConditions.TileOFCConfig
import TileCondToolOfcCoolCfg
35 if kwargs[
'ZeroAmplitudeWithoutDigits']:
37 if 'TileCondToolDspThreshold' not in kwargs:
38 from TileConditions.TileDSPThresholdConfig
import TileCondToolDspThresholdCfg
41 if kwargs[
'CorrectPedestalDifference']
or kwargs[
'ZeroAmplitudeWithoutDigits']:
42 from TileConditions.TileEMScaleConfig
import TileEMScaleCondAlgCfg
45 TileRawChannelOF1Corrector=CompFactory.TileRawChannelOF1Corrector
53 """Return component accumulator with configured private Tile raw channel noise filter tool
56 flags -- Athena configuration flags (ConfigFlags)
61 from TileRecUtils.TileDQstatusConfig
import TileDQstatusAlgCfg
64 from TileConditions.TileInfoLoaderConfig
import TileInfoLoaderCfg
67 from TileConditions.TileEMScaleConfig
import TileEMScaleCondAlgCfg
70 from TileConditions.TileSampleNoiseConfig
import TileSampleNoiseCondAlgCfg
73 from TileConditions.TileBadChannelsConfig
import TileBadChannelsCondAlgCfg
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)
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
106 from TileConditions.TileCablingSvcConfig
import TileCablingSvcCfg
109 from TileConditions.TileEMScaleConfig
import TileEMScaleCondAlgCfg
112 from TileConditions.TileBadChannelsConfig
import TileBadChannelsCondAlgCfg
115 if kwargs[
'CheckDCS']:
116 from TileConditions.TileDCSConfig
import TileDCSCondAlgCfg
119 TileTimeBCOffsetFilter=CompFactory.TileTimeBCOffsetFilter
127 """Return component accumulator with configured private Tile raw channel correction tools
130 flags -- Athena configuration flags (ConfigFlags)
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.
164 kwargs.setdefault(
'InputRawChannelContainer',
'TileRawChannelCnt')
165 kwargs.setdefault(
'OutputRawChannelContainer',
'TileRawChannelCntCorrected')
167 if 'NoiseFilterTools' not in kwargs:
170 TileRawChannelCorrectionAlg=CompFactory.TileRawChannelCorrectionAlg
177 if __name__ ==
"__main__":
179 from AthenaConfiguration.AllConfigFlags
import initConfigFlags
180 from AthenaConfiguration.TestDefaults
import defaultConditionsTags, defaultGeometryTags, defaultTestFiles
181 from AthenaCommon.Logging
import log
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
199 from TileByteStream.TileByteStreamConfig
import TileRawDataReadingCfg
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())