Commit 1a3873e3 authored by Christos Anastopoulos's avatar Christos Anastopoulos
Browse files

Add test for the new config of egamma Algs

parent 5e798af6
......@@ -7,8 +7,8 @@ atlas_subdir( egammaAlgs )
atlas_add_component( egammaAlgs
src/*.cxx
src/components/*.cxx
INCLUDE_DIRS
src/components/*.cxx
INCLUDE_DIRS
LINK_LIBRARIES AthenaBaseComps EventKernel xAODCaloEvent xAODEgamma xAODTruth GaudiKernel
MCTruthClassifierLib CaloGeoHelpers CaloUtilsLib CaloDetDescrLib AthenaKernel StoreGateLib
xAODTracking InDetReadoutGeometry EgammaAnalysisInterfacesLib egammaRecEvent egammaUtils
......@@ -20,4 +20,28 @@ atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} )
atlas_add_test( EMVertexBuilderConfig_test
SCRIPT python -m egammaAlgs.EMVertexBuilderConfig
POST_EXEC_SCRIPT nopost.sh)
\ No newline at end of file
POST_EXEC_SCRIPT nopost.sh)
atlas_add_test( EMBremCollectionBuilderConfig_test
SCRIPT python -m egammaAlgs.EMBremCollectionBuilderConfig
POST_EXEC_SCRIPT nopost.sh)
atlas_add_test( egammaRecBuilderConfig_test
SCRIPT python -m egammaAlgs.egammaRecBuilderConfig
POST_EXEC_SCRIPT nopost.sh)
atlas_add_test( EMGSFCaloExtensionBuilderConfig_test
SCRIPT python -m egammaAlgs.EMGSFCaloExtensionBuilderConfig
POST_EXEC_SCRIPT nopost.sh)
atlas_add_test( egammaSelectedTrackCopyConfig_test
SCRIPT python -m egammaAlgs.egammaSelectedTrackCopyConfig
POST_EXEC_SCRIPT nopost.sh)
atlas_add_test( egammaTopoClusterCopierConfig_test
SCRIPT python -m egammaAlgs.egammaTopoClusterCopierConfig
POST_EXEC_SCRIPT nopost.sh)
atlas_add_test( egammaTrackSlimmerConfig_test
SCRIPT python -m egammaAlgs.egammaTrackSlimmerConfig
POST_EXEC_SCRIPT nopost.sh)
......@@ -2,36 +2,64 @@
from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
from AthenaConfiguration.ComponentFactory import CompFactory
from AthenaCommon.Logging import logging
def EMBremCollectionBuilderCfg(flags,
name="EMBremCollectionBuilder",
**kwargs):
def EMBremCollectionBuilderCfg(flags,
name="EMBremCollectionBuilder",
**kwargs):
acc = ComponentAccumulator()
# FIXME runtime testing required this, but since this is not a direct dependency it should be added elsewhere, but I do not know where yet
# FIXME runtime testing required this, but since this is not a
# direct dependency it should be added elsewhere, but I do not know where yet
if not flags.Input.isMC:
from LumiBlockComps.LumiBlockMuWriterConfig import LumiBlockMuWriterCfg
from LumiBlockComps.LumiBlockMuWriterConfig import LumiBlockMuWriterCfg
acc.merge(LumiBlockMuWriterCfg(flags))
if "TrackRefitTool" not in kwargs:
from egammaTrackTools.egammaTrackToolsConfig import egammaTrkRefitterToolCfg
kwargs["TrackRefitTool"] = acc.popToolsAndMerge( egammaTrkRefitterToolCfg(flags) )
kwargs["TrackRefitTool"] = acc.popToolsAndMerge(
egammaTrkRefitterToolCfg(flags))
if "TrackParticleCreatorTool" not in kwargs:
from InDetConfig.TrackRecoConfig import TrackParticleCreatorToolCfg
kwargs["TrackParticleCreatorTool"] = acc.getPrimaryAndMerge(TrackParticleCreatorToolCfg(flags, name="GSFBuildInDetParticleCreatorTool", BadClusterID = 3))
kwargs["TrackParticleCreatorTool"] = acc.getPrimaryAndMerge(TrackParticleCreatorToolCfg(
flags, name="GSFBuildInDetParticleCreatorTool", BadClusterID=3))
if "TrackSlimmingTool" not in kwargs:
slimmingTool = CompFactory.Trk.TrackSlimmingTool(name="GSFBuildInDetTrackSlimmingTool", KeepOutliers=True)
slimmingTool = CompFactory.Trk.TrackSlimmingTool(
name="GSFBuildInDetTrackSlimmingTool", KeepOutliers=True)
kwargs["TrackSlimmingTool"] = slimmingTool
if "TrackSummaryTool" not in kwargs:
from egammaTrackTools.egammaTrackToolsConfig import GSFTrackSummaryToolCfg
kwargs["TrackSummaryTool"] = acc.popToolsAndMerge(GSFTrackSummaryToolCfg(flags))
kwargs.setdefault("usePixel", True) # TODO configure according to some doPixel, presumably flags.Detector.EnablePixel, same for src
kwargs["TrackSummaryTool"] = acc.popToolsAndMerge(
GSFTrackSummaryToolCfg(flags))
# TODO configure according to some doPixel, presumably flags.Detector.EnablePixel, same for src
kwargs.setdefault("usePixel", True)
kwargs.setdefault("useSCT", True)
alg = CompFactory.EMBremCollectionBuilder(name, **kwargs)
acc.addEventAlgo(alg)
return acc
\ No newline at end of file
return acc
if __name__ == "__main__":
from AthenaCommon.Configurable import Configurable
Configurable.configurableRun3Behavior = True
from AthenaConfiguration.AllConfigFlags import ConfigFlags as flags
from AthenaConfiguration.TestDefaults import defaultTestFiles
from AthenaConfiguration.ComponentAccumulator import printProperties
from AthenaConfiguration.MainServicesConfig import MainServicesCfg
flags.Input.Files = defaultTestFiles.RDO
acc = MainServicesCfg(flags)
acc.merge(EMBremCollectionBuilderCfg(flags))
mlog = logging.getLogger("EMBremCollectionBuilderConfigTest")
mlog.info("Configuring EMBremCollectionBuilder: ")
printProperties(mlog,
acc.getEventAlgo("EMBremCollectionBuilder"),
nestLevel=1,
printDefaults=True)
with open("embremcollectionbuilder.pkl", "wb") as f:
acc.store(f)
# Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
__doc__ = """ Instantiate the EMGSFCaloExtensionBuilder
with default configuration """
from TrackToCalo.TrackToCaloConfig import ParticleCaloExtensionToolCfg
from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
from AthenaConfiguration.ComponentFactory import CompFactory
from AthenaCommon.Logging import logging
__doc__ = """ Instantiate the EMGSFCaloExtensionBuilder
with default configuration """
EMGSFCaloExtensionBuilder = CompFactory.EMGSFCaloExtensionBuilder
......@@ -45,3 +47,24 @@ def EMGSFCaloExtensionBuilderCfg(
acc.addEventAlgo(emgscaloextfAlg)
return acc
if __name__ == "__main__":
from AthenaCommon.Configurable import Configurable
Configurable.configurableRun3Behavior = True
from AthenaConfiguration.AllConfigFlags import ConfigFlags as flags
from AthenaConfiguration.TestDefaults import defaultTestFiles
from AthenaConfiguration.ComponentAccumulator import printProperties
from AthenaConfiguration.MainServicesConfig import MainServicesCfg
flags.Input.Files = defaultTestFiles.RDO
acc = MainServicesCfg(flags)
acc.merge(EMGSFCaloExtensionBuilderCfg(flags))
mlog = logging.getLogger("EMGSFCaloExtensionBuilderConfigTest")
mlog.info("Configuring EMGSFCaloExtensionBuilder: ")
printProperties(mlog,
acc.getEventAlgo("EMGSFCaloExtensionBuilder"),
nestLevel=1,
printDefaults=True)
with open("emgsfcaloextensionbuilder.pkl", "wb") as f:
acc.store(f)
......@@ -2,6 +2,7 @@
from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
from AthenaConfiguration.ComponentFactory import CompFactory
from AthenaCommon.Logging import logging
def EMVertexBuilderCfg(flags, name="EMVertexBuilder", **kwargs):
......@@ -9,11 +10,14 @@ def EMVertexBuilderCfg(flags, name="EMVertexBuilder", **kwargs):
if "ExtrapolationTool" not in kwargs:
from egammaTrackTools.egammaTrackToolsConfig import EMExtrapolationToolsCfg
kwargs["ExtrapolationTool"] = acc.popToolsAndMerge(EMExtrapolationToolsCfg(flags))
if "VertexFinderTool" not in kwargs:
vtxFlags = flags.cloneAndReplace("InDet.SecVertex", "InDet.SecVertexEGammaPileUp" )
kwargs["ExtrapolationTool"] = acc.popToolsAndMerge(
EMExtrapolationToolsCfg(flags))
if "VertexFinderTool" not in kwargs:
vtxFlags = flags.cloneAndReplace(
"InDet.SecVertex", "InDet.SecVertexEGammaPileUp")
from InDetConfig.VertexFindingConfig import ConversionFinderCfg
kwargs["VertexFinderTool"] = acc.popToolsAndMerge( ConversionFinderCfg(vtxFlags) )
kwargs["VertexFinderTool"] = acc.popToolsAndMerge(
ConversionFinderCfg(vtxFlags))
alg = CompFactory.EMVertexBuilder(name, **kwargs)
acc.addEventAlgo(alg)
......@@ -22,13 +26,20 @@ def EMVertexBuilderCfg(flags, name="EMVertexBuilder", **kwargs):
if __name__ == "__main__":
from AthenaCommon.Configurable import Configurable
Configurable.configurableRun3Behavior=1
Configurable.configurableRun3Behavior = True
from AthenaConfiguration.AllConfigFlags import ConfigFlags as flags
from AthenaConfiguration.TestDefaults import defaultTestFiles
from AthenaConfiguration.ComponentAccumulator import printProperties
from AthenaConfiguration.MainServicesConfig import MainServicesCfg
flags.Input.Files = defaultTestFiles.RAW
flags.Input.Files = defaultTestFiles.RDO
acc = MainServicesCfg(flags)
acc.merge(EMVertexBuilderCfg(flags))
mlog = logging.getLogger("EMVertexBuilderConfigTest")
mlog.info("Configuring EMVertexBuilder: ")
printProperties(mlog,
acc.getEventAlgo("EMVertexBuilder"),
nestLevel=1,
printDefaults=True)
with open("vertexbuilder.pkl", "wb") as f:
acc.store(f)
\ No newline at end of file
......@@ -42,3 +42,24 @@ def egammaRecBuilderCfg(
acc.addEventAlgo(egrecAlg)
return acc
if __name__ == "__main__":
from AthenaCommon.Configurable import Configurable
Configurable.configurableRun3Behavior = True
from AthenaConfiguration.AllConfigFlags import ConfigFlags as flags
from AthenaConfiguration.TestDefaults import defaultTestFiles
from AthenaConfiguration.ComponentAccumulator import printProperties
from AthenaConfiguration.MainServicesConfig import MainServicesCfg
flags.Input.Files = defaultTestFiles.RDO
acc = MainServicesCfg(flags)
acc.merge(egammaRecBuilderCfg(flags))
mlog = logging.getLogger("egammaRecBuilderConfigTest")
mlog.info("Configuring egammaRecBuilder: ")
printProperties(mlog,
acc.getEventAlgo("egammaRecBuilder"),
nestLevel=1,
printDefaults=True)
with open("egammarecbuilder.pkl", "wb") as f:
acc.store(f)
......@@ -9,6 +9,7 @@ from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
egammaCaloClusterSelector = CompFactory.egammaCaloClusterSelector
egammaSelectedTrackCopy = CompFactory.egammaSelectedTrackCopy
def egammaSelectedTrackCopyCfg(
flags,
name='egammaSelectedTrackCopy',
......@@ -29,13 +30,16 @@ def egammaSelectedTrackCopyCfg(
kwargs["egammaCaloClusterSelector"] = egammaCaloClusterGSFSelector
if "ExtrapolationTool" not in kwargs:
extraptool = EMExtrapolationToolsCfg(flags, name="EMExtrapolationTools")
extraptool = EMExtrapolationToolsCfg(
flags, name="EMExtrapolationTools")
kwargs["ExtrapolationTool"] = extraptool.popPrivateTools()
acc.merge(extraptool)
if "ExtrapolationToolCommonCache" not in kwargs:
from egammaTrackTools.egammaTrackToolsConfig import EMExtrapolationToolsCacheCfg
kwargs["ExtrapolationToolCommonCache"] = acc.popToolsAndMerge(EMExtrapolationToolsCacheCfg(flags))
from egammaTrackTools.egammaTrackToolsConfig import (
EMExtrapolationToolsCacheCfg)
kwargs["ExtrapolationToolCommonCache"] = acc.popToolsAndMerge(
EMExtrapolationToolsCacheCfg(flags))
kwargs.setdefault(
"ClusterContainerName",
......@@ -48,3 +52,24 @@ def egammaSelectedTrackCopyCfg(
acc.addEventAlgo(egseltrkcpAlg)
return acc
if __name__ == "__main__":
from AthenaCommon.Configurable import Configurable
Configurable.configurableRun3Behavior = True
from AthenaConfiguration.AllConfigFlags import ConfigFlags as flags
from AthenaConfiguration.TestDefaults import defaultTestFiles
from AthenaConfiguration.ComponentAccumulator import printProperties
from AthenaConfiguration.MainServicesConfig import MainServicesCfg
flags.Input.Files = defaultTestFiles.RDO
acc = MainServicesCfg(flags)
acc.merge(egammaSelectedTrackCopyCfg(flags))
mlog = logging.getLogger("egammaSelectedTrackCopyConfigTest")
mlog.info("Configuring egammaSelectedTrackCopy: ")
printProperties(mlog,
acc.getEventAlgo("egammaSelectedTrackCopy"),
nestLevel=1,
printDefaults=True)
with open("egammaselectedtrackCopy.pkl", "wb") as f:
acc.store(f)
......@@ -34,3 +34,24 @@ def egammaTopoClusterCopierCfg(
acc.addEventAlgo(egcopierAlg)
return acc
if __name__ == "__main__":
from AthenaCommon.Configurable import Configurable
Configurable.configurableRun3Behavior = True
from AthenaConfiguration.AllConfigFlags import ConfigFlags as flags
from AthenaConfiguration.TestDefaults import defaultTestFiles
from AthenaConfiguration.ComponentAccumulator import printProperties
from AthenaConfiguration.MainServicesConfig import MainServicesCfg
flags.Input.Files = defaultTestFiles.RDO
acc = MainServicesCfg(flags)
acc.merge(egammaTopoClusterCopierCfg(flags))
mlog = logging.getLogger("egammaTopoClusterCopierConfigTest")
mlog.info("Configuring egammaTopoClusterCopier: ")
printProperties(mlog,
acc.getEventAlgo("egammaTopoClusterCopier"),
nestLevel=1,
printDefaults=True)
with open("egammatopoclustercopier.pkl", "wb") as f:
acc.store(f)
......@@ -30,3 +30,24 @@ def egammaTrackSlimmerCfg(
acc.addEventAlgo(egtrkslimmerAlg)
return acc
if __name__ == "__main__":
from AthenaCommon.Configurable import Configurable
Configurable.configurableRun3Behavior = True
from AthenaConfiguration.AllConfigFlags import ConfigFlags as flags
from AthenaConfiguration.TestDefaults import defaultTestFiles
from AthenaConfiguration.ComponentAccumulator import printProperties
from AthenaConfiguration.MainServicesConfig import MainServicesCfg
flags.Input.Files = defaultTestFiles.ESD
acc = MainServicesCfg(flags)
acc.merge(egammaTrackSlimmerCfg(flags))
mlog = logging.getLogger("egammaTrackSlimmerConfigTest")
mlog.info("Configuring egammaTrackSlimmer: ")
printProperties(mlog,
acc.getEventAlgo("egammaTrackSlimmer"),
nestLevel=1,
printDefaults=True)
with open("egammatrackslimmer.pkl", "wb") as f:
acc.store(f)
......@@ -36,6 +36,6 @@ atlas_add_test(egammaOQFlagsBuilderTest
SCRIPT python -m egammaTools.egammaOQFlagsBuilderConfig
POST_EXEC_SCRIPT nopost.sh)
atlas_add_test(egammaLargeClusterMakerTest
atlas_add_test(egammaLargeClusterMakerConfigTest
SCRIPT python -m egammaTools.egammaLargeClusterMakerConfig
POST_EXEC_SCRIPT nopost.sh)
......@@ -37,7 +37,7 @@ if __name__ == "__main__":
ConfigFlags.dump()
cfg = ComponentAccumulator()
mlog = logging.getLogger("egammaLargeClusterMakerTest")
mlog = logging.getLogger("egammaLargeClusterMakerConfigTest")
mlog.info("Configuring egammaLargeClusterMaker: ")
printProperties(mlog, cfg.popToolsAndMerge(
egammaLargeClusterMakerCfg(ConfigFlags)),
......
......@@ -20,7 +20,6 @@ def egammaOQFlagsBuilderCfg(flags, name='egammaOQFlagsBuilder', **kwargs):
kwargs.setdefault("affectedTool", CaloAffectedTool())
tool = egammaOQFlagsBuilder(name, **kwargs)
print(tool)
acc.setPrivateTools(tool)
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