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

TriggerMenuMT: use flags in L1 menu generation

Pass the `flags` in the L1 menu generation and remove usage of legacy
flags. The menu name is still passed explicitly in some places, but in
principle that could also just be taken from the `flags`.
parent 857751ff
No related branches found
No related tags found
1 merge request!66697TriggerMenuMT: forbid use of legacy properties in menu generation
......@@ -197,11 +197,7 @@ def generateL1Menu( flags ):
log.info("Generating L1 menu %s", flags.Trigger.triggerMenuSetup)
from TriggerMenuMT.L1.L1MenuConfig import L1MenuConfig
l1cfg = L1MenuConfig(
menuName = flags.Trigger.triggerMenuSetup,
do_alfa = flags.Trigger.L1.doAlfaCtpin,
do_HI_tob_thresholds = flags.Trigger.L1.doHeavyIonTobThresholds,
)
l1cfg = L1MenuConfig(flags)
l1cfg.writeJSON(outputFile = getL1MenuFileName(flags),
bgsOutputFile = getBunchGroupSetFileName(flags))
......
# Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
from collections import OrderedDict as odict
from itertools import groupby
from AthenaCommon.Logging import logging
from AthenaConfiguration.Enums import BeamType
from .Limits import Limits
from .L1MenuFlags import L1MenuFlags
......@@ -23,7 +24,7 @@ def createDefaultBunchGroupSetMC():
return bgs
def createDefaultBunchGroupSet():
def createDefaultBunchGroupSet(flags):
"""
sets default bunchgroups for all menus, needed for simulation.
"""
......@@ -33,11 +34,9 @@ def createDefaultBunchGroupSet():
bgs = BunchGroupSet(name)
bgs.addBunchGroup( BunchGroupSet.BunchGroup(name = 'BCRVeto', internalNumber = 0).addRange(0,3539).addRange(3561,3563).normalize() )\
.addBunchGroup( BunchGroupSet.BunchGroup(name = 'Paired', internalNumber = 1).addTrain(0,3445).addTrain(3536,4).addTrain(3561,3).normalize() )
from AthenaCommon.BeamFlags import jobproperties
if jobproperties.Beam.beamType == 'cosmics':
if flags.Beam.Type is BeamType.Cosmics:
bgs.addBunchGroup( BunchGroupSet.BunchGroup(name = 'EMPTY', internalNumber = 3).addTrain(0,3564).normalize() )
bunchgroupnames = L1MenuFlags.BunchGroupNames()[:Limits.NumBunchgroups]
bunchgroupnames += ['NotUsed'] * (Limits.NumBunchgroups - len(bunchgroupnames))
for i,bgname in enumerate(bunchgroupnames):
......
# Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
from .CTP import CTP
from .Items import MenuItemsCollection
......@@ -21,14 +21,15 @@ class L1Menu(object):
This class holds everything that is needed to define the menu
"""
def __init__(self, menuName, do_alfa=False, do_HI_tob_thresholds=False):
def __init__(self, menuName, flags):
self.menuName = menuName
# items in menu
self.items = MenuItemsCollection()
# all thresholds that are in menu (new and legacy)
self.thresholds = MenuThresholdsCollection(do_HI_tob_thresholds)
self.do_HI_tob_thresholds = flags.Trigger.L1.doHeavyIonTobThresholds
self.thresholds = MenuThresholdsCollection(self.do_HI_tob_thresholds)
# all thresholds that are in menu (new and legacy)
self.topoAlgos = MenuTopoAlgorithmsCollection()
......@@ -40,10 +41,8 @@ class L1Menu(object):
self.boards = MenuBoardsCollection()
# CTP Info in the menu
self.ctp = CTP(do_alfa)
self.ctp = CTP(do_alfa = flags.Trigger.L1.doAlfaCtpin)
self.do_HI_tob_thresholds = do_HI_tob_thresholds
if self.menuName:
smk_psk_Name = get_smk_psk_Name(self.menuName)
self.items.menuName = smk_psk_Name["smkName"]
......
# Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
import re
from importlib import import_module
......@@ -37,9 +37,9 @@ log = logging.getLogger(__name__)
class L1MenuConfig(object):
def __init__(self, menuName, inputFile = None, do_alfa = False, do_HI_tob_thresholds = False ):
def __init__(self, flags, inputFile = None):
L1MenuFlags.MenuSetup = menuName
L1MenuFlags.MenuSetup = flags.Trigger.triggerMenuSetup
self.menuFullName = L1MenuFlags.MenuSetup()
self.menuFilesToLoad = self._menuToLoad()
......@@ -63,16 +63,17 @@ class L1MenuConfig(object):
# menu
L1MenuFlags.CTPVersion = 4 # this needs to be done here already, since L1Menu depends on it during init
self.l1menu = L1Menu(self.menuName, do_alfa, do_HI_tob_thresholds)
self.l1menu = L1Menu(self.menuName, flags)
self.l1menu.setBunchGroupSplitting() # store bunchgroups separate from other item inputs
if not self._checkMenuExistence():
log.error("Generating L1 menu %s is not possible", self.menuName)
else:
log.info("=== Generating L1 menu %s ===", self.menuName)
self._generate()
self._generate(flags)
def _generate(self):
def _generate(self, flags):
log.info("=== Reading definition of algorithms, thresholds, and items ===")
......@@ -87,7 +88,7 @@ class L1MenuConfig(object):
self._generateTopoMenu()
self._generateMenu()
self._generateMenu(flags)
self.generated = True
......@@ -499,7 +500,7 @@ class L1MenuConfig(object):
def _generateMenu(self):
def _generateMenu(self, flags):
if len(self.l1menu.items) > 0:
log.info("L1MenuConfig.generate() has already been called. Will ignore")
......@@ -513,7 +514,7 @@ class L1MenuConfig(object):
# Bunchgroups
# ------------------
from .Base.BunchGroupSet import createDefaultBunchGroupSet
self.l1menu.ctp.bunchGroupSet = createDefaultBunchGroupSet()
self.l1menu.ctp.bunchGroupSet = createDefaultBunchGroupSet(flags)
# ------------------
......
......@@ -4,6 +4,14 @@
import sys
def main():
# Make sure nobody uses deprecated global ConfigFlags
import AthenaConfiguration.AllConfigFlags
del AthenaConfiguration.AllConfigFlags.ConfigFlags
# Prevent usage of legacy job properties
from AthenaCommon import JobProperties
JobProperties.jobPropertiesDisallowed = True
from AthenaConfiguration.AllConfigFlags import initConfigFlags
flags = initConfigFlags()
......@@ -31,7 +39,7 @@ def main():
from TriggerMenuMT.L1.Base.Limits import Limits
from TriggerMenuMT.L1.Base.BunchGroupSet import createDefaultBunchGroupSet
Limits.setLimits(CTPVersion=4)
bgs = createDefaultBunchGroupSet()
bgs = createDefaultBunchGroupSet(flags)
bgs.writeJSON(outputFile = "L1BunchGroupSet.json")
else:
# L1 menu generation
......
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