ATLAS Offline Software
Public Member Functions | Public Attributes | Static Private Attributes | List of all members
MenuComponents.Chain Class Reference
Inheritance diagram for MenuComponents.Chain:
Collaboration diagram for MenuComponents.Chain:

Public Member Functions

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)
 

Public Attributes

 name
 
 steps
 
 nSteps
 
 alignmentGroups
 
 topoMap
 
 L1decisions
 

Static Private Attributes

 __slots__
 

Detailed Description

Basic class to define the trigger menu 

Definition at line 483 of file MenuComponents.py.

Constructor & Destructor Documentation

◆ __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):
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 

Member Function Documentation

◆ __repr__()

def MenuComponents.Chain.__repr__ (   self)

Definition at line 617 of file MenuComponents.py.

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)?

◆ 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
616 

◆ 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)]
522 

◆ 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)]
527 
528 

◆ checkMultiplicity()

def MenuComponents.Chain.checkMultiplicity (   self)

Definition at line 590 of file MenuComponents.py.

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 

◆ 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):
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 

◆ numberAllSteps()

def MenuComponents.Chain.numberAllSteps (   self)

Definition at line 529 of file MenuComponents.py.

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 

Member Data Documentation

◆ __slots__

MenuComponents.Chain.__slots__
staticprivate

Definition at line 485 of file MenuComponents.py.

◆ alignmentGroups

MenuComponents.Chain.alignmentGroups

Definition at line 500 of file MenuComponents.py.

◆ L1decisions

MenuComponents.Chain.L1decisions

Definition at line 515 of file MenuComponents.py.

◆ name

MenuComponents.Chain.name

Definition at line 497 of file MenuComponents.py.

◆ nSteps

MenuComponents.Chain.nSteps

Definition at line 499 of file MenuComponents.py.

◆ steps

MenuComponents.Chain.steps

Definition at line 498 of file MenuComponents.py.

◆ topoMap

MenuComponents.Chain.topoMap

Definition at line 509 of file MenuComponents.py.


The documentation for this class was generated from the following file:
convertTimingResiduals.sum
sum
Definition: convertTimingResiduals.py:55
plotBeamSpotVxVal.range
range
Definition: plotBeamSpotVxVal.py:195
TCS::join
std::string join(const std::vector< std::string > &v, const char c=',')
Definition: Trigger/TrigT1/L1Topo/L1TopoCommon/Root/StringUtils.cxx:10
python.processes.powheg.ZZ.ZZ.__init__
def __init__(self, base_directory, **kwargs)
Constructor: all process options are set here.
Definition: ZZ.py:18
str
Definition: BTagTrackIpAccessor.cxx:11
WriteBchToCool.update
update
Definition: WriteBchToCool.py:67