ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/RateMonShiftTool_dev/AddTableInfo_db.py
Revision: 1.7
Committed: Mon Feb 27 11:12:59 2012 UTC (13 years, 2 months ago) by grchrist
Content type: text/x-python
Branch: MAIN
CVS Tags: V00-00-08, V00-00-07
Changes since 1.6: +5 -4 lines
Log Message:
removed LastPS and relaxed allowed rate diff

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