ATLAS Offline Software
Public Member Functions | Public Attributes | Static Public Attributes | List of all members
python.TriggerAPI.TriggerInfo.TriggerChain Class Reference
Collaboration diagram for python.TriggerAPI.TriggerInfo.TriggerChain:

Public Member Functions

def __init__ (self, name, l1seed, livefraction, activeLB=1, hasRerun=False, activeLBByRun={})
 
def setRunRange (self, start, end, totalLB)
 
def toJSON (self)
 
def splitAndOrderLegs (self, legs)
 
def getTriggerType (self, legs, l1seed)
 
def isActive (self, livefraction=1e-99)
 
def isInactive (self, livefraction=1e-99)
 
def isUnprescaled (self, livefraction=1.0)
 
def getType (self)
 
def passType (self, triggerType, additionalTriggerType)
 
def __repr__ (self)
 
def isSubsetOf (self, other)
 
def isLowerThan (self, other, period=TriggerPeriod.future)
 

Public Attributes

 name
 
 l1seed
 
 legs
 
 livefraction
 
 activeLB
 
 hasRerun
 
 activeLBByRun
 
 triggerType
 

Static Public Attributes

 l1types
 
 l1pattern
 

Detailed Description

Definition at line 372 of file TriggerInfo.py.

Constructor & Destructor Documentation

◆ __init__()

def python.TriggerAPI.TriggerInfo.TriggerChain.__init__ (   self,
  name,
  l1seed,
  livefraction,
  activeLB = 1,
  hasRerun = False,
  activeLBByRun = {} 
)

Definition at line 376 of file TriggerInfo.py.

376  def __init__(self,name,l1seed,livefraction,activeLB=1,hasRerun=False, activeLBByRun={}):
377  self.name = name
378  self.l1seed = l1seed
379  tmplegs = TriggerLeg.parse_legs(name,l1seed,name)
380  self.legs = self.splitAndOrderLegs(tmplegs)
381  self.livefraction = livefraction
382  self.activeLB = activeLB
383  self.hasRerun = hasRerun
384  self.activeLBByRun = activeLBByRun
385  self.triggerType = self.getTriggerType(self.legs, l1seed)
386 

Member Function Documentation

◆ __repr__()

def python.TriggerAPI.TriggerInfo.TriggerChain.__repr__ (   self)

Definition at line 562 of file TriggerInfo.py.

562  def __repr__(self):
563  return repr({"name":self.name, "legs":self.legs, "triggerType":TriggerType.toStr(self.triggerType), "livefraction":self.livefraction, "activeLB":self.activeLB})
564 

◆ getTriggerType()

def python.TriggerAPI.TriggerInfo.TriggerChain.getTriggerType (   self,
  legs,
  l1seed 
)

Definition at line 473 of file TriggerInfo.py.

473  def getTriggerType(self, legs, l1seed):
474  mtype = TriggerType.UNDEFINED
475 
476  for l in legs:
477  if mtype & TriggerType.el and l.legtype & TriggerType.el:
478  mtype |= TriggerType.el_multi
479  mtype &= ~TriggerType.el_single
480  elif mtype & TriggerType.mu and l.legtype & TriggerType.mu:
481  mtype |= TriggerType.mu_multi
482  mtype &= ~TriggerType.mu_single
483  elif mtype & TriggerType.tau and l.legtype & TriggerType.tau:
484  mtype |= TriggerType.tau_multi
485  mtype &= ~TriggerType.tau_single
486  elif mtype & TriggerType.j and l.legtype & TriggerType.j:
487  mtype |= TriggerType.j_multi
488  mtype &= ~TriggerType.j_single
489  elif mtype & TriggerType.bj and l.legtype & TriggerType.bj:
490  mtype |= TriggerType.bj_multi
491  mtype &= ~TriggerType.bj_single
492  elif mtype & TriggerType.g and l.legtype & TriggerType.g:
493  mtype |= TriggerType.g_multi
494  mtype &= ~TriggerType.g_single
495  elif l.legtype & TriggerType.mu_bphys:
496  mtype |= TriggerType.mu_bphys
497  mtype &= ~(TriggerType.mu_single | TriggerType.mu_multi)
498  elif l.legtype & TriggerType.exotics:
499  mtype |= TriggerType.exotics
500  elif l.legtype & TriggerType.afp:
501  mtype = TriggerType.afp #on purpose not OR-ed
502  else:
503  mtype |= l.legtype
504 
505  l1seed= l1seed.replace("L1_","")
506  if mtype & TriggerType.exotics or mtype & TriggerType.afp:
507  return mtype
508  for token in l1seed.split("_"):
509  m = self.l1pattern.match(token)
510  if m:
511  count,legtype,thr = m.groups()
512  count = int(count) if count else 1
513  if 'EM' in legtype or 'TAU' in legtype:
514  pass
515  elif 'MU' in legtype:
516  if not mtype & TriggerType.mu_bphys:
517  if count > 1: mtype |= TriggerType.mu_multi
518  elif not mtype & TriggerType.mu_multi: mtype |= TriggerType.mu_single
519  elif 'J' in legtype:
520  if not mtype & TriggerType.bj and not mtype & TriggerType.j and not mtype & TriggerType.tau and not mtype & TriggerType.ht:
521  if count > 1: mtype |= TriggerType.j_multi
522  elif not mtype & TriggerType.j_multi: mtype |= TriggerType.j_single
523  elif 'XE' in legtype or 'XS' in legtype:
524  mtype |= TriggerType.xe
525  elif 'HT' in legtype:
526  mtype |= TriggerType.ht
527  else:
528  log.info("Unknown trigger type:",(legtype, mtype, token, self.name))
529  return mtype
530 

◆ getType()

def python.TriggerAPI.TriggerInfo.TriggerChain.getType (   self)

Definition at line 539 of file TriggerInfo.py.

539  def getType(self):
540  return self.triggerType
541 

◆ isActive()

def python.TriggerAPI.TriggerInfo.TriggerChain.isActive (   self,
  livefraction = 1e-99 
)

Definition at line 531 of file TriggerInfo.py.

531  def isActive(self, livefraction=1e-99):
532  return self.livefraction > livefraction or self.hasRerun

◆ isInactive()

def python.TriggerAPI.TriggerInfo.TriggerChain.isInactive (   self,
  livefraction = 1e-99 
)

Definition at line 533 of file TriggerInfo.py.

533  def isInactive(self, livefraction=1e-99):
534  return not self.isActive(livefraction)
535 

◆ isLowerThan()

def python.TriggerAPI.TriggerInfo.TriggerChain.isLowerThan (   self,
  other,
  period = TriggerPeriod.future 
)
Returns -1 if none of them is lower than the other (e.g. asymmetric dilepton).
    Returns  0 if other is lower than self.
    Returns  1 if self  is lower than other.

Definition at line 581 of file TriggerInfo.py.

581  def isLowerThan(self, other,period=TriggerPeriod.future):
582  ''' Returns -1 if none of them is lower than the other (e.g. asymmetric dilepton).
583  Returns 0 if other is lower than self.
584  Returns 1 if self is lower than other.
585  '''
586  is2015 = period & TriggerPeriod.y2015 and not TriggerPeriod.isRunNumber(period)
587  is2015 |= period <= 284484 and TriggerPeriod.isRunNumber(period)
588  if self.triggerType != other.triggerType: return -1
589  if len(self.legs) != len(other.legs): return -1
590  comp = -1
591  debug = False
592  #if re.search("HLT_j55_gsc75_bmv2c1040_split_3j55_gsc75_boffperf_split", self.name): debug = True
593  if debug: log.info("DEBUG:",self.name,other.name)
594  for selfleg, otherleg in zip(self.legs, other.legs):
595  legcomp = selfleg.isLegLowerThan(otherleg, is2015, debug)
596  if debug: log.info("DEBUG LEG return:", legcomp)
597  if legcomp == -9: return -1
598  elif legcomp == -1: continue
599  elif legcomp == 0 and comp == 1: return -1
600  elif legcomp == 1 and comp == 0: return -1
601  elif legcomp == 0 : comp = 0
602  elif legcomp == 1 : comp = 1
603  if debug: log.info("DEBUG FINAL:",comp)
604  return comp
605 
606 

◆ isSubsetOf()

def python.TriggerAPI.TriggerInfo.TriggerChain.isSubsetOf (   self,
  other 
)
Returns -1 if none of them is a strict subset of the other
    Returns  0 if the legs in other are a subset of self.
    Returns  1 if the legs in self  are a subset of other.

Definition at line 565 of file TriggerInfo.py.

565  def isSubsetOf(self, other):
566  ''' Returns -1 if none of them is a strict subset of the other
567  Returns 0 if the legs in other are a subset of self.
568  Returns 1 if the legs in self are a subset of other.
569  '''
570  if not self.legs or not other.legs: return -1 #problems with AFP
571  selfcounter = Counter(self.legs)
572  othercounter = Counter(other.legs)
573  for leg, count in selfcounter.items():
574  if leg not in othercounter or count > othercounter[leg]: break
575  else: return 1
576  for leg, count in othercounter.items():
577  if leg not in selfcounter or count > selfcounter[leg]: break
578  else: return 0
579  return -1
580 

◆ isUnprescaled()

def python.TriggerAPI.TriggerInfo.TriggerChain.isUnprescaled (   self,
  livefraction = 1.0 
)

Definition at line 536 of file TriggerInfo.py.

536  def isUnprescaled(self, livefraction=1.0):
537  return self.livefraction >= livefraction
538 

◆ passType()

def python.TriggerAPI.TriggerInfo.TriggerChain.passType (   self,
  triggerType,
  additionalTriggerType 
)

Definition at line 542 of file TriggerInfo.py.

542  def passType(self, triggerType, additionalTriggerType):
543  if self.triggerType == TriggerType.UNDEFINED: return False
544  if self.triggerType == TriggerType.ALL: return True
545  match = (self.triggerType & triggerType)
546  if not match: return False
547  tmpType = self.triggerType & ~triggerType
548 
549  try:
550  for t in additionalTriggerType:
551  match = (tmpType & t)
552  if not match: return False
553  tmpType = tmpType & ~t
554  except TypeError: #Not iterable
555  if additionalTriggerType!=TriggerType.UNDEFINED:
556  match = (tmpType & additionalTriggerType)
557  if not match: return False
558  tmpType = tmpType & ~additionalTriggerType
559 
560  return tmpType == TriggerType.UNDEFINED #After matches nothing remains
561 

◆ setRunRange()

def python.TriggerAPI.TriggerInfo.TriggerChain.setRunRange (   self,
  start,
  end,
  totalLB 
)
This method is called by the owning TriggerInfo method to adjust the livefractions and activeLB
to only the given runs
:param start:
:param end:
:param totalLB:
:return:

Definition at line 387 of file TriggerInfo.py.

387  def setRunRange(self,start,end,totalLB):
388  """
389  This method is called by the owning TriggerInfo method to adjust the livefractions and activeLB
390  to only the given runs
391  :param start:
392  :param end:
393  :param totalLB:
394  :return:
395  """
396  if not self.activeLBByRun:
397  # empty dict means either loaded from trigger menu or from old json
398  return
399  self.activeLB = 0
400  for run,efflb in self.activeLBByRun.items():
401  if int(run)<int(start) or int(run)>int(end): continue
402  self.activeLB += efflb
403  self.livefraction = self.activeLB/totalLB
404  pass
405 

◆ splitAndOrderLegs()

def python.TriggerAPI.TriggerInfo.TriggerChain.splitAndOrderLegs (   self,
  legs 
)

Definition at line 409 of file TriggerInfo.py.

409  def splitAndOrderLegs(self, legs):
410  from copy import deepcopy
411  newLegs = []
412  for triggerType in TriggerType:
413  for l in legs:
414  if not l.legtype == triggerType: continue
415  for i in range(l.count): #split into N single legs
416  tmp = deepcopy(l)
417  tmp.count = 1
418  if tmp.legtype & TriggerType.el_multi:
419  tmp.legtype |= TriggerType.el_single
420  tmp.legtype &= ~TriggerType.el_multi
421  elif tmp.legtype & TriggerType.mu_multi:
422  tmp.legtype |= TriggerType.mu_single
423  tmp.legtype &= ~TriggerType.mu_multi
424  elif tmp.legtype & TriggerType.tau_multi:
425  tmp.legtype |= TriggerType.tau_single
426  tmp.legtype &= ~TriggerType.tau_multi
427  elif tmp.legtype & TriggerType.j_multi:
428  tmp.legtype |= TriggerType.j_single
429  tmp.legtype &= ~TriggerType.j_multi
430  elif tmp.legtype & TriggerType.bj_multi:
431  tmp.legtype |= TriggerType.bj_single
432  tmp.legtype &= ~TriggerType.bj_multi
433  elif tmp.legtype & TriggerType.g_multi:
434  tmp.legtype |= TriggerType.g_single
435  tmp.legtype &= ~TriggerType.g_multi
436  newLegs.append(tmp)
437  return newLegs
438 
439 

◆ toJSON()

def python.TriggerAPI.TriggerInfo.TriggerChain.toJSON (   self)

Definition at line 406 of file TriggerInfo.py.

406  def toJSON(self):
407  return dict(name=self.name, l1seed=self.l1seed, livefraction=self.livefraction, activeLB=self.activeLB, hasRerun=self.hasRerun,activeLBByRun=self.activeLBByRun)
408 

Member Data Documentation

◆ activeLB

python.TriggerAPI.TriggerInfo.TriggerChain.activeLB

Definition at line 382 of file TriggerInfo.py.

◆ activeLBByRun

python.TriggerAPI.TriggerInfo.TriggerChain.activeLBByRun

Definition at line 384 of file TriggerInfo.py.

◆ hasRerun

python.TriggerAPI.TriggerInfo.TriggerChain.hasRerun

Definition at line 383 of file TriggerInfo.py.

◆ l1pattern

python.TriggerAPI.TriggerInfo.TriggerChain.l1pattern
static

Definition at line 374 of file TriggerInfo.py.

◆ l1seed

python.TriggerAPI.TriggerInfo.TriggerChain.l1seed

Definition at line 378 of file TriggerInfo.py.

◆ l1types

python.TriggerAPI.TriggerInfo.TriggerChain.l1types
static

Definition at line 373 of file TriggerInfo.py.

◆ legs

python.TriggerAPI.TriggerInfo.TriggerChain.legs

Definition at line 380 of file TriggerInfo.py.

◆ livefraction

python.TriggerAPI.TriggerInfo.TriggerChain.livefraction

Definition at line 381 of file TriggerInfo.py.

◆ name

python.TriggerAPI.TriggerInfo.TriggerChain.name

Definition at line 377 of file TriggerInfo.py.

◆ triggerType

python.TriggerAPI.TriggerInfo.TriggerChain.triggerType

Definition at line 385 of file TriggerInfo.py.


The documentation for this class was generated from the following file:
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
plotBeamSpotVxVal.range
range
Definition: plotBeamSpotVxVal.py:195
PyAthena::repr
std::string repr(PyObject *o)
returns the string representation of a python object equivalent of calling repr(o) in python
Definition: PyAthenaUtils.cxx:106
TrigJetMonitorAlgorithm.items
items
Definition: TrigJetMonitorAlgorithm.py:79
python.processes.powheg.ZZ.ZZ.__init__
def __init__(self, base_directory, **kwargs)
Constructor: all process options are set here.
Definition: ZZ.py:18
Ringer::getType
T getType(const char *cStr)
Return Ringer enumeration of type T identifying string type:
match
bool match(std::string s1, std::string s2)
match the individual directories of two strings
Definition: hcg.cxx:356