3 """Define method to construct configured Tile Cell maker algorithm"""
5 from AthenaConfiguration.ComponentAccumulator
import ComponentAccumulator
6 from AthenaConfiguration.ComponentFactory
import CompFactory
7 from TileConfiguration.TileConfigFlags
import TileRunType
8 from CaloCellCorrection.CaloCellCorrectionConfig
import CaloCellNeighborsAverageCorrCfg
12 """Return component accumulator with configured private Calo cell container checker tool
15 flags -- Athena configuration flags
20 from LArGeoAlgsNV.LArGMConfig
import LArGMCfg
23 from TileGeoModel.TileGMConfig
import TileGMCfg
26 CaloCellContainerCheckerTool=CompFactory.CaloCellContainerCheckerTool
33 """Return component accumulator with configured Tile Cell maker algorithm
36 flags -- Athena configuration flags
37 name -- name of Tile cell maker algorithm. Defautls to TileCellMaker
38 or TileCellMakerHG/TileCellMakerLG depending on only used gain.
39 SkipGain - skip given gain. Defaults to -1 [use all gains]. Possible values: 0 [LG], 1 [HG].
40 CaloCellsOutputName -- name of the output calo cell container. Defautls to AllCalo
41 or AllCaloHG/AllCaloLG depending on only used gain.
42 DoCaloNeighborsCorrection -- correct dead cells. Assign as energy the average energy of
43 the surrounding cells. Defaults to False.
44 mergeChannels -- merge DSP results with offline reco results. Defaults to True.
49 useGain = {0 :
'HG', 1 :
'LG'}
51 skipGain = kwargs.get(
'SkipGain', -1)
53 defaultName =
'TileCellMaker' if skipGain == -1
else 'TileCellMaker' + useGain[skipGain]
54 name = kwargs.get(
'name', defaultName)
56 defaultOutputCells =
'AllCalo' if skipGain == -1
else 'AllCalo' + useGain[skipGain]
57 caloCellsOutputName = kwargs.get(
'CaloCellsOutputName', defaultOutputCells)
59 doCaloNeighborsCorrection = kwargs.get(
'DoCaloNeighborsCorrection',
False)
61 from AthenaCommon.Logging
import logging
62 msg = logging.getLogger(
'TileCellMakerCfg' )
64 CaloCellMaker, CaloCellContainerFinalizerTool=CompFactory.getComps(
"CaloCellMaker",
"CaloCellContainerFinalizerTool",)
65 from TileRecUtils.TileCellBuilderConfig
import TileCellBuilderCfg
66 tileCellBuilder = acc.popToolsAndMerge(
TileCellBuilderCfg(flags, SkipGain=skipGain, mergeChannels=mergeChannels) )
70 noiseFilter = flags.Tile.NoiseFilter
72 doCellNoiseFilter = noiseFilter - noiseFilter % 100
73 doRawChannelNoiseFilter = noiseFilter - doCellNoiseFilter - noiseFilter % 10
75 if doRawChannelNoiseFilter == 10:
76 msg.info(
'Use Tile raw channel noise filter')
77 from TileRecUtils.TileRawChannelCorrectionConfig
import TileRawChannelNoiseFilterCfg
79 tileCellBuilder.NoiseFilterTools = [noiseFilter]
81 if doCellNoiseFilter == 100:
82 msg.info(
'Use Tile cell noise filter')
83 from TileRecUtils.TileCellNoiseFilterConfig
import TileCellNoiseFilterCfg
85 cellMakerTools += [ cellNoiseFilter ]
87 if doCaloNeighborsCorrection:
88 msg.info(
'Use Calo cell neighbours average correction')
90 cellMakerTools += [caloCellNeighborsAverageCorrection]
94 cellMakerTools += [caloCellContainerChecker]
96 cellMakerAlg =
CaloCellMaker(name = name, CaloCellMakerToolNames = cellMakerTools,
97 CaloCellsOutputName = caloCellsOutputName)
99 acc.addEventAlgo(cellMakerAlg, primary =
True)
105 if __name__ ==
"__main__":
107 from AthenaConfiguration.AllConfigFlags
import initConfigFlags
108 from AthenaConfiguration.TestDefaults
import defaultConditionsTags, defaultGeometryTags, defaultTestFiles
109 from AthenaCommon.Logging
import log
116 flags.Input.Files = defaultTestFiles.RAW_RUN2
117 flags.GeoModel.AtlasVersion = defaultGeometryTags.RUN2
118 flags.IOVDb.GlobalTag = defaultConditionsTags.RUN2_DATA
119 flags.Tile.RunType = TileRunType.PHY
120 flags.Tile.doOptATLAS =
True
121 flags.Tile.correctTimeJumps =
True
122 flags.Tile.NoiseFilter = 1
123 flags.Output.ESDFileName =
"myESD.pool.root"
124 flags.Exec.MaxEvents=3
129 from AthenaConfiguration.MainServicesConfig
import MainServicesCfg
132 from TileByteStream.TileByteStreamConfig
import TileRawDataReadingCfg
137 from OutputStreamAthenaPool.OutputStreamConfig
import OutputStreamCfg, outputStreamName
139 ItemList = [
'CaloCellContainer#*',
'TileCellContainer#*']))
141 acc.getEventAlgo(
outputStreamName(
"ESD")).ExtraInputs = {(
'CaloCellContainer',
'StoreGateSvc+AllCalo')}
144 acc.printConfig(withDetails =
True, summariseProps =
True)
145 acc.store(
open(
'TileCellMaker.pkl',
'wb') )
149 ROOT.CaloCellContainer
155 sys.exit(
not sc.isSuccess())