ATLAS Offline Software
Functions | Variables
python.hypoConfigBuilder Namespace Reference

Functions

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

Variables

 logger
 
 aliasesDict
 
 cd
 

Function Documentation

◆ buildHypoHelperConfigTool()

def 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.

88 def 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()

def python.hypoConfigBuilder.getLabelIndices (   chain_dict)

Definition at line 384 of file hypoConfigBuilder.py.

384 def 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 

◆ hypotool_from_chaindict()

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

Definition at line 395 of file hypoConfigBuilder.py.

395 def 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()

def 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.

276 def 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()

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

Definition at line 346 of file hypoConfigBuilder.py.

346 def 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()

def 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.

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

def 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.

202 def 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()

def 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.

144 def 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()

def 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.

232 def 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()

def 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.

217 def 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()

def 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.

158 def 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()

def 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.

172 def 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()

def 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.

187 def 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()

def 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.

247 def 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()

def 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.

129 def 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

python.hypoConfigBuilder.aliasesDict

Definition at line 45 of file hypoConfigBuilder.py.

◆ cd

python.hypoConfigBuilder.cd

Definition at line 441 of file hypoConfigBuilder.py.

◆ logger

python.hypoConfigBuilder.logger

Definition at line 41 of file hypoConfigBuilder.py.

python.hypoConfigBuilder.getLabelIndices
def getLabelIndices(chain_dict)
Definition: hypoConfigBuilder.py:384
python.hypoConfigBuilder.process_dipz
def process_dipz(scenario, chainPartInd)
Definition: hypoConfigBuilder.py:144
python.scenario_fbdjshared.scenario_fbdjshared
def scenario_fbdjshared(scenario, chainPartInd)
Definition: scenario_fbdjshared.py:9
vtune_athena.format
format
Definition: vtune_athena.py:14
python.scenario_htdipz.scenario_htdipz
def scenario_htdipz(scenario, chainPartInd)
Definition: scenario_htdipz.py:62
python.scenario_ht.scenario_ht
def scenario_ht(scenario, chainPartInd)
Definition: scenario_ht.py:64
python.makeConditionFilterConfigurer.makeConditionFilterConfigurer
def makeConditionFilterConfigurer(filterparams)
Definition: makeConditionFilterConfigurer.py:12
python.TrigCompositeUtils.isLegId
def isLegId(chainName)
Definition: DecisionHandling/python/TrigCompositeUtils.py:18
python.scenario_dipz.scenario_dipz
def scenario_dipz(scenario, chainPartInd)
Definition: scenario_dipz.py:65
python.hypoConfigBuilder.process_ht
def process_ht(scenario, chainPartInd)
Definition: hypoConfigBuilder.py:158
python.hypoConfigBuilder.process_fbdjshared
def process_fbdjshared(scenario, chainPartInd)
Definition: hypoConfigBuilder.py:217
python.scenario_dijet.scenario_dijet
def scenario_dijet(scenario, chainPartInd)
Definition: scenario_dijet.py:73
python.hypoConfigBuilder.process_nonsimple
def process_nonsimple(scenario, chainPartInd)
Definition: hypoConfigBuilder.py:247
python.hypoConfigBuilder.process_htdipz
def process_htdipz(scenario, chainPartInd)
Definition: hypoConfigBuilder.py:172
python.make_repeatedCondConfigurer.make_repeatedCond
def make_repeatedCond(tree_id, tree_pid, clique, multiplicity=1, chainPartInd=-1, conditionMakers=[], invert=False)
Definition: make_repeatedCondConfigurer.py:11
python.hypoConfigBuilder.process_dijet
def process_dijet(scenario, chainPartInd)
Definition: hypoConfigBuilder.py:202
python.hypoConfigBuilder.buildHypoHelperConfigTool
def buildHypoHelperConfigTool(params)
Definition: hypoConfigBuilder.py:88
python.hypoConfigBuilder.hypotool_from_chaindict
def hypotool_from_chaindict(chain_dict, visit_debug=False)
Definition: hypoConfigBuilder.py:395
DerivationFramework::TriggerMatchingUtils::sorted
std::vector< typename T::value_type > sorted(T begin, T end)
Helper function to create a sorted vector from an unsorted one.
python.scenario_mult.scenario_mult
def scenario_mult(scenario, chainPartInd)
Definition: scenario_mult.py:57
python.scenario_fbdjnoshared.scenario_fbdjnoshared
def scenario_fbdjnoshared(scenario, chainPartInd)
Definition: scenario_fbdjnoshared.py:70
python.TrigCompositeUtils.getLegIndexInt
def getLegIndexInt(chainName)
Definition: DecisionHandling/python/TrigCompositeUtils.py:21
Trk::open
@ open
Definition: BinningType.h:40
python.hypoToolDisplay.hypoToolDisplay
def hypoToolDisplay(tool, do_dot=False, dotdir='')
Definition: hypoToolDisplay.py:72
python.hypoConfigBuilder.make_fastreduction_configurers
def make_fastreduction_configurers(chain_dict)
Definition: hypoConfigBuilder.py:276
python.hypoConfigBuilder.process_simple
def process_simple(chain_parts)
Definition: hypoConfigBuilder.py:129
python.hypoConfigBuilder.process_mult
def process_mult(scenario, chainPartInd)
Definition: hypoConfigBuilder.py:187
python.scenario_simple.scenario_simple
def scenario_simple(chain_parts)
Definition: scenario_simple.py:274
python.hypoConfigBuilder.make_prefilter_configurers
def make_prefilter_configurers(chain_dict)
Definition: hypoConfigBuilder.py:346
python.make_repeatedCondConfigurer.make_repeatedCondCfgFromParams
def make_repeatedCondCfgFromParams(repcondarg)
Definition: make_repeatedCondConfigurer.py:44
python.hypoConfigBuilder.process_fbdjnoshared
def process_fbdjnoshared(scenario, chainPartInd)
Definition: hypoConfigBuilder.py:232
python.hypoConfigBuilder.make_root_repcondconfig
def make_root_repcondconfig()
Definition: hypoConfigBuilder.py:73
python.FastReductionAlgToolFactory.toolfactory
toolfactory
Definition: FastReductionAlgToolFactory.py:107