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

Public Member Functions

 reset (cls)
 init (cls)
 setConfigFlags (cls, flags)
 setRelease (cls, release)
 setCustomGRL (cls, grl)
 getLowestUnprescaled (cls, period, triggerType=TriggerType.ALL, additionalTriggerType=TriggerType.UNDEFINED, matchPattern="", livefraction=1.0, reparse=False)
 getLowestUnprescaledAnyPeriod (cls, period, triggerType=TriggerType.ALL, additionalTriggerType=TriggerType.UNDEFINED, matchPattern="", livefraction=1.0, reparse=False)
 getUnprescaled (cls, period, triggerType=TriggerType.ALL, additionalTriggerType=TriggerType.UNDEFINED, matchPattern="", livefraction=1.0, reparse=False)
 getUnprescaledAnyPeriod (cls, period, triggerType=TriggerType.ALL, additionalTriggerType=TriggerType.UNDEFINED, matchPattern="", livefraction=1.0, reparse=False)
 getInactive (cls, period, triggerType=TriggerType.ALL, additionalTriggerType=TriggerType.UNDEFINED, matchPattern="", livefraction=1e-99, reparse=False)
 getActive (cls, period, triggerType=TriggerType.ALL, additionalTriggerType=TriggerType.UNDEFINED, matchPattern="", livefraction=1e-99, reparse=False)
 getAllHLT (cls, period, triggerType=TriggerType.ALL, additionalTriggerType=TriggerType.UNDEFINED, matchPattern="", livefraction=0, reparse=False)
 checkPeriodConsistency (cls, period=TriggerPeriod.future, triggerType=TriggerType.ALL, additionalTriggerType=TriggerType.UNDEFINED, matchPattern="", reparse=False)
 dumpAPI (cls, full=False)

Static Public Attributes

 log = logging.getLogger(__name__)
dict dbQueries = {}
 customGRL = None
 flags = None
 release = None
bool cacheread = False

Protected Member Functions

 _loadTriggerPeriod (cls, period, reparse)

Detailed Description

Definition at line 13 of file TriggerAPI.py.

Member Function Documentation

◆ _loadTriggerPeriod()

python.TriggerAPI.TriggerAPI.TriggerAPI._loadTriggerPeriod ( cls,
period,
reparse )
protected

Definition at line 152 of file TriggerAPI.py.

152 def _loadTriggerPeriod(cls, period, reparse):
153 if period != TriggerPeriod.customGRL and not period & TriggerPeriod.future: cls.init()
154 if (period,cls.customGRL) not in cls.dbQueries:
155 if TriggerPeriod.isRunNumber(period) or (isinstance(period,TriggerPeriod) and period.isBasePeriod()):
156 cls.dbQueries[(period,cls.customGRL)] = TriggerInfo(period,cls.customGRL,cls.release,cls.flags)
157 else:
158 basePeriods = [tp for tp in TriggerPeriod.basePeriods() if tp & period]
159 for bp in basePeriods:
160 cls._loadTriggerPeriod(bp,reparse)
161 cls.dbQueries[(period,cls.customGRL)] = TriggerInfo.merge([cls.dbQueries[(bp,cls.customGRL)] for bp in basePeriods])
162 if reparse: cls.dbQueries[(period,cls.customGRL)].reparse()
163
This class contains trigger related information.
Definition TriggerInfo.h:77

◆ checkPeriodConsistency()

python.TriggerAPI.TriggerAPI.TriggerAPI.checkPeriodConsistency ( cls,
period = TriggerPeriod.future,
triggerType = TriggerType.ALL,
additionalTriggerType = TriggerType.UNDEFINED,
matchPattern = "",
reparse = False )
 Returns a list of triggers that are tighter than the lowest unprescaled but are not flagged as primary
    This only makes sense for future periods, the past is already consistent :)
    See getLowestUnprescaled for a detailed description of the options

Definition at line 142 of file TriggerAPI.py.

142 def checkPeriodConsistency(cls, period=TriggerPeriod.future, triggerType=TriggerType.ALL, additionalTriggerType=TriggerType.UNDEFINED, matchPattern="", reparse=False):
143 ''' Returns a list of triggers that are tighter than the lowest unprescaled but are not flagged as primary
144 This only makes sense for future periods, the past is already consistent :)
145 See getLowestUnprescaled for a detailed description of the options
146 '''
147 period &= TriggerPeriod.future #Only meaningful for future periods
148 cls._loadTriggerPeriod(period,reparse)
149 return cls.dbQueries[(period,cls.customGRL)]._checkPeriodConsistency(triggerType, additionalTriggerType, matchPattern)
150

◆ dumpAPI()

python.TriggerAPI.TriggerAPI.TriggerAPI.dumpAPI ( cls,
full = False )

Definition at line 165 of file TriggerAPI.py.

165 def dumpAPI(cls, full=False):
166 if not full: #store only what is not in the central pickle/json
167 for period,grl in list(cls.dbQueries.keys()):
168 if TriggerPeriod.isRunNumber(period) or (isinstance(period,TriggerPeriod) and period.isBasePeriod()): continue
169 del cls.dbQueries[(period,grl)]
170 SerializeAPI.dump(cls.dbQueries)
171 cls.log.info(sorted(cls.dbQueries.keys()))
172
173

◆ getActive()

python.TriggerAPI.TriggerAPI.TriggerAPI.getActive ( cls,
period,
triggerType = TriggerType.ALL,
additionalTriggerType = TriggerType.UNDEFINED,
matchPattern = "",
livefraction = 1e-99,
reparse = False )
 Returns a list of HLT chains that were active at some point, including disabled chains in rerun.
    See getLowestUnprescaled for a detailed description of the options

Definition at line 124 of file TriggerAPI.py.

124 def getActive(cls, period, triggerType=TriggerType.ALL, additionalTriggerType=TriggerType.UNDEFINED, matchPattern="", livefraction=1e-99, reparse=False):
125 ''' Returns a list of HLT chains that were active at some point, including disabled chains in rerun.
126 See getLowestUnprescaled for a detailed description of the options
127 '''
128 cls._loadTriggerPeriod(period,reparse)
129 return cls.dbQueries[(period,cls.customGRL)]._getActive(triggerType, additionalTriggerType, matchPattern, livefraction)
130

◆ getAllHLT()

python.TriggerAPI.TriggerAPI.TriggerAPI.getAllHLT ( cls,
period,
triggerType = TriggerType.ALL,
additionalTriggerType = TriggerType.UNDEFINED,
matchPattern = "",
livefraction = 0,
reparse = False )
 Returns a map of {HLT chains: average live fraction} for a given period.
    The average live fraction is an approximation weighting the number of lumiblocks by prescale.
    *** Don't use this number in analysis!!! ***
    See getLowestUnprescaled for a detailed description of the options

Definition at line 132 of file TriggerAPI.py.

132 def getAllHLT(cls, period, triggerType=TriggerType.ALL, additionalTriggerType=TriggerType.UNDEFINED, matchPattern="", livefraction=0, reparse=False):
133 ''' Returns a map of {HLT chains: average live fraction} for a given period.
134 The average live fraction is an approximation weighting the number of lumiblocks by prescale.
135 *** Don't use this number in analysis!!! ***
136 See getLowestUnprescaled for a detailed description of the options
137 '''
138 cls._loadTriggerPeriod(period,reparse)
139 return cls.dbQueries[(period,cls.customGRL)]._getAllHLT(triggerType, additionalTriggerType, matchPattern, livefraction)
140

◆ getInactive()

python.TriggerAPI.TriggerAPI.TriggerAPI.getInactive ( cls,
period,
triggerType = TriggerType.ALL,
additionalTriggerType = TriggerType.UNDEFINED,
matchPattern = "",
livefraction = 1e-99,
reparse = False )
 Returns a list of HLT chains that were fully inactive, excluding disabled chains in rerun.
    See getLowestUnprescaled for a detailed description of the options

Definition at line 116 of file TriggerAPI.py.

116 def getInactive(cls, period, triggerType=TriggerType.ALL, additionalTriggerType=TriggerType.UNDEFINED, matchPattern="", livefraction=1e-99, reparse=False):
117 ''' Returns a list of HLT chains that were fully inactive, excluding disabled chains in rerun.
118 See getLowestUnprescaled for a detailed description of the options
119 '''
120 cls._loadTriggerPeriod(period,reparse)
121 return cls.dbQueries[(period,cls.customGRL)]._getInactive(triggerType, additionalTriggerType, matchPattern, livefraction)
122

◆ getLowestUnprescaled()

python.TriggerAPI.TriggerAPI.TriggerAPI.getLowestUnprescaled ( cls,
period,
triggerType = TriggerType.ALL,
additionalTriggerType = TriggerType.UNDEFINED,
matchPattern = "",
livefraction = 1.0,
reparse = False )
 Returns a list of the lowest-pt-threshold HLT chains that were always unprescaled in the given period.
    period: see TriggerEnums.TriggerPeriod for all possibilities, recommeded TriggerPeriod.y2018
    triggerType: see TriggerEnums.TriggerType for all possibilities, example TriggerType.el_single
    additionalTriggerType: can request additional types to match, use TriggerType.ALL to show combined triggers of any kind
                           accepts also a list as input in that case all types have to match
    matchPattern: provide additionally a regex-like expression to be applied
    livefraction: accept items that are not unprescaled but have a live fraction above this threshold, example 0.95
                  The live fraction is only an approximation, weighting the number of lumiblocks by prescale.

Definition at line 63 of file TriggerAPI.py.

63 def getLowestUnprescaled(cls, period, triggerType=TriggerType.ALL, additionalTriggerType=TriggerType.UNDEFINED, matchPattern="", livefraction=1.0, reparse=False):
64 ''' Returns a list of the lowest-pt-threshold HLT chains that were always unprescaled in the given period.
65 period: see TriggerEnums.TriggerPeriod for all possibilities, recommeded TriggerPeriod.y2018
66 triggerType: see TriggerEnums.TriggerType for all possibilities, example TriggerType.el_single
67 additionalTriggerType: can request additional types to match, use TriggerType.ALL to show combined triggers of any kind
68 accepts also a list as input in that case all types have to match
69 matchPattern: provide additionally a regex-like expression to be applied
70 livefraction: accept items that are not unprescaled but have a live fraction above this threshold, example 0.95
71 The live fraction is only an approximation, weighting the number of lumiblocks by prescale.
72 '''
73 cls._loadTriggerPeriod(period,reparse)
74 return cls.dbQueries[(period,cls.customGRL)]._getLowestUnprescaled(triggerType, additionalTriggerType, matchPattern, livefraction)
75

◆ getLowestUnprescaledAnyPeriod()

python.TriggerAPI.TriggerAPI.TriggerAPI.getLowestUnprescaledAnyPeriod ( cls,
period,
triggerType = TriggerType.ALL,
additionalTriggerType = TriggerType.UNDEFINED,
matchPattern = "",
livefraction = 1.0,
reparse = False )
 Returns a list of the lowest-pt-threshold HLT chains that were unprescaled in at least one of 
    the subperiods within the given period. The lowest granularity can be seen in TriggerEnums.TriggerPeriod
    See getLowestUnprescaled for a detailed description of the options

Definition at line 77 of file TriggerAPI.py.

77 def getLowestUnprescaledAnyPeriod(cls, period, triggerType=TriggerType.ALL, additionalTriggerType=TriggerType.UNDEFINED, matchPattern="", livefraction=1.0, reparse=False):
78 ''' Returns a list of the lowest-pt-threshold HLT chains that were unprescaled in at least one of
79 the subperiods within the given period. The lowest granularity can be seen in TriggerEnums.TriggerPeriod
80 See getLowestUnprescaled for a detailed description of the options
81 '''
82 lowset = set()
83 for i, ibin in enumerate(reversed(bin(period)[2:])): #to binary
84 ibin = int(ibin)
85 if not ibin: continue
86 subperiod = 2**i
87 cls._loadTriggerPeriod(subperiod, reparse)
88 subperiodset = set( cls.dbQueries[(subperiod,cls.customGRL)]._getLowestUnprescaled(triggerType, additionalTriggerType, matchPattern, livefraction) )
89 lowset |= subperiodset
90 return list(lowset)
91
STL class.

◆ getUnprescaled()

python.TriggerAPI.TriggerAPI.TriggerAPI.getUnprescaled ( cls,
period,
triggerType = TriggerType.ALL,
additionalTriggerType = TriggerType.UNDEFINED,
matchPattern = "",
livefraction = 1.0,
reparse = False )
 Returns a list of always-unprescaled HLT chains, including backup items with higher thresholds.
    See getLowestUnprescaled for a detailed description of the options

Definition at line 93 of file TriggerAPI.py.

93 def getUnprescaled(cls, period, triggerType=TriggerType.ALL, additionalTriggerType=TriggerType.UNDEFINED, matchPattern="", livefraction=1.0, reparse=False):
94 ''' Returns a list of always-unprescaled HLT chains, including backup items with higher thresholds.
95 See getLowestUnprescaled for a detailed description of the options
96 '''
97 return cls.dbQueries[(period,cls.customGRL)]._getUnprescaled(triggerType, additionalTriggerType, matchPattern, livefraction)
98

◆ getUnprescaledAnyPeriod()

python.TriggerAPI.TriggerAPI.TriggerAPI.getUnprescaledAnyPeriod ( cls,
period,
triggerType = TriggerType.ALL,
additionalTriggerType = TriggerType.UNDEFINED,
matchPattern = "",
livefraction = 1.0,
reparse = False )
 Returns a list of HLT chains that were unprescaled in at least one of 
    the subperiods within the given period. The lowest granularity can be seen in TriggerEnums.TriggerPeriod
    See getLowestUnprescaled for a detailed description of the options

Definition at line 100 of file TriggerAPI.py.

100 def getUnprescaledAnyPeriod(cls, period, triggerType=TriggerType.ALL, additionalTriggerType=TriggerType.UNDEFINED, matchPattern="", livefraction=1.0, reparse=False):
101 ''' Returns a list of HLT chains that were unprescaled in at least one of
102 the subperiods within the given period. The lowest granularity can be seen in TriggerEnums.TriggerPeriod
103 See getLowestUnprescaled for a detailed description of the options
104 '''
105 lowset = set()
106 for i, ibin in enumerate(reversed(bin(period)[2:])): #to binary
107 ibin = int(ibin)
108 if not ibin: continue
109 subperiod = 2**i
110 cls._loadTriggerPeriod(subperiod, reparse)
111 subperiodset = set( cls.dbQueries[(subperiod,cls.customGRL)]._getUnprescaled(triggerType, additionalTriggerType, matchPattern, livefraction) )
112 lowset |= subperiodset
113 return list(lowset)
114

◆ init()

python.TriggerAPI.TriggerAPI.TriggerAPI.init ( cls)

Definition at line 30 of file TriggerAPI.py.

30 def init(cls):
31 if cls.cacheread: return
32 cls.cacheread = True
33 cls.dbQueries = SerializeAPI.load()
34 todel = [(p,grl) for p,grl in cls.dbQueries if p & TriggerPeriod.future]
35 for key in todel:
36 del cls.dbQueries[key]
37

◆ reset()

python.TriggerAPI.TriggerAPI.TriggerAPI.reset ( cls)

Definition at line 22 of file TriggerAPI.py.

22 def reset(cls):
23 cls.dbQueries = {}
24 cls.customGRL = None
25 cls.flags = None
26 cls.release = None
27 cls.cacheread = False
28

◆ setConfigFlags()

python.TriggerAPI.TriggerAPI.TriggerAPI.setConfigFlags ( cls,
flags )
Set ConfigFlags (only required for "future" periods)

Definition at line 39 of file TriggerAPI.py.

39 def setConfigFlags(cls, flags):
40 """Set ConfigFlags (only required for "future" periods)"""
41 cls.flags = flags
42

◆ setCustomGRL()

python.TriggerAPI.TriggerAPI.TriggerAPI.setCustomGRL ( cls,
grl )

Definition at line 54 of file TriggerAPI.py.

54 def setCustomGRL(cls, grl):
55 if TriggerInfo.testCustomGRL(grl):
56 cls.customGRL = grl
57 else:
58 cls.log.warning("Couldn't set GRL: "+grl)
59 cls.log.warning("Will use default GRL")
60 cls.customGRL = None
61

◆ setRelease()

python.TriggerAPI.TriggerAPI.TriggerAPI.setRelease ( cls,
release )

Definition at line 44 of file TriggerAPI.py.

44 def setRelease(cls, release):
45 import re
46 if release and re.match(r'21\.1(\.[0-9]+)+$',release):
47 cls.release = release
48 elif release=="current": #Don't allow the release to be automatically overwritten
49 cls.release = release
50 else:
51 cls.log.warning("Release doesn't seem to be a well-formed 21.1 release, ignoring: "+release)
52

Member Data Documentation

◆ cacheread

bool python.TriggerAPI.TriggerAPI.TriggerAPI.cacheread = False
static

Definition at line 19 of file TriggerAPI.py.

◆ customGRL

python.TriggerAPI.TriggerAPI.TriggerAPI.customGRL = None
static

Definition at line 16 of file TriggerAPI.py.

◆ dbQueries

python.TriggerAPI.TriggerAPI.TriggerAPI.dbQueries = {}
static

Definition at line 15 of file TriggerAPI.py.

◆ flags

python.TriggerAPI.TriggerAPI.TriggerAPI.flags = None
static

Definition at line 17 of file TriggerAPI.py.

◆ log

python.TriggerAPI.TriggerAPI.TriggerAPI.log = logging.getLogger(__name__)
static

Definition at line 14 of file TriggerAPI.py.

◆ release

python.TriggerAPI.TriggerAPI.TriggerAPI.release = None
static

Definition at line 18 of file TriggerAPI.py.


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