Skip to content
Snippets Groups Projects

Draft: Updating caloRinger containers and including new egamma flags

Files
8
@@ -6,7 +6,7 @@ from AthenaCommon.SystemOfUnits import GeV
from ROOT import CaloCell_ID
def CaloRingsAsymElectronBuilderCfg(flags, name="CaloRingsAsymBuilder", **kwargs):
def CaloRingsAsymElectronBuilderCfg(flags, name="CaloRingsAsymElectronBuilder", **kwargs):
NRings = [8, 64, 8, 8, 4, 4, 4]
kwargs.setdefault(
'EtaWidth', [0.025, 0.003125, 0.025, 0.05, 0.1, 0.1, 0.2])
@@ -33,12 +33,13 @@ def CaloRingsAsymElectronBuilderCfg(flags, name="CaloRingsAsymBuilder", **kwargs
kwargs.setdefault('CellsContainerName', flags.Egamma.Keys.Input.CaloCells)
kwargs.setdefault('CaloRingsContainerName', 'ElectronCaloAsymRings')
kwargs.setdefault('RingSetContainerName', 'ElectronAsymRingSets')
kwargs.setdefault('MinPartEnergy', 15*GeV)
tool = CompFactory.Ringer.CaloRingsAsymBuilder(name, **kwargs)
kwargs.setdefault('MinPartEnergy',flags.Egamma.CaloRinger.minElectronEnergy*GeV)
tool = CompFactory.Ringer.CaloAsymRingsBuilder(name, **kwargs)
return tool
def CaloRingsAsymPhotonBuilderCfg(flags, name="CaloRingsAsymBuilder", **kwargs):
def CaloRingsAsymPhotonBuilderCfg(flags, name="CaloRingsAsymPhotonBuilder", **kwargs):
NRings = [8, 64, 8, 8, 4, 4, 4]
kwargs.setdefault(
'EtaWidth', [0.025, 0.003125, 0.025, 0.05, 0.1, 0.1, 0.2])
@@ -65,8 +66,9 @@ def CaloRingsAsymPhotonBuilderCfg(flags, name="CaloRingsAsymBuilder", **kwargs):
kwargs.setdefault('CellsContainerName', flags.Egamma.Keys.Input.CaloCells)
kwargs.setdefault('CaloRingsContainerName', 'PhotonCaloAsymRings')
kwargs.setdefault('RingSetContainerName', 'PhotonAsymRingSets')
kwargs.setdefault('MinPartEnergy', 15*GeV)
tool = CompFactory.Ringer.CaloRingsAsymBuilder(name, **kwargs)
kwargs.setdefault('MinPartEnergy', flags.Egamma.CaloRinger.minPhotonEnergy*GeV)
tool = CompFactory.Ringer.CaloAsymRingsBuilder(name, **kwargs)
return tool
@@ -94,9 +96,9 @@ def CaloRingsElectronBuilderCfg(flags, name="CaloRingsElectronBuilder", **kwargs
kwargs.setdefault('CellsContainerName', flags.Egamma.Keys.Input.CaloCells)
kwargs.setdefault('CaloRingsContainerName', 'ElectronCaloRings')
kwargs.setdefault('RingSetContainerName', 'ElectronRingSets')
kwargs.setdefault('MinPartEnergy', 14*GeV)
kwargs.setdefault('MinPartEnergy', flags.Egamma.CaloRinger.minElectronEnergy*GeV)
tool = CompFactory.Ringer.CaloRingsBuilder(name, **kwargs)
return tool
@@ -124,15 +126,19 @@ def CaloRingsPhotonBuilderCfg(flags, name="CaloRingsPhotonBuilder", **kwargs):
kwargs.setdefault('CellsContainerName', flags.Egamma.Keys.Input.CaloCells)
kwargs.setdefault('CaloRingsContainerName', 'PhotonCaloRings')
kwargs.setdefault('RingSetContainerName', 'PhotonRingSets')
kwargs.setdefault('MinPartEnergy', 15*GeV)
kwargs.setdefault('MinPartEnergy', flags.Egamma.CaloRinger.minPhotonEnergy*GeV)
tool = CompFactory.Ringer.CaloRingsBuilder(name, **kwargs)
return tool
def CaloRingerElectronsInputReaderCfg(flags, name="CaloRingerElectronsReader", **kwargs):
builderTool = CaloRingsElectronBuilderCfg(flags)
if 'Asym' in name:
builderTool = CaloRingsAsymElectronBuilderCfg(flags)
else:
builderTool = CaloRingsElectronBuilderCfg(flags)
kwargs.setdefault('crBuilder', builderTool)
kwargs.setdefault('inputKey', flags.Egamma.Keys.Output.Electrons)
kwargs.setdefault('builderAvailable', True)
@@ -145,8 +151,11 @@ def CaloRingerElectronsInputReaderCfg(flags, name="CaloRingerElectronsReader", *
def CaloRingerPhotonsInputReaderCfg(flags,
name="CaloRingerPhotonsReader",
**kwargs):
if 'Asym' in name:
builderTool = CaloRingsAsymPhotonBuilderCfg(flags)
else:
builderTool = CaloRingsPhotonBuilderCfg(flags)
builderTool = CaloRingsPhotonBuilderCfg(flags)
kwargs.setdefault('crBuilder', builderTool)
kwargs.setdefault('inputKey', flags.Egamma.Keys.Output.Photons)
kwargs.setdefault('builderAvailable', True)
@@ -156,48 +165,95 @@ def CaloRingerPhotonsInputReaderCfg(flags,
return inputReaderTool, builderTool
def caloRingerOutputList(flags,name="CaloRingerOutputList"):
toOuput = []
if flags.Egamma.CaloRinger.buildElectronRings:
toOuput +=[ 'xAOD::RingSetContainer#ElectronRingSets',
'xAOD::RingSetAuxContainer#ElectronRingSetsAux.',
'xAOD::CaloRingsContainer#ElectronCaloRings',
'xAOD::CaloRingsAuxContainer#ElectronCaloRingsAux.',
]
if flags.Egamma.CaloRinger.buildElectronAsymRings:
toOuput +=[ 'xAOD::RingSetContainer#ElectronAsymRingSets',
'xAOD::RingSetAuxContainer#ElectronAsymRingSetsAux.',
'xAOD::CaloRingsContainer#ElectronCaloAsymRings',
'xAOD::CaloRingsAuxContainer#ElectronCaloAsymRingsAux.',
]
if flags.Egamma.CaloRinger.buildPhotonRings:
toOuput += [
'xAOD::RingSetContainer#PhotonRingSets',
'xAOD::RingSetAuxContainer#PhotonRingSetsAux.',
'xAOD::CaloRingsContainer#PhotonCaloRings',
'xAOD::CaloRingsAuxContainer#PhotonCaloRingsAux.'
]
if flags.Egamma.CaloRinger.buildPhotonAsymRings:
toOuput +=[
'xAOD::RingSetContainer#PhotonAsymRingSets',
'xAOD::RingSetAuxContainer#PhotonAsymRingSetsAux.',
'xAOD::CaloRingsContainer#PhotonCaloAsymRings',
'xAOD::CaloRingsAuxContainer#PhotonCaloAsymRingsAux.',
]
if not toOuput:
toOuput +=[
'xAOD::RingSetContainer#PhotonRingSets',
'xAOD::RingSetAuxContainer#PhotonRingSetsAux.',
'xAOD::CaloRingsContainer#PhotonCaloRings',
'xAOD::CaloRingsAuxContainer#PhotonCaloRingsAux.'
]
return toOuput
def CaloRingerOutputCfg(flags, name="CaloRingerOutput"):
"""Configure the CaloRingerOutput."""
from OutputStreamAthenaPool.OutputStreamConfig import addToAOD, addToESD
toOuput = caloRingerOutputList(flags)
acc = ComponentAccumulator()
# For now keep it like Run-2 Electron only
toOuput = ['xAOD::RingSetContainer#ElectronRingSets',
'xAOD::RingSetAuxContainer#ElectronRingSetsAux.',
'xAOD::CaloRingsContainer#ElectronCaloRings',
'xAOD::CaloRingsAuxContainer#ElectronCaloRingsAux.',
# 'xAOD::RingSetContainer#PhotonRingSets',
# 'xAOD::RingSetAuxContainer#PhotonRingSetsAux.',
# 'xAOD::CaloRingsContainer#PhotonCaloRings',
# 'xAOD::CaloRingsAuxContainer#PhotonCaloRingsAux.'
]
if flags.Output.doWriteAOD:
acc.merge(addToAOD(flags, toOuput))
if flags.Output.doWriteESD:
acc.merge(addToESD(flags, toOuput))
return acc
def CaloRingerAlgsCfg(flags, name="CaloRingerAlgorithm", **kwargs):
"""Configure the CaloRingerAlgs."""
acc = ComponentAccumulator()
electronInputReaderTool, electronBuilderTool = CaloRingerElectronsInputReaderCfg(
flags)
photonInputReaderTool, photonBuilderTool = CaloRingerPhotonsInputReaderCfg(
flags)
# For now keep it like Run-2 Electron only
acc.addPublicTool(electronInputReaderTool)
# acc.addPublicTool(photonInputReaderTool)
acc.addPublicTool(electronBuilderTool)
# acc.addPublicTool(photonBuilderTool)
kwargs.setdefault('inputReaderTools', [
electronInputReaderTool,
# photonInputReaderTool
])
CaloRingerAlgorithm = CompFactory.Ringer.CaloRingerAlgorithm(
name, **kwargs)
readerTools = []
if flags.Egamma.CaloRinger.buildElectronRings:
electronInputReaderTool, electronBuilderTool = CaloRingerElectronsInputReaderCfg(flags)
readerTools.append(electronInputReaderTool)
acc.addPublicTool(electronBuilderTool)
acc.addPublicTool(electronInputReaderTool)
if flags.Egamma.CaloRinger.buildElectronAsymRings:
electronInputReaderTool, electronBuilderTool = CaloRingerElectronsInputReaderCfg(flags, name='CaloAsymRingerElectronsReader')
readerTools.append(electronInputReaderTool)
acc.addPublicTool(electronBuilderTool)
acc.addPublicTool(electronInputReaderTool)
if flags.Egamma.CaloRinger.buildPhotonRings:
photonInputReaderTool, photonBuilderTool = CaloRingerPhotonsInputReaderCfg(flags)
readerTools.append(photonInputReaderTool)
acc.addPublicTool(photonBuilderTool)
acc.addPublicTool(photonInputReaderTool)
if flags.Egamma.CaloRinger.buildPhotonAsymRings:
photonInputReaderTool, photonBuilderTool = CaloRingerPhotonsInputReaderCfg(flags, name='CaloAsymRingerPhotonReader')
readerTools.append(photonInputReaderTool)
acc.addPublicTool(photonBuilderTool)
acc.addPublicTool(photonInputReaderTool)
kwargs.setdefault('inputReaderTools', readerTools)
CaloRingerAlgorithm = CompFactory.Ringer.CaloRingerAlgorithm(name, **kwargs)
acc.addEventAlgo(CaloRingerAlgorithm)
return acc
Loading