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