Commit 14f10a62 authored by Rafal Bielski's avatar Rafal Bielski
Browse files

EDMVersion flag: change default to -1, remove from TriggerFlags

parent 512e8d60
......@@ -36,7 +36,10 @@ def getTriggerEDMList(key, runVersion):
additionally for Run 3 the key can be 'AODSMALL' and 'AODLARGE'
run can be: '1 (Run1)', '2 (Run2)', '3' (Run 3)
"""
if runVersion == 2:
if runVersion == 1:
return getTriggerObjList(key,[TriggerL2List,TriggerEFList, TriggerResultsRun1List])
elif runVersion == 2:
if 'SLIM' in key:
return getTriggerEDMSlimList(key)
else:
......@@ -53,7 +56,7 @@ def getTriggerEDMList(key, runVersion):
return getRun3TrigObjList(key, [TriggerHLTListRun3])
else:
return getTriggerObjList(key,[TriggerL2List,TriggerEFList, TriggerResultsRun1List])
raise RuntimeError("Invalid runVersion=%s supplied to getTriggerEDMList" % runVersion)
......@@ -379,8 +382,10 @@ def getPreregistrationList(version=2):
l=[]
if version==2:
l = getHLTPreregistrationList()
else:
elif version==1:
l=list(set(getL2PreregistrationList()+getEFPreregistrationList()+getHLTPreregistrationList()))
else:
raise RuntimeError("Invalid version=%s supplied to getPreregistrationList" % version)
return l
......@@ -511,8 +516,10 @@ def getTPList(version=2):
l = {}
if version==2:
bslist = getHLTBSTypeList()
else:
elif version==1:
bslist = list(set(getL2BSTypeList() + getEFBSTypeList()))
else:
raise RuntimeError("Invalid version=%s supplied to getTPList" % version)
for t,d in six.iteritems (EDMDetails):
colltype = t
......
......@@ -83,10 +83,10 @@ class ByteStreamUnpackGetter(Configured):
log.debug("Configured HLT result BS decoding sequence")
return True
class ByteStreamUnpackGetterRun2(Configured):
class ByteStreamUnpackGetterRun1or2(Configured):
def configure(self):
log = logging.getLogger("ByteStreamUnpackGetterRun2")
log = logging.getLogger("ByteStreamUnpackGetterRun1or2")
from AthenaCommon.AlgSequence import AlgSequence
topSequence = AlgSequence()
......@@ -188,11 +188,11 @@ class TrigDecisionGetter(Configured):
return True
class TrigDecisionGetterRun2(Configured):
class TrigDecisionGetterRun1or2(Configured):
#class to setup the writing or just making of TrigDecisionObject
def configure(self):
log = logging.getLogger("TrigDecisionGetterRun2")
log = logging.getLogger("TrigDecisionGetterRun1or2")
from AthenaCommon.AlgSequence import AlgSequence
topSequence = AlgSequence()
......@@ -281,21 +281,29 @@ class HLTTriggerResultGetter(Configured):
topSequence = AlgSequence()
log.info("BS unpacking (TF.readBS): %d", TriggerFlags.readBS() )
if TriggerFlags.readBS():
if ConfigFlags.Trigger.EDMVersion <= 2:
bs = ByteStreamUnpackGetterRun2() # noqa: F841
else:
if ConfigFlags.Trigger.EDMVersion == 1 or \
ConfigFlags.Trigger.EDMVersion == 2:
bs = ByteStreamUnpackGetterRun1or2() # noqa: F841
elif ConfigFlags.Trigger.EDMVersion >=3:
bs = ByteStreamUnpackGetter() # noqa: F841
else:
raise RuntimeError("Invalid EDMVersion=%s " % ConfigFlags.Trigger.EDMVersion)
xAODContainers = {}
# if not recAlgs.doTrigger(): #only convert when running on old data
if ConfigFlags.Trigger.EDMVersion == 1:
xaodcnvrt = xAODConversionGetter()
xAODContainers = xaodcnvrt.xaodlist
if ConfigFlags.Trigger.EDMVersion <= 2 and (rec.doTrigger() or TriggerFlags.doTriggerConfigOnly()):
tdt = TrigDecisionGetterRun2() # noqa: F841
elif ConfigFlags.Trigger.EDMVersion >= 3 and TriggerFlags.readBS():
tdt = TrigDecisionGetter() # noqa: F841
if ConfigFlags.Trigger.EDMVersion == 1 or \
ConfigFlags.Trigger.EDMVersion == 2:
if rec.doTrigger() or TriggerFlags.doTriggerConfigOnly():
tdt = TrigDecisionGetterRun1or2() # noqa: F841
elif ConfigFlags.Trigger.EDMVersion >= 3:
if TriggerFlags.readBS():
tdt = TrigDecisionGetter() # noqa: F841
else:
raise RuntimeError("Invalid EDMVersion=%s " % ConfigFlags.Trigger.EDMVersion)
# Temporary hack to add Run-3 navigation to ESD and AOD
if (rec.doESD() or rec.doAOD()) and ConfigFlags.Trigger.EDMVersion == 3:
......
......@@ -74,7 +74,7 @@ def createTriggerFlags():
'''
_log = logging.getLogger('TriggerConfigFlags.EDMVersion')
_log.debug("Attempting to determine EDMVersion")
default_version = 3
default_version = -1 # intentionally invalid default value, ATR-22856
if flags.Input.Format=="BS":
_log.debug("Input format is ByteStream")
inputFileName = flags.Input.Files[0]
......
......@@ -211,7 +211,7 @@ class TriggerConfigGetter(Configured):
from AthenaConfiguration.AllConfigFlags import ConfigFlags
# define ConfigSvc (for Run 1 + 2)
if ConfigFlags.Trigger.EDMVersion <= 2:
if ConfigFlags.Trigger.EDMVersion == 1 or ConfigFlags.Trigger.EDMVersion == 2:
if not self.ConfigSrcList:
if (self.readPool and not self.readRDO) or (self.readRDO and not self.readPool): # (ESD, AOD, DPD) or (RDO-BS)
self.ConfigSrcList = ['ds']
......@@ -430,7 +430,7 @@ class TriggerConfigGetter(Configured):
writeTriggerMenu = False # Run2 offline xAOD metadata summary format. Writing of this now is deprecated. Reading supported still.
writeMenuJSON = False # Run3 offline xAOD metadata summary format
from AthenaConfiguration.AllConfigFlags import ConfigFlags
if ConfigFlags.Trigger.EDMVersion <= 2:
if ConfigFlags.Trigger.EDMVersion == 1 or ConfigFlags.Trigger.EDMVersion == 2:
if ConfigFlags.Trigger.doEDMVersionConversion:
# also save the menu in JSON format
from RecExConfig.AutoConfiguration import GetRunNumber, GetLBNumber
......@@ -463,7 +463,7 @@ class TriggerConfigGetter(Configured):
topAlgs += TrigConf__xAODMenuWriter( OverwriteEventObj = True )
writeTriggerMenu = True
else:
elif ConfigFlags.Trigger.EDMVersion >= 3:
from TrigConfxAOD.TrigConfxAODConf import TrigConf__xAODMenuWriterMT, TrigConf__KeyWriterTool
menuwriter = TrigConf__xAODMenuWriterMT()
menuwriter.KeyWriterTool = TrigConf__KeyWriterTool('KeyWriterToolOffline')
......@@ -480,6 +480,8 @@ class TriggerConfigGetter(Configured):
appendCAtoAthena( acc )
Configurable.configurableRun3Behavior -= 1
else:
raise RuntimeError("Invalid EDMVersion=%s " % ConfigFlags.Trigger.EDMVersion)
# Set up the metadata for the output ESD and AOD:
from RecExConfig.ObjKeyStore import objKeyStore
......
......@@ -74,27 +74,6 @@ class doHLT(JobProperty):
_flags.append(doHLT)
class EDMVersion(JobProperty):
""" if 1, Run1 decoding version is set; if 2, Run2; if 3, Run3 """
statusOn=False
allowedType=['int']
allowedValues=[1,2,3]
StoredValue=3
def _do_action(self):
self.statusOn = True
def __call__(self):
if not self.statusOn:
log = logging.getLogger('TriggerJobOpts.TriggerFlags')
log.warning('TriggerFlags.EDMVersion is deprecated, please use ConfigFlags.Trigger.EDMVersion')
from AthenaConfiguration.AllConfigFlags import ConfigFlags
self.StoredValue = ConfigFlags.Trigger.EDMVersion
self.statusOn = True
return JobProperty.__call__(self)
_flags.append(EDMVersion)
class enableMonitoring(JobProperty):
""" enables certain monitoring type: Validation, Online, Time"""
statusOn=True
......
......@@ -42,14 +42,17 @@ if rec.doTrigger():
if ConfigFlags.Trigger.EDMVersion >= 3:
# for Run 3 we eventually want to disable TrigConfigSvc
tf.configurationSourceList = []
else:
# for reconstructing Run 2 data we need to run the trigger configuration
# from the Run 2 TriggerDB, which is done by the TrigConfigSvc(DSConfigSvc)
elif ConfigFlags.Trigger.EDMVersion == 1 or ConfigFlags.Trigger.EDMVersion == 2:
# for reconstructing Run 1/2 data we need to run the trigger configuration
# from the Run 1/2 TriggerDB, which is done by the TrigConfigSvc(DSConfigSvc)
tf.configurationSourceList = ['ds']
# this configurations are in the old format
from AthenaConfiguration.AllConfigFlags import ConfigFlags
_log.info("Setting ConfigFlags.Trigger.readLVL1FromJSON to False as we are reconstructing Run 2 data")
_log.info("Setting ConfigFlags.Trigger.readLVL1FromJSON to False as we are reconstructing Run %s data",
ConfigFlags.Trigger.EDMVersion)
ConfigFlags.Trigger.readLVL1FromJSON = False
else:
raise RuntimeError("Invalid EDMVersion=%s " % ConfigFlags.Trigger.EDMVersion)
......@@ -89,7 +92,7 @@ if rec.doTrigger():
#---------------------------------------------------------------------------
elif tf.configForStartup()=="HLToffline": # HLT is ran offline so cannot read from COOL.
if ConfigFlags.Trigger.EDMVersion <= 2: # Run 1+2 setup, not needed for Run 3 reco
if ConfigFlags.Trigger.EDMVersion == 1 or ConfigFlags.Trigger.EDMVersion == 2: # Run 1+2 setup, not needed for Run 3 reco
tf.readLVL1configFromXML = True # has to use the .xml file used for reco
tf.readHLTconfigFromXML = True # has to use the .xml file used for reco
# You have to set the 2 following files to the .xml files you want.
......
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