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 472 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 475 of file MenuComponents.py.

475  def __init__(self, name, ChainSteps, L1decisions, nSteps = None, alignmentGroups = None, topoMap=None):
476 
477  """
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
480  """
481 
482  # default mutable values must be initialized to None
483  if nSteps is None: nSteps = []
484  if alignmentGroups is None: alignmentGroups = []
485 
486  self.name = name
487  self.steps = ChainSteps
488  self.nSteps = nSteps
489  self.alignmentGroups = alignmentGroups
490 
491 
492  # The chain holds a map of topo ComboHypoTool configurators
493  # This is needed to allow placement of the ComboHypoTool in the right position
494  # for multi-leg chains (defaults to last step)
495  # Format is {"[step name]" : ([topo config function], [topo descriptor string]), ...}
496  # Here, the topo descriptor string would usually be the chain name expression that
497  # configures the topo
498  self.topoMap = {}
499  if topoMap:
500  self.topoMap.update(topoMap)
501 
502  # L1decisions are used to set the seed type (EM, MU,JET), removing the actual threshold
503  # in practice it is the HLTSeeding Decision output
504  self.L1decisions = L1decisions
505  log.debug("[Chain.__init__] Made Chain %s with seeds: %s ", name, self.L1decisions)
506 

Member Function Documentation

◆ __repr__()

def MenuComponents.Chain.__repr__ (   self)

Definition at line 606 of file MenuComponents.py.

606  def __repr__(self):
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)))
609 
610 
611 # next: can we remove multiplicity array, if it can be retrieved from the ChainDict?
612 # 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 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
605 

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

◆ 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)]
516 
517 

◆ checkMultiplicity()

def MenuComponents.Chain.checkMultiplicity (   self)

Definition at line 579 of file MenuComponents.py.

579  def checkMultiplicity(self):
580  #TODO: Not used anymore, can we delete it?
581  if len(self.steps) == 0:
582  return 0
583  mult=[sum(step.multiplicity) for step in self.steps] # on mult per step
584  not_empty_mult = [m for m in mult if m!=0]
585  if len(not_empty_mult) == 0: #empty chain?
586  log.error("checkMultiplicity: Chain %s has all steps with multiplicity =0: what to do?", self.name)
587  return 0
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))
590  return 0
591 
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))
594  return 0
595  return not_empty_mult[0]
596 
597 

◆ 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):
533  #start position indexed from 0. if start position is 3 and length is 2, it works like:
534  # [old1,old2,old3,old4,old5,old6] ==> [old1,old2,old3,empty1,empty2,old4,old5,old6]
535 
536  if len(self.steps) == 0 :
537  log.error("I can't insert empty steps because the chain doesn't have any steps yet!")
538 
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)
541 
542 
543  chain_steps_pre_split = self.steps[:start_position]
544  chain_steps_post_split = self.steps[start_position:]
545 
546  next_step_name = ''
547  prev_step_name = ''
548  # copy the same dictionary as the last step, which else?
549  prev_chain_dict = []
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:]
556 
557  prev_step_name = 'empty_'+str(len(self.L1decisions))+'L1in'
558  prev_chain_dict = chain_steps_post_split[0].stepDicts
559  else:
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)
562  else:
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
566 
567 
568  steps_to_add = []
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
571 
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)]
574 
575  self.steps = chain_steps_pre_split + steps_to_add + chain_steps_post_split
576 
577  return
578 

◆ numberAllSteps()

def MenuComponents.Chain.numberAllSteps (   self)

Definition at line 518 of file MenuComponents.py.

518  def numberAllSteps(self):
519  if len(self.steps)==0:
520  return
521  else:
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
529  return
530 
531 

Member Data Documentation

◆ __slots__

MenuComponents.Chain.__slots__
staticprivate

Definition at line 474 of file MenuComponents.py.

◆ alignmentGroups

MenuComponents.Chain.alignmentGroups

Definition at line 489 of file MenuComponents.py.

◆ L1decisions

MenuComponents.Chain.L1decisions

Definition at line 504 of file MenuComponents.py.

◆ name

MenuComponents.Chain.name

Definition at line 486 of file MenuComponents.py.

◆ nSteps

MenuComponents.Chain.nSteps

Definition at line 488 of file MenuComponents.py.

◆ steps

MenuComponents.Chain.steps

Definition at line 487 of file MenuComponents.py.

◆ topoMap

MenuComponents.Chain.topoMap

Definition at line 498 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