CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups 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 96 of file PrescaleChecker.py.

References isMonotonic().

Referenced by main().

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

Definition at line 83 of file PrescaleChecker.py.

References sistrip::SpyUtilities.range(), and ComparisonHelper.zip().

Referenced by findAnomalies().

83 
84 def isMonotonic(array, ignoreCols): # return 0 if not, 1 if true and 2 if the array is constant
85  lastEntry = array[0]
86  returnVal=2
87  for entry,i in zip(array[0:],range(len(array[0:]))):
88  if i in ignoreCols:
89  continue
90  if lastEntry<entry and lastEntry!=0:
91  return 0
92  if lastEntry!=entry:
93  returnVal=1
94  lastEntry=entry
95  return returnVal
const uint16_t range(const Frame &aFrame)
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(), TablePrint.PrettyPrintTable(), print(), str, and usage().

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

Definition at line 68 of file PrescaleChecker.py.

References ComparisonHelper.zip().

68 
69 def TrendingWithLumi(ColLumi,PrescaleTable):
70  RatioTable=[]
71  for line in PrescaleTable:
72  name = line[0]
73  l1 = line[1]
74  prescales = line[2:]
75  ratios=[]
76  for lumi,ps in zip(ColLumi,prescales):
77  if ps>0:
78  ratios.append(lumi/ps)
79  else:
80  ratios.append(0)
81  RatioTable.append([name,l1]+ratios)
82  return RatioTable
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 print().

Referenced by main().

13 
14 def usage():
15  print("%s [Options] KeyVersion" % sys.argv[0])
16  print("--IgnoreCols=<cols> List of columns to ignore from the prescale checker (format is 1,2,3,4 etc.)")
17 
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:47

Variable Documentation

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

Definition at line 11 of file PrescaleChecker.py.