ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/RateMonShiftTool_dev/AddTableInfo_db.py
Revision: 1.11
Committed: Wed Mar 7 11:37:46 2012 UTC (13 years, 1 month ago) by abrinke1
Content type: text/x-python
Branch: MAIN
CVS Tags: V00-00-12, V00-00-11, V00-00-10, V00-00-09
Changes since 1.10: +0 -5 lines
Log Message:
Last revision failed

File Contents

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