CMS 3D CMS Logo

Functions | Variables
PrescaleChecker Namespace Reference

Functions

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

Variables

 WBMPageTemplate
 

Function Documentation

◆ findAnomalies()

def PrescaleChecker.findAnomalies (   PrescaleTable,
  ignoreCols 
)

Definition at line 96 of file PrescaleChecker.py.

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

References isMonotonic().

Referenced by main().

◆ isMonotonic()

def PrescaleChecker.isMonotonic (   array,
  ignoreCols 
)

Definition at line 83 of file PrescaleChecker.py.

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 

References FastTimerService_cff.range, and ComparisonHelper.zip().

Referenced by findAnomalies().

◆ main()

def PrescaleChecker.main ( )

Definition at line 18 of file PrescaleChecker.py.

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 
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 
67 

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

◆ TrendingWithLumi()

def PrescaleChecker.TrendingWithLumi (   ColLumi,
  PrescaleTable 
)

Definition at line 68 of file PrescaleChecker.py.

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 

References ComparisonHelper.zip().

◆ usage()

def PrescaleChecker.usage ( )

Definition at line 13 of file PrescaleChecker.py.

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 

References print().

Referenced by main().

Variable Documentation

◆ WBMPageTemplate

PrescaleChecker.WBMPageTemplate

Definition at line 11 of file PrescaleChecker.py.

PrescaleChecker.main
def main()
Definition: PrescaleChecker.py:18
FastTimerService_cff.range
range
Definition: FastTimerService_cff.py:34
PrescaleChecker.isMonotonic
def isMonotonic(array, ignoreCols)
Definition: PrescaleChecker.py:83
str
#define str(s)
Definition: TestProcessor.cc:51
PrescaleChecker.findAnomalies
def findAnomalies(PrescaleTable, ignoreCols)
Definition: PrescaleChecker.py:96
print
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:46
TablePrint.PrettyPrintTable
def PrettyPrintTable(Headers, Data, ColWidths, WarningCol=[], border=' *')
Definition: TablePrint.py:7
createfilelist.int
int
Definition: createfilelist.py:10
PrescaleChecker.TrendingWithLumi
def TrendingWithLumi(ColLumi, PrescaleTable)
Definition: PrescaleChecker.py:68
Page1Parser
Definition: Page1Parser.py:1
ComparisonHelper::zip
OutputIterator zip(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp)
Definition: L1TStage2CaloLayer1.h:41
usage
void usage()
Definition: array2xmlEB.cc:14