3 from AthenaConfiguration.ComponentAccumulator
import ComponentAccumulator
4 from AthenaConfiguration.ComponentFactory
import CompFactory
5 from AthenaCommon.Logging
import logging
9 mlog = logging.getLogger(
'MakeFwdTopoTowerCfg')
13 from LArGeoAlgsNV.LArGMConfig
import LArGMCfg
14 from TileGeoModel.TileGMConfig
import TileGMCfg
20 result.addCondAlgo(CompFactory.CaloTowerGeometryCondAlg(TowerEtaBins = 100,
25 kwargs.setdefault(
"PrepareLCW",flags.Calo.FwdTower.prepareLCW)
26 kwargs.setdefault(
"TopoClusterRange",flags.Calo.FwdTower.clusterRange)
27 kwargs.setdefault(
"BuildCombinedTopoSignal",
True)
30 towerContainerKey=kwargs.pop(
'towerContainerKey',
'CaloCalFwdTopoTowers')
31 signalContainerKey=kwargs.pop(
'signalContainerKey',
'CaloCalTopoSignals')
32 towerBuilderName=kwargs.pop(
'TowerBuilderName',
'CaloTopoTowerFromClusterMaker')
33 towerMergerName=kwargs.pop(
'TowerMergerName',
'CaloTopoSignalMaker')
36 towerBuilder=CompFactory.CaloTopoTowerFromClusterMaker(towerBuilderName,**kwargs)
39 orderbyPt=towerBuilder.OrderClusterByPt
41 if flags.Calo.FwdTower.prepareLCW:
43 towerBuilder.OrderClusterByPt=
False
45 mlog.info(
'Consistency check')
46 if towerBuilder.PrepareLCW
and not towerBuilder.BuildTopoTowers:
47 raise RuntimeError(
'{0}[inconsistent configuration] applying LCW requires to build topo-towers'.
format(towerBuilder.name()))
48 if towerBuilder.BuildCombinedTopoSignal
and not towerBuilder.BuildTopoTowers:
49 raise RuntimeError(
'{0}[inconsistent configuration] building combined topo-cluster/topo-tower signals requires to build topo-towers'.
format(towerBuilder.name()))
50 if towerBuilder.ApplyCellEnergyThreshold
and towerBuilder.BuildTopoTowers:
51 raise RuntimeError(
'{0}[inconsistent configuration] applying cell energy thresholds for topo-towers not yet implemented'.
format(towerBuilder.name()))
53 ''' Tower converter configuration summary
55 if towerBuilder.BuildTopoTowers:
56 if towerBuilder.PrepareLCW:
59 mlog.info(
'################################################')
60 mlog.info(
'## Produce LCW calibrated topo-tower clusters ##')
61 mlog.info(
'################################################')
62 mlog.info(
'CaloTopoClusterContainerKey .. {0}'.
format(towerBuilder.CaloTopoClusterContainerKey))
67 mlog.info(
'###############################################')
68 mlog.info(
'## Produce EM calibrated topo-tower clusters ##')
69 mlog.info(
'###############################################')
70 mlog.info(
'CaloTopoClusterContainerKey .. {0}'.
format(towerBuilder.CaloTopoClusterContainerKey))
72 if towerBuilder.BuildCombinedTopoSignal:
74 mlog.info(
'Combined topo-cluster/topo-towermode with y_max = {0}'.
format(towerBuilder.TopoClusterRange))
78 mlog.info(
'########################################')
79 mlog.info(
'## Produce EM standard tower clusters ##')
80 mlog.info(
'########################################')
83 from CaloTools.CaloNoiseCondAlgConfig
import CaloNoiseCondAlgCfg
86 baseName=towerBuilder.name.replace(
"Builder",
"").
replace(
"Maker",
"")
89 clusterMoments = CompFactory.CaloClusterMomentsMaker (baseName+
'MomentMaker')
90 clusterMoments.MaxAxisAngle = 20*deg
91 clusterMoments.TwoGaussianNoise = flags.Calo.TopoCluster.doTwoGaussianNoise
92 clusterMoments.MinBadLArQuality = 4000
93 clusterMoments.MomentsNames = [
105 if not flags.Common.isOnline:
106 from LArConfiguration.LArElecCalibDBConfig
import LArElecCalibDBCfg
109 clusterMoments.LArHVFraction=CompFactory.LArHVFraction(HVScaleCorrKey=
"LArHVScaleCorr")
111 clusterMoments.LArHVFraction=CompFactory.LArHVFraction(HVScaleCorrKey=
"LArHVScaleCorrRecomputed")
113 clusterMoments.MomentsNames += [
"ENG_BAD_HV_CELLS",
"N_BAD_HV_CELLS"]
116 towerMaker = CompFactory.CaloTopoTowerMaker(baseName+
"Alg")
117 towerMaker.TowersOutputName = towerContainerKey
118 towerMaker.TowerMakerTool = towerBuilder
119 towerMaker.UseLCWCalibration = towerBuilder.PrepareLCW
121 from CaloBadChannelTool.CaloBadChanToolConfig
import CaloBadChanToolCfg
123 CaloClusterBadChannelList=CompFactory.CaloClusterBadChannelList
127 towerMaker.TowerCorrectionTools += [BadChannelListCorr,clusterMoments]
129 if towerBuilder.PrepareLCW:
130 ''' Configure name for calibration tool
132 towerCalName = baseName+
'Calibrator'
133 towerCalibrator = CompFactory.CaloTopoTowerFromClusterCalibrator(towerCalName)
134 towerCalibrator.OrderClusterByPt = orderbyPt
136 towerMaker.TowerCalibratorTool = towerCalibrator
138 result.addEventAlgo(towerMaker)
141 if towerBuilder.TopoClusterRange > 0.:
142 caloTowerMerger = CompFactory.CaloTopoClusterTowerMerger(towerMergerName)
143 caloTowerMerger.TopoClusterRange = towerBuilder.TopoClusterRange
144 caloTowerMerger.TopoClusterContainerKey = towerBuilder.CaloTopoClusterContainerKey
145 caloTowerMerger.TopoTowerContainerKey = towerMaker.TowersOutputName
146 caloTowerMerger.TopoSignalContainerKey = signalContainerKey
148 result.addEventAlgo(caloTowerMerger)
151 from OutputStreamAthenaPool.OutputStreamConfig
import addToAOD, addToESD
152 toESD=[f
"xAOD::CaloClusterContainer#{towerContainerKey}",
153 f
"xAOD::CaloClusterAuxContainer#{towerContainerKey}Aux.",
154 f
"CaloClusterCellLinkContainer#{towerContainerKey}_links"]
157 AODAuxItems=f
"xAOD::CaloClusterAuxContainer#{towerContainerKey}Aux"
158 for mom
in (
"CENTER_LAMBDA",
169 toAOD=[f
"xAOD::CaloClusterContainer#{towerContainerKey}",AODAuxItems]
171 result.merge(
addToESD(flags, toESD))
173 if flags.Calo.FwdTower.WriteToAOD:
174 result.merge(
addToAOD(flags, toAOD))
179 if __name__==
"__main__":
180 from AthenaConfiguration.AllConfigFlags
import initConfigFlags
182 flags.Input.Files = [
"/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/RecExRecoTest/mc20e_13TeV/valid1.410000.PowhegPythiaEvtGen_P2012_ttbar_hdamp172p5_nonallhad.ESD.e4993_s3227_r12689/myESD.pool.root"]
183 flags.Output.ESDFileName=
"esdOut.pool.root"
187 from AthenaConfiguration.MainServicesConfig
import MainServicesCfg
188 from AthenaPoolCnvSvc.PoolReadConfig
import PoolReadCfg
193 towerAcc=
CaloFwdTopoTowerCfg(flags,towerContainerKey=
"NewTowers",CaloTopoClusterContainerKey=
"CaloCalTopoClusters")