Commit 1a52ad69 authored by Frank Winklmeier's avatar Frank Winklmeier
Browse files

Merge branch 'clean-up-transient-bs' into 'master'

TriggerJobOpts: Clean up transient ByteStream configuration

See merge request !44473
parents 119085c5 284ab8d9
# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
# Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
'''
ComponentAccumulator configuration for producing transient ByteStream,
which is required when running HLT selection algorithms on MC RDO inputs
'''
from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
from ByteStreamCnvSvc.ByteStreamConfig import TransientByteStreamCfg
def triggerTransBSCfg(flags, seqName="AthAlgSeq"):
# ----------------------------------------------------------
# Base function
# ----------------------------------------------------------
def triggerTransBSCfg_Base(flags, itemList, typeNames, extraInputs, seqName="AthAlgSeq"):
'''
Base function for system-specific transient BS configurations.
Arguments:
flags - Configuration AthConfigFlags
itemList - Objects to be written to transient BS
typeNames - Objects to be read from transient BS
extraInputs - Objects to be produced before writing transient BS (scheduler dependency)
seqName - The sequence where transient BS writing algorithm should be placed
'''
acc = ComponentAccumulator(seqName)
transBSCfg = TransientByteStreamCfg(
flags,
item_list=itemList,
type_names=typeNames,
extra_inputs=extraInputs)
itemList = [] # Objects to be written to transient BS
typeNames = [] # Objects to be read from transient BS
extraInputs = [] # Objects to be produced before writing transient BS (scheduler dependency)
# Allow merging extra input lists
def merge_lists(a, b):
a.extend([item for item in b if item not in a])
return a
transBSCfg.getEventAlgo('TransBSStreamAlg')._descriptors['ExtraInputs'].semantics.merge = merge_lists
# --------------------------------------------------
# Level-1 Trigger
# --------------------------------------------------
from TrigT1ResultByteStream.TrigT1ResultByteStreamConfig import L1TriggerByteStreamEncoderCfg
acc.merge(L1TriggerByteStreamEncoderCfg(flags))
acc.merge(transBSCfg, sequenceName=seqName)
return acc
# ----------------------------------------------------------
# Level-1 Trigger
# ----------------------------------------------------------
def triggerTransBSCfg_LVL1(flags, seqName="AthAlgSeq"):
itemList = []
typeNames = []
extraInputs = []
if flags.Trigger.enableL1CaloLegacy or not flags.Trigger.enableL1MuonPhase1:
itemList += ["ROIB::RoIBResult#RoIBResult"]
......@@ -30,68 +53,96 @@ def triggerTransBSCfg(flags, seqName="AthAlgSeq"):
itemList += ["xAOD::TrigCompositeContainer#L1TriggerResult"]
extraInputs += [('xAOD::TrigCompositeContainer', 'StoreGateSvc+L1TriggerResult')]
# --------------------------------------------------
# ID
# --------------------------------------------------
acc = triggerTransBSCfg_Base(flags, itemList, typeNames, extraInputs, seqName)
from TrigT1ResultByteStream.TrigT1ResultByteStreamConfig import L1TriggerByteStreamEncoderCfg
acc.merge(L1TriggerByteStreamEncoderCfg(flags))
return acc
# ----------------------------------------------------------
# ID
# ----------------------------------------------------------
def triggerTransBSCfg_ID(flags, seqName="AthAlgSeq"):
itemList = []
typeNames = []
extraInputs = []
# Pixel
itemList += ["PixelRDO_Container#*"]
typeNames += ["InDet::PixelClusterContainer/PixelOnlineClusters"]
extraInputs += [('PixelHitDiscCnfgData','ConditionStore+PixelHitDiscCnfgData')]
extraInputs += [('PixelCablingCondData','ConditionStore+PixelCablingCondData')]
# SCT
itemList += ["SCT_RDO_Container#*"]
typeNames += ["InDet::SCT_ClusterContainer/SCT_OnlineClusters"]
extraInputs += [('SCT_CablingData','ConditionStore+SCT_CablingData')]
# TRT
itemList += ["TRT_RDO_Container#*"]
typeNames += ["InDet::TRT_DriftCircleContainer/TRT_DriftCircle"]
return triggerTransBSCfg_Base(flags, itemList, typeNames, extraInputs, seqName)
# ----------------------------------------------------------
# Calo
# ----------------------------------------------------------
def triggerTransBSCfg_Calo(flags, seqName="AthAlgSeq"):
itemList = []
typeNames = []
extraInputs = []
# LAr
from LArByteStream.LArByteStreamConfig import LArRawDataContByteStreamToolCfg
acc, larExtraInputs = LArRawDataContByteStreamToolCfg(flags, InitializeForWriting=True)
itemList += ["LArRawChannelContainer#*"]
extraInputs += larExtraInputs
# Tile
itemList += ["TileRawChannelContainer#*"]
typeNames += ["TileCellIDC/TileCellIDC"]
extraInputs += [('TileBadChannels','ConditionStore+TileBadChannels')]
acc.merge(triggerTransBSCfg_Base(flags, itemList, typeNames, extraInputs, seqName))
return acc
# ----------------------------------------------------------
# Muon
# ----------------------------------------------------------
def triggerTransBSCfg_Muon(flags, seqName="AthAlgSeq"):
itemList = []
typeNames = []
extraInputs = []
# MDT
itemList += ["MdtCsmContainer#*"]
typeNames += ["MdtDigitContainer/MDT_DIGITS",
"MdtCsmContainer/MDTCSM"]
extraInputs += [('MuonMDT_CablingMap','ConditionStore+MuonMDT_CablingMap')]
# RPC
itemList += ["RpcPadContainer#*"]
typeNames += ["RpcDigitContainer/RPC_DIGITS",
"RpcPadContainer/RPCPAD"]
# TGC
itemList += ["TgcRdoContainer#*"]
typeNames += ["TgcDigitContainer/TGC_DIGITS",
"TgcRdoContainer/TGCRDO"]
# CSC
itemList += ["CscRawDataContainer#*"]
typeNames += ["CscDigitContainer/CSC_DIGITS",
"CscRawDataContainer/CSCRDO"]
return triggerTransBSCfg_Base(flags, itemList, typeNames, extraInputs, seqName)
# ----------------------------------------------------------
# Combined configuration with all sub-subsystems
# ----------------------------------------------------------
def triggerTransBSCfg(flags, seqName="AthAlgSeq"):
acc = triggerTransBSCfg_LVL1(flags, seqName)
if flags.Trigger.doID:
# Pixel
itemList += ["PixelRDO_Container#*"]
typeNames += ["InDet::PixelClusterContainer/PixelOnlineClusters"]
extraInputs += [('PixelHitDiscCnfgData','ConditionStore+PixelHitDiscCnfgData')]
extraInputs += [('PixelCablingCondData','ConditionStore+PixelCablingCondData')]
# SCT
itemList += ["SCT_RDO_Container#*"]
typeNames += ["InDet::SCT_ClusterContainer/SCT_OnlineClusters"]
extraInputs += [('SCT_CablingData','ConditionStore+SCT_CablingData')]
# TRT
itemList += ["TRT_RDO_Container#*"]
typeNames += ["InDet::TRT_DriftCircleContainer/TRT_DriftCircle"]
# --------------------------------------------------
# Calo
# --------------------------------------------------
acc.merge(triggerTransBSCfg_ID(flags, seqName), sequenceName=seqName)
if flags.Trigger.doCalo:
# LAr
from LArByteStream.LArByteStreamConfig import LArRawDataContByteStreamToolCfg
larToolCA, larExtraInputs = LArRawDataContByteStreamToolCfg(flags, InitializeForWriting=True)
acc.merge(larToolCA)
itemList += ["LArRawChannelContainer#*"]
extraInputs += larExtraInputs
# Tile
itemList += ["TileRawChannelContainer#*"]
typeNames += ["TileCellIDC/TileCellIDC"]
extraInputs += [('TileBadChannels','ConditionStore+TileBadChannels')]
# --------------------------------------------------
# Muon
# --------------------------------------------------
acc.merge(triggerTransBSCfg_Calo(flags, seqName), sequenceName=seqName)
if flags.Trigger.doMuon:
# MDT
itemList += ["MdtCsmContainer#*"]
typeNames += ["MdtDigitContainer/MDT_DIGITS",
"MdtCsmContainer/MDTCSM"]
extraInputs += [('MuonMDT_CablingMap','ConditionStore+MuonMDT_CablingMap')]
# RPC
itemList += ["RpcPadContainer#*"]
typeNames += ["RpcDigitContainer/RPC_DIGITS",
"RpcPadContainer/RPCPAD"]
# TGC
itemList += ["TgcRdoContainer#*"]
typeNames += ["TgcDigitContainer/TGC_DIGITS",
"TgcRdoContainer/TGCRDO"]
# CSC
itemList += ["CscRawDataContainer#*"]
typeNames += ["CscDigitContainer/CSC_DIGITS",
"CscRawDataContainer/CSCRDO"]
# --------------------------------------------------
# Final configuration
# --------------------------------------------------
transBSCfg = TransientByteStreamCfg(
flags,
item_list=itemList,
type_names=typeNames,
extra_inputs=extraInputs)
acc.merge(transBSCfg, sequenceName=seqName)
acc.merge(triggerTransBSCfg_Muon(flags, seqName), sequenceName=seqName)
return acc
......@@ -382,7 +382,10 @@ if ConfigFlags.Trigger.doCalo:
from TrigT2CaloCommon.CaloDef import setMinimalCaloSetup
setMinimalCaloSetup()
if ConfigFlags.Input.Format == 'POOL':
ConfigFlags.Trigger.doTransientByteStream = True # enable transient BS if TrigCaloDataAccessSvc is used with pool data
# Enable transient BS if TrigCaloDataAccessSvc is used with pool data
ConfigFlags.Trigger.doTransientByteStream = True
from TriggerJobOpts.TriggerTransBSConfig import triggerTransBSCfg_Calo
CAtoGlobalWrapper(triggerTransBSCfg_Calo, ConfigFlags, seqName="HLTBeginSeq")
if ConfigFlags.Trigger.doMuon:
TriggerFlags.MuonSlice.doTrigMuonConfig=True
......@@ -466,14 +469,6 @@ if opt.doL1Unpacking:
from DecisionHandling.TestUtils import L1EmulationTest
hltBeginSeq += L1EmulationTest()
# ---------------------------------------------------------------
# Transient ByteStream
# ---------------------------------------------------------------
if ConfigFlags.Trigger.doTransientByteStream:
log.info("Configuring transient ByteStream")
from TriggerJobOpts.TriggerTransBSConfig import triggerTransBSCfg
CAtoGlobalWrapper(triggerTransBSCfg, ConfigFlags, seqName="HLTBeginSeq")
# ---------------------------------------------------------------
# HLT generation
# ---------------------------------------------------------------
......
......@@ -54,6 +54,9 @@ flags.Concurrency.NumThreads = 1
flags.InDet.useSctDCS = False
flags.InDet.usePixelDCS = False
# Calo is currently the only client of Transient BS
flags.Trigger.doTransientByteStream = lambda f: f.Input.Format == 'POOL' and f.Trigger.doCalo
# command line handling
# options that are defined in: AthConfigFlags are handled here
# they override values from above
......@@ -93,12 +96,12 @@ menu = triggerRunCfg(flags, menu=generateHLTMenu)
# menu.printConfig(withDetails=True, summariseProps=True)
acc.merge(menu)
#TODO this is not exactly correct, we need an independent flag for it
if flags.Input.isMC:
from TriggerJobOpts.TriggerTransBSConfig import triggerTransBSCfg
acc.merge(triggerTransBSCfg(flags), sequenceName="HLTBeginSeq")
if flags.Trigger.doMuon:
loadFromSG += [( 'RpcPadContainer' , 'StoreGateSvc+RPCPAD' ), ( 'TgcRdoContainer' , 'StoreGateSvc+TGCRDO' )]
if flags.Trigger.doTransientByteStream and flags.Trigger.doCalo:
from TriggerJobOpts.TriggerTransBSConfig import triggerTransBSCfg_Calo
acc.merge(triggerTransBSCfg_Calo(flags), sequenceName="HLTBeginSeq")
if flags.Input.isMC and flags.Trigger.doMuon:
loadFromSG += [( 'RpcPadContainer' , 'StoreGateSvc+RPCPAD' ), ( 'TgcRdoContainer' , 'StoreGateSvc+TGCRDO' )]
if flags.Trigger.doLVL1:
from TriggerJobOpts.Lvl1SimulationConfig import Lvl1SimulationCfg
......
Markdown is supported
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