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_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()

python.hypoConfigBuilder.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 88 of file hypoConfigBuilder.py.

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

◆ getLabelIndices()

python.hypoConfigBuilder.getLabelIndices ( chain_dict)

Definition at line 384 of file hypoConfigBuilder.py.

384def getLabelIndices(chain_dict):
385
386 start_index = 0
387 if isLegId(chain_dict['chainName']):
388 start_index = getLegIndexInt(chain_dict['chainName'])
389
390 end_index = start_index + len(chain_dict['chainParts'])
391
392 return start_index, end_index
393
394
bool isLegId(const HLT::Identifier &legIdentifier)
Recognise whether the chain ID is a leg ID.

◆ hypotool_from_chaindict()

python.hypoConfigBuilder.hypotool_from_chaindict ( chain_dict,
visit_debug = False )

Definition at line 395 of file hypoConfigBuilder.py.

395def hypotool_from_chaindict(chain_dict, visit_debug=False):
396
397 toolfactory.reset()
398
399 if visit_debug:
400 fn = chain_dict['chainName'] + '_chaindict.log'
401 from pprint import pprint
402 with open(fn, 'w') as fh:
403 pprint(chain_dict, fh)
404
405
406 helperToolConfigTools = make_fastreduction_configurers(chain_dict)
407
408 prefilterMakers = make_prefilter_configurers(chain_dict)
409
410 toolclass, name = toolfactory('helper_tool')
411 args = {'name': name,
412 'HypoConfigurers': helperToolConfigTools,
413 'prefilterMakers': prefilterMakers
414 }
415
416 helper_tool = toolclass(**args)
417
418 toolclass, name = toolfactory('hypo_tool')
419
420 startLabelIndex, endLabelIndex = getLabelIndices(chain_dict)
421
422 args = {'name': chain_dict['chainName'],
423 # for reporting passing jets:
424 'visit_debug': visit_debug,
425 'helper_tool': helper_tool,
426 'chain_name': chain_dict['chainName'],
427 'startLabelIndex': startLabelIndex,
428 'endLabelIndex': endLabelIndex,
429 }
430
431 hypo_tool = toolclass(**args)
432 hypo_tool.visit_debug = visit_debug
433
434 if (visit_debug):
435 hypoToolDisplay(hypo_tool,
436 do_dot=True)
437
438 return hypo_tool
439

◆ make_fastreduction_configurers()

python.hypoConfigBuilder.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 276 of file hypoConfigBuilder.py.

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

◆ make_prefilter_configurers()

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

Definition at line 346 of file hypoConfigBuilder.py.

346def make_prefilter_configurers(chain_dict):
347 """Set up the prefilters fo the chain."""
348
349 pf_strings = []
350 chain_parts = [cp for cp in chain_dict['chainParts'] if
351 cp['signature'] == 'Jet' and 'prefilters' in cp]
352
353 [pf_strings.extend(cp['prefilters']) for cp in chain_parts]
354
355 # if not pre filter strings (pf_strings) are found in the chainDict,
356 # a PassThroughFilter configurer is made.
357
358 if not pf_strings:
359 return []
360
361 # route the prefilter strings to the appropriate handler
362 prefilter_router = {
363 'MASK': prefilter_mask,
364 'PTRANGE': prefilter_ptrange,
365 'MAXMULT': prefilter_maxmult,
366 'CLEAN': prefilter_clean,
367 }
368
369 pattern = r'(?P<stub>[A-Z]*)'
370 rgx = re.compile(pattern)
371
372 filters = []
373 for pf_string in pf_strings:
374 # get prefilter stub and make sure is correct
375 m = rgx.match(pf_string)
376 assert m is not None,'No prefilter stub was found'
377 groupdict = m.groupdict()
378 assert groupdict['stub'] in prefilter_router,'prefilter stub ({}) not recognized'.format(groupdict['stub'])
379 filters.append(prefilter_router[groupdict['stub']](pf_string))
380
381 return filters
382
383

◆ make_root_repcondconfig()

python.hypoConfigBuilder.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 73 of file hypoConfigBuilder.py.

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

◆ process_dijet()

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

Definition at line 202 of file hypoConfigBuilder.py.

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

◆ process_dipz()

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

Definition at line 144 of file hypoConfigBuilder.py.

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

◆ process_fbdjnoshared()

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

Definition at line 232 of file hypoConfigBuilder.py.

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

◆ process_fbdjshared()

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

Definition at line 217 of file hypoConfigBuilder.py.

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

◆ process_ht()

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

Definition at line 158 of file hypoConfigBuilder.py.

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

◆ process_htdipz()

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

Definition at line 172 of file hypoConfigBuilder.py.

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

◆ process_mult()

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

Definition at line 187 of file hypoConfigBuilder.py.

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

◆ process_nonsimple()

python.hypoConfigBuilder.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 247 of file hypoConfigBuilder.py.

247def process_nonsimple(scenario, chainPartInd):
248 """Maker a list of helper tool config tool for a non-simple scenario.
249 Note: a non-simple scenario will produce more than HelperToolConfigTool
250 if jet sharing among Conditions is required."""
251
252 # interpret scenario aliases
253 if scenario in aliasesDict.keys(): scenario = aliasesDict[scenario]
254
255 router = {
256 'Z': process_dipz,
257 'HTZ': process_htdipz,
258 'HT': process_ht,
259 'MULT': process_mult,
260 'DIJET': process_dijet,
261 'FBDJSHARED': process_fbdjshared,
262 'FBDJNOSHARED': process_fbdjnoshared,
263 }
264
265 # get scenario stub and make sure is correct
266 pattern = r'^(?P<stub>[A-Z]+)'
267 rgx = re.compile(pattern)
268 m = rgx.match(scenario)
269 assert m is not None,'No scenario stub was found'
270 groupdict = m.groupdict()
271 assert groupdict['stub'] in router,'scenario stub ({}) not recognized'.format(groupdict['stub'])
272
273 return router[groupdict['stub']](scenario, chainPartInd) # list of HelperToolConfigTool
274
275

◆ process_simple()

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

Definition at line 129 of file hypoConfigBuilder.py.

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

Variable Documentation

◆ aliasesDict

dict python.hypoConfigBuilder.aliasesDict
Initial value:
1= {
2 'DJMASS200j20' : 'DIJET20j12ptXX200djmass',
3 'DJMASS350j20' : 'DIJET20j12ptXX350djmass',
4 'DJMASS300j35' : 'DIJET35j12ptXX300djmass',
5 'DJMASS500j35' : 'DIJET35j12ptXX500djmass',
6 'DJMASS700j35' : 'DIJET35j12ptXX700djmass',
7 'DJMASS1000j35' : 'DIJET35j12ptXX1000djmass',
8 'DJMASS700j40' : 'DIJET40j12ptXX700djmass',
9 'DJMASS700j50x0eta240' : 'DIJET50j12ptXX0j12eta240XX700djmass',
10 'DJMASS700j80x0eta240' : 'DIJET80j12ptXX0j12eta240XX700djmass',
11 'DJMASS900j50' : 'DIJET50j12ptXX900djmass',
12 'DJMASS1000j50' : 'DIJET50j12ptXX1000djmass',
13 'DJMASS1000j50dphi240' : 'DIJET50j12ptXX1000djmassXXdjdphi240',
14 'DJMASS900j50dphi240' : 'DIJET50j12ptXX900djmassXXdjdphi240',
15 'DJMASS1000j50dphi200x400deta' : 'DIJET50j12ptXX1000djmassXXdjdphi200XX400djdeta',
16 'DJMASS900j50dphi200x400deta' : 'DIJET50j12ptXX900djmassXXdjdphi200XX400djdeta',
17 'DJMASS1000j50dphi260x200deta' : 'DIJET50j12ptXX1000djmassXXdjdphi260XX200djdeta',
18 'DJMASS900j50dphi260x200deta' : 'DIJET50j12ptXX900djmassXXdjdphi260XX200djdeta',
19 'DJMASS1000j30dphi260x200deta' : 'DIJET30j12ptXX1000djmassXXdjdphi260XX200djdeta',
20 'DJMASS900j30dphi260x200deta' : 'DIJET30j12ptXX900djmassXXdjdphi260XX200djdeta',
21 'DJMASS1000j50x200deta' : 'DIJET50j12ptXX1000djmassXX200djdeta',
22 'DJMASS900j50x200deta' : 'DIJET50j12ptXX900djmassXX200djdeta',
23
24 'DJMASS1000j50dphi260' : 'DIJET50j12ptXX1000djmassXXdjdphi260',
25 'DJMASS900j50dphi260' : 'DIJET50j12ptXX900djmassXXdjdphi260',
26
27}

Definition at line 45 of file hypoConfigBuilder.py.

◆ cd

dict python.hypoConfigBuilder.cd

Definition at line 441 of file hypoConfigBuilder.py.

◆ logger

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

Definition at line 41 of file hypoConfigBuilder.py.