ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
TrigAnalysis
TrigDecisionTool
python
TrigDecisionToolConfig.py
Go to the documentation of this file.
1
#
2
# Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3
#
4
5
from
AthenaConfiguration.AccumulatorCache
import
AccumulatorCache
6
from
AthenaCommon.Logging
import
logging
7
8
9
@AccumulatorCache
10
def
TrigDecisionToolCfg
(flags):
11
'''
12
@brief Configures and returns the TrigDecisionTool (TDT) for use in Athena-MT.
13
The TDT uses a Tool interface such that it can be used in either Athena or AnalysisBase releases.
14
The manages an MT-safe internal state, hence we should only have one instance of it configured in any job.
15
It is thus one of the few places where it OK to use a PublicTool in Athena-MT.
16
17
Obtain the configured public tool instance by calling getPrimary()
18
on the ComponentAccumulator returned by this function, or by calling
19
getPublicTool('TrigDecisionTool') or getPrimaryAndMerge()
20
on any downstream merged ComponentAccumulator.
21
22
23
When running in AnalysisBase, the tdt.TrigConfigTool='TrigConf::xAODConfigTool' should be used
24
in place of the TrigConf::xAODConfigSvc
25
'''
26
msg = logging.getLogger(
'TrigDecisionToolCfg'
)
27
from
AthenaConfiguration.ComponentFactory
import
CompFactory
28
from
AthenaConfiguration.ComponentAccumulator
import
ComponentAccumulator
29
from
AthenaConfiguration.Enums
import
Format, Project
30
acc = ComponentAccumulator()
31
32
from
TrigConfxAOD.TrigConfxAODConfig
import
getxAODConfigSvc
33
cfgsvc = acc.getPrimaryAndMerge(getxAODConfigSvc(flags))
34
35
tdt = CompFactory.Trig.TrigDecisionTool(
'TrigDecisionTool'
)
36
tdt.TrigConfigSvc = cfgsvc
37
use_run3_format = flags.Trigger.EDMVersion >= 3
# or flags.Trigger.doEDMVersionConversion (to be added when this is working)
38
tdt.NavigationFormat =
'TrigComposite'
if
use_run3_format
else
'TriggerElement'
39
tdt.HLTSummary =
getRun3NavigationContainerFromInput
(flags)
40
41
if
flags.Input.Format
is
Format.BS
and
flags.Trigger.EDMVersion
in
[1, 2]:
42
tdt.UseAODDecision =
True
43
44
if
flags.Common.Project
is
not
Project.AthAnalysis:
45
# Full Athena
46
# This pre-loads libraries required to read the run 2 trigger navigation
47
from
TrigEDMConfig.TriggerEDM
import
EDMLibraries, getClassesToIgnore
48
nav = CompFactory.HLT.Navigation(
'Navigation'
)
49
nav.Dlls = [e
for
e
in
EDMLibraries
if
'TPCnv'
not
in
e]
50
nav.ClassesFromPayloadIgnore = getClassesToIgnore(flags)
51
52
tdt.Navigation = nav
53
acc.addPublicTool(nav)
54
55
acc.addPublicTool(tdt, primary=
True
)
56
57
msg.info(
'Configuring the TrigDecisionTool and xAODConfigSvc to use ConfigSource: %s, Run3NavigationFormat: %s, Run3NavigationSummaryCollection: %s'
,
58
'InFileMetadata'
if
flags.Trigger.triggerConfig ==
'INFILE'
else
'ConditionsAndDetStore'
,
59
str(use_run3_format),
60
tdt.HLTSummary)
61
62
return
acc
63
64
@AccumulatorCache
65
def
getRun3NavigationContainerFromInput
(flags):
66
from
TrigDecisionTool.TrigDecisionToolHelpers
import
(
67
getRun3NavigationContainerFromInput_forAnalysisBase)
68
return
getRun3NavigationContainerFromInput_forAnalysisBase(flags)
69
70
71
if
__name__ ==
'__main__'
:
72
from
AthenaConfiguration.AllConfigFlags
import
initConfigFlags
73
from
AthenaConfiguration.TestDefaults
import
defaultTestFiles
74
import
sys
75
76
flags = initConfigFlags()
77
if
'--RAWRUN2'
in
sys.argv:
78
flags.Input.Files = defaultTestFiles.RAW_RUN2
79
else
:
80
flags.Input.Files = defaultTestFiles.AOD_RUN2_DATA
81
#TODO expand the test scope Run3 AODs and RAWs
82
83
flags.lock()
84
acc =
TrigDecisionToolCfg
(flags)
85
acc.printConfig(withDetails=
True
, summariseProps=
True
, prefix=
'UnitTest'
)
86
acc.wasMerged()
87
# TODO possibly add EDM printing alg using the TDT
88
python.TrigDecisionToolConfig.getRun3NavigationContainerFromInput
getRun3NavigationContainerFromInput(flags)
Definition
TrigDecisionToolConfig.py:65
python.TrigDecisionToolConfig.TrigDecisionToolCfg
TrigDecisionToolCfg(flags)
Definition
TrigDecisionToolConfig.py:10
Generated on
for ATLAS Offline Software by
1.17.0