ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/RateMonShiftTool_dev/AddTableInfo_db.py
(Generate patch)

Comparing UserCode/RateMonShiftTool_dev/AddTableInfo_db.py (file contents):
Revision 1.16 by grchrist, Mon Mar 19 16:43:03 2012 UTC vs.
Revision 1.27 by amott, Thu May 3 15:31:09 2012 UTC

# Line 9 | Line 9 | NHighStreamA=0
9  
10   def MoreTableInfo(parser,LumiRange,config,isCol=True):
11      print "Monitoring Run %d" % (parser.RunNumber,)
12 <    [AvInstLumi, AvLiveLumi, AvDeliveredLumi, AvDeadTime,PSCols] = parser.GetAvLumiInfo(LumiRange)
12 >    print "len=",len(LumiRange)
13 >    print "LSRange=", LumiRange
14 >    if len(LumiRange)>0:
15 >        
16 >        [AvInstLumi, AvLiveLumi, AvDeliveredLumi, AvDeadTime,PSCols] = parser.GetAvLumiInfo(LumiRange)
17 >        deadtimebeamactive=parser.GetDeadTimeBeamActive(LumiRange)*100
18 >        ##print "dtba=",deadtimebeamactive
19 >    else:
20 >        print "no lumisections to monitor"
21 >        return
22      try:
23          LastPSCol = PSCols[-1]
24      except:
25          LastPSCol = -1
26 +    if isCol:
27          
28 <    aRates = parser.GetTriggerRatesByLS("AOutput")
28 >        aRates = parser.GetTriggerRatesByLS("AOutput")
29 >    else:
30 >        if len(parser.GetTriggerRatesByLS("AOutput"))>0:
31 >            aRates = parser.GetTriggerRatesByLS("AOutput")
32 >        else:
33 >            aRates = parser.GetTriggerRatesByLS("AForPPOutput")
34 >            
35 >    
36      expressRates = {}
37      if isCol:
38          expressRates = parser.GetTriggerRatesByLS("ExpressOutput")
39      else:
40 <        expressRates = parser.GetTriggerRatesByLS("ExpressCosmicsOutput")
40 >        if len(parser.GetTriggerRatesByLS("ExpressOutput"))>0:
41 >            expressRates=parser.GetTriggerRatesByLS("ExpressOutput")
42 >        else:
43 >            expressRates = parser.GetTriggerRatesByLS("ExpressForCosmicsOutput")
44      ExpRate=0
45      PeakRate=0
46      AvgExpRate=0
# Line 64 | Line 84 | def MoreTableInfo(parser,LumiRange,confi
84          
85      write(text)
86      if badExpress:
87 <        if (ExpRate-PeakRate)/(len(LumiRange)-1) <=config.MaxExpressRate: ## one lumisection causes this
88 <            write("  <<  This appears to be due to a 1 lumisection spike, please monitor\n")
89 <        else:
90 <            if NHighExpress > 1:  # big problem, call HLT DOC
91 <                write(colored("  <<  WARNING: Current Express rate is too high!",'red',attrs=['reverse']) )
92 <                Warn = True
87 >        if len(LumiRange)>1:
88 >            if (ExpRate-PeakRate)/(len(LumiRange)-1) <=config.MaxExpressRate: ## one lumisection causes this
89 >                write("  <<  This appears to be due to a 1 lumisection spike, please monitor\n")
90 >            else:
91 >                if NHighExpress > 1:  # big problem, call HLT DOC
92 >                    write(colored("  <<  WARNING: Current Express rate is too high!",'red',attrs=['reverse']) )
93 >                    Warn = True
94  
95                  #    if AvgExpRate > config.MaxExpressRate:
96                  #        write( colored("\n\nWARNING: Average Express Stream Rate is too high (%0.1f Hz)  << CALL HLT DOC" % AvgExpRate,'red',attrs=['reverse']) )
97                  #        Warn = True
98 <    
98 >        
99 >            
100  
101  
102      #########################################
# Line 92 | Line 114 | def MoreTableInfo(parser,LumiRange,confi
114  
115      write(textA)
116      if badStreamA:
117 <        if (ARate-PeakRateA)/(len(LumiRange)-1) <=config.MaxStreamARate: ## one lumisection causes this
118 <            write("  <<  This appears to be due to a 1 lumisection spike, please monitor\n")
119 <        else:
120 <            if NHighStreamA >1: ##Call HLT doc!
121 <                write(colored("  <<  WARNING: Current Stream A rate is too high!",'red',attrs=['reverse']) )
122 <                Warn = True
117 >        if len(LumiRange)>1:
118 >            if (ARate-PeakRateA)/(len(LumiRange)-1) <=config.MaxStreamARate: ## one lumisection causes this
119 >                write("  <<  This appears to be due to a 1 lumisection spike, please monitor\n")
120 >            else:
121 >                if NHighStreamA >1: ##Call HLT doc!
122 >                    write(colored("  <<  WARNING: Current Stream A rate is too high!",'red',attrs=['reverse']) )
123 >                    Warn = True
124      write("\n\n")
125              
126      ######################################
# Line 112 | Line 135 | def MoreTableInfo(parser,LumiRange,confi
135          write( colored(line,'red',attrs=['reverse','blink']) )
136          write( colored("*"*cols+"\n",'red',attrs=['reverse','blink']) )
137      
138 <    if AvDeadTime==0:  ## For some reason the dead time in the DB is occasionally broken
116 <        try:
117 <            AvDeadTime = AvLiveLumi/AvDeliveredLumi * 100
118 <        except:
119 <            AvDeadTime = 100
138 >    
139      PrescaleColumnString=''
140      PSCols = list(set(PSCols))
141      for c in PSCols:
# Line 130 | Line 149 | def MoreTableInfo(parser,LumiRange,confi
149          write("The live (recorded) lumi of these lumi sections is:      ")
150          write(str(round(len(LumiRange)*AvLiveLumi,1))+"e30\n\n")
151          write("The average deadtime of these lumi sections is:          ")
152 <        if AvDeadTime > 5:
152 >        if deadtimebeamactive > 5:
153              write(bcolors.FAIL)
154 <        elif AvDeadTime > 10:
154 >        elif deadtimebeamactive > 10:
155              write(bcolors.WARNING)
156          else:
157              write(bcolors.OKBLUE)
158 <        write(str(round(AvDeadTime,2))+"%")
158 >        write(str(round(deadtimebeamactive,2))+"%")
159          write(bcolors.ENDC+"\n")
160 <
161 <    print "Used prescale column(s): "+str(PrescaleColumnString)    
162 <    write("Lumisections: ")
160 >    write("Used prescale column(s): %s  " % (str(PrescaleColumnString),) )
161 >    if LastPSCol in config.ForbiddenCols and isCol:
162 >        write( colored("<< Using column %d! Please check in the documentation that this is the correct column" % (LastPSCol),'red',attrs=['reverse']) )
163 >    write("\nLumisections: ")
164      if not isSequential(LumiRange):
165          write(str(LumiRange)+"   Lumisections are not sequential (bad LS skipped)\n")
166      else:
167          write("%d - %d\n" % (min(LumiRange),max(LumiRange),))
168 <    print "\nLast Lumisection of the run is:        "+str(parser.GetLastLS())
169 <    write(  "Last Lumisection good for physics is:  "+str(parser.GetLastLS(True)) )
168 >    ##print "\nLast Lumisection of the run is:        "+str(parser.GetLastLS())
169 >    write(  "\nLast Lumisection good where DAQ is active is:  "+str(parser.GetLastLS(isCol)) )
170 >    ##write(  "Last Lumisection where DAQ is active is:  "+str(parser.GetLastLS(True)) )
171      write("\n\n\n")
172  
173 <    if isCol:
174 <        L1RatePredictions = config.GetExpectedL1Rates(AvInstLumi)
175 <        if len(L1RatePredictions):
176 <            print "Expected Level 1 Rates:"
177 <        for key,val in L1RatePredictions.iteritems():
178 <            write("Prescale Column "+str(key)+":  "+str(round(val/1000,1))+" kHz")
179 <            if key == LastPSCol:
180 <                write(' << taking data in this column')
181 <            write('\n')
173 >    ## if isCol:
174 > ##         L1RatePredictions = config.GetExpectedL1Rates(AvInstLumi)
175 > ##         if len(L1RatePredictions):
176 > ##             print "Expected Level 1 Rates:"
177 > ##         for key,val in L1RatePredictions.iteritems():
178 > ##             write("Prescale Column "+str(key)+":  "+str(round(val/1000,1))+" kHz")
179 > ##             if key == LastPSCol:
180 > ##                 write(' << taking data in this column')
181 > ##             write('\n')
182          
183      
184  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines