diff --git a/Trigger/TriggerCommon/TrigEDMConfig/CMakeLists.txt b/Trigger/TriggerCommon/TrigEDMConfig/CMakeLists.txt index 43378552b975417b6f6976385414a6b14a562d11..f88fe64e6ced5395d2c576f9545970bfd245950a 100644 --- a/Trigger/TriggerCommon/TrigEDMConfig/CMakeLists.txt +++ b/Trigger/TriggerCommon/TrigEDMConfig/CMakeLists.txt @@ -5,6 +5,7 @@ atlas_subdir( TrigEDMConfig ) # Install files from the package: atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} --extend-select=ATL900,ATL901 ) +atlas_install_scripts( test/*.sh ) atlas_add_test( testEDM SCRIPT python/testEDM.py @@ -13,3 +14,7 @@ atlas_add_test( testEDM atlas_add_test( testEDMRun3 SCRIPT python/testEDMRun3.py POST_EXEC_SCRIPT nopost.sh ) + +atlas_add_test( testEDMRun3Reproducibility + SCRIPT testTriggerEDMRun3Reproducibility.sh + POST_EXEC_SCRIPT nopost.sh ) diff --git a/Trigger/TriggerCommon/TrigEDMConfig/python/TriggerEDMRun3.py b/Trigger/TriggerCommon/TrigEDMConfig/python/TriggerEDMRun3.py index 70d098bcf1da9c04b1e9ac47029f1a424583aec4..08acad35da73975c3b3e13c1834b1ecac8edabe2 100644 --- a/Trigger/TriggerCommon/TrigEDMConfig/python/TriggerEDMRun3.py +++ b/Trigger/TriggerCommon/TrigEDMConfig/python/TriggerEDMRun3.py @@ -85,7 +85,7 @@ JetCopyVarsToKeep += [f'fastDIPS20211215_p{x}' for x in 'cub'] JetCopyVars = '.'.join(JetCopyVarsToKeep) # Create a (temporary) list of TLAJetVars as the union of JetVars and JetCopyVars -TLAJetVarsToKeep = list(set(JetVarsToKeep+JetCopyVarsToKeep)) +TLAJetVarsToKeep = sorted(list(set(JetVarsToKeep+JetCopyVarsToKeep))) TLAJetVars='.'.join(TLAJetVarsToKeep) ElToKeep = ['ptcone20', 'ptvarcone20'] diff --git a/Trigger/TriggerCommon/TrigEDMConfig/python/testEDMRun3.py b/Trigger/TriggerCommon/TrigEDMConfig/python/testEDMRun3.py index 61e8429d4a2b6cf1ce1d83a03f7e6c6a224c95c4..d5e744e0208d32c7ddacee96960bc460c590ae01 100755 --- a/Trigger/TriggerCommon/TrigEDMConfig/python/testEDMRun3.py +++ b/Trigger/TriggerCommon/TrigEDMConfig/python/testEDMRun3.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration -from TriggerEDMRun3 import TriggerHLTListRun3, EDMDetailsRun3, AllowedOutputFormats +from TrigEDMConfig.TriggerEDMRun3 import TriggerHLTListRun3, EDMDetailsRun3, AllowedOutputFormats from AthenaCommon.Logging import logging log = logging.getLogger('testEDMRun3') @@ -13,6 +13,15 @@ def isCLIDDefined(typename): c = cgen.genClidFromName(typename) return (cgen.getNameFromClid(c) is not None) + +def dumpListToJson(fileName): + from TrigEDMConfig.TriggerEDM import getTriggerEDMList + import json + edmDict = dict([(fmt, getTriggerEDMList(fmt, 3)) for fmt in AllowedOutputFormats]) + with open(fileName,'w') as f: + json.dump(edmDict, f) + + def main(): import re serializable_names = [] diff --git a/Trigger/TriggerCommon/TrigEDMConfig/test/testTriggerEDMRun3Reproducibility.sh b/Trigger/TriggerCommon/TrigEDMConfig/test/testTriggerEDMRun3Reproducibility.sh new file mode 100755 index 0000000000000000000000000000000000000000..404d7f2e735eb376620addcc9724e7b860d9fabc --- /dev/null +++ b/Trigger/TriggerCommon/TrigEDMConfig/test/testTriggerEDMRun3Reproducibility.sh @@ -0,0 +1,22 @@ +#!/bin/bash +# +# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration +# + +baseFileName="trig_edmr3_repr_test_" +rm -f ${baseFileName}* + +for i in `seq 3`; do + python -c "from TrigEDMConfig.testEDMRun3 import dumpListToJson; dumpListToJson('${baseFileName}${i}.json')" +done + +diff ${baseFileName}1.json ${baseFileName}2.json >${baseFileName}diff1.txt +ret1=$? + +diff ${baseFileName}1.json ${baseFileName}3.json >${baseFileName}diff2.txt +ret2=$? + +if [[ $ret1 != 0 || $ret2 != 0 ]]; then + echo "ERROR Trigger EDM Run3 list is irreproducible" + exit 1 +fi