9def TileRawChannelBuilderOpt2FilterCfg(flags, method = 'Opt2', **kwargs):
10 """Return component accumulator with configured private Tile raw channel builder tool (Opt2)
11
12 Arguments:
13 flags -- Athena configuration flags
14 method -- flavour of Tile Optimal Filtering method. Defaults to Opt2. Possible values: Opt2, OptATLAS, OF1
15 """
16
17 if method not in ['Opt2', 'OptATLAS', 'OF1']:
18 raise(Exception("Invalid Tile Optimal Filtering method: %s" % method))
19
20 name = kwargs.pop('name', 'TileRawChannelBuilder' + method)
21 useIterations = (method == 'Opt2')
22
23 acc = ComponentAccumulator()
24
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
29 kwargs['TileCondToolOfc'] = acc.popToolsAndMerge( TileCondToolOfcCoolCfg(flags, OfcType = ofcType) )
30 else:
31 from TileConditions.TileOFCConfig import TileCondToolOfcCfg
32 kwargs['TileCondToolOfc'] = acc.popToolsAndMerge( TileCondToolOfcCfg(flags) )
33
34 outputContainer = getRawChannelContainerOptATLAS(flags) if method == 'OptATLAS' else 'TileRawChannel' + method
35 kwargs.setdefault('TileRawChannelContainer', outputContainer)
36
37 maxIterations = 3 if flags.Tile.RunType is TileRunType.MONOCIS else 5
38
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
45
46 if (flags.Tile.BestPhaseFromCOOL and not useIterations) or flags.Tile.correctTime:
47 if 'TileCondToolTiming' not in kwargs:
48 from TileConditions.TileTimingConfig import TileCondToolTimingCfg
49 kwargs['TileCondToolTiming'] = acc.popToolsAndMerge( TileCondToolTimingCfg(flags) )
50
51 if flags.Tile.BestPhaseFromCOOL and not useIterations:
52
53 kwargs['correctTime'] = False
54 else:
55 kwargs.setdefault('correctTime', flags.Tile.correctTime)
56
57 if method == 'OptATLAS':
58 pedestalMode = 17
59 else:
60 pedestalMode = -1 if method == 'OF1' else 1
61
62 kwargs.setdefault('PedestalMode', pedestalMode)
63
64 if kwargs['PedestalMode'] == -1 and 'TileCondToolNoiseSample' not in kwargs:
65
66 from TileConditions.TileSampleNoiseConfig import TileCondToolNoiseSampleCfg
67 sampleNoiseTool = acc.popToolsAndMerge( TileCondToolNoiseSampleCfg(flags) )
68 kwargs['TileCondToolNoiseSample'] = sampleNoiseTool
69
70 TileRawChannelBuilderOpt2Filter=CompFactory.TileRawChannelBuilderOpt2Filter
71 from TileRecUtils.TileRawChannelBuilderConfig import TileRawChannelBuilderCfg
72 builderTool = acc.popToolsAndMerge( TileRawChannelBuilderCfg(flags, name, TileRawChannelBuilderOpt2Filter, **kwargs) )
73
74 acc.setPrivateTools( builderTool )
75 return acc
76
77
78