Commit b076148e authored by Vakhtang Tsulaia's avatar Vakhtang Tsulaia
Browse files

Merge branch 'egammaConfig_smarterflags_egammaTrackSlimmer' into 'master'

Egamma config smarter flags add egamma track slimmer

See merge request atlas/athena!47520
parents cf60403b fd398379
...@@ -21,7 +21,8 @@ egammaLargeClusterMakerAlg = AlgFactory( ...@@ -21,7 +21,8 @@ egammaLargeClusterMakerAlg = AlgFactory(
SaveUncalibratedSignalState=False, SaveUncalibratedSignalState=False,
ClustersOutputName=egammaKeys.EgammaLargeClustersKey(), ClustersOutputName=egammaKeys.EgammaLargeClustersKey(),
ClusterMakerTools=FcnWrapper(clusMakerTools), ClusterMakerTools=FcnWrapper(clusMakerTools),
ClusterCorrectionTools=make_CaloSwCorrections("ele7_11", ClusterCorrectionTools=make_CaloSwCorrections(
suffix="Nocorr", "ele7_11",
version="none", suffix="Nocorr",
cells_name=egammaKeys.caloCellKey())) version="none",
cells_name=egammaKeys.caloCellKey()))
...@@ -9,7 +9,8 @@ from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator ...@@ -9,7 +9,8 @@ from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
from AthenaConfiguration.ComponentFactory import CompFactory from AthenaConfiguration.ComponentFactory import CompFactory
from egammaTools.egammaLargeClusterMakerConfig import ( from egammaTools.egammaLargeClusterMakerConfig import (
egammaLargeClusterMakerCfg) egammaLargeClusterMakerCfg)
from CaloClusterCorrection.CaloSwCorrections import make_CaloSwCorrections from CaloClusterCorrection.CaloSwCorrections import (
make_CaloSwCorrectionsCfg)
def egammaLargeClusterMakerAlgCfg( def egammaLargeClusterMakerAlgCfg(
...@@ -17,24 +18,24 @@ def egammaLargeClusterMakerAlgCfg( ...@@ -17,24 +18,24 @@ def egammaLargeClusterMakerAlgCfg(
name="egammaLargeClusterMaker", name="egammaLargeClusterMaker",
**kwargs): **kwargs):
acc = ComponentAccumulator acc = ComponentAccumulator()
kwargs.setdefault("SaveUncalibratedSignalState", False) kwargs.setdefault("SaveUncalibratedSignalState", False)
kwargs.setdefault("ClustersOutputName", kwargs.setdefault("ClustersOutputName",
flags.Egamma.Keys.Output.EgammaLargeClusters) flags.Egamma.Keys.Output.EgammaLargeClusters)
if "ClusterMakerTools" not in kwargs: if "ClusterMakerTools" not in kwargs:
toolAcc = egammaLargeClusterMakerCfg(flags) tool = egammaLargeClusterMakerCfg(flags)
kwargs["ClusterMakerTools"] = [toolAcc.popPrivateTools()] kwargs["ClusterMakerTools"] = [acc.popToolsAndMerge(tool)]
acc.merge(toolAcc)
kwargs.setdefault( if "ClusterCorrectionTools" not in kwargs:
"ClusterCorrectionTools", tools = make_CaloSwCorrectionsCfg(
make_CaloSwCorrections( flags,
"ele7_11", "ele7_11",
suffix="Nocorr", suffix="Nocorr",
version="none", version="none",
cells_name=flags.Egamma.Keys.Input.CaloCells)) cells_name=flags.Egamma.Keys.Input.CaloCells)
kwargs["ClusterCorrectionTools"] = acc.popToolsAndMerge(tools)
acc.addEventAlgo(CompFactory.CaloClusterMaker(name, **kwargs)) acc.addEventAlgo(CompFactory.CaloClusterMaker(name, **kwargs))
return acc return acc
...@@ -8,15 +8,16 @@ from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator ...@@ -8,15 +8,16 @@ from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
from AthenaConfiguration.ComponentFactory import CompFactory from AthenaConfiguration.ComponentFactory import CompFactory
from egammaTools.egammaLargeFWDClusterMakerConfig import ( from egammaTools.egammaLargeFWDClusterMakerConfig import (
egammaLargeFWDClusterMakerCfg) egammaLargeFWDClusterMakerCfg)
from CaloClusterCorrection.CaloSwCorrections import make_CaloSwCorrections from CaloClusterCorrection.CaloSwCorrections import (
make_CaloSwCorrectionsCfg)
def egammaLargeFWDClusterMakerAlgCfg( def egammaLargeFWDClusterMakerAlgCfg(
flags, flags,
name="egammaLargeClusterMaker", name="egammaLargeFWDClusterMaker",
**kwargs): **kwargs):
acc = ComponentAccumulator acc = ComponentAccumulator()
kwargs.setdefault("SaveUncalibratedSignalState", False) kwargs.setdefault("SaveUncalibratedSignalState", False)
kwargs.setdefault("ClustersOutputName", kwargs.setdefault("ClustersOutputName",
...@@ -27,13 +28,14 @@ def egammaLargeFWDClusterMakerAlgCfg( ...@@ -27,13 +28,14 @@ def egammaLargeFWDClusterMakerAlgCfg(
kwargs["ClusterMakerTools"] = [toolAcc.popPrivateTools()] kwargs["ClusterMakerTools"] = [toolAcc.popPrivateTools()]
acc.merge(toolAcc) acc.merge(toolAcc)
kwargs.setdefault( if "ClusterCorrectionTools" not in kwargs:
"ClusterCorrectionTools", tools = make_CaloSwCorrectionsCfg(
make_CaloSwCorrections( flags,
"FWDele6_6", "FWDele6_6",
suffix="Nocorr", suffix="Nocorr",
version="none", version="none",
cells_name=flags.Egamma.Keys.Input.CaloCells)) cells_name=flags.Egamma.Keys.Input.CaloCells)
kwargs["ClusterCorrectionTools"] = acc.popToolsAndMerge(tools)
acc.addEventAlgo(CompFactory.CaloClusterMaker(name, **kwargs)) acc.addEventAlgo(CompFactory.CaloClusterMaker(name, **kwargs))
return acc return acc
...@@ -17,30 +17,13 @@ def EGammaReconstructionCfg(flags, name="EGammaReconstruction"): ...@@ -17,30 +17,13 @@ def EGammaReconstructionCfg(flags, name="EGammaReconstruction"):
acc = ComponentAccumulator() acc = ComponentAccumulator()
# Depending on what is availabe we might want
# to disable certain things
# without calo no egamma
if not flags.Detector.EnableCalo:
flags.Egamma.enabled = False
flags.Egamma.doCaloSeeded = False
flags.Egamma.doForwardSeeded = False
# Tracking
if not flags.Detector.EnableID:
flags.Egamma.doGSF = False
flags.Egamma.doConversionBuilding = False
# MC Truth
if not flags.Input.isMC:
flags.Egamma.doTruthAssociation = False
# if not enabled add nothing # if not enabled add nothing
if not flags.Egamma.enabled: if not flags.Egamma.enabled:
return acc return acc
# Add algorithms # Add e/gamma tracking algorithms
if flags.Egamma.doGSF: if flags.Egamma.doGSF:
from egammaAlgs.egammaSelectedTrackCopyConfig import ( from egammaAlgs.egammaSelectedTrackCopyConfig import (
egammaSelectedTrackCopyCfg) egammaSelectedTrackCopyCfg)
acc.merge(egammaSelectedTrackCopyCfg(flags)) acc.merge(egammaSelectedTrackCopyCfg(flags))
...@@ -53,30 +36,55 @@ def EGammaReconstructionCfg(flags, name="EGammaReconstruction"): ...@@ -53,30 +36,55 @@ def EGammaReconstructionCfg(flags, name="EGammaReconstruction"):
EMGSFCaloExtensionBuilderCfg) EMGSFCaloExtensionBuilderCfg)
acc.merge(EMGSFCaloExtensionBuilderCfg(flags)) acc.merge(EMGSFCaloExtensionBuilderCfg(flags))
# Add e/gamma conversion finding
if flags.Egamma.doConversionBuilding: if flags.Egamma.doConversionBuilding:
from egammaAlgs.EMVertexBuilderConfig import EMVertexBuilderCfg
from egammaAlgs.EMVertexBuilderConfig import (
EMVertexBuilderCfg)
acc.merge(EMVertexBuilderCfg(flags)) acc.merge(EMVertexBuilderCfg(flags))
# Add calo seeded central algorithms
if flags.Egamma.doCaloSeeded: if flags.Egamma.doCaloSeeded:
from egammaAlgs.egammaRecBuilderConfig import egammaRecBuilderCfg
from egammaAlgs.egammaRecBuilderConfig import (
egammaRecBuilderCfg)
acc.merge(egammaRecBuilderCfg(flags)) acc.merge(egammaRecBuilderCfg(flags))
from egammaAlgs.egammaSuperClusterBuilderConfig import ( from egammaAlgs.egammaSuperClusterBuilderConfig import (
electronSuperClusterBuilderCfg, photonSuperClusterBuilderCfg) electronSuperClusterBuilderCfg, photonSuperClusterBuilderCfg)
acc.merge(electronSuperClusterBuilderCfg(flags)) acc.merge(electronSuperClusterBuilderCfg(flags))
acc.merge(photonSuperClusterBuilderCfg(flags)) acc.merge(photonSuperClusterBuilderCfg(flags))
from egammaAlgs.topoEgammaBuilderConfig import topoEgammaBuilderCfg
from egammaAlgs.topoEgammaBuilderConfig import (
topoEgammaBuilderCfg)
acc.merge(topoEgammaBuilderCfg(flags)) acc.merge(topoEgammaBuilderCfg(flags))
from egammaAlgs.egammaLargeClusterMakerAlgConfig import (
egammaLargeClusterMakerAlgCfg)
acc.merge(egammaLargeClusterMakerAlgCfg(flags))
# Add calo seeded forward algorithms
if flags.Egamma.doForwardSeeded: if flags.Egamma.doForwardSeeded:
from egammaAlgs.egammaForwardBuilderConfig import ( from egammaAlgs.egammaForwardBuilderConfig import (
egammaForwardBuilderCfg) egammaForwardBuilderCfg)
acc.merge(egammaForwardBuilderCfg(flags)) acc.merge(egammaForwardBuilderCfg(flags))
# Add truth association
if flags.Egamma.doTruthAssociation: if flags.Egamma.doTruthAssociation:
from egammaAlgs.egammaTruthAssociationConfig import ( from egammaAlgs.egammaTruthAssociationConfig import (
egammaTruthAssociationCfg) egammaTruthAssociationCfg)
acc.merge(egammaTruthAssociationCfg(flags)) acc.merge(egammaTruthAssociationCfg(flags))
# Add e/gamma track thinning
# (although we call the Alg slimming)
if flags.Egamma.doTrackThinning:
from egammaAlgs.egammaTrackSlimmerConfig import (
egammaTrackSlimmerCfg)
acc.merge(egammaTrackSlimmerCfg(flags))
mlog.info("EGamma reconstruction configured") mlog.info("EGamma reconstruction configured")
return acc return acc
...@@ -89,6 +97,7 @@ if __name__ == "__main__": ...@@ -89,6 +97,7 @@ if __name__ == "__main__":
from AthenaConfiguration.TestDefaults import defaultTestFiles from AthenaConfiguration.TestDefaults import defaultTestFiles
from AthenaConfiguration.MainServicesConfig import MainServicesCfg from AthenaConfiguration.MainServicesConfig import MainServicesCfg
flags.Input.Files = defaultTestFiles.RDO flags.Input.Files = defaultTestFiles.RDO
flags.Output.doWriteAOD = True # To test the AOD parts
acc = MainServicesCfg(flags) acc = MainServicesCfg(flags)
acc.merge(EGammaReconstructionCfg(flags)) acc.merge(EGammaReconstructionCfg(flags))
......
...@@ -13,19 +13,27 @@ def createEgammaConfigFlags(): ...@@ -13,19 +13,27 @@ def createEgammaConfigFlags():
egcf.addFlag("Egamma.enabled", True) egcf.addFlag("Egamma.enabled", True)
# do standard cluster-based egamma algorithm # do standard cluster-based egamma algorithm
egcf.addFlag("Egamma.doCaloSeeded", True) egcf.addFlag("Egamma.doCaloSeeded",
lambda prevFlags: prevFlags.Detector.EnableCalo)
# do forward egamma # do forward egamma
egcf.addFlag("Egamma.doForwardSeeded", True) egcf.addFlag("Egamma.doForwardSeeded",
lambda prevFlags: prevFlags.Detector.EnableCalo)
# do egamma truth association when running on MC # do egamma truth association when running on MC
egcf.addFlag("Egamma.doTruthAssociation", True) egcf.addFlag("Egamma.doTruthAssociation",
lambda prevFlags: prevFlags.Input.isMC)
# run the GSF refitting # run the GSF refitting /egamma Tracking
egcf.addFlag("Egamma.doGSF", True) egcf.addFlag("Egamma.doGSF", lambda prevFlags: prevFlags.Detector.EnableID)
# build conversion vertices # build photon conversion vertices
egcf.addFlag("Egamma.doConversionBuilding", True) egcf.addFlag("Egamma.doConversionBuilding",
lambda prevFlags: prevFlags.Detector.EnableID)
# Do e/gamma track thinning (Although we call the alg slimming...)
egcf.addFlag("Egamma.doTrackThinning",
lambda prevFlags: prevFlags.Output.doWriteAOD)
# The cluster corrections/calib # The cluster corrections/calib
egcf.addFlag("Egamma.Calib.ClusterCorrectionVersion", egcf.addFlag("Egamma.Calib.ClusterCorrectionVersion",
......
...@@ -16,7 +16,8 @@ def egammaLargeClusterMakerCfg(flags, name="egammaLCMakerTool", **kwargs): ...@@ -16,7 +16,8 @@ def egammaLargeClusterMakerCfg(flags, name="egammaLCMakerTool", **kwargs):
kwargs.setdefault("CellsName", flags.Egamma.Keys.Input.CaloCells) kwargs.setdefault("CellsName", flags.Egamma.Keys.Input.CaloCells)
kwargs.setdefault("InputClusterCollection", kwargs.setdefault("InputClusterCollection",
flags.Egamma.Keys.Output.CaloClusters) flags.Egamma.Keys.Output.CaloClusters)
kwargs.setdefault("InputClusterCollection",
flags.Egamma.Keys.Output.CaloClusters)
acc.setPrivateTools(CompFactory.egammaLargeClusterMaker(name, **kwargs)) acc.setPrivateTools(CompFactory.egammaLargeClusterMaker(name, **kwargs))
return acc return acc
......
...@@ -8,15 +8,18 @@ from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator ...@@ -8,15 +8,18 @@ from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
from AthenaConfiguration.ComponentFactory import CompFactory from AthenaConfiguration.ComponentFactory import CompFactory
def egammaLargeFWDClusterMakerCfg(flags, **kwargs): def egammaLargeFWDClusterMakerCfg(
flags,
name="egammaFWDLCMakerTool",
**kwargs):
acc = ComponentAccumulator() acc = ComponentAccumulator()
kwargs.setdefault("CellsName", flags.Egamma.Keys.Input.CaloCells) kwargs.setdefault("CellsName", flags.Egamma.Keys.Input.CaloCells)
kwargs.setdefault("InputClusterCollection", kwargs.setdefault("InputClusterCollection",
flags.Egamma.Keys.Output.FwdCluster) flags.Egamma.Keys.Output.ForwardClusters)
kwargs.setdefault("doFWDelesurraundingWindows", True) kwargs.setdefault("doFWDelesurraundingWindows", True)
acc.setPrivateTools(CompFactory.egammaLargeFWDClusterMaker(**kwargs)) acc.setPrivateTools(CompFactory.egammaLargeClusterMaker(name, **kwargs))
return acc return acc
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment