ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/RateMonShiftTool_dev/DatabaseRateMonitor.py
Revision: 1.33
Committed: Sun Apr 15 11:16:30 2012 UTC (13 years ago) by amott
Content type: text/x-python
Branch: MAIN
CVS Tags: V00-00-29
Changes since 1.32: +41 -37 lines
Log Message:
Added ability to sort the output list and fixed bugs so we can list all triggers

File Contents

# User Rev Content
1 amott 1.1 #!/usr/bin/env python
2    
3 amott 1.15 #from AndrewGetRun import GetRun
4 amott 1.1 from DatabaseParser import *
5     from ReadConfig import RateMonConfig
6     import sys
7     import os
8     import cPickle as pickle
9     import getopt
10     import time
11     from colors import *
12     from TablePrint import *
13     from AddTableInfo_db import MoreTableInfo
14     from math import *
15    
16     WBMPageTemplate = "http://cmswbm/cmsdb/servlet/RunSummary?RUN=%s&DB=cms_omds_lb"
17     WBMRunInfoPage = "https://cmswbm/cmsdb/runSummary/RunSummary_1.html"
18    
19     RefRunNameTemplate = "RefRuns/Run_%s.pk"
20    
21     # define a function that clears the terminal screen
22     def clear():
23     print("\x1B[2J")
24    
25    
26     def usage():
27     print sys.argv[0]+" [Options]"
28     print "This script gets the current HLT trigger rates and compares them to a reference run"
29     print "Options: "
30     print "--AllowedDiff=<diff> Report only if difference in trigger rate is greater than <diff>%"
31     print "--CompareRun=<Run #> Compare run <Run #> to the reference run (Default = Current Run)"
32     print "--FindL1Zeros Look for physics paths with 0 L1 rate"
33     print "--FirstLS=<ls> Specify the first lumisection to consider. This will set LSSlidingWindow to -1"
34     print "--NumberLS=<#> Specify the last lumisection to consider. Make sure LastLS > LSSlidingWindow"
35     print " or set LSSlidingWindow = -1"
36     print "--IgnoreLowRate=<rate> Ignore triggers with an actual and expected rate below <rate>"
37     print "--ListIgnoredPaths Prints the paths that are not compared by this script and their rate in the CompareRun"
38     print "--PrintLumi Prints Instantaneous, Delivered, and Live lumi by LS for the run"
39     print "--RefRun=<Run #> Specifies <Run #> as the reference run to use (Default in defaults.cfg)"
40     print "--ShowPSTriggers Show prescaled triggers in rate comparison"
41 amott 1.33 print "--sortBy=<field> Sort the triggers by field. Valid fields are: name, rate, rateDiff"
42 amott 1.2 print "--force Override the check for collisions run"
43 amott 1.1 print "--help Print this help"
44 grchrist 1.20
45     def pickYear():
46     global thisyear
47 grchrist 1.23 thisyear="2012"
48     ##print "Year set to ",thisyear
49 grchrist 1.20
50 amott 1.1 def main():
51 grchrist 1.21 pickYear()
52 amott 1.1 try:
53     opt, args = getopt.getopt(sys.argv[1:],"",["AllowedDiff=","CompareRun=","FindL1Zeros",\
54     "FirstLS=","NumberLS=","IgnoreLowRate=","ListIgnoredPaths",\
55 amott 1.33 "PrintLumi","RefRun=","ShowPSTriggers","force","sortBy=","help"])
56 amott 1.1 except getopt.GetoptError, err:
57     print str(err)
58     usage()
59     sys.exit(2)
60    
61     Config = RateMonConfig(os.path.abspath(os.path.dirname(sys.argv[0])))
62     for o,a in opt:
63     if o=="--ConfigFile":
64     Config.CFGfile=a
65     Config.ReadCFG()
66 grchrist 1.27
67 grchrist 1.30 print "NoVersion=",Config.NoVersion
68 grchrist 1.23
69 amott 1.1 AllowedRateDiff = Config.DefAllowRateDiff
70     CompareRunNum = ""
71     FindL1Zeros = False
72     FirstLS = 9999
73 amott 1.2 NumLS = -10
74 amott 1.1 IgnoreThreshold = Config.DefAllowIgnoreThresh
75     ListIgnoredPaths = False
76     PrintLumi = False
77     RefRunNum = int(Config.ReferenceRun)
78     ShowPSTriggers = True
79 amott 1.2 Force = False
80 amott 1.33 SortBy = ""
81 amott 1.1
82 amott 1.33 ShifterMode = int(Config.ShifterMode) # get this from the config, but can be overridden by other options
83 grchrist 1.23
84     ## if int(Config.ShifterMode):
85     ## print "ShifterMode!!"
86     ## else:
87     ## print "ExpertMode"
88 amott 1.1
89     if Config.LSWindow > 0:
90     NumLS = -1*Config.LSWindow
91    
92     for o,a in opt: # get options passed on the command line
93     if o=="--AllowedDiff":
94 amott 1.33 AllowedRateDiff = float(a)
95 amott 1.1 elif o=="--CompareRun":
96     CompareRunNum=int(a)
97 amott 1.33 ShifterMode = False
98 amott 1.1 elif o=="--FindL1Zeros":
99     FindL1Zeros = True
100     elif o=="--FirstLS":
101     FirstLS = int(a)
102 amott 1.33 ShifterMode = False
103 amott 1.1 elif o=="--NumberLS":
104     NumLS = int(a)
105     elif o=="--IgnoreLowRate":
106     IgnoreThreshold = float(a)
107     elif o=="--ListIgnoredPaths":
108     ListIgnoredPaths=True
109 amott 1.33 ShifterMode = False
110 amott 1.1 elif o=="--PrintLumi":
111     PrintLumi = True
112     elif o=="--RefRun":
113     RefRunNum=int(a)
114     elif o=="--ShowPSTriggers":
115     ShowPSTriggers=True
116 amott 1.33 elif o=="--sortBy":
117     SortBy = a
118 amott 1.2 elif o=="--force":
119     Force = True
120 amott 1.1 elif o=="--help":
121     usage()
122     sys.exit(0)
123     else:
124     print "Invalid Option "+a
125     sys.exit(1)
126    
127 grchrist 1.23
128 amott 1.1 RefLumisExists = False
129    
130     """
131     if RefRunNum > 0:
132     RefRates = {}
133     for Iterator in range(1,100):
134     if RefLumisExists: ## Quits at the end of a run
135     if max(RefLumis[0]) <= (Iterator+1)*10:
136     break
137    
138     RefRunFile = RefRunNameTemplate % str( RefRunNum*100 + Iterator ) # place to save the reference run info
139     print "RefRunFile=",RefRunFile
140     if not os.path.exists(RefRunFile[:RefRunFile.rfind('/')]): # folder for ref run file must exist
141     print "Reference run folder does not exist, please create" # should probably create programmatically, but for now force user to create
142     print RefRunFile[:RefRunFile.rfind('/')]
143     sys.exit(0)
144    
145     if not os.path.exists(RefRunFile): # if the reference run is not saved, get it from wbm
146     print "Reference Run File for run "+str(RefRunNum)+" iterator "+str(Iterator)+" does not exist"
147     print "Creating ..."
148     try:
149     RefParser = GetRun(RefRunNum, RefRunFile, True, Iterator*10, (Iterator+1)*10)
150     print "parsing"
151     except:
152     print "GetRun failed from LS "+str(Iterator*10)+" to "+str((Iterator+1)*10)
153     continue
154    
155     else: # otherwise load it from the file
156     RefParser = pickle.load( open( RefRunFile ) )
157     print "loading"
158     if not RefLumisExists:
159     RefLumis = RefParser.LumiInfo
160     RefLumisExists = True
161    
162     try:
163     RefRates[Iterator] = RefParser.TriggerRates # get the trigger rates from the reference run
164     LastSuccessfulIterator = Iterator
165     except:
166     print "Failed to get rates from LS "+str(Iterator*10)+" to "+str((Iterator+1)*10)
167     """
168    
169     RefRunFile = RefRunNameTemplate % RefRunNum
170     RefParser = DatabaseParser()
171 grchrist 1.23 ##print "Reference Run: "+str(RefRunNum)
172 amott 1.1 if RefRunNum > 0:
173     if not os.path.exists(RefRunFile[:RefRunFile.rfind('/')]): # folder for ref run file must exist
174     print "Reference run folder does not exist, please create" # should probably create programmatically, but for now force user to create
175     print RefRunFile[:RefRunFile.rfind('/')]
176 grchrist 1.27 sys.exit(0)
177    
178 amott 1.1 return
179     if not os.path.exists(RefRunFile):
180     # create the reference run file
181     try:
182     RefParser.RunNumber = RefRunNum
183     RefParser.ParseRunSetup()
184     #RefParser.GetAllTriggerRatesByLS()
185     #RefParser.Save( RefRunFile )
186     except e:
187     print "PROBLEM GETTING REFERNCE RUN"
188     raise
189     else:
190     RefParser = pickle.load( open( RefRunFile ) )
191    
192     # OK, Got the Reference Run
193     # Now get the most recent run
194    
195     SaveRun = False
196     if CompareRunNum=="": # if no run # specified on the CL, get the most recent run
197 grchrist 1.22 CompareRunNum,isCol,isGood = GetLatestRunNumber()
198 grchrist 1.26
199    
200 grchrist 1.22 if not isGood:
201 grchrist 1.23 print "NO TRIGGER KEY FOUND for run ",CompareRunNum
202 grchrist 1.22
203 grchrist 1.23 ##sys.exit(0)
204 amott 1.1
205     if not isCol:
206     print "Most Recent run, "+str(CompareRunNum)+", is NOT collisions"
207 amott 1.16 print "Monitoring only stream A and Express"
208     #if not Force:
209     # sys.exit(0) # maybe we should walk back and try to find a collisions run, but for now just exit
210 grchrist 1.23
211     else:
212     print "Most Recent run is "+str(CompareRunNum)
213 amott 1.16 else:
214 grchrist 1.22 CompareRunNum,isCol,isGood = GetLatestRunNumber(CompareRunNum)
215     if not isGood:
216 grchrist 1.23 print "NO TRIGGER KEY FOUND for run ", CompareRunNum
217     ##sys.exit(0)
218 amott 1.17
219 grchrist 1.23
220 amott 1.17 HeadParser = DatabaseParser()
221     HeadParser.RunNumber = CompareRunNum
222 grchrist 1.23
223     try:
224     HeadParser.ParseRunSetup()
225     HeadLumiRange = HeadParser.GetLSRange(FirstLS,NumLS,isCol)
226     LastGoodLS=HeadParser.GetLastLS(isCol)
227     CurrRun=CompareRunNum
228     except:
229     HeadLumiRange=[]
230     LastGoodLS=-1
231     CurrRun=CompareRunNum
232     isGood=0
233    
234     if len(HeadLumiRange) is 0:
235     print "No lumisections that are taking physics data"
236     HeadLumiRange = HeadParser.GetLSRange(FirstLS,NumLS,False)
237     if len(HeadLumiRange)>0:
238     isGood=1
239     isCol=0
240     ##sys.exit(0)
241    
242    
243 amott 1.1 if PrintLumi:
244     for LS in HeadParser.LumiInfo[0]:
245     try:
246     if (LS < FirstLS or LS > LastLS) and not FirstLS==999999:
247     continue
248     print str(LS)+' '+str(round(HeadParser.LumiInfo[2][LS],1))+' '+str(round((HeadParser.LumiInfo[3][LS] - HeadParser.LumiInfo[3][LS-1])*1000/23.3,0))+' '+str(round((HeadParser.LumiInfo[4][LS] - HeadParser.LumiInfo[4][LS-1])*1000/23.3,0))
249     except:
250     print "Lumisection "+str(LS-1)+" was not parsed from the LumiSections page"
251    
252 grchrist 1.23 sys.exit(0)
253 amott 1.1
254     if RefRunNum == 0:
255     RefRates = 0
256     RefLumis = 0
257     LastSuccessfulIterator = 0
258    
259     ### Now actually compare the rates, make tables and look at L1. Loops for ShifterMode
260     #CheckTriggerList(HeadParser,RefRunNum,RefRates,RefLumis,LastSuccessfulIterator,ShowPSTriggers,AllowedRateDiff,IgnoreThreshold,Config)
261 grchrist 1.23
262     ###isGood=1##if there is a trigger key
263 amott 1.1 try:
264     while True:
265 grchrist 1.23
266     if isGood:
267     LastGoodLS=HeadParser.GetLastLS(isCol)
268     if not isCol:
269     ##clear()
270     MoreTableInfo(HeadParser,HeadLumiRange,Config,False)
271     else:
272 grchrist 1.25 if (len(HeadLumiRange)>0):
273 amott 1.33 RunComparison(HeadParser,RefParser,HeadLumiRange,ShowPSTriggers,AllowedRateDiff,IgnoreThreshold,Config,ListIgnoredPaths,SortBy)
274 grchrist 1.25 if FindL1Zeros:
275     CheckL1Zeros(HeadParser,RefRunNum,RefRates,RefLumis,LastSuccessfulIterator,ShowPSTriggers,AllowedRateDiff,IgnoreThreshold,Config)
276     else:
277 grchrist 1.26 print "No lumisections that are taking physics data"
278 amott 1.33 if ShifterMode:
279 grchrist 1.23 #print "Shifter Mode. Continuing"
280     pass
281 amott 1.2 else:
282 grchrist 1.23 print "Expert Mode. Quitting."
283     sys.exit(0)
284 amott 1.2
285 amott 1.1
286     print "Sleeping for 1 minute before repeating "
287 amott 1.16 for iSleep in range(20):
288 amott 1.15 write(".")
289     sys.stdout.flush()
290 amott 1.16 time.sleep(3)
291 grchrist 1.23 write(" Updating\n")
292 amott 1.15 sys.stdout.flush()
293 grchrist 1.23
294     ##print "\nminLS=",min(HeadLumiRange),"Last LS=",HeadParser.GetLastLS(isCol),"run=",HeadParser.RunNumber
295     ###Get a new run if DAQ stops
296     ##print "\nLastGoodLS=",LastGoodLS
297    
298     ##### NEED PLACEHOLDER TO COMPARE CURRENT RUN TO LATEST RUN #####
299    
300     NewRun,isCol,isGood = GetLatestRunNumber(9999999) ## update to the latest run and lumi range
301    
302     try:
303     maxLumi=max(HeadLumiRange)
304     except:
305     maxLumi=0
306    
307     ##### THESE ARE CONDITIONS TO GET NEW RUN #####
308     if maxLumi>(LastGoodLS+1) or not isGood or NewRun!=CurrRun:
309     print "Trying to get new Run"
310     try:
311     HeadParser = DatabaseParser()
312     HeadParser.RunNumber = NewRun
313     HeadParser.ParseRunSetup()
314     CurrRun,isCol,isGood=GetLatestRunNumber(9999999)
315     FirstLS=9999
316     HeadLumiRange = HeadParser.GetLSRange(FirstLS,NumLS,isCol)
317     if len(HeadLumiRange) is 0:
318     HeadLumiRange = HeadParser.GetLSRange(FirstLS,NumLS,False)
319 grchrist 1.26 print "No lumisections that are taking physics data"
320 grchrist 1.23 if len(HeadLumiRange)>0:
321     isGood=1
322     isCol=0
323    
324 grchrist 1.26
325 grchrist 1.23 LastGoodLS=HeadParser.GetLastLS(isCol)
326 grchrist 1.25 ##print CurrRun, isCol, isGood
327 grchrist 1.23 except:
328     isGood=0
329     isCol=0
330     print "failed"
331    
332    
333    
334    
335     ##CurrRun,isCol,isGood = GetLatestRunNumber(CurrRun) ## update to the latest run and lumi range
336     else:
337     try:
338     HeadParser.ParseRunSetup()
339     HeadLumiRange = HeadParser.GetLSRange(FirstLS,NumLS,isCol)
340     if len(HeadLumiRange) is 0:
341     HeadLumiRange = HeadParser.GetLSRange(FirstLS,NumLS,False)
342 grchrist 1.26 print "No lumisections that are taking physics data"
343 grchrist 1.23 if len(HeadLumiRange)>0:
344     isGood=1
345     isCol=0
346     LastGoodLS=HeadParser.GetLastLS(isCol)
347    
348     except:
349     isGood=0
350     isCol=0
351     clear()
352     print "NO TRIGGER KEY FOUND YET for run", NewRun ,"repeating search"
353    
354    
355     ## try:
356     ## HeadParser.GetLumiInfo()
357     ## if len(HeadParser.Active)>0:
358     ## isGood=1
359     ## ##print "setting to good"
360     ## except:
361     ## pass
362 grchrist 1.22
363 grchrist 1.23
364 amott 1.1 #end while True
365     #end try
366     except KeyboardInterrupt:
367     print "Quitting. Peace Out."
368    
369    
370 amott 1.33 def RunComparison(HeadParser,RefParser,HeadLumiRange,ShowPSTriggers,AllowedRateDiff,IgnoreThreshold,Config,ListIgnoredPaths,SortBy):
371 amott 1.1 Header = ["Trigger Name","Actual","Expected","% Inc","Cur PS","Comments"]
372     Data = []
373     Warn = []
374     IgnoredRates=[]
375 grchrist 1.23
376 abrinke1 1.9 [HeadAvInstLumi,HeadAvLiveLumi,HeadAvDeliveredLumi,HeadAvDeadTime,HeadPSCols] = HeadParser.GetAvLumiInfo(HeadLumiRange)
377 abrinke1 1.3 ##[HeadUnprescaledRates, HeadTotalPrescales, HeadL1Prescales, HeadTriggerRates] = HeadParser.UpdateRun(HeadLumiRange)
378     HeadUnprescaledRates = HeadParser.UpdateRun(HeadLumiRange)
379 abrinke1 1.9 [PSColumnByLS,InstLumiByLS,DeliveredLumiByLS,LiveLumiByLS,DeadTimeByLS,PhysicsByLS,ActiveByLS] = HeadParser.LumiInfo
380 grchrist 1.30 deadtimebeamactive=HeadParser.GetDeadTimeBeamActive(HeadLumiRange)
381 grchrist 1.18 try:
382     pkl_file = open(Config.FitFileName, 'rb')
383     FitInput = pickle.load(pkl_file)
384     pkl_file.close()
385 grchrist 1.29 ##print "fit file name=",Config.FitFileName
386 grchrist 1.31
387 grchrist 1.18 except:
388 grchrist 1.27 print "No fit file specified"
389 grchrist 1.20 sys.exit(2)
390    
391 grchrist 1.23 try:
392     refrunfile="RefRuns/%s/Rates_HLT_10LS_JPAP.pkl" % (thisyear)
393     pkl_file = open(refrunfile, 'rb')
394     RefRatesInput = pickle.load(pkl_file)
395     pkl_file.close()
396     except:
397 grchrist 1.24 RefRatesInput={}
398 amott 1.1
399 grchrist 1.30
400     trig_list=Config.MonitorList
401    
402     if Config.NoVersion:
403     trig_list=[]
404     FitInputNoV={}
405    
406     for trigger in Config.MonitorList:
407     trig_list.append(StripVersion(trigger))
408     for trigger in FitInput.iterkeys():
409     FitInputNoV[StripVersion(trigger)]=FitInput[trigger]
410     FitInput=FitInputNoV
411 grchrist 1.31
412 grchrist 1.30
413     ##trig_list=Config.MonitorList
414 abrinke1 1.3 for HeadName in HeadUnprescaledRates:
415 grchrist 1.30
416     HeadNameNoV=StripVersion(HeadName)
417 grchrist 1.31
418 grchrist 1.30
419     if Config.NoVersion:
420     if HeadNameNoV not in trig_list and not ListIgnoredPaths:
421     continue
422 amott 1.33 if HeadNameNoV not in FitInput.keys() and not ListIgnoredPaths:
423 grchrist 1.30 continue
424     else:
425     if HeadName not in trig_list and not ListIgnoredPaths:
426     continue
427 amott 1.33 if HeadName not in FitInput.keys() and not ListIgnoredPaths:
428 grchrist 1.30 continue
429 grchrist 1.24
430 grchrist 1.25 ##masked_triggers = ["AlCa_", "DST_", "HLT_L1", "HLT_L2", "HLT_Zero"]
431 grchrist 1.28 masked_triggers = ["AlCa_", "DST_", "HLT_L1", "HLT_Zero"]
432 abrinke1 1.9 masked_trig = False
433     for mask in masked_triggers:
434     if str(mask) in HeadName:
435     masked_trig = True
436     if masked_trig:
437     continue
438    
439 amott 1.1 skipTrig=False
440 abrinke1 1.3 TriggerRate = round(HeadUnprescaledRates[HeadName][2],2)
441 grchrist 1.30
442 amott 1.1 if RefParser.RunNumber == 0: ## Use rate prediction functions
443    
444 grchrist 1.30
445     PSCorrectedExpectedRate = Config.GetExpectedRate(HeadName,FitInput,RefRatesInput,HeadAvLiveLumi,HeadAvDeliveredLumi,deadtimebeamactive)
446    
447 abrinke1 1.9
448 amott 1.33 #if PSCorrectedExpectedRate[0] < 0: ##This means we don't have a prediction for this trigger
449     # continue
450 grchrist 1.32 try:
451     ExpectedRate = round((PSCorrectedExpectedRate[0] / HeadUnprescaledRates[HeadName][1]),2)
452     except:
453     ExpectedRate=0.
454 amott 1.33 #print "No rate for ", HeadName
455 grchrist 1.30
456 amott 1.1 PerDiff=0
457     if ExpectedRate>0:
458     PerDiff = int(round( (TriggerRate-ExpectedRate)/ExpectedRate,2 )*100)
459    
460 amott 1.33 if TriggerRate < IgnoreThreshold and (ExpectedRate < IgnoreThreshold and ExpectedRate!=0):
461 amott 1.1 continue
462    
463     VC = ""
464    
465 abrinke1 1.3 Data.append([HeadName,TriggerRate,ExpectedRate,PerDiff,round(HeadUnprescaledRates[HeadName][1],1),VC])
466 amott 1.1
467     else: ## Use a reference run
468     ## cheap trick to only get triggers in list when in shifter mode
469     #print "shifter mode=",int(Config.ShifterMode)
470 grchrist 1.24 print "REfRun!!!"
471 amott 1.1 if int(Config.ShifterMode)==1:
472     if not HeadParser.AvgL1Prescales[HeadParser.HLTSeed[HeadName]]==1:
473     continue
474    
475     RefInstLumi = 0
476     RefIterator = 0
477    
478     RefStartIndex = ClosestIndex(HeadAvInstLumi,RefParser.GetAvLumiPerRange())
479     RefLen = -10
480    
481 abrinke1 1.3 ##[RefUnprescaledRates, RefTotalPrescales, RefL1Prescales, RefTriggerRates] = RefParser.UpdateRun(RefParser.GetLSRange(RefStartIndex,RefLen))
482     RefUnprescaledRates = RefParser.UpdateRun(RefParser.GetLSRange(RefStartIndex,RefLen))
483 amott 1.1 [RefAvInstLumi,RefAvLiveLumi,RefAvDeliveredLumi,RefAvDeadTime,RefPSCols] = RefParser.GetAvLumiInfo(RefParser.GetLSRange(RefStartIndex,RefLen))
484     RefRate = -1
485     for k,v in RefUnprescaledRates.iteritems():
486 grchrist 1.19 #if StripVersion(HeadName) == StripVersion(k): # versions may not match
487     RefRate = v
488 amott 1.1
489 abrinke1 1.3 ScaledRefRate = round( RefRate*HeadAvLiveLumi/RefAvLiveLumi/(HeadUnprescaledRates[HeadName][1]), 2 )
490 amott 1.1
491     if ScaledRefRate == 0:
492     PerDiff = 100
493     else:
494     PerDiff = int( round( (TriggerRate - ScaledRefRate)/ScaledRefRate , 2)*100)
495    
496     if TriggerRate < IgnoreThreshold and ScaledRefRate < IgnoreThreshold:
497     continue
498    
499     VC = ""
500 amott 1.15 Data.append([HeadName,TriggerRate,ScaledRefRate,PerDiff,round((HeadUnprescaledRates[HeadName][1]),1),VC])
501 amott 1.1
502 amott 1.33 SortedData = []
503     if SortBy == "":
504     SortedData = Data # don't do any sorting
505     elif SortBy == "name":
506     SortedData=sorted(Data, key=lambda entry: entry[0])
507     elif SortBy == "rate":
508     SortedData=sorted(Data, key=lambda entry: entry[1],reverse=True)
509     elif SortBy == "rateDiff":
510     SortedData=sorted(Data, key=lambda entry: abs(entry[3]),reverse=True)
511     else:
512     print "Invalid sorting option %s\n"%SortBy
513     SortedData = Data
514    
515     #check for triggers above the warning threshold
516     Warn=[]
517     for entry in SortedData:
518     if abs(entry[3]) > AllowedRateDiff:
519     Warn.append(True)
520     else:
521     Warn.append(False)
522    
523     PrettyPrintTable(Header,SortedData,[80,10,10,10,10,20],Warn)
524 amott 1.1
525 amott 1.4 MoreTableInfo(HeadParser,HeadLumiRange,Config)
526 amott 1.1
527     def CheckTriggerList(HeadParser,RefRunNum,RefRates,RefLumis,LastSuccessfulIterator,ShowPSTriggers,AllowedRateDiff,IgnoreThreshold,Config):
528     print "checking trigger list"
529    
530     def CheckL1Zeros(HeadParser,RefRunNum,RefRates,RefLumis,LastSuccessfulIterator,ShowPSTriggers,AllowedRateDiff,IgnoreThreshold,Config):
531     L1Zeros=[]
532     IgnoreBits = ["L1_PreCollisions","L1_InterBunch_Bsc","L1_BeamHalo","L1_BeamGas_Hf"]
533     for key in HeadParser.TriggerRates:
534     ## Skip events in the skip list
535     skipTrig=False
536     ##for trig in Config.ExcludeList:
537     ##if not trigN.find(trig) == -1:
538     ##skipTrig=True
539     ##break
540     if skipTrig:
541     continue
542     ## if no events pass the L1, add it to the L1Zeros list if not already there
543     if HeadParser.TriggerRates[key][1]==0 and not HeadParser.TriggerRates[key][4] in L1Zeros:
544     if HeadParser.TriggerRates[key][4].find('L1_BeamHalo')==-1 and HeadParser.TriggerRates[key][4].find('L1_PreCollisions')==-1 and HeadParser.TriggerRates[key][4].find('L1_InterBunch_Bsc')==-1:
545    
546     L1Zeros.append(HeadParser.TriggerRates[key][4])
547     print "L1Zeros=", L1Zeros
548    
549     if len(L1Zeros) == 0:
550     #print "It looks like no masked L1 bits seed trigger paths"
551     pass
552     else:
553     print "The following seeds are used to seed HLT bits but accept 0 events:"
554     #print "The average lumi of this run is: "+str(round(HeadParser.LumiInfo[6],1))+"e30"
555     for Seed in L1Zeros:
556     print Seed
557    
558     if __name__=='__main__':
559 grchrist 1.20 global thisyear
560 amott 1.1 main()