ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/RateMonShiftTool_dev/AddTableInfo_db.py
(Generate patch)

Comparing UserCode/RateMonShiftTool_dev/AddTableInfo_db.py (file contents):
Revision 1.2 by amott, Wed Feb 15 09:55:46 2012 UTC vs.
Revision 1.11 by abrinke1, Wed Mar 7 11:37:46 2012 UTC

# Line 3 | Line 3 | from colors import *
3   from DatabaseParser import *
4   write = sys.stdout.write
5  
6 < def MoreTableInfo(parser,LumiRange):
6 > def MoreTableInfo(parser,LumiRange,config):
7      [AvInstLumi, AvLiveLumi, AvDeliveredLumi, AvDeadTime,PSCols] = parser.GetAvLumiInfo(LumiRange)
8 +    LastPSCol = PSCols[-1]
9  
10      if AvDeadTime==0:  ## For some reason the dead time in the DB is occasionally broken
11          try:
# Line 12 | Line 13 | def MoreTableInfo(parser,LumiRange):
13          except:
14              AvDeadTime = 100
15      PrescaleColumnString=''
16 +    PSCols = list(set(PSCols))
17      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 <    write(str(round(1000*AvDeliveredLumi,1))+"e30"+"\n")
23 >    write(str(round(len(LumiRange)*AvDeliveredLumi,1))+"e30"+"\n")
24      write("The live (recorded) lumi of these lumi sections is:      ")
25 <    write(str(round(1000*AvLiveLumi,1))+"e30\n\n")
25 >    write(str(round(len(LumiRange)*AvLiveLumi,1))+"e30\n\n")
26      write("The average deadtime of these lumi sections is:          ")
27      if AvDeadTime > 5:
28          write(bcolors.FAIL)
# Line 31 | Line 33 | def MoreTableInfo(parser,LumiRange):
33      write(str(round(AvDeadTime,1))+"%")
34      write(bcolors.ENDC+"\n")
35  
36 <    print "Used prescale column(s): "+str(PrescaleColumnString)
37 <    print "Lumisections: "+str(LumiRange)
36 >    print "Used prescale column(s): "+str(PrescaleColumnString)    
37 >    write("Lumisections: ")
38 >    if not isSequential(LumiRange):
39 >        write(str(LumiRange)+"   Lumisections are not sequential (bad LS skipped)\n")
40 >    else:
41 >        write("%d - %d\n" % (min(LumiRange),max(LumiRange),))
42 >    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 >    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 >        write("Prescale Column "+str(key)+":  "+str(round(val/1000,1))+" kHz")
54 >        if key == LastPSCol:
55 >            write(' << We Are here!')
56 >        write('\n')
57 >        
58 >    
59 >
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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines