|
| def | GetConnection (dbconn, verbosity=0) |
| |
| dict[str, Any]|None | getMenuConfigKey (int run, db=None) |
| |
| def | getHLTConfigKeys (db, runlist) |
| |
| def | getHLTPrescaleKeys (db, runlist) |
| |
| int|None | getHLTPrescaleKey (int run, int lb, db=None) |
| |
| def | getL1ConfigKeys (db, runlist) |
| |
| int|None | getL1PrescaleKey (int run, int lb, db=None) |
| |
| dict[int, Any] | getBunchGroupKey (db, runlist) |
| |
| int|None | getBunchGroupKeyForRunLB (int run, int lb, db=None) |
| |
| def | getDBConnectionForRun (int runNumber) |
| |
| dict[str, Any] | getTrigConfKeys (int runNumber, int lumiBlock) |
| |
| def | getRunStartTime (db, runlist, runs) |
| |
| def | printL1Menu (db, run, verbosity) |
| |
| def | printHLTMenu (db, run, verbosity, printL2=True, printEF=True) |
| |
| def | printStreams (db, run, verbosity) |
| |
|
| def | _getKeys (db, runlist, folder, in_name, out_name) |
| |
Definition at line 33 of file TriggerCoolUtil.py.
◆ _getKeys()
| def python.TriggerCoolUtil.TriggerCoolUtil._getKeys |
( |
|
db, |
|
|
|
runlist, |
|
|
|
folder, |
|
|
|
in_name, |
|
|
|
out_name |
|
) |
| |
|
staticprivate |
Helper to retrieve run/LB-index configuration keys
returns empty dict if not iov is found
Definition at line 94 of file TriggerCoolUtil.py.
94 def _getKeys(db, runlist, folder, in_name, out_name):
95 """Helper to retrieve run/LB-index configuration keys
96 returns empty dict if not iov is found
100 f = db.getFolder( folder )
102 objs = f.browseObjects( limmin, limmax, cool.ChannelSelection(0))
103 while objs.goToNext():
104 obj=objs.currentRef()
105 runNr = obj.since()>>32
106 if runNr>1e9:
continue
107 payload = obj.payload()
108 key = payload[in_name]
109 firstLB = obj.since() & lbmask
110 until = (obj.until() & lbmask)
111 lastLB = until-1
if until>0
else lbmask
112 configKeys.setdefault(runNr,{}).setdefault( out_name, [] ).
append((key,firstLB,lastLB))
◆ getBunchGroupKey()
| dict[int, Any] python.TriggerCoolUtil.TriggerCoolUtil.getBunchGroupKey |
( |
|
db, |
|
|
|
runlist |
|
) |
| |
|
static |
Definition at line 151 of file TriggerCoolUtil.py.
151 def getBunchGroupKey(db,runlist) -> dict[int, Any]:
152 return TriggerCoolUtil._getKeys(db, runlist,
"/TRIGGER/LVL1/BunchGroupKey",
153 "Lvl1BunchGroupConfigurationKey",
"BGKey")
◆ getBunchGroupKeyForRunLB()
| int | None python.TriggerCoolUtil.TriggerCoolUtil.getBunchGroupKeyForRunLB |
( |
int |
run, |
|
|
int |
lb, |
|
|
|
db = None |
|
) |
| |
|
static |
Definition at line 156 of file TriggerCoolUtil.py.
156 def getBunchGroupKeyForRunLB(run: int, lb: int, db =
None) -> int |
None:
158 db = TriggerCoolUtil.getDBConnectionForRun(run)
159 bunches = TriggerCoolUtil.getBunchGroupKey(db, [(run, run)])
160 if(run
not in bunches):
162 for (bgsk, firstlb, lastlb)
in bunches[run][
'BGKey']:
163 if firstlb<=lb
and lb<=lastlb:
◆ GetConnection()
| def python.TriggerCoolUtil.TriggerCoolUtil.GetConnection |
( |
|
dbconn, |
|
|
|
verbosity = 0 |
|
) |
| |
|
static |
Definition at line 36 of file TriggerCoolUtil.py.
36 def GetConnection(dbconn, verbosity=0):
38 m =
match(
r".*?([^/.]+)\.db",dbconn)
39 if dbconn
in [
"CONDBR2",
"COMP200",
"OFLP200"]:
40 connection = f
'COOLONL_TRIGGER/{dbconn}'
42 dbname=m.group(1).
upper()
43 connection =
"sqlite://;schema=%s;dbname=%s;" % (dbconn,dbname)
45 raise RuntimeError (
"Can't connect to COOL db %s" % dbconn)
47 openConn =
indirectOpen(connection,readOnly=
True,debug=(verbosity>0))
◆ getDBConnectionForRun()
| def python.TriggerCoolUtil.TriggerCoolUtil.getDBConnectionForRun |
( |
int |
runNumber | ) |
|
|
static |
Definition at line 168 of file TriggerCoolUtil.py.
168 def getDBConnectionForRun(runNumber: int):
169 return TriggerCoolUtil.GetConnection(
'CONDBR2' if runNumber > 230000
else 'COMP200')
◆ getHLTConfigKeys()
| def python.TriggerCoolUtil.TriggerCoolUtil.getHLTConfigKeys |
( |
|
db, |
|
|
|
runlist |
|
) |
| |
|
static |
Definition at line 63 of file TriggerCoolUtil.py.
65 f = db.getFolder(
"/TRIGGER/HLT/HltConfigKeys" )
67 objs = f.browseObjects( limmin, limmax, cool.ChannelSelection(0))
68 while objs.goToNext():
70 runNr = obj.since()>>32
71 if runNr>1e9:
continue
73 smk = payload[
'MasterConfigurationKey']
74 hltpsk = payload[
'HltPrescaleConfigurationKey']
80 confsrc = payload[
'ConfigSource'].
split(
';')
81 if len(confsrc)>2: release = confsrc[2].
split()[0]
83 confsrc = payload[
'ConfigSource'].
split(
',', maxsplit=1)
84 if len(confsrc)>1: release = confsrc[1]
87 configKeys[runNr] = {
"REL" : release,
◆ getHLTPrescaleKey()
| int | None python.TriggerCoolUtil.TriggerCoolUtil.getHLTPrescaleKey |
( |
int |
run, |
|
|
int |
lb, |
|
|
|
db = None |
|
) |
| |
|
static |
Definition at line 122 of file TriggerCoolUtil.py.
122 def getHLTPrescaleKey(run: int, lb: int, db =
None) -> int |
None:
124 db = TriggerCoolUtil.getDBConnectionForRun(run)
125 prescales = TriggerCoolUtil.getHLTPrescaleKeys(db, [(run, run)])
126 if(run
not in prescales):
128 for (hltpsk, firstlb, lastlb)
in prescales[run][
'HLTPSK2']:
129 if firstlb<=lb
and lb<=lastlb:
◆ getHLTPrescaleKeys()
| def python.TriggerCoolUtil.TriggerCoolUtil.getHLTPrescaleKeys |
( |
|
db, |
|
|
|
runlist |
|
) |
| |
|
static |
Definition at line 117 of file TriggerCoolUtil.py.
117 def getHLTPrescaleKeys(db,runlist):
118 return TriggerCoolUtil._getKeys(db, runlist,
"/TRIGGER/HLT/PrescaleKey",
119 "HltPrescaleKey",
"HLTPSK2")
◆ getL1ConfigKeys()
| def python.TriggerCoolUtil.TriggerCoolUtil.getL1ConfigKeys |
( |
|
db, |
|
|
|
runlist |
|
) |
| |
|
static |
Definition at line 134 of file TriggerCoolUtil.py.
134 def getL1ConfigKeys(db,runlist):
135 return TriggerCoolUtil._getKeys(db, runlist,
"/TRIGGER/LVL1/Lvl1ConfigKey",
136 "Lvl1PrescaleConfigurationKey",
"LVL1PSK")
◆ getL1PrescaleKey()
| int | None python.TriggerCoolUtil.TriggerCoolUtil.getL1PrescaleKey |
( |
int |
run, |
|
|
int |
lb, |
|
|
|
db = None |
|
) |
| |
|
static |
Definition at line 139 of file TriggerCoolUtil.py.
139 def getL1PrescaleKey(run: int, lb: int, db =
None) -> int |
None:
141 db = TriggerCoolUtil.getDBConnectionForRun(run)
142 prescales = TriggerCoolUtil.getL1ConfigKeys(db, [(run, run)])
143 if(run
not in prescales):
145 for (l1psk, firstlb, lastlb)
in prescales[run][
'LVL1PSK']:
146 if firstlb<=lb
and lb<=lastlb:
◆ getMenuConfigKey()
| dict[str, Any] | None python.TriggerCoolUtil.TriggerCoolUtil.getMenuConfigKey |
( |
int |
run, |
|
|
|
db = None |
|
) |
| |
|
static |
Definition at line 56 of file TriggerCoolUtil.py.
56 def getMenuConfigKey(run: int, db =
None) -> dict[str, Any] |
None:
58 db = TriggerCoolUtil.getDBConnectionForRun(run)
59 configs = TriggerCoolUtil.getHLTConfigKeys(db, [(run, run)])
60 return configs.get(run,
None)
◆ getRunStartTime()
| def python.TriggerCoolUtil.TriggerCoolUtil.getRunStartTime |
( |
|
db, |
|
|
|
runlist, |
|
|
|
runs |
|
) |
| |
|
static |
Definition at line 187 of file TriggerCoolUtil.py.
187 def getRunStartTime(db,runlist, runs):
190 f = db.getFolder(
"/TRIGGER/LUMI/LBLB" )
192 limmin=(rr[0] << 32)+0
193 limmax=((rr[1]+1) << 32)+0
194 objs = f.browseObjects( limmin, limmax, cool.ChannelSelection(0) )
195 while objs.goToNext():
196 obj=objs.currentRef()
197 runNr = obj.since()>>32
198 if runNr==latestRunNr:
continue
200 if runNr
not in runs:
continue
201 payload=obj.payload()
202 starttime = payload[
'StartTime']
203 startTime[runNr] = {
"STARTTIME" : ctime(starttime/1E9).
replace(
' ',
'_') }
◆ getTrigConfKeys()
| dict[str, Any] python.TriggerCoolUtil.TriggerCoolUtil.getTrigConfKeys |
( |
int |
runNumber, |
|
|
int |
lumiBlock |
|
) |
| |
|
static |
Definition at line 172 of file TriggerCoolUtil.py.
172 def getTrigConfKeys(runNumber: int, lumiBlock: int) -> dict[str, Any]:
173 db = TriggerCoolUtil.getDBConnectionForRun(runNumber)
174 bgkey = TriggerCoolUtil.getBunchGroupKeyForRunLB(runNumber, lumiBlock, db)
175 l1pskey = TriggerCoolUtil.getL1PrescaleKey(runNumber, lumiBlock, db)
176 hltpskey = TriggerCoolUtil.getHLTPrescaleKey(runNumber, lumiBlock, db)
177 menucfg = TriggerCoolUtil.getMenuConfigKey(runNumber, db)
179 "SMK": menucfg[
'SMK']
if menucfg
else None,
180 "DB": menucfg[
'DB']
if menucfg
else None,
◆ printHLTMenu()
| def python.TriggerCoolUtil.TriggerCoolUtil.printHLTMenu |
( |
|
db, |
|
|
|
run, |
|
|
|
verbosity, |
|
|
|
printL2 = True, |
|
|
|
printEF = True |
|
) |
| |
|
static |
Definition at line 251 of file TriggerCoolUtil.py.
251 def printHLTMenu(db, run, verbosity, printL2=True, printEF=True):
253 limmax=((run+1)<<32)-1
255 f = db.getFolder(
"/TRIGGER/HLT/Menu" )
256 chansel=cool.ChannelSelection.all()
257 objs = f.browseObjects( limmin,limmax,chansel)
265 while objs.goToNext():
266 obj=objs.currentRef()
267 payload=obj.payload()
268 level = payload[
'TriggerLevel']
269 if level==
'L2' and not printL2:
continue
270 if level==
'EF' and not printEF:
continue
271 name = payload[
'ChainName']
272 sizeName=
max(sizeName,len(name))
273 counter = payload[
'ChainCounter']
274 chainNames[(level,counter)] = name
276 version = payload[
'ChainVersion']
277 prescale = payload[
'Prescale']
278 passthr = payload[
'PassThrough']
279 stream = payload[
'StreamInfo']
280 lower = payload[
'LowerChainName']
281 sizePS=
max(sizePS,prescale)
282 sizePT=
max(sizePT,passthr)
283 sizeStr=
max(sizeStr,len(stream))
284 sizeLow=
max(sizeLow,len(lower))
285 chainExtraInfo[(name,level)] = (version, prescale, passthr, stream, lower)
286 sizePS = len(
"%i"%sizePS)
287 sizePT = len(
"%i"%sizePT)
288 for c
in sorted(chainNames):
290 print (
"%s %4i: %-*s" % (c[0], c[1], sizeName, name),)
292 (version, prescale, passthr, stream, lower) = chainExtraInfo[(name,c[0])]
293 print (
"[V %1s, PS %*i, PT %*i, by %-*s , => %-*s ]" %
294 (version, sizePS, prescale, sizePT, passthr, sizeLow, lower, sizeStr, stream), end=
'')
◆ printL1Menu()
| def python.TriggerCoolUtil.TriggerCoolUtil.printL1Menu |
( |
|
db, |
|
|
|
run, |
|
|
|
verbosity |
|
) |
| |
|
static |
Definition at line 208 of file TriggerCoolUtil.py.
208 def printL1Menu(db, run, verbosity):
212 printPrescales = verbosity>0
213 printDisabled = verbosity>1
215 f = db.getFolder(
"/TRIGGER/LVL1/Menu" )
216 chansel=cool.ChannelSelection.all()
217 objs = f.browseObjects( limmin,limmax,chansel)
218 fps = db.getFolder(
"/TRIGGER/LVL1/Prescales" )
219 objsps = fps.browseObjects( limmin,limmax,chansel)
223 while objs.goToNext():
224 obj=objs.currentRef()
225 channel = obj.channelId()
226 payload=obj.payload()
227 itemname = payload[
'ItemName']
228 itemName[channel] = itemname
229 longestName=
max(longestName,len(itemname))
230 while objsps.goToNext():
231 objps=objsps.currentRef()
232 channel = objps.channelId()
233 payloadps=objps.payload()
234 ps = payloadps[
'Lvl1Prescale']
235 if channel
in itemPrescale:
236 itemPrescale[channel] += [ ps ]
238 itemPrescale[channel] = [ ps ]
239 for channel
in itemName:
241 for x
in itemPrescale[channel]:
242 if x>0
or printDisabled: doPrint =
True
243 if not doPrint:
continue
245 print (
"%4i: %-*s PS " % (channel, longestName, itemName[channel]), itemPrescale[channel])
247 print (
"%4i: %s" % (channel, itemName[channel]))
◆ printStreams()
| def python.TriggerCoolUtil.TriggerCoolUtil.printStreams |
( |
|
db, |
|
|
|
run, |
|
|
|
verbosity |
|
) |
| |
|
static |
Definition at line 298 of file TriggerCoolUtil.py.
298 def printStreams(db, run, verbosity):
300 limmax=((run+1)<<32)-1
301 print (
"Used Streams:")
302 f = db.getFolder(
"/TRIGGER/HLT/Menu" )
303 chansel=cool.ChannelSelection.all()
304 objs = f.browseObjects( limmin,limmax,chansel)
306 while objs.goToNext():
307 obj=objs.currentRef()
308 payload=obj.payload()
309 streamsOfChain = payload[
'StreamInfo']
310 for streamprescale
in streamsOfChain.split(
';'):
311 streamname = streamprescale.split(
',')[0]
312 streams.add(streamname)
The documentation for this class was generated from the following file:
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.