ATLAS Offline Software
Loading...
Searching...
No Matches
MenuComponents.Chain Class Reference
Inheritance diagram for MenuComponents.Chain:
Collaboration diagram for MenuComponents.Chain:

Public Types

typedef HLT::TypeInformation::for_each_type_c< typenameEDMLIST::map, my_functor, my_result<>, my_arg< HLT::TypeInformation::get_cont, CONTAINER > >::type result

Public Member Functions

 __init__ (self, name, ChainSteps, L1decisions, nSteps=None, alignmentGroups=None, topoMap=None)
 append_bjet_steps (self, new_steps)
 append_step_to_jet (self, new_steps)
 numberAllSteps (self)
 insertEmptySteps (self, empty_step_name, n_new_steps, start_position)
 checkNumberOfLegs (self)
 addTopo (self, topoPair, step="last")
 __str__ (self)
 __repr__ (self)

Public Attributes

 name = name
 steps = ChainSteps
list nSteps = nSteps
 alignmentGroups = alignmentGroups
dict topoMap = {}
 L1decisions = L1decisions

Static Private Attributes

str __slots__ = 'name','steps','nSteps','alignmentGroups','L1decisions', 'topoMap'

Detailed Description

Basic class to define the trigger menu 

Definition at line 432 of file MenuComponents.py.

Member Typedef Documentation

◆ result

Definition at line 90 of file EDM_MasterSearch.h.

Constructor & Destructor Documentation

◆ __init__()

MenuComponents.Chain.__init__ ( self,
name,
ChainSteps,
L1decisions,
nSteps = None,
alignmentGroups = None,
topoMap = None )
Construct the Chain from the steps
Out of all arguments the ChainSteps & L1Thresholds are most relevant, the chain name is used in debug messages

Definition at line 435 of file MenuComponents.py.

435 def __init__(self, name, ChainSteps, L1decisions, nSteps = None, alignmentGroups = None, topoMap=None):
436
437 """
438 Construct the Chain from the steps
439 Out of all arguments the ChainSteps & L1Thresholds are most relevant, the chain name is used in debug messages
440 """
441
442 # default mutable values must be initialized to None
443 if nSteps is None: nSteps = []
444 if alignmentGroups is None: alignmentGroups = []
445
446 self.name = name
447 self.steps = ChainSteps
448 self.nSteps = nSteps
449 self.alignmentGroups = alignmentGroups
450
451
452 # The chain holds a map of topo ComboHypoTool configurators
453 # This is needed to allow placement of the ComboHypoTool in the right position
454 # for multi-leg chains (defaults to last step)
455 # Format is {"[step name]" : ([topo config function], [topo descriptor string]), ...}
456 # Here, the topo descriptor string would usually be the chain name expression that
457 # configures the topo
458 self.topoMap = {}
459 if topoMap:
460 self.topoMap.update(topoMap)
461
462 # L1decisions are used to set the seed type (EM, MU,JET), removing the actual threshold
463 # in practice it is the HLTSeeding Decision output
464 self.L1decisions = L1decisions
465 log.debug("[Chain.__init__] Made Chain %s with seeds: %s ", name, self.L1decisions)
466

Member Function Documentation

◆ __repr__()

MenuComponents.Chain.__repr__ ( self)

Definition at line 584 of file MenuComponents.py.

584 def __repr__(self):
585 return "\n-*- Chain %s -*- \n + Seeds: %s, Steps: %s, AlignmentGroups: %s \n + Steps: \n %s \n"%(\
586 self.name, ' '.join(map(str, self.L1decisions)), self.nSteps, self.alignmentGroups, '\n '.join(map(str, self.steps)))
587
588
589
STL class.

◆ __str__()

MenuComponents.Chain.__str__ ( self)

Definition at line 580 of file MenuComponents.py.

580 def __str__(self):
581 return "\n-*- Chain %s -*- \n + Seeds: %s, Steps: %s, AlignmentGroups: %s "%(\
582 self.name, ' '.join(map(str, self.L1decisions)), self.nSteps, self.alignmentGroups)
583

◆ addTopo()

MenuComponents.Chain.addTopo ( self,
topoPair,
step = "last" )

Definition at line 575 of file MenuComponents.py.

575 def addTopo(self,topoPair,step="last"):
576 stepname = "last step" if step=="last" else step.name
577 log.debug("Adding topo configurator %s for %s to %s", topoPair[0].__qualname__, topoPair[1], "step " + stepname)
578 self.topoMap[step] = topoPair
579

◆ append_bjet_steps()

MenuComponents.Chain.append_bjet_steps ( self,
new_steps )

Definition at line 467 of file MenuComponents.py.

467 def append_bjet_steps(self,new_steps):
468 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!"
469 self.steps = self.steps + new_steps
470 self.nSteps = [len(self.steps)]
471

◆ append_step_to_jet()

MenuComponents.Chain.append_step_to_jet ( self,
new_steps )

Definition at line 472 of file MenuComponents.py.

472 def append_step_to_jet(self,new_steps):
473 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!"
474 self.steps = self.steps + new_steps
475 self.nSteps = [len(self.steps)]
476
477

◆ checkNumberOfLegs()

MenuComponents.Chain.checkNumberOfLegs ( self)
return 0 if the chain has unexpected number of step legs 

Definition at line 548 of file MenuComponents.py.

548 def checkNumberOfLegs(self):
549 """ return 0 if the chain has unexpected number of step legs """
550 if len(self.steps) == 0: # skip if it's noAlg chains
551 return 1
552
553 mult=[step.nLegs for step in self.steps] # one nLegs per step
554 not_empty_mult = [m for m in mult if m!=0]
555 # cannot accept chains with all empty steps
556 if len(not_empty_mult) == 0:
557 log.error("checkNumberOfLegs: Chain %s has all steps with nLegs =0: what to do?", self.name)
558 return 0
559
560 # cannot accept chains with steps with different number of legs
561 if not_empty_mult.count(not_empty_mult[0]) != len(not_empty_mult):
562 log.error("checkNumberOfLegs: Chain %s has steps with differnt number of legs: %s", self.name, ' '.join(mult))
563 return 0
564
565 # check that the chain number of legs is the same as the number of L1 seeds
566 if not_empty_mult[0] != len(self.L1decisions):
567 log.error("checkNumberOfLegs: Chain %s has %i legs per step, and %d L1Decisions", self.name, mult, len(self.L1decisions))
568 return 0
569 return not_empty_mult[0]
570
571

◆ insertEmptySteps()

MenuComponents.Chain.insertEmptySteps ( self,
empty_step_name,
n_new_steps,
start_position )

Definition at line 501 of file MenuComponents.py.

501 def insertEmptySteps(self, empty_step_name, n_new_steps, start_position):
502 #start position indexed from 0. if start position is 3 and length is 2, it works like:
503 # [old1,old2,old3,old4,old5,old6] ==> [old1,old2,old3,empty1,empty2,old4,old5,old6]
504
505 if len(self.steps) == 0 :
506 log.error("I can't insert empty steps because the chain doesn't have any steps yet!")
507
508 if len(self.steps) < start_position :
509 log.error("I can't insert empty steps at step %d because the chain doesn't have that many steps!", start_position)
510
511
512 chain_steps_pre_split = self.steps[:start_position]
513 chain_steps_post_split = self.steps[start_position:]
514
515 next_step_name = ''
516 prev_step_name = ''
517 # copy the same dictionary as the last step, which else?
518 prev_chain_dict = []
519 if start_position == 0:
520 next_step_name = chain_steps_post_split[0].name
521 if re.search('^Step[0-9]_',next_step_name):
522 next_step_name = next_step_name[6:]
523 elif re.search('^Step[0-9]{2}_', next_step_name):
524 next_step_name = next_step_name[7:]
525
526 prev_step_name = 'empty_'+str(len(self.L1decisions))+'L1in'
527 prev_chain_dict = chain_steps_post_split[0].stepDicts
528 else:
529 if len(chain_steps_post_split) == 0:
530 log.error("Adding empty steps to the end of a chain (%s)- why would you do this?",self.name)
531 else:
532 prev_step_name = chain_steps_pre_split[-1].name
533 next_step_name = chain_steps_post_split[0].name
534 prev_chain_dict = chain_steps_pre_split[-1].stepDicts
535
536
537 steps_to_add = []
538 for stepID in range(1,n_new_steps+1):
539 new_step_name = prev_step_name+'_'+empty_step_name+'%d_'%stepID+next_step_name
540
541 log.debug("Adding empty step %s", new_step_name)
542 steps_to_add += [ChainStep(new_step_name, chainDicts=prev_chain_dict, isEmpty=True)]
543
544 self.steps = chain_steps_pre_split + steps_to_add + chain_steps_post_split
545
546 return
547

◆ numberAllSteps()

MenuComponents.Chain.numberAllSteps ( self)

Definition at line 478 of file MenuComponents.py.

478 def numberAllSteps(self):
479 if len(self.steps)==0:
480 return
481 else:
482 for stepID,step in enumerate(self.steps):
483 step_name = step.name
484 if re.search('^Step[0-9]_',step_name):
485 step_name = step_name[6:]
486 elif re.search('^Step[0-9]{2}_', step_name):
487 step_name = step_name[7:]
488 step.name = 'Step%d_'%(stepID+1)+step_name
489 # also modify the empty sequence names to follow the step name change
490 for iseq, seq in enumerate(step.sequenceGens):
491 if isEmptySequenceCfg(seq):
492 name = seq.func.__name__
493 if re.search('Seq[0-9]_',name):
494 newname = re.sub('Seq[0-9]_', 'Seq%d_'%(stepID+1), name)
495 #replace the empty sequence
496 thisEmpty = createEmptyMenuSequenceCfg(flags=None, name=newname)
497 step.sequenceGens[iseq]=functools.partial(thisEmpty, flags=None, name=newname)
498 return
499
500

Member Data Documentation

◆ __slots__

str MenuComponents.Chain.__slots__ = 'name','steps','nSteps','alignmentGroups','L1decisions', 'topoMap'
staticprivate

Definition at line 434 of file MenuComponents.py.

◆ alignmentGroups

MenuComponents.Chain.alignmentGroups = alignmentGroups

Definition at line 449 of file MenuComponents.py.

◆ L1decisions

MenuComponents.Chain.L1decisions = L1decisions

Definition at line 464 of file MenuComponents.py.

◆ name

MenuComponents.Chain.name = name

Definition at line 446 of file MenuComponents.py.

◆ nSteps

MenuComponents.Chain.nSteps = nSteps

Definition at line 448 of file MenuComponents.py.

◆ steps

MenuComponents.Chain.steps = ChainSteps

Definition at line 447 of file MenuComponents.py.

◆ topoMap

dict MenuComponents.Chain.topoMap = {}

Definition at line 458 of file MenuComponents.py.


The documentation for this class was generated from the following file: