Skip to content
Snippets Groups Projects
Commit 8b5bf12a authored by Frank Winklmeier's avatar Frank Winklmeier
Browse files

Merge branch 'recexcommon-no-trig' into 'master'

Disable Trigger in RecExCommon unless really needed

See merge request !39114
parents 78b0aa62 4b7d4a39
No related branches found
No related tags found
No related merge requests found
Showing with 75 additions and 61 deletions
...@@ -554,42 +554,57 @@ if rec.readESD() and rec.doESD(): ...@@ -554,42 +554,57 @@ if rec.readESD() and rec.doESD():
rec.doTrigger=False rec.doTrigger=False
recAlgs.doTrigger=False recAlgs.doTrigger=False
logRecExCommon_topOptions.info("detected re-reconstruction from ESD, will switch trigger OFF !") logRecExCommon_topOptions.info("detected re-reconstruction from ESD, will switch trigger OFF !")
#try:
# Disable Trigger output reading in MC if there is none, unless running Trigger selection algorithms
if not globalflags.InputFormat.is_bytestream() and not recAlgs.doTrigger:
try:
from RecExConfig.ObjKeyStore import cfgKeyStore
from PyUtils.MetaReaderPeeker import convert_itemList
cfgKeyStore.addManyTypesInputFile(convert_itemList(layout='#join'))
# Check for Run-1, Run-2 or Run-3 Trigger content in the input file
if not cfgKeyStore.isInInputFile("HLT::HLTResult", "HLTResult_EF") \
and not cfgKeyStore.isInInputFile("xAOD::TrigNavigation", "TrigNavigation") \
and not cfgKeyStore.isInInputFile("xAOD::TrigCompositeContainer", "HLTNav_Summary"):
logRecExCommon_topOptions.info('Disabled rec.doTrigger because recAlgs.doTrigger=False and there is no Trigger content in the input file')
rec.doTrigger = False
except Exception:
logRecExCommon_topOptions.warning('Failed to check input file for Trigger content, leaving rec.doTrigger value unchanged (%s)', rec.doTrigger)
if rec.doTrigger: if rec.doTrigger:
if globalflags.DataSource() == 'data'and globalflags.InputFormat == 'bytestream': if globalflags.DataSource() == 'data' and globalflags.InputFormat == 'bytestream':
try: try:
include("TriggerJobOpts/BStoESD_Tier0_HLTConfig_jobOptions.py") include("TriggerJobOpts/BStoESD_Tier0_HLTConfig_jobOptions.py")
except Exception: except Exception:
treatException("Could not import TriggerJobOpts/BStoESD_Tier0_HLTConfig_jobOptions.py . Switching trigger off !" ) treatException("Could not import TriggerJobOpts/BStoESD_Tier0_HLTConfig_jobOptions.py . Switching trigger off !" )
recAlgs.doTrigger=False rec.doTrigger = recAlgs.doTrigger = False
else: else:
try: try:
from TriggerJobOpts.TriggerGetter import TriggerGetter from TriggerJobOpts.TriggerGetter import TriggerGetter
triggerGetter = TriggerGetter() triggerGetter = TriggerGetter()
except Exception: except Exception:
treatException("Could not import TriggerJobOpts.TriggerGetter . Switched off !" ) treatException("Could not import TriggerJobOpts.TriggerGetter . Switched off !" )
recAlgs.doTrigger=False rec.doTrigger = recAlgs.doTrigger = False
# Run-3 Trigger Outputs: Don't run any trigger - only pass the HLT contents from ESD to AOD # ESDtoAOD Run-3 Trigger Outputs: Don't run any trigger - only pass the HLT contents from ESD to AOD
if rec.readESD() and rec.doAOD(): if rec.readESD() and rec.doAOD():
from AthenaConfiguration.AllConfigFlags import ConfigFlags from AthenaConfiguration.AllConfigFlags import ConfigFlags
# The simplest protection in case ConfigFlags.Input.Files is not set, doesn't cover all cases: # The simplest protection in case ConfigFlags.Input.Files is not set, doesn't cover all cases:
if ConfigFlags.Input.Files == ['_ATHENA_GENERIC_INPUTFILE_NAME_'] and athenaCommonFlags.FilesInput(): if ConfigFlags.Input.Files == ['_ATHENA_GENERIC_INPUTFILE_NAME_'] and athenaCommonFlags.FilesInput():
ConfigFlags.Input.Files = athenaCommonFlags.FilesInput() ConfigFlags.Input.Files = athenaCommonFlags.FilesInput()
if ConfigFlags.Trigger.EDMVersion == 3: if ConfigFlags.Trigger.EDMVersion == 3:
# Add HLT output # Add HLT output
from TriggerJobOpts.HLTTriggerResultGetter import HLTTriggerResultGetter from TriggerJobOpts.HLTTriggerResultGetter import HLTTriggerResultGetter
hltOutput = HLTTriggerResultGetter() hltOutput = HLTTriggerResultGetter()
# Add Trigger menu metadata # Add Trigger menu metadata
if rec.doFileMetaData(): if rec.doFileMetaData():
from RecExConfig.ObjKeyStore import objKeyStore from RecExConfig.ObjKeyStore import objKeyStore
metadataItems = [ "xAOD::TriggerMenuContainer#TriggerMenu", metadataItems = [ "xAOD::TriggerMenuContainer#TriggerMenu",
"xAOD::TriggerMenuAuxContainer#TriggerMenuAux." ] "xAOD::TriggerMenuAuxContainer#TriggerMenuAux." ]
objKeyStore.addManyTypesMetaData( metadataItems ) objKeyStore.addManyTypesMetaData( metadataItems )
# Add L1 output (to be consistent with R2) # Add L1 output (to be consistent with R2)
from TrigEDMConfig.TriggerEDM import getLvl1AODList from TrigEDMConfig.TriggerEDM import getLvl1AODList
objKeyStore.addManyTypesStreamAOD(getLvl1AODList()) objKeyStore.addManyTypesStreamAOD(getLvl1AODList())
AODFix_postTrigger() AODFix_postTrigger()
......
...@@ -102,9 +102,11 @@ class doEgammaBremReco(JobProperty): ...@@ -102,9 +102,11 @@ class doEgammaBremReco(JobProperty):
StoredValue=False StoredValue=False
class doTrigger(JobProperty): class doTrigger(JobProperty):
""" Switch for trigger""" """ Switch for trigger"""
# TODO: Remove this flag and assume False in all client configuration
# once the Run-2 trigger execution is removed from release 22
statusOn=True statusOn=True
allowedTypes=['bool'] allowedTypes=['bool']
StoredValue=True StoredValue=False
class doAtlfast(JobProperty): class doAtlfast(JobProperty):
""" Switch for fast simulation (but normally run at ESD->AOD stage)""" """ Switch for fast simulation (but normally run at ESD->AOD stage)"""
statusOn=True statusOn=True
......
...@@ -52,21 +52,11 @@ if hasattr(runArgs,"outputAODFile"): ...@@ -52,21 +52,11 @@ if hasattr(runArgs,"outputAODFile"):
rec.doAOD.set_Value_and_Lock( True ) rec.doAOD.set_Value_and_Lock( True )
rec.doWriteAOD.set_Value_and_Lock( True ) rec.doWriteAOD.set_Value_and_Lock( True )
athenaCommonFlags.PoolAODOutput.set_Value_and_Lock( runArgs.outputAODFile ) athenaCommonFlags.PoolAODOutput.set_Value_and_Lock( runArgs.outputAODFile )
# Begin temporary block for Run-3 Trigger outputs # Lock DQ configuration to prevent downstream override
if ConfigFlags.Trigger.EDMVersion == 3: # RB 15/12/2020: This logic was added in !36737, not sure if still needed
# Lock DQ configuration to prevent downstream override from AthenaMonitoring.DQMonFlags import DQMonFlags
from AthenaMonitoring.DQMonFlags import DQMonFlags print('DQMonFlags.useTrigger override')
print('DQMonFlags override') DQMonFlags.useTrigger.set_Value_and_Lock(rec.doTrigger() and DQMonFlags.useTrigger())
if not rec.doTrigger():
DQMonFlags.useTrigger.set_Value_and_Lock(False)
if DQMonFlags.useTrigger() and rec.doTrigger():
DQMonFlags.useTrigger.set_Value_and_Lock(True)
# Don't run any trigger - only pass the HLT contents from ESD to AOD
# Configure here, and extract HLT content in RecExCommon_topOptions
# after the rest of the job is configured
from RecExConfig.RecAlgsFlags import recAlgs
recAlgs.doTrigger.set_Value_and_Lock( False )
rec.doTrigger.set_Value_and_Lock( False )
if hasattr(runArgs,"outputTAGFile"): if hasattr(runArgs,"outputTAGFile"):
# should be used as outputTAGFile_e2a=myTAG.root so that it does not trigger AODtoTAG # should be used as outputTAGFile_e2a=myTAG.root so that it does not trigger AODtoTAG
......
...@@ -13,7 +13,9 @@ def setMinimalCaloSetup() : ...@@ -13,7 +13,9 @@ def setMinimalCaloSetup() :
svcMgr.TrigCaloDataAccessSvc.OutputLevel=ERROR svcMgr.TrigCaloDataAccessSvc.OutputLevel=ERROR
if not hasattr(svcMgr,'RegSelSvcDefault'): if not hasattr(svcMgr,'RegSelSvcDefault'):
from RegionSelector.RegSelSvcDefault import RegSelSvcDefault from RegionSelector.RegSelSvcDefault import RegSelSvcDefault
svcMgr += RegSelSvcDefault() regsel = RegSelSvcDefault()
regsel.enableCalo = True
svcMgr += regsel
......
...@@ -63,7 +63,9 @@ def HLTCaloMonitoringTool(): ...@@ -63,7 +63,9 @@ def HLTCaloMonitoringTool():
from AthenaCommon.AppMgr import ServiceMgr from AthenaCommon.AppMgr import ServiceMgr
if not hasattr(ServiceMgr,"RegSelSvcDefault"): if not hasattr(ServiceMgr,"RegSelSvcDefault"):
from RegionSelector.RegSelSvcDefault import RegSelSvcDefault from RegionSelector.RegSelSvcDefault import RegSelSvcDefault
ServiceMgr += RegSelSvcDefault() regsel = RegSelSvcDefault()
regsel.enableCalo = True
ServiceMgr += regsel
#HLTFullCalo = HLTCaloTool(name = 'HLTFullCalo', #HLTFullCalo = HLTCaloTool(name = 'HLTFullCalo',
# histoPathBase = "/Trigger/HLT") # histoPathBase = "/Trigger/HLT")
......
...@@ -145,7 +145,9 @@ class HLTSimulationGetter(Configured): ...@@ -145,7 +145,9 @@ class HLTSimulationGetter(Configured):
log.info("Loading RegionSelector") log.info("Loading RegionSelector")
from AthenaCommon.AppMgr import ServiceMgr from AthenaCommon.AppMgr import ServiceMgr
from RegionSelector.RegSelSvcDefault import RegSelSvcDefault from RegionSelector.RegSelSvcDefault import RegSelSvcDefault
ServiceMgr += RegSelSvcDefault() regsel = RegSelSvcDefault()
regsel.enableCalo = TriggerFlags.doCalo()
ServiceMgr += regsel
# Configure the Data Preparation for Calo # Configure the Data Preparation for Calo
if TriggerFlags.doCalo(): if TriggerFlags.doCalo():
......
...@@ -8,7 +8,6 @@ from AthenaCommon.GlobalFlags import globalflags ...@@ -8,7 +8,6 @@ from AthenaCommon.GlobalFlags import globalflags
from AthenaCommon.AppMgr import ServiceMgr from AthenaCommon.AppMgr import ServiceMgr
from RecExConfig.Configured import Configured from RecExConfig.Configured import Configured
from RecExConfig.RecAlgsFlags import recAlgs
from RecExConfig.RecFlags import rec from RecExConfig.RecFlags import rec
from TrigRoiConversion.TrigRoiConversionConf import RoiWriter from TrigRoiConversion.TrigRoiConversionConf import RoiWriter
...@@ -305,11 +304,10 @@ class HLTTriggerResultGetter(Configured): ...@@ -305,11 +304,10 @@ class HLTTriggerResultGetter(Configured):
xaodcnvrt = xAODConversionGetter() xaodcnvrt = xAODConversionGetter()
xAODContainers = xaodcnvrt.xaodlist xAODContainers = xaodcnvrt.xaodlist
if recAlgs.doTrigger() or TriggerFlags.doTriggerConfigOnly(): if ConfigFlags.Trigger.EDMVersion <= 2 and (rec.doTrigger() or TriggerFlags.doTriggerConfigOnly()):
if ConfigFlags.Trigger.EDMVersion <= 2: tdt = TrigDecisionGetterRun2() # noqa: F841
tdt = TrigDecisionGetterRun2() # noqa: F841 elif ConfigFlags.Trigger.EDMVersion >= 3 and TriggerFlags.readBS():
else: tdt = TrigDecisionGetter() # noqa: F841
tdt = TrigDecisionGetter() # noqa: F841
# Temporary hack to add Run-3 navigation to ESD and AOD # Temporary hack to add Run-3 navigation to ESD and AOD
if (rec.doESD() or rec.doAOD()) and ConfigFlags.Trigger.EDMVersion == 3: if (rec.doESD() or rec.doAOD()) and ConfigFlags.Trigger.EDMVersion == 3:
......
...@@ -8,7 +8,6 @@ from AthenaCommon.Include import include # to include old style job options ...@@ -8,7 +8,6 @@ from AthenaCommon.Include import include # to include old style job options
from AthenaCommon.AppMgr import theApp from AthenaCommon.AppMgr import theApp
from RecExConfig.RecFlags import rec from RecExConfig.RecFlags import rec
from RecExConfig.RecAlgsFlags import recAlgs
from RecExConfig.Configured import Configured from RecExConfig.Configured import Configured
...@@ -41,7 +40,7 @@ class Lvl1ResultBuilderGetter(Configured): ...@@ -41,7 +40,7 @@ class Lvl1ResultBuilderGetter(Configured):
topSequence = AlgSequence() topSequence = AlgSequence()
if recAlgs.doTrigger(): if rec.doTrigger():
if (rec.doESD() or rec.doAOD()) and (not(rec.readAOD() or \ if (rec.doESD() or rec.doAOD()) and (not(rec.readAOD() or \
rec.readESD())): rec.readESD())):
if jobproperties.Global.InputFormat() == 'bytestream': if jobproperties.Global.InputFormat() == 'bytestream':
......
...@@ -15,6 +15,11 @@ from TriggerJobOpts.TriggerFlags import TriggerFlags as tf ...@@ -15,6 +15,11 @@ from TriggerJobOpts.TriggerFlags import TriggerFlags as tf
from AthenaCommon.AppMgr import ServiceMgr, ToolSvc from AthenaCommon.AppMgr import ServiceMgr, ToolSvc
from AthenaCommon.Include import include from AthenaCommon.Include import include
assertMsg = 'This file is meant for Trigger configuration in RAWtoESD/RAWtoALL data reconstruction.'
assert rec.doTrigger(), assertMsg + ' Since rec.doTrigger is disabled, this file should not be included.'
assert not recAlgs.doTrigger(), assertMsg + \
' Trigger selection should not run in offline reconstruction, so recAlgs.doTrigger should be False'
# First check is HLT psk is ok, if not, turn trigger off. # First check is HLT psk is ok, if not, turn trigger off.
if tf.configForStartup() != 'HLToffline': if tf.configForStartup() != 'HLToffline':
include( "TriggerJobOpts/TriggerConfigCheckHLTpsk.py" ) include( "TriggerJobOpts/TriggerConfigCheckHLTpsk.py" )
...@@ -130,14 +135,13 @@ if rec.doTrigger(): ...@@ -130,14 +135,13 @@ if rec.doTrigger():
getattr(ToolSvc, toolName).LVL1ConfigSvc="TrigConf::TrigConfigSvc/TrigConfigSvc" getattr(ToolSvc, toolName).LVL1ConfigSvc="TrigConf::TrigConfigSvc/TrigConfigSvc"
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
if recAlgs.doTrigger(): try:
try: from TriggerJobOpts.T0TriggerGetter import T0TriggerGetter
from TriggerJobOpts.T0TriggerGetter import T0TriggerGetter triggerGetter = T0TriggerGetter()
triggerGetter = T0TriggerGetter() except Exception:
except Exception: from AthenaCommon.Resilience import treatException
from AthenaCommon.Resilience import treatException treatException("Could not import TriggerJobOpts.TriggerGetter . Switched off !" )
treatException("Could not import TriggerJobOpts.TriggerGetter . Switched off !" ) recAlgs.doTrigger=False
recAlgs.doTrigger=False if rec.doWriteBS():
elif rec.doWriteBS():
include( "ByteStreamCnvSvc/RDP_ByteStream_jobOptions.py" ) include( "ByteStreamCnvSvc/RDP_ByteStream_jobOptions.py" )
## end of configure the HLT config ## end of configure the HLT config
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment