3 """Define methods to construct configured Tile raw channel builder tools using Optimal Filtering methods"""
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 raw channel builder tool (Opt2)
13 flags -- Athena configuration flags
14 method -- flavour of Tile Optimal Filtering method. Defaults to Opt2. Possible values: Opt2, OptATLAS, OF1
17 if method
not in [
'Opt2',
'OptATLAS',
'OF1']:
18 raise(Exception(
"Invalid Tile Optimal Filtering method: %s" % method))
20 name = kwargs.pop(
'name',
'TileRawChannelBuilder' + method)
21 useIterations = (method ==
'Opt2')
25 if 'TileCondToolOfc' not in kwargs:
26 if flags.Tile.OfcFromCOOL:
27 ofcType =
'OF2' if method !=
'OF1' else 'OF1'
28 from TileConditions.TileOFCConfig
import TileCondToolOfcCoolCfg
31 from TileConditions.TileOFCConfig
import TileCondToolOfcCfg
34 outputContainer = flags.Tile.RawChannelContainer
if method ==
'OptATLAS' else 'TileRawChannel' + method
35 kwargs.setdefault(
'TileRawChannelContainer', outputContainer)
37 maxIterations = 3
if flags.Tile.RunType
is TileRunType.MONOCIS
else 5
39 kwargs[
'BestPhase'] =
False if useIterations
else flags.Tile.BestPhaseFromCOOL
40 kwargs[
'OF2'] =
True if method !=
'OF1' else False
41 kwargs[
'MaxIterations'] = maxIterations
if useIterations
else 1
42 kwargs[
'Minus1Iteration'] =
True if useIterations
else False
43 kwargs[
'AmplitudeCorrection'] =
False if useIterations
else flags.Tile.correctAmplitude
44 kwargs[
'TimeCorrection'] =
False if method !=
'OptATLAS' else flags.Tile.correctTimeNI
46 if (flags.Tile.BestPhaseFromCOOL
and not useIterations)
or flags.Tile.correctTime:
47 if 'TileCondToolTiming' not in kwargs:
48 from TileConditions.TileTimingConfig
import TileCondToolTimingCfg
51 if flags.Tile.BestPhaseFromCOOL
and not useIterations:
53 kwargs[
'correctTime'] =
False
55 kwargs.setdefault(
'correctTime', flags.Tile.correctTime)
57 if method ==
'OptATLAS':
60 pedestalMode = -1
if method ==
'OF1' else 1
62 kwargs.setdefault(
'PedestalMode', pedestalMode)
64 if kwargs[
'PedestalMode'] == -1
and 'TileCondToolNoiseSample' not in kwargs:
66 from TileConditions.TileSampleNoiseConfig
import TileCondToolNoiseSampleCfg
68 kwargs[
'TileCondToolNoiseSample'] = sampleNoiseTool
70 TileRawChannelBuilderOpt2Filter=CompFactory.TileRawChannelBuilderOpt2Filter
71 from TileRecUtils.TileRawChannelBuilderConfig
import TileRawChannelBuilderCfg
72 builderTool = acc.popToolsAndMerge(
TileRawChannelBuilderCfg(flags, name, TileRawChannelBuilderOpt2Filter, **kwargs) )
74 acc.setPrivateTools( builderTool )
89 if __name__ ==
"__main__":
91 from AthenaConfiguration.AllConfigFlags
import initConfigFlags
92 from AthenaConfiguration.TestDefaults
import defaultGeometryTags, defaultTestFiles
93 from AthenaCommon.Logging
import log
100 flags.Input.Files = defaultTestFiles.RAW_RUN2
101 flags.GeoModel.AtlasVersion = defaultGeometryTags.RUN2
102 flags.Tile.RunType = TileRunType.PHY
103 flags.Tile.NoiseFilter = 1
115 acc.printConfig(withDetails =
True, summariseProps =
True)
116 acc.store(
open(
'TileRawChannelBuilder.pkl',
'wb') )