Skip to content
Snippets Groups Projects
Commit f1647b51 authored by John Chapman's avatar John Chapman
Browse files

Add ComponentAccumulator-based configuration for PixelOverlay

parent 05d5e0dc
No related branches found
No related tags found
No related merge requests found
Pipeline #1008428 passed
...@@ -58,6 +58,10 @@ atlas_install_python_modules( python/*.py ) ...@@ -58,6 +58,10 @@ atlas_install_python_modules( python/*.py )
atlas_install_joboptions( share/StoreGateTestCommon.txt ) atlas_install_joboptions( share/StoreGateTestCommon.txt )
# Configuration tests # Configuration tests
atlas_add_test( PixelOverlayConfig_test
SCRIPT test/PixelOverlayConfig_test.py
PROPERTIES TIMEOUT 300 )
atlas_add_test( SCTOverlayConfig_test atlas_add_test( SCTOverlayConfig_test
SCRIPT test/SCTOverlayConfig_test.py SCRIPT test/SCTOverlayConfig_test.py
PROPERTIES TIMEOUT 300 ) PROPERTIES TIMEOUT 300 )
"""Define methods to construct configured Pixel overlay algorithms
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
"""
from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
def PixelOverlayAlgCfg(flags, name = "PixelOverlay", **kwargs):
"""Return a ComponentAccumulator for PixelOverlay algorithm"""
acc = ComponentAccumulator()
kwargs.setdefault("BkgInputKey", flags.Overlay.BkgPrefix + "PixelRDOs")
kwargs.setdefault("SignalInputKey", flags.Overlay.SigPrefix + "PixelRDOs")
kwargs.setdefault("OutputKey", "PixelRDOs")
kwargs.setdefault("includeBkg", True)
# Do Pixel overlay
from InDetOverlay.InDetOverlayConf import PixelOverlay
alg = PixelOverlay(name, **kwargs)
acc.addEventAlgo(alg)
# Setup output
from OutputStreamAthenaPool.OutputStreamConfig import OutputStreamCfg
acc.merge(OutputStreamCfg(flags, "RDO", ItemList = [
"PixelRDO_Container#PixelRDOs"
]))
return acc
def PixelTruthOverlayCfg(flags, name = "PixelSDOOverlay", **kwargs):
"""Return a ComponentAccumulator for the Pixel SDO overlay algorithm"""
acc = ComponentAccumulator()
# We do not need background Pixel SDOs
kwargs.setdefault("BkgInputKey", "")
kwargs.setdefault("SignalInputKey", flags.Overlay.BkgPrefix + "PixelSDO_Map")
kwargs.setdefault("OutputKey", "PixelSDO_Map")
# Do Pixel truth overlay
from InDetOverlay.InDetOverlayConf import InDetSDOOverlay
alg = InDetSDOOverlay(name, **kwargs)
acc.addEventAlgo(alg)
# Setup output
from OutputStreamAthenaPool.OutputStreamConfig import OutputStreamCfg
acc.merge(OutputStreamCfg(flags, "RDO", ItemList = [
"InDetSimDataCollection#PixelSDO_Map"
]))
return acc
def PixelOverlayCfg(flags):
"""Configure and return a ComponentAccumulator for Pixel overlay"""
acc = ComponentAccumulator()
# Add Pixel overlay digitization algorithm
from PixelDigitization.PixelDigitizationConfigNew import PixelDigitizationOverlayCfg
acc.merge(PixelDigitizationOverlayCfg(flags))
# Add Pixel overlay algorithm
acc.merge(PixelOverlayAlgCfg(flags))
# Add Pixel truth overlay
acc.merge(PixelTruthOverlayCfg(flags))
return acc
#!/usr/bin/env python
"""Run tests on PixelOverlayConfig.py
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
"""
import sys
from AthenaCommon.Configurable import Configurable
from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
from AthenaConfiguration.AllConfigFlags import ConfigFlags
from AthenaConfiguration.MainServicesConfig import MainServicesThreadedCfg
from AthenaConfiguration.TestDefaults import defaultTestFiles
from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg
from OverlayCommonAlgs.OverlayCopyAlgsConfig import CopyMcEventCollectionCfg
from InDetOverlay.PixelOverlayConfig import PixelOverlayCfg
# Global test config
nThreads = 1
# Configure
Configurable.configurableRun3Behavior = True
ConfigFlags.Input.Files = defaultTestFiles.RDO_BKG
ConfigFlags.Input.SecondaryFiles = defaultTestFiles.HITS
ConfigFlags.IOVDb.GlobalTag = "OFLCOND-MC16-SDR-16"
ConfigFlags.GeoModel.Align.Dynamic = False
ConfigFlags.Overlay.DataOverlay = False
# Flags relating to multithreaded execution
ConfigFlags.Concurrency.NumThreads = nThreads
if nThreads > 0:
ConfigFlags.Scheduler.ShowDataDeps = True
ConfigFlags.Scheduler.ShowDataFlow = True
ConfigFlags.Scheduler.ShowControlFlow = True
ConfigFlags.Concurrency.NumConcurrentEvents = nThreads
ConfigFlags.lock()
# Construct our accumulator to run
acc = MainServicesThreadedCfg(ConfigFlags)
acc.merge(PoolReadCfg(ConfigFlags))
# Add truth overlay (needed downstream)
acc.merge(CopyMcEventCollectionCfg(ConfigFlags))
# Add Pixel overlay
acc.merge(PixelOverlayCfg(ConfigFlags))
# Dump config
acc.printConfig(withDetails=True)
ConfigFlags.dump()
# Execute and finish
sc = acc.run(maxEvents=3)
# Dump config summary
acc.printConfig(withDetails=False)
# Success should be 0
sys.exit(not sc.isSuccess())
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment