3 from TrigConfStorage.TriggerCoolUtil
import TriggerCoolUtil
4 from PyCool
import cool
21 if opt.l1
and not opt.menu:
22 print (
"Option l1 requires option 'menu' to be set")
25 if opt.l2
and not opt.menu:
26 print (
"Option l2 requires option 'menu' to be set")
29 if opt.ef
and not opt.menu:
30 print (
"Option ef requires option 'menu' to be set")
33 if opt.processing
and opt.processing!=
'hlt':
34 print (
"Option p|processing must be set to 'hlt'")
37 if opt.menu
and not (opt.l1
or opt.l2
or opt.ef):
38 opt.l1 = opt.l2 = opt.ef =
True
45 for rr
in listOfRanges:
47 newRR.append(copy.deepcopy(rr))
49 if rr[0]-1<=newRR[-1][1]:
50 newRR[-1][1] =
max(rr[1],newRR[-1][1])
52 newRR.append(copy.deepcopy(rr))
58 runRanges = runRange.split(
',')
60 startend = rr.split(
'-')
61 if len(startend)==1: startend += [startend[0]]
62 firstlast = [0, (cool.ValidityKeyMax>>32)-1]
63 if startend[0]: firstlast[0] =
int(startend[0])
64 if startend[1]: firstlast[1] =
int(startend[1])
66 listOfRanges += [firstlast]
73 self.
dbconn = TriggerCoolUtil.GetConnection(self.
opt.db,self.
opt.verbosity)
77 hltkeys = TriggerCoolUtil.getHLTConfigKeys(self.
dbconn, self.
runlist)
78 hltpskeys = TriggerCoolUtil.getHLTPrescaleKeys(self.
dbconn, self.
runlist)
79 l1keys = TriggerCoolUtil.getL1ConfigKeys(self.
dbconn, self.
runlist)
85 runStartTimes = TriggerCoolUtil.getRunStartTime(self.
dbconn, self.
runlist, runs)
87 allkeys = dict([(r,{})
for r
in runs])
89 if r
in hltkeys: allkeys[r].
update(hltkeys[r])
90 if r
in hltpskeys: allkeys[r].
update(hltpskeys[r])
91 if r
in l1keys: allkeys[r].
update(l1keys[r])
92 if runStartTimes
and r
in runStartTimes: allkeys[r].
update(runStartTimes[r])
94 return (runs, allkeys)
103 print (
'c'.
join([
"%su%s" % (x[1],x[0])
for x
in keys[
"HLTPSK2"]]))
114 try: timestr =
"(%s) " % keys[
"STARTTIME"]
115 except KeyError: timestr =
"(--------unknown---------) "
119 hltpsk =
"%4i (1-)" % keys[
"HLTPSK"]
128 if "HLTPSK2" in keys:
129 for x
in keys[
"HLTPSK2"]:
130 if x[2]<0: hltpsknew +=
"%4i (%i-)" % (x[0],x[1])
131 elif x[2]==x[1]: hltpsknew +=
"%4i (%i) " % (x[0],x[1])
132 else: hltpsknew +=
"%4i (%i-%i) " % (x[0],x[1],x[2])
133 if not hltpsknew: hltpsknew =
"unknown"
136 if "LVL1PSK" in keys:
137 for x
in keys[
"LVL1PSK"]:
138 if x[2]<0: lvl1psk +=
"%4i (%i-)" % (x[0],x[1])
139 elif x[2]==x[1]: lvl1psk +=
"%4i (%i) " % (x[0],x[1])
140 else: lvl1psk +=
"%4i (%i-%i) " % (x[0],x[1],x[2])
141 if not lvl1psk: lvl1psk =
"unknown"
143 print (
"run %6i %srelease %9s smk %4s hltps %s lvl1ps %s" % (r, timestr, rel, smk, hltpsknew, lvl1psk),)
145 if r > 127453
and "HLTPSK2" in keys
and "HLTPSK" in keys
and keys[
"HLTPSK"] != keys[
"HLTPSK2"][0][0]:
146 msg =
"WARNING: Menu folder shows different HLT prescale for SOR: %i" % keys[
"HLTPSK"]
151 if not self.
opt.menu:
return
153 TriggerCoolUtil.printL1Menu(self.
dbconn, run, self.
opt.verbosity)
154 if self.
opt.l2
or self.
opt.ef:
155 TriggerCoolUtil.printHLTMenu(self.
dbconn, run, self.
opt.verbosity, printL2=self.
opt.l2, printEF=self.
opt.ef)
158 if not self.
opt.streams:
return
159 TriggerCoolUtil.printStreams(self.
dbconn,run,self.
opt.verbosity)
164 if self.
opt.processing==
'hlt':
170 self.
opt.isSingleRun = len(runs)==1
172 if self.
opt.menu
and not self.
opt.isSingleRun:
173 print (
"Error: option 'menu' works only for single run")
176 if self.
opt.streams
and not self.
opt.isSingleRun:
177 print (
"Error: option 'streams' works only for single run")
180 if self.
opt.isSingleRun: