3 """Define method to construct configured Tile Cell maker algorithm"""
5 from AthenaConfiguration.ComponentAccumulator
import ComponentAccumulator
6 from AthenaConfiguration.Enums
import BeamType
7 from AthenaConfiguration.ComponentFactory
import CompFactory
8 from TileConfiguration.TileConfigFlags
import TileRunType
9 from CaloCellCorrection.CaloCellCorrectionConfig
import CaloCellNeighborsAverageCorrCfg
13 """Return component accumulator with configured private Calo cell container checker tool
16 flags -- Athena configuration flags
21 from LArGeoAlgsNV.LArGMConfig
import LArGMCfg
24 from TileGeoModel.TileGMConfig
import TileGMCfg
27 CaloCellContainerCheckerTool=CompFactory.CaloCellContainerCheckerTool
34 """Return component accumulator with configured Tile Cell maker algorithm
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.
50 useGain = {0 :
'HG', 1 :
'LG'}
52 skipGain = kwargs.get(
'SkipGain', -1)
54 defaultName =
'TileCellMaker' if skipGain == -1
else 'TileCellMaker' + useGain[skipGain]
55 name = kwargs.get(
'name', defaultName)
57 defaultOutputCells =
'AllCalo' if skipGain == -1
else 'AllCalo' + useGain[skipGain]
58 caloCellsOutputName = kwargs.get(
'CaloCellsOutputName', defaultOutputCells)
60 doCaloNeighborsCorrection = kwargs.get(
'DoCaloNeighborsCorrection',
False)
62 from AthenaCommon.Logging
import logging
63 msg = logging.getLogger(
'TileCellMakerCfg' )
65 CaloCellMaker, CaloCellContainerFinalizerTool=CompFactory.getComps(
"CaloCellMaker",
"CaloCellContainerFinalizerTool",)
66 from TileRecUtils.TileCellBuilderConfig
import TileCellBuilderCfg
67 tileCellBuilder = acc.popToolsAndMerge(
TileCellBuilderCfg(flags, SkipGain=skipGain, mergeChannels=mergeChannels) )
71 noiseFilter = flags.Tile.NoiseFilter
73 doCellNoiseFilter = noiseFilter - noiseFilter % 100
74 doRawChannelNoiseFilter = noiseFilter - doCellNoiseFilter - noiseFilter % 10
76 if doRawChannelNoiseFilter == 10:
77 msg.info(
'Use Tile raw channel noise filter')
78 from TileRecUtils.TileRawChannelCorrectionConfig
import TileRawChannelNoiseFilterCfg
80 tileCellBuilder.NoiseFilterTools = [noiseFilter]
82 if doCellNoiseFilter == 100:
83 msg.info(
'Use Tile cell noise filter')
84 from TileRecUtils.TileCellNoiseFilterConfig
import TileCellNoiseFilterCfg
86 cellMakerTools += [ cellNoiseFilter ]
88 if doCaloNeighborsCorrection:
89 msg.info(
'Use Calo cell neighbours average correction')
91 cellMakerTools += [caloCellNeighborsAverageCorrection]
93 if flags.Beam.Type
is not BeamType.TestBeam:
95 cellMakerTools += [caloCellContainerChecker]
97 cellMakerAlg =
CaloCellMaker(name = name, CaloCellMakerToolNames = cellMakerTools,
98 CaloCellsOutputName = caloCellsOutputName)
100 acc.addEventAlgo(cellMakerAlg, primary =
True)
106 if __name__ ==
"__main__":
108 from AthenaConfiguration.AllConfigFlags
import initConfigFlags
109 from AthenaConfiguration.TestDefaults
import defaultConditionsTags, defaultGeometryTags, defaultTestFiles
110 from AthenaCommon.Logging
import log
117 flags.Input.Files = defaultTestFiles.RAW_RUN2
118 flags.GeoModel.AtlasVersion = defaultGeometryTags.RUN2
119 flags.IOVDb.GlobalTag = defaultConditionsTags.RUN2_DATA
120 flags.Tile.RunType = TileRunType.PHY
121 flags.Tile.doOptATLAS =
True
122 flags.Tile.correctTimeJumps =
True
123 flags.Tile.NoiseFilter = 1
124 flags.Output.ESDFileName =
"myESD.pool.root"
125 flags.Exec.MaxEvents=3
130 from AthenaConfiguration.MainServicesConfig
import MainServicesCfg
133 from TileByteStream.TileByteStreamConfig
import TileRawDataReadingCfg
138 from OutputStreamAthenaPool.OutputStreamConfig
import OutputStreamCfg, outputStreamName
140 ItemList = [
'CaloCellContainer#*',
'TileCellContainer#*']))
142 acc.getEventAlgo(
outputStreamName(
"ESD")).ExtraInputs = {(
'CaloCellContainer',
'StoreGateSvc+AllCalo')}
145 acc.printConfig(withDetails =
True, summariseProps =
True)
146 acc.store(
open(
'TileCellMaker.pkl',
'wb') )
150 ROOT.CaloCellContainer
156 sys.exit(
not sc.isSuccess())