33def TileCellMakerCfg(flags, mergeChannels=True, **kwargs):
34 """Return component accumulator with configured Tile Cell maker algorithm
35
36 Arguments:
37 flags -- Athena configuration flags
38 name -- name of Tile cell maker algorithm. Defautls to TileCellMaker
39 or TileCellMakerHG/TileCellMakerLG depending on only used gain.
40 SkipGain - skip given gain. Defaults to -1 [use all gains]. Possible values: 0 [LG], 1 [HG].
41 CaloCellsOutputName -- name of the output calo cell container. Defautls to AllCalo
42 or AllCaloHG/AllCaloLG depending on only used gain.
43 DoCaloNeighborsCorrection -- correct dead cells. Assign as energy the average energy of
44 the surrounding cells. Defaults to False.
45 mergeChannels -- merge DSP results with offline reco results. Defaults to True.
46 """
47
48 acc = ComponentAccumulator()
49
50 useGain = {0 : 'HG', 1 : 'LG'}
51
52 skipGain = kwargs.get('SkipGain', -1)
53
54 defaultName = 'TileCellMaker' if skipGain == -1 else 'TileCellMaker' + useGain[skipGain]
55 name = kwargs.get('name', defaultName)
56
57 defaultOutputCells = 'AllCalo' if skipGain == -1 else 'AllCalo' + useGain[skipGain]
58 caloCellsOutputName = kwargs.get('CaloCellsOutputName', defaultOutputCells)
59
60 doCaloNeighborsCorrection = kwargs.get('DoCaloNeighborsCorrection', False)
61
62 from AthenaCommon.Logging import logging
63 msg = logging.getLogger( 'TileCellMakerCfg' )
64
65 CaloCellMaker, CaloCellContainerFinalizerTool=CompFactory.getComps("CaloCellMaker","CaloCellContainerFinalizerTool",)
66 from TileRecUtils.TileCellBuilderConfig import TileCellBuilderCfg
67 tileCellBuilder = acc.popToolsAndMerge( TileCellBuilderCfg(flags, SkipGain=skipGain, mergeChannels=mergeChannels) )
68
70
71 noiseFilter = flags.Tile.NoiseFilter
72
73 doCellNoiseFilter = noiseFilter - noiseFilter % 100
74 doRawChannelNoiseFilter = noiseFilter - doCellNoiseFilter - noiseFilter % 10
75
76 if doRawChannelNoiseFilter == 10:
77 msg.info('Use Tile raw channel noise filter')
78 from TileRecUtils.TileRawChannelCorrectionConfig import TileRawChannelNoiseFilterCfg
79 noiseFilter = acc.popToolsAndMerge( TileRawChannelNoiseFilterCfg(flags) )
80 tileCellBuilder.NoiseFilterTools = [noiseFilter]
81
82 if doCellNoiseFilter == 100:
83 msg.info('Use Tile cell noise filter')
84 from TileRecUtils.TileCellNoiseFilterConfig import TileCellNoiseFilterCfg
85 cellNoiseFilter = acc.popToolsAndMerge( TileCellNoiseFilterCfg(flags) )
86 cellMakerTools += [ cellNoiseFilter ]
87
88 if doCaloNeighborsCorrection:
89 msg.info('Use Calo cell neighbours average correction')
90 caloCellNeighborsAverageCorrection = acc.popToolsAndMerge( CaloCellNeighborsAverageCorrCfg(flags) )
91 cellMakerTools += [caloCellNeighborsAverageCorrection]
92
93 if flags.Beam.Type is not BeamType.TestBeam:
94 caloCellContainerChecker = acc.popToolsAndMerge( CaloCellContainerCheckerToolCfg(flags) )
95 cellMakerTools += [caloCellContainerChecker]
96
97 cellMakerAlg =
CaloCellMaker(name = name, CaloCellMakerToolNames = cellMakerTools,
98 CaloCellsOutputName = caloCellsOutputName)
99
100 acc.addEventAlgo(cellMakerAlg, primary = True)
101
102 return acc
103
104
105