CMS 3D CMS Logo

Functions | Variables

PrescaleChecker Namespace Reference

Functions

def findAnomalies
def isMonotonic
def main
def TrendingWithLumi
def usage

Variables

string WBMPageTemplate = "http://cmswbm/cmsdb/servlet/TriggerMode?KEY=l1_hlt_collisions/v%s"

Function Documentation

def PrescaleChecker::findAnomalies (   PrescaleTable,
  ignoreCols 
)

Definition at line 94 of file PrescaleChecker.py.

00095                                            :
00096     anomalies=[]
00097     for line in PrescaleTable:
00098         ps = line[2:]
00099         if not isMonotonic(ps,ignoreCols):
00100             anomalies.append(line)
    return anomalies
def PrescaleChecker::isMonotonic (   array,
  ignoreCols 
)

Definition at line 81 of file PrescaleChecker.py.

00081                                   :  # return 0 if not, 1 if true and 2 if the array is constant
00082     lastEntry = array[0]
00083     returnVal=2
00084     for entry,i in zip(array[0:],range(len(array[0:]))):
00085         if i in ignoreCols:
00086             continue
00087         if lastEntry<entry and lastEntry!=0:
00088             return 0
00089         if lastEntry!=entry:
00090             returnVal=1
00091         lastEntry=entry
00092     return returnVal
00093 
def PrescaleChecker::main ( )

Definition at line 16 of file PrescaleChecker.py.

00017           :
00018     try:
00019         opt, args = getopt.getopt(sys.argv[1:],"",["IgnoreCols="])
00020     except getopt.GetoptError, err:
00021         print str(err)
00022         usage()
00023         sys.exit(2)
00024 
00025     if len(args)<1:
00026         usage()
00027         sys.exit(2)
00028 
00029     IgnoreCols=[]
00030     for o,a in opt:
00031         if o == "--IgnoreCols":
00032             tmp = a.split(',')
00033             try:
00034                 for e in tmp:
00035                     IgnoreCols.append(int(e))
00036             except:
00037                 print "Invalid argument to '--IgnoreCols' "
00038                 sys.exit(2)
00039         else:
00040             print "Invalid option "+o
00041             usage()
00042             sys.exit(0)
00043             
00044     WBMPage = WBMPageTemplate % args[0]
00045     ## Parse the key page
00046     Parser = Page1Parser()
00047     Parser._Parse(WBMPage)
00048     Parser.ParseTrigModePage()
00049     Parser.ComputeTotalPrescales()
00050 
00051     Header=["Path Name", "L1 Seed"]+Parser.ColumnLumi
00052     ColWidths=[70,30]+[10]*len(Parser.ColumnLumi)
00053     print """
00054     TOTAL L1*HLT PRESCALE TABLE:
00055     """
00056     PrettyPrintTable(Header,Parser.TotalPrescaleTable,ColWidths)
00057     
00058     print """
00059     Weird Looking L1*HLT Prescales
00060 
00061     WARNING: paths seeded by the OR of several L1 bits may not be calculated properly (they assume an L1 prescale of 1 in all columns)
00062     """
00063 
00064     PrettyPrintTable(Header,findAnomalies(Parser.TotalPrescaleTable,IgnoreCols),ColWidths)
00065     ## OK, we need some more checks here, but to first order this is useful

def PrescaleChecker::TrendingWithLumi (   ColLumi,
  PrescaleTable 
)

Definition at line 66 of file PrescaleChecker.py.

00067                                            :
00068     RatioTable=[]
00069     for line in PrescaleTable:
00070         name = line[0]
00071         l1 = line[1]
00072         prescales = line[2:]
00073         ratios=[]
00074         for lumi,ps in zip(ColLumi,prescales):
00075             if ps>0:
00076                 ratios.append(lumi/ps)
00077             else:
00078                 ratios.append(0)
00079         RatioTable.append([name,l1]+ratios)
00080     return RatioTable

def PrescaleChecker::usage ( )

Definition at line 11 of file PrescaleChecker.py.

00012            :
00013     print "%s [Options] KeyVersion" % sys.argv[0]
00014     print "--IgnoreCols=<cols>               List of columns to ignore from the prescale checker (format is 1,2,3,4 etc.)"
00015 
    

Variable Documentation

string PrescaleChecker::WBMPageTemplate = "http://cmswbm/cmsdb/servlet/TriggerMode?KEY=l1_hlt_collisions/v%s"

Definition at line 9 of file PrescaleChecker.py.