ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
TriggerCommon
TriggerMenuMT
python
CFtest
test_menu_cf.py
Go to the documentation of this file.
1
#!/usr/bin/env athena
2
# Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3
4
6
7
# - menuManual: chains are generated manually in generateCFChains, and run on input data file
8
# - emuMenuTest: chains are generated in the menu framework as HLT_TestChain**, and run on emulated data
9
# - emuManual: chains are genrated manually and run on emulated data
10
11
import
itertools
12
import
functools
13
14
from
AthenaCommon.Logging
import
logging
15
log = logging.getLogger(
'test_menu_cf'
)
16
from
AthenaCommon.Constants
import
DEBUG
17
18
19
# load all configuration as the real HLT
20
def
set_flags
(flags):
21
22
# Prevent usage of legacy job properties
23
from
AthenaCommon
import
JobProperties
24
JobProperties.jobPropertiesDisallowed =
True
25
26
# generic trigger flags
27
flags.Trigger.doHLT =
True
# needs to be set early as other flags depend on it
28
flags.Trigger.EDMVersion = 3
# Run-3 EDM
29
flags.Common.isOnline =
True
# online environment
30
flags.Input.Files = []
# menu cannot depend on input files
31
32
flags.Trigger.triggerMenuSetup =
"Dev_pp_run3_v1"
33
flags.Trigger.enableL1MuonPhase1 =
False
# doesn't work in this minimal setup
34
flags.Trigger.enabledSignatures = [
'Muon'
,
'Tau'
,
'MinBias'
,
'Bphysics'
,
'Egamma'
,
'Electron'
,
'Photon'
,
'MET'
,
'Jet'
,
'Bjet'
,
'Calib'
]
35
log.info(
"Running on these signatures: %s"
,flags.Trigger.enabledSignatures)
36
37
# these flags are proper for these tests
38
flags.Trigger.doCFEmulationTest =
True
# this enables this emulation tests
39
flags.Trigger.generateMenuDiagnostics =
True
40
# set DEBUG flag on the control-flow builder (before building)
41
import
TriggerMenuMT.HLT.Config.ControlFlow.HLTCFConfig
42
TriggerMenuMT.HLT.Config.ControlFlow.HLTCFConfig.log.setLevel(DEBUG)
43
44
45
def
configure
(flags, args):
46
47
from
TriggerMenuMT.CFtest.generateCFChains
import
generateCFChains
48
from
TriggerMenuMT.CFtest.EmuStepProcessingConfig
import
generateEmuEvents, generateChainsManually, generateEmuMenu
49
50
if
args.menuType ==
'menuManual'
:
51
# test generating chains from real sequences and real data
52
menu =
generateCFChains
(flags)
53
chains = list(itertools.chain(*menu.chainsInMenu.values()))
54
elif
args.menuType ==
'emuMenuTest'
:
55
# test using menu code (HLT_TestChain) with dummy sequences and events
56
generateEmuEvents()
57
chains = generateEmuMenu(flags)
58
elif
args.menuType ==
'emuManual'
:
59
# test generating emulation chains with dummy segments and events
60
generateEmuEvents()
61
chains = generateChainsManually(flags)
62
else
:
63
log.error(
"Input parameter %s not accepted"
,args.menuType)
64
65
return
chains
66
67
def
makeMenu
(flags, args):
68
from
TrigConfigSvc.TrigConfigSvcCfg
import
generateL1Menu
69
generateL1Menu(flags)
70
# from here generate the ControlFlow and the Dataflow
71
# doing the same as menu.generateMT()
72
chains =
configure
(flags, args)
73
74
from
TriggerMenuMT.HLT.Config.GenerateMenuMT
import
makeHLTTree
75
menuCA, cfseqlist = makeHLTTree(flags, chains)
76
77
from
TriggerMenuMT.HLT.Config.Utility.MenuPrescaleSet
import
AutoPrescaleSetGen
78
AutoPrescaleSetGen().
generate
(flags, store=
True
)
79
80
return
menuCA
81
82
def
main
():
83
from
AthenaConfiguration.AllConfigFlags
import
initConfigFlags
84
flags = initConfigFlags()
85
set_flags
(flags)
86
# Add options to command line parser
87
parser = flags.getArgumentParser()
88
89
parser.add_argument(
'--menuType'
, default=
'emuMenuTest'
,
#'emuManual',
90
help=
'use either menu or manual chain building'
)
91
92
# Fill flags from command line
93
args = flags.fillFromArgs(parser=parser)
94
log.info(
'Setup options:'
)
95
log.info(
' %20s = %s'
,
'menuType'
, args.menuType)
96
97
# Configure main services
98
_allflags = flags.clone()
# copy including Concurrency flags
99
_allflags.lock()
100
from
AthenaConfiguration.MainServicesConfig
import
MainServicesCfg
101
cfg = MainServicesCfg(_allflags)
102
del _allflags
103
flags.lock()
104
105
from
TriggerJobOpts.TriggerConfig
import
triggerRunCfg
106
menu = triggerRunCfg(flags, menu=functools.partial(makeMenu, args=args))
107
cfg.merge(menu)
108
cfg.printConfig(withDetails=
False
, summariseProps=
True
, printDefaults=
True
)
109
110
from
AthenaConfiguration.AccumulatorCache
import
AccumulatorDecorator
111
AccumulatorDecorator.printStats()
112
113
from
AthenaCommon.CFElements
import
isSequence
114
for
alg
in
menu.getSequence(
"HLTAllSteps"
).Members:
115
if
isSequence( alg ):
116
continue
117
118
if
"TriggerSummary"
in
alg.getName():
119
alg.OutputLevel = DEBUG
# noqa: ATL900 (testing script)
120
121
return
cfg
122
123
# This entry point is only used when running in athena
124
if
__name__ ==
"__main__"
:
125
import
sys
126
sys.exit(
main
().
run
().isFailure())
Constants
generateCFChains
Definition
generateCFChains.py:1
generate
Definition
generate.cxx:28
test_menu_cf.main
main()
Definition
test_menu_cf.py:82
test_menu_cf.makeMenu
makeMenu(flags, args)
Definition
test_menu_cf.py:67
test_menu_cf.configure
configure(flags, args)
Definition
test_menu_cf.py:45
test_menu_cf.set_flags
set_flags(flags)
Definition
test_menu_cf.py:20
run
int run(int argc, char *argv[])
Definition
ttree2hdf5.cxx:28
Generated on
for ATLAS Offline Software by
1.17.0