74 """ original dijet scenario work by J. Bossio.
76 produce a singe element list containing a HelperToolConfigTool.
78 Decodes the dijet scenario to form aConditions to select jet pairs
79 with Conditions on the jet pair, and each of the two jets separately.
81 Currently supported cuts:
88 - default values are used for unspecified cuts, except for delta phi and
89 delta eta for which no cut is applied if not requested
90 The cut set can be extended according to the pattern
94 DIJET50j1etXX80j2etXX0j1eta240XX0j2eta320XX700djmass
95 mixed j1/j2 et/eta values
97 DIJET80j12etXX0j12eta240XX700djmass
98 same et/eta cuts for j1 and j2
100 DIJET80j12etXX700djmassXX26djdphi
101 including delta phi cut
103 DIJET70j12etXX1000djmassXX20djdphiXX40djdeta
104 including delta eta cut
106 The tree vector is [0, 0, 1, 1]
107 # pos 0: root; pos 1 dijet cuts; pos 2: j1 cuts; pos 3: j2 cuts'"""
109 assert scenario.startswith(
'DIJET'), \
110 'routing error, module %s: bad scenario %s' % (__name__, scenario)
122 m = rgx_pt.match(scenario)
126 m = rgx_et.match(scenario)
128 assert m
is not None, \
129 'scenario_dijet.py - regex pat %s or %s do not match scenario %s' % (
130 pattern_pt, pattern_et, scenario)
132 groupdict = m.groupdict()
134 to_delete = [k
for k
in groupdict
if groupdict[k]
is None]
135 for k
in to_delete: del groupdict[k]
137 def massage_thresh(threshold_var, gdict):
139 for k
in (
'j12'+threshold_var+
'lo',
140 'j12'+threshold_var+
'hi',
145 new_key =
'j1' + k[len(
'j12'):]
146 gdict[new_key] = gdict[k]
147 new_key =
'j2' + k[len(
'j12'):]
148 gdict[new_key] = gdict[k]
155 groupdict = massage_thresh(threshold_var, groupdict)
158 if 'j1etalo' not in groupdict: groupdict[
'j1etalo'] =
'0'
159 if 'j1etahi' not in groupdict: groupdict[
'j1etahi'] =
'490'
160 if 'j2etalo' not in groupdict: groupdict[
'j2etalo'] =
'0'
161 if 'j2etahi' not in groupdict: groupdict[
'j2etahi'] =
'490'
165 keystubs =
set([k[:-2]
for k
in groupdict
if k.startswith(
'dj')])
170 repcondargs = [RepeatedConditionParams(tree_id = 1,
187 twins = condargs1 == condargs2
189 repcondargs.append(RepeatedConditionParams(tree_id = 2,
192 chainPartInd=chainPartInd,
196 repcondargs.append(RepeatedConditionParams(tree_id = 2,
198 chainPartInd=chainPartInd,
201 repcondargs.append(RepeatedConditionParams(tree_id = 3,
203 chainPartInd=chainPartInd,
209 nconds = len(repcondargs)
211 filterparam_inds = [-1
for i
in range(nconds)]
220 assert treevec == [0, 0, 1]
222 assert treevec == [0, 0, 1, 1]
224 assert len(repcondargs) == len(filterparam_inds)
226 helper_params = HelperConfigToolParams(treevec=treevec,
227 repcondargs=repcondargs,
228 filterparams=filterparams,
229 filterparam_inds=filterparam_inds)
231 return [helper_params]