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

Comparing UserCode/RateMonShiftTool_dev/CheckPrescales.py (file contents):
Revision 1.1 by amott, Thu Mar 22 17:37:23 2012 UTC vs.
Revision 1.3 by amott, Sat Mar 24 21:24:55 2012 UTC

# Line 5 | Line 5 | import os
5   from DatabaseParser import ConnectDB
6  
7   def usage():
8 <    print sys.argv[0] + " HLTKey GTKey GTRS Key"
8 >    print sys.argv[0] + " HLTKey GTKey GTRS Key [PSColsToIgnore]"
9  
10   def main():
11  
12 <    if not len(sys.argv) == 4:
12 >    if len(sys.argv) < 4 or len(sys.argv)>5:
13          usage()
14          sys.exit(0)
15  
16      HLT_Key  = sys.argv[1]
17      GT_Key   = sys.argv[2]
18 <    GTRS_Key = sys.argv[3]
19 <    
18 >    GTRS_Key = sys.argv[3]
19 >    PSColsToIgnore = []
20 >    if len(sys.argv)==5:
21 >        for c in sys.argv[4].split(','):
22 >            try:
23 >                PSColsToIgnore.append(int(c))
24 >            except:
25 >                print "ERROR: %s is not a valid prescale column" % c
26 >    GetPrescaleTable(HLT_Key,GT_Key,GTRS_Key,PSColsToIgnore,True)
27 >
28 > def GetPrescaleTable(HLT_Key,GT_Key,GTRS_Key,PSColsToIgnore,doPrint):
29      curs = ConnectDB('hlt')
30  
31      ## Get the HLT seeds
# Line 67 | Line 76 | def main():
76  
77      FullPrescales = {}
78      formatString = "%60s%30s%50s%50s%50s"
79 <    print "List of triggers with non-sequential prescales:"
80 <    print formatString % ("HLT Name","L1 Name","Total","HLT","L1",)
79 >    if doPrint:
80 >        print "List of triggers with non-sequential prescales:"
81 >        print formatString % ("HLT Name","L1 Name","Total","HLT","L1",)
82      for HLTName,L1Seeds in HLTSeed.iteritems():
83          if HLTName.startswith('AlCa'): ## the results don't make sense for AlCa paths
84              continue
# Line 100 | Line 110 | def main():
110          for hlt,l1 in zip(thisHLTPS,thisL1PS):
111              prescales.append(hlt*l1)
112          #print HLTName+" HLT: "+str(thisHLTPS)+" L1: "+str(thisL1PS)+" Total: "+str(prescales)
113 <        if not isSequential(prescales):
113 >        if not isSequential(prescales,PSColsToIgnore) and doPrint:
114              print formatString % (HLTName,L1Seeds,prescales,thisHLTPS,thisL1PS,)
115          FullPrescales[HLTName] = prescales
116 +    return FullPrescales
117              
118   def GetHLTPrescaleMatrix(cursor,HLT_Key):
119      ## Get the config ID
# Line 227 | Line 238 | def GetL1AlgoPrescales(curs, GTRS_Key):
238              L1PrescaleTable[index].append(ps)
239      return L1PrescaleTable
240  
241 < def isSequential(row):
241 > def isSequential(row,ignore):
242      seq = True
243 <    lastEntry=row[0]
244 <    for entry in row:
243 >    lastEntry=999999999999
244 >    for i,entry in enumerate(row):
245 >        if i in ignore:
246 >            continue
247          if entry > lastEntry and lastEntry!=0:
248              seq = False
249              break

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines