Loading [MathJax]/extensions/tex2jax.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
MenuComponents.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
2 
3 from TriggerMenuMT.HLT.Config.Utility.HLTMenuConfig import HLTMenuConfig
4 from TriggerMenuMT.HLT.Config.ControlFlow.MenuComponentsNaming import CFNaming
5 from TriggerMenuMT.HLT.Config.ControlFlow.HLTCFTools import (NoHypoToolCreated,
6  algColor,
7  isHypoBase,
8  isInputMakerBase)
9 from AthenaCommon.CFElements import parOR, seqAND, findAlgorithmByPredicate
10 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
11 from AthenaConfiguration.ComponentFactory import CompFactory
12 from DecisionHandling.DecisionHandlingConfig import ComboHypoCfg
13 import GaudiConfig2
14 from TrigCompositeUtils.TrigCompositeUtils import legName
15 from TriggerJobOpts.TriggerConfigFlags import ROBPrefetching
16 
17 from collections.abc import MutableSequence
18 import functools
19 import inspect
20 import re
21 import types
22 
23 from AthenaCommon.Logging import logging
24 log = logging.getLogger( __name__ )
25 # Pool of mutable ComboHypo instances (FIXME: ATR-29181)
26 _ComboHypoPool = dict()
27 _CustomComboHypoAllowed = set()
28 
29 class Node(object):
30  """base class representing one Alg + inputs + outputs, to be used to connect """
31  """stores all the inputs, even if repeated (self.inputs)"""
32  def __init__(self, Alg):
33  self.name = ("%sNode")%( Alg.getName() )
34  self.Alg=Alg
35  self.inputs=[]
36  self.outputs=[]
37 
38  def addOutput(self, name):
39  self.outputs.append(str(name))
40 
41  def addInput(self, name):
42  self.inputs.append(str(name))
43 
44  def getOutputList(self):
45  return self.outputs
46 
47  def getInputList(self):
48  return self.inputs
49 
50  def __repr__(self):
51  return "Node::%s [%s] -> [%s]"%(self.Alg.getName(), ' '.join(map(str, self.getInputList())), ' '.join(map(str, self.getOutputList())))
52 
53 
54 class AlgNode(Node):
55  """Node class that represent an algorithm: sets R/W handles (as unique input/output) and properties as parameters """
56  """Automatically de-duplicates input ReadHandles upon repeated calls to addInput."""
57  def __init__(self, Alg, inputProp, outputProp):
58  Node.__init__(self, Alg)
59  self.outputProp = outputProp
60  self.inputProp = inputProp
61 
62  def addDefaultOutput(self):
63  if self.outputProp != '':
64  self.addOutput(("%s_%s"%(self.Alg.getName(),self.outputProp)))
65 
66  def setPar(self, propname, value):
67  cval = getattr( self.Alg, propname)
68  if isinstance(cval, MutableSequence):
69  cval.append(value)
70  return setattr(self.Alg, propname, cval)
71  else:
72  return setattr(self.Alg, propname, value)
73 
74  def resetPar(self, prop):
75  cval = getattr(self.Alg, prop)
76  if isinstance(cval, MutableSequence):
77  return setattr(self.Alg, prop, [])
78  else:
79  return setattr(self.Alg, prop, "")
80 
81  def getPar(self, prop):
82  return getattr(self.Alg, prop)
83 
84  def resetOutput(self):
85  self.resetPar(self.outputProp)
86 
87  def resetInput(self):
88  self.resetPar(self.inputProp)
89 
90  def addOutput(self, name):
91  outputs = self.readOutputList()
92  if name in outputs:
93  log.debug("Output DH not added in %s: %s already set!", self.Alg.getName(), name)
94  else:
95  if self.outputProp != '':
96  self.setPar(self.outputProp, name)
97  else:
98  log.debug("no outputProp set for output of %s", self.Alg.getName())
99  Node.addOutput(self, name)
100 
101  def readOutputList(self):
102  cval = self.getPar(self.outputProp)
103  return (cval if isinstance(cval, MutableSequence) else
104  ([str(cval)] if cval else []))
105 
106  def addInput(self, name):
107  inputs = self.readInputList()
108  if name in inputs:
109  log.debug("Input DH not added in %s: %s already set!", self.Alg.getName(), name)
110  else:
111  if self.inputProp != '':
112  self.setPar(self.inputProp, name)
113  else:
114  log.debug("no InputProp set for input of %s", self.Alg.getName())
115  Node.addInput(self, name)
116  return len(self.readInputList())
117 
118  def readInputList(self):
119  cval = self.getPar(self.inputProp)
120  return (cval if isinstance(cval, MutableSequence) else
121  ([str(cval)] if cval else []))
122 
123  def __repr__(self):
124  return "Alg::%s [%s] -> [%s]"%(self.Alg.getName(), ' '.join(map(str, self.getInputList())), ' '.join(map(str, self.getOutputList())))
125 
126 
128  """ Class to group info on hypotools for ChainDict"""
129  def __init__(self, hypoToolGen):
130  # Check if the generator function takes flags:
131  self.hasFlags = 'flags' in inspect.signature(hypoToolGen).parameters
132  self.hypoToolGen = hypoToolGen
133  self.name=hypoToolGen.__name__
134 
135  def setConf( self, chainDict):
136  if type(chainDict) is not dict:
137  raise RuntimeError("Configuring hypo with %s, not good anymore, use chainDict" % str(chainDict) )
138  self.chainDict = chainDict
139 
140  def create(self, flags):
141  """creates instance of the hypo tool"""
142  if self.hasFlags:
143  return self.hypoToolGen( flags, self.chainDict )
144  else:
145  return self.hypoToolGen( self.chainDict )
146 
147  def confAndCreate(self, flags, chainDict):
148  """sets the configuration and creates instance of the hypo tool"""
149  self.setConf(chainDict)
150  return self.create(flags)
151 
152 
154  """AlgNode for HypoAlgs"""
155  initialOutput= 'StoreGateSvc+UNSPECIFIED_OUTPUT'
156  def __init__(self, Alg):
157  assert isHypoBase(Alg), "Error in creating HypoAlgNode from Alg " + Alg.name
158  AlgNode.__init__(self, Alg, 'HypoInputDecisions', 'HypoOutputDecisions')
159  self.previous=[]
160 
161  def addOutput(self, name):
162  outputs = self.readOutputList()
163  if name in outputs:
164  log.debug("Output DH not added in %s: %s already set!", self.name, name)
165  elif self.initialOutput in outputs:
166  AlgNode.addOutput(self, name)
167  else:
168  log.error("Hypo %s has already %s as configured output: you may want to duplicate the Hypo!",
169  self.name, outputs[0])
170 
171  def addHypoTool (self, flags, hypoToolConf):
172  log.debug("Adding HypoTool %s for chain %s to %s", hypoToolConf.name, hypoToolConf.chainDict['chainName'], self.Alg.getName())
173  try:
174  result = hypoToolConf.create(flags)
175  if isinstance(result, ComponentAccumulator):
176  tool = result.popPrivateTools()
177  assert not isinstance(tool, list), "Can not handle list of tools"
178  self.Alg.HypoTools.append(tool)
179  return result
180  else:
181  self.Alg.HypoTools = self.Alg.HypoTools + [result] # see ATEAM-773
182 
183  except NoHypoToolCreated as e:
184  log.debug("%s returned empty tool: %s", hypoToolConf.name, e)
185  return None
186 
187  def setPreviousDecision(self,prev):
188  self.previous.append(prev)
189  return self.addInput(prev)
190 
191  def __repr__(self):
192  return "HypoAlg::%s [%s] -> [%s], previous = [%s], HypoTools=[%s]" % \
193  (self.Alg.name,' '.join(map(str, self.getInputList())),
194  ' '.join(map(str, self.getOutputList())),
195  ' '.join(map(str, self.previous)),
196  ' '.join([t.getName() for t in self.Alg.HypoTools]))
197 
198 
200  """AlgNode for InputMaker Algs"""
201  def __init__(self, Alg):
202  assert isInputMakerBase(Alg), "Error in creating InputMakerNode from Alg " + Alg.name
203  AlgNode.__init__(self, Alg, 'InputMakerInputDecisions', 'InputMakerOutputDecisions')
204  self.resetInput()
205  self.resetOutput()
206  input_maker_output = CFNaming.inputMakerOutName(self.Alg.name)
207  self.addOutput(input_maker_output)
208 
209 
211  """AlgNode for Combo HypoAlgs"""
212  def __init__(self, name, comboHypoCfg):
213  self.prop1 = "MultiplicitiesMap"
214  self.prop2 = "LegToInputCollectionMap"
215  self.comboHypoCfg = comboHypoCfg
216  self.acc = self.create( name )
217  thealgs= self.acc.getEventAlgos()
218  if thealgs is None:
219  log.error("ComboHypoNode: Combo alg %s not found", name)
220  if len(thealgs) != 1:
221  log.error("ComboHypoNode: Combo alg %s len is %d",name, len(thealgs))
222  Alg=thealgs[0]
223 
224  log.debug("ComboHypoNode init: Alg %s", name)
225  AlgNode.__init__(self, Alg, 'HypoInputDecisions', 'HypoOutputDecisions')
226  self.resetInput()
227  self.resetOutput()
229  setattr(self.Alg, self.prop1, {})
230  setattr(self.Alg, self.prop2, {})
231 
232  def __del__(self):
233  self.acc.wasMerged()
234 
235  def create (self, name):
236  log.debug("ComboHypoNode.create %s",name)
237  return self.comboHypoCfg(name=name)
238 
239  """
240  AlgNode automatically de-duplicates input ReadHandles upon repeated calls to addInput.
241  Node instead stores all the inputs, even if repeated (self.inputs)
242  This function maps from the raw number of times that addInput was called to the de-duplicated index of the handle.
243  E.g. a step processing chains such as HLT_e5_mu6 would return [0,1]
244  E.g. a step processing chains such as HLT_e5_e6 would return [0,0]
245  E.g. a step processing chains such as HLT_e5_mu6_mu7 would return [0,1,1]
246  These data are needed to configure the step's ComboHypo
247  """
249  mapping = []
250  theInputs = self.readInputList() #only unique inputs
251  for rawInput in self.inputs: # all inputs
252  mapping.append( theInputs.index(rawInput) )
253  return mapping
254 
255 
256  def addChain(self, chainDict):
257  chainName = chainDict['chainName']
258  chainMult = chainDict['chainMultiplicities']
259  legsToInputCollections = self.mapRawInputsToInputsIndex()
260  if len(chainMult) != len(legsToInputCollections):
261  log.error("ComboHypoNode for Alg:{} with addChain for:{} Chain multiplicity:{} Per leg input collection index:{}."
262  .format(self.Alg.name, chainName, tuple(chainMult), tuple(legsToInputCollections)))
263  log.error("The size of the multiplicies vector must be the same size as the per leg input collection vector.")
264  log.error("The ComboHypo needs to know which input DecisionContainers contain the DecisionObjects to be used for each leg.")
265  log.error("Check why ComboHypoNode.addInput(...) was not called exactly once per leg.")
266  raise Exception("[createDataFlow] Error in ComboHypoNode.addChain. Cannot proceed.")
267 
268  cval1 = getattr(self.Alg, self.prop1) # check necessary to see if chain was added already?
269  cval2 = getattr(self.Alg, self.prop2)
270  if type(cval1) is dict or isinstance(cval1, GaudiConfig2.semantics._DictHelper):
271  if chainName in cval1.keys():
272  log.error("ERROR in configuration: ComboAlg %s has already been configured for chain %s", self.Alg.name, chainName)
273  raise Exception("[createDataFlow] Error in ComboHypoNode.addChain. Cannot proceed.")
274  else:
275  cval1[chainName] = chainMult
276  cval2[chainName] = legsToInputCollections
277  else:
278  cval1 = {chainName : chainMult}
279  cval2 = {chainName : legsToInputCollections}
280 
281  setattr(self.Alg, self.prop1, cval1)
282  setattr(self.Alg, self.prop2, cval2)
283 
284 
285  def getChains(self):
286  cval = getattr(self.Alg, self.prop1)
287  return cval.keys()
288 
289 
290  def createComboHypoTools(self, flags, chainDict, comboToolConfs):
291  """Create the ComboHypoTools and add them to the main alg"""
292  if not len(comboToolConfs):
293  return
294  confs = [ HypoToolConf( tool ) for tool in comboToolConfs ]
295  log.debug("ComboHypoNode.createComboHypoTools for chain %s, Alg %s with %d tools", chainDict["chainName"],self.Alg.getName(), len(comboToolConfs))
296  for conf in confs:
297  log.debug("ComboHypoNode.createComboHypoTools adding %s", conf)
298  tools = self.Alg.ComboHypoTools
299  self.Alg.ComboHypoTools = tools + [ conf.confAndCreate( flags, chainDict ) ]
300 
301 
302 
305 
307  """Class to emulate reco sequences with no Hypo"""
308  """It contains an InputMaker and and empty seqAND used for merging"""
309  """It contains empty function to follow the same MenuSequence behaviour"""
310  def __init__(self, the_name):
311  log.debug("Made EmptySequence %s", the_name)
312  self._name = the_name
313 
314  # isEmptyStep causes the IM to try at runtime to merge by feature by default
315  # (i.e for empty steps appended after a leg has finised). But if this failes then it will
316  # merge by initial ROI instead (i.e. for empy steps prepended before a leg has started)
317  makerAlg = CompFactory.InputMakerForRoI(f"IM{the_name}",
318  isEmptyStep = True,
319  RoIsLink = 'initialRoI')
320 
321  self._maker = InputMakerNode( Alg = makerAlg )
322  self._sequence = Node( Alg = seqAND(the_name, [makerAlg]))
323 
325  self.ca.addSequence(seqAND(the_name))
326  self.ca.addEventAlgo(makerAlg, sequenceName=the_name)
327 
328  def __del__(self):
329  self.ca.wasMerged()
330 
331  @property
332  def sequence(self):
333  return self._sequence
334 
335  @property
336  def maker(self):
337  # Input makers are added during DataFlow building (connectToFilter) when a chain
338  # uses this sequence in another step. So we need to make sure to update the
339  # algorithm when accessed.
340  self._maker.Alg = self.ca.getEventAlgo(self._maker.Alg.name)
341  return self._maker
342 
343  @property
344  def name(self):
345  return self._name
346 
347  def getOutputList(self):
348  return self.maker.readOutputList() # Only one since it's merged
349 
350  def connectToFilter(self, outfilter):
351  """Connect filter to the InputMaker"""
352  self.maker.addInput(outfilter)
353 
354  def getHypoToolConf(self):
355  return None
356 
357  def buildDFDot(self, cfseq_algs, all_hypos, last_step_hypo_nodes, file):
358  cfseq_algs.append(self.maker)
359  cfseq_algs.append(self.sequence )
360  file.write(" %s[fillcolor=%s]\n"%(self.maker.Alg.getName(), algColor(self.maker.Alg)))
361  file.write(" %s[fillcolor=%s]\n"%(self.sequence.Alg.getName(), algColor(self.sequence.Alg)))
362  return cfseq_algs, all_hypos, last_step_hypo_nodes
363 
364  def __repr__(self):
365  return "MenuSequence::%s \n Hypo::%s \n Maker::%s \n Sequence::%s \n HypoTool::%s\n"\
366  %(self.name, "Empty", self.maker.Alg.getName(), self.sequence.Alg.getName(), "None")
367 
368 def createEmptyMenuSequenceCfg(flags, name):
369  """ creates the generator function named as the empty sequence"""
370  def create_sequence(flags, name):
371  return EmptyMenuSequence(name)
372  # this allows to create the function with the same name as the sequence
373  create_sequence.__name__ = name
374  globals()[name] = create_sequence
375  return globals()[name]
376 
377 
379  return 'Empty' in o.func.__name__
380 
382  """Class to group reco sequences with the Hypo.
383  By construction it has one Hypo only, which gives the name to this class object"""
384 
385  def __init__(self, flags, selectionCA, HypoToolGen):
386  self.ca = selectionCA
387  # separate the HypoCA to be merged later
388  self.hypoAcc = selectionCA.hypoAcc
389 
390  sequence = self.ca.topSequence()
391  self._sequence = Node(Alg=sequence)
392 
393  # get the InputMaker
394  inputMaker = [ a for a in self.ca.getEventAlgos() if isInputMakerBase(a)]
395  assert len(inputMaker) == 1, f"{len(inputMaker)} input makers in the ComponentAccumulator"
396  inputMaker = inputMaker[0]
397  assert inputMaker.name.startswith("IM"), f"Input maker {inputMaker.name} name needs to start with 'IM'"
398  self._maker = InputMakerNode( Alg = inputMaker )
399  input_maker_output = self.maker.readOutputList()[0] # only one since it's merged
400 
401 
402  # get the HypoAlg
403  hypoAlg = selectionCA.hypoAcc.getEventAlgos()
404  assert len(hypoAlg) == 1, f"{len(hypoAlg)} hypo algs in the ComponentAccumulator"
405  hypoAlg = hypoAlg[0]
406  hypoAlg.RuntimeValidation = flags.Trigger.doRuntimeNaviVal
407 
408  self._name = CFNaming.menuSequenceName(hypoAlg.name)
409  self._hypo = HypoAlgNode( Alg = hypoAlg )
410  self._hypo.addOutput( CFNaming.hypoAlgOutName(hypoAlg.name) )
411  self._hypo.setPreviousDecision( input_maker_output )
412  self._hypoToolConf = HypoToolConf( HypoToolGen )
413 
414  # Connect InputMaker output to ROBPrefetchingAlg(s) if there is any
415  if ROBPrefetching.StepRoI in flags.Trigger.ROBPrefetchingOptions:
416  for child in sequence.Members:
417  if ( isinstance(child, CompFactory.ROBPrefetchingAlg) and
418  input_maker_output not in child.ROBPrefetchingInputDecisions ):
419  child.ROBPrefetchingInputDecisions.append(input_maker_output)
420 
421  log.debug("connecting InputMaker and HypoAlg, adding: InputMaker::%s.output=%s",
422  self.maker.Alg.name, input_maker_output)
423  log.debug("HypoAlg::%s.HypoInputDecisions=%s, HypoAlg::%s.HypoOutputDecisions=%s",
424  self.hypo.Alg.name, self.hypo.readInputList()[0],
425  self.hypo.Alg.name, self.hypo.readOutputList()[0])
426 
427  def __del__(self):
428  self.ca.wasMerged()
429  self.hypoAcc.wasMerged()
430 
431  @property
432  def name(self):
433  return self._name
434 
435  @property
436  def sequence(self):
437  return self._sequence
438 
439  @property
440  def maker(self):
441  # Input makers are added during DataFlow building (connectToFilter) when a chain
442  # uses this sequence in another step. So we need to make sure to update the
443  # algorithm when accessed.
444  self._maker.Alg = self.ca.getEventAlgo(self._maker.Alg.name)
445  return self._maker
446 
447  @property
448  def hypo(self):
449  return self._hypo
450 
451  def getOutputList(self):
452  return [self._hypo.readOutputList()[0]]
453 
454  def connectToFilter(self, outfilter):
455  """Connect filter to the InputMaker"""
456  log.debug("connecting %s to inputs of %s", outfilter, self.maker.Alg.name)
457  self.maker.addInput(outfilter)
458 
459  def getHypoToolConf(self) :
460  return self._hypoToolConf
461 
462 
463  def buildDFDot(self, cfseq_algs, all_hypos, last_step_hypo_nodes, file):
464  cfseq_algs.append(self.maker)
465  cfseq_algs.append(self.sequence)
466  file.write(" %s[fillcolor=%s]\n"%(self.maker.Alg.getName(), algColor(self.maker.Alg)))
467  file.write(" %s[fillcolor=%s]\n"%(self.sequence.Alg.getName(), algColor(self.sequence.Alg)))
468  cfseq_algs.append(self._hypo)
469  file.write(" %s[color=%s]\n"%(self._hypo.Alg.getName(), algColor(self._hypo.Alg)))
470  all_hypos.append(self._hypo)
471  return cfseq_algs, all_hypos, last_step_hypo_nodes
472 
473  def __repr__(self):
474  hyponame = self._hypo.Alg.name
475  hypotool = self._hypoToolConf.name
476  return "MenuSequence::%s \n Hypo::%s \n Maker::%s \n Sequence::%s \n HypoTool::%s\n"\
477  %(self.name, hyponame, self.maker.Alg.name, self.sequence.Alg.name, hypotool)
478 
479 
480 class Chain(object):
481  """Basic class to define the trigger menu """
482  __slots__ ='name','steps','nSteps','alignmentGroups','L1decisions', 'topoMap'
483  def __init__(self, name, ChainSteps, L1decisions, nSteps = None, alignmentGroups = None, topoMap=None):
484 
485  """
486  Construct the Chain from the steps
487  Out of all arguments the ChainSteps & L1Thresholds are most relevant, the chain name is used in debug messages
488  """
489 
490  # default mutable values must be initialized to None
491  if nSteps is None: nSteps = []
492  if alignmentGroups is None: alignmentGroups = []
493 
494  self.name = name
495  self.steps = ChainSteps
496  self.nSteps = nSteps
497  self.alignmentGroups = alignmentGroups
498 
499 
500  # The chain holds a map of topo ComboHypoTool configurators
501  # This is needed to allow placement of the ComboHypoTool in the right position
502  # for multi-leg chains (defaults to last step)
503  # Format is {"[step name]" : ([topo config function], [topo descriptor string]), ...}
504  # Here, the topo descriptor string would usually be the chain name expression that
505  # configures the topo
506  self.topoMap = {}
507  if topoMap:
508  self.topoMap.update(topoMap)
509 
510  # L1decisions are used to set the seed type (EM, MU,JET), removing the actual threshold
511  # in practice it is the HLTSeeding Decision output
512  self.L1decisions = L1decisions
513  log.debug("[Chain.__init__] Made Chain %s with seeds: %s ", name, self.L1decisions)
514 
515  def append_bjet_steps(self,new_steps):
516  assert len(self.nSteps) == 1, "[Chain.append_bjet_steps] appending already-merged step lists - chain object will be broken. This should only be used to append Bjets to jets!"
517  self.steps = self.steps + new_steps
518  self.nSteps = [len(self.steps)]
519 
520  def append_step_to_jet(self,new_steps):
521  assert len(self.nSteps) == 1, "[Chain.append_step_to_jet] appending already-merged step lists - chain object will be broken. This is used either for appending Beamspot algorithms to jets!"
522  self.steps = self.steps + new_steps
523  self.nSteps = [len(self.steps)]
524 
525 
526  def numberAllSteps(self):
527  if len(self.steps)==0:
528  return
529  else:
530  for stepID,step in enumerate(self.steps):
531  step_name = step.name
532  if re.search('^Step[0-9]_',step_name):
533  step_name = step_name[6:]
534  elif re.search('^Step[0-9]{2}_', step_name):
535  step_name = step_name[7:]
536  step.name = 'Step%d_'%(stepID+1)+step_name
537  # also modify the empty sequence names to follow the step name change
538  for iseq, seq in enumerate(step.sequenceGens):
539  if isEmptySequenceCfg(seq):
540  name = seq.func.__name__
541  if re.search('Seq[0-9]_',name):
542  newname = re.sub('Seq[0-9]_', 'Seq%d_'%(stepID+1), name)
543  #replace the empty sequence
544  thisEmpty = createEmptyMenuSequenceCfg(flags=None, name=newname)
545  step.sequenceGens[iseq]=functools.partial(thisEmpty, flags=None, name=newname)
546  return
547 
548 
549  def insertEmptySteps(self, empty_step_name, n_new_steps, start_position):
550  #start position indexed from 0. if start position is 3 and length is 2, it works like:
551  # [old1,old2,old3,old4,old5,old6] ==> [old1,old2,old3,empty1,empty2,old4,old5,old6]
552 
553  if len(self.steps) == 0 :
554  log.error("I can't insert empty steps because the chain doesn't have any steps yet!")
555 
556  if len(self.steps) < start_position :
557  log.error("I can't insert empty steps at step %d because the chain doesn't have that many steps!", start_position)
558 
559 
560  chain_steps_pre_split = self.steps[:start_position]
561  chain_steps_post_split = self.steps[start_position:]
562 
563  next_step_name = ''
564  prev_step_name = ''
565  # copy the same dictionary as the last step, which else?
566  prev_chain_dict = []
567  if start_position == 0:
568  next_step_name = chain_steps_post_split[0].name
569  if re.search('^Step[0-9]_',next_step_name):
570  next_step_name = next_step_name[6:]
571  elif re.search('^Step[0-9]{2}_', next_step_name):
572  next_step_name = next_step_name[7:]
573 
574  prev_step_name = 'empty_'+str(len(self.L1decisions))+'L1in'
575  prev_chain_dict = chain_steps_post_split[0].stepDicts
576  else:
577  if len(chain_steps_post_split) == 0:
578  log.error("Adding empty steps to the end of a chain (%s)- why would you do this?",self.name)
579  else:
580  prev_step_name = chain_steps_pre_split[-1].name
581  next_step_name = chain_steps_post_split[0].name
582  prev_chain_dict = chain_steps_pre_split[-1].stepDicts
583 
584 
585  steps_to_add = []
586  for stepID in range(1,n_new_steps+1):
587  new_step_name = prev_step_name+'_'+empty_step_name+'%d_'%stepID+next_step_name
588 
589  log.debug("Adding empty step %s", new_step_name)
590  steps_to_add += [ChainStep(new_step_name, chainDicts=prev_chain_dict, comboHypoCfg=ComboHypoCfg, isEmpty=True)]
591 
592  self.steps = chain_steps_pre_split + steps_to_add + chain_steps_post_split
593 
594  return
595 
596  def checkMultiplicity(self):
597  #TODO: Not used anymore, can we delete it?
598  if len(self.steps) == 0:
599  return 0
600  mult=[sum(step.multiplicity) for step in self.steps] # on mult per step
601  not_empty_mult = [m for m in mult if m!=0]
602  if len(not_empty_mult) == 0: #empty chain?
603  log.error("checkMultiplicity: Chain %s has all steps with multiplicity =0: what to do?", self.name)
604  return 0
605  if not_empty_mult.count(not_empty_mult[0]) != len(not_empty_mult):
606  log.error("checkMultiplicity: Chain %s has steps with differnt multiplicities: %s", self.name, ' '.join(mult))
607  return 0
608 
609  if not_empty_mult[0] != len(self.L1decisions):
610  log.error("checkMultiplicity: Chain %s has %d multiplicity per step, and %d L1Decisions", self.name, mult, len(self.L1decisions))
611  return 0
612  return not_empty_mult[0]
613 
614 
615  # Receives a pair with the topo config function and an identifier string,
616  # optionally also a target step name
617  # The string is needed to rename the step after addition of the ComboHypoTool
618  def addTopo(self,topoPair,step="last"):
619  stepname = "last step" if step=="last" else step.name
620  log.debug("Adding topo configurator %s for %s to %s", topoPair[0].__qualname__, topoPair[1], "step " + stepname)
621  self.topoMap[step] = topoPair
622 
623  def __str__(self):
624  return "\n-*- Chain %s -*- \n + Seeds: %s, Steps: %s, AlignmentGroups: %s "%(\
625  self.name, ' '.join(map(str, self.L1decisions)), self.nSteps, self.alignmentGroups)
626 
627  def __repr__(self):
628  return "\n-*- Chain %s -*- \n + Seeds: %s, Steps: %s, AlignmentGroups: %s \n + Steps: \n %s \n"%(\
629  self.name, ' '.join(map(str, self.L1decisions)), self.nSteps, self.alignmentGroups, '\n '.join(map(str, self.steps)))
630 
631 
632 # next: can we remove multiplicity array, if it can be retrieved from the ChainDict?
633 # next: can we describe emtpy steps with isEmpty flag only (not via multiplicity and setting comboHypoCfg=None)?
635  """Class to describe one step of a chain; if multiplicity is greater than 1, the step is combo/combined. Set one multiplicity value per sequence"""
636  #TODO remove default argument comboHypoCfg
637  def __init__(self, name, SequenceGens = None, chainDicts = None, comboHypoCfg = ComboHypoCfg , comboToolConfs = None, isEmpty = False, createsGhostLegs = False):
638 
639  # default mutable values must be initialized to None
640  if SequenceGens is None: SequenceGens = []
641  if comboToolConfs is None: comboToolConfs = []
642 
643  assert chainDicts is not None,"Error building a ChainStep without a chainDicts"
644 
645  self.name = name
646  self.sequences = []
647  self.sequenceGens = SequenceGens
648  self.comboHypoCfg = comboHypoCfg
649  self.comboToolConfs = list(comboToolConfs)
650  self.stepDicts = chainDicts # one dict per leg
651 
652  self.isEmpty = isEmpty
653  if self.isEmpty:
654  self.multiplicity = []
655  else:
656  self.multiplicity = [1 for seq in self.sequenceGens]
657  log.debug("Building step %s for chain %s: len=%d multiplicty=%s", name, chainDicts[0]['chainName'], len(chainDicts), ' '.join(map(str,[mult for mult in self.multiplicity])))
658  # sanity check on inputs, excluding empty steps
659  if len(chainDicts) != len(self.multiplicity) and 'Jet' not in chainDicts[0]['signatures']:
660  log.error("[ChainStep] SequenceGens: %s",self.sequenceGens)
661  log.error("[ChainStep] chainDicts: %s",chainDicts)
662  log.error("[ChainStep] multiplicity: %s",self.multiplicity)
663  raise RuntimeError("[ChainStep] Tried to configure a ChainStep %s with %i multiplicity and %i dictionaries. These lists must have the same size" % (name, len(self.multiplicity), len(chainDicts)) )
664 
665 
666  for iseq, seq in enumerate(self.sequenceGens):
667  if not isinstance(seq, functools.partial):
668  log.error("[ChainStep] %s SequenceGens verification failed, sequence %d is not partial function, likely ChainBase.getStep function was not used", self.name, iseq)
669  log.error("[ChainStep] It rather seems to be of type %s trying to print it", type(seq))
670  raise RuntimeError("Sequence is not packaged in a tuple, see error message above" )
671 
672  self.onlyJets = False
673  sig_set = None
674  if len(chainDicts) > 0 and 'signature' in chainDicts[0]:
675  leg_signatures = [step['signature'] for step in chainDicts if step['signature'] != 'Bjet']
676  if (len(self.multiplicity) > 0 and leg_signatures.count('Jet') == 1) and (len(set(leg_signatures)) > 1 and chainDicts[0]['signatures'].count('Jet') > 1) and (len(leg_signatures) != 2 or leg_signatures.count('MET') == 0):
677  index_jetLeg = leg_signatures.index('Jet')
678  self.multiplicity[index_jetLeg:index_jetLeg] = [1] * (len(chainDicts[0]['chainMultiplicities']) - len(self.multiplicity))
679  sig_set = set([step['signature'] for step in chainDicts])
680  if len(sig_set) == 1 and ('Jet' in sig_set or 'Bjet' in sig_set):
681  self.onlyJets = True
682  if len(sig_set) == 2 and ('Jet' in sig_set and 'Bjet' in sig_set):
683  self.onlyJets = True
684 
685 
686 
687  if not self.isEmpty:
688  #self.relabelLegIdsForJets()
689  self.setChainPartIndices()
690  self.legIds = self.getLegIds()
691  self.makeCombo()
692 
693  def createSequences(self):
694  """ creation of this step sequences with instantiation of the CAs"""
695  log.debug("creating sequences for step %s", self.name)
696  for seq in self.sequenceGens:
697  self.sequences.append(seq()) # create the sequences
698 
700  has_jets = False
701  leg_counter = []
702 
703  for step_dict in self.stepDicts:
704  if 'Jet' in step_dict['signatures'] or 'Bjet' in step_dict['signatures']:
705  has_jets = True
706  leg_counter += [len(step_dict['chainParts'])]
707  elif len(step_dict['chainParts']) > 1:
708  log.error("[relabelLegIdsForJets] this should only happen for jet chains, but the signatures are %s",step_dict['signatures'])
709  raise Exception("[relabelLegIdsForJets] leg labelling is probably wrong...")
710  else:
711  leg_counter +=[1]
712 
713  self.onlyJets = False
714  if len(leg_counter) == len(self.multiplicity):
715  self.onlyJets = True
716 
717  log.debug("[relabelLegIdsForJets] leg_counter: %s , onlyjets: %s, multiplicity: %s...",leg_counter, self.onlyJets, self.multiplicity)
718 
719  if not has_jets or len(leg_counter) == len(self.multiplicity): #also don't relabel only jets since no offset needed
720  return
721 
722  if len(leg_counter) == 1 or (len(set(leg_counter)) == 1 and leg_counter[0] == 1):
723  #all legs are already length 1, or there's only one jet blocks nothing to do
724  return
725  elif len(set(leg_counter[:-1])) == 1 and leg_counter[0] == 1:
726  #it's the last leg that's not length one, so we don't need to relabel any end legs
727  return
728  else:
729  nLegs = 0
730  for i,nLegParts in enumerate(leg_counter):
731  oldLegName = self.stepDicts[i]['chainName']
732  if re.search('^leg[0-9]{3}_',oldLegName):
733  oldLegName = oldLegName[7:]
734  else:
735  log.error("[relabelLegIdsForJets] you told me to relabel the legs for %s",self.stepDicts)
736  raise Exception("[relabelLegIdsForJets] you told me to relabel the legs but this leg doesn't have a legXXX_ name!")
737  self.stepDicts[i]['chainName'] = legName(oldLegName,nLegs)
738  nLegs += nLegParts
739  return
740 
741  #Heather updated for full jet chain dicts
743  leg_counter = 0
744  lists_of_chainPartNames = []
745  for step_dict in self.stepDicts:
746  if len(lists_of_chainPartNames) == 0:
747  lists_of_chainPartNames += [[cp['chainPartName'] for cp in step_dict['chainParts']]]
748  else:
749  new_list_of_chainPartNames = [cp['chainPartName'] for cp in step_dict['chainParts']]
750  if new_list_of_chainPartNames == lists_of_chainPartNames[-1]:
751  leg_counter -= len(new_list_of_chainPartNames)
752  for chainPart in step_dict['chainParts']:
753  chainPart['chainPartIndex'] = leg_counter
754  leg_counter += 1
755  return
756 
757  def getLegIds(self):
758  """ get the gelId from the step dictionary for multi-leg chains"""
759  if len(self.multiplicity) <= 1: # single leg step
760  return [0]
761  leg_ids = []
762  for istep,step_dict in enumerate(self.stepDicts):
763  if step_dict['chainName'][0:3] != 'leg':
764  if self.onlyJets:
765  leg_ids += [istep]
766  else:
767  log.error("[getLegIds] chain %s has multiplicities %s but no legs? ",step_dict['chainName'], self.multiplicity)
768  raise Exception("[getLegIds] cannot extract leg IDs, exiting.")
769  else:
770  leg_ids += [int(step_dict['chainName'][3:6])]
771  return leg_ids
772 
773  def addComboHypoTools(self, tool):
774  #this function does not add tools, it just adds one tool. do not pass it a list!
775  self.comboToolConfs.append(tool)
776 
778  return self.comboHypoCfg.__name__ if isinstance(self.comboHypoCfg, types.FunctionType) else self.comboHypoCfg
779 
780 
781  def makeCombo(self):
782  """ Configure the Combo Hypo Alg and generate the corresponding function, without instantiation which is done in createSequences() """
783  self.combo = None
784  if self.isEmpty or self.comboHypoCfg is None:
785  return
786  comboNameFromStep = CFNaming.comboHypoName(self.name) # name expected from the step name
787  funcName = self.getComboHypoFncName() # name of the function generator
788  key = hash((comboNameFromStep, funcName))
789  if key not in _ComboHypoPool:
790  tmpCombo = ComboHypoNode(comboNameFromStep, self.comboHypoCfg)
791  CHname = tmpCombo.name[:-4] # remove 'Node'
792  # exceptions for BLS chains that re-use the same custom CH in differnt steps
793  # this breaks the run-one-CH-per-step, but the BLS CH are able to handle decisions internally
794  if comboNameFromStep != CHname:
795  log.debug("Created ComboHypo with name %s, expected from the step is instead %s. This is accepted only for allowed custom ComboHypos", CHname, comboNameFromStep)
796  _CustomComboHypoAllowed.add(CHname)
797  key = hash((CHname, funcName))
798  _ComboHypoPool[key] = tmpCombo
799  self.combo = _ComboHypoPool[key]
800  log.debug("Created combo %s with name %s, step comboName %s, key %s", funcName, self.combo.name, comboNameFromStep,key)
801 
802 
803  def createComboHypoTools(self, flags, chainName):
804  chainDict = HLTMenuConfig.getChainDictFromChainName(chainName)
805  self.combo.createComboHypoTools(flags, chainDict, self.comboToolConfs)
806 
807  def getChainLegs(self):
808  """ This is extrapolating the chain legs from the step dictionaries"""
809  legs = [part['chainName'] for part in self.stepDicts]
810  return legs
811 
812  def getChainNames(self):
813  if self.combo is not None:
814  return list(self.combo.getChains())
815  return self.getChainLegs()
816 
817  def __repr__(self):
818  if len(self.sequenceGens) == 0:
819  return "\n--- ChainStep %s ---\n is Empty, ChainDict = %s "%(self.name, ' '.join(map(str, [dic['chainName'] for dic in self.stepDicts])) )
820 
821  repr_string= "\n--- ChainStep %s ---\n , multiplicity = %s ChainDict = %s \n + MenuSequenceGens = %s "%\
822  (self.name, ' '.join(map(str,[mult for mult in self.multiplicity])),
823  ' '.join(map(str, [dic['chainName'] for dic in self.stepDicts])),
824  ' '.join(map(str, [seq.func.__name__ for seq in self.sequenceGens]) ))
825 
826  if self.combo is not None:
827  repr_string += "\n + ComboHypo = %s" % self.combo.Alg.name
828  if len(self.comboToolConfs)>0:
829  repr_string +=", ComboHypoTools = %s" %(' '.join(map(str, [tool.__name__ for tool in self.comboToolConfs])))
830  repr_string += "\n"
831  return repr_string
832 
833 
835  """ Class to handle in-event reco """
836  def __init__(self, name, inputMaker=None, **inputMakerArgs):
837  super( InEventRecoCA, self ).__init__()
838  self.name = name
839  self.recoSeq = None
840 
841  if inputMaker:
842  assert len(inputMakerArgs) == 0, "No support for explicitly passed input maker and and input maker arguments at the same time"
843  self.inputMakerAlg = inputMaker
844  else:
845  assert 'name' not in inputMakerArgs, "The name of input maker is predefined by the name of sequence"
846  args = {'name': "IM"+name,
847  'RoIsLink' : 'initialRoI',
848  'RoIs' : f'{name}RoIs',
849  'RoITool': CompFactory.ViewCreatorInitialROITool(),
850  'mergeUsingFeature': False}
851  args.update(**inputMakerArgs)
852  self.inputMakerAlg = CompFactory.InputMakerForRoI(**args)
853 
854  def addRecoSequence(self):
855  if self.recoSeq is None:
856  self.recoSeq = parOR( self.name )
857  self.addSequence( self.recoSeq )
858 
859  def mergeReco( self, ca ):
860  """ Merged CA moving reconstruction algorithms into the right sequence """
861  self.addRecoSequence()
862  return self.merge( ca, sequenceName=self.recoSeq.name )
863 
864  def addRecoAlgo( self, algo ):
865  """ Place algorithm in the correct reconstruction sequence """
866  self.addRecoSequence()
867  return self.addEventAlgo( algo, sequenceName=self.recoSeq.name )
868 
869  def inputMaker( self ):
870  return self.inputMakerAlg
871 
872 
873 
875  """ Class to handle in-view reco, sets up the View maker if not provided and exposes InputMaker so that more inputs to it can be added in the process of assembling the menu """
876  def __init__(self, name, viewMaker=None, isProbe=False, **viewMakerArgs):
877  super( InViewRecoCA, self ).__init__()
878  self.name = name +"_probe" if isProbe else name
879  def updateHandle(baseTool, probeTool, handleName):
880  if hasattr(baseTool, handleName) and getattr(baseTool, handleName).Path!="StoreGateSvc+":
881  setattr(probeTool, handleName, getattr(probeTool, handleName).Path + "_probe")
882 
883  if len(viewMakerArgs) != 0:
884  assert viewMaker is None, "No support for explicitly passed view maker and args for EventViewCreatorAlgorithm"
885 
886  if viewMaker:
887  assert len(viewMakerArgs) == 0, "No support for explicitly passed view maker and args for EventViewCreatorAlgorithm"
888  if isProbe:
889  self.viewMakerAlg = viewMaker.__class__(viewMaker.getName()+'_probe', **viewMaker._properties)
890  self.viewMakerAlg.Views = viewMaker.Views+'_probe'
891  roiTool = self.viewMakerAlg.RoITool.__class.__(self.viewMakerAlg.RoITool.getName()+'_probe', **self.viewMakerAlg.RoITool._properties)
892  log.debug(f"InViewRecoCA: Setting InputCachedViews on {self.viewMaker.getName()} to read decisions from tag leg {viewMaker.getName()}: {viewMaker.InputMakerOutputDecisions}")
893  self.viewMakerAlg.InputCachedViews = viewMaker.InputMakerOutputDecisions
894  updateHandle(viewMakerArgs['RoITool'], roiTool, "RoisWriteHandleKey")
895  if hasattr(viewMakerArgs['RoITool'], "RoiCreator"):
896  updateHandle(viewMakerArgs['RoITool'], roiTool, "ExtraPrefetchRoIsKey")
897  updateHandle(viewMakerArgs['RoITool'].RoiCreator, roiTool.RoiCreator, "RoisWriteHandleKey")
898 
899  self.viewMakerAlg.RoITool = roiTool
900  else:
901  self.viewMakerAlg = viewMaker
902  else:
903  assert 'name' not in viewMakerArgs, "The name of view maker is predefined by the name of sequence"
904  assert 'Views' not in viewMakerArgs, "The Views is predefined by the name of sequence"
905  assert 'ViewsNodeName' not in viewMakerArgs, "The ViewsNodeName is predefined by the name of sequence"
906  if 'RoITool' in viewMakerArgs:
907  roiTool = viewMakerArgs['RoITool']
908  else:
909  roiTool = CompFactory.ViewCreatorInitialROITool()
910 
911 
912  args = {'name': f'IM_{self.name}',
913  'ViewFallThrough' : True,
914  'RoIsLink' : 'initialRoI',
915  'RoITool' : roiTool,
916  'InViewRoIs' : f'{name}RoIs',
917  'Views' : f'{name}Views'+'_probe' if isProbe else f'{name}Views',
918  'ViewNodeName' : f'{name}InViews'+'_probe' if isProbe else f'{name}InViews',
919  'RequireParentView' : False,
920  'mergeUsingFeature' : False }
921  args.update(**viewMakerArgs)
922  self.viewMakerAlg = CompFactory.EventViewCreatorAlgorithm(**args)
923  if isProbe:
924  updateHandle(args['RoITool'], roiTool, "RoisWriteHandleKey")
925  if hasattr(args['RoITool'], "RoiCreator"):
926  updateHandle(args['RoITool'], roiTool, "ExtraPrefetchRoIsKey")
927  updateHandle(args['RoITool'].RoiCreator, roiTool.RoiCreator, "RoisWriteHandleKey")
928  self.viewsSeq = parOR( self.viewMakerAlg.ViewNodeName )
929  self.addSequence( self.viewsSeq )
930 
931  def mergeReco( self, ca ):
932  """ Merge CA moving reconstruction algorithms into the right sequence """
933  return self.merge( ca, sequenceName=self.viewsSeq.name )
934 
935 
936  def addRecoAlgo( self, algo ):
937  """ Place algorithm in the correct reconstruction sequence """
938  return self.addEventAlgo( algo, sequenceName=self.viewsSeq.name )
939 
940 
941  def inputMaker( self ):
942  return self.viewMakerAlg
943 
944 
946  """ CA component for MenuSequence sequence """
947  def __init__(self, name, isProbe=False):
948  self.name = name+"_probe" if isProbe else name
949  self.isProbe=isProbe
950  super( SelectionCA, self ).__init__()
951 
954 
955  def wasMerged(self):
956  super( SelectionCA, self ).wasMerged()
957  self.hypoAcc.wasMerged()
958 
959  def mergeReco(self, recoCA, robPrefetchCA=None, upSequenceCA=None):
960  ''' upSequenceCA is the user CA to run before the recoCA'''
962  ca.addSequence(self.stepViewSequence)
963  if upSequenceCA:
964  ca.merge(upSequenceCA, sequenceName=self.stepViewSequence.name)
965  ca.addEventAlgo(recoCA.inputMaker(), sequenceName=self.stepViewSequence.name)
966  if robPrefetchCA:
967  ca.merge(robPrefetchCA, self.stepViewSequence.name)
968  ca.merge(recoCA, sequenceName=self.stepViewSequence.name)
969  self.merge(ca)
970 
971  def mergeHypo(self, other):
972  """To be used when the hypo alg configuration comes with auxiliary tools/services"""
973  self.hypoAcc.merge(other)
974 
975  def addHypoAlgo(self, algo):
976  """To be used when the hypo alg configuration does not require auxiliary tools/services"""
977  if self.isProbe:
978  newname = algo.getName()+'_probe'
979  algo.name=newname
980  self.hypoAcc.addEventAlgo(algo)
981 
982  def hypo(self):
983  """Access hypo algo (or throws)"""
984  h = findAlgorithmByPredicate(self.stepViewSequence, lambda alg: "HypoInputDecisions" in alg._descriptors ) # can't use isHypo
985  assert h is not None, "No hypo in SeelectionCA {}".format(self.name)
986  return h
987 
988  def inputMaker(self):
989  """Access Input Maker (or throws)"""
990  im = findAlgorithmByPredicate(self.stepViewSequence, lambda alg: "InputMakerInputDecisions" in alg._descriptors )
991  assert im is not None, "No input maker in SeelectionCA {}".format(self.name)
992  return im
993 
994  def topSequence(self):
995  return self.stepViewSequence
test_athena_ntuple_filter.seq
seq
filter configuration ## -> we use the special sequence 'AthMasterSeq' which is run before any other a...
Definition: test_athena_ntuple_filter.py:18
MenuComponents.AlgNode.readOutputList
def readOutputList(self)
Definition: MenuComponents.py:101
MenuComponents.Node.getOutputList
def getOutputList(self)
Definition: MenuComponents.py:44
MenuComponents.ChainStep.setChainPartIndices
def setChainPartIndices(self)
Definition: MenuComponents.py:742
MenuComponents.HypoAlgNode.initialOutput
initialOutput
Definition: MenuComponents.py:155
MenuComponents.ChainStep.getLegIds
def getLegIds(self)
Definition: MenuComponents.py:757
MenuComponents.ChainStep.comboHypoCfg
comboHypoCfg
Definition: MenuComponents.py:648
MenuComponents.EmptyMenuSequence.ca
ca
Definition: MenuComponents.py:324
MenuComponents.HypoToolConf.confAndCreate
def confAndCreate(self, flags, chainDict)
Definition: MenuComponents.py:147
MenuComponents.AlgNode.addDefaultOutput
def addDefaultOutput(self)
Definition: MenuComponents.py:62
MenuComponents.InEventRecoCA.__init__
def __init__(self, name, inputMaker=None, **inputMakerArgs)
Definition: MenuComponents.py:836
MenuComponents.Node.inputs
inputs
Definition: MenuComponents.py:35
MenuComponents.InputMakerNode
Definition: MenuComponents.py:199
MenuComponents.ChainStep.sequenceGens
sequenceGens
Definition: MenuComponents.py:647
MenuComponents.ChainStep.name
name
Definition: MenuComponents.py:645
MenuComponents.EmptyMenuSequence.__del__
def __del__(self)
Definition: MenuComponents.py:328
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
MenuComponents.InEventRecoCA.inputMakerAlg
inputMakerAlg
Definition: MenuComponents.py:843
MenuComponents.MenuSequence._hypo
_hypo
Definition: MenuComponents.py:409
MenuComponents.Node.addOutput
def addOutput(self, name)
Definition: MenuComponents.py:38
vtune_athena.format
format
Definition: vtune_athena.py:14
MenuComponents.MenuSequence
Definition: MenuComponents.py:381
MenuComponents.ComboHypoNode.addChain
def addChain(self, chainDict)
Definition: MenuComponents.py:256
MenuComponents.MenuSequence.hypoAcc
hypoAcc
Definition: MenuComponents.py:388
MenuComponents.MenuSequence._maker
_maker
Definition: MenuComponents.py:398
MenuComponents.Chain.__init__
def __init__(self, name, ChainSteps, L1decisions, nSteps=None, alignmentGroups=None, topoMap=None)
Definition: MenuComponents.py:483
MenuComponents.ComboHypoNode
Definition: MenuComponents.py:210
MenuComponents.Chain.addTopo
def addTopo(self, topoPair, step="last")
Definition: MenuComponents.py:618
MenuComponents.ComboHypoNode.prop1
prop1
Definition: MenuComponents.py:213
MenuComponents.ChainStep.makeCombo
def makeCombo(self)
Definition: MenuComponents.py:781
AthenaPoolTestReadDoubleSelector.topSequence
topSequence
Definition: AthenaPoolTestReadDoubleSelector.py:18
MenuComponents.MenuSequence.getOutputList
def getOutputList(self)
Definition: MenuComponents.py:451
MenuComponents.ChainStep.addComboHypoTools
def addComboHypoTools(self, tool)
Definition: MenuComponents.py:773
MenuComponents.ChainStep.multiplicity
multiplicity
Definition: MenuComponents.py:654
MenuComponents.ComboHypoNode.acc
acc
Definition: MenuComponents.py:216
python.CFElements.findAlgorithmByPredicate
def findAlgorithmByPredicate(startSequence, predicate, depth=1000000)
Definition: CFElements.py:126
MenuComponents.MenuSequence._hypoToolConf
_hypoToolConf
Definition: MenuComponents.py:412
MenuComponents.SelectionCA.inputMaker
def inputMaker(self)
Definition: MenuComponents.py:988
MenuComponents.ChainStep
Definition: MenuComponents.py:634
MenuComponents.InEventRecoCA.addRecoAlgo
def addRecoAlgo(self, algo)
Definition: MenuComponents.py:864
MenuComponents.Node.outputs
outputs
Definition: MenuComponents.py:36
MenuComponents.MenuSequence.__del__
def __del__(self)
Definition: MenuComponents.py:427
MenuComponents.SelectionCA.hypoAcc
hypoAcc
Definition: MenuComponents.py:953
MenuComponents.Chain.numberAllSteps
def numberAllSteps(self)
Definition: MenuComponents.py:526
MenuComponents.AlgNode.resetOutput
def resetOutput(self)
Definition: MenuComponents.py:84
MenuComponents.HypoToolConf.create
def create(self, flags)
Definition: MenuComponents.py:140
detail::addInput
void addInput(T &c, const Primitive &input, A a=defaultAccessor< T >)
Definition: PrimitiveHelpers.h:50
MenuComponents.ComboHypoNode.createComboHypoTools
def createComboHypoTools(self, flags, chainDict, comboToolConfs)
Definition: MenuComponents.py:290
MenuComponents.SelectionCA.wasMerged
def wasMerged(self)
Definition: MenuComponents.py:955
MenuComponents.MenuSequence.hypo
def hypo(self)
Definition: MenuComponents.py:448
python.TrigConfigSvcUtils.getChains
def getChains(connection, smk)
Definition: TrigConfigSvcUtils.py:592
MenuComponents.HypoAlgNode.previous
previous
Definition: MenuComponents.py:159
MenuComponents.AlgNode
Definition: MenuComponents.py:54
dumpHVPathFromNtuple.append
bool append
Definition: dumpHVPathFromNtuple.py:91
MenuComponents.ComboHypoNode.create
def create(self, name)
Definition: MenuComponents.py:235
MenuComponents.MenuSequence.__repr__
def __repr__(self)
Definition: MenuComponents.py:473
MenuComponents.ChainStep.__init__
def __init__(self, name, SequenceGens=None, chainDicts=None, comboHypoCfg=ComboHypoCfg, comboToolConfs=None, isEmpty=False, createsGhostLegs=False)
Definition: MenuComponents.py:637
MenuComponents.EmptyMenuSequence.getOutputList
def getOutputList(self)
Definition: MenuComponents.py:347
MenuComponents.SelectionCA.mergeReco
def mergeReco(self, recoCA, robPrefetchCA=None, upSequenceCA=None)
Definition: MenuComponents.py:959
MenuComponents.Chain.__str__
def __str__(self)
Definition: MenuComponents.py:623
python.CaloAddPedShiftConfig.type
type
Definition: CaloAddPedShiftConfig.py:42
MenuComponents.EmptyMenuSequence.__repr__
def __repr__(self)
Definition: MenuComponents.py:364
XMLtoHeader.count
count
Definition: XMLtoHeader.py:85
MenuComponents.ChainStep.__repr__
def __repr__(self)
Definition: MenuComponents.py:817
dumpTruth.getName
getName
Definition: dumpTruth.py:34
MenuComponents.ChainStep.relabelLegIdsForJets
def relabelLegIdsForJets(self)
Definition: MenuComponents.py:699
MenuComponents.InViewRecoCA.viewsSeq
viewsSeq
Definition: MenuComponents.py:928
MenuComponents.Node.Alg
Alg
Definition: MenuComponents.py:34
HLTCFTools.isHypoBase
def isHypoBase(alg)
Definition: HLTCFTools.py:31
MenuComponents.InViewRecoCA.name
name
Definition: MenuComponents.py:878
MenuComponents.MenuSequence.getHypoToolConf
def getHypoToolConf(self)
Definition: MenuComponents.py:459
MenuComponents.EmptyMenuSequence
Definition: MenuComponents.py:306
MenuComponents.HypoToolConf.__init__
def __init__(self, hypoToolGen)
Definition: MenuComponents.py:129
MenuComponents.EmptyMenuSequence._maker
_maker
Definition: MenuComponents.py:321
MenuComponents.InEventRecoCA.inputMaker
def inputMaker(self)
Definition: MenuComponents.py:869
MenuComponents.Chain.nSteps
nSteps
Definition: MenuComponents.py:496
MenuComponents.ChainStep.getChainLegs
def getChainLegs(self)
Definition: MenuComponents.py:807
MenuComponents.SelectionCA.__init__
def __init__(self, name, isProbe=False)
Definition: MenuComponents.py:947
MenuComponents.isEmptySequenceCfg
def isEmptySequenceCfg(o)
Definition: MenuComponents.py:378
MenuComponents.InEventRecoCA.recoSeq
recoSeq
Definition: MenuComponents.py:839
MenuComponents.HypoToolConf.chainDict
chainDict
Definition: MenuComponents.py:138
MenuComponents.Chain.topoMap
topoMap
Definition: MenuComponents.py:506
convertTimingResiduals.sum
sum
Definition: convertTimingResiduals.py:55
MenuComponents.EmptyMenuSequence.connectToFilter
def connectToFilter(self, outfilter)
Definition: MenuComponents.py:350
python.CFElements.seqAND
def seqAND(name, subs=[])
Definition: CFElements.py:25
MenuComponents.Node.__repr__
def __repr__(self)
Definition: MenuComponents.py:50
MenuComponents.Node.getInputList
def getInputList(self)
Definition: MenuComponents.py:47
HLTCFTools.isInputMakerBase
def isInputMakerBase(alg)
Definition: HLTCFTools.py:40
MenuComponents.ComboHypoNode.prop2
prop2
Definition: MenuComponents.py:214
MenuComponents.MenuSequence.__init__
def __init__(self, flags, selectionCA, HypoToolGen)
Definition: MenuComponents.py:385
MenuComponents.EmptyMenuSequence._name
_name
Definition: MenuComponents.py:312
MenuComponents.Chain.steps
steps
Definition: MenuComponents.py:495
python.JetAnalysisCommon.parOR
parOR
Definition: JetAnalysisCommon.py:271
MenuComponents.InEventRecoCA.mergeReco
def mergeReco(self, ca)
Definition: MenuComponents.py:859
MenuComponents.ChainStep.legIds
legIds
Definition: MenuComponents.py:690
MenuComponents.InputMakerNode.__init__
def __init__(self, Alg)
Definition: MenuComponents.py:201
MenuComponents.ChainStep.getComboHypoFncName
def getComboHypoFncName(self)
Definition: MenuComponents.py:777
MenuComponents.InEventRecoCA.name
name
Definition: MenuComponents.py:838
MenuComponents.ChainStep.createSequences
def createSequences(self)
Definition: MenuComponents.py:693
python.TrigCompositeUtils.legName
def legName(chainName, legCounter)
Definition: DecisionHandling/python/TrigCompositeUtils.py:12
MenuComponents.InViewRecoCA.addRecoAlgo
def addRecoAlgo(self, algo)
Definition: MenuComponents.py:936
plotBeamSpotVxVal.range
range
Definition: plotBeamSpotVxVal.py:195
MenuComponents.ComboHypoNode.mapRawInputsToInputsIndex
def mapRawInputsToInputsIndex(self)
Definition: MenuComponents.py:248
MenuComponents.Chain
Definition: MenuComponents.py:480
MenuComponents.ChainStep.sequences
sequences
Definition: MenuComponents.py:646
histSizes.list
def list(name, path='/')
Definition: histSizes.py:38
MenuComponents.MenuSequence.sequence
def sequence(self)
Definition: MenuComponents.py:436
MenuComponents.AlgNode.outputProp
outputProp
Definition: MenuComponents.py:59
MenuComponents.ChainStep.getChainNames
def getChainNames(self)
Definition: MenuComponents.py:812
MenuComponents.HypoAlgNode.__repr__
def __repr__(self)
Definition: MenuComponents.py:191
MenuComponents.AlgNode.readInputList
def readInputList(self)
Definition: MenuComponents.py:118
MenuComponents.MenuSequence._name
_name
Definition: MenuComponents.py:408
MenuComponents.MenuSequence.maker
def maker(self)
Definition: MenuComponents.py:440
MenuComponents.Node.__init__
def __init__(self, Alg)
Definition: MenuComponents.py:32
MenuComponents.Chain.checkMultiplicity
def checkMultiplicity(self)
Definition: MenuComponents.py:596
MenuComponents.HypoToolConf.hasFlags
hasFlags
Definition: MenuComponents.py:131
CxxUtils::set
constexpr std::enable_if_t< is_bitmask_v< E >, E & > set(E &lhs, E rhs)
Convenience function to set bits in a class enum bitmask.
Definition: bitmask.h:232
MenuComponents.AlgNode.addOutput
def addOutput(self, name)
Definition: MenuComponents.py:90
MenuComponents.SelectionCA.addHypoAlgo
def addHypoAlgo(self, algo)
Definition: MenuComponents.py:975
MenuComponents.EmptyMenuSequence.sequence
def sequence(self)
Definition: MenuComponents.py:332
MenuComponents.Node
Definition: MenuComponents.py:29
MenuComponents.Chain.__repr__
def __repr__(self)
Definition: MenuComponents.py:627
MenuComponents.ComboHypoNode.comboHypoCfg
comboHypoCfg
Definition: MenuComponents.py:215
TCS::join
std::string join(const std::vector< std::string > &v, const char c=',')
Definition: Trigger/TrigT1/L1Topo/L1TopoCommon/Root/StringUtils.cxx:10
MenuComponents.InEventRecoCA.addRecoSequence
def addRecoSequence(self)
Definition: MenuComponents.py:854
MenuComponents.ChainStep.combo
combo
Definition: MenuComponents.py:783
MenuComponents.HypoAlgNode.__init__
def __init__(self, Alg)
Definition: MenuComponents.py:156
MenuComponents.InViewRecoCA.mergeReco
def mergeReco(self, ca)
Definition: MenuComponents.py:931
MenuComponents.HypoAlgNode.addHypoTool
def addHypoTool(self, flags, hypoToolConf)
Definition: MenuComponents.py:171
MenuComponents.HypoToolConf
Definition: MenuComponents.py:127
MenuComponents.HypoAlgNode.setPreviousDecision
def setPreviousDecision(self, prev)
Definition: MenuComponents.py:187
MenuComponents.AlgNode.addInput
def addInput(self, name)
Definition: MenuComponents.py:106
MenuComponents.HypoToolConf.hypoToolGen
hypoToolGen
Definition: MenuComponents.py:132
MenuComponents.MenuSequence.ca
ca
Definition: MenuComponents.py:386
MenuComponents.MenuSequence.connectToFilter
def connectToFilter(self, outfilter)
Definition: MenuComponents.py:454
MenuComponents.InViewRecoCA.inputMaker
def inputMaker(self)
Definition: MenuComponents.py:941
MenuComponents.EmptyMenuSequence.name
def name(self)
Definition: MenuComponents.py:344
MenuComponents.EmptyMenuSequence.maker
def maker(self)
Definition: MenuComponents.py:336
MenuComponents.EmptyMenuSequence.buildDFDot
def buildDFDot(self, cfseq_algs, all_hypos, last_step_hypo_nodes, file)
Definition: MenuComponents.py:357
MenuComponents.InEventRecoCA
Definition: MenuComponents.py:834
MenuComponents.MenuSequence._sequence
_sequence
Definition: MenuComponents.py:391
MenuComponents.EmptyMenuSequence.getHypoToolConf
def getHypoToolConf(self)
Definition: MenuComponents.py:354
python.CaloAddPedShiftConfig.int
int
Definition: CaloAddPedShiftConfig.py:45
MenuComponents.Chain.alignmentGroups
alignmentGroups
Definition: MenuComponents.py:497
MenuComponents.AlgNode.getPar
def getPar(self, prop)
Definition: MenuComponents.py:81
MenuComponents.ChainStep.onlyJets
onlyJets
Definition: MenuComponents.py:672
CaloCondBlobAlgs_fillNoiseFromASCII.hash
dictionary hash
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:109
MenuComponents.AlgNode.inputProp
inputProp
Definition: MenuComponents.py:60
MenuComponents.InViewRecoCA
Definition: MenuComponents.py:874
MenuComponents.Chain.L1decisions
L1decisions
Definition: MenuComponents.py:512
MenuComponents.ChainStep.createComboHypoTools
def createComboHypoTools(self, flags, chainName)
Definition: MenuComponents.py:803
MenuComponents.ComboHypoNode.__init__
def __init__(self, name, comboHypoCfg)
Definition: MenuComponents.py:212
MenuComponents.SelectionCA.mergeHypo
def mergeHypo(self, other)
Definition: MenuComponents.py:971
MenuComponents.AlgNode.__repr__
def __repr__(self)
Definition: MenuComponents.py:123
MenuComponents.SelectionCA.isProbe
isProbe
Definition: MenuComponents.py:949
MenuComponents.SelectionCA.stepViewSequence
stepViewSequence
Definition: MenuComponents.py:952
MenuComponents.HypoToolConf.name
name
Definition: MenuComponents.py:133
MenuComponents.Node.addInput
def addInput(self, name)
Definition: MenuComponents.py:41
MenuComponents.MenuSequence.name
def name(self)
Definition: MenuComponents.py:432
MenuComponents.AlgNode.resetPar
def resetPar(self, prop)
Definition: MenuComponents.py:74
MenuComponents.HypoToolConf.setConf
def setConf(self, chainDict)
Definition: MenuComponents.py:135
MenuComponents.HypoAlgNode.addOutput
def addOutput(self, name)
Definition: MenuComponents.py:161
pickleTool.object
object
Definition: pickleTool.py:30
MenuComponents.ChainStep.stepDicts
stepDicts
Definition: MenuComponents.py:650
str
Definition: BTagTrackIpAccessor.cxx:11
MenuComponents.EmptyMenuSequence._sequence
_sequence
Definition: MenuComponents.py:322
MenuComponents.SelectionCA.hypo
def hypo(self)
Definition: MenuComponents.py:982
MenuComponents.AlgNode.setPar
def setPar(self, propname, value)
Definition: MenuComponents.py:66
MenuComponents.SelectionCA
Definition: MenuComponents.py:945
MenuComponents.EmptyMenuSequence.__init__
def __init__(self, the_name)
Definition: MenuComponents.py:310
MenuComponents.HypoAlgNode
Definition: MenuComponents.py:153
MenuComponents.Chain.append_step_to_jet
def append_step_to_jet(self, new_steps)
Definition: MenuComponents.py:520
MenuComponents.Node.name
name
Definition: MenuComponents.py:33
MenuComponents.Chain.insertEmptySteps
def insertEmptySteps(self, empty_step_name, n_new_steps, start_position)
Definition: MenuComponents.py:549
MenuComponents.AlgNode.__init__
def __init__(self, Alg, inputProp, outputProp)
Definition: MenuComponents.py:57
MenuComponents.InViewRecoCA.viewMakerAlg
viewMakerAlg
Definition: MenuComponents.py:889
HLTCFTools.algColor
def algColor(alg)
Definition: HLTCFTools.py:15
MenuComponents.ChainStep.isEmpty
isEmpty
Definition: MenuComponents.py:652
MenuComponents.ComboHypoNode.__del__
def __del__(self)
Definition: MenuComponents.py:232
MenuComponents.ChainStep.comboToolConfs
comboToolConfs
Definition: MenuComponents.py:649
merge
Definition: merge.py:1
MenuComponents.InViewRecoCA.__init__
def __init__(self, name, viewMaker=None, isProbe=False, **viewMakerArgs)
Definition: MenuComponents.py:876
MenuComponents.createEmptyMenuSequenceCfg
def createEmptyMenuSequenceCfg(flags, name)
Definition: MenuComponents.py:368
MenuComponents.Chain.append_bjet_steps
def append_bjet_steps(self, new_steps)
Definition: MenuComponents.py:515
MenuComponents.AlgNode.resetInput
def resetInput(self)
Definition: MenuComponents.py:87
MenuComponents.MenuSequence.buildDFDot
def buildDFDot(self, cfseq_algs, all_hypos, last_step_hypo_nodes, file)
Definition: MenuComponents.py:463
MenuComponents.SelectionCA.name
name
Definition: MenuComponents.py:948
MenuComponents.ComboHypoNode.getChains
def getChains(self)
Definition: MenuComponents.py:285
MenuComponents.SelectionCA.topSequence
def topSequence(self)
Definition: MenuComponents.py:994
MenuComponents.Chain.name
name
Definition: MenuComponents.py:494