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
120 from CaloBadChannelTool.CaloBadChanToolConfig
import CaloBadChanToolCfg
122 CaloClusterBadChannelList=CompFactory.CaloClusterBadChannelList
126 towerMaker.TowerCorrectionTools += [BadChannelListCorr,clusterMoments]
128 if towerBuilder.PrepareLCW:
129 ''' Configure name for calibration tool
131 towerCalName = baseName+
'Calibrator'
132 towerCalibrator = CompFactory.CaloTopoTowerFromClusterCalibrator(towerCalName)
133 towerCalibrator.OrderClusterByPt = orderbyPt
135 towerMaker.TowerCalibratorTool = towerCalibrator
137 result.addEventAlgo(towerMaker)
140 if towerBuilder.TopoClusterRange > 0.:
141 caloTowerMerger = CompFactory.CaloTopoClusterTowerMerger(towerMergerName)
142 caloTowerMerger.TopoClusterRange = towerBuilder.TopoClusterRange
143 caloTowerMerger.TopoClusterContainerKey = towerBuilder.CaloTopoClusterContainerKey
144 caloTowerMerger.TopoTowerContainerKey = towerMaker.TowersOutputName
145 caloTowerMerger.TopoSignalContainerKey = signalContainerKey
147 result.addEventAlgo(caloTowerMerger)
150 from OutputStreamAthenaPool.OutputStreamConfig
import addToAOD, addToESD
151 toESD=[f
"xAOD::CaloClusterContainer#{towerContainerKey}",
152 f
"xAOD::CaloClusterAuxContainer#{towerContainerKey}Aux.",
153 f
"CaloClusterCellLinkContainer#{towerContainerKey}_links"]
156 AODAuxItems=f
"xAOD::CaloClusterAuxContainer#{towerContainerKey}Aux"
157 for mom
in (
"CENTER_LAMBDA",
168 toAOD=[f
"xAOD::CaloClusterContainer#{towerContainerKey}",AODAuxItems]
170 result.merge(
addToESD(flags, toESD))
172 if flags.Calo.FwdTower.WriteToAOD:
173 result.merge(
addToAOD(flags, toAOD))