Commit 4a37ecf9 authored by Frank Winklmeier's avatar Frank Winklmeier
Browse files

TriggerFlags: migrate more flags to ConfigFlags

Migrate the following `TriggerFlags` to `ConfigFlags`:
- `doID`
- `doCalo`
- `doMuon`
- `doCaloOffsetCorrection`
- `readBS`
- `OnlineCondTag` (delete, was already migrated)
- `OnlineGeoTag` (delete, was already migrated)

Remove `doL1Topo` from both old and new flags as this was a left-over
from Run-2 commissioning.

Also remove some unused "Modifiers".
parent 2b16bc2d
......@@ -38,7 +38,6 @@ if [ $doreco == 1 ]; then
#domon="rec.doMonitoring=True;"
#rdotrig="--outputRDO_TRIGFile testRTT.RDO_TRIG.pool.root --triggerConfig MCRECO:DBF:TRIGGERDBMC:2046,20,48 "
aodout="--outputAODFile testRTT.AOD.pool.root"
#trigflag="from TriggerJobOpts.TriggerFlags import TriggerFlags as TF; TF.doLVL1.set_Value_and_Lock(False); TF.doL1Topo.set_Value_and_Lock(False); TF.doLVL2.set_Value_and_Lock(True); TF.doEF.set_Value_and_Lock(True);"
trigflag="from TriggerJobOpts.TriggerFlags import TriggerFlags as TF; TF.configForStartup.set_Value_and_Lock('HLToffline');"
#dotrig="rec.doTrigger=True;"
......
# 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 TrigT2CaloCommon.TrigT2CaloCommonConf import TrigCaloDataAccessSvc as _TrigCaloDataAccessSvc
......@@ -9,7 +9,7 @@ class TrigCaloDataAccessSvc(_TrigCaloDataAccessSvc):
super(TrigCaloDataAccessSvc, self).__init__(name)
from AthenaCommon.AppMgr import ServiceMgr as svcMgr
from TriggerJobOpts.TriggerFlags import TriggerFlags
from AthenaConfiguration.AllConfigFlags import ConfigFlags
from AthenaCommon.GlobalFlags import globalflags
from AthenaCommon.AthenaCommonFlags import athenaCommonFlags
from AthenaCommon.Logging import logging
......@@ -28,10 +28,10 @@ class TrigCaloDataAccessSvc(_TrigCaloDataAccessSvc):
condseq = AthSequencer('AthCondSeq')
condseq.RegSelCondAlg_TTEM.RegSelLUT="ConditionStore+RegSelLUTCondData_TTEM"
if ( globalflags.DatabaseInstance == "COMP200" and TriggerFlags.doCaloOffsetCorrection() ) :
if ( globalflags.DatabaseInstance == "COMP200" and ConfigFlags.Trigger.calo.doOffsetCorrection ) :
log.warning("Not possible to run BCID offset correction with COMP200")
else:
if TriggerFlags.doCaloOffsetCorrection():
if ConfigFlags.Trigger.calo.doOffsetCorrection:
if globalflags.DataSource()=='data' and athenaCommonFlags.isOnline():
log.info('Enable HLT calo offset correction for data')
from IOVDbSvc.CondDB import conddb
......
......@@ -30,7 +30,7 @@ topSequence += HLTSeedingNoCtpForTesting("HLTSeedingNoCtpForTesting", OutputLeve
steps = seqOR("HLTTop")
topSequence += steps
if TriggerFlags.doCalo:
if ConfigFlags.Trigger.doCalo:
if ( doHLTCaloTopo ) :
from TrigT2CaloCommon.CaloDef import HLTFSTopoRecoSequence
recosequence, caloclusters = HLTFSTopoRecoSequence("HLT_TestFSRoI")
......
......@@ -31,7 +31,7 @@ topSequence += HLTSeedingNoCtpForTesting("HLTSeedingNoCtpForTesting", OutputLeve
steps = seqOR("HLTTop")
topSequence += steps
if TriggerFlags.doCalo:
if ConfigFlags.Trigger.doCalo:
if ( doHLTCaloTopo ) :
from TrigT2CaloCommon.CaloDef import HLTFSTopoRecoSequence
......
......@@ -19,7 +19,7 @@ if globalflags.InputFormat.is_bytestream():
# ----------------------------------------------------------------
from AthenaCommon.AlgSequence import AthSequencer
if TriggerFlags.doCalo:
if ConfigFlags.Trigger.doCalo:
if ( True ) :
from AthenaMonitoringKernel.GenericMonitoringTool import GenericMonitoringTool, defineHistogram
......
......@@ -25,7 +25,7 @@ class L1EmulationTest(HLTSeeding):
def __init__(self, name='L1EmulationTest', *args, **kwargs):
super(L1EmulationTest, self).__init__(name, *args, **kwargs)
from TriggerJobOpts.TriggerFlags import TriggerFlags
from AthenaConfiguration.AllConfigFlags import ConfigFlags
from HLTSeeding.HLTSeedingConf import CTPUnpackingEmulationTool, RoIsUnpackingEmulationTool
self.RoIBResult = ""
......@@ -50,7 +50,7 @@ class L1EmulationTest(HLTSeeding):
from HLTSeeding.HLTSeedingConfig import mapThresholdToL1RoICollection
# EM unpacker
if TriggerFlags.doID() or TriggerFlags.doCalo():
if ConfigFlags.Trigger.doID or ConfigFlags.Trigger.doCalo:
emUnpacker = RoIsUnpackingEmulationTool("EMRoIsUnpackingTool",
Decisions = "EMRoIDecisions",
OutputTrigRoIs = mapThresholdToL1RoICollection("EM"),
......@@ -60,7 +60,7 @@ class L1EmulationTest(HLTSeeding):
# MU unpacker
if TriggerFlags.doMuon():
if ConfigFlags.Trigger.doMuon:
muUnpacker = RoIsUnpackingEmulationTool("MURoIsUnpackingTool",
Decisions = "MURoIDecisions",
OutputTrigRoIs = mapThresholdToL1RoICollection("MU"),
......
......@@ -199,7 +199,6 @@ class HLTSeeding(CompFactory.HLTSeeding) :
def __init__(self, name='HLTSeeding', *args, **kwargs):
super(HLTSeeding, self).__init__(name, *args, **kwargs)
from TriggerJobOpts.TriggerFlags import TriggerFlags
from AthenaConfiguration.AllConfigFlags import ConfigFlags as flags
# CTP unpacker
......@@ -212,14 +211,14 @@ class HLTSeeding(CompFactory.HLTSeeding) :
Decisions=mapThresholdToL1DecisionCollection("FSNOSEED"),
OutputTrigRoIs = recordable(mapThresholdToL1RoICollection("FSNOSEED") )) ]
# EM unpacker
if TriggerFlags.doID() or TriggerFlags.doCalo():
if flags.Trigger.doID or flags.Trigger.doCalo:
if flags.Trigger.enableL1CaloPhase1:
self.xAODRoIUnpackers += createCaloRoIUnpackers()
if flags.Trigger.enableL1CaloLegacy:
self.RoIBRoIUnpackers += createLegacyCaloRoIUnpackers()
# MU unpacker
if TriggerFlags.doMuon():
if flags.Trigger.doMuon:
unpackers = createMuonRoIUnpackers(flags)
if flags.Trigger.enableL1MuonPhase1:
self.xAODRoIUnpackers += unpackers
......
......@@ -82,7 +82,6 @@ class ByteStreamUnpackGetterRun1or2(Configured):
from AthenaCommon.AlgSequence import AlgSequence
topSequence = AlgSequence()
#if TriggerFlags.readBS():
log.info( "TriggerFlags.dataTakingConditions: %s", TriggerFlags.dataTakingConditions() )
# in MC this is always FullTrigger
hasHLT = TriggerFlags.dataTakingConditions() in ('HltOnly', 'FullTrigger')
......@@ -170,7 +169,7 @@ class TrigDecisionGetter(Configured):
from TrigDecisionMaker.TrigDecisionMakerConfig import TrigDecisionMakerMT
tdm = TrigDecisionMakerMT('TrigDecMakerMT')
if not TriggerFlags.readBS():
if not ConfigFlags.Trigger.readBS:
# Construct trigger bits from HLTNav_summary instead of reading from BS
from TrigOutputHandling.TrigOutputHandlingConf import TriggerBitsMakerTool
tdm.BitsMakerTool = TriggerBitsMakerTool()
......@@ -276,8 +275,8 @@ class HLTTriggerResultGetter(Configured):
from AthenaCommon.AlgSequence import AlgSequence
topSequence = AlgSequence()
log.info("BS unpacking (TF.readBS): %d", TriggerFlags.readBS() )
if TriggerFlags.readBS():
log.info("BS unpacking (ConfigFlags.Trigger.readBS): %d", ConfigFlags.Trigger.readBS )
if ConfigFlags.Trigger.readBS:
if ConfigFlags.Trigger.EDMVersion == 1 or \
ConfigFlags.Trigger.EDMVersion == 2:
bs = ByteStreamUnpackGetterRun1or2() # noqa: F841
......@@ -297,7 +296,7 @@ class HLTTriggerResultGetter(Configured):
if rec.doTrigger() or TriggerFlags.doTriggerConfigOnly():
tdt = TrigDecisionGetterRun1or2() # noqa: F841
elif ConfigFlags.Trigger.EDMVersion >= 3:
if TriggerFlags.readBS():
if ConfigFlags.Trigger.readBS:
tdt = TrigDecisionGetter() # noqa: F841
else:
raise RuntimeError("Invalid EDMVersion=%s " % ConfigFlags.Trigger.EDMVersion)
......
......@@ -41,46 +41,6 @@ class _modifier:
# Detector maps and conditions
###############################################################
class streamingOnly(_modifier):
"""
Turn off things not needed for streaming only setup
"""
def preSetup(self):
from MuonRecExample.MuonRecFlags import muonRecFlags
muonRecFlags.doMDTs=False
muonRecFlags.doRPCs=False
muonRecFlags.doTGCs=False
TriggerFlags.doID=False
TriggerFlags.doCalo=False
def postSetup(self):
#remove MDT folders as one of them takes 10s to load
svcMgr.IOVDbSvc.Folders=[]
Folders=[]
for text in svcMgr.IOVDbSvc.Folders:
if text.find("/MDT")<0:
Folders+=[text]
svcMgr.IOVDbSvc.Folders=Folders
# There is no magnetic field service in this setup
if hasattr(svcMgr,'HltEventLoopMgr'):
svcMgr.HltEventLoopMgr.setMagFieldFromPtree = False
class noID(_modifier):
"""
Turning of ID - make sure no algorithm needs it!
"""
def preSetup(self):
TriggerFlags.doID=False
class noCalo(_modifier):
"""
Turning of Calorimeter - make sure no algorithm needs it!
"""
def preSetup(self):
TriggerFlags.doCalo=False
class BunchSpacing25ns(_modifier):
"""
ID (and other settings) related to 25ns bunch spacing
......@@ -124,7 +84,8 @@ class useHLTMuonAlign(_modifier):
Apply muon alignment
"""
def postSetup(self):
if TriggerFlags.doHLT() and TriggerFlags.doMuon():
from AthenaConfiguration.AllConfigFlags import ConfigFlags
if ConfigFlags.Trigger.doHLT and ConfigFlags.Trigger.doMuon:
from MuonRecExample import MuonAlignConfig # noqa: F401
#temporary hack to workaround DB problem - should not be needed any more
folders=svcMgr.IOVDbSvc.Folders
......@@ -142,7 +103,8 @@ class useRecentHLTMuonAlign(_modifier):
Apply muon alignment
"""
def postSetup(self):
if TriggerFlags.doHLT() and TriggerFlags.doMuon():
from AthenaConfiguration.AllConfigFlags import ConfigFlags
if ConfigFlags.Trigger.doHLT and ConfigFlags.Trigger.doMuon:
from MuonRecExample import MuonAlignConfig # noqa: F401
folders=svcMgr.IOVDbSvc.Folders
newFolders=[]
......@@ -267,9 +229,10 @@ class noPileupNoise(_modifier):
Disable pileup noise correction
"""
def preSetup(self):
from AthenaConfiguration.AllConfigFlags import ConfigFlags
from CaloTools.CaloNoiseFlags import jobproperties
jobproperties.CaloNoiseFlags.FixedLuminosity.set_Value_and_Lock(0)
TriggerFlags.doCaloOffsetCorrection.set_Value_and_Lock(False)
ConfigFlags.Trigger.calo.doOffsetCorrection = False
class usePileupNoiseMu8(_modifier):
"""
......@@ -397,37 +360,6 @@ class forceAFPLinkNum(_modifier):
# Algorithm modifiers
###############################################################
class physicsZeroStreaming(_modifier):
"""
set all physics chains to stream prescale 0 except streamer chains
"""
def preSetup(self):
TriggerFlags.zero_stream_prescales=True
class physicsPTmode(_modifier):
"""
set all physics chains to PT=1 except streamer chains
"""
def preSetup(self):
TriggerFlags.physics_pass_through=True
class disableIBLInTracking(_modifier):
"""
Turn off IBL in tracking algorithms (data still available for PEB etc)
"""
def postSetup(self):
svcMgr.SpecialPixelMapSvc.MaskLayers = True
svcMgr.SpecialPixelMapSvc.LayersToMask = [0]
class doMuonRoIDataAccess(_modifier):
"""
Use RoI based decoding of muon system
"""
def preSetup(self):
TriggerFlags.MuonSlice.doEFRoIDrivenAccess=True
class rewriteLVL1(_modifier):
"""
Write LVL1 results to ByteStream output, usually used together with rerunLVL1
......@@ -481,7 +413,8 @@ class DisableMdtT0Fit(_modifier):
Disable MDT T0 re-fit and use constants from COOL instead
"""
def preSetup(self):
if TriggerFlags.doMuon():
from AthenaConfiguration.AllConfigFlags import ConfigFlags
if ConfigFlags.Trigger.doMuon:
from MuonRecExample.MuonRecFlags import muonRecFlags
muonRecFlags.doSegmentT0Fit.set_Value_and_Lock(False)
......
......@@ -13,9 +13,6 @@ def createTriggerFlags():
# enables L1 simulation
flags.addFlag('Trigger.doLVL1', lambda prevFlags: prevFlags.Input.isMC)
# enables L1 topological trigger simulation
flags.addFlag('Trigger.doL1Topo', True )
# need proper documentation
flags.addFlag('Trigger.useRun1CaloEnergyScale', False)
......@@ -103,6 +100,9 @@ def createTriggerFlags():
flags.addFlag('Trigger.doEDMVersionConversion', False)
flags.addFlag('Trigger.doConfigVersionConversion', True)
# Unpack trigger bytestream
flags.addFlag('Trigger.readBS', False)
# Flag to control the scheduling of online Run 3 trigger navigation compactification into a single collection (uses slimming framework).
flags.addFlag('Trigger.doOnlineNavigationCompactification', True)
......@@ -114,13 +114,13 @@ def createTriggerFlags():
# True if we have at least one input file, it is a POOL file, it has a metadata store, and the store has xAOD trigger configuration data
# in either the run-2 or run-3 formats.
def TrigConfMeta(flags):
def _trigConfMeta(flags):
from AthenaConfiguration.AutoConfigFlags import GetFileMD
md = GetFileMD(flags.Input.Files) if any(flags.Input.Files) else {}
return ("metadata_items" in md and any(('TriggerMenu' in key) for key in md["metadata_items"].keys()))
# Flag to sense if trigger confioguration POOL metadata is available on the job's input
flags.addFlag('Trigger.InputContainsConfigMetadata', lambda prevFlags: TrigConfMeta(prevFlags))
flags.addFlag('Trigger.InputContainsConfigMetadata', lambda prevFlags: _trigConfMeta(prevFlags))
# only enable services for analysis and BS -> ESD processing (we need better name)
flags.addFlag('Trigger.doTriggerConfigOnly', False)
......
......@@ -23,11 +23,6 @@ def bool_flag_with_default(name, val):
default_true_flags = [
"doLVL1", # run the LVL1 simulation (set to FALSE to read the LVL1 result from BS file)
"doL1Topo", # Run the L1 Topo simulation (set to FALSE to read the L1 Topo result from BS file)
"doID", # if False, disable ID algos at LVL2 and EF """
"doCalo", # if False, disable Calo algorithms at LVL2 & EF """
"doCaloOffsetCorrection", # enable Calo pileup offset BCID correction """
"doMuon", # if FAlse, disable Muons, note: muons need input file containing digits"""
"doNavigationSlimming", # Enable the trigger navigation slimming"""
]
......@@ -35,7 +30,6 @@ default_false_flags = [
"useRun1CaloEnergyScale",
"doTruth",
"doTriggerConfigOnly", # if True only the configuration services should be set, no algorithm """
"readBS",
"readMenuFromTriggerDb", # define the TriggerDb to be the source of the LVL1 and HLT trigger menu
]
......@@ -91,21 +85,6 @@ class ESDEDMSet(JobProperty):
_flags.append(ESDEDMSet)
class OnlineCondTag(JobProperty):
""" Default (online) HLT conditions tag """
statusOn=True
allowedType=['str']
StoredValue='CONDBR2-HLTP-2018-01'
_flags.append(OnlineCondTag)
class OnlineGeoTag(JobProperty):
""" Default (online) HLT geometry tag """
statusOn=True
allowedType=['str']
StoredValue='ATLAS-R2-2016-01-00-01'
_flags.append(OnlineGeoTag)
# =========
#
......@@ -419,11 +398,12 @@ def sync_Trigger2Reco():
from AthenaCommon.GlobalFlags import globalflags
from RecExConfig.RecFlags import rec
if recAlgs.doTrigger() and rec.readRDO() and not globalflags.InputFormat()=='bytestream':
if recAlgs.doTrigger() and rec.readRDO() and not globalflags.InputFormat()=='bytestream':
include( "TriggerJobOpts/TransientBS_DetFlags.py" )
if globalflags.InputFormat() == 'bytestream':
TriggerFlags.readBS = True
from AthenaConfiguration.AllConfigFlags import ConfigFlags
ConfigFlags.Trigger.readBS = True
TriggerFlags.doLVL1 = False
TriggerFlags.doHLT = False
......
......@@ -35,7 +35,7 @@ if rec.doTrigger():
from ByteStreamCnvSvcBase. ByteStreamCnvSvcBaseConf import ByteStreamAddressProviderSvc
ServiceMgr += ByteStreamAddressProviderSvc()
tf.readBS=True
ConfigFlags.Trigger.readBS = True
tf.doLVL1= False # needed to not rerun the trigger
tf.doHLT= False # needed to not rerun the trigger
if ConfigFlags.Trigger.EDMVersion >= 3:
......
# 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 AthenaCommon.DetFlags import DetFlags
from RecExConfig.RecFlags import rec
from TriggerJobOpts.TriggerFlags import TriggerFlags
from AthenaCommon.GlobalFlags import jobproperties
trtEnabled=DetFlags.detdescr.TRT_on()
......@@ -33,7 +32,7 @@ if (not rec.readESD()) and jobproperties.Global.InputFormat() == "pool" and DetF
#
# Switch off direct formation of Cells from hits
#
if not rec.readESD() and TriggerFlags.doCalo():
if not rec.readESD():
from AthenaCommon.Include import include
include ("CaloRec/CaloCellMaker_config.py")
CaloCellMakerFlags.doLArHitToCellDirect=False # noqa: F821 old job options, flags from include above
......
......@@ -273,9 +273,9 @@ else: # More data modifiers
'enableSchedulerMon'
]
TriggerFlags.doID = ConfigFlags.Trigger.doID = opt.doID
TriggerFlags.doMuon = ConfigFlags.Trigger.doMuon = opt.doMuon
TriggerFlags.doCalo = ConfigFlags.Trigger.doCalo = opt.doCalo
ConfigFlags.Trigger.doID = opt.doID
ConfigFlags.Trigger.doMuon = opt.doMuon
ConfigFlags.Trigger.doCalo = opt.doCalo
#-------------------------------------------------------------
# Modifiers
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment