ATLAS Offline Software
Loading...
Searching...
No Matches
python.TriggerAPI.TriggerInfo.TriggerChain Class Reference
Collaboration diagram for python.TriggerAPI.TriggerInfo.TriggerChain:

Public Member Functions

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

Public Attributes

 name = name
 l1seed = l1seed
 legs = self.splitAndOrderLegs(tmplegs)
int livefraction = livefraction
int activeLB = activeLB
 hasRerun = hasRerun
 activeLBByRun = activeLBByRun
bool triggerType = self.getTriggerType(self.legs, l1seed)

Static Public Attributes

tuple l1types = ('EM','J','MU','TAU','XE','XS','HT','eEM','eTAU','jJ','jTAU','jXE','gXEJWOJ','gJ','gLJ','jEM')
 l1pattern = re.compile('([0-9]*)(%s)([0-9]+)' % '|'.join(l1types))

Detailed Description

Definition at line 371 of file TriggerInfo.py.

Constructor & Destructor Documentation

◆ __init__()

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

Definition at line 375 of file TriggerInfo.py.

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

Member Function Documentation

◆ __repr__()

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

Definition at line 561 of file TriggerInfo.py.

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

◆ getTriggerType()

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

Definition at line 472 of file TriggerInfo.py.

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

◆ getType()

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

Definition at line 538 of file TriggerInfo.py.

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

◆ isActive()

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

Definition at line 530 of file TriggerInfo.py.

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

◆ isInactive()

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

Definition at line 532 of file TriggerInfo.py.

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

◆ isLowerThan()

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 580 of file TriggerInfo.py.

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

◆ isSubsetOf()

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 564 of file TriggerInfo.py.

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

◆ isUnprescaled()

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

Definition at line 535 of file TriggerInfo.py.

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

◆ passType()

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

Definition at line 541 of file TriggerInfo.py.

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

◆ setRunRange()

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 386 of file TriggerInfo.py.

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

◆ splitAndOrderLegs()

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

Definition at line 408 of file TriggerInfo.py.

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

◆ toJSON()

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

Definition at line 405 of file TriggerInfo.py.

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

Member Data Documentation

◆ activeLB

int python.TriggerAPI.TriggerInfo.TriggerChain.activeLB = activeLB

Definition at line 381 of file TriggerInfo.py.

◆ activeLBByRun

python.TriggerAPI.TriggerInfo.TriggerChain.activeLBByRun = activeLBByRun

Definition at line 383 of file TriggerInfo.py.

◆ hasRerun

python.TriggerAPI.TriggerInfo.TriggerChain.hasRerun = hasRerun

Definition at line 382 of file TriggerInfo.py.

◆ l1pattern

python.TriggerAPI.TriggerInfo.TriggerChain.l1pattern = re.compile('([0-9]*)(%s)([0-9]+)' % '|'.join(l1types))
static

Definition at line 373 of file TriggerInfo.py.

◆ l1seed

python.TriggerAPI.TriggerInfo.TriggerChain.l1seed = l1seed

Definition at line 377 of file TriggerInfo.py.

◆ l1types

tuple python.TriggerAPI.TriggerInfo.TriggerChain.l1types = ('EM','J','MU','TAU','XE','XS','HT','eEM','eTAU','jJ','jTAU','jXE','gXEJWOJ','gJ','gLJ','jEM')
static

Definition at line 372 of file TriggerInfo.py.

◆ legs

python.TriggerAPI.TriggerInfo.TriggerChain.legs = self.splitAndOrderLegs(tmplegs)

Definition at line 379 of file TriggerInfo.py.

◆ livefraction

python.TriggerAPI.TriggerInfo.TriggerChain.livefraction = livefraction

Definition at line 380 of file TriggerInfo.py.

◆ name

python.TriggerAPI.TriggerInfo.TriggerChain.name = name

Definition at line 376 of file TriggerInfo.py.

◆ triggerType

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

Definition at line 384 of file TriggerInfo.py.


The documentation for this class was generated from the following file: