9 |
|
|
10 |
|
def MoreTableInfo(parser,LumiRange,config,isCol=True): |
11 |
|
print "Monitoring Run %d" % (parser.RunNumber,) |
12 |
< |
[AvInstLumi, AvLiveLumi, AvDeliveredLumi, AvDeadTime,PSCols] = parser.GetAvLumiInfo(LumiRange) |
13 |
< |
deadtimebeamactive=parser.GetDeadTimeBeamActive(LumiRange) |
12 |
> |
print "len=",len(LumiRange) |
13 |
> |
print "LSRange=", LumiRange |
14 |
> |
if len(LumiRange)>0: |
15 |
> |
|
16 |
> |
[AvInstLumi, AvLiveLumi, AvDeliveredLumi, AvDeadTime,PSCols] = parser.GetAvLumiInfo(LumiRange) |
17 |
> |
deadtimebeamactive=parser.GetDeadTimeBeamActive(LumiRange)*100 |
18 |
> |
##print "dtba=",deadtimebeamactive |
19 |
> |
else: |
20 |
> |
print "no lumisections to monitor" |
21 |
> |
return |
22 |
|
try: |
23 |
|
LastPSCol = PSCols[-1] |
24 |
|
except: |
26 |
|
if isCol: |
27 |
|
|
28 |
|
aRates = parser.GetTriggerRatesByLS("AOutput") |
29 |
+ |
bRates = parser.GetTriggerRatesByLS("BOutput") |
30 |
+ |
if len(bRates) == 0: |
31 |
+ |
realARates = aRates |
32 |
+ |
else: |
33 |
+ |
realARates={} |
34 |
+ |
for k,v in bRates.iteritems(): |
35 |
+ |
realARates[k]=aRates[k]-bRates[k]*20 |
36 |
+ |
#realARates = aRates - bRates*20; |
37 |
|
else: |
38 |
|
if len(parser.GetTriggerRatesByLS("AOutput"))>0: |
39 |
|
aRates = parser.GetTriggerRatesByLS("AOutput") |
40 |
+ |
bRates = parser.GetTriggerRatesByLS("BOutput") |
41 |
|
else: |
42 |
|
aRates = parser.GetTriggerRatesByLS("AForPPOutput") |
43 |
+ |
bRates = parser.GetTriggerRatesByLS("BForPPOutput") |
44 |
|
|
45 |
|
|
46 |
|
expressRates = {} |
59 |
|
PeakRateA=0 |
60 |
|
AvgRateA=0 |
61 |
|
|
62 |
+ |
realARate=0 |
63 |
+ |
realPeakRateA=0 |
64 |
+ |
realAvgRateA=0 |
65 |
+ |
|
66 |
|
if len(expressRates.values()) > 20: |
67 |
|
AvgExpRate = sum(expressRates.values())/len(expressRates.values()) |
68 |
|
|
76 |
|
ARate+=thisRateA |
77 |
|
if thisRateA>PeakRateA: |
78 |
|
PeakRateA=thisRateA |
79 |
< |
|
79 |
> |
|
80 |
> |
thisRealRateA = aRates.get(ls,0) - bRates.get(ls,0)*20 |
81 |
> |
realARate+=thisRealRateA |
82 |
> |
if thisRealRateA > realPeakRateA: |
83 |
> |
realReakRateA = thisRealRateA |
84 |
|
#ARate+=aRates.get(ls,0) |
85 |
|
## Print Stream A Rate --moved see below |
86 |
|
##print "Current Steam A Rate is: %0.1f Hz" % (ARate/len(LumiRange),) |
88 |
|
Warn = False |
89 |
|
|
90 |
|
########################################## |
91 |
< |
## Check if the express stream is too high |
91 |
> |
## Check if the express stream is too high or low |
92 |
|
########################################## |
93 |
|
global NHighExpress |
94 |
< |
badExpress = ExpRate/len(LumiRange) > config.MaxExpressRate ## avg express stream rate too high? |
94 |
> |
badExpress = ((ExpRate/len(LumiRange) > config.MaxExpressRate) or ExpRate/len(LumiRange)<0.1) ## avg express stream rate too high? |
95 |
|
baseText = "\nCurrent Express Stream rate is: %0.1f Hz" % (ExpRate/len(LumiRange),) ## text to display |
96 |
|
if badExpress: |
97 |
|
text = colored(baseText,'red',attrs=['reverse']) ## bad, make the text white on red |
102 |
|
|
103 |
|
write(text) |
104 |
|
if badExpress: |
105 |
< |
if (ExpRate-PeakRate)/(len(LumiRange)-1) <=config.MaxExpressRate: ## one lumisection causes this |
106 |
< |
write(" << This appears to be due to a 1 lumisection spike, please monitor\n") |
107 |
< |
else: |
108 |
< |
if NHighExpress > 1: # big problem, call HLT DOC |
109 |
< |
write(colored(" << WARNING: Current Express rate is too high!",'red',attrs=['reverse']) ) |
110 |
< |
Warn = True |
105 |
> |
if len(LumiRange)>1: |
106 |
> |
if (ExpRate-PeakRate)/(len(LumiRange)-1) <=config.MaxExpressRate: ## one lumisection causes this |
107 |
> |
write(" << This appears to be due to a 1 lumisection spike, please monitor\n") |
108 |
> |
else: |
109 |
> |
if NHighExpress > 1: # big problem, call HLT DOC |
110 |
> |
write(colored(" << WARNING: Current Express rate is too high!",'red',attrs=['reverse']) ) |
111 |
> |
Warn = True |
112 |
|
|
113 |
|
# if AvgExpRate > config.MaxExpressRate: |
114 |
|
# write( colored("\n\nWARNING: Average Express Stream Rate is too high (%0.1f Hz) << CALL HLT DOC" % AvgExpRate,'red',attrs=['reverse']) ) |
115 |
|
# Warn = True |
116 |
< |
|
116 |
> |
|
117 |
> |
|
118 |
|
|
119 |
|
|
120 |
|
######################################### |
121 |
|
##Check if Stream A is too high |
122 |
|
######################################### |
123 |
|
global NHighStreamA |
124 |
< |
badStreamA =ARate/len(LumiRange) > config.MaxStreamARate ##Cosmics Express Rate 300 Hz max |
124 |
> |
badStreamA =realARate/len(LumiRange) > config.MaxStreamARate ##Cosmics Express Rate 300 Hz max |
125 |
|
baseTextA= "\nCurrent Steam A Rate is: %0.1f Hz" % (ARate/len(LumiRange),) |
126 |
+ |
baseTextRealA= "\nCurrent PROMPT Steam A Rate is: %0.1f Hz" % (realARate/len(LumiRange),) |
127 |
|
if badStreamA: |
128 |
|
textA=colored(baseTextA,'red',attrs=['reverse']) ## bad, make the text white on red |
129 |
+ |
textRealA=colored(baseTextRealA,'red',attrs=['reverse']) ## bad, make the text white on red |
130 |
|
NHighStreamA+=1 |
131 |
|
else: |
132 |
|
textA=baseTextA |
133 |
+ |
textRealA=baseTextRealA |
134 |
|
NHighStreamA=0 |
135 |
|
|
136 |
|
write(textA) |
137 |
+ |
write(textRealA) |
138 |
|
if badStreamA: |
139 |
< |
if (ARate-PeakRateA)/(len(LumiRange)-1) <=config.MaxStreamARate: ## one lumisection causes this |
140 |
< |
write(" << This appears to be due to a 1 lumisection spike, please monitor\n") |
141 |
< |
else: |
142 |
< |
if NHighStreamA >1: ##Call HLT doc! |
143 |
< |
write(colored(" << WARNING: Current Stream A rate is too high!",'red',attrs=['reverse']) ) |
144 |
< |
Warn = True |
139 |
> |
if len(LumiRange)>1: |
140 |
> |
if (realARate-realPeakRateA)/(len(LumiRange)-1) <=config.MaxStreamARate: ## one lumisection causes this |
141 |
> |
write(" << This appears to be due to a 1 lumisection spike, please monitor\n") |
142 |
> |
else: |
143 |
> |
if NHighStreamA >1: ##Call HLT doc! |
144 |
> |
write(colored(" << WARNING: Current Stream A rate is too high!",'red',attrs=['reverse']) ) |
145 |
> |
Warn = True |
146 |
|
write("\n\n") |
147 |
|
|
148 |
|
###################################### |
179 |
|
write(bcolors.OKBLUE) |
180 |
|
write(str(round(deadtimebeamactive,2))+"%") |
181 |
|
write(bcolors.ENDC+"\n") |
182 |
< |
|
183 |
< |
print "Used prescale column(s): "+str(PrescaleColumnString) |
184 |
< |
write("Lumisections: ") |
182 |
> |
write("Used prescale column(s): %s " % (str(PrescaleColumnString),) ) |
183 |
> |
if LastPSCol in config.ForbiddenCols and isCol: |
184 |
> |
write( colored("<< Using column %d! Please check in the documentation that this is the correct column" % (LastPSCol),'red',attrs=['reverse']) ) |
185 |
> |
write("\nLumisections: ") |
186 |
|
if not isSequential(LumiRange): |
187 |
|
write(str(LumiRange)+" Lumisections are not sequential (bad LS skipped)\n") |
188 |
|
else: |
189 |
|
write("%d - %d\n" % (min(LumiRange),max(LumiRange),)) |
190 |
< |
print "\nLast Lumisection of the run is: "+str(parser.GetLastLS()) |
191 |
< |
write( "Last Lumisection good where DAQ is active is: "+str(parser.GetLastLS(isCol)) ) |
190 |
> |
##print "\nLast Lumisection of the run is: "+str(parser.GetLastLS()) |
191 |
> |
write( "\nLast Lumisection good where DAQ is active is: "+str(parser.GetLastLS(isCol)) ) |
192 |
|
##write( "Last Lumisection where DAQ is active is: "+str(parser.GetLastLS(True)) ) |
193 |
|
write("\n\n\n") |
194 |
|
|
195 |
< |
if isCol: |
196 |
< |
L1RatePredictions = config.GetExpectedL1Rates(AvInstLumi) |
197 |
< |
if len(L1RatePredictions): |
198 |
< |
print "Expected Level 1 Rates:" |
199 |
< |
for key,val in L1RatePredictions.iteritems(): |
200 |
< |
write("Prescale Column "+str(key)+": "+str(round(val/1000,1))+" kHz") |
201 |
< |
if key == LastPSCol: |
202 |
< |
write(' << taking data in this column') |
203 |
< |
write('\n') |
195 |
> |
## if isCol: |
196 |
> |
## L1RatePredictions = config.GetExpectedL1Rates(AvInstLumi) |
197 |
> |
## if len(L1RatePredictions): |
198 |
> |
## print "Expected Level 1 Rates:" |
199 |
> |
## for key,val in L1RatePredictions.iteritems(): |
200 |
> |
## write("Prescale Column "+str(key)+": "+str(round(val/1000,1))+" kHz") |
201 |
> |
## if key == LastPSCol: |
202 |
> |
## write(' << taking data in this column') |
203 |
> |
## write('\n') |
204 |
|
|
205 |
|
|
206 |
|
|