ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
PhysicsAnalysis
Algorithms
JetAnalysisAlgorithms
python
JetTriggerAnalysisConfig.py
Go to the documentation of this file.
1
# Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
2
3
# AnaAlgorithm import(s):
4
from
AnalysisAlgorithmsConfig.ConfigBlock
import
ConfigBlock
5
from
AnalysisAlgorithmsConfig.ConfigAccumulator
import
DataType
6
from
AthenaConfiguration.Enums
import
LHCPeriod
7
from
Campaigns.Utils
import
Campaign
8
from
TriggerAnalysisAlgorithms.TriggerAnalysisConfig
import
TriggerAnalysisBlock
9
from
TriggerAnalysisAlgorithms.TriggerAnalysisSFConfig
import
trigger_set
10
11
def
configure_emulationTool
(alg, config, emulatedChains):
12
# Configuration adapted from
13
# https://gitlab.cern.ch/atlas/athena/-/blob/main/Trigger/TrigEmulation/TrigBtagEmulationTool/python/TrigBtagEmulationToolConfig.py
14
decisionTool = TriggerAnalysisBlock.makeTriggerDecisionTool(config)
15
config.addPrivateTool(
'trigEmulationTool'
,
16
'Trig::TrigBtagEmulationTool'
)
17
trigEmulationTool = alg.trigEmulationTool
18
19
from
TrigBtagEmulationTool.TrigBtagEmulationToolHelpers
import
(
20
TrigBtagEmulation_kwargs)
21
tool_kwargs = TrigBtagEmulation_kwargs(config.flags, emulatedChains)
22
for
prop, value
in
tool_kwargs.items():
23
setattr(trigEmulationTool, prop, value)
24
25
trigEmulationTool.TrigDecisionTool = (
26
f
"{decisionTool.getType()}/{decisionTool.getName()}"
)
27
28
config.addPrivateTool(
'trigEmulationTool.JM_a4tcemsubjes_CNT'
,
29
'Trig::JetManagerTool'
)
30
a4tcemsubjesJet = (
'HLT_xAOD__JetContainer_a4tcemsubjesFS'
31
if
config.campaign()
is
Campaign.MC20a
or
config.dataYear()==2016
32
else
'HLT_xAOD__JetContainer_a4tcemsubjesISFS'
)
33
trigEmulationTool.JM_a4tcemsubjes_CNT.JetContainerName = a4tcemsubjesJet
34
trigEmulationTool.JM_a4tcemsubjes_CNT.LHCPeriod = 2
35
36
config.addPrivateTool(
'trigEmulationTool.JM_Split_CNT'
,
37
'Trig::JetManagerTool'
)
38
trigEmulationTool.JM_Split_CNT.JetContainerName =
'HLT_xAOD__JetContainer_SplitJet'
39
trigEmulationTool.JM_Split_CNT.LHCPeriod = 2
40
41
if
not(config.campaign()
is
Campaign.MC20a
or
config.dataYear()==2016):
42
config.addPrivateTool(
'trigEmulationTool.JM_GSC_CNT'
,
43
'Trig::JetManagerTool'
)
44
trigEmulationTool.JM_GSC_CNT.JetContainerName =
'HLT_xAOD__JetContainer_GSCJet'
45
trigEmulationTool.JM_GSC_CNT.LHCPeriod = 2
46
47
48
class
JetTriggerMatchingBlock
(ConfigBlock):
49
50
def
__init__
(self) :
51
super().
__init__
()
52
self.addOption (
'triggerChainsPerYear'
, {}, type=dict,
53
info=
"a dictionary with key (string) the year and value (list of "
54
"strings) the trigger chains."
)
55
self.addOption (
'includeAllYearsPerRun'
,
False
, type=bool,
56
info=
"all configured years in the LHC run will "
57
"be included in all jobs."
)
58
self.addOption (
'removeHLTPrefix'
,
True
, type=bool,
59
info=
"remove the HLT prefix from trigger chain names."
)
60
self.addOption (
'containerName'
,
''
, type=str,
61
info=
"the input jet container, with a possible selection, in "
62
"the format `container` or `container.selection`."
,
63
meta={
'role'
:
'containerRef'
})
64
self.addOption (
'runL1Matching'
,
True
, type=bool,
65
info=
"Add L1 matching decorations"
)
66
self.addOption (
'runHLTMatching'
,
True
, type=bool,
67
info=
"Add HLT matching decorations"
)
68
self.addOption (
'l1dR'
, 0.4, type=float,
69
info=
"ΔR cone for the L1 (jFEX) trigger matching "
70
"(sets CP::JetTriggerDecoratorAlg.l1dR_cut). Default 0.4 "
71
"matches the algorithm's own default."
)
72
self.addOption (
'hltDR'
, 0.4, type=float,
73
info=
"ΔR cone for the HLT trigger matching "
74
"(sets CP::JetTriggerDecoratorAlg.hltDR_cut). Default 0.4 "
75
"matches the algorithm's own default."
)
76
77
def
instanceName
(self) :
78
"""Return the instance name for this block"""
79
return
self.
containerName
80
81
82
def
makeAlgs
(self, config) :
83
84
triggers = trigger_set(config, self.triggerChainsPerYear,
85
self.includeAllYearsPerRun)
86
decisionTool = TriggerAnalysisBlock.makeTriggerDecisionTool(config)
87
88
for
chain
in
triggers:
89
chain_noHLT = chain.replace(
"HLT_"
,
""
)
90
chain_out = chain_noHLT
if
self.removeHLTPrefix
else
chain
91
chain_out = chain_out.replace(
"-"
,
"_"
).
replace
(
"."
,
"p"
)
92
93
alg = config.createAlgorithm(
'CP::JetTriggerDecoratorAlg'
,
94
'JetTriggerDecoratorAlg_'
+ chain_out )
95
96
alg.trigger = chain
97
98
# To add missing HLT jets -- only for buggy triggers
99
# These extra jets are added because of bug in trigger navigation
100
# Will be removed once bug fixed at DAOD level
101
alg.triggerBugList = [
102
"HLT_j80c_020jvt_j55c_020jvt_j28c_020jvt_j20c_020jvt_SHARED_2j20c_020jvt_bdl1d77_pf_ftf_presel2c20XX2c20b85_L1J45p0ETA21_3J15p0ETA25"
,
103
"HLT_j75c_020jvt_j50c_020jvt_j25c_020jvt_j20c_020jvt_SHARED_2j20c_020jvt_bgn177_pf_ftf_presel2c20XX2c20b85_L1J45p0ETA21_3J15p0ETA25"
104
]
105
106
alg.TrigDecisionTool = f
"{decisionTool.getType()}/{decisionTool.getName()}"
107
108
alg.doL1Matching = self.
runL1Matching
109
alg.doHLTMatching = self.
runHLTMatching
110
alg.jets = config.readName (self.
containerName
)
111
112
# Phase-I L1Calo (jFEX) vs legacy L1Calo is not a user choice — it is
113
# fixed by the data-taking year (data 2024+) and the MC campaign
114
# (mc23e/mc23g). Determine it automatically from the config metadata.
115
if
config.dataType()
is
DataType.Data:
116
usePhaseIL1 = config.dataYear() >= 2024
117
else
:
118
usePhaseIL1 = config.campaign()
in
(Campaign.MC23e, Campaign.MC23g)
119
alg.usePhaseIL1 = usePhaseIL1
120
alg.l1dR_cut = self.l1dR
121
alg.hltDR_cut = self.hltDR
122
123
if
config.geometry()
is
LHCPeriod.Run2
and
self.
runHLTMatching
:
124
125
alg.useEmulationTool =
True
126
configure_emulationTool
(alg, config, [chain])
127
128
decorations = []
129
if
self.
runL1Matching
:
130
decorations += [(
'L1Et'
,
'L1et'
), (
'L1Eta'
,
'L1eta'
),
131
(
'L1Phi'
,
'L1phi'
), (
'L1DR'
,
'L1dr'
),
132
(
'L1Threshold'
,
'L1thresholds'
)]
133
if
self.
runHLTMatching
:
134
decorations += [(
'HLTPt'
,
'HLTpt'
), (
'HLTEta'
,
'HLTeta'
),
135
(
'HLTPhi'
,
'HLTphi'
), (
'HLTDR'
,
'HLTdr'
),
136
(
'HLTThreshold'
,
'HLTthresholds'
)]
137
for
prop, var
in
decorations:
138
outputName =
"match_"
+ chain_out +
"_"
+ var
139
setattr(alg, prop, outputName +
"_%SYS%"
)
140
config.addOutputVar (self.
containerName
,
141
outputName +
"_%SYS%"
,
142
outputName, noSys=
True
)
python.JetTriggerAnalysisConfig.JetTriggerMatchingBlock
Definition
JetTriggerAnalysisConfig.py:48
python.JetTriggerAnalysisConfig.JetTriggerMatchingBlock.containerName
containerName
Definition
JetTriggerAnalysisConfig.py:140
python.JetTriggerAnalysisConfig.JetTriggerMatchingBlock.runHLTMatching
runHLTMatching
Definition
JetTriggerAnalysisConfig.py:123
python.JetTriggerAnalysisConfig.JetTriggerMatchingBlock.instanceName
instanceName(self)
Definition
JetTriggerAnalysisConfig.py:77
python.JetTriggerAnalysisConfig.JetTriggerMatchingBlock.runL1Matching
runL1Matching
Definition
JetTriggerAnalysisConfig.py:129
python.JetTriggerAnalysisConfig.JetTriggerMatchingBlock.makeAlgs
makeAlgs(self, config)
Definition
JetTriggerAnalysisConfig.py:82
python.JetTriggerAnalysisConfig.JetTriggerMatchingBlock.__init__
__init__(self)
Definition
JetTriggerAnalysisConfig.py:50
replace
std::string replace(std::string s, const std::string &s2, const std::string &s3)
Definition
hcg.cxx:312
python.JetTriggerAnalysisConfig.configure_emulationTool
configure_emulationTool(alg, config, emulatedChains)
Definition
JetTriggerAnalysisConfig.py:11
Generated on
for ATLAS Offline Software by
1.17.0