createEcalEndcapCells.noiseTool = noiseEndcap
createEcalEndcapCells.hits="newECalEndcapCells"
createEcalEndcapCells.cells=ecalEndcapCellsName+"Noise"
ApplicationMgr().TopAlg +=[createEcalEndcapCells]

#Create calo clusters
from GaudiKernel.PhysicalConstants import pi

from Configurables import CaloTowerTool
towers = CaloTowerTool("towers")
towers.deltaEtaTower = 0.01
towers.deltaPhiTower = 2*pi/704.
towers.ecalBarrelReadoutName = ecalBarrelReadoutName
towers.ecalEndcapReadoutName = ecalEndcapReadoutName
towers.ecalFwdReadoutName = ecalFwdReadoutName
towers.hcalBarrelReadoutName = hcalBarrelReadoutPhiEtaName
towers.hcalExtBarrelReadoutName = hcalExtBarrelReadoutPhiEtaName
towers.hcalEndcapReadoutName = hcalEndcapReadoutName
towers.hcalFwdReadoutName = hcalFwdReadoutName

towers.ecalBarrelCells.Path = ecalBarrelCellsName + "Noise"
towers.ecalEndcapCells.Path = ecalEndcapCellsName + "Noise"
towers.ecalFwdCells.Path = ecalFwdCellsName
towers.hcalBarrelCells.Path = "newHCalBarrelCells"
towers.hcalExtBarrelCells.Path ="newHCalExtBarrelCells"
towers.hcalEndcapCells.Path = hcalEndcapCellsName
towers.hcalFwdCells.Path = hcalFwdCellsName

# Cluster variables
windE = 9
windP = 17
# sliding window clustering #FIXME not yet ready for key4hep
#Empty cells for parts of calorimeter not implemented yet
from Configurables import CreateEmptyCaloCellsCollection
createemptycells = CreateEmptyCaloCellsCollection("CreateEmptyCaloCells")
createemptycells.cells.Path = "emptyCaloCells"
ApplicationMgr().TopAlg += [createemptycells]

from Configurables import CaloTowerTool
towers = CaloTowerTool("towers")
towers.deltaEtaTower = 0.01
towers.deltaPhiTower = 2 * constants.pi / 768.
towers.ecalBarrelReadoutName = ecalBarrelReadoutNamePhiEta
towers.ecalEndcapReadoutName = ""
towers.ecalFwdReadoutName = ""
towers.hcalBarrelReadoutName = ""
towers.hcalExtBarrelReadoutName = ""
towers.hcalEndcapReadoutName = ""
towers.hcalFwdReadoutName = ""
towers.ecalBarrelCells.Path = EcalBarrelCellsName
towers.ecalEndcapCells.Path = "emptyCaloCells"
towers.ecalFwdCells.Path = "emptyCaloCells"
towers.hcalBarrelCells.Path = "emptyCaloCells"
towers.hcalExtBarrelCells.Path = "emptyCaloCells"
towers.hcalEndcapCells.Path = "emptyCaloCells"
towers.hcalFwdCells.Path = "emptyCaloCells"



from Configurables import CreateCaloClustersSlidingWindow
createClusters = CreateCaloClustersSlidingWindow("CreateClusters")