ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
TrigHypothesis
TrigHLTJetHypo
python
scenario_ht.py
Go to the documentation of this file.
1
# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
2
3
from
TrigHLTJetHypo.RepeatedConditionParams
import
RepeatedConditionParams
4
from
TrigHLTJetHypo.FilterParams
import
FilterParams
5
from
TrigHLTJetHypo.HelperConfigToolParams
import
HelperConfigToolParams
6
from
TrigHLTJetHypo.ConditionDefaults
import
defaults
7
from
TrigHLTJetHypo.make_treevec
import
make_treevec
8
9
import
re
10
11
12
pattern_pt_threshold =
r'^HT(?P<htlo>\d+)'
\
13
r'(XX(?P<ptlo>\d*)pt(?P<pthi>\d*))?'
14
15
pattern_et_threshold =
r'^HT(?P<htlo>\d+)'
\
16
r'(XX(?P<etlo>\d*)et(?P<ethi>\d*))?'
17
18
pattern_common =
r'(XX(?P<etalo>\d*)eta(?P<etahi>\d*))?'
\
19
r'(XX(?P<jvtlo>\d*)jvt)?(XX(?P<veto>veto))?$'
20
21
pattern_ptfull = pattern_pt_threshold + pattern_common
22
rgx_pt = re.compile(pattern_ptfull)
23
24
pattern_etfull = pattern_et_threshold + pattern_common
25
rgx_et = re.compile(pattern_etfull)
26
27
def
get_conditionfilter_args_from_matchdict
(groupdict, threshold_var):
28
""" Extract the arguments used by the filter of the HT condition
29
from the dictionary created during the regex matching to the scenario
30
string. THESE CHAINS HAS DEFAULT CONDITION FILTERING"""
31
32
# care! if et no match, etlo and etahi are None.
33
# if et match, missing etlo, ethi = ''
34
# same for eta
35
36
if
groupdict[threshold_var+
'lo'
]
is
None
:
# then default filtering for threshold_var
37
groupdict[threshold_var+
'lo'
] =
'30'
38
groupdict[threshold_var+
'hi'
] =
''
# will be assigned default value
39
40
if
groupdict[
'etalo'
]
is
None
:
# then default filtering for eta
41
groupdict[
'etalo'
] =
''
# will be assigned default value
42
groupdict[
'etahi'
] =
'320'
43
44
45
condargs = []
46
vals =
defaults
(threshold_var,
47
groupdict[threshold_var+
'lo'
],
48
groupdict[threshold_var+
'hi'
])
49
condargs.append((threshold_var, vals))
50
51
vals =
defaults
(
'eta'
,
52
groupdict[
'etalo'
],
53
groupdict[
'etahi'
])
54
condargs.append((
'eta'
, vals))
55
56
# optional
57
if
groupdict[
'jvtlo'
]
is
not
None
:
58
vals =
defaults
(
'jvt'
, groupdict[
'jvtlo'
])
59
condargs.append((
'jvt'
, vals))
60
61
return
condargs
62
63
64
def
scenario_ht(scenario, chainPartInd):
65
"""calculate the parameters needed to generate a hypo helper config AlgTool
66
starting from a the hypoScenario which appears in the chainname for
67
an HT condition. The HT condition is filtered"""
68
69
assert
scenario.startswith(
'HT'
),\
70
'routing error, module %s: bad scenario %s'
% (__name__, scenario)
71
72
threshold_var =
'pt'
73
m = rgx_pt.match(scenario)
74
if
m
is
None
:
75
threshold_var =
'et'
76
m = rgx_et.match(scenario)
77
groupdict = m.groupdict()
78
79
condargs = []
80
vals =
defaults
(
'ht'
,
81
groupdict[
'htlo'
])
82
83
# find the constructor arguments for each elemental condition
84
condargs.append((
'ht'
, vals))
85
86
# treeVec is [0, 0] handle non-root nodes here
87
repcondargs = [RepeatedConditionParams(tree_id = 1,
88
tree_pid=0,
89
chainPartInd=chainPartInd,
90
condargs=condargs,
91
invert=
'veto'
in
scenario)]
92
93
# get the arguments needed for the HT condition filter
94
filterparams =
None
95
condargs =
get_conditionfilter_args_from_matchdict
(groupdict,threshold_var)
96
97
if
condargs:
# has default filterinf, so always True
98
99
# make repeated conditions that filter the ht condition
100
repfiltargs = [RepeatedConditionParams(tree_id=1,
101
tree_pid=0,
102
condargs=condargs)]
103
filterparams = [FilterParams(typename=
'ConditionFilter'
,
104
args=repfiltargs)]
105
filterparam_inds = [0]
106
107
else
:
108
filterparams = []
109
filterparam_inds = [-1]
# no condition filter
110
111
# parameters to initalise the AlgTool that initialises the helper AlgTool
112
113
# treevec[i] gives the tree_id of the parent of the
114
# node with tree_id = i
115
treevec = make_treevec(repcondargs)
116
assert
treevec == [0, 0]
117
118
assert
len(repcondargs) == len(filterparam_inds)
119
120
121
helper_params = HelperConfigToolParams(treevec=treevec,
122
repcondargs=repcondargs,
123
filterparams=filterparams,
124
filterparam_inds=filterparam_inds)
125
126
return
[helper_params]
# a list with one entry per FastReduction tree
127
defaults
Definition
MSVtxValidationAlg.h:44
python.scenario_ht.get_conditionfilter_args_from_matchdict
get_conditionfilter_args_from_matchdict(groupdict, threshold_var)
Definition
scenario_ht.py:27
Generated on
for ATLAS Offline Software by
1.17.0