From 87f3b16440d086ad39ac936b41288d4b2eea1f99 Mon Sep 17 00:00:00 2001
From: Tomasz Bold <tomasz.bold@gmail.com>
Date: Wed, 30 Dec 2020 11:11:17 +0000
Subject: [PATCH 1/2] Option to run part of the menu in newJO

---
 .../python/TriggerConfigFlags.py              |  4 ++++
 .../Menu/GenerateMenuMT_newJO.py              | 20 ++++++++++++++++++-
 2 files changed, 23 insertions(+), 1 deletion(-)

diff --git a/Trigger/TriggerCommon/TriggerJobOpts/python/TriggerConfigFlags.py b/Trigger/TriggerCommon/TriggerJobOpts/python/TriggerConfigFlags.py
index 40450fa9998b..43ec20c30fb5 100644
--- a/Trigger/TriggerCommon/TriggerJobOpts/python/TriggerConfigFlags.py
+++ b/Trigger/TriggerCommon/TriggerJobOpts/python/TriggerConfigFlags.py
@@ -206,6 +206,10 @@ def createTriggerFlags():
     # name of the trigger menu
     flags.addFlag('Trigger.triggerMenuSetup', 'LS2_v1')
 
+    # modify the slection of chains that are run (default run all), see more in GenerateMenuMT_newJO
+
+    flags.addFlag('Trigger.triggerMenuModifier', ['all'])
+
     # name of the trigger menu
     flags.addFlag('Trigger.generateMenuDiagnostics', False)
 
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/GenerateMenuMT_newJO.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/GenerateMenuMT_newJO.py
index 1ce863f74f56..d9622d9f6758 100644
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/GenerateMenuMT_newJO.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/GenerateMenuMT_newJO.py
@@ -35,11 +35,28 @@ def obtainChainsOfMenu(flags):
     return setupMenuModule.setupMenu(flags)
 
 
+def acceptChain(chainDict, whichSignatures):
+    """
+    Helper to accept chains to be part of the menu depending on their name or which signatures they belong to.
 
+    If the keyword "all" is present all chains that are in the menu are accepted.
+    If the keyword "emptyMenu" is present other keywords are checked.
+      They can be name of signature: e.g. Muon or name of chain(s) HLT_j50_L1J30
+    Leaving the "emptyMenu" keyword only results in no chains that are configured. As a consequence would cause an issue somewhere downstream.
+    """
+    if "all" in whichSignatures:
+        return True
+    if "emptyMenu" in whichSignatures:
+        if chainDict["chainName"] in whichSignatures:  #explicit list of chains specified
+            return True
+        if all( [ sig in whichSignatures for sig in chainDict['signatures'] ]): # all signatures for the chain are mentioned 
+            return True
+    return False
 
 def generateMenu(flags):
     """
     Using flags generate appropriate Control Flow Graph wiht all HLT algorithms
+    
     """
 
     # convert to chainDefs
@@ -75,7 +92,8 @@ def generateMenu(flags):
         for chain in chains:
             # TODO topo threshold
             mainChainDict = dictFromChainName( chain )
-            
+            if not acceptChain( mainChainDict, flags.Trigger.triggerMenuModifier ):
+                continue
             counter += 1
             mainChainDict['chainCounter'] = counter
 
-- 
GitLab


From b5ca2c4dfef26f7e9221f45e36bd34e6642bd019 Mon Sep 17 00:00:00 2001
From: Tomasz Bold <tomasz.bold@gmail.com>
Date: Wed, 30 Dec 2020 11:17:03 +0000
Subject: [PATCH 2/2] Corrected spaces to make linter happy

---
 .../share/runHLT_standalone_newJO.py          | 69 +++++++++----------
 1 file changed, 34 insertions(+), 35 deletions(-)

diff --git a/Trigger/TriggerCommon/TriggerJobOpts/share/runHLT_standalone_newJO.py b/Trigger/TriggerCommon/TriggerJobOpts/share/runHLT_standalone_newJO.py
index b524cd9622b4..30d9e06a9dc2 100644
--- a/Trigger/TriggerCommon/TriggerJobOpts/share/runHLT_standalone_newJO.py
+++ b/Trigger/TriggerCommon/TriggerJobOpts/share/runHLT_standalone_newJO.py
@@ -1,5 +1,5 @@
 #
-#  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+#  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
 #
 
 from AthenaConfiguration.ComponentAccumulator import CompFactory
@@ -7,29 +7,29 @@ from AthenaConfiguration.MainServicesConfig import MainServicesCfg
 from AthenaConfiguration.AllConfigFlags import ConfigFlags as flags
 
 from AthenaCommon.Configurable import Configurable
-Configurable.configurableRun3Behavior=1
+Configurable.configurableRun3Behavior = 1
 
 
 flags.Detector.GeometryPixel = True
-flags.Detector.GeometrySCT   = True
-flags.Detector.GeometryTRT   = True
-flags.Detector.GeometryID    = True
+flags.Detector.GeometrySCT = True
+flags.Detector.GeometryTRT = True
+flags.Detector.GeometryID = True
 flags.Detector.GeometryBpipe = True
 flags.Detector.GeometryCavern = False
 flags.Detector.GeometryPixel = True
-flags.Detector.GeometrySCT   = True
-flags.Detector.GeometryTRT   = True
+flags.Detector.GeometrySCT = True
+flags.Detector.GeometryTRT = True
 
-flags.Detector.GeometryLAr   = True
-flags.Detector.GeometryTile  = True
-flags.Detector.GeometryMDT   = True
-flags.Detector.GeometryTGC   = True
-flags.Detector.GeometryCSC   = True
-flags.Detector.GeometryRPC   = True
+flags.Detector.GeometryLAr = True
+flags.Detector.GeometryTile = True
+flags.Detector.GeometryMDT = True
+flags.Detector.GeometryTGC = True
+flags.Detector.GeometryCSC = True
+flags.Detector.GeometryRPC = True
 
 
 flags.Detector.RecoPixel = True
-flags.Detector.RecoSCT   = True
+flags.Detector.RecoSCT = True
 
 
 # Output configuration - currently testing offline workflow
@@ -44,17 +44,17 @@ flags.Scheduler.ShowDataFlow = True
 flags.Scheduler.ShowControlFlow = True
 flags.Scheduler.EnableVerboseViews = True
 
-flags.Exec.MaxEvents=50
+flags.Exec.MaxEvents = 50
 flags.Input.isMC = False
-flags.Common.isOnline=True
-flags.IOVDb.GlobalTag="CONDBR2-HLTP-2018-01"
+flags.Common.isOnline = True
+flags.IOVDb.GlobalTag = "CONDBR2-HLTP-2018-01"
 
 
-flags.Concurrency.NumThreads=1
-flags.Concurrency.NumConcurrentEvents=1
+flags.Concurrency.NumThreads = 1
+flags.Concurrency.NumConcurrentEvents = 1
 
-flags.InDet.useSctDCS=False
-flags.InDet.usePixelDCS=False
+flags.InDet.useSctDCS = False
+flags.InDet.usePixelDCS = False
 
 # command line handling
 # options that are defined in: AthConfigFlags are handled here
@@ -65,37 +65,36 @@ flags.fillFromArgs(parser=parser)
 flags.lock()
 
 
-from AthenaCommon.Constants import INFO,DEBUG,WARNING
-acc = MainServicesCfg( flags )
+from AthenaCommon.Constants import INFO, DEBUG, WARNING
+acc = MainServicesCfg(flags)
 acc.getService('AvalancheSchedulerSvc').VerboseSubSlots = True
 
 # this delcares to the scheduer that EventInfo object is produced
-acc.addEventAlgo( CompFactory.SGInputLoader( Load = [( 'xAOD::EventInfo' , 'StoreGateSvc+EventInfo' )] ),
-                      "AthAlgSeq" )
+acc.addEventAlgo(CompFactory.SGInputLoader(Load=[('xAOD::EventInfo', 'StoreGateSvc+EventInfo')]), "AthAlgSeq")
 
 
 from ByteStreamCnvSvc.ByteStreamConfig import ByteStreamReadCfg
-acc.merge(ByteStreamReadCfg( flags ))
+acc.merge(ByteStreamReadCfg(flags))
 
 
 from TriggerJobOpts.TriggerHistSvcConfig import TriggerHistSvcConfig
-acc.merge(TriggerHistSvcConfig( flags ))
+acc.merge(TriggerHistSvcConfig(flags))
 
 
 from TriggerMenuMT.HLTMenuConfig.Menu.GenerateMenuMT_newJO import generateMenu as generateHLTMenu
 from TriggerJobOpts.TriggerConfig import triggerRunCfg
-acc.merge( triggerRunCfg( flags, seqName = "AthMasterSeq", menu=generateHLTMenu ) )
+acc.merge(triggerRunCfg(flags, seqName="AthMasterSeq", menu=generateHLTMenu))
 
 from RegionSelector.RegSelConfig import regSelCfg
-acc.merge( regSelCfg( flags ) )
+acc.merge(regSelCfg(flags))
 
 # The L1 presacles do not get created in the avoce menu setup
 from TrigConfigSvc.TrigConfigSvcCfg import createL1PrescalesFileFromMenu
 createL1PrescalesFileFromMenu(flags)
 
 
-acc.getEventAlgo( "TrigSignatureMoniMT" ).OutputLevel=DEBUG
-acc.getEventAlgo( "L1Decoder" ).ctpUnpacker.UseTBPBits=True # test setup
+acc.getEventAlgo("TrigSignatureMoniMT").OutputLevel = DEBUG
+acc.getEventAlgo("L1Decoder").ctpUnpacker.UseTBPBits = True # test setup
 
 
 
@@ -116,10 +115,10 @@ acc.foreach_component("*HLTTop/*GenericMonitoringTool*").OutputLevel = WARNING #
 acc.printConfig(withDetails=False, summariseProps=True, printDefaults=True)
 
 
-fname = "runHLT_standalone_newJO.pkl"
-print( "Storing config in the file {}".format( fname ) )
-with open(fname, "wb") as p:
-    acc.store( p )
+fName = "runHLT_standalone_newJO.pkl"
+print("Storing config in the file {}".format(fName))
+with open(fName, "wb") as p:
+    acc.store(p)
     p.close()
 status = acc.run()
 if status.isFailure():
-- 
GitLab