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 96 of file PrescaleChecker.py.

References isMonotonic().

Referenced by main().

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

Definition at line 83 of file PrescaleChecker.py.

References ComparisonHelper.zip().

Referenced by findAnomalies().

83 def isMonotonic(array, ignoreCols): # return 0 if not, 1 if true and 2 if the array is constant
84  lastEntry = array[0]
85  returnVal=2
86  for entry,i in zip(array[0:],range(len(array[0:]))):
87  if i in ignoreCols:
88  continue
89  if lastEntry<entry and lastEntry!=0:
90  return 0
91  if lastEntry!=entry:
92  returnVal=1
93  lastEntry=entry
94  return returnVal
95 
def isMonotonic(array, ignoreCols)
OutputIterator zip(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp)
def PrescaleChecker.main ( )

Definition at line 18 of file PrescaleChecker.py.

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

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

Definition at line 68 of file PrescaleChecker.py.

References ComparisonHelper.zip().

68 def TrendingWithLumi(ColLumi,PrescaleTable):
69  RatioTable=[]
70  for line in PrescaleTable:
71  name = line[0]
72  l1 = line[1]
73  prescales = line[2:]
74  ratios=[]
75  for lumi,ps in zip(ColLumi,prescales):
76  if ps>0:
77  ratios.append(lumi/ps)
78  else:
79  ratios.append(0)
80  RatioTable.append([name,l1]+ratios)
81  return RatioTable
82 
def TrendingWithLumi(ColLumi, PrescaleTable)
OutputIterator zip(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp)
def PrescaleChecker.usage ( )

Definition at line 13 of file PrescaleChecker.py.

References edm.print().

Referenced by main().

13 def usage():
14  print("%s [Options] KeyVersion" % sys.argv[0])
15  print("--IgnoreCols=<cols> List of columns to ignore from the prescale checker (format is 1,2,3,4 etc.)")
16 
17 
S & print(S &os, JobReport::InputFile const &f)
Definition: JobReport.cc:66