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'^HT(?P<htlo>\d+)'\
13 r'(XX(?P<ptlo>\d*)pt(?P<pthi>\d*))?'
15 pattern_et_threshold =
r'^HT(?P<htlo>\d+)'\
16 r'(XX(?P<etlo>\d*)et(?P<ethi>\d*))?'
18 pattern_common =
r'(XX(?P<etalo>\d*)eta(?P<etahi>\d*))?'\
19 r'(XX(?P<jvtlo>\d*)jvt)?(XX(?P<veto>veto))?$'
21 pattern_ptfull = pattern_pt_threshold + pattern_common
22 rgx_pt = re.compile(pattern_ptfull)
24 pattern_etfull = pattern_et_threshold + pattern_common
25 rgx_et = re.compile(pattern_etfull)
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"""
36 if groupdict[threshold_var+
'lo']
is None:
37 groupdict[threshold_var+
'lo'] =
'30'
38 groupdict[threshold_var+
'hi'] =
''
40 if groupdict[
'etalo']
is None:
41 groupdict[
'etalo'] =
''
42 groupdict[
'etahi'] =
'320'
47 groupdict[threshold_var+
'lo'],
48 groupdict[threshold_var+
'hi'])
49 condargs.append((threshold_var, vals))
54 condargs.append((
'eta', vals))
57 if groupdict[
'jvtlo']
is not None:
58 vals =
defaults(
'jvt', groupdict[
'jvtlo'])
59 condargs.append((
'jvt', vals))
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"""
69 assert scenario.startswith(
'HT'),\
70 'routing error, module %s: bad scenario %s' % (__name__, scenario)
73 m = rgx_pt.match(scenario)
76 m = rgx_et.match(scenario)
77 groupdict = m.groupdict()
84 condargs.append((
'ht', vals))
87 repcondargs = [RepeatedConditionParams(tree_id = 1,
89 chainPartInd=chainPartInd,
91 invert=
'veto' in scenario)]
100 repfiltargs = [RepeatedConditionParams(tree_id=1,
103 filterparams = [FilterParams(typename=
'ConditionFilter',
105 filterparam_inds = [0]
109 filterparam_inds = [-1]
116 assert treevec == [0, 0]
118 assert len(repcondargs) == len(filterparam_inds)
121 helper_params = HelperConfigToolParams(treevec=treevec,
122 repcondargs=repcondargs,
123 filterparams=filterparams,
124 filterparam_inds=filterparam_inds)
126 return [helper_params]