From dd2d3ba7244cbe355259a46ce8c12dc823228fe4 Mon Sep 17 00:00:00 2001
From: John Derek Chapman <chapman@hep.phy.cam.ac.uk>
Date: Tue, 22 Dec 2020 15:17:16 +0000
Subject: [PATCH] Overriding Run Numbers in Component Accumulator based
 configuration

---
 .../python/AllConfigFlags.py                  |  12 +-
 .../python/AutoConfigFlags.py                 |  17 +++
 .../python/RunToTimestampData.py              |   0
 .../python/EventIdOverrideConfig.py           | 131 ++++++++++++++++++
 .../AthenaPoolCnvSvc/python/PoolReadConfig.py |  52 ++++++-
 .../python/DigitizationConfigFlags.py         |   3 -
 .../python/DigitizationParametersConfig.py    |  18 +--
 .../Digitization/python/PileUpConfigNew.py    |   2 +-
 .../python/RunDependentConfigNew.py           |  84 +----------
 .../test/DigitizationPUConfigNew_test.py      |   2 +-
 .../G4AtlasApps/python/G4Atlas_MetadataNew.py |  16 +--
 .../G4AtlasApps/python/SimConfigFlags.py      |   8 --
 .../ISF_SimulationSelectorsConfigNew.py       | 110 +++++++--------
 .../SimuJobTransforms/python/ISF_Skeleton.py  |  60 +-------
 14 files changed, 271 insertions(+), 244 deletions(-)
 rename {Simulation/G4Atlas/G4AtlasApps => Control/AthenaConfiguration}/python/RunToTimestampData.py (100%)
 create mode 100644 Control/AthenaKernel/python/EventIdOverrideConfig.py

diff --git a/Control/AthenaConfiguration/python/AllConfigFlags.py b/Control/AthenaConfiguration/python/AllConfigFlags.py
index 137186d0313e..83e2ed707f96 100644
--- a/Control/AthenaConfiguration/python/AllConfigFlags.py
+++ b/Control/AthenaConfiguration/python/AllConfigFlags.py
@@ -4,7 +4,7 @@ from __future__ import print_function
 
 from AthenaConfiguration.AthConfigFlags import AthConfigFlags
 from AthenaCommon.SystemOfUnits import TeV
-from AthenaConfiguration.AutoConfigFlags import GetFileMD
+from AthenaConfiguration.AutoConfigFlags import GetFileMD, getInitialTimeStampsFromRunNumbers, getRunToTimestampDict
 from PyUtils.moduleExists import moduleExists
 
 
@@ -29,8 +29,14 @@ def _createCfgFlags():
     acf.addFlag('Input.Files', ["_ATHENA_GENERIC_INPUTFILE_NAME_",] ) # former global.InputFiles
     acf.addFlag('Input.SecondaryFiles', []) # secondary input files for DoubleEventSelector
     acf.addFlag('Input.isMC', lambda prevFlags : "IS_SIMULATION" in GetFileMD(prevFlags.Input.Files).get("eventTypes",[]) ) # former global.isMC
+    acf.addFlag('Input.OverrideRunNumber', False )
     acf.addFlag('Input.RunNumber', lambda prevFlags : list(GetFileMD(prevFlags.Input.Files).get("runNumbers",[]))) # former global.RunNumber
     acf.addFlag('Input.LumiBlockNumber', lambda prevFlags : list(GetFileMD(prevFlags.Input.Files).get("lumiBlockNumbers",[]))) # former global.RunNumber
+    acf.addFlag('Input.TimeStamp', lambda prevFlags : [] if not prevFlags.Input.OverrideRunNumber else getInitialTimeStampsFromRunNumbers(prevFlags.Input.RunNumber))
+    # Configure EvtIdModifierSvc with a list of dictionaries of the form:
+    # {'run': 152166, 'lb': 202, 'starttstamp': 1269948352889940910, 'dt': 104.496, 'evts': 1, 'mu': 0.005, 'force_new': False}
+    acf.addFlag("Input.RunAndLumiOverrideList", [])
+
     acf.addFlag('Input.ProjectName', lambda prevFlags : GetFileMD(prevFlags.Input.Files).get("project_name","data17_13TeV") ) # former global.ProjectName
     acf.addFlag('Input.Format', lambda prevFlags : GetFileMD(prevFlags.Input.Files).get("file_type","") ) # former global.InputFormat
 
@@ -137,6 +143,10 @@ def _createCfgFlags():
     acf.addFlag("IOVDb.GlobalTag",lambda prevFlags : GetFileMD(prevFlags.Input.Files).get("IOVDbGlobalTag",None) or "CONDBR2-BLKPA-2017-05")
     from IOVDbSvc.IOVDbAutoCfgFlags import getDatabaseInstanceDefault
     acf.addFlag("IOVDb.DatabaseInstance",getDatabaseInstanceDefault)
+    # Run dependent simulation
+    # map from runNumber to timestamp; migrated from RunDMCFlags.py
+    acf.addFlag("IOVDb.RunToTimestampDict", lambda prevFlags: getRunToTimestampDict())
+
 
     def __bfield():
         from MagFieldConfig.BFieldConfigFlags import createBFieldConfigFlags
diff --git a/Control/AthenaConfiguration/python/AutoConfigFlags.py b/Control/AthenaConfiguration/python/AutoConfigFlags.py
index 5ac59444e947..12958a31c184 100644
--- a/Control/AthenaConfiguration/python/AutoConfigFlags.py
+++ b/Control/AthenaConfiguration/python/AutoConfigFlags.py
@@ -55,3 +55,20 @@ def DetDescrInfo(geoTag):
     detDescrInfo = _initializeGeometryParameters(geoTag)
     detDescrInfo["geomTag"] = geoTag
     return detDescrInfo
+
+
+# Based on RunDMCFlags.py
+def getRunToTimestampDict():
+    # this wrapper is intended to avoid an initial import
+    from .RunToTimestampData import RunToTimestampDict
+    return RunToTimestampDict
+
+
+def getInitialTimeStampsFromRunNumbers(runNumbers):
+    """This is used to hold a dictionary of the form
+    {152166:1269948352889940910, ...} to allow the
+    timestamp to be determined from the run.
+    """
+    run2timestampDict =  getRunToTimestampDict()
+    timeStamps = [run2timestampDict.get(runNumber,1) for runNumber in runNumbers] # Add protection here?
+    return timeStamps
diff --git a/Simulation/G4Atlas/G4AtlasApps/python/RunToTimestampData.py b/Control/AthenaConfiguration/python/RunToTimestampData.py
similarity index 100%
rename from Simulation/G4Atlas/G4AtlasApps/python/RunToTimestampData.py
rename to Control/AthenaConfiguration/python/RunToTimestampData.py
diff --git a/Control/AthenaKernel/python/EventIdOverrideConfig.py b/Control/AthenaKernel/python/EventIdOverrideConfig.py
new file mode 100644
index 000000000000..d49a61ab6280
--- /dev/null
+++ b/Control/AthenaKernel/python/EventIdOverrideConfig.py
@@ -0,0 +1,131 @@
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+
+from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
+from AthenaConfiguration.ComponentFactory import CompFactory
+
+# based on https://acode-browser1.usatlas.bnl.gov/lxr/source/athena/Control/AthenaServices/python/Configurables.py#0247
+def add_modifier(run_nbr=None, evt_nbr=None, time_stamp=None, lbk_nbr=None, nevts=1):
+
+    if run_nbr is None:
+        modify_run_nbr = 0
+        run_nbr = 0
+    else:
+        modify_run_nbr = 1
+
+    if evt_nbr is None:
+        modify_evt_nbr = 0
+        evt_nbr = 0
+    else:
+        modify_evt_nbr = 1
+
+    if time_stamp is None:
+        modify_time_stamp = 0
+        time_stamp = 0
+    else:
+        modify_time_stamp = 1
+
+    if lbk_nbr is None:
+        modify_lbk_nbr = 0
+        lbk_nbr = 0
+    else:
+        modify_lbk_nbr = 1
+
+    mod_bit = int(0b0000
+                  | (modify_run_nbr << 0)
+                  | (modify_evt_nbr << 1)
+                  | (modify_time_stamp << 2)
+                  | (modify_lbk_nbr << 3))
+
+    return [run_nbr, evt_nbr, time_stamp, lbk_nbr, nevts, mod_bit]
+
+
+def buildListOfModifiers(ConfigFlags):
+    # migrated from RunDMCFlags.py
+    Modifiers = []
+    pDicts = ConfigFlags.Input.RunAndLumiOverrideList
+    DataRunNumber = ConfigFlags.Digitization.DataRunNumber
+
+    if pDicts:
+        for el in pDicts:
+            evt_nbr = el.get("evt_nbr", None)
+            Modifiers += add_modifier(run_nbr=el["run"], evt_nbr=evt_nbr, time_stamp=el["starttstamp"], lbk_nbr=el["lb"], nevts=el["evts"])
+    elif DataRunNumber>0:
+        assert DataRunNumber >= 0, (
+            "ConfigFlags.Digitization.DataRunNumber %d is negative. "
+            "Use a real run number from data." % DataRunNumber)
+
+        # Using event numbers to avoid "some very large number" setting
+        totalNumber = 1000000
+        if ConfigFlags.Exec.MaxEvents > 0:
+            totalNumber = ConfigFlags.Exec.MaxEvents + 1
+        if ConfigFlags.Exec.SkipEvents > 0:
+            totalNumber += ConfigFlags.Exec.SkipEvents
+
+        InitialTimeStamp = ConfigFlags.IOVDb.RunToTimestampDict.get(DataRunNumber, 1) # TODO fix repeated configuration
+
+        FirstLB = 1
+        Modifiers += add_modifier(run_nbr=DataRunNumber, lbk_nbr=FirstLB, time_stamp=InitialTimeStamp, nevts=totalNumber)
+    elif ConfigFlags.Input.RunNumber:
+        # Behaviour for Simulation jobs. For standard Simulation we
+        # override the run number once per job. TODO Still need to deal with the specific case of DataOverlay
+        myRunNumber = ConfigFlags.Input.RunNumber[0]
+        assert myRunNumber >= 0, (
+            "ConfigFlags.Input.RunNumber[0] %d is negative. "
+            "Use a real run number from data." % myRunNumber)
+        myFirstLB = ConfigFlags.Input.LumiBlockNumber[0]
+        myInitialTimeStamp = ConfigFlags.Input.TimeStamp[0]
+
+        # Using event numbers to avoid "some very large number" setting
+        totalNumber = 1000000
+        if ConfigFlags.Exec.MaxEvents > 0:
+            totalNumber = ConfigFlags.Exec.MaxEvents + 1
+        if ConfigFlags.Exec.SkipEvents > 0:
+            totalNumber += ConfigFlags.Exec.SkipEvents
+        Modifiers += add_modifier(run_nbr=myRunNumber, lbk_nbr=myFirstLB, time_stamp=myInitialTimeStamp, nevts=totalNumber)
+    return Modifiers
+
+
+def getMinMaxRunNumbers(ConfigFlags):
+    """Get a pair (firstrun,lastrun + 1) for setting ranges in IOVMetaData """
+    mini = 1
+    maxi = 2147483647
+    pDicts = ConfigFlags.Input.RunAndLumiOverrideList
+    if pDicts:
+        # Behaviour for Digitization jobs using RunAndLumiOverrideList
+        allruns = [element['run'] for element in pDicts]
+        mini = min(allruns) + 0
+        maxi = max(allruns) + 1
+    elif ConfigFlags.Digitization.DataRunNumber>0:
+        # Behaviour for Digitization jobs using DataRunNumber
+        DataRunNumber = ConfigFlags.Digitization.DataRunNumber
+        assert DataRunNumber >= 0, (
+            "ConfigFlags.Digitization.DataRunNumber %d is negative. "
+            "Use a real run number from data." % DataRunNumber)
+        mini = DataRunNumber
+        maxi = DataRunNumber+1
+    elif ConfigFlags.Input.RunNumber:
+        # Behaviour for Simulation jobs
+        myRunNumber = ConfigFlags.Input.RunNumber[0]
+        assert myRunNumber >= 0, (
+            "ConfigFlags.Input.RunNumber[0] %d is negative. "
+            "Use a real run number from data." % myRunNumber)
+        mini = myRunNumber
+        maxi = 2147483647
+    return (mini,maxi)
+
+
+def EvtIdModifierSvcCfg(ConfigFlags, name="EvtIdModifierSvc", **kwargs):
+    acc = ComponentAccumulator()
+    if ConfigFlags.Digitization.Pileup or ConfigFlags.Sim.DoFullChain:
+        kwargs.setdefault("EvtStoreName", "OriginalEvent_SG")
+    else:
+        kwargs.setdefault("EvtStoreName", "StoreGateSvc")
+
+    Modifiers = buildListOfModifiers(ConfigFlags)
+    if len(Modifiers) > 0:
+        kwargs.setdefault("Modifiers", Modifiers)
+    acc.addService(CompFactory.EvtIdModifierSvc(name, **kwargs), create=True)
+    iovDbMetaDataTool = CompFactory.IOVDbMetaDataTool()
+    iovDbMetaDataTool.MinMaxRunNumbers = getMinMaxRunNumbers(ConfigFlags)
+    acc.addPublicTool(iovDbMetaDataTool)
+    return acc
diff --git a/Database/AthenaPOOL/AthenaPoolCnvSvc/python/PoolReadConfig.py b/Database/AthenaPOOL/AthenaPoolCnvSvc/python/PoolReadConfig.py
index de15a350b0e8..8779b2921140 100644
--- a/Database/AthenaPOOL/AthenaPoolCnvSvc/python/PoolReadConfig.py
+++ b/Database/AthenaPOOL/AthenaPoolCnvSvc/python/PoolReadConfig.py
@@ -2,6 +2,50 @@
 
 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
 from AthenaConfiguration.ComponentFactory import CompFactory
+from AthenaKernel.EventIdOverrideConfig import EvtIdModifierSvcCfg
+
+def EventSelectorAthenaPoolCfg(configFlags):
+    result=ComponentAccumulator()
+    EventSelectorAthenaPool=CompFactory.EventSelectorAthenaPool
+    evSel=EventSelectorAthenaPool("EventSelector",
+                                  InputCollections = configFlags.Input.Files,
+                                  SkipEvents=configFlags.Exec.SkipEvents)
+    if configFlags.Input.OverrideRunNumber:
+        if not configFlags.Input.RunAndLumiOverrideList:
+            DataRunNumber = -1
+            FirstLB = 1
+            InitialTimeStamp = 1
+            OldRunNumber = -1
+            if configFlags.Digitization.DataRunNumber>0:
+                # Behaviour for Digitization jobs using DataRunNumber
+                DataRunNumber = configFlags.Digitization.DataRunNumber
+                FirstLB = 1
+                InitialTimeStamp = configFlags.IOVDb.RunToTimestampDict.get(DataRunNumber, 1) # TODO fix repeated configuration
+                if not configFlags.Sim.DoFullChain:
+                    OldRunNumber = configFlags.Input.RunNumber[0] # CHECK this should be the Run Number from the HITS file
+            elif configFlags.Input.RunNumber:
+                # Behaviour for Simulation jobs
+                DataRunNumber = configFlags.Input.RunNumber[0]
+                FirstLB = configFlags.Input.LumiBlockNumber[0]
+                InitialTimeStamp = configFlags.Input.TimeStamp[0]
+            assert DataRunNumber >= 0, (
+                "configFlags.Input.OverrideRunNumber was True, but provided DataRunNumber (%d) is negative. "
+                "Use a real run number from data." % DataRunNumber)
+            evSel.OverrideRunNumber = configFlags.Input.OverrideRunNumber
+            evSel.RunNumber = DataRunNumber
+            evSel.FirstLB = FirstLB
+            evSel.InitialTimeStamp = InitialTimeStamp # Necessary to avoid a crash
+            if hasattr(evSel, "OverrideRunNumberFromInput"):
+                evSel.OverrideRunNumberFromInput = configFlags.Input.OverrideRunNumber
+            if OldRunNumber > 0:
+                evSel.OldRunNumber = OldRunNumber
+        else:
+            # Behaviour for Digitization jobs using RunAndLumiOverrideList
+            pass
+        result.merge(EvtIdModifierSvcCfg(configFlags))
+    result.addService(evSel)
+    return result
+
 
 def PoolReadCfg(configFlags):
     """
@@ -70,17 +114,15 @@ def PoolReadCfg(configFlags):
                                                    IsSecondary=True,
                                                    InputCollections=filenamesSecondary)
             result.addService(secondarySel)
+        result.addService(evSel)
     else:
         # We have only primary inputs
         apaps=AthenaPoolAddressProviderSvc()
         result.addService(apaps)
         result.addService(ProxyProviderSvc(ProviderNames=[apaps.getFullJobOptName(),])) #No service handle yet???
+        result.merge(EventSelectorAthenaPoolCfg(configFlags))
+        evSel = result.getService("EventSelector")
 
-        evSel=EventSelectorAthenaPool("EventSelector", 
-                                      InputCollections = filenames, 
-                                      SkipEvents=configFlags.Exec.SkipEvents)
-
-    result.addService(evSel)
     result.setAppProperty("EvtSel",evSel.getFullJobOptName())
 
     #(possibly) missing: MetaDataSvc
diff --git a/Simulation/Digitization/python/DigitizationConfigFlags.py b/Simulation/Digitization/python/DigitizationConfigFlags.py
index 9bd2e33ff737..b89326551cc6 100644
--- a/Simulation/Digitization/python/DigitizationConfigFlags.py
+++ b/Simulation/Digitization/python/DigitizationConfigFlags.py
@@ -140,9 +140,6 @@ def createDigitizationCfgFlags():
     flags.addFlag("Digitization.PU.NumberOfCavern", 0.0)
     # Repeating pattern to determine which events to simulate when using Stepping Cache
     flags.addFlag("Digitization.PU.SignalPatternForSteppingCache", [])
-    # Configure EvtIdModifierSvc with a list of dictionaries of the form:
-    # {'run': 152166, 'lb': 202, 'starttstamp': 1269948352889940910, 'dt': 104.496, 'evts': 1, 'mu': 0.005, 'force_new': False}
-    flags.addFlag("Digitization.PU.RunAndLumiOverrideList", [])
     
     return flags
 
diff --git a/Simulation/Digitization/python/DigitizationParametersConfig.py b/Simulation/Digitization/python/DigitizationParametersConfig.py
index 87f1fc7848f8..07779269ecc5 100644
--- a/Simulation/Digitization/python/DigitizationParametersConfig.py
+++ b/Simulation/Digitization/python/DigitizationParametersConfig.py
@@ -1,27 +1,13 @@
 # Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
+from AthenaKernel.EventIdOverrideConfig import getMinMaxRunNumbers
 from AthenaCommon.Logging import logging
 logDigitizationWriteMetadata = logging.getLogger( 'DigitizationParametersConfig' )
 
-myRunNumber = 0
-myEndRunNumber = 2147483647 # the max run number
-
-def getRunNumberRangeForOutputMetadata(ConfigFlags):
-    myRunNumber = ConfigFlags.Input.RunNumber[0]
-    myEndRunNumber = 2147483647 # the max run number
-
-    if myRunNumber > 0 :
-        logDigitizationWriteMetadata.info('Found Run Number %s in hits file metadata.', str(myRunNumber) )
-        myEndRunNumber = myRunNumber+1 # got a reasonable run number so set end run to be the next run after this one.
-    else :
-        logDigitizationWriteMetadata.info('Found unexpected Run Number %s in hits file metadata. Not overriding RunNumber to match hits file for this job.', str(myRunNumber) )
-        myRunNumber = 0
-    return myRunNumber, myEndRunNumber
-
 def writeDigitizationMetadata(ConfigFlags):
     from IOVDbMetaDataTools import ParameterDbFiller
     dbFiller = ParameterDbFiller.ParameterDbFiller()
-    myRunNumber, myEndRunNumber = getRunNumberRangeForOutputMetadata(ConfigFlags)
+    myRunNumber, myEndRunNumber = getMinMaxRunNumbers(ConfigFlags)
     logDigitizationWriteMetadata.debug('ParameterDbFiller BeginRun = %s', str(myRunNumber) )
     dbFiller.setBeginRun(myRunNumber)
     logDigitizationWriteMetadata.debug('ParameterDbFiller EndRun   = %s', str(myEndRunNumber) )
diff --git a/Simulation/Digitization/python/PileUpConfigNew.py b/Simulation/Digitization/python/PileUpConfigNew.py
index 72194f7b362e..691d9ed10021 100644
--- a/Simulation/Digitization/python/PileUpConfigNew.py
+++ b/Simulation/Digitization/python/PileUpConfigNew.py
@@ -311,7 +311,7 @@ def PileUpEventLoopMgrCfg(flags, name="PileUpEventLoopMgr", **kwargs):
     kwargs.setdefault("firstXing", flags.Digitization.PU.InitialBunchCrossing)
     kwargs.setdefault("lastXing", flags.Digitization.PU.FinalBunchCrossing)
 
-    if flags.Digitization.PU.RunAndLumiOverrideList:
+    if flags.Input.RunAndLumiOverrideList:
         kwargs.setdefault("MaxMinBiasCollPerXing", maxNevtsPerXing(flags))
         acc.merge(LumiProfileSvcCfg(flags))
         kwargs.setdefault("BeamLuminosity", acc.getService("LumiProfileSvc"))
diff --git a/Simulation/Digitization/python/RunDependentConfigNew.py b/Simulation/Digitization/python/RunDependentConfigNew.py
index 8aa31ec86093..84273ffbe660 100644
--- a/Simulation/Digitization/python/RunDependentConfigNew.py
+++ b/Simulation/Digitization/python/RunDependentConfigNew.py
@@ -8,74 +8,10 @@ from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
 from AthenaConfiguration.ComponentFactory import CompFactory
 
 # Auxiliary
-def add_modifier(run_nbr=None, evt_nbr=None, time_stamp=None, lbk_nbr=None, nevts=1):
-    
-    if run_nbr is None:
-        modify_run_nbr = 0
-        run_nbr = 0
-    else:
-        modify_run_nbr = 1
-
-    if evt_nbr is None:
-        modify_evt_nbr = 0
-        evt_nbr = 0
-    else:
-        modify_evt_nbr = 1
-
-    if time_stamp is None:
-        modify_time_stamp = 0
-        time_stamp = 0
-    else:
-        modify_time_stamp = 1
-
-    if lbk_nbr is None:
-        modify_lbk_nbr = 0
-        lbk_nbr = 0
-    else:
-        modify_lbk_nbr = 1
-
-    mod_bit = int(0b0000
-                  | (modify_run_nbr << 0)
-                  | (modify_evt_nbr << 1)
-                  | (modify_time_stamp << 2)
-                  | (modify_lbk_nbr << 3))
-
-    return [run_nbr, evt_nbr, time_stamp, lbk_nbr, nevts, mod_bit]
-
-
-def buildListOfModifiers(flags):
-    # migrated from RunDMCFlags.py
-    Modifiers = []
-    pDicts = flags.Digitization.PU.RunAndLumiOverrideList
-    DataRunNumber = flags.Digitization.DataRunNumber
-    
-    if pDicts:
-        for el in pDicts:
-            evt_nbr = el.get("evt_nbr", None)
-            Modifiers += add_modifier(run_nbr=el["run"], evt_nbr=evt_nbr, time_stamp=el["starttstamp"], lbk_nbr=el["lb"], nevts=el["evts"])
-    elif DataRunNumber:
-        assert DataRunNumber >= 0, (
-            "flags.Digitization.DataRunNumber %d is negative. "
-            "Use a real run number from data." % DataRunNumber)
-        
-        # Using event numbers to avoid "some very large number" setting
-        totalNumber = 1000000
-        if flags.Exec.MaxEvents > 0:
-            totalNumber = flags.Exec.MaxEvents + 1
-        if flags.Exec.SkipEvents > 0:
-            totalNumber += flags.Exec.SkipEvents
-            
-        InitialTimeStamp = flags.Sim.RunToTimestampDict.get(DataRunNumber, 1)
-
-        FirstLB = 1
-        Modifiers += add_modifier(run_nbr=DataRunNumber, lbk_nbr=FirstLB, time_stamp=InitialTimeStamp, nevts=totalNumber)
-    return Modifiers
-
-
 def maxNevtsPerXing(flags):
     """Return the largest minbias pileup value, for PileUpEvtLoopMgr caches"""
     # migrated from DigitizationFlags.py
-    pDicts = flags.Digitization.PU.RunAndLumiOverrideList
+    pDicts = flags.Input.RunAndLumiOverrideList
     return max(element["mu"] for element in pDicts)
 
 
@@ -83,7 +19,7 @@ def runLumiListAndScaleFactorLists(flags):
     # migrated from DigitizationFlags.py
     runLumiList = []
     scaleFactorList = []
-    pDicts = flags.Digitization.PU.RunAndLumiOverrideList
+    pDicts = flags.Input.RunAndLumiOverrideList
     MaxCollisionsPerXing = maxNevtsPerXing(flags)
     for element in pDicts:
         run = element["run"]
@@ -99,22 +35,6 @@ def runLumiListAndScaleFactorLists(flags):
 
 
 # Config
-def EvtIdModifierSvcCfg(flags, name="EvtIdModifierSvc", **kwargs):
-    acc = ComponentAccumulator()
-    
-    if flags.Sim.DoFullChain:
-        kwargs.setdefault("EvtStoreName", "OriginalEvent_SG")
-    else:
-        kwargs.setdefault("EvtStoreName", "StoreGateSvc")
-
-    Modifiers = buildListOfModifiers(flags)
-    if len(Modifiers) > 0:
-        kwargs.setdefault("Modifiers", Modifiers)
-
-    acc.addService(CompFactory.EvtIdModifierSvc(name, **kwargs), create=True)
-    return acc
-
-
 def LumiProfileSvcCfg(flags, name="LumiProfileSvc", **kwargs):
     acc = ComponentAccumulator()
     runLumiList, scaleFactorList = runLumiListAndScaleFactorLists(flags)
diff --git a/Simulation/Digitization/test/DigitizationPUConfigNew_test.py b/Simulation/Digitization/test/DigitizationPUConfigNew_test.py
index 74545bff0733..6f34bdafd0d2 100755
--- a/Simulation/Digitization/test/DigitizationPUConfigNew_test.py
+++ b/Simulation/Digitization/test/DigitizationPUConfigNew_test.py
@@ -126,7 +126,7 @@ ConfigFlags.Tile.correctTime = False
 ConfigFlags.lock()
 
 # test this flag
-ConfigFlags.Sim.RunToTimestampDict
+ConfigFlags.IOVDb.RunToTimestampDict
 
 # Core components
 acc = MainServicesCfg(ConfigFlags)
diff --git a/Simulation/G4Atlas/G4AtlasApps/python/G4Atlas_MetadataNew.py b/Simulation/G4Atlas/G4AtlasApps/python/G4Atlas_MetadataNew.py
index f075b62cf844..d37613c34c0b 100644
--- a/Simulation/G4Atlas/G4AtlasApps/python/G4Atlas_MetadataNew.py
+++ b/Simulation/G4Atlas/G4AtlasApps/python/G4Atlas_MetadataNew.py
@@ -2,6 +2,7 @@
 
 ### This module contains functions which may need to peek at the input file metadata
 
+from AthenaKernel.EventIdOverrideConfig import getMinMaxRunNumbers
 ## Get the logger
 from AthenaCommon.Logging import logging
 simMDlog = logging.getLogger('Sim_Metadata')
@@ -26,7 +27,6 @@ def fillAtlasMetadata(ConfigFlags, dbFiller):
 
     #---------  
     ## Simulated detector flags: add each enabled detector to the simulatedDetectors list
-    from AthenaCommon.DetFlags import DetFlags  # noqa: F401
     simDets = []
     for det in ['Pixel','SCT','TRT','BCM','Lucid','ZDC','ALFA','AFP','FwdRegion','LAr','HGTD','Tile','MDT','CSC','TGC','RPC','MM','sTGC','Truth','LVL1']:
         attrname = "Detector.Geometry"+det
@@ -50,22 +50,10 @@ def fillISFMetadata(dbFiller):
     dbFiller.addSimParam('Simulator', ISF_Flags.Simulator())
 
 
-def getRunNumberRangeForOutputMetadata(ConfigFlags):
-    myRunNumber = ConfigFlags.Input.RunNumber[0]
-    myEndRunNumber = 2147483647 # the max run number
-
-    #if myRunNumber > 0 :
-    #    simMDlog.info('Found Run Number %s in hits file metadata.', str(myRunNumber) )
-    #    myEndRunNumber = myRunNumber+1 # got a reasonable run number so set end run to be the next run after this one.
-    #else :
-    #    simMDlog.info('Found unexpected Run Number %s in hits file metadata. Not overriding RunNumber to match hits file for this job.', str(myRunNumber) )
-    #    myRunNumber = 0
-    return myRunNumber, myEndRunNumber
-
 def writeSimulationParametersMetadata(ConfigFlags):
     from IOVDbMetaDataTools import ParameterDbFiller
     dbFiller = ParameterDbFiller.ParameterDbFiller()
-    myRunNumber, myEndRunNumber = getRunNumberRangeForOutputMetadata(ConfigFlags)
+    myRunNumber, myEndRunNumber = getMinMaxRunNumbers(ConfigFlags)
     simMDlog.debug('ParameterDbFiller BeginRun = %s', str(myRunNumber) )
     dbFiller.setBeginRun(myRunNumber)
     simMDlog.debug('ParameterDbFiller EndRun   = %s', str(myEndRunNumber) )
diff --git a/Simulation/G4Atlas/G4AtlasApps/python/SimConfigFlags.py b/Simulation/G4Atlas/G4AtlasApps/python/SimConfigFlags.py
index 764ce875c6da..c9eac2b62a4c 100644
--- a/Simulation/G4Atlas/G4AtlasApps/python/SimConfigFlags.py
+++ b/Simulation/G4Atlas/G4AtlasApps/python/SimConfigFlags.py
@@ -127,14 +127,6 @@ def createSimConfigFlags():
     scf.addFlag("Sim.Fatras.GaussianMixtureModel", True) # use Gaussian mixture model for Multiple Scattering
     scf.addFlag("Sim.Fatras.BetheHeitlerScale", 1.) # scale to Bethe-Heitler contribution
 
-    # Run dependent simulation
-    # map from runNumber to timestamp; migrated from RunDMCFlags.py
-    def getRunToTimestampDict():
-        # this wrapper is intended to avoid an initial import
-        from G4AtlasApps.RunToTimestampData import RunToTimestampDict
-        return RunToTimestampDict
-    scf.addFlag("Sim.RunToTimestampDict", lambda prevFlags: getRunToTimestampDict())
-
     scf.addFlag("Sim.BeamPipeCut", 100.0)
     scf.addFlag("Sim.TightMuonStepping", False)
 
diff --git a/Simulation/ISF/ISF_SimulationSelectors/python/ISF_SimulationSelectorsConfigNew.py b/Simulation/ISF/ISF_SimulationSelectors/python/ISF_SimulationSelectorsConfigNew.py
index 2031035e3a0f..5085814f5c98 100644
--- a/Simulation/ISF/ISF_SimulationSelectors/python/ISF_SimulationSelectorsConfigNew.py
+++ b/Simulation/ISF/ISF_SimulationSelectors/python/ISF_SimulationSelectorsConfigNew.py
@@ -33,7 +33,7 @@ def DefaultSimSelectorCfg(flags, name="ISF_DefaultSimSelector", **kwargs):
 
 def DefaultParticleKillerSelectorCfg(flags, name="ISF_DefaultParticleKillerSelector", **kwargs):
     acc = ParticleKillerSvcCfg(flags)
-    if flags.Concurrency.NumThreads == 0:
+    if flags.Concurrency.NumThreads == 0 and 'MT' not in flags.Sim.ISF.Simulator:
         kwargs.setdefault("Simulator", acc.getService("ISF_ParticleKillerSvc"))
     kwargs.setdefault("SimulationFlavor", SimulationFlavor.ParticleKiller)
     acc.merge(DefaultSimSelectorCfg(flags, name, **kwargs))
@@ -43,7 +43,7 @@ def DefaultParticleKillerSelectorCfg(flags, name="ISF_DefaultParticleKillerSelec
 def PileupParticleKillerSelectorCfg(flags, name="ISF_PileupParticleKillerSelector", **kwargs):
     acc = ParticleKillerSvcCfg(flags)
     kwargs.setdefault("PileupBCID", [1])
-    if flags.Concurrency.NumThreads == 0:
+    if flags.Concurrency.NumThreads == 0 and 'MT' not in flags.Sim.ISF.Simulator:
         kwargs.setdefault("Simulator", acc.getService("ISF_ParticleKillerSvc"))
     kwargs.setdefault("SimulationFlavor", SimulationFlavor.ParticleKiller)
     acc.addPublicTool(CompFactory.ISF.KinematicPileupSimSelector(name, **kwargs))
@@ -52,7 +52,7 @@ def PileupParticleKillerSelectorCfg(flags, name="ISF_PileupParticleKillerSelecto
 
 def DefaultGeant4SelectorCfg(flags, name="ISF_DefaultGeant4Selector", **kwargs):
     acc = Geant4SimCfg(flags)
-    if flags.Concurrency.NumThreads == 0:
+    if flags.Concurrency.NumThreads == 0 and 'MT' not in flags.Sim.ISF.Simulator:
         kwargs.setdefault("Simulator", acc.getService("ISFG4SimSvc"))
     kwargs.setdefault("SimulationFlavor", SimulationFlavor.Geant4)
     acc.merge(DefaultSimSelectorCfg(flags, name, **kwargs))
@@ -61,7 +61,7 @@ def DefaultGeant4SelectorCfg(flags, name="ISF_DefaultGeant4Selector", **kwargs):
 
 def DefaultAFIIGeant4SelectorCfg(flags, name="ISF_DefaultAFIIGeant4Selector", **kwargs):
     acc = AFIIGeant4SimCfg(flags)
-    if flags.Concurrency.NumThreads == 0:
+    if flags.Concurrency.NumThreads == 0 and 'MT' not in flags.Sim.ISF.Simulator:
         kwargs.setdefault("Simulator", acc.getService("ISF_AFIIGeant4SimSvc"))
     acc.merge(DefaultGeant4SelectorCfg(flags, name, **kwargs))
     return acc
@@ -69,7 +69,7 @@ def DefaultAFIIGeant4SelectorCfg(flags, name="ISF_DefaultAFIIGeant4Selector", **
 
 def DefaultLongLivedGeant4SelectorCfg(flags, name="ISF_DefaultLongLivedGeant4Selector", **kwargs):
     acc = LongLivedGeant4SimCfg(flags)
-    if flags.Concurrency.NumThreads == 0:
+    if flags.Concurrency.NumThreads == 0 and 'MT' not in flags.Sim.ISF.Simulator:
         kwargs.setdefault("Simulator", acc.getService("ISF_LongLivedGeant4SimSvc"))
     acc.merge(DefaultGeant4SelectorCfg(flags, name, **kwargs))
     return acc
@@ -77,7 +77,7 @@ def DefaultLongLivedGeant4SelectorCfg(flags, name="ISF_DefaultLongLivedGeant4Sel
 
 def DefaultAFII_QS_Geant4SelectorCfg(flags, name="ISF_DefaultAFII_QS_Geant4Selector", **kwargs):
     acc = AFII_QS_Geant4SimCfg(flags)
-    if flags.Concurrency.NumThreads == 0:
+    if flags.Concurrency.NumThreads == 0 and 'MT' not in flags.Sim.ISF.Simulator:
         kwargs.setdefault("Simulator", acc.getService("ISF_AFII_QS_Geant4SimSvc"))
     acc.merge(DefaultGeant4SelectorCfg(flags, name, **kwargs))
     return acc
@@ -85,7 +85,7 @@ def DefaultAFII_QS_Geant4SelectorCfg(flags, name="ISF_DefaultAFII_QS_Geant4Selec
 
 def FullGeant4SelectorCfg(flags, name="ISF_FullGeant4Selector", **kwargs):
     acc = ComponentAccumulator()
-    if flags.Concurrency.NumThreads == 0:
+    if flags.Concurrency.NumThreads == 0 and 'MT' not in flags.Sim.ISF.Simulator:
         acc.merge(FullGeant4SimCfg(flags))
         kwargs.setdefault("Simulator", acc.getService("ISF_FullGeant4SimSvc"))
     kwargs.setdefault("SimulationFlavor", SimulationFlavor.Geant4)
@@ -95,7 +95,7 @@ def FullGeant4SelectorCfg(flags, name="ISF_FullGeant4Selector", **kwargs):
 
 def PassBackGeant4SelectorCfg(flags, name="ISF_PassBackGeant4Selector", **kwargs):
     acc = PassBackGeant4SimCfg(flags)
-    if flags.Concurrency.NumThreads == 0:
+    if flags.Concurrency.NumThreads == 0 and 'MT' not in flags.Sim.ISF.Simulator:
         kwargs.setdefault("Simulator", acc.getService("ISF_PassBackGeant4SimSvc"))
     kwargs.setdefault("SimulationFlavor", SimulationFlavor.Geant4)
     acc.merge(DefaultSimSelectorCfg(flags, name, **kwargs))
@@ -104,7 +104,7 @@ def PassBackGeant4SelectorCfg(flags, name="ISF_PassBackGeant4Selector", **kwargs
 
 def DefaultFastCaloSimSelectorCfg(flags, name="ISF_DefaultFastCaloSimSelector", **kwargs):
     acc = FastCaloSimSvcCfg(flags)
-    if flags.Concurrency.NumThreads == 0:
+    if flags.Concurrency.NumThreads == 0 and 'MT' not in flags.Sim.ISF.Simulator:
         kwargs.setdefault("Simulator", acc.getService("ISF_FastCaloSimSvc"))
     kwargs.setdefault("SimulationFlavor", SimulationFlavor.FastCaloSim)
     acc.merge(DefaultSimSelectorCfg(flags, name, **kwargs))
@@ -113,7 +113,7 @@ def DefaultFastCaloSimSelectorCfg(flags, name="ISF_DefaultFastCaloSimSelector",
 
 def DefaultLegacyAFIIFastCaloSimSelectorCfg(flags, name="ISF_DefaultLegacyAFIIFastCaloSimSelector", **kwargs):
     acc = LegacyAFIIFastCaloSimSvcCfg(flags)
-    if flags.Concurrency.NumThreads == 0:
+    if flags.Concurrency.NumThreads == 0 and 'MT' not in flags.Sim.ISF.Simulator:
         kwargs.setdefault("Simulator", acc.getService("ISF_LegacyAFIIFastCaloSimSvc"))
     kwargs.setdefault("SimulationFlavor", SimulationFlavor.FastCaloSim)
     acc.merge(DefaultSimSelectorCfg(flags, name, **kwargs))
@@ -122,7 +122,7 @@ def DefaultLegacyAFIIFastCaloSimSelectorCfg(flags, name="ISF_DefaultLegacyAFIIFa
 
 def DefaultFastCaloSimV2SelectorCfg(flags, name="ISF_DefaultFastCaloSimV2Selector", **kwargs):
     acc = FastCaloSimV2SvcCfg(flags)
-    if flags.Concurrency.NumThreads == 0:
+    if flags.Concurrency.NumThreads == 0 and 'MT' not in flags.Sim.ISF.Simulator:
         kwargs.setdefault("Simulator", acc.getService("ISF_FastCaloSimSvcV2"))
     kwargs.setdefault("SimulationFlavor", SimulationFlavor.FastCaloSimV2)
     acc.merge(DefaultSimSelectorCfg(flags, name, **kwargs))
@@ -131,7 +131,7 @@ def DefaultFastCaloSimV2SelectorCfg(flags, name="ISF_DefaultFastCaloSimV2Selecto
 
 def DefaultDNNCaloSimSelectorCfg(flags, name="ISF_DefaultDNNCaloSimSelector", **kwargs):
     acc = DNNCaloSimSvcCfg(flags)
-    if flags.Concurrency.NumThreads == 0:
+    if flags.Concurrency.NumThreads == 0 and 'MT' not in flags.Sim.ISF.Simulator:
         kwargs.setdefault("Simulator", acc.getService("ISF_DNNCaloSimSvc"))
     acc.merge(DefaultSimSelectorCfg(flags, name, **kwargs))
     return acc
@@ -140,7 +140,7 @@ def DefaultDNNCaloSimSelectorCfg(flags, name="ISF_DefaultDNNCaloSimSelector", **
 def FastHitConvAlgFastCaloSimSelectorCfg(flags, name="ISF_FastHitConvAlgFastCaloSimSelector", **kwargs):
     acc = ComponentAccumulator()
     acc.merge(FastHitConvAlgFastCaloSimSvcCfg(flags))
-    if flags.Concurrency.NumThreads == 0:
+    if flags.Concurrency.NumThreads == 0 and 'MT' not in flags.Sim.ISF.Simulator:
         kwargs.setdefault("Simulator", acc.getService("ISF_FastHitConvAlgFastCaloSimSvc"))
     kwargs.setdefault("SimulationFlavor", SimulationFlavor.FastCaloSim)
     acc.merge(DefaultSimSelectorCfg(flags, name, **kwargs))
@@ -150,7 +150,7 @@ def FastHitConvAlgFastCaloSimSelectorCfg(flags, name="ISF_FastHitConvAlgFastCalo
 def FastHitConvAlgLegacyAFIIFastCaloSimSelectorCfg(flags, name="ISF_FastHitConvAlgLegacyAFIIFastCaloSimSelector", **kwargs):
     acc = ComponentAccumulator()
     acc.merge(FastHitConvAlgLegacyAFIIFastCaloSimSvcCfg(flags))
-    if flags.Concurrency.NumThreads == 0:
+    if flags.Concurrency.NumThreads == 0 and 'MT' not in flags.Sim.ISF.Simulator:
         kwargs.setdefault("Simulator", acc.getService("ISF_FastHitConvAlgLegacyAFIIFastCaloSimSvc"))
     kwargs.setdefault("SimulationFlavor", SimulationFlavor.FastCaloSim)
     acc.merge(DefaultSimSelectorCfg(flags, name, **kwargs))
@@ -159,7 +159,7 @@ def FastHitConvAlgLegacyAFIIFastCaloSimSelectorCfg(flags, name="ISF_FastHitConvA
 
 def DefaultFatrasSelectorCfg(flags, name="ISF_DefaultFatrasSelector", **kwargs):
     acc = fatrasSimServiceIDCfg(flags)
-    if flags.Concurrency.NumThreads == 0:
+    if flags.Concurrency.NumThreads == 0 and 'MT' not in flags.Sim.ISF.Simulator:
         kwargs.setdefault("Simulator", acc.getService("ISF_FatrasSimSvc"))
     kwargs.setdefault("SimulationFlavor", SimulationFlavor.Fatras)
     acc.merge(DefaultSimSelectorCfg(flags, name, **kwargs))
@@ -169,7 +169,7 @@ def DefaultFatrasSelectorCfg(flags, name="ISF_DefaultFatrasSelector", **kwargs):
 def DefaultFatrasNewExtrapolationSelectorCfg(flags, name="ISF_DefaultFatrasNewExtrapolationSelector", **kwargs):
     acc = ComponentAccumulator()
     acc.merge(fatrasNewExtrapolationSimServiceIDCfg(flags))
-    if flags.Concurrency.NumThreads == 0:
+    if flags.Concurrency.NumThreads == 0 and 'MT' not in flags.Sim.ISF.Simulator:
         kwargs.setdefault("Simulator", acc.getService("ISF_FatrasNewExtrapolationSimSvc"))
     kwargs.setdefault("SimulationFlavor", SimulationFlavor.Fatras)
     acc.merge(DefaultSimSelectorCfg(flags, name, **kwargs))
@@ -178,7 +178,7 @@ def DefaultFatrasNewExtrapolationSelectorCfg(flags, name="ISF_DefaultFatrasNewEx
 
 def DefaultParametricSimulationSelectorCfg(flags, name="ISF_DefaultParametricSimulationSelector", **kwargs):
     acc = ComponentAccumulator()
-    if flags.Concurrency.NumThreads == 0:
+    if flags.Concurrency.NumThreads == 0 and 'MT' not in flags.Sim.ISF.Simulator:
         kwargs.setdefault("Simulator", "ISF_ParametricSimSvc") # TODO
     kwargs.setdefault("SimulationFlavor", SimulationFlavor.Parametric)
     acc.merge(DefaultSimSelectorCfg(flags, name, **kwargs))
@@ -196,7 +196,7 @@ def FatrasPileupSelectorCfg(flags, name="ISF_FatrasPileupSelector", **kwargs):
     acc = ComponentAccumulator()
     acc.merge(fatrasPileupSimServiceIDCfg(flags))
     kwargs.setdefault("PileupBCID", [1])
-    if flags.Concurrency.NumThreads == 0:
+    if flags.Concurrency.NumThreads == 0 and 'MT' not in flags.Sim.ISF.Simulator:
         kwargs.setdefault("Simulator", acc.getService("ISF_FatrasPileupSimSvc"))
     kwargs.setdefault("SimulationFlavor", SimulationFlavor.FatrasPileup)
     acc.merge(PileupSimSelectorCfg(flags, name, **kwargs))
@@ -210,7 +210,7 @@ def FatrasPileupSelectorCfg(flags, name="ISF_FatrasPileupSelector", **kwargs):
 def FastCaloSimPileupSelectorCfg(flags, name="ISF_FastCaloSimPileupSelector", **kwargs):
     acc = FastCaloSimPileupSvcCfg(flags)
     kwargs.setdefault("PileupBCID"  , flags.Sim.FastChain.BCID)
-    if flags.Concurrency.NumThreads == 0:
+    if flags.Concurrency.NumThreads == 0 and 'MT' not in flags.Sim.ISF.Simulator:
         kwargs.setdefault("Simulator", acc.getService("ISF_FastCaloSimPileupSvc"))
     kwargs.setdefault("SimulationFlavor", SimulationFlavor.FastCaloSimPileup)
     acc.merge(PileupSimSelectorCfg(flags, name, **kwargs))
@@ -220,7 +220,7 @@ def FastCaloSimPileupSelectorCfg(flags, name="ISF_FastCaloSimPileupSelector", **
 def FastCaloSimPileupOTSelectorCfg(flags, name="ISF_FastCaloSimPileupOTSelector", **kwargs):
     acc = FastCaloSimPileupOTSvcCfg(flags)
     kwargs.setdefault("PileupBCID", flags.Sim.FastChain.BCID)
-    if flags.Concurrency.NumThreads == 0:
+    if flags.Concurrency.NumThreads == 0 and 'MT' not in flags.Sim.ISF.Simulator:
         kwargs.setdefault("Simulator", acc.getService("ISF_FastCaloSimPileupOTSvc"))
     kwargs.setdefault("SimulationFlavor", SimulationFlavor.FastCaloSimPileup)
     acc.merge(PileupSimSelectorCfg(flags, name, **kwargs))
@@ -231,7 +231,7 @@ def FastCaloSimPileupOTSelectorCfg(flags, name="ISF_FastCaloSimPileupOTSelector"
 def ElectronGeant4SelectorCfg(flags, name="ISF_ElectronGeant4Selector", **kwargs):
     acc = Geant4SimCfg(flags)
     kwargs.setdefault("ParticlePDG", 11)
-    if flags.Concurrency.NumThreads == 0:
+    if flags.Concurrency.NumThreads == 0 and 'MT' not in flags.Sim.ISF.Simulator:
         kwargs.setdefault("Simulator", acc.getService("ISFG4SimSvc"))
     kwargs.setdefault("SimulationFlavor", SimulationFlavor.Geant4)
     acc.addPublicTool(CompFactory.ISF.KinematicSimSelector(name, **kwargs))
@@ -241,7 +241,7 @@ def ElectronGeant4SelectorCfg(flags, name="ISF_ElectronGeant4Selector", **kwargs
 def NeutralGeant4SelectorCfg(flags, name="ISF_NeutralGeant4Selector", **kwargs):
     acc = Geant4SimCfg(flags)
     kwargs.setdefault("Charge", 0)
-    if flags.Concurrency.NumThreads == 0:
+    if flags.Concurrency.NumThreads == 0 and 'MT' not in flags.Sim.ISF.Simulator:
         kwargs.setdefault("Simulator", acc.getService("ISFG4SimSvc"))
     kwargs.setdefault("SimulationFlavor", SimulationFlavor.Geant4)
     acc.addPublicTool(CompFactory.ISF.KinematicSimSelector(name, **kwargs))
@@ -252,7 +252,7 @@ def ProtonAFIIGeant4SelectorCfg(flags, name="ISF_ProtonAFIIGeant4Selector", **kw
     acc = AFIIGeant4SimCfg(flags)
     kwargs.setdefault("MaxMom", 750)
     kwargs.setdefault("ParticlePDG", 2212)
-    if flags.Concurrency.NumThreads == 0:
+    if flags.Concurrency.NumThreads == 0 and 'MT' not in flags.Sim.ISF.Simulator:
         kwargs.setdefault("Simulator", acc.getService("ISF_AFIIGeant4SimSvc"))
     kwargs.setdefault("SimulationFlavor", SimulationFlavor.Geant4)
     acc.addPublicTool(CompFactory.ISF.KinematicSimSelector(name, **kwargs))
@@ -261,7 +261,7 @@ def ProtonAFIIGeant4SelectorCfg(flags, name="ISF_ProtonAFIIGeant4Selector", **kw
 
 def ProtonAFII_QS_Geant4SelectorCfg(flags, name="ISF_ProtonAFII_QS_Geant4Selector", **kwargs):
     acc = AFII_QS_Geant4SimCfg(flags)
-    if flags.Concurrency.NumThreads == 0:
+    if flags.Concurrency.NumThreads == 0 and 'MT' not in flags.Sim.ISF.Simulator:
         kwargs.setdefault("Simulator", acc.getService("ISF_AFII_QS_Geant4SimSvc"))
     acc.merge(ProtonAFIIGeant4SelectorCfg(flags, name, **kwargs))
     return acc
@@ -271,7 +271,7 @@ def PionAFIIGeant4SelectorCfg(flags, name="ISF_PionAFIIGeant4Selector", **kwargs
     acc = AFIIGeant4SimCfg(flags)
     kwargs.setdefault("MaxMom", 200)
     kwargs.setdefault("ParticlePDG", 211)
-    if flags.Concurrency.NumThreads == 0:
+    if flags.Concurrency.NumThreads == 0 and 'MT' not in flags.Sim.ISF.Simulator:
         kwargs.setdefault("Simulator", acc.getService("ISF_AFIIGeant4SimSvc"))
     kwargs.setdefault("SimulationFlavor", SimulationFlavor.Geant4)
     acc.addPublicTool(CompFactory.ISF.KinematicSimSelector(name, **kwargs))
@@ -282,7 +282,7 @@ def PionG4FastCaloGeant4Selector(flags, name="ISF_PionG4FastCaloGeant4Selector",
     acc = AFIIGeant4SimCfg(flags)
     kwargs.setdefault("MaxEkin", 200)
     kwargs.setdefault("ParticlePDG", 211)
-    if flags.Concurrency.NumThreads == 0:
+    if flags.Concurrency.NumThreads == 0 and 'MT' not in flags.Sim.ISF.Simulator:
         kwargs.setdefault("Simulator", acc.getService("ISF_AFIIGeant4SimSvc"))
     acc.addPublicTool(CompFactory.ISF.KinematicSimSelector(name, **kwargs))
     return acc
@@ -292,7 +292,7 @@ def ProtonG4FastCaloGeant4Selector(flags, name="ISF_ProtonG4FastCaloGeant4Select
     acc = AFIIGeant4SimCfg(flags)
     kwargs.setdefault("MaxEkin", 400)
     kwargs.setdefault("ParticlePDG", 2212)
-    if flags.Concurrency.NumThreads == 0:
+    if flags.Concurrency.NumThreads == 0 and 'MT' not in flags.Sim.ISF.Simulator:
         kwargs.setdefault("Simulator", acc.getService("ISF_AFIIGeant4SimSvc"))
     acc.addPublicTool(CompFactory.ISF.KinematicSimSelector(name, **kwargs))
     return acc
@@ -302,7 +302,7 @@ def NeutronG4FastCaloGeant4Selector(flags, name="ISF_NeutronG4FastCaloGeant4Sele
     acc = AFIIGeant4SimCfg(flags)
     kwargs.setdefault("MaxEkin", 400)
     kwargs.setdefault("ParticlePDG", 2112)
-    if flags.Concurrency.NumThreads == 0:
+    if flags.Concurrency.NumThreads == 0 and 'MT' not in flags.Sim.ISF.Simulator:
         kwargs.setdefault("Simulator", acc.getService("ISF_AFIIGeant4SimSvc"))
     acc.addPublicTool(CompFactory.ISF.KinematicSimSelector(name, **kwargs))
     return acc
@@ -312,7 +312,7 @@ def ChargedKaonG4FastCaloGeant4Selector(flags, name="ISF_ChargedKaonG4FastCaloGe
     acc = AFIIGeant4SimCfg(flags)
     kwargs.setdefault("MaxEkin", 400)
     kwargs.setdefault("ParticlePDG", 321)
-    if flags.Concurrency.NumThreads == 0:
+    if flags.Concurrency.NumThreads == 0 and 'MT' not in flags.Sim.ISF.Simulator:
         kwargs.setdefault("Simulator", acc.getService("ISF_AFIIGeant4SimSvc"))
     acc.addPublicTool(CompFactory.ISF.KinematicSimSelector(name, **kwargs))
     return acc
@@ -322,7 +322,7 @@ def KLongG4FastCaloGeant4Selector(flags, name="ISF_KLongG4FastCaloGeant4Selector
     acc = AFIIGeant4SimCfg(flags)
     kwargs.setdefault("MaxEkin", 400)
     kwargs.setdefault("ParticlePDG", 130)
-    if flags.Concurrency.NumThreads == 0:
+    if flags.Concurrency.NumThreads == 0 and 'MT' not in flags.Sim.ISF.Simulator:
         kwargs.setdefault("Simulator", acc.getService("ISF_AFIIGeant4SimSvc"))
     acc.addPublicTool(CompFactory.ISF.KinematicSimSelector(name, **kwargs))
     return acc
@@ -330,7 +330,7 @@ def KLongG4FastCaloGeant4Selector(flags, name="ISF_KLongG4FastCaloGeant4Selector
 
 def PionAFII_QS_Geant4SelectorCfg(flags, name="ISF_PionAFII_QS_Geant4Selector", **kwargs):
     acc = AFII_QS_Geant4SimCfg(flags)
-    if flags.Concurrency.NumThreads == 0:
+    if flags.Concurrency.NumThreads == 0 and 'MT' not in flags.Sim.ISF.Simulator:
         kwargs.setdefault("Simulator", acc.getService("ISF_AFII_QS_Geant4SimSvc"))
     acc.merge(PionAFIIGeant4SelectorCfg(flags, name, **kwargs))
     return acc
@@ -340,7 +340,7 @@ def ChargedKaonAFIIGeant4SelectorCfg(flags, name="ISF_ChargedKaonAFIIGeant4Selec
     acc = AFIIGeant4SimCfg(flags)
     kwargs.setdefault("MaxMom", 750)
     kwargs.setdefault("ParticlePDG", 321)
-    if flags.Concurrency.NumThreads == 0:
+    if flags.Concurrency.NumThreads == 0 and 'MT' not in flags.Sim.ISF.Simulator:
         kwargs.setdefault("Simulator", acc.getService("ISF_AFIIGeant4SimSvc"))
     kwargs.setdefault("SimulationFlavor", SimulationFlavor.Geant4)
     acc.addPublicTool(CompFactory.ISF.KinematicSimSelector(name, **kwargs))
@@ -349,7 +349,7 @@ def ChargedKaonAFIIGeant4SelectorCfg(flags, name="ISF_ChargedKaonAFIIGeant4Selec
 
 def ChargedKaonAFII_QS_Geant4SelectorCfg(flags, name="ISF_ChargedKaonAFII_QS_Geant4Selector", **kwargs):
     acc = AFII_QS_Geant4SimCfg(flags)
-    if flags.Concurrency.NumThreads == 0:
+    if flags.Concurrency.NumThreads == 0 and 'MT' not in flags.Sim.ISF.Simulator:
         kwargs.setdefault("Simulator", acc.getService("ISF_AFII_QS_Geant4SimSvc"))
     acc.merge(ChargedKaonAFIIGeant4SelectorCfg(flags, name, **kwargs))
     return acc
@@ -359,7 +359,7 @@ def KLongAFIIGeant4SelectorCfg(flags, name="ISF_KLongAFIIGeant4Selector", **kwar
     acc = AFIIGeant4SimCfg(flags)
     kwargs.setdefault("MaxMom", 750)
     kwargs.setdefault("ParticlePDG", 130)
-    if flags.Concurrency.NumThreads == 0:
+    if flags.Concurrency.NumThreads == 0 and 'MT' not in flags.Sim.ISF.Simulator:
         kwargs.setdefault("Simulator", acc.getService("ISF_AFIIGeant4SimSvc"))
     kwargs.setdefault("SimulationFlavor", SimulationFlavor.Geant4)
     acc.addPublicTool(CompFactory.ISF.KinematicSimSelector(name, **kwargs))
@@ -368,7 +368,7 @@ def KLongAFIIGeant4SelectorCfg(flags, name="ISF_KLongAFIIGeant4Selector", **kwar
 
 def KLongAFII_QS_Geant4SelectorCfg(flags, name="ISF_KLongAFII_QS_Geant4Selector", **kwargs):
     acc = AFII_QS_Geant4SimCfg(flags)
-    if flags.Concurrency.NumThreads == 0:
+    if flags.Concurrency.NumThreads == 0 and 'MT' not in flags.Sim.ISF.Simulator:
         kwargs.setdefault("Simulator", acc.getService("ISF_AFII_QS_Geant4SimSvc"))
     acc.merge(KLongAFIIGeant4SelectorCfg(flags, name, **kwargs))
     return acc
@@ -383,7 +383,7 @@ def MuonSelectorCfg(flags, name="ISF_MuonSelector", **kwargs):
 
 def MuonGeant4SelectorCfg(flags, name="ISF_MuonGeant4Selector", **kwargs):
     acc = Geant4SimCfg(flags)
-    if flags.Concurrency.NumThreads == 0:
+    if flags.Concurrency.NumThreads == 0 and 'MT' not in flags.Sim.ISF.Simulator:
         kwargs.setdefault("Simulator", acc.getService("ISFG4SimSvc"))
     kwargs.setdefault("SimulationFlavor", SimulationFlavor.Geant4)
     acc.merge(MuonSelectorCfg(flags, name, **kwargs))
@@ -392,7 +392,7 @@ def MuonGeant4SelectorCfg(flags, name="ISF_MuonGeant4Selector", **kwargs):
 
 def MuonAFIIGeant4SelectorCfg(flags, name="ISF_MuonAFIIGeant4Selector", **kwargs):
     acc = AFIIGeant4SimCfg(flags)
-    if flags.Concurrency.NumThreads == 0:
+    if flags.Concurrency.NumThreads == 0 and 'MT' not in flags.Sim.ISF.Simulator:
         kwargs.setdefault("Simulator", acc.getService("ISF_AFIIGeant4SimSvc"))
     kwargs.setdefault("SimulationFlavor", SimulationFlavor.Geant4)
     acc.merge(MuonGeant4SelectorCfg(flags, name, **kwargs))
@@ -401,7 +401,7 @@ def MuonAFIIGeant4SelectorCfg(flags, name="ISF_MuonAFIIGeant4Selector", **kwargs
 
 def MuonAFII_QS_Geant4SelectorCfg(flags, name="ISF_MuonAFII_QS_Geant4Selector", **kwargs):
     acc = AFII_QS_Geant4SimCfg(flags)
-    if flags.Concurrency.NumThreads == 0:
+    if flags.Concurrency.NumThreads == 0 and 'MT' not in flags.Sim.ISF.Simulator:
         kwargs.setdefault("Simulator", acc.getService("ISF_AFII_QS_Geant4SimSvc"))
     acc.merge(MuonGeant4SelectorCfg(flags, name, **kwargs))
     return acc
@@ -409,7 +409,7 @@ def MuonAFII_QS_Geant4SelectorCfg(flags, name="ISF_MuonAFII_QS_Geant4Selector",
 
 def MuonFatrasSelectorCfg(flags, name="ISF_MuonFatrasSelector", **kwargs):
     acc = fatrasSimServiceIDCfg(flags)
-    if flags.Concurrency.NumThreads == 0:
+    if flags.Concurrency.NumThreads == 0 and 'MT' not in flags.Sim.ISF.Simulator:
         kwargs.setdefault("Simulator", acc.getService("ISF_FatrasSimSvc"))
     kwargs.setdefault("SimulationFlavor", SimulationFlavor.Fatras)
     acc.merge(MuonSelectorCfg(flags, name, **kwargs))
@@ -419,7 +419,7 @@ def MuonFatrasSelectorCfg(flags, name="ISF_MuonFatrasSelector", **kwargs):
 def MuonFatrasPileupSelectorCfg(flags, name="ISF_MuonFatrasPileupSelector", **kwargs):
     acc = ComponentAccumulator()
     acc.merge(fatrasPileupSimServiceIDCfg(flags))
-    if flags.Concurrency.NumThreads == 0:
+    if flags.Concurrency.NumThreads == 0 and 'MT' not in flags.Sim.ISF.Simulator:
         kwargs.setdefault("Simulator", acc.getService("ISF_FatrasPileupSimSvc"))
     kwargs.setdefault("PileupBCID", [1])
     kwargs.setdefault("ParticlePDG", 13)
@@ -430,7 +430,7 @@ def MuonFatrasPileupSelectorCfg(flags, name="ISF_MuonFatrasPileupSelector", **kw
 
 def WithinEta5FastCaloSimSelectorCfg(flags, name="ISF_WithinEta5FastCaloSimSelector", **kwargs):
     acc = FastCaloSimSvcCfg(flags)
-    if flags.Concurrency.NumThreads == 0:
+    if flags.Concurrency.NumThreads == 0 and 'MT' not in flags.Sim.ISF.Simulator:
         kwargs.setdefault("Simulator", acc.getService("ISF_FastCaloSimSvc"))
     kwargs.setdefault("MinPosEta", -5.0)
     kwargs.setdefault("MaxPosEta",  5.0)
@@ -441,7 +441,7 @@ def WithinEta5FastCaloSimSelectorCfg(flags, name="ISF_WithinEta5FastCaloSimSelec
 
 def EtaGreater5ParticleKillerSimSelectorCfg(flags, name="ISF_EtaGreater5ParticleKillerSimSelector", **kwargs):
     acc = ParticleKillerSvcCfg(flags)
-    if flags.Concurrency.NumThreads == 0:
+    if flags.Concurrency.NumThreads == 0 and 'MT' not in flags.Sim.ISF.Simulator:
         kwargs.setdefault("Simulator", acc.getService("ISF_ParticleKillerSvc"))
     kwargs.setdefault("MinPosEta", -5.0)
     kwargs.setdefault("MaxPosEta",  5.0)
@@ -453,7 +453,7 @@ def EtaGreater5ParticleKillerSimSelectorCfg(flags, name="ISF_EtaGreater5Particle
 
 def EtaGreater5PileupParticleKillerSimSelectorCfg(flags, name="ISF_EtaGreater5PileupParticleKillerSimSelector", **kwargs):
     acc = ParticleKillerSvcCfg(flags)
-    if flags.Concurrency.NumThreads == 0:
+    if flags.Concurrency.NumThreads == 0 and 'MT' not in flags.Sim.ISF.Simulator:
         kwargs.setdefault("Simulator", acc.getService("ISF_ParticleKillerSvc"))
     kwargs.setdefault("MinPosEta", -5.0)
     kwargs.setdefault("MaxPosEta",  5.0)
@@ -476,7 +476,7 @@ def PhotonConeSelectorCfg(flags, name="ISF_PhotonConeSelector", **kwargs):
 
 def PhotonConeFatrasSelectorCfg(flags, name="ISF_PhotonConeFatrasSelector", **kwargs):
     acc = fatrasSimServiceIDCfg(flags)
-    if flags.Concurrency.NumThreads == 0:
+    if flags.Concurrency.NumThreads == 0 and 'MT' not in flags.Sim.ISF.Simulator:
         kwargs.setdefault("Simulator", acc.getService("ISF_FatrasSimSvc"))
     kwargs.setdefault("SimulationFlavor", SimulationFlavor.Fatras)
     acc.merge(PhotonConeSelectorCfg(flags, name, **kwargs))
@@ -485,7 +485,7 @@ def PhotonConeFatrasSelectorCfg(flags, name="ISF_PhotonConeFatrasSelector", **kw
 
 def PhotonConeGeant4SelectorCfg(flags, name="ISF_PhotonConeGeant4Selector", **kwargs):
     acc = Geant4SimCfg(flags)
-    if flags.Concurrency.NumThreads == 0:
+    if flags.Concurrency.NumThreads == 0 and 'MT' not in flags.Sim.ISF.Simulator:
         kwargs.setdefault("Simulator", acc.getService("ISFG4SimSvc"))
     kwargs.setdefault("SimulationFlavor", SimulationFlavor.Geant4)
     acc.merge(PhotonConeSelectorCfg(flags, name, **kwargs))
@@ -508,7 +508,7 @@ def HiggsLeptonsConeSimSelectorCfg(flags, name="ISF_HiggsLeptonsConeSimSelector"
 
 def HiggsLeptonsConeGeant4SelectorCfg(flags, name="ISF_HiggsLeptonsConeGeant4Selector", **kwargs):
     acc = Geant4SimCfg(flags)
-    if flags.Concurrency.NumThreads == 0:
+    if flags.Concurrency.NumThreads == 0 and 'MT' not in flags.Sim.ISF.Simulator:
         kwargs.setdefault("Simulator", acc.getService("ISFG4SimSvc"))
     kwargs.setdefault("SimulationFlavor", SimulationFlavor.Geant4)
     acc.merge(HiggsLeptonsConeSimSelectorCfg(flags, name, **kwargs))
@@ -530,7 +530,7 @@ def HiggsLeptonsConeGeant4CaloSelectorCfg(flags, name="ISF_HiggsLeptonsConeGeant
 
 def WLeptonsConeGeant4SelectorCfg(flags, name="ISF_WLeptonsConeGeant4Selector", **kwargs):
     acc = Geant4SimCfg(flags)
-    if flags.Concurrency.NumThreads == 0:
+    if flags.Concurrency.NumThreads == 0 and 'MT' not in flags.Sim.ISF.Simulator:
         kwargs.setdefault("Simulator", acc.getService("ISFG4SimSvc"))
     kwargs.setdefault("SimulationFlavor", SimulationFlavor.Geant4)
     kwargs.setdefault("ConeCreatorMinPt", 0.)
@@ -548,7 +548,7 @@ def ZLeptonsDirectionConeGeant4SelectorCfg(flags, name="ISF_ZLeptonsDirectionCon
     # this selector picks all particles with a mometum direction
     # within DeltaR<ConeSize relative to the Z decay lepton directions
     acc = Geant4SimCfg(flags)
-    if flags.Concurrency.NumThreads == 0:
+    if flags.Concurrency.NumThreads == 0 and 'MT' not in flags.Sim.ISF.Simulator:
         kwargs.setdefault("Simulator", acc.getService("ISFG4SimSvc"))
     kwargs.setdefault("SimulationFlavor", SimulationFlavor.Geant4)
     kwargs.setdefault("ConeCreatorMinPt", 0.)
@@ -571,7 +571,7 @@ def ZLeptonsPositionConeGeant4SelectorCfg(flags, name="ISF_ZLeptonsPositionConeG
 
 def JPsiLeptonsConeGeant4SelectorCfg(flags, name="ISF_JPsiLeptonsConeGeant4Selector", **kwargs):
     acc = Geant4SimCfg(flags)
-    if flags.Concurrency.NumThreads == 0:
+    if flags.Concurrency.NumThreads == 0 and 'MT' not in flags.Sim.ISF.Simulator:
         kwargs.setdefault("Simulator", acc.getService("ISFG4SimSvc"))
     kwargs.setdefault("SimulationFlavor", SimulationFlavor.Geant4)
     kwargs.setdefault("ConeCreatorMinPt", 0.)
@@ -603,7 +603,7 @@ def BHadronProductsSimSelectorCfg(flags, name="ISF_BHadronProductsSimSelector",
 
 def BHadronProductsGeant4SelectorCfg(flags, name="ISF_BHadronProductsGeant4Selector", **kwargs):
     acc = Geant4SimCfg(flags)
-    if flags.Concurrency.NumThreads == 0:
+    if flags.Concurrency.NumThreads == 0 and 'MT' not in flags.Sim.ISF.Simulator:
         kwargs.setdefault("Simulator", acc.getService("ISFG4SimSvc"))
     kwargs.setdefault("SimulationFlavor", SimulationFlavor.Geant4)
     acc.merge(BHadronProductsSimSelectorCfg(flags, name, **kwargs))
@@ -612,7 +612,7 @@ def BHadronProductsGeant4SelectorCfg(flags, name="ISF_BHadronProductsGeant4Selec
 
 def BHadronProductsFatrasSelectorCfg(flags, name="ISF_BHadronProductsFatrasSelector", **kwargs):
     acc = fatrasSimServiceIDCfg(flags)
-    if flags.Concurrency.NumThreads == 0:
+    if flags.Concurrency.NumThreads == 0 and 'MT' not in flags.Sim.ISF.Simulator:
         kwargs.setdefault("Simulator", acc.getService("ISF_FatrasSimSvc"))
     kwargs.setdefault("SimulationFlavor", SimulationFlavor.Fatras)
     acc.merge(BHadronProductsSimSelectorCfg(flags, name, **kwargs))
@@ -631,7 +631,7 @@ def TauProductsSimSelectorCfg(flags, name="ISF_TauProductsSimSelector", **kwargs
 
 def TauProductsGeant4SelectorCfg(flags, name="ISF_TauProductsGeant4Selector", **kwargs):
     acc = Geant4SimCfg(flags)
-    if flags.Concurrency.NumThreads == 0:
+    if flags.Concurrency.NumThreads == 0 and 'MT' not in flags.Sim.ISF.Simulator:
         kwargs.setdefault("Simulator", acc.getService("ISFG4SimSvc"))
     kwargs.setdefault("SimulationFlavor", SimulationFlavor.Geant4)
     acc.merge(TauProductsSimSelectorCfg(flags, name, **kwargs))
@@ -650,7 +650,7 @@ def ZProductsSimSelectorCfg(flags, name="ISF_ZProductsSimSelector", **kwargs):
 
 def ZProductsGeant4SelectorCfg(flags, name="ISF_ZProductsGeant4Selector", **kwargs):
     acc = Geant4SimCfg(flags)
-    if flags.Concurrency.NumThreads == 0:
+    if flags.Concurrency.NumThreads == 0 and 'MT' not in flags.Sim.ISF.Simulator:
         kwargs.setdefault("Simulator", acc.getService("ISFG4SimSvc"))
     kwargs.setdefault("SimulationFlavor", SimulationFlavor.Geant4)
     acc.merge(ZProductsSimSelectorCfg(flags, name, **kwargs))
@@ -661,7 +661,7 @@ def ZProductsGeant4SelectorCfg(flags, name="ISF_ZProductsGeant4Selector", **kwar
 def SubDetStickyGeant4SimSelectorCfg(flags, name="ISF_SubDetStickyGeant4SimSelector", **kwargs):
     acc = Geant4SimCfg(flags)
     kwargs.setdefault("RequiresUnchangedGeoID", True)
-    if flags.Concurrency.NumThreads == 0:
+    if flags.Concurrency.NumThreads == 0 and 'MT' not in flags.Sim.ISF.Simulator:
         kwargs.setdefault("PrevSimSvc", acc.getService("ISFG4SimSvc"))
         kwargs.setdefault("Simulator", acc.getService("ISFG4SimSvc"))
     kwargs.setdefault("SimulationFlavor", SimulationFlavor.Geant4)
@@ -673,7 +673,7 @@ def GlobalStickyGeant4SimSelectorCfg(flags, name="ISF_GlobalStickyGeant4SimSelec
     acc = Geant4SimCfg(flags)
     kwargs.setdefault("PrevSimSvc", acc.getService("ISFG4SimSvc"))
     kwargs.setdefault("RequiresUnchangedGeoID", False)
-    if flags.Concurrency.NumThreads == 0:
+    if flags.Concurrency.NumThreads == 0 and 'MT' not in flags.Sim.ISF.Simulator:
         kwargs.setdefault("Simulator", acc.getService("ISFG4SimSvc"))
     kwargs.setdefault("SimulationFlavor", SimulationFlavor.Geant4)
     acc.addPublicTool(CompFactory.ISF.HistorySimSelector(name, **kwargs))
diff --git a/Simulation/SimuJobTransforms/python/ISF_Skeleton.py b/Simulation/SimuJobTransforms/python/ISF_Skeleton.py
index 2073c899f084..a5396254fdfa 100644
--- a/Simulation/SimuJobTransforms/python/ISF_Skeleton.py
+++ b/Simulation/SimuJobTransforms/python/ISF_Skeleton.py
@@ -4,44 +4,6 @@ import sys
 from PyJobTransforms.CommonRunArgsToFlags import commonRunArgsToFlags
 from OverlayConfiguration.OverlayHelpers import accFromFragment
 
-# based on https://acode-browser1.usatlas.bnl.gov/lxr/source/athena/Control/AthenaServices/python/Configurables.py#0247
-def EvtIdModifierSvc_add_modifier(svc,
-        run_nbr=None, evt_nbr=None, time_stamp=None, lbk_nbr=None,
-        nevts=1):
-    if run_nbr is None:
-        modify_run_nbr = 0
-        run_nbr = 0
-    else:
-        modify_run_nbr = 1
-
-
-    if evt_nbr is None:
-        modify_evt_nbr = 0
-        evt_nbr = 0
-    else:
-        modify_evt_nbr = 1
-
-    if time_stamp is None:
-        modify_time_stamp = 0
-        time_stamp = 0
-    else:
-        modify_time_stamp = 1
-
-    if lbk_nbr is None:
-        modify_lbk_nbr = 0
-        lbk_nbr = 0
-    else:
-        modify_lbk_nbr = 1
-
-    mod_bit = int(0b0000
-                | (modify_run_nbr << 0)
-                | (modify_evt_nbr << 1)
-                | (modify_time_stamp << 2)
-                | (modify_lbk_nbr << 3))
-
-    svc.Modifiers += [run_nbr, evt_nbr, time_stamp, lbk_nbr,
-                    nevts, mod_bit]
-
 def defaultSimulationFlags(ConfigFlags):
     """Fill default simulation flags"""
     # TODO: how to autoconfigure those
@@ -137,6 +99,8 @@ def fromRunArgs(runArgs):
 
     if hasattr(runArgs, 'DataRunNumber'):
         ConfigFlags.Input.RunNumber = [runArgs.DataRunNumber] # is it updating?
+        ConfigFlags.Input.OverrideRunNumber = True
+        ConfigFlags.Input.LumiBlockNumber = [1] # dummy value
 
     if hasattr(runArgs, 'outputHITSFile'):
         ConfigFlags.Sim.PhysicsList = runArgs.physicsList
@@ -180,26 +144,6 @@ def fromRunArgs(runArgs):
     from AthenaPoolCnvSvc.PoolWriteConfig import PoolWriteCfg
     cfg.merge(PoolReadCfg(ConfigFlags))
     cfg.merge(PoolWriteCfg(ConfigFlags))
-    # todo its own cfg ...
-    #todo check evtMax=-1 works with this method
-    myRunNumber = 284500
-    myFirstLB = 1
-    myInitialTimeStamp = 1446539185
-    from AthenaConfiguration.ComponentFactory import CompFactory
-    evtIdModifierSvc = CompFactory.EvtIdModifierSvc(EvtStoreName="StoreGateSvc")
-    iovDbMetaDataTool = CompFactory.IOVDbMetaDataTool()
-    iovDbMetaDataTool.MinMaxRunNumbers = [myRunNumber, 2147483647]
-    cfg.addPublicTool(iovDbMetaDataTool)
-    EvtIdModifierSvc_add_modifier(evtIdModifierSvc, run_nbr=myRunNumber, lbk_nbr=myFirstLB, time_stamp=myInitialTimeStamp, nevts=evtMax)
-    eventSelector = cfg.getService("EventSelector")
-    eventSelector.OverrideRunNumber = True
-    eventSelector.RunNumber = myRunNumber
-    eventSelector.FirstLB = myFirstLB
-    eventSelector.InitialTimeStamp = myInitialTimeStamp # Necessary to avoid a crash
-    if hasattr(eventSelector, "OverrideRunNumberFromInput"):
-        eventSelector.OverrideRunNumberFromInput = True
-    cfg.addService(evtIdModifierSvc, create=True)
-    # ... up to here?
 
     # add BeamEffectsAlg
     from BeamEffects.BeamEffectsAlgConfig import BeamEffectsAlgCfg
-- 
GitLab