CMS 3D CMS Logo

Functions
PrescaleChecker Namespace Reference

Functions

def findAnomalies (PrescaleTable, ignoreCols)
 
def isMonotonic (array, ignoreCols)
 
def main ()
 
def TrendingWithLumi (ColLumi, PrescaleTable)
 
def usage ()
 

Function Documentation

def PrescaleChecker.findAnomalies (   PrescaleTable,
  ignoreCols 
)

Definition at line 95 of file PrescaleChecker.py.

References isMonotonic().

Referenced by main().

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)
101  return anomalies
def findAnomalies(PrescaleTable, ignoreCols)
def isMonotonic(array, ignoreCols)
def PrescaleChecker.isMonotonic (   array,
  ignoreCols 
)

Definition at line 82 of file PrescaleChecker.py.

References ComparisonHelper.zip().

Referenced by findAnomalies().

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
94 
def isMonotonic(array, ignoreCols)
OutputIterator zip(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp)
def PrescaleChecker.main ( )

Definition at line 17 of file PrescaleChecker.py.

References findAnomalies(), createfilelist.int, TablePrint.PrettyPrintTable(), edm.print(), str, and usage().

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
66 
def findAnomalies(PrescaleTable, ignoreCols)
S & print(S &os, JobReport::InputFile const &f)
Definition: JobReport.cc:65
def PrettyPrintTable(Headers, Data, ColWidths, WarningCol=[], border='*')
Definition: TablePrint.py:6
#define str(s)
def PrescaleChecker.TrendingWithLumi (   ColLumi,
  PrescaleTable 
)

Definition at line 67 of file PrescaleChecker.py.

References ComparisonHelper.zip().

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
81 
def TrendingWithLumi(ColLumi, PrescaleTable)
OutputIterator zip(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp)
def PrescaleChecker.usage ( )

Definition at line 12 of file PrescaleChecker.py.

References edm.print().

Referenced by main().

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 
16 
S & print(S &os, JobReport::InputFile const &f)
Definition: JobReport.cc:65