From 2f7a7c418ead97710508dbe16583e510c372ec2f Mon Sep 17 00:00:00 2001
From: Tadej Novak <tadej.novak@cern.ch>
Date: Tue, 9 Jan 2024 07:57:33 +0100
Subject: [PATCH] Trigger: improve handling of geometry tags in tests

---
 .../AthenaConfiguration/python/TestDefaults.py   | 15 +++++++++++++++
 .../python/AnalysisTriggerAlgsCAConfig.py        |  5 +++--
 .../python/FPGATrackSimAnalysisConfig.py         |  5 +++--
 .../TrigCaloRec/python/TrigCaloRecConfig.py      |  8 +++-----
 .../python/MdtDataPreparator_test.py             |  5 +++--
 .../TrigL2MuonSA/python/TrigL2MuonSAConfig.py    |  5 +++--
 .../TrigMinBias/python/MbtsConfig.py             |  5 +++--
 .../python/TrigPartialEventBuildingConfig.py     |  5 +++--
 .../python/TrigCaloDataAccessConfig.py           |  5 +++--
 .../HLTSeeding/python/HLTSeedingConfig.py        |  4 +++-
 .../python/FexEmulatedTowersConfig.py            | 12 ++++++------
 .../python/L1CaloFEXAlgosConfig.py               | 12 ++++++------
 .../L1CaloFEXSim/python/FEXReprocessingRun3.py   | 10 +++++-----
 .../L1CaloFEXSim/python/L1CaloFEXSimCfg.py       | 12 +++++++-----
 Trigger/TrigT1/TrigGepPerf/share/run_gep.py      | 14 ++++++--------
 .../share/L1CaloRampMaker.py                     | 11 +++++------
 .../TrigT1CaloCondSvc/python/L1CaloCondConfig.py |  8 ++++----
 .../python/TrigT1ResultByteStreamConfig.py       | 16 +++++++---------
 .../TrigInDetConfig/python/TrigInDetConfig.py    |  5 +++--
 .../TrigValAlgs/python/TrigValAlgsConfig.py      |  5 +++--
 .../TriggerJobOpts/python/TriggerConfig.py       |  4 +++-
 .../TriggerJobOpts/python/TriggerRecoConfig.py   |  5 ++++-
 .../CommonSequences/EventBuildingSequences.py    |  5 +++--
 23 files changed, 104 insertions(+), 77 deletions(-)

diff --git a/Control/AthenaConfiguration/python/TestDefaults.py b/Control/AthenaConfiguration/python/TestDefaults.py
index 0e484cf617a..5a88ad5f037 100644
--- a/Control/AthenaConfiguration/python/TestDefaults.py
+++ b/Control/AthenaConfiguration/python/TestDefaults.py
@@ -46,3 +46,18 @@ class defaultGeometryTags:
     RUN2_BEST_KNOWLEDGE = "ATLAS-R2-2016-01-02-01"
     RUN3 = "ATLAS-R3S-2021-03-02-00"
     RUN4 = "ATLAS-P2-RUN4-03-00-00"
+
+    @staticmethod
+    def autoconfigure(flags):
+        if flags.GeoModel.AtlasVersion:
+            return flags.GeoModel.AtlasVersion
+
+        from AthenaConfiguration.Enums import LHCPeriod
+        if flags.GeoModel.Run is LHCPeriod.Run1:
+            return defaultGeometryTags.RUN1_2012
+        if flags.GeoModel.Run is LHCPeriod.Run2:
+            return defaultGeometryTags.RUN2
+        if flags.GeoModel.Run is LHCPeriod.Run3:
+            return defaultGeometryTags.RUN3
+        if flags.GeoModel.Run is LHCPeriod.Run4:
+            return defaultGeometryTags.RUN4
diff --git a/PhysicsAnalysis/AnalysisTrigger/AnalysisTriggerAlgs/python/AnalysisTriggerAlgsCAConfig.py b/PhysicsAnalysis/AnalysisTrigger/AnalysisTriggerAlgs/python/AnalysisTriggerAlgsCAConfig.py
index 4b0a6bc37ec..f7a18fbcc8e 100644
--- a/PhysicsAnalysis/AnalysisTrigger/AnalysisTriggerAlgs/python/AnalysisTriggerAlgsCAConfig.py
+++ b/PhysicsAnalysis/AnalysisTrigger/AnalysisTriggerAlgs/python/AnalysisTriggerAlgsCAConfig.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
 
 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
 from AthenaConfiguration.ComponentFactory import CompFactory
@@ -67,9 +67,10 @@ def RoIBResultToxAODCfg(flags):
 if __name__ == "__main__":
     from AthenaConfiguration.MainServicesConfig import MainServicesCfg
     from AthenaConfiguration.AllConfigFlags import initConfigFlags
-    from AthenaConfiguration.TestDefaults import defaultTestFiles
+    from AthenaConfiguration.TestDefaults import defaultTestFiles, defaultGeometryTags
     flags = initConfigFlags()
     flags.Input.Files = defaultTestFiles.RAW_RUN2
+    flags.GeoModel.AtlasVersion = defaultGeometryTags.RUN2
     flags.Exec.MaxEvents = 20
     flags.fillFromArgs()
     flags.lock()
diff --git a/Trigger/EFTracking/FPGATrackSim/FPGATrackSimConfTools/python/FPGATrackSimAnalysisConfig.py b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimConfTools/python/FPGATrackSimAnalysisConfig.py
index 4997e6a481e..8222be59479 100644
--- a/Trigger/EFTracking/FPGATrackSim/FPGATrackSimConfTools/python/FPGATrackSimAnalysisConfig.py
+++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimConfTools/python/FPGATrackSimAnalysisConfig.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
 
 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
 from AthenaConfiguration.ComponentFactory import CompFactory
@@ -394,7 +394,8 @@ if __name__ == "__main__":
 
     flags = initConfigFlags()
     flags.fillFromArgs()
-    flags.GeoModel.AtlasVersion = "ATLAS-P2-RUN4-03-00-00"
+    from AthenaConfiguration.TestDefaults import defaultGeometryTags
+    flags.GeoModel.AtlasVersion = defaultGeometryTags.RUN4
     if isinstance(flags.Trigger.FPGATrackSim.wrapperFileName, str):
         log.info("wrapperFile is string, converting to list")
         flags.Trigger.FPGATrackSim.wrapperFileName = [flags.Trigger.FPGATrackSim.wrapperFileName]
diff --git a/Trigger/TrigAlgorithms/TrigCaloRec/python/TrigCaloRecConfig.py b/Trigger/TrigAlgorithms/TrigCaloRec/python/TrigCaloRecConfig.py
index ba572435360..766056d2fa6 100755
--- a/Trigger/TrigAlgorithms/TrigCaloRec/python/TrigCaloRecConfig.py
+++ b/Trigger/TrigAlgorithms/TrigCaloRec/python/TrigCaloRecConfig.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
 
 from AthenaCommon.SystemOfUnits import MeV, deg
 from AthenaCommon.Logging import logging
@@ -472,14 +472,12 @@ def HICaloTowerCfg(flags):
 
 
 if __name__ == "__main__":
-    from AthenaConfiguration.TestDefaults import defaultTestFiles
+    from AthenaConfiguration.TestDefaults import defaultTestFiles, defaultGeometryTags
     from AthenaConfiguration.AllConfigFlags import initConfigFlags
-    from AthenaConfiguration.Enums import LHCPeriod
 
     flags = initConfigFlags()
     flags.Input.Files = defaultTestFiles.RAW_RUN3
-    #flags.Input.isMC=False
-    flags.GeoModel.Run=LHCPeriod.Run3
+    flags.GeoModel.AtlasVersion = defaultGeometryTags.RUN3
     flags.IOVDb.GlobalTag = "CONDBR2-ES1PA-2022-07"
     flags.Common.isOnline = True
     outputContainers = ["CaloCellContainer#SeedLessFS",
diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/python/MdtDataPreparator_test.py b/Trigger/TrigAlgorithms/TrigL2MuonSA/python/MdtDataPreparator_test.py
index 06401726fb5..b14e4748126 100644
--- a/Trigger/TrigAlgorithms/TrigL2MuonSA/python/MdtDataPreparator_test.py
+++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/python/MdtDataPreparator_test.py
@@ -1,5 +1,5 @@
 #
-# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration.
+# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration.
 #
 # File: TrigL2MuonSA/share/MdtDataPreparator_test.py
 # Author: scott snyder
@@ -51,10 +51,11 @@ def testCfg (configFlags):
 
 
 from AthenaConfiguration.AllConfigFlags import initConfigFlags
-from AthenaConfiguration.TestDefaults import defaultTestFiles
+from AthenaConfiguration.TestDefaults import defaultTestFiles, defaultGeometryTags
 
 flags = initConfigFlags()
 flags.Input.Files = defaultTestFiles.RAW_RUN2
+flags.GeoModel.AtlasVersion = defaultGeometryTags.RUN2
 flags.lock()
 from AthenaConfiguration.MainServicesConfig import MainServicesCfg 
 acc=MainServicesCfg(flags)
diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/python/TrigL2MuonSAConfig.py b/Trigger/TrigAlgorithms/TrigL2MuonSA/python/TrigL2MuonSAConfig.py
index 6c63b4a935d..52350e973e9 100644
--- a/Trigger/TrigAlgorithms/TrigL2MuonSA/python/TrigL2MuonSAConfig.py
+++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/python/TrigL2MuonSAConfig.py
@@ -1,5 +1,5 @@
 #
-#  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
+#  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
 #
 #  This file configs the L2MuonSA reco alg in the newJO way, 
 #      but now is located here temporarily until newJO migrations are done in all trigger signatures.
@@ -368,10 +368,11 @@ def l2MuFastAlgCfg( flags, roisKey, setup="", **kwargs ):
 
 
 if __name__ == "__main__":
-    from AthenaConfiguration.TestDefaults import defaultTestFiles
+    from AthenaConfiguration.TestDefaults import defaultTestFiles, defaultGeometryTags
     from AthenaConfiguration.AllConfigFlags import initConfigFlags
     flags = initConfigFlags()
     flags.Input.Files = defaultTestFiles.RAW_RUN2
+    flags.GeoModel.AtlasVersion = defaultGeometryTags.RUN2
     flags.lock()
 
     cfg = l2MuFastAlgCfg(flags, roisKey="MURoIs")
diff --git a/Trigger/TrigAlgorithms/TrigMinBias/python/MbtsConfig.py b/Trigger/TrigAlgorithms/TrigMinBias/python/MbtsConfig.py
index b5e8bb0fe35..dc2a111df61 100644
--- a/Trigger/TrigAlgorithms/TrigMinBias/python/MbtsConfig.py
+++ b/Trigger/TrigAlgorithms/TrigMinBias/python/MbtsConfig.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
 from TrigMinBias.TrigMinBiasMonitoring import MbtsFexMonitoring
 from AthenaConfiguration.ComponentFactory import CompFactory
 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
@@ -26,10 +26,11 @@ def MbtsSGInputCfg(flags):
 
 if __name__ == '__main__':
     from AthenaConfiguration.AllConfigFlags import initConfigFlags
-    from AthenaConfiguration.TestDefaults import defaultTestFiles
+    from AthenaConfiguration.TestDefaults import defaultTestFiles, defaultGeometryTags
 
     flags = initConfigFlags()
     flags.Input.Files=defaultTestFiles.RAW_RUN2 # or ESD or AOD or ...
+    flags.GeoModel.AtlasVersion = defaultGeometryTags.RUN2
     flags.lock()
 
     acc=ComponentAccumulator()
diff --git a/Trigger/TrigAlgorithms/TrigPartialEventBuilding/python/TrigPartialEventBuildingConfig.py b/Trigger/TrigAlgorithms/TrigPartialEventBuilding/python/TrigPartialEventBuildingConfig.py
index 2c7efe168f5..c70cd7d8ede 100644
--- a/Trigger/TrigAlgorithms/TrigPartialEventBuilding/python/TrigPartialEventBuildingConfig.py
+++ b/Trigger/TrigAlgorithms/TrigPartialEventBuilding/python/TrigPartialEventBuildingConfig.py
@@ -1,5 +1,5 @@
 #
-#  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
+#  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
 #
 
 from AthenaCommon.Configurable import ConfigurableCABehavior
@@ -101,10 +101,11 @@ def StaticPEBInfoWriterToolCfg(flags, name='StaticPEBInfoWriterTool',
 
 
 if __name__ == '__main__':
-    from AthenaConfiguration.TestDefaults import defaultTestFiles
+    from AthenaConfiguration.TestDefaults import defaultTestFiles, defaultGeometryTags
     from AthenaConfiguration.AllConfigFlags import initConfigFlags
     flags = initConfigFlags()
     flags.Input.Files = defaultTestFiles.RAW_RUN3
+    flags.GeoModel.AtlasVersion = defaultGeometryTags.RUN3
     flags.lock()
 
     cfg = ComponentAccumulator()
diff --git a/Trigger/TrigAlgorithms/TrigT2CaloCommon/python/TrigCaloDataAccessConfig.py b/Trigger/TrigAlgorithms/TrigT2CaloCommon/python/TrigCaloDataAccessConfig.py
index a07304375e7..26fbed9bde3 100644
--- a/Trigger/TrigAlgorithms/TrigT2CaloCommon/python/TrigCaloDataAccessConfig.py
+++ b/Trigger/TrigAlgorithms/TrigT2CaloCommon/python/TrigCaloDataAccessConfig.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
 from AthenaConfiguration.ComponentFactory import CompFactory
 from AthenaConfiguration.AccumulatorCache import AccumulatorCache
@@ -101,12 +101,13 @@ def trigCaloDataAccessSvcCfg( flags ):
 
 
 if __name__ == "__main__":
-    from AthenaConfiguration.TestDefaults import defaultTestFiles
+    from AthenaConfiguration.TestDefaults import defaultTestFiles, defaultGeometryTags
     from AthenaConfiguration.AllConfigFlags import initConfigFlags
     import sys
 
     flags = initConfigFlags()
     flags.Input.Files = defaultTestFiles.RAW_RUN2
+    flags.GeoModel.AtlasVersion = defaultGeometryTags.RUN2
     flags.Input.isMC=False
     flags.lock()
 
diff --git a/Trigger/TrigSteer/HLTSeeding/python/HLTSeedingConfig.py b/Trigger/TrigSteer/HLTSeeding/python/HLTSeedingConfig.py
index 81bec4f9a43..c5b664764ed 100644
--- a/Trigger/TrigSteer/HLTSeeding/python/HLTSeedingConfig.py
+++ b/Trigger/TrigSteer/HLTSeeding/python/HLTSeedingConfig.py
@@ -1,5 +1,5 @@
 #
-#  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
+#  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
 #
 
 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
@@ -399,6 +399,8 @@ if __name__ == "__main__":
     flags = initConfigFlags()
     flags.Trigger.forceEnableAllChains= True
     flags.Input.Files= ["/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/TrigP1Test/data17_13TeV.00327265.physics_EnhancedBias.merge.RAW._lb0100._SFO-1._0001.1",]
+    from AthenaConfiguration.TestDefaults import defaultGeometryTags
+    flags.GeoModel.AtlasVersion = defaultGeometryTags.RUN2
     flags.lock()
     acc = HLTSeedingCfg( flags )
     acc.wasMerged()
diff --git a/Trigger/TrigT1/L1CaloFEX/L1CaloFEXAlgos/python/FexEmulatedTowersConfig.py b/Trigger/TrigT1/L1CaloFEX/L1CaloFEXAlgos/python/FexEmulatedTowersConfig.py
index 4c383163374..3999dbb319d 100644
--- a/Trigger/TrigT1/L1CaloFEX/L1CaloFEXAlgos/python/FexEmulatedTowersConfig.py
+++ b/Trigger/TrigT1/L1CaloFEX/L1CaloFEXAlgos/python/FexEmulatedTowersConfig.py
@@ -1,5 +1,5 @@
 #
-# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
 #
 
 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
@@ -65,7 +65,11 @@ if __name__ == '__main__':
     flags.Input.Files = [file for x in args.filesInput for file in glob.glob(x)]
     flags.Concurrency.NumThreads = 1
     flags.Concurrency.NumConcurrentEvents = 1
-  
+
+    if not flags.Input.isMC:
+        from AthenaConfiguration.TestDefaults import defaultGeometryTags
+        flags.GeoModel.AtlasVersion = defaultGeometryTags.autoconfigure(flags)
+
     if any(["data" in f for f in args.filesInput]):
         s=args.filesInput[0].replace('*','').replace('.data','')
         flags.Output.AODFileName = "AOD."+(s.split("/")[-1]).split('_SFO')[0]+"pool.root"
@@ -76,10 +80,6 @@ if __name__ == '__main__':
     flags.Trigger.doLVL1 = True
     flags.Trigger.enableL1CaloPhase1 = True
 
-    from AthenaConfiguration.Enums import LHCPeriod
-    if not flags.Input.isMC and flags.GeoModel.Run is LHCPeriod.Run2:
-        flags.GeoModel.AtlasVersion = 'ATLAS-R2-2016-01-00-01'
-
     # Enable only calo for this test
     from AthenaConfiguration.DetectorConfigFlags import setupDetectorsFromList
     setupDetectorsFromList(flags,['LAr','Tile','MBTS'],True)
diff --git a/Trigger/TrigT1/L1CaloFEX/L1CaloFEXAlgos/python/L1CaloFEXAlgosConfig.py b/Trigger/TrigT1/L1CaloFEX/L1CaloFEXAlgos/python/L1CaloFEXAlgosConfig.py
index cd9ecbdc562..9e997c3648b 100644
--- a/Trigger/TrigT1/L1CaloFEX/L1CaloFEXAlgos/python/L1CaloFEXAlgosConfig.py
+++ b/Trigger/TrigT1/L1CaloFEX/L1CaloFEXAlgos/python/L1CaloFEXAlgosConfig.py
@@ -1,5 +1,5 @@
 #
-# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
 #
 
 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
@@ -96,7 +96,11 @@ if __name__ == '__main__':
     flags.Input.Files = [file for x in args.filesInput for file in glob.glob(x)]
     flags.Concurrency.NumThreads = 1
     flags.Concurrency.NumConcurrentEvents = 1
-  
+
+    if not flags.Input.isMC:
+        from AthenaConfiguration.TestDefaults import defaultGeometryTags
+        flags.GeoModel.AtlasVersion = defaultGeometryTags.autoconfigure(flags)
+
     if any(["data" in f for f in args.filesInput]):
         s=args.filesInput[0].replace('*','').replace('.data','')
         flags.Output.AODFileName = "AOD."+(s.split("/")[-1]).split('_SFO')[0]+"pool.root"
@@ -107,10 +111,6 @@ if __name__ == '__main__':
     flags.Trigger.doLVL1 = True
     flags.Trigger.enableL1CaloPhase1 = True
 
-    from AthenaConfiguration.Enums import LHCPeriod
-    if not flags.Input.isMC and flags.GeoModel.Run is LHCPeriod.Run2:
-        flags.GeoModel.AtlasVersion = 'ATLAS-R2-2016-01-00-01'
-
     # Enable only calo for this test
     from AthenaConfiguration.DetectorConfigFlags import setupDetectorsFromList
     setupDetectorsFromList(flags,['LAr','Tile','MBTS'],True)
diff --git a/Trigger/TrigT1/L1CaloFEX/L1CaloFEXSim/python/FEXReprocessingRun3.py b/Trigger/TrigT1/L1CaloFEX/L1CaloFEXSim/python/FEXReprocessingRun3.py
index a8e22e77a58..3656b5011e3 100644
--- a/Trigger/TrigT1/L1CaloFEX/L1CaloFEXSim/python/FEXReprocessingRun3.py
+++ b/Trigger/TrigT1/L1CaloFEX/L1CaloFEXSim/python/FEXReprocessingRun3.py
@@ -1,5 +1,5 @@
 #
-# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
 #
 
 from AthenaConfiguration.ComponentFactory import CompFactory
@@ -42,6 +42,10 @@ if __name__ == '__main__':
     flags.Input.Files = [file for x in args.filesInput for file in glob.glob(x)]
     flags.Concurrency.NumThreads = 1
     flags.Concurrency.NumConcurrentEvents = 1
+
+    if not flags.Input.isMC:
+        from AthenaConfiguration.TestDefaults import defaultGeometryTags
+        flags.GeoModel.AtlasVersion = defaultGeometryTags.autoconfigure(flags)
   
     if any(["data" in f for f in args.filesInput]):
         s=args.filesInput[0].replace('*','').replace('.data','')
@@ -53,10 +57,6 @@ if __name__ == '__main__':
     flags.Trigger.doLVL1 = True
     flags.Trigger.enableL1CaloPhase1 = True
 
-    from AthenaConfiguration.Enums import LHCPeriod
-    if not flags.Input.isMC and flags.GeoModel.Run is LHCPeriod.Run2:
-        flags.GeoModel.AtlasVersion = 'ATLAS-R2-2016-01-00-01'
-
     # Enable only calo for this test
     from AthenaConfiguration.DetectorConfigFlags import setupDetectorsFromList
     setupDetectorsFromList(flags,['LAr','Tile','MBTS'],True)
diff --git a/Trigger/TrigT1/L1CaloFEX/L1CaloFEXSim/python/L1CaloFEXSimCfg.py b/Trigger/TrigT1/L1CaloFEX/L1CaloFEXSim/python/L1CaloFEXSimCfg.py
index b58b03b2ddb..4f96d301cb7 100644
--- a/Trigger/TrigT1/L1CaloFEX/L1CaloFEXSim/python/L1CaloFEXSimCfg.py
+++ b/Trigger/TrigT1/L1CaloFEX/L1CaloFEXSim/python/L1CaloFEXSimCfg.py
@@ -1,5 +1,5 @@
 #
-# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
 #
 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
 from AthenaConfiguration.ComponentFactory import CompFactory
@@ -321,7 +321,13 @@ if __name__ == '__main__':
     import os
 
     flags = initConfigFlags()
+    flags.Common.isOnline = True
     flags.Input.Files = [args.input] if os.path.isfile(args.input) else Input.get_input(args.input).paths
+    if not flags.Input.isMC:
+        from AthenaConfiguration.TestDefaults import defaultGeometryTags
+        flags.GeoModel.AtlasVersion = defaultGeometryTags.autoconfigure(flags)
+        from AthenaConfiguration.Enums import LHCPeriod
+        flags.IOVDb.GlobalTag = 'CONDBR2-HLTP-2023-01' if flags.GeoModel.Run is LHCPeriod.Run3 else 'CONDBR2-HLTP-2018-04'
     flags.Output.AODFileName = 'AOD.pool.root'
     flags.Exec.MaxEvents = args.nevents
     flags.Concurrency.NumThreads = 1
@@ -334,10 +340,6 @@ if __name__ == '__main__':
     flags.Trigger.enableL1CaloPhase1 = True
     flags.Trigger.triggerConfig = 'FILE'
 
-    from AthenaConfiguration.Enums import LHCPeriod
-    if not flags.Input.isMC and flags.GeoModel.Run is LHCPeriod.Run2:
-        flags.GeoModel.AtlasVersion = 'ATLAS-R2-2016-01-00-01'
-
     # Enable only calo for this test
     from AthenaConfiguration.DetectorConfigFlags import setupDetectorFlags
     setupDetectorFlags(flags, ['LAr','Tile','MBTS'], toggle_geometry=True)
diff --git a/Trigger/TrigT1/TrigGepPerf/share/run_gep.py b/Trigger/TrigT1/TrigGepPerf/share/run_gep.py
index edbadebb10e..507e8a35966 100644
--- a/Trigger/TrigT1/TrigGepPerf/share/run_gep.py
+++ b/Trigger/TrigT1/TrigGepPerf/share/run_gep.py
@@ -1,5 +1,5 @@
 #
-# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
 #
 
 if __name__ == '__main__':
@@ -77,6 +77,10 @@ if __name__ == '__main__':
     else:
         flags.Input.Files = Input.get_input(args.input).paths
 
+    if not flags.Input.isMC:
+        from AthenaConfiguration.TestDefaults import defaultGeometryTags
+        flags.GeoModel.AtlasVersion = defaultGeometryTags.autoconfigure(flags)
+
     info('Command line args: ' + str(args))
 
     flags.Output.AODFileName = 'AOD.pool.root'
@@ -91,10 +95,6 @@ if __name__ == '__main__':
     flags.Trigger.doLVL1 = True
     flags.Trigger.enableL1CaloPhase1 = True
 
-    from AthenaConfiguration.Enums import LHCPeriod
-    if not flags.Input.isMC and flags.GeoModel.Run is LHCPeriod.Run2:
-        flags.GeoModel.AtlasVersion = 'ATLAS-R2-2016-01-00-01'
-
     # Enable only calo for this test
     from AthenaConfiguration.DetectorConfigFlags import setupDetectorFlags
     setupDetectorFlags(flags, ['LAr','Tile','MBTS'], toggle_geometry=True)
@@ -223,7 +223,7 @@ if __name__ == '__main__':
     
     acc.merge(calo_acc422)
 
-    from AthenaCommon.Constants import DEBUG,INFO
+    from AthenaCommon.Constants import DEBUG
     gepAlgs_output_level = DEBUG
 
     from TrigGepPerf.GepClusterTimingAlgConfig import GepClusterTimingAlgCfg
@@ -336,5 +336,3 @@ if __name__ == '__main__':
         sc = acc.run()
         if sc.isFailure():
             exit(1)
-
-    
diff --git a/Trigger/TrigT1/TrigT1CaloCalibUtils/share/L1CaloRampMaker.py b/Trigger/TrigT1/TrigT1CaloCalibUtils/share/L1CaloRampMaker.py
index f8d5600a530..6fdba3fdd32 100644
--- a/Trigger/TrigT1/TrigT1CaloCalibUtils/share/L1CaloRampMaker.py
+++ b/Trigger/TrigT1/TrigT1CaloCalibUtils/share/L1CaloRampMaker.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
 
 import glob, sys
 from AthenaConfiguration.AllConfigFlags import initConfigFlags
@@ -30,6 +30,8 @@ def main():
     
     flags = initConfigFlags()
     flags.Input.Files = glob.glob(options.InputFiles)
+    from AthenaConfiguration.TestDefaults import defaultGeometryTags
+    flags.GeoModel.AtlasVersion = defaultGeometryTags.autoconfigure(flags)
     
     flags.Exec.MaxEvents = -1
     flags.Detector.EnableCalo = True
@@ -44,7 +46,6 @@ def main():
     flags.Tile.doOptATLAS=True
     flags.Tile.RunType='PHY'
     flags.Tile.BestPhaseFromCOOL=True
-    flags.GeoModel.AtlasVersion="ATLAS-R2-2015-03-01-00"
     flags.IOVDb.DBConnection = "sqlite://;schema=energyscanresults.sqlite;dbname=L1CALO"
     flags.IOVDb.GlobalTag = 'CONDBR2-BLKPA-2022-02'
 
@@ -73,10 +74,8 @@ def main():
 
     from CaloConditions.CaloConditionsConfig import CaloTriggerTowerCfg
     acc.merge(CaloTriggerTowerCfg(flags))
-    
-    
-    from LArRecUtils.LArRecUtilsConf import LArADC2MeVCondAlg 
-    LArADC2MeVCondAlg= CompFactory.LArADC2MeVCondAlg()
+
+    LArADC2MeVCondAlg = CompFactory.LArADC2MeVCondAlg()
     LArADC2MeVCondAlg.LArHVScaleCorrKey=""
     acc.addCondAlgo(LArADC2MeVCondAlg, 'AthAlgSeq')
 
diff --git a/Trigger/TrigT1/TrigT1CaloCondSvc/python/L1CaloCondConfig.py b/Trigger/TrigT1/TrigT1CaloCondSvc/python/L1CaloCondConfig.py
index 1e9538dd096..c83c8ddc24b 100644
--- a/Trigger/TrigT1/TrigT1CaloCondSvc/python/L1CaloCondConfig.py
+++ b/Trigger/TrigT1/TrigT1CaloCondSvc/python/L1CaloCondConfig.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
 
 import sys
 
@@ -62,13 +62,13 @@ def L1CaloCondAlgCfg(flags, readTest=False, Physics=True, Calib1=True, Calib2=Tr
 if __name__=="__main__":
         
     from AthenaConfiguration.AllConfigFlags import initConfigFlags
-    from AthenaConfiguration.TestDefaults import defaultTestFiles
+    from AthenaConfiguration.TestDefaults import defaultTestFiles, defaultGeometryTags
 
     flags = initConfigFlags()
-    flags.Input.Files = defaultTestFiles.RAW_RUN2 
+    flags.Input.Files = defaultTestFiles.RAW_RUN2
+    flags.GeoModel.AtlasVersion = defaultGeometryTags.RUN2
     flags.Exec.MaxEvents = 1
     flags.IOVDb.GlobalTag = 'CONDBR2-BLKPA-2022-02'
-    flags.GeoModel.AtlasVersion="ATLAS-R2-2015-03-01-00"
     flags.Trigger.enableL1CaloLegacy = True 
     flags.fillFromArgs()    
     flags.lock() 
diff --git a/Trigger/TrigT1/TrigT1ResultByteStream/python/TrigT1ResultByteStreamConfig.py b/Trigger/TrigT1/TrigT1ResultByteStream/python/TrigT1ResultByteStreamConfig.py
index 0a7d92ddefd..5f5a6522e0f 100644
--- a/Trigger/TrigT1/TrigT1ResultByteStream/python/TrigT1ResultByteStreamConfig.py
+++ b/Trigger/TrigT1/TrigT1ResultByteStream/python/TrigT1ResultByteStreamConfig.py
@@ -1,5 +1,5 @@
 #
-# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
 #
 from AthenaCommon.Logging import logging
 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
@@ -410,21 +410,19 @@ if __name__ == '__main__':
   if any(["data23" in f for f in args.filesInput]):
     flags.IOVDb.GlobalTag = "CONDBR2-HLTP-2022-02"
     flags.Trigger.triggerConfig='DB'
-    from AthenaConfiguration.Enums import LHCPeriod
-    flags.GeoModel.Run = LHCPeriod.Run3 # needed for LArGMConfig
 
   elif any(["data22" in f for f in args.filesInput]):
-    flags.Trigger.triggerConfig='DB'
-    from AthenaConfiguration.Enums import LHCPeriod
-    flags.GeoModel.Run = LHCPeriod.Run3 # needed for LArGMConfig
     flags.IOVDb.GlobalTag = "CONDBR2-ES1PA-2022-07"
-  
-  
+    flags.Trigger.triggerConfig='DB'
+
+  flags.Input.Files = [file for x in args.filesInput for file in glob.glob(x)]
+
+  from AthenaConfiguration.TestDefaults import defaultGeometryTags
+  flags.GeoModel.AtlasVersion = defaultGeometryTags.autoconfigure(flags)
 
   flags.Exec.OutputLevel = algLogLevel
   flags.Exec.MaxEvents = args.evtMax
   flags.Exec.SkipEvents = args.skipEvents
-  flags.Input.Files = [file for x in args.filesInput for file in glob.glob(x)]
   flags.Concurrency.NumThreads = 1
   flags.Concurrency.NumConcurrentEvents = 1
   flags.Output.HISTFileName = args.outputHISTFile
diff --git a/Trigger/TrigTools/TrigInDetConfig/python/TrigInDetConfig.py b/Trigger/TrigTools/TrigInDetConfig/python/TrigInDetConfig.py
index 5d981d85f86..c90a1b26926 100644
--- a/Trigger/TrigTools/TrigInDetConfig/python/TrigInDetConfig.py
+++ b/Trigger/TrigTools/TrigInDetConfig/python/TrigInDetConfig.py
@@ -1,5 +1,5 @@
 #
-#  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
+#  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
 #
 
 from AthenaConfiguration.AccumulatorCache import AccumulatorCache
@@ -157,10 +157,11 @@ def trigInDetVertexingCfg(flags, inputTracks, outputVtx):
 
 if __name__ == "__main__":
     from AthenaConfiguration.AllConfigFlags import initConfigFlags
-    from AthenaConfiguration.TestDefaults import defaultTestFiles
+    from AthenaConfiguration.TestDefaults import defaultTestFiles, defaultGeometryTags
     ComponentAccumulator.debugMode = "trackCA trackPublicTool trackEventAlgo trackCondAlgo trackPrivateTool"
     flags = initConfigFlags()
     flags.Input.Files = defaultTestFiles.RAW_RUN2
+    flags.GeoModel.AtlasVersion = defaultGeometryTags.RUN2
     flags.lock()
     # this configuration is not runable, the test checks if there is no mistake in python scripts above
     # output can be used by experts to check actual configuration (e.g. here we configure to run on RAW and it should be reflected in settings)
diff --git a/Trigger/TrigValidation/TrigValAlgs/python/TrigValAlgsConfig.py b/Trigger/TrigValidation/TrigValAlgs/python/TrigValAlgsConfig.py
index 16b2ffb7140..e0f67b6c08b 100755
--- a/Trigger/TrigValidation/TrigValAlgs/python/TrigValAlgsConfig.py
+++ b/Trigger/TrigValidation/TrigValAlgs/python/TrigValAlgsConfig.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
 
 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
 from AthenaConfiguration.ComponentFactory import CompFactory
@@ -49,9 +49,10 @@ def getEDMAuxList(flags):
 
 if __name__ == '__main__':
     from AthenaConfiguration.AllConfigFlags import initConfigFlags
-    from AthenaConfiguration.TestDefaults import defaultTestFiles
+    from AthenaConfiguration.TestDefaults import defaultTestFiles, defaultGeometryTags
     flags = initConfigFlags()
     flags.Input.Files = defaultTestFiles.RAW_RUN3
+    flags.GeoModel.AtlasVersion = defaultGeometryTags.RUN3
     flags.lock()
 
     cfg = ComponentAccumulator()
diff --git a/Trigger/TriggerCommon/TriggerJobOpts/python/TriggerConfig.py b/Trigger/TriggerCommon/TriggerJobOpts/python/TriggerConfig.py
index 39054b6f78c..91bcbe7116a 100644
--- a/Trigger/TriggerCommon/TriggerJobOpts/python/TriggerConfig.py
+++ b/Trigger/TriggerCommon/TriggerJobOpts/python/TriggerConfig.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
 
 import re
 from collections import OrderedDict, defaultdict
@@ -756,6 +756,8 @@ if __name__ == "__main__":
     flags = initConfigFlags()
     flags.Trigger.forceEnableAllChains = True
     flags.Input.Files = ["/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/TrigP1Test/data17_13TeV.00327265.physics_EnhancedBias.merge.RAW._lb0100._SFO-1._0001.1",]
+    from AthenaConfiguration.TestDefaults import defaultGeometryTags
+    flags.GeoModel.AtlasVersion = defaultGeometryTags.RUN2
     flags.lock()
 
     def testMenu(flags):
diff --git a/Trigger/TriggerCommon/TriggerJobOpts/python/TriggerRecoConfig.py b/Trigger/TriggerCommon/TriggerJobOpts/python/TriggerRecoConfig.py
index 7752b96c124..d5221757d7b 100644
--- a/Trigger/TriggerCommon/TriggerJobOpts/python/TriggerRecoConfig.py
+++ b/Trigger/TriggerCommon/TriggerJobOpts/python/TriggerRecoConfig.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
 
 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
 from AthenaConfiguration.ComponentFactory import CompFactory
@@ -464,6 +464,9 @@ if __name__ == '__main__':
         elif flags.Trigger.EDMVersion==3:
             flags.Input.Files = defaultTestFiles.RAW_RUN3
 
+    from AthenaConfiguration.TestDefaults import defaultGeometryTags
+    flags.GeoModel.AtlasVersion = defaultGeometryTags.autoconfigure(flags)
+
     flags.lock()
 
     acc = MainServicesCfg(flags)
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLT/CommonSequences/EventBuildingSequences.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLT/CommonSequences/EventBuildingSequences.py
index d515d04ecb8..8ded13364a6 100644
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLT/CommonSequences/EventBuildingSequences.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLT/CommonSequences/EventBuildingSequences.py
@@ -1,5 +1,5 @@
 #
-#  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
+#  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
 #
 
 from TrigEDMConfig import DataScoutingInfo
@@ -366,10 +366,11 @@ def isNoAlg(chain):
 
 # Unit test
 if __name__ == "__main__":
-    from AthenaConfiguration.TestDefaults import defaultTestFiles
+    from AthenaConfiguration.TestDefaults import defaultTestFiles, defaultGeometryTags
     from AthenaConfiguration.AllConfigFlags import initConfigFlags
     flags = initConfigFlags()
     flags.Input.Files = defaultTestFiles.RAW_RUN3
+    flags.GeoModel.AtlasVersion = defaultGeometryTags.RUN3
     flags.lock()
 
     # Ensure all DS identifiers have been added to the EB list:
-- 
GitLab