|
def | __init__ (self, name, ChainSteps, L1decisions, nSteps=None, alignmentGroups=None, topoMap=None) |
|
def | append_bjet_steps (self, new_steps) |
|
def | append_step_to_jet (self, new_steps) |
|
def | numberAllSteps (self) |
|
def | insertEmptySteps (self, empty_step_name, n_new_steps, start_position) |
|
def | checkMultiplicity (self) |
|
def | addTopo (self, topoPair, step="last") |
|
def | __repr__ (self) |
|
Basic class to define the trigger menu
Definition at line 472 of file MenuComponents.py.
◆ __init__()
def 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 475 of file MenuComponents.py.
475 def __init__(self, name, ChainSteps, L1decisions, nSteps = None, alignmentGroups = None, topoMap=None):
478 Construct the Chain from the steps
479 Out of all arguments the ChainSteps & L1Thresholds are most relevant, the chain name is used in debug messages
483 if nSteps
is None: nSteps = []
484 if alignmentGroups
is None: alignmentGroups = []
487 self.steps = ChainSteps
489 self.alignmentGroups = alignmentGroups
500 self.topoMap.
update(topoMap)
504 self.L1decisions = L1decisions
505 log.debug(
"[Chain.__init__] Made Chain %s with seeds: %s ", name, self.L1decisions)
◆ __repr__()
def MenuComponents.Chain.__repr__ |
( |
|
self | ) |
|
Definition at line 606 of file MenuComponents.py.
607 return "\n-*- Chain %s -*- \n + Seeds: %s, Steps: %s, AlignmentGroups: %s \n + Steps: \n %s \n"%(\
608 self.name,
' '.
join(map(str, self.L1decisions)), self.nSteps, self.alignmentGroups,
'\n '.
join(map(str, self.steps)))
◆ addTopo()
def MenuComponents.Chain.addTopo |
( |
|
self, |
|
|
|
topoPair, |
|
|
|
step = "last" |
|
) |
| |
Definition at line 601 of file MenuComponents.py.
601 def addTopo(self,topoPair,step="last"):
602 stepname =
"last step" if step==
"last" else step.name
603 log.debug(
"Adding topo configurator %s for %s to %s", topoPair[0].__qualname__, topoPair[1],
"step " + stepname)
604 self.topoMap[step] = topoPair
◆ append_bjet_steps()
def MenuComponents.Chain.append_bjet_steps |
( |
|
self, |
|
|
|
new_steps |
|
) |
| |
Definition at line 507 of file MenuComponents.py.
507 def append_bjet_steps(self,new_steps):
508 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!"
509 self.steps = self.steps + new_steps
510 self.nSteps = [len(self.steps)]
◆ append_step_to_jet()
def MenuComponents.Chain.append_step_to_jet |
( |
|
self, |
|
|
|
new_steps |
|
) |
| |
Definition at line 512 of file MenuComponents.py.
512 def append_step_to_jet(self,new_steps):
513 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!"
514 self.steps = self.steps + new_steps
515 self.nSteps = [len(self.steps)]
◆ checkMultiplicity()
def MenuComponents.Chain.checkMultiplicity |
( |
|
self | ) |
|
Definition at line 579 of file MenuComponents.py.
579 def checkMultiplicity(self):
581 if len(self.steps) == 0:
583 mult=[
sum(step.multiplicity)
for step
in self.steps]
584 not_empty_mult = [m
for m
in mult
if m!=0]
585 if len(not_empty_mult) == 0:
586 log.error(
"checkMultiplicity: Chain %s has all steps with multiplicity =0: what to do?", self.name)
588 if not_empty_mult.count(not_empty_mult[0]) != len(not_empty_mult):
589 log.error(
"checkMultiplicity: Chain %s has steps with differnt multiplicities: %s", self.name,
' '.
join(mult))
592 if not_empty_mult[0] != len(self.L1decisions):
593 log.error(
"checkMultiplicity: Chain %s has %d multiplicity per step, and %d L1Decisions", self.name, mult, len(self.L1decisions))
595 return not_empty_mult[0]
◆ insertEmptySteps()
def MenuComponents.Chain.insertEmptySteps |
( |
|
self, |
|
|
|
empty_step_name, |
|
|
|
n_new_steps, |
|
|
|
start_position |
|
) |
| |
Definition at line 532 of file MenuComponents.py.
532 def insertEmptySteps(self, empty_step_name, n_new_steps, start_position):
536 if len(self.steps) == 0 :
537 log.error(
"I can't insert empty steps because the chain doesn't have any steps yet!")
539 if len(self.steps) < start_position :
540 log.error(
"I can't insert empty steps at step %d because the chain doesn't have that many steps!", start_position)
543 chain_steps_pre_split = self.steps[:start_position]
544 chain_steps_post_split = self.steps[start_position:]
550 if start_position == 0:
551 next_step_name = chain_steps_post_split[0].name
552 if re.search(
'^Step[0-9]_',next_step_name):
553 next_step_name = next_step_name[6:]
554 elif re.search(
'^Step[0-9]{2}_', next_step_name):
555 next_step_name = next_step_name[7:]
557 prev_step_name =
'empty_'+
str(len(self.L1decisions))+
'L1in'
558 prev_chain_dict = chain_steps_post_split[0].stepDicts
560 if len(chain_steps_post_split) == 0:
561 log.error(
"Adding empty steps to the end of a chain (%s)- why would you do this?",self.name)
563 prev_step_name = chain_steps_pre_split[-1].name
564 next_step_name = chain_steps_post_split[0].name
565 prev_chain_dict = chain_steps_pre_split[-1].stepDicts
569 for stepID
in range(1,n_new_steps+1):
570 new_step_name = prev_step_name+
'_'+empty_step_name+
'%d_'%stepID+next_step_name
572 log.debug(
"Configuring empty step %s", new_step_name)
573 steps_to_add += [ChainStep(new_step_name, chainDicts=prev_chain_dict, comboHypoCfg=ComboHypoCfg, isEmpty=
True)]
575 self.steps = chain_steps_pre_split + steps_to_add + chain_steps_post_split
◆ numberAllSteps()
def MenuComponents.Chain.numberAllSteps |
( |
|
self | ) |
|
Definition at line 518 of file MenuComponents.py.
518 def numberAllSteps(self):
519 if len(self.steps)==0:
522 for stepID,step
in enumerate(self.steps):
523 step_name = step.name
524 if re.search(
'^Step[0-9]_',step_name):
525 step_name = step_name[6:]
526 elif re.search(
'^Step[0-9]{2}_', step_name):
527 step_name = step_name[7:]
528 step.name =
'Step%d_'%(stepID+1)+step_name
◆ __slots__
MenuComponents.Chain.__slots__ |
|
staticprivate |
◆ alignmentGroups
MenuComponents.Chain.alignmentGroups |
◆ L1decisions
MenuComponents.Chain.L1decisions |
◆ name
MenuComponents.Chain.name |
◆ nSteps
MenuComponents.Chain.nSteps |
◆ steps
MenuComponents.Chain.steps |
◆ topoMap
MenuComponents.Chain.topoMap |
The documentation for this class was generated from the following file: