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

Public Member Functions

def __init__ (self, period=0, customGRL=None, release=None, flags=None)
 
def setRunRange (self, start=0, end=999999)
 
def __str__ (self)
 
def toJSON (self)
 
def merge (cls, listofTI)
 
def testCustomGRL (cls, grl)
 
def reparse (self)
 

Public Attributes

 triggerChains
 
 period
 
 totalLB
 
 totalLBByRun
 

Private Member Functions

def _getUnprescaled (self, triggerType, additionalTriggerType, matchPattern, livefraction=1.0)
 
def _getLowestUnprescaled (self, triggerType, additionalTriggerType, matchPattern, livefraction=1.0)
 
def _getAllHLT (self, triggerType, additionalTriggerType, matchPattern, livefraction)
 
def _getActive (self, triggerType, additionalTriggerType, matchPattern, livefraction)
 
def _getInactive (self, triggerType, additionalTriggerType, matchPattern, livefraction)
 
def _checkPeriodConsistency (self, triggerType, additionalTriggerType, matchPattern)
 

Detailed Description

Object containing all the HLT information related to a given period.
    Stores a list of TriggerChain objects and the functions to skim them

Definition at line 14 of file TriggerInfo.py.

Constructor & Destructor Documentation

◆ __init__()

def python.TriggerAPI.TriggerInfo.TriggerInfo.__init__ (   self,
  period = 0,
  customGRL = None,
  release = None,
  flags = None 
)

Definition at line 18 of file TriggerInfo.py.

18  def __init__(self,period=0, customGRL=None, release=None, flags=None):
19  self.triggerChains = []
20  self.period = period
21  self.totalLB = 0
22  self.totalLBByRun = {}
23 
24  if not period and not customGRL: return
25  from .TriggerDataAccess import getHLTlist
26  HLTlist, self.totalLB, self.totalLBByRun = getHLTlist(period, customGRL, release, flags)
27  for hlt, l1, livefraction, activeLB, hasRerun, activeLBByRun in HLTlist:
28  self.triggerChains.append( TriggerChain(hlt, l1, livefraction, activeLB, hasRerun, activeLBByRun))
29 

Member Function Documentation

◆ __str__()

def python.TriggerAPI.TriggerInfo.TriggerInfo.__str__ (   self)

Definition at line 42 of file TriggerInfo.py.

42  def __str__(self):
43  return f"<TriggerMenuMT.TriggerAPI.TriggerInfo.TriggerInfo object with {len(self.triggerChains)} triggerChains, period={self.period}, totalLB={self.totalLB}>"
44 

◆ _checkPeriodConsistency()

def python.TriggerAPI.TriggerInfo.TriggerInfo._checkPeriodConsistency (   self,
  triggerType,
  additionalTriggerType,
  matchPattern 
)
private

Definition at line 111 of file TriggerInfo.py.

111  def _checkPeriodConsistency(self,triggerType, additionalTriggerType, matchPattern):
112  inconsistent = set()
113  for i in range(len(self.triggerChains)):
114  probe1 = self.triggerChains[i]
115  if not (probe1.passType(triggerType, additionalTriggerType) and re.search(matchPattern, probe1.name)): continue
116  for j in range(i+1,len(self.triggerChains)):
117  probe2 = self.triggerChains[j]
118  if not (probe2.passType(triggerType, additionalTriggerType) and re.search(matchPattern, probe2.name)): continue
119  if probe1.isUnprescaled() and not probe2.isUnprescaled() and probe1.isLowerThan(probe2,self.period)==1:
120  log.error(f"Found {probe2.name} that is tighter than Primary {probe1.name}")
121  inconsistent.add(probe2.name)
122  if probe2.isUnprescaled() and not probe1.isUnprescaled() and probe2.isLowerThan(probe1,self.period)==1:
123  log.error(f"Found {probe1.name} that is tighter than Primary {probe2.name}")
124  inconsistent.add(probe1.name)
125 
126  return inconsistent
127 
128 

◆ _getActive()

def python.TriggerAPI.TriggerInfo.TriggerInfo._getActive (   self,
  triggerType,
  additionalTriggerType,
  matchPattern,
  livefraction 
)
private

Definition at line 106 of file TriggerInfo.py.

106  def _getActive(self,triggerType, additionalTriggerType, matchPattern, livefraction):
107  return [x.name for x in self.triggerChains if x.isActive(livefraction) and x.passType(triggerType, additionalTriggerType) and re.search(matchPattern, x.name)]

◆ _getAllHLT()

def python.TriggerAPI.TriggerInfo.TriggerInfo._getAllHLT (   self,
  triggerType,
  additionalTriggerType,
  matchPattern,
  livefraction 
)
private

Definition at line 103 of file TriggerInfo.py.

103  def _getAllHLT(self,triggerType, additionalTriggerType, matchPattern, livefraction):
104  return {x.name: x.livefraction for x in self.triggerChains if x.passType(triggerType, additionalTriggerType) and re.search(matchPattern, x.name) and x.isUnprescaled(livefraction)}
105 

◆ _getInactive()

def python.TriggerAPI.TriggerInfo.TriggerInfo._getInactive (   self,
  triggerType,
  additionalTriggerType,
  matchPattern,
  livefraction 
)
private

Definition at line 108 of file TriggerInfo.py.

108  def _getInactive(self,triggerType, additionalTriggerType, matchPattern, livefraction):
109  return [x.name for x in self.triggerChains if x.isInactive(livefraction) and x.passType(triggerType, additionalTriggerType) and re.search(matchPattern, x.name)]
110 

◆ _getLowestUnprescaled()

def python.TriggerAPI.TriggerInfo.TriggerInfo._getLowestUnprescaled (   self,
  triggerType,
  additionalTriggerType,
  matchPattern,
  livefraction = 1.0 
)
private

Definition at line 83 of file TriggerInfo.py.

83  def _getLowestUnprescaled(self,triggerType, additionalTriggerType, matchPattern, livefraction=1.0):
84  chainList = [ x for x in self.triggerChains if x.isUnprescaled(livefraction) and x.passType(triggerType, additionalTriggerType) and re.search(matchPattern, x.name)]
85  typeMap = {}
86  for chain in chainList:
87  if chain.triggerType not in typeMap:
88  typeMap[chain.triggerType] = [chain]
89  continue
90  append = False
91  for other in typeMap[chain.triggerType][:]:
92  comp = chain.isLowerThan(other,self.period)
93  if comp == 0:
94  append = False
95  break
96  append = True
97  if comp == 1: typeMap[chain.triggerType].remove(other)
98  if append:
99  typeMap[chain.triggerType].append(chain)
100  return [x.name for t in six.itervalues (typeMap) for x in t ]
101 
102 

◆ _getUnprescaled()

def python.TriggerAPI.TriggerInfo.TriggerInfo._getUnprescaled (   self,
  triggerType,
  additionalTriggerType,
  matchPattern,
  livefraction = 1.0 
)
private

Definition at line 80 of file TriggerInfo.py.

80  def _getUnprescaled(self,triggerType, additionalTriggerType, matchPattern, livefraction=1.0):
81  return [x.name for x in self.triggerChains if x.isUnprescaled(livefraction) and x.passType(triggerType, additionalTriggerType) and re.search(matchPattern, x.name)]
82 

◆ merge()

def python.TriggerAPI.TriggerInfo.TriggerInfo.merge (   cls,
  listofTI 
)

Definition at line 49 of file TriggerInfo.py.

49  def merge(cls,listofTI):
50  from copy import deepcopy
51  mergedTI = TriggerInfo()
52  mergedHLTmap = {}
53  for ti in listofTI:
54  mergedTI.period |= ti.period
55  mergedTI.totalLB += ti.totalLB
56  for run,lb in ti.totalLBByRun.items():
57  if run not in mergedTI.totalLBByRun: mergedTI.totalLBByRun[run] = 0
58  mergedTI.totalLBByRun[run] += lb
59  for tc in ti.triggerChains:
60  if tc.name not in mergedHLTmap: mergedHLTmap[tc.name] = deepcopy(tc)
61  else: mergedHLTmap[tc.name].activeLB += tc.activeLB
62  # copy activeLBByRun values too
63  for run,lb in tc.activeLBByRun.items():
64  if run not in mergedHLTmap[tc.name].activeLBByRun: mergedHLTmap[tc.name].activeLBByRun = 0
65  mergedHLTmap[tc.name].activeLBByRun += lb
66  for tc in six.itervalues (mergedHLTmap):
67  tc.livefraction = tc.activeLB/float(mergedTI.totalLB)
68  mergedTI.triggerChains = list(mergedHLTmap.values())
69  return mergedTI
70 
71 

◆ reparse()

def python.TriggerAPI.TriggerInfo.TriggerInfo.reparse (   self)

Definition at line 77 of file TriggerInfo.py.

77  def reparse(self):
78  self.triggerChains = [ TriggerChain(t.name, t.l1seed, t.livefraction, t.activeLB) for t in self.triggerChains ]
79 

◆ setRunRange()

def python.TriggerAPI.TriggerInfo.TriggerInfo.setRunRange (   self,
  start = 0,
  end = 999999 
)

Definition at line 30 of file TriggerInfo.py.

30  def setRunRange(self,start=0,end=999999):
31  if not self.totalLBByRun:
32  # empty dict means either loaded from trigger menu or from old json
33  totalLB = self.totalLB
34  else:
35  totalLB = 0
36  for run,efflb in self.totalLBByRun.items():
37  if int(run)<int(start) or int(run)>int(end): continue
38  totalLB += efflb
39  for tc in self.triggerChains:
40  tc.setRunRange(start,end,totalLB)
41 

◆ testCustomGRL()

def python.TriggerAPI.TriggerInfo.TriggerInfo.testCustomGRL (   cls,
  grl 
)

Definition at line 73 of file TriggerInfo.py.

73  def testCustomGRL(cls, grl):
74  from TriggerMenuMT.TriggerAPI.TriggerPeriodData import TriggerPeriodData
75  return TriggerPeriodData.testCustomGRL(grl)
76 

◆ toJSON()

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

Definition at line 45 of file TriggerInfo.py.

45  def toJSON(self):
46  return dict(period= TriggerPeriod.toName(self.period), totalLB=self.totalLB,triggerChains=self.triggerChains,totalLBByRun=self.totalLBByRun)
47 

Member Data Documentation

◆ period

python.TriggerAPI.TriggerInfo.TriggerInfo.period

Definition at line 20 of file TriggerInfo.py.

◆ totalLB

python.TriggerAPI.TriggerInfo.TriggerInfo.totalLB

Definition at line 21 of file TriggerInfo.py.

◆ totalLBByRun

python.TriggerAPI.TriggerInfo.TriggerInfo.totalLBByRun

Definition at line 22 of file TriggerInfo.py.

◆ triggerChains

python.TriggerAPI.TriggerInfo.TriggerInfo.triggerChains

Definition at line 19 of file TriggerInfo.py.


The documentation for this class was generated from the following file:
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
dumpHVPathFromNtuple.append
bool append
Definition: dumpHVPathFromNtuple.py:91
PixelModuleFeMask_create_db.remove
string remove
Definition: PixelModuleFeMask_create_db.py:83
plotBeamSpotVxVal.range
range
Definition: plotBeamSpotVxVal.py:195
histSizes.list
def list(name, path='/')
Definition: histSizes.py:38
CxxUtils::set
constexpr std::enable_if_t< is_bitmask_v< E >, E & > set(E &lhs, E rhs)
Convenience function to set bits in a class enum bitmask.
Definition: bitmask.h:232
TriggerInfo
This class contains trigger related information.
Definition: TriggerInfo.h:77
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
python.utility.LHE.merge
def merge(input_file_pattern, output_file)
Merge many input LHE files into a single output file.
Definition: LHE.py:29
python.TriggerAPI.TriggerDataAccess.getHLTlist
def getHLTlist(period, customGRL, release, flags=None)
Definition: TriggerDataAccess.py:393
readCCLHist.float
float
Definition: readCCLHist.py:83