ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
TrigHypothesis
TrigHLTJetHypo
python
hypoToolTests.py
Go to the documentation of this file.
1
# Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
2
"""Make chain dicts for testing jet hypo config modules"""
3
4
from
TriggerMenuMT.HLT.Menu.Physics_pp_run3_v1
import
(
5
SingleJetGroup,
6
MultiJetGroup)
7
8
from
TriggerMenuMT.HLT.Config.Utility.ChainDefInMenu
import
ChainProp
9
from
TriggerMenuMT.HLT.Config.Utility.DictFromChainName
import
dictFromChainName
10
11
from
TrigHLTJetHypo.hypoConfigBuilder
import
hypotool_from_chaindict
12
from
TrigHLTJetHypo.HypoToolAnalyser
import
HypoToolAnalyser
13
14
import
unittest
15
16
from
AthenaCommon.Logging
import
logging
17
from
AthenaCommon.Constants
import
DEBUG
18
logger = logging.getLogger( __name__)
19
20
logger.setLevel(DEBUG)
21
22
from
AthenaConfiguration.AllConfigFlags
import
initConfigFlags
23
flags = initConfigFlags()
24
flags.Input.Files = []
25
26
flags.lock()
27
28
class
HypoToolStructure
(unittest.TestCase):
29
def
test_structure
(self):
30
testData = [
31
{
'prop'
:
32
ChainProp(name=
'HLT_j420_subresjesgscIS_ftf_L1J100'
,
33
l1SeedThresholds=[
'FSNOSEED'
],
34
groups=SingleJetGroup),
35
'connections'
: dict(((0, [1]),
36
(1, [2]),
37
(2, [3, 5]),
38
(3, [4]),
39
(5, [6, 7]))),
40
'values'
: []
41
},
42
43
{
'prop'
:
44
ChainProp(name=
'HLT_j260f_L1J75_31ETA49'
,
45
l1SeedThresholds=[
'FSNOSEED'
],
46
groups=SingleJetGroup),
47
'connections'
: dict(((0, [1]),
48
(1, [2]),
49
(2, [3, 5]),
50
(3, [4]),
51
(5, [6, 7]))),
52
'values'
: []
53
},
54
55
56
{
'prop'
:
57
ChainProp(name=
'HLT_j80_j60_L1J15'
,
58
l1SeedThresholds=[
'FSNOSEED'
]*2, groups=MultiJetGroup),
59
'connections'
: dict(((0, [1]),
60
(1, [2]),
61
(2, [3, 5, 8]),
62
(3, [4]),
63
(5, [6, 7]),
64
(8, [9, 10]))),
65
'values'
: []
66
},
67
68
{
69
'prop'
: ChainProp(name=
'HLT_2j80_3j60_L1J15'
,
70
l1SeedThresholds=[
'FSNOSEED'
]*2, groups=MultiJetGroup),
71
'connections'
: dict(((0, [1]), (1, [2]),
72
(2, [3, 5, 8]),
73
(3, [4]),
74
(5, [6, 7]),
75
(8, [9,10]))),
76
'values'
: []
77
},
78
79
{
80
'prop'
: ChainProp(name=
'HLT_j0_HT1000_L1J20'
,
81
l1SeedThresholds=[
'FSNOSEED'
],
82
groups=SingleJetGroup),
83
84
'connections'
: dict(((0, [1]),
85
(1, [2]),
86
(2, [3, 5, 7]),
87
(3, [4]),
88
(5, [6]),
89
(7, [8]),
90
(8, [9, 10]))),
91
'values'
: []
92
},
93
94
{
95
'prop'
: ChainProp(
96
name=
'HLT_j70_1j50a_j0_DIJET70j12etXX1000djmassXXdjdphi200XX400djdeta_L1MJJ-500-NFF'
,
97
l1SeedThresholds=[
'FSNOSEED'
]*3,
98
groups=MultiJetGroup),
99
100
'connections'
: dict(((0, [1]),
101
(1, [2, 11]),
102
(2, [3, 5, 8]),
103
(3, [4]),
104
(5, [6, 7]),
105
(8, [9, 10]),
106
(11, [12, 14, 18]),
107
(12, [13]),
108
(14, [15, 16, 17]),
109
(18, [19, 20]),)),
110
'values'
: []
111
},
112
113
{
114
'prop'
: ChainProp(name=
'HLT_10j40_L1J15'
,
115
l1SeedThresholds=[
'FSNOSEED'
],
116
groups=MultiJetGroup),
117
118
'connections'
: dict(((0, [1]),
119
(1, [2]),
120
(2, [3, 5]),
121
(3, [4]),
122
(5, [6, 7]))),
123
'values'
: [{
'nodeid'
: 5,
124
'multiplicity'
: 10}]
125
},
126
127
{
128
'prop'
: ChainProp(name=
'HLT_j0_FBDJSHARED_L1J20'
,
129
l1SeedThresholds=[
'FSNOSEED'
],
130
groups=SingleJetGroup),
131
132
'connections'
: dict(((0, [1]),
133
(1, [2, 11]),
134
(2, [3, 5, 8]),
135
(3, [4]),
136
(5, [6, 7]),
137
(8, [9, 10]),
138
(11, [12, 14, 17, 20]),
139
(12, [13]),
140
(14, [15, 16]),
141
(17, [18, 19]),
142
(20, [21, 22]))),
143
'values'
: []
144
},
145
146
{
147
'prop'
: ChainProp(name=
'HLT_j40_j0_HT50XX10etXX0eta320_L1J20'
,
148
l1SeedThresholds=[
'FSNOSEED'
]*2,
149
groups=MultiJetGroup),
150
151
'connections'
: dict(((0, [1]),
152
(1, [2, 8]),
153
(2, [3, 5]),
154
(3, [4]),
155
(5, [6, 7]),
156
(8, [9, 11, 13]),
157
(9, [10]),
158
(11, [12]),
159
(13, [14]),
160
(14, [15, 16]))),
161
'values'
: []
162
},
163
164
{
165
'prop'
: ChainProp(name=
'HLT_j0_FBDJNOSHARED10etXX20etXX34massXX50fbet_L1J20'
,
166
l1SeedThresholds=[
'FSNOSEED'
],
167
groups=SingleJetGroup),
168
169
'connections'
: dict(((0, [1]),
170
(1, [2]),
171
(2, [3, 5, 8, 11, 14, 17]),
172
(3, [4]),
173
(5, [6, 7]),
174
(8, [9, 10]),
175
(11, [12, 13]),
176
(14, [15, 16]),
177
(17, [18, 19]))),
178
'values'
: []
179
},
180
181
182
{
183
'prop'
: ChainProp(name=
'HLT_j45_pf_ftf_preselj20_L1J15'
,
184
l1SeedThresholds=[
'FSNOSEED'
],
185
groups=SingleJetGroup),
186
187
'connections'
: dict(((0, [1]),
188
(1, [2]),
189
(2, [3, 5]),
190
(3, [4]),
191
(5, [6, 7]))),
192
'values'
: []
193
},
194
195
{
196
'prop'
: ChainProp(name=
'HLT_j85_ftf_MASK300ceta210XX300nphi10_L1J20'
,
197
l1SeedThresholds=[
'FSNOSEED'
],
198
groups=SingleJetGroup),
199
200
201
'connections'
: dict(((0, [1]),
202
(1, [2, 8]),
203
(2, [3, 5]),
204
(3, [4]),
205
(5, [6, 7]),
206
(8, [9]),
207
(9, [10, 11]))),
208
'values'
: []
209
},
210
211
212
{
213
'prop'
: ChainProp(name=
'HLT_j0_DIJET80j12etXX0j12eta240XX700djmass_L1J20'
,
214
l1SeedThresholds=[
'FSNOSEED'
],
215
groups=SingleJetGroup),
216
217
218
219
'connections'
: dict(((0, [1]),
220
(1, [2]),
221
(2, [3, 5, 7]),
222
(3, [4]),
223
(5, [6]),
224
(7, [8, 9]))),
225
226
'values'
: [{
'nodeid'
: 6,
'min'
:
'700000.0'
,
'max'
:
'inf'
},
227
228
{
'nodeid'
: 7,
'multiplicity'
: 2},
229
{
'nodeid'
: 8,
'min'
:
'80000.0'
,
'max'
:
'inf'
},
230
{
'nodeid'
: 9,
'min'
:
'0.0'
,
'max'
:
'2.4'
},
231
]
232
233
},
234
235
236
]
237
238
for
td
in
testData:
239
chain_dict =chain_dict = dictFromChainName(flags, td[
'prop'
])
240
# set chain part indices (kludge)
241
cpi = 0
242
for
cp
in
chain_dict[
'chainParts'
]:
243
cp[
'chainPartIndex'
] = cpi
244
cpi += 1
245
chain_name = chain_dict[
'chainName'
]
246
tool = hypotool_from_chaindict(chain_dict)
247
248
analyser = HypoToolAnalyser(tool)
249
250
node_table = []
251
for
k
in
sorted(analyser.node_table.keys()):
252
node_table.append (
'%d: %s'
% (k, analyser.node_table[k]))
253
254
node_table =
'\n'
.join(node_table)
255
256
self.assertTrue(analyser.connections == td[
'connections'
],
257
'fail for case %s expected %s; saw %s \n %s'
%(
258
chain_name,
259
str(td[
'connections'
]),
260
str(analyser.connections),
261
node_table))
262
263
# check selected attributes of inner (nested) tools.
264
265
for
ref_values
in
td[
'values'
]:
266
267
# find the inner (nested) subtool
268
# from the tool list in the analyser
269
270
nodeid = ref_values[
'nodeid'
]
271
del ref_values[
'nodeid'
]
272
subtool = analyser.node_table[nodeid]
273
274
# check selected attributes of the subtool
275
276
for
attrname, testval
in
ref_values.items():
277
toolval = getattr(subtool, attrname)
278
self.assertEqual(toolval, testval,
279
msg=
'%s: node: %d expected %s saw %s'
% (
280
chain_name,
281
nodeid,
282
str(testval),
283
str(toolval)))
284
285
286
if
__name__ ==
'__main__'
:
287
288
unittest.main()
289
290
291
python.hypoToolTests.HypoToolStructure
Definition
hypoToolTests.py:28
python.hypoToolTests.HypoToolStructure.test_structure
test_structure(self)
Definition
hypoToolTests.py:29
Constants
Generated on
for ATLAS Offline Software by
1.17.0