|
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 483 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 486 of file MenuComponents.py.
486 def __init__(self, name, ChainSteps, L1decisions, nSteps = None, alignmentGroups = None, topoMap=None):
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
494 if nSteps
is None: nSteps = []
495 if alignmentGroups
is None: alignmentGroups = []
498 self.steps = ChainSteps
500 self.alignmentGroups = alignmentGroups
511 self.topoMap.
update(topoMap)
515 self.L1decisions = L1decisions
516 log.debug(
"[Chain.__init__] Made Chain %s with seeds: %s ", name, self.L1decisions)
◆ __repr__()
def MenuComponents.Chain.__repr__ |
( |
|
self | ) |
|
Definition at line 617 of file MenuComponents.py.
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)))
◆ addTopo()
def MenuComponents.Chain.addTopo |
( |
|
self, |
|
|
|
topoPair, |
|
|
|
step = "last" |
|
) |
| |
Definition at line 612 of file MenuComponents.py.
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
◆ append_bjet_steps()
def MenuComponents.Chain.append_bjet_steps |
( |
|
self, |
|
|
|
new_steps |
|
) |
| |
Definition at line 518 of file MenuComponents.py.
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)]
◆ append_step_to_jet()
def MenuComponents.Chain.append_step_to_jet |
( |
|
self, |
|
|
|
new_steps |
|
) |
| |
Definition at line 523 of file MenuComponents.py.
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)]
◆ checkMultiplicity()
def MenuComponents.Chain.checkMultiplicity |
( |
|
self | ) |
|
Definition at line 590 of file MenuComponents.py.
590 def checkMultiplicity(self):
592 if len(self.steps) == 0:
594 mult=[
sum(step.multiplicity)
for step
in self.steps]
595 not_empty_mult = [m
for m
in mult
if m!=0]
596 if len(not_empty_mult) == 0:
597 log.error(
"checkMultiplicity: Chain %s has all steps with multiplicity =0: what to do?", self.name)
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))
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))
606 return not_empty_mult[0]
◆ insertEmptySteps()
def MenuComponents.Chain.insertEmptySteps |
( |
|
self, |
|
|
|
empty_step_name, |
|
|
|
n_new_steps, |
|
|
|
start_position |
|
) |
| |
Definition at line 543 of file MenuComponents.py.
543 def insertEmptySteps(self, empty_step_name, n_new_steps, start_position):
547 if len(self.steps) == 0 :
548 log.error(
"I can't insert empty steps because the chain doesn't have any steps yet!")
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)
554 chain_steps_pre_split = self.steps[:start_position]
555 chain_steps_post_split = self.steps[start_position:]
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:]
568 prev_step_name =
'empty_'+
str(len(self.L1decisions))+
'L1in'
569 prev_chain_dict = chain_steps_post_split[0].stepDicts
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)
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
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
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)]
586 self.steps = chain_steps_pre_split + steps_to_add + chain_steps_post_split
◆ numberAllSteps()
def MenuComponents.Chain.numberAllSteps |
( |
|
self | ) |
|
Definition at line 529 of file MenuComponents.py.
529 def numberAllSteps(self):
530 if len(self.steps)==0:
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
◆ __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: