3 |
|
from DatabaseParser import * |
4 |
|
write = sys.stdout.write |
5 |
|
|
6 |
< |
def MoreTableInfo(parser,LumiRange): |
6 |
> |
def MoreTableInfo(parser,LumiRange,config): |
7 |
> |
<<<<<<< AddTableInfo_db.py |
8 |
|
[AvInstLumi, AvLiveLumi, AvDeliveredLumi, AvDeadTime,PSCols] = parser.GetAvLumiInfo(LumiRange) |
9 |
+ |
LastPSCol = PSCols[-1] |
10 |
+ |
======= |
11 |
+ |
[AvInstLumi, AvLiveLumi, AvDeliveredLumi, AvDeadTime,PSCols,LastPSCol] = parser.GetAvLumiInfo(LumiRange) |
12 |
+ |
##[AvInstLumi, AvLiveLumi, AvDeliveredLumi, AvDeadTime,PSCols] = parser.GetAvLumiInfo(LumiRange) |
13 |
|
|
14 |
+ |
>>>>>>> 1.9 |
15 |
|
if AvDeadTime==0: ## For some reason the dead time in the DB is occasionally broken |
16 |
|
try: |
17 |
|
AvDeadTime = AvLiveLumi/AvDeliveredLumi * 100 |
18 |
|
except: |
19 |
|
AvDeadTime = 100 |
20 |
|
PrescaleColumnString='' |
21 |
+ |
PSCols = list(set(PSCols)) |
22 |
|
for c in PSCols: |
23 |
|
PrescaleColumnString = PrescaleColumnString + str(c) + "," |
24 |
|
|
25 |
|
write("The average instantaneous lumi of these lumisections is: ") |
26 |
|
write(str(round(AvInstLumi,1))+"e30\n") |
27 |
|
write("The delivered lumi of these lumi sections is: ") |
28 |
< |
write(str(round(1000*AvDeliveredLumi,1))+"e30"+"\n") |
28 |
> |
write(str(round(len(LumiRange)*AvDeliveredLumi,1))+"e30"+"\n") |
29 |
|
write("The live (recorded) lumi of these lumi sections is: ") |
30 |
< |
write(str(round(1000*AvLiveLumi,1))+"e30\n\n") |
30 |
> |
write(str(round(len(LumiRange)*AvLiveLumi,1))+"e30\n\n") |
31 |
|
write("The average deadtime of these lumi sections is: ") |
32 |
|
if AvDeadTime > 5: |
33 |
|
write(bcolors.FAIL) |
38 |
|
write(str(round(AvDeadTime,1))+"%") |
39 |
|
write(bcolors.ENDC+"\n") |
40 |
|
|
41 |
< |
print "Used prescale column(s): "+str(PrescaleColumnString) |
42 |
< |
print "Lumisections: "+str(LumiRange) |
41 |
> |
print "Used prescale column(s): "+str(PrescaleColumnString) |
42 |
> |
write("Lumisections: ") |
43 |
> |
if not isSequential(LumiRange): |
44 |
> |
write(str(LumiRange)+" Lumisections are not sequential (bad LS skipped)\n") |
45 |
> |
else: |
46 |
> |
write("%d - %d\n" % (min(LumiRange),max(LumiRange),)) |
47 |
> |
print "\nLast Lumisection of the run is: "+str(parser.GetLastLS()) |
48 |
> |
write( "Last Lumisection good for physics is: "+str(parser.GetLastLS(True)) ) |
49 |
> |
if parser.GetLastLS(True)!=max(LumiRange): |
50 |
> |
write(bcolors.WARNING) |
51 |
> |
write(" << This exceeds the last lumisection parsed") |
52 |
> |
write(bcolors.ENDC+"\n\n\n") |
53 |
> |
|
54 |
> |
L1RatePredictions = config.GetExpectedL1Rates(AvInstLumi) |
55 |
> |
if len(L1RatePredictions): |
56 |
> |
print "Expected Level 1 Rates:" |
57 |
> |
for key,val in L1RatePredictions.iteritems(): |
58 |
> |
write("Prescale Column "+str(key)+": "+str(round(val/1000,1))+" kHz") |
59 |
> |
if key == LastPSCol: |
60 |
> |
write(' << We Are here!') |
61 |
> |
write('\n') |
62 |
> |
|
63 |
> |
|
64 |
> |
|
65 |
> |
def isSequential(t): |
66 |
> |
try: |
67 |
> |
if len(t)<2: |
68 |
> |
return True |
69 |
> |
except: |
70 |
> |
return True |
71 |
> |
for i,e in enumerate(t[1:]): |
72 |
> |
if not abs(e-t[i])==1: |
73 |
> |
return False |
74 |
> |
return True |