diff --git a/Control/AthenaConfiguration/python/AutoConfigFlags.py b/Control/AthenaConfiguration/python/AutoConfigFlags.py index 5fe04eb7dcae8b715b57a89a30e82bafc53252f7..65eddb4ba189fdb5f351eb209e49363b6d85f930 100644 --- a/Control/AthenaConfiguration/python/AutoConfigFlags.py +++ b/Control/AthenaConfiguration/python/AutoConfigFlags.py @@ -17,6 +17,8 @@ def GetFileMD(filenames): from AthenaCommon.Logging import logging msg = logging.getLogger('AutoConfigFlags') filename=filenames[0] + if filename == '_ATHENA_GENERIC_INPUTFILE_NAME_': + raise RuntimeError('Input file name not set, instead _ATHENA_GENERIC_INPUTFILE_NAME_ found. Cannot read metadata.') if filename not in _fileMetaData: if len(filenames)>1: msg.info("Multiple input files. Use the first one for auto-configuration") diff --git a/Control/AthenaMonitoring/share/DQMonFlagsConfig_jobOptions.py b/Control/AthenaMonitoring/share/DQMonFlagsConfig_jobOptions.py index 29de83de225b6927b5a6fec2622f38dbe476e040..a86b0539f64b890edb4d7511e93f529416b50c7e 100644 --- a/Control/AthenaMonitoring/share/DQMonFlagsConfig_jobOptions.py +++ b/Control/AthenaMonitoring/share/DQMonFlagsConfig_jobOptions.py @@ -19,8 +19,7 @@ from RecExConfig.RecAlgsFlags import recAlgs # if we are not in MT mode, do not run new-style monitoring # if you really want to override, use set_Value_and_Lock(True) on the relevant flags below -from TriggerJobOpts.TriggerFlags import TriggerFlags -if not TriggerFlags.doMT(): +if jobproperties.ConcurrencyFlags.NumThreads() == 0: DQMonFlags.doNewMonitoring=False # Set the data type based on beamType/HI flag @@ -73,7 +72,7 @@ else: # the meaning of this flag has changed in MT if (rec.doTrigger() == False and - not (TriggerFlags.doMT() and DQMonFlags.monManEnvironment=='tier0ESD' and DQMonFlags.useTrigger())): + not (ConfigFlags.Trigger.EDMVersion == 3 and DQMonFlags.monManEnvironment=='tier0ESD' and DQMonFlags.useTrigger())): DQMonFlags.useTrigger=False # steers trigger-awareness DQMonFlags.doLVL1CaloMon=False DQMonFlags.doCTPMon=False diff --git a/Control/AthenaPython/share/read_file.py b/Control/AthenaPython/share/read_file.py index aa27a85508ca1a3bc2ec9e9b8c62a75da2b09554..968462572a3e2fe1ddf87f5c1f148c06538087e1 100644 --- a/Control/AthenaPython/share/read_file.py +++ b/Control/AthenaPython/share/read_file.py @@ -16,6 +16,9 @@ assert len(acf.FilesInput()) != 0, \ "this jobo fragment needs the autoconfig-fwk." \ "FilesInput needs to be filled" +from AthenaConfiguration.AllConfigFlags import ConfigFlags +ConfigFlags.Input.Files = acf.FilesInput() + import AthenaPython.ConfigLib as apcl cfg = apcl.AutoCfg(name='read-file', input_files=acf.FilesInput()) diff --git a/Reconstruction/RecExample/RecExCommon/share/RecExCommon_topOptions.py b/Reconstruction/RecExample/RecExCommon/share/RecExCommon_topOptions.py index 032ada00886b84a84aa1ec9656ab4b81d48a8186..1ec89204466a04253b03fea1fe588e27b36444e2 100644 --- a/Reconstruction/RecExample/RecExCommon/share/RecExCommon_topOptions.py +++ b/Reconstruction/RecExample/RecExCommon/share/RecExCommon_topOptions.py @@ -567,10 +567,9 @@ if rec.doTrigger: treatException("Could not import TriggerJobOpts.TriggerGetter . Switched off !" ) recAlgs.doTrigger=False -#MT part -## Outputs -from TriggerJobOpts.TriggerFlags import TriggerFlags -if TriggerFlags.doMT() and rec.readESD() and rec.doAOD(): +# Run-3 Trigger Outputs +from AthenaConfiguration.AllConfigFlags import ConfigFlags +if ConfigFlags.Trigger.EDMVersion == 3 and rec.readESD() and rec.doAOD(): # Don't run any trigger - only pass the HLT contents from ESD to AOD # Add HLT output from TriggerJobOpts.HLTTriggerResultGetter import HLTTriggerResultGetter diff --git a/Reconstruction/RecJobTransforms/share/skeleton.ESDtoAOD_tf.py b/Reconstruction/RecJobTransforms/share/skeleton.ESDtoAOD_tf.py index c497f73ddad7b1ad90539cd66b98198abffcd8ce..7014c91ffcc1b92e8c803971027a8ac2a66a9e4c 100644 --- a/Reconstruction/RecJobTransforms/share/skeleton.ESDtoAOD_tf.py +++ b/Reconstruction/RecJobTransforms/share/skeleton.ESDtoAOD_tf.py @@ -52,8 +52,8 @@ if hasattr(runArgs,"outputAODFile"): rec.doAOD.set_Value_and_Lock( True ) rec.doWriteAOD.set_Value_and_Lock( True ) athenaCommonFlags.PoolAODOutput.set_Value_and_Lock( runArgs.outputAODFile ) - # Begin temporary trigger block - if TriggerFlags.doMT(): + # Begin temporary block for Run-3 Trigger outputs + if ConfigFlags.Trigger.EDMVersion == 3: # Lock DQ configuration to prevent downstream override from AthenaMonitoring.DQMonFlags import DQMonFlags print('DQMonFlags override') diff --git a/Reconstruction/RecJobTransforms/share/skeleton.RAWtoALL_tf.py b/Reconstruction/RecJobTransforms/share/skeleton.RAWtoALL_tf.py index ccf0cbd7d94adf16801b90dafefa34c60aae0d2c..1eb52904e3a1088ac6113fc342be86a5921e51db 100644 --- a/Reconstruction/RecJobTransforms/share/skeleton.RAWtoALL_tf.py +++ b/Reconstruction/RecJobTransforms/share/skeleton.RAWtoALL_tf.py @@ -17,6 +17,7 @@ recoLog.info( '****************** STARTING RAW->ALL MAKING *****************' ) from AthenaCommon.AppMgr import ServiceMgr; import AthenaPoolCnvSvc.AthenaPool from AthenaCommon.AthenaCommonFlags import athenaCommonFlags +from AthenaConfiguration.AllConfigFlags import ConfigFlags ## Input # BS @@ -27,6 +28,7 @@ if hasattr(runArgs,"inputBSFile"): rec.readRDO.set_Value_and_Lock( True ) globalflags.InputFormat.set_Value_and_Lock('bytestream') athenaCommonFlags.BSRDOInput.set_Value_and_Lock( runArgs.inputBSFile ) + ConfigFlags.Input.Files = athenaCommonFlags.BSRDOInput() if len(DRAWInputs) == 1: rec.readRDO.set_Value_and_Lock( True ) globalflags.InputFormat.set_Value_and_Lock('bytestream') @@ -39,6 +41,7 @@ if hasattr(runArgs,"inputRDOFile"): rec.readRDO.set_Value_and_Lock( True ) globalflags.InputFormat.set_Value_and_Lock('pool') athenaCommonFlags.PoolRDOInput.set_Value_and_Lock( runArgs.inputRDOFile ) + ConfigFlags.Input.Files = athenaCommonFlags.PoolRDOInput() # EVNT (?) if hasattr(runArgs,"inputEVNTFile"): diff --git a/Reconstruction/RecJobTransforms/share/skeleton.RAWtoESD_tf.py b/Reconstruction/RecJobTransforms/share/skeleton.RAWtoESD_tf.py index 18e4d1c26b171006c420bbddf561f63dd1256b60..68e669f15ac61c0c7af6f688c6372e8d9048d0b5 100644 --- a/Reconstruction/RecJobTransforms/share/skeleton.RAWtoESD_tf.py +++ b/Reconstruction/RecJobTransforms/share/skeleton.RAWtoESD_tf.py @@ -71,6 +71,7 @@ if hasattr(runArgs,"inputRDOFile"): rec.readRDO.set_Value_and_Lock( True ) globalflags.InputFormat.set_Value_and_Lock('pool') athenaCommonFlags.PoolRDOInput.set_Value_and_Lock( runArgs.inputRDOFile ) + ConfigFlags.Input.Files = athenaCommonFlags.PoolRDOInput() if hasattr(runArgs,"inputRDO_TRIGFile"): rec.readRDO.set_Value_and_Lock( True ) globalflags.InputFormat.set_Value_and_Lock('pool') @@ -98,6 +99,7 @@ if hasattr(runArgs,"inputRDO_TRIGFile"): from TrigEDMConfig.TriggerEDM import getLvl1ESDList from TrigEDMConfig.TriggerEDM import getLvl1AODList from TrigEDMConfig.TriggerEDM import getTrigIDTruthList + from TriggerJobOpts.TriggerFlags import TriggerFlags objKeyStore.addManyTypesStreamESD(getTrigIDTruthList(TriggerFlags.ESDEDMSet())) objKeyStore.addManyTypesStreamAOD(getTrigIDTruthList(TriggerFlags.AODEDMSet())) objKeyStore.addManyTypesStreamESD(getLvl1ESDList()) diff --git a/Reconstruction/RecJobTransforms/share/skeleton.RDOtoRDOtrigger.py b/Reconstruction/RecJobTransforms/share/skeleton.RDOtoRDOtrigger.py index 88390fdf027f4d79e41d43b8056a84f585cbc858..2cfecda21a1615b27fe8948e26fc6f172a5d1844 100644 --- a/Reconstruction/RecJobTransforms/share/skeleton.RDOtoRDOtrigger.py +++ b/Reconstruction/RecJobTransforms/share/skeleton.RDOtoRDOtrigger.py @@ -1,9 +1,12 @@ # Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration from AthenaCommon.Include import include -from TriggerJobOpts.TriggerFlags import TriggerFlags +from AthenaCommon.ConcurrencyFlags import jobproperties as cfjp +from AthenaConfiguration.AllConfigFlags import ConfigFlags -if TriggerFlags.doMT(): +if cfjp.ConcurrencyFlags.NumThreads() > 0 or ConfigFlags.Concurrency.NumThreads > 0: + # AthenaMT Run-3 Trigger include('RecJobTransforms/skeleton.RDOtoRDOtriggerMT.py') else: + # Serial Athena Run-2 Trigger include('RecJobTransforms/skeleton.RDOtoRDOtriggerLegacy.py') diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/python/TrigL2MuonSAConfig.py b/Trigger/TrigAlgorithms/TrigL2MuonSA/python/TrigL2MuonSAConfig.py index 04fcae2901a4041a20088490365cd3972e2256ae..6773b4b1b8020213ac0da01415e45e3306c6c132 100644 --- a/Trigger/TrigAlgorithms/TrigL2MuonSA/python/TrigL2MuonSAConfig.py +++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/python/TrigL2MuonSAConfig.py @@ -6,6 +6,7 @@ from AthenaCommon.AppMgr import ServiceMgr,ToolSvc from AthenaCommon.DetFlags import DetFlags from TrigMuonBackExtrapolator.TrigMuonBackExtrapolatorConfig import MuonBackExtrapolatorForAlignedDet, MuonBackExtrapolatorForMisalignedDet, MuonBackExtrapolatorForData from TriggerJobOpts.TriggerFlags import TriggerFlags +from AthenaConfiguration.AllConfigFlags import ConfigFlags from RegionSelector.RegSelToolConfig import makeRegSelTool_MDT from RegionSelector.RegSelToolConfig import makeRegSelTool_RPC from RegionSelector.RegSelToolConfig import makeRegSelTool_TGC @@ -39,7 +40,7 @@ if not MuonGeometryFlags.hasCSC(): theDataPreparator.CSCDataPreparator.CSCPrepDataContainer = "" #Need different PRD collection names to run offline and Run 2 trigger in same job -if not TriggerFlags.doMT(): +if ConfigFlags.Trigger.EDMVersion <= 2: from MuonMDT_CnvTools.MuonMDT_CnvToolsConf import Muon__MdtRdoToPrepDataTool from MuonCnvExample import MuonCalibConfig diff --git a/Trigger/TriggerCommon/TriggerJobOpts/python/TriggerFlags.py b/Trigger/TriggerCommon/TriggerJobOpts/python/TriggerFlags.py index 6363d61dcce9a858055e3a53ea64dd30cc0d4cb6..c1572a7226cdd9f11d1cc06bc76702eb96eef20a 100644 --- a/Trigger/TriggerCommon/TriggerJobOpts/python/TriggerFlags.py +++ b/Trigger/TriggerCommon/TriggerJobOpts/python/TriggerFlags.py @@ -4,7 +4,6 @@ import re from AthenaCommon.Logging import logging log = logging.getLogger( 'TriggerJobOpts.TriggerFlags' ) -log.setLevel(logging.DEBUG) from AthenaCommon.JobProperties import JobProperty, JobPropertyContainer from AthenaCommon.JobProperties import jobproperties # noqa: F401 @@ -79,23 +78,6 @@ class doHLT(JobProperty): _flags.append(doHLT) -class doMT(JobProperty): - """ Configure Run-3 AthenaMT Trigger """ - statusOn=True - allowedType=['bool'] - # Cannot use OnlineFlags.partitionName here because OnlineFlags need TriggerFlags to be created first - import os - partitionName = os.getenv('TDAQ_PARTITION') or '' - if partitionName: - # Only MT Trigger is supported online - StoredValue=True - else: - # ConcurrencyFlags are valid only in offline athena - from AthenaCommon.ConcurrencyFlags import jobproperties # noqa: F811 - StoredValue=bool(jobproperties.ConcurrencyFlags.NumThreads() >= 1) - -_flags.append(doMT) - class EDMVersion(JobProperty): """ if 1, Run1 decoding version is set; if 2, Run2; if 3, Run3 """ statusOn=False @@ -498,16 +480,23 @@ class readLVL1configFromXML(JobProperty): import os log = logging.getLogger( 'TriggerFlags.readLVL1configFromXML' ) - if TriggerFlags.doMT(): - import TriggerMenuMT.LVL1MenuConfig.LVL1.Lvl1Flags # noqa: F401 - else: + from AthenaConfiguration.AllConfigFlags import ConfigFlags + try: + legacy_run2_trigger = (ConfigFlags.Trigger.EDMVersion <= 2) and not os.getenv('TDAQ_PARTITION') + except Exception: + log.warning("Could not determine if legacy or Run-3 configuration is needed. Assuming Run-3.") + legacy_run2_trigger = False + + if legacy_run2_trigger: import TriggerMenu.l1.Lvl1Flags # noqa: F401 + else: + import TriggerMenuMT.LVL1MenuConfig.LVL1.Lvl1Flags # noqa: F401 if self.get_Value() is False: TriggerFlags.inputLVL1configFile = TriggerFlags.outputLVL1configFile() TriggerFlags.Lvl1.items.set_On() else: - menuXMLPackage = "TriggerMenuMT" if TriggerFlags.doMT() else "TriggerMenuXML" + menuXMLPackage = "TriggerMenuXML" if legacy_run2_trigger else "TriggerMenuMT" TriggerFlags.inputLVL1configFile = menuXMLPackage + "/LVL1config_"+_getMenuBaseName(TriggerFlags.triggerMenuSetup())+"_" + TriggerFlags.menuVersion() + ".xml" xmlFile=TriggerFlags.inputLVL1configFile() from TrigConfigSvc.TrigConfigSvcConfig import findFileInXMLPATH @@ -924,14 +913,38 @@ TriggerFlags = rec.Trigger ## add online specific flags from TriggerJobOpts.TriggerOnlineFlags import OnlineFlags # noqa: F401 -## add slices generation flags +def _legacy_run2_trigger(): + if TriggerFlags.Online.partitionName(): + return False + try: + from AthenaConfiguration.AllConfigFlags import ConfigFlags + return (ConfigFlags.Trigger.EDMVersion <= 2) + except Exception: + # This is needed when TriggerFlags are imported before we can determine if we need legacy + # or Run-3 trigger configuration. This whole function wouldn't be needed if we didn't change + # which SliceFlags we import during the import of TriggerFlags depending on legacy vs Run-3 + # below. Running MT or serial has no relation to legacy vs Run-3 trigger in any case other + # than when executing trigger algorithms (like at P1 or in RDOtoRDOTrigger), but it's the best + # we can do here until we remove the legacy TriggerMenu. This is likely to be incorrect in + # digitisation / offline reconstruction / offline monitoring / derivations, but hopefully these + # jobs won't depend on SliceFlags. + from AthenaCommon.ConcurrencyFlags import jobproperties as cfjp + from AthenaConfiguration.AllConfigFlags import ConfigFlags + log = logging.getLogger('TriggerJobOpts.TriggerFlags') + log.debug('WARNING TriggerFlags imported before legacy vs Run-3 trigger config can be determined. ' + 'Cannot determine whether to import SliceFlags for legacy TriggerMenu or TriggerMenuMT. ' + 'Assuming legacy if numThreads=0 or Run-3 otherwise. If this job depends on SliceFlags, ' + 'ensure ConfigFlags.Trigger.EDMVersion is either set manually or can be auto-configured ' + 'from ConfigFlags.Input.Files before importing TriggerFlags.') + return cfjp.ConcurrencyFlags.NumThreads() == 0 and ConfigFlags.Concurrency.NumThreads == 0 -if doMT(): - log.info("TriggerFlags importing SliceFlagsMT" ) - from TriggerJobOpts.SliceFlagsMT import * # noqa: F401, F403 -else: +## add slices generation flags +if _legacy_run2_trigger(): log.info("TriggerFlags importing SliceFlags (non-MT)" ) from TriggerJobOpts.SliceFlags import * # noqa: F401, F403 +else: + log.info("TriggerFlags importing SliceFlagsMT" ) + from TriggerJobOpts.SliceFlagsMT import * # noqa: F401, F403 from TriggerJobOpts.Tier0TriggerFlags import Tier0TriggerFlags # noqa: F401 diff --git a/Trigger/TriggerCommon/TriggerJobOpts/python/TriggerGetter.py b/Trigger/TriggerCommon/TriggerJobOpts/python/TriggerGetter.py index a33ba3f35c0c1413202255d19b54520a15d7435c..df634b14cc978b158cee252aa58a8fd1c7f09c6c 100644 --- a/Trigger/TriggerCommon/TriggerJobOpts/python/TriggerGetter.py +++ b/Trigger/TriggerCommon/TriggerJobOpts/python/TriggerGetter.py @@ -44,13 +44,8 @@ class TriggerGetter(Configured): # start with print some information what this will do log.info("Basic configuration flags RecAlgsFlag.doTrigger: %d RecFlags.doTrigger: %d TriggerFlags.doTriggerConfigOnly %d", recAlgs.doTrigger(), rec.doTrigger(), TF.doTriggerConfigOnly() ) - log.info("TriggerFlags: doL1Topo: %s, doLVL1: %s, doHLT: %s, doMT: %s", TF.doL1Topo(), TF.doLVL1(), TF.doHLT(), TF.doMT() ) + log.info("TriggerFlags: doL1Topo: %s, doLVL1: %s, doHLT: %s", TF.doL1Topo(), TF.doLVL1(), TF.doHLT() ) - # RDOtoRDOTrigger MT temporarily coded in the transform skeleton, so skip here - if TF.doMT() and rec.readRDO() and rec.doWriteRDO(): - log.info("Nothing happens in TriggerGetter for RDOtoRDOTrigger MT") - return True - willGenerateMenu = recAlgs.doTrigger() and (TF.doLVL1() or TF.doHLT()) and not TF.doTriggerConfigOnly() willRunTriggerConfigGetter = recAlgs.doTrigger() or rec.doTrigger() or TF.doTriggerConfigOnly() willRunLVL1SimulationGetter = recAlgs.doTrigger() and not TF.doTriggerConfigOnly() diff --git a/Trigger/TriggerCommon/TriggerJobOpts/share/runHLT_standalone_run2.py b/Trigger/TriggerCommon/TriggerJobOpts/share/runHLT_standalone_run2.py index 80221b88dfb0aeb8472e4b66669629f456ed157c..1c6f9ba83ebfd544b73163239f10771c058e06b2 100755 --- a/Trigger/TriggerCommon/TriggerJobOpts/share/runHLT_standalone_run2.py +++ b/Trigger/TriggerCommon/TriggerJobOpts/share/runHLT_standalone_run2.py @@ -191,6 +191,10 @@ defaultOptions={ } +# Legacy (Run-2) trigger produces Run-2 EDM +from AthenaConfiguration.AllConfigFlags import ConfigFlags +ConfigFlags.Trigger.EDMVersion = 2 + #------------------------------------------------------------- # Transfer flags into TriggerFlags #------------------------------------------------------------- @@ -373,7 +377,6 @@ TriggerFlags.doMuon=True TriggerFlags.doCalo=True from AthenaCommon.AthenaCommonFlags import athenaCommonFlags -from AthenaConfiguration.AllConfigFlags import ConfigFlags athenaCommonFlags.isOnline = True ConfigFlags.Common.isOnline = True @@ -403,9 +406,6 @@ elif PoolRDOInput!=None: ConfigFlags.Input.Files = athenaCommonFlags.FilesInput() -# Legacy (Run-2) trigger produces Run-2 EDM -ConfigFlags.Trigger.EDMVersion = 2 - # Conditions and geometry tag if globalflags.InputFormat.is_pool() and (setDetDescr==None or setGlobalTag==None): import PyUtils.AthFile as athFile diff --git a/Trigger/TriggerCommon/TriggerMenuXML/share/runHLT_forXMLgeneration.py b/Trigger/TriggerCommon/TriggerMenuXML/share/runHLT_forXMLgeneration.py index 0ea9f302ba9f5e00067560977fa9c975bf8b0d58..a068a96e1ffea146ee54b24e408f141513f8e105 100644 --- a/Trigger/TriggerCommon/TriggerMenuXML/share/runHLT_forXMLgeneration.py +++ b/Trigger/TriggerCommon/TriggerMenuXML/share/runHLT_forXMLgeneration.py @@ -7,6 +7,10 @@ log = logging.getLogger('runHLT_forXMLgeneration.py') from AthenaCommon.AthenaCommonFlags import athenaCommonFlags from AthenaCommon.GlobalFlags import globalflags +from AthenaConfiguration.AllConfigFlags import ConfigFlags + +# Running Run-2 Trigger configuration +ConfigFlags.Trigger.EDMVersion = 2 # Input file is only needed so that TileCal picks up the correct cabling according to the year athenaCommonFlags.FilesInput=["/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/TrigP1Test/data18_13TeV.00360026.physics_EnhancedBias.merge.RAW._lb0151._SFO-1._0001.1"]