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.1 by amott, Mon Feb 13 19:33:53 2012 UTC vs.
Revision 1.4 by amott, Wed Feb 15 12:16:37 2012 UTC

# Line 7 | Line 7 | def MoreTableInfo(parser,LumiRange):
7      [AvInstLumi, AvLiveLumi, AvDeliveredLumi, AvDeadTime,PSCols] = parser.GetAvLumiInfo(LumiRange)
8  
9      if AvDeadTime==0:  ## For some reason the dead time in the DB is occasionally broken
10 <        AvDeadTime = AvLiveLumi/AvDeliveredLumi * 100
11 <
10 >        try:
11 >            AvDeadTime = AvLiveLumi/AvDeliveredLumi * 100
12 >        except:
13 >            AvDeadTime = 100
14      PrescaleColumnString=''
15      for c in PSCols:
16          PrescaleColumnString = PrescaleColumnString + str(c) + ","
# Line 26 | Line 28 | def MoreTableInfo(parser,LumiRange):
28          write(bcolors.WARNING)
29      else:
30          write(bcolors.OKBLUE)
31 <        write(str(round(AvDeadTime,1))+"%")
31 >    write(str(round(AvDeadTime,1))+"%")
32 >    write(bcolors.ENDC+"\n")
33 >
34 >    print "Used prescale column(s): "+str(PrescaleColumnString)    
35 >    write("Lumisections: ")
36 >    if not isSequential(LumiRange):
37 >        write(str(LumiRange)+"   Lumisections are not sequential (bad LS skipped)\n")
38 >    else:
39 >        write("%d - %d\n" % (min(LumiRange),max(LumiRange),))
40 >    print "\nLast Lumisection of the run is:        "+str(parser.GetLastLS())
41 >    write(  "Last Lumisection good for physics is:  "+str(parser.GetLastLS(True)) )
42 >    if parser.GetLastLS(True)!=max(LumiRange):
43 >        write(bcolors.WARNING)
44 >        write("  << This exceeds the last lumisection parsed")
45      write(bcolors.ENDC+"\n")
46  
47 <    print "Used prescale column(s): "+str(PrescaleColumnString)
48 <    print "Lumisections: "+str(LumiRange)
47 > def isSequential(t):
48 >    try:
49 >        if len(t)<2:
50 >            return True
51 >    except:
52 >        return True        
53 >    for i,e in enumerate(t[1:]):
54 >        if not abs(e-t[i])==1:
55 >            return False
56 >    return True

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines