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
12 pattern_pt_threshold =
r'^MULT(?P<multlo>\d+)mult(?P<multhi>\d+)'\
13 r'(XX(?P<ptlo>\d*)pt(?P<pthi>\d*))?'
15 pattern_et_threshold =
r'^MULT(?P<multlo>\d+)mult(?P<multhi>\d+)'\
16 r'(XX(?P<etlo>\d*)et(?P<ethi>\d*))?'
18 pattern_common =
r'(XX(?P<etalo>\d*)eta(?P<etahi>\d*))?'
20 pattern_ptfull = pattern_pt_threshold + pattern_common
21 rgx_pt = re.compile(pattern_ptfull)
23 pattern_etfull = pattern_et_threshold + pattern_common
24 rgx_et = re.compile(pattern_etfull)
27 """ Extract the arguments used by the filter of the MULT condition
28 from the dictionary greated during ghe regex matching to the sceanario
29 string. THESE CHAINS HAS DEFAULT CONDITION FILTERING"""
35 if groupdict[threshold_var+
'lo']
is None:
36 groupdict[threshold_var+
'lo'] =
''
37 groupdict[threshold_var+
'hi'] =
''
39 if groupdict[
'etalo']
is None:
40 groupdict[
'etalo'] =
''
41 groupdict[
'etahi'] =
''
45 groupdict[threshold_var+
'lo'],
46 groupdict[threshold_var+
'hi'])
47 condargs.append((threshold_var, vals))
52 condargs.append((
'eta', vals))
58 """calculate the parameters needed to generate a hypo helper config AlgTool
59 starting from a the hypoScenario which appears in the chainname for
60 an MULT condition. The MULT condition is filtered"""
62 if not scenario.startswith(
'MULT'):
63 raise ValueError( f
'routing error, module {__name__}: bad scenario {scenario}')
66 m = rgx_pt.match(scenario)
69 m = rgx_et.match(scenario)
70 groupdict = m.groupdict()
78 condargs.append((
'mult', vals))
81 repcondargs = [RepeatedConditionParams(tree_id = 1,
83 chainPartInd=chainPartInd,
93 repfiltargs = [RepeatedConditionParams(tree_id=1,
96 filterparams = [FilterParams(typename=
'ConditionFilter',
98 filterparam_inds = [0]
102 filterparam_inds = [-1]
109 assert treevec == [0, 0]
111 assert len(repcondargs) == len(filterparam_inds)
114 helper_params = HelperConfigToolParams(treevec=treevec,
115 repcondargs=repcondargs,
116 filterparams=filterparams,
117 filterparam_inds=filterparam_inds)
119 return [helper_params]