Commit fd398379 authored by Christos Anastopoulos's avatar Christos Anastopoulos Committed by Vakhtang Tsulaia
Browse files

Egamma config smarter flags add egamma track slimmer

parent 579ff66e
......@@ -21,7 +21,8 @@ egammaLargeClusterMakerAlg = AlgFactory(
SaveUncalibratedSignalState=False,
ClustersOutputName=egammaKeys.EgammaLargeClustersKey(),
ClusterMakerTools=FcnWrapper(clusMakerTools),
ClusterCorrectionTools=make_CaloSwCorrections("ele7_11",
suffix="Nocorr",
version="none",
cells_name=egammaKeys.caloCellKey()))
ClusterCorrectionTools=make_CaloSwCorrections(
"ele7_11",
suffix="Nocorr",
version="none",
cells_name=egammaKeys.caloCellKey()))
......@@ -9,7 +9,8 @@ from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
from AthenaConfiguration.ComponentFactory import CompFactory
from egammaTools.egammaLargeClusterMakerConfig import (
egammaLargeClusterMakerCfg)
from CaloClusterCorrection.CaloSwCorrections import make_CaloSwCorrections
from CaloClusterCorrection.CaloSwCorrections import (
make_CaloSwCorrectionsCfg)
def egammaLargeClusterMakerAlgCfg(
......@@ -17,24 +18,24 @@ def egammaLargeClusterMakerAlgCfg(
name="egammaLargeClusterMaker",
**kwargs):
acc = ComponentAccumulator
acc = ComponentAccumulator()
kwargs.setdefault("SaveUncalibratedSignalState", False)
kwargs.setdefault("ClustersOutputName",
flags.Egamma.Keys.Output.EgammaLargeClusters)
if "ClusterMakerTools" not in kwargs:
toolAcc = egammaLargeClusterMakerCfg(flags)
kwargs["ClusterMakerTools"] = [toolAcc.popPrivateTools()]
acc.merge(toolAcc)
tool = egammaLargeClusterMakerCfg(flags)
kwargs["ClusterMakerTools"] = [acc.popToolsAndMerge(tool)]
kwargs.setdefault(
"ClusterCorrectionTools",
make_CaloSwCorrections(
if "ClusterCorrectionTools" not in kwargs:
tools = make_CaloSwCorrectionsCfg(
flags,
"ele7_11",
suffix="Nocorr",
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))
return acc
......@@ -8,15 +8,16 @@ from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
from AthenaConfiguration.ComponentFactory import CompFactory
from egammaTools.egammaLargeFWDClusterMakerConfig import (
egammaLargeFWDClusterMakerCfg)
from CaloClusterCorrection.CaloSwCorrections import make_CaloSwCorrections
from CaloClusterCorrection.CaloSwCorrections import (
make_CaloSwCorrectionsCfg)
def egammaLargeFWDClusterMakerAlgCfg(
flags,
name="egammaLargeClusterMaker",
name="egammaLargeFWDClusterMaker",
**kwargs):
acc = ComponentAccumulator
acc = ComponentAccumulator()
kwargs.setdefault("SaveUncalibratedSignalState", False)
kwargs.setdefault("ClustersOutputName",
......@@ -27,13 +28,14 @@ def egammaLargeFWDClusterMakerAlgCfg(
kwargs["ClusterMakerTools"] = [toolAcc.popPrivateTools()]
acc.merge(toolAcc)
kwargs.setdefault(
"ClusterCorrectionTools",
make_CaloSwCorrections(
if "ClusterCorrectionTools" not in kwargs:
tools = make_CaloSwCorrectionsCfg(
flags,
"FWDele6_6",
suffix="Nocorr",
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))
return acc
......@@ -17,30 +17,13 @@ def EGammaReconstructionCfg(flags, name="EGammaReconstruction"):
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 flags.Egamma.enabled:
return acc
# Add algorithms
# Add e/gamma tracking algorithms
if flags.Egamma.doGSF:
from egammaAlgs.egammaSelectedTrackCopyConfig import (
egammaSelectedTrackCopyCfg)
acc.merge(egammaSelectedTrackCopyCfg(flags))
......@@ -53,30 +36,55 @@ def EGammaReconstructionCfg(flags, name="EGammaReconstruction"):
EMGSFCaloExtensionBuilderCfg)
acc.merge(EMGSFCaloExtensionBuilderCfg(flags))
# Add e/gamma conversion finding
if flags.Egamma.doConversionBuilding:
from egammaAlgs.EMVertexBuilderConfig import EMVertexBuilderCfg
from egammaAlgs.EMVertexBuilderConfig import (
EMVertexBuilderCfg)
acc.merge(EMVertexBuilderCfg(flags))
# Add calo seeded central algorithms
if flags.Egamma.doCaloSeeded:
from egammaAlgs.egammaRecBuilderConfig import egammaRecBuilderCfg
from egammaAlgs.egammaRecBuilderConfig import (
egammaRecBuilderCfg)
acc.merge(egammaRecBuilderCfg(flags))
from egammaAlgs.egammaSuperClusterBuilderConfig import (
electronSuperClusterBuilderCfg, photonSuperClusterBuilderCfg)
acc.merge(electronSuperClusterBuilderCfg(flags))
acc.merge(photonSuperClusterBuilderCfg(flags))
from egammaAlgs.topoEgammaBuilderConfig import topoEgammaBuilderCfg
from egammaAlgs.topoEgammaBuilderConfig import (
topoEgammaBuilderCfg)
acc.merge(topoEgammaBuilderCfg(flags))
from egammaAlgs.egammaLargeClusterMakerAlgConfig import (
egammaLargeClusterMakerAlgCfg)
acc.merge(egammaLargeClusterMakerAlgCfg(flags))
# Add calo seeded forward algorithms
if flags.Egamma.doForwardSeeded:
from egammaAlgs.egammaForwardBuilderConfig import (
egammaForwardBuilderCfg)
acc.merge(egammaForwardBuilderCfg(flags))
# Add truth association
if flags.Egamma.doTruthAssociation:
from egammaAlgs.egammaTruthAssociationConfig import (
egammaTruthAssociationCfg)
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")
return acc
......@@ -89,6 +97,7 @@ if __name__ == "__main__":
from AthenaConfiguration.TestDefaults import defaultTestFiles
from AthenaConfiguration.MainServicesConfig import MainServicesCfg
flags.Input.Files = defaultTestFiles.RDO
flags.Output.doWriteAOD = True # To test the AOD parts
acc = MainServicesCfg(flags)
acc.merge(EGammaReconstructionCfg(flags))
......
......@@ -13,19 +13,27 @@ def createEgammaConfigFlags():
egcf.addFlag("Egamma.enabled", True)
# do standard cluster-based egamma algorithm
egcf.addFlag("Egamma.doCaloSeeded", True)
egcf.addFlag("Egamma.doCaloSeeded",
lambda prevFlags: prevFlags.Detector.EnableCalo)
# 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
egcf.addFlag("Egamma.doTruthAssociation", True)
egcf.addFlag("Egamma.doTruthAssociation",
lambda prevFlags: prevFlags.Input.isMC)
# run the GSF refitting
egcf.addFlag("Egamma.doGSF", True)
# run the GSF refitting /egamma Tracking
egcf.addFlag("Egamma.doGSF", lambda prevFlags: prevFlags.Detector.EnableID)
# build conversion vertices
egcf.addFlag("Egamma.doConversionBuilding", True)
# build photon conversion vertices
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
egcf.addFlag("Egamma.Calib.ClusterCorrectionVersion",
......
......@@ -16,7 +16,8 @@ def egammaLargeClusterMakerCfg(flags, name="egammaLCMakerTool", **kwargs):
kwargs.setdefault("CellsName", flags.Egamma.Keys.Input.CaloCells)
kwargs.setdefault("InputClusterCollection",
flags.Egamma.Keys.Output.CaloClusters)
kwargs.setdefault("InputClusterCollection",
flags.Egamma.Keys.Output.CaloClusters)
acc.setPrivateTools(CompFactory.egammaLargeClusterMaker(name, **kwargs))
return acc
......
......@@ -8,15 +8,18 @@ from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
from AthenaConfiguration.ComponentFactory import CompFactory
def egammaLargeFWDClusterMakerCfg(flags, **kwargs):
def egammaLargeFWDClusterMakerCfg(
flags,
name="egammaFWDLCMakerTool",
**kwargs):
acc = ComponentAccumulator()
kwargs.setdefault("CellsName", flags.Egamma.Keys.Input.CaloCells)
kwargs.setdefault("InputClusterCollection",
flags.Egamma.Keys.Output.FwdCluster)
flags.Egamma.Keys.Output.ForwardClusters)
kwargs.setdefault("doFWDelesurraundingWindows", True)
acc.setPrivateTools(CompFactory.egammaLargeFWDClusterMaker(**kwargs))
acc.setPrivateTools(CompFactory.egammaLargeClusterMaker(name, **kwargs))
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