From 2a262c8f4b15db014a495fb13fddf82d5b0ab1b9 Mon Sep 17 00:00:00 2001
From: John Chapman <jchapman@cern.ch>
Date: Mon, 7 Nov 2022 12:05:31 +0100
Subject: [PATCH] Workaround for CA-based ReSimulation jobs

This ensures that the conditions run number is available during the
initialization again. The CA-based configuration behaviour is now the
same as the legacy configuration. Further debugging is required to see
if this is correct in the case of variable beam spot simulation.
Should fix ATLASSIM-6113.
---
 .../AthenaPOOL/AthenaPoolCnvSvc/python/PoolReadConfig.py    | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/Database/AthenaPOOL/AthenaPoolCnvSvc/python/PoolReadConfig.py b/Database/AthenaPOOL/AthenaPoolCnvSvc/python/PoolReadConfig.py
index 5509d59ae138..34430cbe8bd2 100644
--- a/Database/AthenaPOOL/AthenaPoolCnvSvc/python/PoolReadConfig.py
+++ b/Database/AthenaPOOL/AthenaPoolCnvSvc/python/PoolReadConfig.py
@@ -54,6 +54,12 @@ def EventSelectorAthenaPoolCfg(flags):
             pass
         from AthenaKernel.EventIdOverrideConfig import EvtIdModifierSvcCfg
         result.merge(EvtIdModifierSvcCfg(flags))
+    elif flags.Common.ProductionStep in [ProductionStep.Simulation] and len(flags.Input.RunNumber) and flags.Sim.ISF.ReSimulation:
+        # ReSimulation case
+        evSel.OverrideRunNumber = True
+        evSel.RunNumber = flags.Input.RunNumber[0]
+        if flags.Input.LumiBlockNumber: evSel.FirstLB = flags.Input.LumiBlockNumber[0]
+        evSel.InitialTimeStamp = flags.IOVDb.RunToTimestampDict.get(flags.Input.RunNumber[0], 1)
 
     result.addService(evSel)
     return result
-- 
GitLab