CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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.

References isMonotonic().

Referenced by main().

94 
95 def findAnomalies(PrescaleTable,ignoreCols):
96  anomalies=[]
97  for line in PrescaleTable:
98  ps = line[2:]
99  if not isMonotonic(ps,ignoreCols):
100  anomalies.append(line)
return anomalies
def PrescaleChecker.isMonotonic (   array,
  ignoreCols 
)

Definition at line 81 of file PrescaleChecker.py.

Referenced by findAnomalies().

81 
82 def isMonotonic(array, ignoreCols): # return 0 if not, 1 if true and 2 if the array is constant
83  lastEntry = array[0]
84  returnVal=2
85  for entry,i in zip(array[0:],range(len(array[0:]))):
86  if i in ignoreCols:
87  continue
88  if lastEntry<entry and lastEntry!=0:
89  return 0
90  if lastEntry!=entry:
91  returnVal=1
92  lastEntry=entry
93  return returnVal
def PrescaleChecker.main ( )

Definition at line 16 of file PrescaleChecker.py.

References findAnomalies(), TablePrint.PrettyPrintTable(), and usage().

16 
17 def main():
18  try:
19  opt, args = getopt.getopt(sys.argv[1:],"",["IgnoreCols="])
20  except getopt.GetoptError as err:
21  print str(err)
22  usage()
23  sys.exit(2)
24 
25  if len(args)<1:
26  usage()
27  sys.exit(2)
28 
29  IgnoreCols=[]
30  for o,a in opt:
31  if o == "--IgnoreCols":
32  tmp = a.split(',')
33  try:
34  for e in tmp:
35  IgnoreCols.append(int(e))
36  except:
37  print "Invalid argument to '--IgnoreCols' "
38  sys.exit(2)
39  else:
40  print "Invalid option "+o
41  usage()
42  sys.exit(0)
43 
44  WBMPage = WBMPageTemplate % args[0]
45  ## Parse the key page
46  Parser = Page1Parser()
47  Parser._Parse(WBMPage)
48  Parser.ParseTrigModePage()
49  Parser.ComputeTotalPrescales()
50 
51  Header=["Path Name", "L1 Seed"]+Parser.ColumnLumi
52  ColWidths=[70,30]+[10]*len(Parser.ColumnLumi)
53  print """
54  TOTAL L1*HLT PRESCALE TABLE:
55  """
56  PrettyPrintTable(Header,Parser.TotalPrescaleTable,ColWidths)
57 
58  print """
59  Weird Looking L1*HLT Prescales
60 
61  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)
62  """
63 
64  PrettyPrintTable(Header,findAnomalies(Parser.TotalPrescaleTable,IgnoreCols),ColWidths)
65  ## OK, we need some more checks here, but to first order this is useful
def PrettyPrintTable
Definition: TablePrint.py:5
def PrescaleChecker.TrendingWithLumi (   ColLumi,
  PrescaleTable 
)

Definition at line 66 of file PrescaleChecker.py.

66 
67 def TrendingWithLumi(ColLumi,PrescaleTable):
68  RatioTable=[]
69  for line in PrescaleTable:
70  name = line[0]
71  l1 = line[1]
72  prescales = line[2:]
73  ratios=[]
74  for lumi,ps in zip(ColLumi,prescales):
75  if ps>0:
76  ratios.append(lumi/ps)
77  else:
78  ratios.append(0)
79  RatioTable.append([name,l1]+ratios)
80  return RatioTable
def PrescaleChecker.usage ( )

Definition at line 11 of file PrescaleChecker.py.

Referenced by main().

11 
12 def usage():
13  print "%s [Options] KeyVersion" % sys.argv[0]
14  print "--IgnoreCols=<cols> List of columns to ignore from the prescale checker (format is 1,2,3,4 etc.)"
15 

Variable Documentation

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

Definition at line 9 of file PrescaleChecker.py.