ATLAS Offline Software
Loading...
Searching...
No Matches
test_HLTmenu.py
Go to the documentation of this file.
1#!/usr/bin/env python3
2# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3
4"""Standalone menu generation in CA mode"""
5
6from AthenaConfiguration.AllConfigFlags import initConfigFlags
7from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
8from AthenaConfiguration.AccumulatorCache import AccumulatorDecorator
9from TriggerJobOpts import runHLT
10
11# Prevent usage of legacy job properties
12from AthenaCommon import JobProperties
13JobProperties.jobPropertiesDisallowed = True
14
15# Set flags
16flags = initConfigFlags()
17runHLT.set_flags(flags)
18flags.Trigger.generateMenuDiagnostics = False
19flags.Common.isOnline = True # online environment
20flags.Input.Files = [] # menu cannot depend on input files
21
22flags.fillFromArgs()
23flags.lock()
24
25# Set the Python OutputLevel on the root logger (usually done in MainServicesCfg)
26from AthenaCommon.Logging import log
27log.setLevel(flags.Exec.OutputLevel)
28
29from TriggerMenuMT.HLT.Config.GenerateMenuMT import generateMenuMT
30acc = ComponentAccumulator()
31menu = generateMenuMT(flags)
32acc.merge(menu)
33
34with open(flags.Trigger.triggerMenuSetup+".pkl", "wb") as f:
35 acc.store(f)
36AccumulatorDecorator.printStats()
37
38# Run menu verification
39import os, sys, subprocess
40sys.stdout.flush()
41rc = subprocess.call("verify_menu_config.py --folder " + os.getcwd(), shell=True)
42if rc != 0:
43 log.error("Menu verification failed")
44sys.exit(rc)