ATLAS Offline Software
Loading...
Searching...
No Matches
python.hypoConfigBuilder Namespace Reference

Functions

 make_root_repcondconfig ()
 buildHypoHelperConfigTool (params)
 process_simple (chain_parts)
 process_dipz (scenario, chainPartInd)
 process_hitz (scenario, chainPartInd)
 process_ht (scenario, chainPartInd)
 process_htdipz (scenario, chainPartInd)
 process_mult (scenario, chainPartInd)
 process_dijet (scenario, chainPartInd)
 process_fbdjshared (scenario, chainPartInd)
 process_fbdjnoshared (scenario, chainPartInd)
 process_nonsimple (scenario, chainPartInd)
 make_fastreduction_configurers (chain_dict)
 make_prefilter_configurers (chain_dict)
 getLabelIndices (chain_dict)
 hypotool_from_chaindict (chain_dict, visit_debug=False)

Variables

 logger = logging.getLogger( __name__)
dict aliasesDict
dict cd

Function Documentation

◆ buildHypoHelperConfigTool()

buildHypoHelperConfigTool ( params)
the parameter object passed in is built in the modules handling
scenarios. It contains the information needed to build the
configuration AlgTool that intialiases a hypo helper AlgTool

Definition at line 89 of file hypoConfigBuilder.py.

89def buildHypoHelperConfigTool(params):
90 """the parameter object passed in is built in the modules handling
91 scenarios. It contains the information needed to build the
92 configuration AlgTool that intialiases a hypo helper AlgTool"""
93
94 # check that each Condition has a Filter index.
95 # the index is -1 for no Condition filtering.
96 assert len(params.repcondargs) == len(params.filterparam_inds)
97 assert len(params.filterparam_inds) >= len(params.filterparams)
98
99 # FastReducer root node
100 repcondobjs = [make_root_repcondconfig()]
101 for ra in params.repcondargs:
102 repcondobjs.append(make_repeatedCondCfgFromParams(ra))
103
104
105 # filter for FastReducer root node (use position 0)
106 filtConditionMakers = []
107 filtConditionMakerInds = [-1] # no condition filtering for root
108
109 for ra_ind in params.filterparam_inds:
110 if ra_ind != -1:
111 ra = params.filterparams[ra_ind]
112 filtConditionMakers.append(makeConditionFilterConfigurer(ra))
113 filtConditionMakerInds.append(len(filtConditionMakers)-1)
114 else:
115 filtConditionMakerInds.append(-1)
116
117 toolclass, name = toolfactory('HelperToolConfigTool')
118
119 vals = {'name': name,
120 'conditionMakers': repcondobjs,
121 'filterMakers': filtConditionMakers,
122 'filterMakerInds': filtConditionMakerInds,
123 'treeVector': params.treevec,
124 'leafVector': params.leafvec,
125 }
126
127 return toolclass(**vals)
128
129

◆ getLabelIndices()

getLabelIndices ( chain_dict)

Definition at line 401 of file hypoConfigBuilder.py.

401def getLabelIndices(chain_dict):
402
403 start_index = 0
404 if isLegId(chain_dict['chainName']):
405 start_index = getLegIndexInt(chain_dict['chainName'])
406
407 end_index = start_index + len(chain_dict['chainParts'])
408
409 return start_index, end_index
410
411
bool isLegId(const HLT::Identifier &legIdentifier)
Recognise whether the chain ID is a leg ID.

◆ hypotool_from_chaindict()

hypotool_from_chaindict ( chain_dict,
visit_debug = False )

Definition at line 412 of file hypoConfigBuilder.py.

412def hypotool_from_chaindict(chain_dict, visit_debug=False):
413
414 toolfactory.reset()
415
416 if visit_debug:
417 fn = chain_dict['chainName'] + '_chaindict.log'
418 from pprint import pprint
419 with open(fn, 'w') as fh:
420 pprint(chain_dict, fh)
421
422
423 helperToolConfigTools = make_fastreduction_configurers(chain_dict)
424
425 prefilterMakers = make_prefilter_configurers(chain_dict)
426
427 toolclass, name = toolfactory('helper_tool')
428 args = {'name': name,
429 'HypoConfigurers': helperToolConfigTools,
430 'prefilterMakers': prefilterMakers
431 }
432
433 helper_tool = toolclass(**args)
434
435 toolclass, name = toolfactory('hypo_tool')
436
437 startLabelIndex, endLabelIndex = getLabelIndices(chain_dict)
438
439 args = {'name': chain_dict['chainName'],
440 # for reporting passing jets:
441 'visit_debug': visit_debug,
442 'helper_tool': helper_tool,
443 'chain_name': chain_dict['chainName'],
444 'startLabelIndex': startLabelIndex,
445 'endLabelIndex': endLabelIndex,
446 }
447
448 hypo_tool = toolclass(**args)
449 hypo_tool.visit_debug = visit_debug
450
451 if (visit_debug):
452 hypoToolDisplay(hypo_tool,
453 do_dot=True)
454
455 return hypo_tool
456

◆ make_fastreduction_configurers()

make_fastreduction_configurers ( chain_dict)
Create HelperToolConfigTool  instances. Each instance
configures a FastReduction tree. Chain parts with the 'simple' scenario
are used to form a single HelperToolConfigTool. The information 
may be spread over a number of chain parts. 

There is at most one chain part with a non-simple scenario. 
This may give rise to > 1 HelperToolConfigTool instance - as this
is how jet sharing among Conditions is handled.

If there are both simple and non-simple scenarios, there will be
n HelperToolConfigTool instances, where n >=2: one for the simple 
scenario chain parts, and n-1 for the non-simple scenario.

Definition at line 293 of file hypoConfigBuilder.py.

293def make_fastreduction_configurers(chain_dict):
294 """Create HelperToolConfigTool instances. Each instance
295 configures a FastReduction tree. Chain parts with the 'simple' scenario
296 are used to form a single HelperToolConfigTool. The information
297 may be spread over a number of chain parts.
298
299 There is at most one chain part with a non-simple scenario.
300 This may give rise to > 1 HelperToolConfigTool instance - as this
301 is how jet sharing among Conditions is handled.
302
303 If there are both simple and non-simple scenarios, there will be
304 n HelperToolConfigTool instances, where n >=2: one for the simple
305 scenario chain parts, and n-1 for the non-simple scenario.
306 """
307
308 chain_parts = chain_dict['chainParts']
309
310 simple_chainparts = [
311 cp for cp in chain_parts if cp['hypoScenario'] == 'simple']
312 simple_cpis = [cp['chainPartIndex'] for cp in simple_chainparts]
313 # check that all the simple scenario parts occur before
314 # non-simple scenario chain parts
315
316 if simple_cpis:
317 assert simple_cpis == sorted(simple_cpis), "disordered chain parts"
318 assert simple_cpis[-1] - simple_cpis[0] == len(simple_cpis) - 1, "nonsequential chainParts"
319 helperToolConfigTools = []
320
321 # check for SHARED markers (chainPart['tboundary'] = 'SHARED')
322 # in the list of simple chain parts.
323 # Get a tree configuration each time SHARED == 1 is encountered.
324 if simple_chainparts:
325
326 assert simple_chainparts[-1]['tboundary'] == ''
327
328 tree_cps = []
329 for cp in simple_chainparts:
330 tree_cps.append(cp)
331 if cp['tboundary'] == 'SHARED':
332 helperToolConfigTools.extend(process_simple(tree_cps))
333 tree_cps = []
334
335 # tree_cps cannot be empty here
336 assert tree_cps
337 helperToolConfigTools.extend(process_simple(tree_cps))
338
339 scenario_chainparts =[
340 cp for cp in chain_parts if cp['hypoScenario'] != 'simple']
341
342 if scenario_chainparts:
343 for scenario_chainpart in scenario_chainparts:
344 # scenario_chainpart = scenario_chainparts[0]
345
346 # We only allow threshold != 0 for the simple scenario.
347 assert scenario_chainpart['threshold'] == '0'
348
349 scenario = scenario_chainpart['hypoScenario']
350 # find the chain part index for a non-simple scenario.
351 # assume simple is processed before non-simple, and that
352 # there is at most one non-simple chainpart.
353 # chainPartInd is needed to report passing jets to the
354 # trigger framework.
355 chainPartInd = scenario_chainpart['chainPartIndex']
356
357 helperToolConfigTools.extend(process_nonsimple(scenario,
358 chainPartInd))
359
360 return helperToolConfigTools
361
362

◆ make_prefilter_configurers()

make_prefilter_configurers ( chain_dict)
Set up the prefilters fo the chain.

Definition at line 363 of file hypoConfigBuilder.py.

363def make_prefilter_configurers(chain_dict):
364 """Set up the prefilters fo the chain."""
365
366 pf_strings = []
367 chain_parts = [cp for cp in chain_dict['chainParts'] if
368 cp['signature'] == 'Jet' and 'prefilters' in cp]
369
370 [pf_strings.extend(cp['prefilters']) for cp in chain_parts]
371
372 # if not pre filter strings (pf_strings) are found in the chainDict,
373 # a PassThroughFilter configurer is made.
374
375 if not pf_strings:
376 return []
377
378 # route the prefilter strings to the appropriate handler
379 prefilter_router = {
380 'MASK': prefilter_mask,
381 'PTRANGE': prefilter_ptrange,
382 'MAXMULT': prefilter_maxmult,
383 'CLEAN': prefilter_clean,
384 }
385
386 pattern = r'(?P<stub>[A-Z]*)'
387 rgx = re.compile(pattern)
388
389 filters = []
390 for pf_string in pf_strings:
391 # get prefilter stub and make sure is correct
392 m = rgx.match(pf_string)
393 assert m is not None,'No prefilter stub was found'
394 groupdict = m.groupdict()
395 assert groupdict['stub'] in prefilter_router,'prefilter stub ({}) not recognized'.format(groupdict['stub'])
396 filters.append(prefilter_router[groupdict['stub']](pf_string))
397
398 return filters
399
400

◆ make_root_repcondconfig()

make_root_repcondconfig ( )
make a repeated condition configurer for the fast reduction
root node. This will will have a single accapt all internal node.

Definition at line 74 of file hypoConfigBuilder.py.

74def make_root_repcondconfig():
75 """make a repeated condition configurer for the fast reduction
76 root node. This will will have a single accapt all internal node."""
77
78 toolclass, name = toolfactory('all')
79 args = {'name': name}
80 conditionMakers = [toolclass(**args)]
81
82 configurer = make_repeatedCond(tree_id=0,
83 tree_pid=0,
84 clique=-1,
85 conditionMakers=conditionMakers)
86
87 return configurer
88

◆ process_dijet()

process_dijet ( scenario,
chainPartInd )
Obtain the paramters needed to build an AlgTool
to initialise a jet hypo HelperAlgTool

Definition at line 218 of file hypoConfigBuilder.py.

218def process_dijet(scenario, chainPartInd):
219 """Obtain the paramters needed to build an AlgTool
220 to initialise a jet hypo HelperAlgTool"""
221
222 # obtain a list of parameter objects that will be used
223 # to build a helper config AlgTools
224 helper_params = scenario_dijet(scenario, chainPartInd)
225
226 # build the helper config AlgTools
227 helperconfigobjs = [buildHypoHelperConfigTool(params) for params in
228 helper_params]
229
230 return helperconfigobjs
231
232

◆ process_dipz()

process_dipz ( scenario,
chainPartInd )
Obtain the paramters needed to build an AlgTool
to initialise a jet hypo HelperAlgTool

Definition at line 145 of file hypoConfigBuilder.py.

145def process_dipz(scenario, chainPartInd):
146 """Obtain the paramters needed to build an AlgTool
147 to initialise a jet hypo HelperAlgTool"""
148
149 # obtain a list of parameter objects that will be used
150 # to build a helper config AlgTools
151 helper_params = scenario_dipz(scenario, chainPartInd)
152
153 # build the helper config AlgTools
154 helperconfigobjs = [buildHypoHelperConfigTool(params) for params in
155 helper_params]
156
157 return helperconfigobjs
158
159

◆ process_fbdjnoshared()

process_fbdjnoshared ( scenario,
chainPartInd )
Obtain the paramters needed to build an AlgTool
to initialise a jet hypo HelperAlgTool

Definition at line 248 of file hypoConfigBuilder.py.

248def process_fbdjnoshared(scenario, chainPartInd):
249 """Obtain the paramters needed to build an AlgTool
250 to initialise a jet hypo HelperAlgTool"""
251
252 # obtain a list of parameter objects that will be used
253 # to build a helper config AlgTools
254 helper_params = scenario_fbdjnoshared(scenario, chainPartInd)
255
256 # build the helper config AlgTools
257 helperconfigobjs = [buildHypoHelperConfigTool(params) for params in
258 helper_params]
259
260 return helperconfigobjs
261
262

◆ process_fbdjshared()

process_fbdjshared ( scenario,
chainPartInd )
Obtain the paramters needed to build an AlgTool
to initialise a jet hypo HelperAlgTool

Definition at line 233 of file hypoConfigBuilder.py.

233def process_fbdjshared(scenario, chainPartInd):
234 """Obtain the paramters needed to build an AlgTool
235 to initialise a jet hypo HelperAlgTool"""
236
237 # obtain a list of parameter objects that will be used
238 # to build a helper config AlgTools
239 helper_params = scenario_fbdjshared(scenario, chainPartInd)
240
241 # build the helper config AlgTools
242 helperconfigobjs = [buildHypoHelperConfigTool(params) for params in
243 helper_params]
244
245 return helperconfigobjs
246
247

◆ process_hitz()

process_hitz ( scenario,
chainPartInd )
Obtain the paramters needed to build an AlgTool
to initialise a jet hypo HelperAlgTool

Definition at line 160 of file hypoConfigBuilder.py.

160def process_hitz(scenario, chainPartInd):
161 """Obtain the paramters needed to build an AlgTool
162 to initialise a jet hypo HelperAlgTool"""
163
164 # obtain a list of parameter objects that will be used
165 # to build a helper config AlgTools
166 helper_params = scenario_hitz(scenario, chainPartInd)
167
168 # build the helper config AlgTools
169 helperconfigobjs = [buildHypoHelperConfigTool(params) for params in
170 helper_params]
171
172 return helperconfigobjs
173

◆ process_ht()

process_ht ( scenario,
chainPartInd )
Obtain the paramters needed to build an AlgTool
to initialise a jet hypo HelperAlgTool

Definition at line 174 of file hypoConfigBuilder.py.

174def process_ht(scenario, chainPartInd):
175 """Obtain the paramters needed to build an AlgTool
176 to initialise a jet hypo HelperAlgTool"""
177
178 # obtain a list of parameter objects that will be used
179 # to build a helper config AlgTools
180 helper_params = scenario_ht(scenario, chainPartInd)
181
182 # build the helper config AlgTools
183 helperconfigobjs = [buildHypoHelperConfigTool(params) for params in
184 helper_params]
185
186 return helperconfigobjs
187

◆ process_htdipz()

process_htdipz ( scenario,
chainPartInd )
Obtain the paramters needed to build an AlgTool
to initialise a jet hypo HelperAlgTool

Definition at line 188 of file hypoConfigBuilder.py.

188def process_htdipz(scenario, chainPartInd):
189 """Obtain the paramters needed to build an AlgTool
190 to initialise a jet hypo HelperAlgTool"""
191
192 # obtain a list of parameter objects that will be used
193 # to build a helper config AlgTools
194 helper_params = scenario_htdipz(scenario, chainPartInd)
195
196 # build the helper config AlgTools
197 helperconfigobjs = [buildHypoHelperConfigTool(params) for params in
198 helper_params]
199
200 return helperconfigobjs
201
202

◆ process_mult()

process_mult ( scenario,
chainPartInd )
Obtain the paramters needed to build an AlgTool
to initialise a jet hypo HelperAlgTool

Definition at line 203 of file hypoConfigBuilder.py.

203def process_mult(scenario, chainPartInd):
204 """Obtain the paramters needed to build an AlgTool
205 to initialise a jet hypo HelperAlgTool"""
206
207 # obtain a list of parameter objects that will be used
208 # to build a helper config AlgTools
209 helper_params = scenario_mult(scenario, chainPartInd)
210
211 # build the helper config AlgTools
212 helperconfigobjs = [buildHypoHelperConfigTool(params) for params in
213 helper_params]
214
215 return helperconfigobjs
216
217

◆ process_nonsimple()

process_nonsimple ( scenario,
chainPartInd )
Maker a list of helper tool config tool for a non-simple scenario.
Note:  a non-simple scenario will  produce more than HelperToolConfigTool
if jet sharing among Conditions is required.

Definition at line 263 of file hypoConfigBuilder.py.

263def process_nonsimple(scenario, chainPartInd):
264 """Maker a list of helper tool config tool for a non-simple scenario.
265 Note: a non-simple scenario will produce more than HelperToolConfigTool
266 if jet sharing among Conditions is required."""
267
268 # interpret scenario aliases
269 if scenario in aliasesDict.keys(): scenario = aliasesDict[scenario]
270
271 router = {
272 'Z': process_dipz,
273 'HZ': process_hitz,
274 'HTZ': process_htdipz,
275 'HT': process_ht,
276 'MULT': process_mult,
277 'DIJET': process_dijet,
278 'FBDJSHARED': process_fbdjshared,
279 'FBDJNOSHARED': process_fbdjnoshared,
280 }
281
282 # get scenario stub and make sure is correct
283 pattern = r'^(?P<stub>[A-Z]+)'
284 rgx = re.compile(pattern)
285 m = rgx.match(scenario)
286 assert m is not None,'No scenario stub was found'
287 groupdict = m.groupdict()
288 assert groupdict['stub'] in router,'scenario stub ({}) not recognized'.format(groupdict['stub'])
289
290 return router[groupdict['stub']](scenario, chainPartInd) # list of HelperToolConfigTool
291
292

◆ process_simple()

process_simple ( chain_parts)
Obtain the paramters needed to build an AlgTool
to initialise a jet hypo HelperAlgTool

Definition at line 130 of file hypoConfigBuilder.py.

130def process_simple(chain_parts):
131 """Obtain the paramters needed to build an AlgTool
132 to initialise a jet hypo HelperAlgTool"""
133
134 # obtain a list of parameter objects that will be used
135 # to build a helper config AlgTools
136 helper_params = scenario_simple(chain_parts)
137
138 # build the helper config AlgTools
139 helperconfigobjs = [buildHypoHelperConfigTool(params) for params in
140 helper_params]
141
142 return helperconfigobjs
143
144

Variable Documentation

◆ aliasesDict

dict python.hypoConfigBuilder.aliasesDict
Initial value:
= {
'DJMASS200j20' : 'DIJET20j12ptXX200djmass',
'DJMASS350j20' : 'DIJET20j12ptXX350djmass',
'DJMASS300j35' : 'DIJET35j12ptXX300djmass',
'DJMASS500j35' : 'DIJET35j12ptXX500djmass',
'DJMASS700j35' : 'DIJET35j12ptXX700djmass',
'DJMASS1000j35' : 'DIJET35j12ptXX1000djmass',
'DJMASS700j40' : 'DIJET40j12ptXX700djmass',
'DJMASS700j50x0eta240' : 'DIJET50j12ptXX0j12eta240XX700djmass',
'DJMASS700j80x0eta240' : 'DIJET80j12ptXX0j12eta240XX700djmass',
'DJMASS900j50' : 'DIJET50j12ptXX900djmass',
'DJMASS1000j50' : 'DIJET50j12ptXX1000djmass',
'DJMASS1000j50dphi240' : 'DIJET50j12ptXX1000djmassXXdjdphi240',
'DJMASS900j50dphi240' : 'DIJET50j12ptXX900djmassXXdjdphi240',
'DJMASS1000j50dphi200x400deta' : 'DIJET50j12ptXX1000djmassXXdjdphi200XX400djdeta',
'DJMASS900j50dphi200x400deta' : 'DIJET50j12ptXX900djmassXXdjdphi200XX400djdeta',
'DJMASS1000j50dphi260x200deta' : 'DIJET50j12ptXX1000djmassXXdjdphi260XX200djdeta',
'DJMASS900j50dphi260x200deta' : 'DIJET50j12ptXX900djmassXXdjdphi260XX200djdeta',
'DJMASS1000j30dphi260x200deta' : 'DIJET30j12ptXX1000djmassXXdjdphi260XX200djdeta',
'DJMASS900j30dphi260x200deta' : 'DIJET30j12ptXX900djmassXXdjdphi260XX200djdeta',
'DJMASS1000j50x200deta' : 'DIJET50j12ptXX1000djmassXX200djdeta',
'DJMASS900j50x200deta' : 'DIJET50j12ptXX900djmassXX200djdeta',
'DJMASS1000j50dphi260' : 'DIJET50j12ptXX1000djmassXXdjdphi260',
'DJMASS900j50dphi260' : 'DIJET50j12ptXX900djmassXXdjdphi260',
}

Definition at line 46 of file hypoConfigBuilder.py.

◆ cd

dict python.hypoConfigBuilder.cd

Definition at line 458 of file hypoConfigBuilder.py.

◆ logger

python.hypoConfigBuilder.logger = logging.getLogger( __name__)

Definition at line 42 of file hypoConfigBuilder.py.