diff --git a/Tracking/Acts/ActsTrkFinding/python/ActsSequenceConfiguration.py b/Tracking/Acts/ActsTrkFinding/python/ActsSequenceConfiguration.py new file mode 100644 index 0000000000000000000000000000000000000000..1f1f0ddab12ccd0d290bde7f8e8aeac682de7d16 --- /dev/null +++ b/Tracking/Acts/ActsTrkFinding/python/ActsSequenceConfiguration.py @@ -0,0 +1,32 @@ +# Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration + +# Python's Decorator for ACTS algorithm sequence +# This will set the debug level to the desired value +# and change the name of all the sequences accordingly +# to the environment + +def acts_sequence_configuration(func): + def wrapper(ConfigFlags, **kwargs): + acc = func(ConfigFlags, **kwargs) + + # Set OutputLevel can be set with the following piece of code + # This will set the Outputl Level of all the algorithms and Tools to + # a defined value + # TO-DO: Add a flag (maybe in the config flags) that defines the output level + # for our algorithms/tools + # + # from AthenaCommon.Constants import DEBUG + # for el in acc._allSequences: + # for member in el.Members: + # member.OutputLevel = DEBUG + + # the following is needed to reliably determine whether we're really being steered from an old-style job option + # assume we're running CPython + import inspect + stack = inspect.stack() + if len(stack) >= 2 and stack[1].function == 'CAtoGlobalWrapper': + for el in acc._allSequences: + el.name = "TopAlg" + + return acc + return wrapper diff --git a/Tracking/Acts/ActsTrkFinding/python/ActsTrackingSequenceConfig.py b/Tracking/Acts/ActsTrkFinding/python/ActsTrackingSequenceConfig.py index aa7ab817c00cd0927e144b4232c30f7bf48b3ea3..06ebc748f15041a1d1f9f048fc2946323e663924 100644 --- a/Tracking/Acts/ActsTrkFinding/python/ActsTrackingSequenceConfig.py +++ b/Tracking/Acts/ActsTrkFinding/python/ActsTrackingSequenceConfig.py @@ -4,7 +4,9 @@ from AthenaCommon.Configurable import ConfigurableRun3Behavior from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator from AthenaConfiguration.ComponentAccumulator import CAtoGlobalWrapper from ActsTrkFinding.ActsSeedingAlgorithmConfig import ActsSeedingAlgorithmCfg +from ActsTrkFinding.ActsSequenceConfiguration import acts_sequence_configuration +@acts_sequence_configuration def ActsTrackingSequenceCfg(ConfigFlags, inputCollections: list = []): # prepare entire sequence @@ -16,23 +18,6 @@ def ActsTrackingSequenceCfg(ConfigFlags, name = 'ActsSeedingAlgorithm', inputCollection = i_collection, outputCollection = o_collection)) - - # Set OutputLevel can be set with the following piece of code - # This will set the Outputl Level of all the algorithms and Tools to - # a defined value - # - # from AthenaCommon.Constants import DEBUG - # for el in acc._allSequences: - # for member in el.Members: - # member.OutputLevel = DEBUG - - # the following is needed to reliably determine whether we're really being steered from an old-style job option - # assume we're running CPython - import inspect - stack = inspect.stack() - if len(stack) >= 2 and stack[1].function == 'CAtoGlobalWrapper': - for el in acc._allSequences: - el.name = "TopAlg" return acc diff --git a/Tracking/Acts/ActsTrkFinding/python/ActsTrackingSequenceFromAthenaConfig.py b/Tracking/Acts/ActsTrkFinding/python/ActsTrackingSequenceFromAthenaConfig.py index da38ebea3c28e3bef55aa8e40faa56bb20a01d24..30b1d149be2bd65c6731d0f6bd36ff851ff13005 100644 --- a/Tracking/Acts/ActsTrkFinding/python/ActsTrackingSequenceFromAthenaConfig.py +++ b/Tracking/Acts/ActsTrkFinding/python/ActsTrackingSequenceFromAthenaConfig.py @@ -4,8 +4,10 @@ from AthenaCommon.Configurable import ConfigurableRun3Behavior from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator from AthenaConfiguration.ComponentAccumulator import CAtoGlobalWrapper from ActsTrkFinding.ActsSeedingAlgorithmConfig import ActsSeedingAlgorithmCfg +from ActsTrkFinding.ActsSequenceConfiguration import acts_sequence_configuration from ActsInterop import UnitConstants +@acts_sequence_configuration def ActsTrackingSequenceFromAthenaCfg(ConfigFlags, inputCollections: list = []): # prepare entire sequence @@ -30,23 +32,6 @@ def ActsTrackingSequenceFromAthenaCfg(ConfigFlags, inputCollection = i_collection, outputCollection = o_collection, **seedingOptions)) - - # Set OutputLevel can be set with the following piece of code - # This will set the Outputl Level of all the algorithms and Tools to - # a defined value - # - # from AthenaCommon.Constants import DEBUG - # for el in acc._allSequences: - # for member in el.Members: - # member.OutputLevel = DEBUG - - # the following is needed to reliably determine whether we're really being steered from an old-style job option - # assume we're running CPython - import inspect - stack = inspect.stack() - if len(stack) >= 2 and stack[1].function == 'CAtoGlobalWrapper': - for el in acc._allSequences: - el.name = "TopAlg" return acc