CMS 3D CMS Logo

Functions

lumiReport Namespace Reference

Functions

def toCSVConfHlt
def toCSVConfTrg
def toCSVLSBeam
def toCSVLSEffective
def toCSVLSHlt
def toCSVLSTrg
def toCSVLumiByLS
def toCSVLumiByLSXing
def toCSVOverview
def toCSVTotDelivered
def toCSVTotEffective
def toScreenConfHlt
def toScreenConfTrg
def toScreenLSBeam
def toScreenLSEffective
def toScreenLSHlt
def toScreenLSTrg
def toScreenLumiByLS
def toScreenNorm
def toScreenOverview
def toScreenTotDelivered
def toScreenTotEffective

Function Documentation

def lumiReport::toCSVConfHlt (   hltconfdata,
  filename,
  iresults = [],
  isverbose = False 
)
input:{runnumber,[(hltpath,l1seedexpr,l1bitname),...]}

Definition at line 1128 of file lumiReport.py.

01129                                                                   :
01130     '''
01131     input:{runnumber,[(hltpath,l1seedexpr,l1bitname),...]}
01132     '''
01133     result=[]
01134     for rline in iresults:
01135         result.append(rline)
01136     for run in sorted(hltconfdata):
01137         pathdata=hltconfdata[run]
01138         if pathdata is None:
01139             result.append([str(run),'n/a','n/a','n/a'])
01140             continue
01141         for thispathinfo in pathdata:
01142             thispath=thispathinfo[0]
01143             thisseed=thispathinfo[1]
01144             thisbit=thispathinfo[2]
01145             if not thisbit:
01146                 thisbit='n/a'
01147             result.append([str(run),thispath,thisseed,thisbit])
01148     fieldnames=['Run','hltpath','l1seedexpr','l1bit']
01149     assert(filename)
01150     if filename.upper()=='STDOUT':
01151         r=sys.stdout
01152         r.write(','.join(fieldnames)+'\n')
01153         for l in result:
01154             r.write(str(l)+'\n')
01155     else:
01156         r=csvReporter.csvReporter(filename)
01157         r.writeRow(fieldnames)
01158         r.writeRows(result)
        
def lumiReport::toCSVConfTrg (   trgconfdata,
  filename,
  iresults = [],
  isverbose = False 
)
input {run:[datasource,normbitname,[allbits]]}

Definition at line 949 of file lumiReport.py.

00950                                                                   :
00951     '''
00952     input {run:[datasource,normbitname,[allbits]]}
00953     '''
00954     result=[]
00955     fieldnames=['Run','source','bitnames']
00956     if isverbose:
00957         fieldnames.append('normbit')
00958     for rline in iresults:
00959         result.append(rline)
00960     for run in sorted(trgconfdata):
00961         rundata=trgconfdata[run]
00962         if rundata is None:
00963             ll=[run,'n/a','n/a']
00964             if isverbose:
00965                 ll.append('n/a')
00966             result.append(ll)            
00967             continue
00968         datasource=rundata[0]
00969         if datasource:
00970             datasource=datasource.split('/')[-1]
00971         normbit=rundata[1]
00972         bitdata=rundata[2]        
00973         bitnames=','.join(bitdata)
00974         if isverbose:
00975             result.append([run,datasource,bitnames,normbit])
00976         else:
00977             result.append([run,datasource,bitnames])
00978     assert(filename)
00979     if filename.upper()=='STDOUT':
00980         r=sys.stdout
00981         r.write(','.join(fieldnames)+'\n')
00982         for l in result:
00983             r.write(str(l)+'\n')
00984     else:
00985         r=csvReporter.csvReporter(filename)
00986         r.writeRow(fieldnames)
00987         r.writeRows(result)

def lumiReport::toCSVLSBeam (   beamdata,
  filename,
  resultlines,
  dumpIntensity = False,
  isverbose = False 
)
input: {run:[(lumilsnum(0),cmslsnum(1),beamstatus(2),beamenergy(3),beaminfolist(4)),..]}
beaminfolist:[(bxidx,b1,b2)]

Definition at line 1201 of file lumiReport.py.

01202                                                                                   :
01203     '''
01204     input: {run:[(lumilsnum(0),cmslsnum(1),beamstatus(2),beamenergy(3),beaminfolist(4)),..]}
01205     beaminfolist:[(bxidx,b1,b2)]
01206     '''
01207     result=[]
01208     fieldnames=['Run','LS','beamstatus','egev']
01209     if dumpIntensity:
01210         fieldnames.append('(bxidx,b1,b2)')
01211     for rline in resultlines:
01212         result.append(rline)        
01213     for run in sorted(beamdata):
01214         perrundata=beamdata[run]
01215         if perrundata is None:            
01216             ll=[str(run),'n/a','n/a']
01217             if dumpIntensity:
01218                 ll.extend('n/a')
01219             continue
01220         for lsdata in perrundata:
01221             lumilsnum=lsdata[0]
01222             cmslsnum=lsdata[1]
01223             beamstatus=lsdata[2]
01224             beamenergy=lsdata[3]
01225             if not dumpIntensity:
01226                 result.append([str(run),str(lumilsnum)+':'+str(cmslsnum),beamstatus,'%.2f'%beamenergy])
01227                 continue
01228             allbxinfo=lsdata[4]
01229             #print 'allbxinfo ',allbxinfo
01230             allbxresult=[]
01231             for thisbxinfo in allbxinfo:
01232                 thisbxresultStr='(n/a,n/a,n/a)'
01233                 bxidx=thisbxinfo[0]
01234                 b1=thisbxinfo[1]
01235                 b2=thisbxinfo[2]
01236                 thisbxresultStr=','.join(['%d'%bxidx,'%.3e'%b1,'%.3e'%b2])
01237                 allbxresult.append(thisbxresultStr)
01238             allbxresultStr=' '.join(allbxresult)
01239             result.append([str(run),str(lumilsnum)+':'+str(cmslsnum),beamstatus,'%.2f'%beamenergy,allbxresultStr])
01240     assert(filename)
01241     if filename.upper()=='STDOUT':
01242         r=sys.stdout
01243         r.write(','.join(fieldnames)+'\n')
01244         for l in result:
01245             r.write(str(l)+'\n')
01246     else:
01247         r=csvReporter.csvReporter(filename)
01248         r.writeRow(fieldnames)
01249         r.writeRows(result)
01250 
def lumiReport::toCSVLSEffective (   lumidata,
  filename,
  resultlines,
  scalefactor,
  isverbose 
)
input:  {run:[lumilsnum(0),cmslsnum(1),timestamp(2),beamstatus(3),beamenergy(4),deliveredlumi(5),recordedlumi(6),calibratedlumierror(7),{hltpath:[l1name,l1prescale,hltprescale,efflumi]}(8),bxdata(9),beamdata(10),fillnum(11)]}

Definition at line 513 of file lumiReport.py.

00514                                                                          :
00515     '''
00516     input:  {run:[lumilsnum(0),cmslsnum(1),timestamp(2),beamstatus(3),beamenergy(4),deliveredlumi(5),recordedlumi(6),calibratedlumierror(7),{hltpath:[l1name,l1prescale,hltprescale,efflumi]}(8),bxdata(9),beamdata(10),fillnum(11)]}
00517     '''
00518     result=[]#[run,ls,hltpath,l1bitname,hltpresc,l1presc,efflumi]
00519     for rline in resultlines:
00520         result.append(rline)
00521          
00522     for run in sorted(lumidata):#loop over runs
00523         rundata=lumidata[run]
00524         if rundata is None:
00525             result.append([str(run),'n/a','n/a','n/a','n/a','n/a','n/a','n/a'])
00526             continue
00527         fillnum=0
00528         if rundata[0][11]:
00529             fillnum=rundata[0][11]
00530         for lsdata in rundata:
00531             efflumiDict=lsdata[8]# this ls has no such path?
00532             if not efflumiDict:
00533                 continue
00534             cmslsnum=lsdata[1]
00535             recorded=lsdata[6]
00536             if not recorded:
00537                 recorded=0.0
00538             for hltpathname in sorted(efflumiDict):
00539                 pathdata=efflumiDict[hltpathname]
00540                 l1name=pathdata[0]
00541                 if l1name is None:
00542                     l1name='n/a'
00543                 else:
00544                     l1name=l1name.replace('"','')
00545                 l1prescale=pathdata[1]
00546                 hltprescale=pathdata[2]
00547                 lumival=pathdata[3]
00548                 if lumival is not None:
00549                     result.append([str(run)+':'+str(fillnum),cmslsnum,hltpathname,l1name,hltprescale,l1prescale,recorded*scalefactor,lumival*scalefactor])
00550                 else:
00551                     result.append([str(run)+':'+str(fillnum),cmslsnum,hltpathname,l1name,hltprescale,l1prescale,recorded*scalefactor,'n/a'])
00552     fieldnames = ['Run:Fill','LS','HLTpath','L1bit','HLTpresc','L1presc','Recorded(/ub)','Effective(/ub)']
00553     assert(filename)
00554     if filename.upper()=='STDOUT':
00555         r=sys.stdout
00556         r.write(','.join(fieldnames)+'\n')
00557         for l in result:
00558             r.write(str(l)+'\n')
00559     else:
00560         r=csvReporter.csvReporter(filename)
00561         r.writeRow(fieldnames)
00562         r.writeRows(result)

def lumiReport::toCSVLSHlt (   hltdata,
  filename,
  iresults = None,
  isverbose = False 
)
input:{runnumber:[(cmslsnum,[(hltpath,hltprescale,l1pass,hltaccept),...]),(cmslsnum,[])})}

Definition at line 1035 of file lumiReport.py.

01036                                                               :
01037     '''
01038     input:{runnumber:[(cmslsnum,[(hltpath,hltprescale,l1pass,hltaccept),...]),(cmslsnum,[])})}
01039     '''
01040     result=[]
01041     fieldnames=['Run','LS','hltpath,hltprescale']
01042     if isverbose:
01043         fieldnames[-1]+=',l1pass,hltaccept'
01044     for rline in iresults:
01045         result.append(rline)
01046     for run in sorted(hltdata):
01047         lsdata=hltdata[run]
01048         if lsdata is None:
01049             result.append([run,'n/a','n/a'])
01050             continue
01051         for thislsdata in lsdata:
01052             cmslsnum=thislsdata[0]
01053             bitsdata=thislsdata[1]
01054             allbitsresult=[]
01055             for mybit in bitsdata:
01056                 hltpath=mybit[0]
01057                 if not hltpath: continue
01058                 hltprescale=mybit[1]
01059                 if hltprescale is None:
01060                     hltprescale='n/a'
01061                 else:
01062                     hltprescale='%d'%hltprescale
01063                 if isverbose:
01064                     l1pass=mybit[2]
01065                     if l1pass is None:
01066                         l1pass='n/a'
01067                     else:
01068                         l1pass='%d'%l1pass
01069                     hltaccept=mybit[3]
01070                     if hltaccept is None:
01071                         hltaccept='n/a'
01072                     else:
01073                         hltaccept='%d'%hltaccept
01074                     mybitStr=','.join([hltpath,hltprescale,l1pass,hltaccept])
01075                 else:
01076                     mybitStr=','.join([hltpath,hltprescale])
01077                 allbitsresult.append(mybitStr)
01078             allbitsresult=';'.join(allbitsresult)
01079             result.append([run,cmslsnum,allbitsresult])
01080             
01081     assert(filename)
01082     if filename.upper()=='STDOUT':
01083         r=sys.stdout
01084         r.write(','.join(fieldnames)+'\n')
01085         for l in result:
01086             r.write(str(l)+'\n')
01087     else:
01088         r=csvReporter.csvReporter(filename)
01089         r.writeRow(fieldnames)
01090         r.writeRows(result)        
    
def lumiReport::toCSVLSTrg (   trgdata,
  filename,
  iresults = [],
  isverbose = False 
)
input:{run:[[cmslsnum,deadfrac,deadtimecount,bitzero_count,bitzero_prescale,[(name,count,presc),]],..]

Definition at line 875 of file lumiReport.py.

00876                                                             :
00877     '''
00878     input:{run:[[cmslsnum,deadfrac,deadtimecount,bitzero_count,bitzero_prescale,[(name,count,presc),]],..]
00879     '''
00880     result=[]
00881     fieldnames=['Run','LS','dfrac','dcount','bit,cout,presc']
00882     for rline in iresults:
00883         result.append(rline)
00884     for run in sorted(trgdata):
00885         rundata=trgdata[run]
00886         if rundata is None:
00887             ll=[run,'n/a','n/a','n/a',]
00888             if isverbose:
00889                 ll.append('n/a')
00890             result.append(ll)
00891             continue
00892         deadfrac=0.0
00893         bitdataStr='n/a'
00894         for lsdata in rundata:
00895             cmslsnum=lsdata[0]
00896             deadfrac=lsdata[1]
00897             dcount=lsdata[2]
00898             bitdata=lsdata[5]
00899             flatbitdata=[x[0]+',%d'%x[1]+',%d'%x[2] for x in bitdata if x[0]!='False']
00900             bitdataStr=';'.join(flatbitdata)
00901             if isverbose:                
00902                 result.append([run,cmslsnum,deadfrac,dcount,bitdataStr])
00903             else:
00904                 result.append([run,cmslsnum,deadfrac,dcount])
00905     assert(filename)
00906     if filename.upper()=='STDOUT':
00907         r=sys.stdout
00908         r.write(','.join(fieldnames)+'\n')
00909         for l in result:
00910             r.write(str(l)+'\n')
00911     else:
00912         r=csvReporter.csvReporter(filename)
00913         r.writeRow(fieldnames)
00914         r.writeRows(result)
    
def lumiReport::toCSVLumiByLS (   lumidata,
  filename,
  resultlines,
  scalefactor,
  isverbose 
)

Definition at line 382 of file lumiReport.py.

00383                                                                       :
00384     result=[]
00385     fieldnames=['Run:Fill','LS','UTCTime','Beam Status','E(GeV)','Delivered(/ub)','Recorded(/ub)']
00386     for rline in resultlines:
00387         result.append(rline)
00388         
00389     for run in sorted(lumidata):
00390         rundata=lumidata[run]
00391         if rundata is None:
00392             result.append([run,'n/a','n/a','n/a','n/a','n/a'])
00393             continue
00394         fillnum=0
00395         if rundata[0][10]:
00396             fillnum=rundata[0][10]
00397         for lsdata in rundata:
00398             lumilsnum=lsdata[0]
00399             cmslsnum=lsdata[1]
00400             ts=lsdata[2]
00401             bs=lsdata[3]
00402             begev=lsdata[4]
00403             deliveredlumi=lsdata[5]
00404             recordedlumi=lsdata[6]
00405             if cmslsnum!=0:
00406                 result.append([str(run)+':'+str(fillnum),str(lumilsnum)+':'+str(cmslsnum),ts.strftime('%m/%d/%y %H:%M:%S'),bs,begev,deliveredlumi*scalefactor,recordedlumi*scalefactor])
00407     sortedresult=sorted(result,key=lambda x : int(x[0].split(':')[0]))
00408     assert(filename)
00409     if filename.upper()=='STDOUT':
00410         r=sys.stdout
00411         r.write(','.join(fieldnames)+'\n')
00412         for l in sortedresult:
00413             r.write(str(l)+'\n')
00414     else:
00415         r=csvReporter.csvReporter(filename)
00416         r.writeRow(fieldnames)
00417         r.writeRows(sortedresult)

def lumiReport::toCSVLumiByLSXing (   lumidata,
  scalefactor,
  filename 
)
input:{run:[lumilsnum(0),cmslsnum(1),timestamp(2),beamstatus(3),beamenergy(4),deliveredlumi(5),recordedlumi(6),calibratedlumierror(7),bxdata(8),beamdata(9),fillnum(10)]}
output:
fieldnames=['Run:Fill','CMSLS','Delivered(/ub)','Recorded(/ub)','BX']

Definition at line 794 of file lumiReport.py.

00795                                                     :
00796     '''
00797     input:{run:[lumilsnum(0),cmslsnum(1),timestamp(2),beamstatus(3),beamenergy(4),deliveredlumi(5),recordedlumi(6),calibratedlumierror(7),bxdata(8),beamdata(9),fillnum(10)]}
00798     output:
00799     fieldnames=['Run:Fill','CMSLS','Delivered(/ub)','Recorded(/ub)','BX']
00800     '''
00801     result=[]
00802     assert(filename)
00803     fieldnames=['run:fill','ls','UTCTime','delivered(/ub)','recorded(/ub)','bx']
00804     for run in sorted(lumidata):
00805         rundata=lumidata[run]
00806         if rundata is None:
00807             result.append([run,'n/a','n/a','n/a','n/a','n/a'])
00808             continue
00809         fillnum=0
00810         if rundata[0][10]:
00811             fillnum=rundata[0][10]
00812         for lsdata in rundata:
00813             cmslsnum=lsdata[1]
00814             ts=lsdata[2]
00815             if cmslsnum==0:
00816                 continue
00817             deliveredlumi=lsdata[5]
00818             recordedlumi=lsdata[6]
00819             (bxidxlist,bxvaluelist,bxerrorlist)=lsdata[8]
00820             bxresult=[]
00821             if bxidxlist and bxvaluelist:
00822                 bxinfo=CommonUtil.transposed([bxidxlist,bxvaluelist])
00823                 bxresult=CommonUtil.flatten([str(run)+':'+str(fillnum),cmslsnum,ts.strftime('%m/%d/%y %H:%M:%S'),deliveredlumi*scalefactor,recordedlumi*scalefactor,bxinfo])
00824                 result.append(bxresult)
00825             else:
00826                 result.append([str(run)+':'+str(fillnum),cmslsnum,ts.strftime('%m/%d/%y %H:%M:%S'),deliveredlumi*scalefactor,recordedlumi*scalefactor])
00827     r=None
00828     if filename.upper()=='STDOUT':
00829         r=sys.stdout
00830         r.write(','.join(fieldnames)+'\n')
00831         for l in result:
00832             r.write(str(l)+'\n')
00833     else:
00834         r=csvReporter.csvReporter(filename)
00835         r.writeRow(fieldnames)
00836         r.writeRows(result)
    
def lumiReport::toCSVOverview (   lumidata,
  filename,
  resultlines,
  scalefactor,
  isverbose 
)
input:
lumidata {run:[lumilsnum(0),cmslsnum(1),timestamp(2),beamstatus(3),beamenergy(4),deliveredlumi(5),recordedlumi(6),calibratedlumierror(7),(bxidx,bxvalues,bxerrs)(8),(bxidx,b1intensities,b2intensities)(9),fillnum(10)]}
resultlines [[resultrow1],[resultrow2],...,] existing result row

Definition at line 237 of file lumiReport.py.

00238                                                                       :
00239     '''
00240     input:
00241     lumidata {run:[lumilsnum(0),cmslsnum(1),timestamp(2),beamstatus(3),beamenergy(4),deliveredlumi(5),recordedlumi(6),calibratedlumierror(7),(bxidx,bxvalues,bxerrs)(8),(bxidx,b1intensities,b2intensities)(9),fillnum(10)]}
00242     resultlines [[resultrow1],[resultrow2],...,] existing result row
00243     '''
00244     result=[]
00245     fieldnames = ['Run:Fill', 'DeliveredLS', 'Delivered(/ub)','SelectedLS','Recorded(/ub)']
00246     r=csvReporter.csvReporter(filename)
00247     for rline in resultlines:
00248         result.append(rline)
00249         
00250     for run in lumidata.keys():
00251         lsdata=lumidata[run]
00252         if lsdata is None:
00253             result.append([run,'n/a','n/a','n/a','n/a'])
00254             continue
00255         nls=len(lsdata)
00256         fillnum=0
00257         if lsdata[0][10]:
00258             fillnum=lsdata[0][10]
00259         deliveredData=[x[5] for x in lsdata]
00260         recordedData=[x[6] for x in lsdata if x[6] is not None]
00261         totdeliveredlumi=0.0
00262         totrecordedlumi=0.0
00263         if len(deliveredData)!=0:
00264             totdeliveredlumi=sum(deliveredData)
00265         if len(recordedData)!=0:
00266             totrecordedlumi=sum(recordedData)
00267         selectedcmsls=[x[1] for x in lsdata if x[1]!=0]
00268         if len(selectedcmsls)==0:
00269             selectedlsStr='n/a'
00270         else:
00271             selectedlsStr = CommonUtil.splitlistToRangeString(selectedcmsls)
00272         result.append([str(run)+':'+str(fillnum),nls,totdeliveredlumi*scalefactor,selectedlsStr,totrecordedlumi*scalefactor])
00273     sortedresult=sorted(result,key=lambda x : int(x[0].split(':')[0]))
00274     
00275     r=None
00276     assert(filename)
00277     if filename.upper()=='STDOUT':
00278         r=sys.stdout
00279         r.write(','.join(fieldnames)+'\n')
00280         for l in sortedresult:
00281             r.write(str(l)+'\n')
00282     else:
00283         r=csvReporter.csvReporter(filename)
00284         r.writeRow(fieldnames)
        r.writeRows(sortedresult)
def lumiReport::toCSVTotDelivered (   lumidata,
  filename,
  resultlines,
  scalefactor,
  isverbose 
)
input:  {run:[lumilsnum(0),cmslsnum(1),timestamp(2),beamstatus(3),beamenergy(4),deliveredlumi(5),calibratedlumierror(6),(bxidx,bxvalues,bxerrs)(7),(bxidx,b1intensities,b2intensities)(8),fillnum(9)]}

Definition at line 99 of file lumiReport.py.

00100                                                                           :
00101     '''
00102     input:  {run:[lumilsnum(0),cmslsnum(1),timestamp(2),beamstatus(3),beamenergy(4),deliveredlumi(5),calibratedlumierror(6),(bxidx,bxvalues,bxerrs)(7),(bxidx,b1intensities,b2intensities)(8),fillnum(9)]}
00103     '''
00104     result=[]
00105     fieldnames = ['Run:Fill', 'N_LS', 'Delivered(/ub)','UTCTime','E(GeV)']
00106     if isverbose:
00107         fieldnames.append('Selected LS')
00108     for rline in resultlines:
00109         result.append(rline)
00110     for run in lumidata.keys():
00111         lsdata=lumidata[run]
00112         if lsdata is None:
00113             result.append([run,'n/a','n/a','n/a','n/a'])
00114             if isverbose:
00115                 result.extend(['n/a'])
00116             continue
00117         nls=len(lsdata)
00118         fillnum=0
00119         if lsdata[0][9]:
00120             fillnum=lsdata[0][9]
00121         totlumival=sum([x[5] for x in lsdata])
00122         beamenergyPerLS=[float(x[4]) for x in lsdata]
00123         avgbeamenergy=0.0
00124         if len(beamenergyPerLS):
00125             avgbeamenergy=sum(beamenergyPerLS)/len(beamenergyPerLS)
00126         runstarttime='n/a'
00127         if nls!=0:
00128             runstarttime=lsdata[0][2]
00129             runstarttime=runstarttime.strftime("%m/%d/%y %H:%M:%S")
00130         if isverbose:
00131             selectedls='n/a'
00132             if nls:
00133                 selectedls=[(x[0],x[1]) for x in lsdata]
00134             result.append([str(run)+':'+str(fillnum),nls,totlumival*scalefactor,runstarttime,avgbeamenergy, str(selectedls)])
00135         else:
00136             result.append([str(run)+':'+str(fillnum),nls,totlumival*scalefactor,runstarttime,avgbeamenergy])
00137     sortedresult=sorted(result,key=lambda x : int(x[0].split(':')[0]))
00138     r=None
00139     assert(filename)
00140     if filename.upper()=='STDOUT':
00141         r=sys.stdout
00142         r.write(','.join(fieldnames)+'\n')
00143         for l in sortedresult:
00144             r.write(str(l)+'\n')
00145     else:
00146         r=csvReporter.csvReporter(filename)
00147         r.writeRow(fieldnames)
00148         r.writeRows(sortedresult)

def lumiReport::toCSVTotEffective (   lumidata,
  filename,
  resultlines,
  scalefactor,
  isverbose 
)
input:  {run:[lumilsnum(0),triggeredls(1),timestamp(2),beamstatus(3),beamenergy(4),deliveredlumi(5),recordedlumi(6),calibratedlumierror(7),{hltpath:[l1name,l1prescale,hltprescale,efflumi]}(8),bxdata(9),beamdata(10),fillnum(11)]}
screen Run,SelectedLS,Recorded,HLTPath,L1Bit,Effective

Definition at line 700 of file lumiReport.py.

00701                                                                           :
00702     '''
00703     input:  {run:[lumilsnum(0),triggeredls(1),timestamp(2),beamstatus(3),beamenergy(4),deliveredlumi(5),recordedlumi(6),calibratedlumierror(7),{hltpath:[l1name,l1prescale,hltprescale,efflumi]}(8),bxdata(9),beamdata(10),fillnum(11)]}
00704     screen Run,SelectedLS,Recorded,HLTPath,L1Bit,Effective
00705     '''
00706     result=[]#[run,selectedlsStr,recorded,hltpath,l1bitname,efflumi]
00707     totdict={}#{hltpath:[nls,toteff]}
00708     selectedcmsls=[]
00709     recordedPerpathPerrun={}#{path:{run:recorded}}
00710     selectedPerpathPerrun={}#{path:{run:totselected}}
00711     for rline in resultlines:
00712         result.append(rline)
00713     for run in sorted(lumidata):#loop over runs
00714         hprescdict={}
00715         lprescdict={}
00716         rundata=lumidata[run]
00717         if rundata is None:
00718             result.append([str(run),'n/a','n/a','n/a','n/a','n/a'])
00719             continue
00720         fillnum=0
00721         if rundata[0][11]:
00722             fillnum=rundata[0][11]
00723         selectedcmsls=[x[1] for x in rundata if x[1]!=0]
00724         totefflumiDict={}
00725         totrecorded=0.0
00726         toteffective=0.0
00727         pathmap={}#{hltpathname:1lname}
00728         for lsdata in rundata:
00729             cmslsnum=lsdata[1]
00730             efflumiDict=lsdata[8]# this ls has no such path?
00731             recordedlumi=lsdata[6]
00732             totrecorded+=recordedlumi
00733             if not efflumiDict:
00734                 if cmslsnum in selectedcmsls:
00735                     selectedcmsls.remove(cmslsnum)
00736                 continue
00737             for hltpathname,pathdata in efflumiDict.items():
00738                 if not totefflumiDict.has_key(hltpathname):
00739                     totefflumiDict[hltpathname]=0.0
00740                     pathmap[hltpathname]='n/a'
00741                 l1name=pathdata[0]
00742                 l1presc=pathdata[1]
00743                 hltpresc=pathdata[2]
00744                 lumival=pathdata[3]
00745                 recordedPerpathPerrun.setdefault(hltpathname,{})
00746                 selectedPerpathPerrun.setdefault(hltpathname,{})
00747                 if not totdict.has_key(hltpathname):
00748                     totdict[hltpathname]=[0,0.0]
00749                 if l1presc is None or hltpresc is None:#if found all null prescales and if it is in the selectedcmsls, remove it because incomplete
00750                     if cmslsnum in selectedcmsls:
00751                         selectedcmsls.remove(cmslsnum)
00752                 else:
00753                     #recordedlumi=lsdata[6]
00754                     #totrecorded+=recordedlumi
00755                     if not hprescdict.has_key(hltpathname):
00756                         hprescdict[hltpathname]=[]
00757                     hprescdict[hltpathname].append(hltpresc)
00758                     if not lprescdict.has_key(l1name):
00759                         lprescdict[l1name]=[]
00760                     lprescdict[l1name].append(l1presc)
00761                     totdict[hltpathname][0]+=1
00762                     if lumival:
00763                         totdict[hltpathname][1]+=lumival
00764                         totefflumiDict[hltpathname]+=lumival
00765                         pathmap[hltpathname]=l1name.replace('\"','')
00766                     recordedPerpathPerrun[hltpathname][run]=totrecorded
00767                     selectedPerpathPerrun[hltpathname][run]=len(selectedcmsls)
00768         if len(selectedcmsls)==0:
00769             selectedlsStr='n/a'
00770         else:
00771             selectedlsStr= CommonUtil.splitlistToRangeString(selectedcmsls)
00772             
00773         for name in sorted(totefflumiDict):
00774             lname=pathmap[name]
00775             if lname=='n/a':
00776                 continue
00777             totrecordedinrun=recordedPerpathPerrun[name][run]
00778             hprescs=list(set(hprescdict[name]))
00779             lprescs=list(set(lprescdict['"'+lname+'"']))
00780             hprescStr='('+','.join(['%d'%(x) for x in hprescs])+')'
00781             lprescStr='('+','.join(['%d'%(x) for x in lprescs])+')'
00782             result.append([str(run)+':'+str(fillnum),selectedlsStr,totrecordedinrun*scalefactor,name+hprescStr,lname+lprescStr,totefflumiDict[name]*scalefactor])
00783     fieldnames=['Run:Fill','SelectedLS','Recorded','HLTpath(Presc)','L1bit(Presc)','Effective(/ub)']
00784     assert(filename)
00785     if filename.upper()=='STDOUT':
00786         r=sys.stdout
00787         r.write(','.join(fieldnames)+'\n')
00788         for l in result:
00789             r.write(str(l)+'\n')
00790     else:
00791         r=csvReporter.csvReporter(filename)
00792         r.writeRow(fieldnames)
00793         r.writeRows(result)
        
def lumiReport::toScreenConfHlt (   hltconfdata,
  iresults = [],
  isverbose = False 
)
input : {runnumber,[(hltpath,l1seedexpr,l1bitname),...]}

Definition at line 1091 of file lumiReport.py.

01092                                                             :
01093     '''
01094     input : {runnumber,[(hltpath,l1seedexpr,l1bitname),...]}
01095     '''
01096     labels=[('Run','hltpath','l1seedexpr','l1bit')]
01097     result=[]
01098     for r in iresults:
01099         pp=r[1]
01100         pp=' '.join([pp[i:i+25] for i in range(0,len(pp),25)])
01101         sdepr=r[2]
01102         sdepr=' '.join([sdepr[i:i+25] for i in range(0,len(sdepr),25)])
01103         lb=r[3]
01104         lb=' '.join([lb[i:i+25] for i in range(0,len(lb),25)])
01105         result.append([r[0],pp,sdepr,lb])
01106     for run in sorted(hltconfdata):
01107         pathdata=hltconfdata[run]
01108         if pathdata is None:
01109             result.append([str(run),'n/a','n/a','n/a'])
01110             continue
01111         for thispathinfo in pathdata:
01112             thispath=thispathinfo[0]
01113             thispath=' '.join([thispath[i:i+25] for i in range(0,len(thispath),25)])
01114             thisseed=thispathinfo[1]
01115             thisseed=''.join(thisseed.split(' '))
01116             thisseed=' '.join([thisseed[i:i+25] for i in range(0,len(thisseed),25)])
01117             thisbit=thispathinfo[2]
01118             if not thisbit:
01119                 thisbit='n/a'
01120             else:
01121                 thisbit=' '.join([thisbit[i:i+25] for i in range(0,len(thisbit),25)])
01122             result.append([str(run),thispath,thisseed,thisbit])
01123     print ' ==  = '
01124     print tablePrinter.indent (labels+result, hasHeader = True, separateRows = False,
01125                                prefix = '| ', postfix = ' |', justify = 'left',
01126                                delim = ' | ', wrapfunc = lambda x: wrap_onspace(x,25) )
01127 

def lumiReport::toScreenConfTrg (   trgconfdata,
  iresults = [],
  isverbose = False 
)
input:{run:[datasource,normbitname,[allbits]]}

Definition at line 915 of file lumiReport.py.

00916                                                             :
00917     '''
00918     input:{run:[datasource,normbitname,[allbits]]}
00919     '''
00920     if isverbose:
00921         labels=[('Run','source','bitnames','normbit')]
00922     else:
00923         labels=[('Run','source','bitnames')]
00924 
00925     result=[]
00926     for r in iresults:
00927         result.append(r)
00928     for  run in sorted(trgconfdata):
00929         if trgconfdata[run] is None:
00930             ll=[str(run),'n/a','n/a']
00931             if isverbose:
00932                 ll.append('n/a')
00933             result.append(ll)
00934             continue
00935         source=trgconfdata[run][0]
00936         source=source.split('/')[-1]
00937         normbit=trgconfdata[run][1]
00938         allbits=trgconfdata[run][2]
00939         bitnames=', '.join(allbits)
00940         if isverbose:
00941             result.append([str(run),source,bitnames,normbit])
00942         else:
00943             result.append([str(run),source,bitnames])
00944 
00945     print ' ==  = '
00946     print tablePrinter.indent (labels+result, hasHeader = True, separateRows = False,
00947                                prefix = '| ', postfix = ' |', justify = 'left',
00948                                delim = ' | ', wrapfunc = lambda x: wrap_onspace_strict(x,60) )

def lumiReport::toScreenLSBeam (   beamdata,
  iresults = [],
  dumpIntensity = False,
  isverbose = False 
)
input: {run:[(lumilsnum(0),cmslsnum(1),beamstatus(2),beamenergy(3),beaminfolist(4)),..]}
beaminfolist:[(bxidx,b1,b2)]

Definition at line 1159 of file lumiReport.py.

01160                                                                             :
01161     '''
01162     input: {run:[(lumilsnum(0),cmslsnum(1),beamstatus(2),beamenergy(3),beaminfolist(4)),..]}
01163     beaminfolist:[(bxidx,b1,b2)]
01164     '''
01165     labels=[('Run','LS','beamstatus','egev')]
01166     if dumpIntensity:
01167         labels=[('Run','LS','beamstatus','egev','(bxidx,b1,b2)')]
01168     result=[]
01169     for rline in iresults:
01170         result.append(rline)
01171     for run in sorted(beamdata):
01172         perrundata=beamdata[run]
01173         if perrundata is None:            
01174             ll=[str(run),'n/a','n/a']
01175             if dumpIntensity:
01176                 ll.extend('n/a')
01177             continue
01178         for lsdata in perrundata:
01179             lumilsnum=lsdata[0]
01180             cmslsnum=lsdata[1]
01181             beamstatus=lsdata[2]
01182             beamenergy=lsdata[3]
01183             if not dumpIntensity:
01184                 result.append([str(run),str(lumilsnum)+':'+str(cmslsnum),beamstatus,'%.2f'%beamenergy])
01185                 continue
01186             allbxinfo=lsdata[4]
01187             allbxresult=[]
01188             for thisbxinfo in allbxinfo:
01189                 thisbxresultStr='(n/a,n/a,n/a)'
01190                 bxidx=thisbxinfo[0]
01191                 b1=thisbxinfo[1]
01192                 b2=thisbxinfo[2]
01193                 thisbxresultStr=','.join(['%d'%bxidx,'%.3e'%b1,'%.3e'%b2])
01194                 allbxresult.append(thisbxresultStr)
01195             allbxresultStr=' '.join(allbxresult)
01196             result.append([str(run),str(lumilsnum)+':'+str(cmslsnum),beamstatus,'%.2f'%beamenergy,allbxresultStr])
01197     print ' ==  = '
01198     print tablePrinter.indent (labels+result, hasHeader = True, separateRows = False,
01199                                prefix = '| ', postfix = ' |', justify = 'left',
01200                                delim = ' | ', wrapfunc = lambda x: wrap_onspace(x,25) )

def lumiReport::toScreenLSEffective (   lumidata,
  resultlines,
  scalefactor,
  isverbose 
)
input:  {run:[lumilsnum(0),cmslsnum(1),timestamp(2),beamstatus(3),beamenergy(4),deliveredlumi(5),recordedlumi(6),calibratedlumierror(7),{hltpath:[l1name,l1prescale,hltprescale,efflumi]}(8),bxdata(9),beamdata(10),fillnum(11)]}

Definition at line 418 of file lumiReport.py.

00419                                                                    :
00420     '''
00421     input:  {run:[lumilsnum(0),cmslsnum(1),timestamp(2),beamstatus(3),beamenergy(4),deliveredlumi(5),recordedlumi(6),calibratedlumierror(7),{hltpath:[l1name,l1prescale,hltprescale,efflumi]}(8),bxdata(9),beamdata(10),fillnum(11)]}
00422     '''
00423     result=[]#[run,ls,hltpath,l1bitname,hltpresc,l1presc,efflumi]
00424     totalrow=[]
00425     totSelectedLS=0
00426     totRecorded=0.0
00427     totEffective=0
00428 
00429     totOldSelectedLS=0
00430     totOldRecorded=0.0
00431     totOldEffective=0.0
00432 
00433     maxlslumi = 0.0
00434     for rline in resultlines:
00435         myls=rline[1]
00436         if myls!='n/a':
00437             totOldSelectedLS+=1
00438         myrecorded=rline[6]
00439         if myrecorded!='n/a':
00440             myrecorded=float(rline[6])
00441             if myrecorded>maxlslumi:maxlslumi=myrecorded
00442             totOldRecorded+=myrecorded
00443             rline[6]=myrecorded
00444         myeff=rline[7]
00445         if myeff!='n/a':
00446             myeff=float(rline[7])
00447             totOldEffective+=myeff
00448             rline[7]=myeff
00449         result.append(rline)
00450         
00451     totrecordedlumi=0.0
00452     totefflumi=0.0
00453    
00454     for run in lumidata.keys():#loop over runs
00455         rundata=lumidata[run]
00456         if rundata is None:
00457             result.append([str(run),'n/a','n/a','n/a','n/a','n/a','n/a','n/a'])
00458             continue
00459         fillnum=0
00460         if rundata[0][11]:
00461             fillnum=rundata[0][11]
00462         for lsdata in rundata:
00463             efflumiDict=lsdata[8]# this ls has no such path?
00464             if not efflumiDict:
00465                 continue
00466             cmslsnum=lsdata[1]
00467             recorded=lsdata[6]
00468             totSelectedLS+=1
00469             if not recorded:
00470                 recorded=0.0
00471             if recorded>maxlslumi:maxlslumi=recorded
00472             totRecorded+=recorded
00473             for hltpathname in sorted(efflumiDict):
00474                 pathdata=efflumiDict[hltpathname]
00475                 l1name=pathdata[0]
00476                 if l1name is None:
00477                     l1name='n/a'
00478                 else:
00479                     l1name=l1name.replace('"','')
00480                 l1prescale=pathdata[1]
00481                 hltprescale=pathdata[2]
00482                 lumival=pathdata[3]
00483                 if lumival is not None:
00484                     result.append([str(run)+':'+str(fillnum),str(cmslsnum),hltpathname,l1name,str(hltprescale),str(l1prescale),(recorded),(lumival)])
00485                     totEffective+=lumival
00486                 else:
00487                     result.append([str(run)+':'+str(fillnum),str(cmslsnum),hltpathname,l1name,str(hltprescale),str(l1prescale),(recorded),'n/a'])
00488     (totrecordedlumi,recordedlumiunit)=CommonUtil.guessUnit((totRecorded+totOldRecorded)*scalefactor)
00489     (totefflumi,efflumiunit)=CommonUtil.guessUnit((totEffective+totOldEffective)*scalefactor)
00490     #guess ls lumi unit
00491     (lsunitstring,unitdenomitor)=CommonUtil.lumiUnitForPrint(maxlslumi*scalefactor)
00492     labels = [('Run:Fill','LS','HLTpath','L1bit','HLTpresc','L1presc','Recorded('+lsunitstring+')','Effective('+lsunitstring+')')]
00493     sortedresult=sorted(result,key=lambda x : int(x[0].split(':')[0]))
00494     perlsresult=[]
00495     for entry in sortedresult:
00496         reclumi=entry[6]
00497         if reclumi!='n/a':
00498             reclumi='%.3f'%float(float(reclumi*scalefactor)/float(unitdenomitor))        
00499         efflumi=entry[7]
00500         if efflumi!='n/a':
00501             efflumi='%.3f'%float(float(efflumi*scalefactor)/float(unitdenomitor))
00502         perlsresult.append([entry[0],entry[1],entry[2],entry[3],entry[4],entry[5],reclumi,efflumi])
00503     print ' ==  = '
00504     print tablePrinter.indent (labels+perlsresult, hasHeader = True, separateRows = False,
00505                                prefix = '| ', postfix = ' |', justify = 'right',
00506                                delim = ' | ', wrapfunc = lambda x: wrap_onspace_strict(x,25) )
00507     totalrow.append([str(totSelectedLS+totOldSelectedLS),'%.3f'%(totrecordedlumi),'%.3f'%(totefflumi)])
00508     lastrowlabels = [ ('Selected LS','Recorded('+recordedlumiunit+')','Effective('+efflumiunit+')')]
00509     print ' ==  =  Total : '
00510     print tablePrinter.indent (lastrowlabels+totalrow, hasHeader = True, separateRows = False, prefix = '| ',
00511                                postfix = ' |', justify = 'right', delim = ' | ',
00512                                wrapfunc = lambda x: wrap_onspace (x, 20))    

def lumiReport::toScreenLSHlt (   hltdata,
  iresults = [],
  isverbose = False 
)
input:{runnumber:[(cmslsnum,[(hltpath,hltprescale,l1pass,hltaccept),...]),(cmslsnum,[])})}

Definition at line 988 of file lumiReport.py.

00989                                                       :
00990     '''
00991     input:{runnumber:[(cmslsnum,[(hltpath,hltprescale,l1pass,hltaccept),...]),(cmslsnum,[])})}
00992     '''
00993     result=[]
00994     for r in iresults:
00995         result.append(r)
00996     for run in hltdata.keys():
00997         if hltdata[run] is None:            
00998             ll=[str(run),'n/a','n/a']
00999             continue
01000         perrundata=hltdata[run]
01001         for lsdata in perrundata:
01002             cmslsnum=lsdata[0]
01003             allpathinfo=lsdata[1]
01004             allpathresult=[]
01005             for thispathinfo in allpathinfo:
01006                 thispathname=thispathinfo[0]
01007                 thispathpresc=thispathinfo[1]
01008                 thisl1pass=None
01009                 thishltaccept=None
01010                 thispathresult=[]
01011                 thispathresult.append(thispathname)
01012                 thispathresult.append('%d'%thispathpresc)
01013                 if isverbose:
01014                     if thispathinfo[2] :
01015                         thisl1pass=thispathinfo[2]
01016                         thispathresult.append('%d'%thisl1pass)
01017                     else:
01018                         thispathresult.append('n/a')
01019                     if thispathinfo[3]:
01020                         thishltaccept=thispathinfo[3]
01021                         thispathresult.append('%d'%thishltaccept)
01022                     else:
01023                         thispathresult.append('n/a')
01024                 thispathresultStr='('+','.join(thispathresult)+')'
01025                 allpathresult.append(thispathresultStr)
01026             result.append([str(run),str(cmslsnum),', '.join(allpathresult)])
01027     print ' ==  = '
01028     if isverbose:
01029         labels = [('Run', 'LS', '(hltpath,presc)')]
01030     else:
01031         labels = [('Run', 'LS', '(hltpath,presc,l1pass,hltaccept)')]
01032     print tablePrinter.indent (labels+result, hasHeader = True, separateRows = False,
01033                                prefix = '| ', postfix = ' |', justify = 'left',
01034                                delim = ' | ', wrapfunc = lambda x: wrap_onspace (x,70) )
    
def lumiReport::toScreenLSTrg (   trgdata,
  iresults = [],
  isverbose = False 
)
input:{run:[[cmslsnum,deadfrac,deadtimecount,bitzero_count,bitzero_prescale,[(name,count,presc),]],..]

Definition at line 837 of file lumiReport.py.

00838                                                       :
00839     '''
00840     input:{run:[[cmslsnum,deadfrac,deadtimecount,bitzero_count,bitzero_prescale,[(name,count,presc),]],..]
00841     '''
00842     result=[]
00843     for r in iresults:
00844         result.append(r)
00845     for run in trgdata.keys():
00846         if trgdata[run] is None:
00847             ll=[str(run),'n/a','n/a','n/a']
00848             if isverbose:
00849                 ll.append('n/a')
00850             result.append(ll)
00851             continue
00852         perrundata=trgdata[run]
00853         deadfrac=0.0
00854         bitdataStr='n/a'
00855         for lsdata in perrundata:
00856             cmslsnum=lsdata[0]
00857             deadfrac=lsdata[1]
00858             deadcount=lsdata[2]
00859             bitdata=lsdata[5]# already sorted by name
00860             flatbitdata=["("+x[0]+',%d'%x[1]+',%d'%x[2]+")" for x in bitdata if x[0]!='False']
00861             bitdataStr=', '.join(flatbitdata)
00862             #print 'bitdataStr ',bitdataStr
00863             if isverbose:
00864                 result.append([str(run),str(cmslsnum),'%.4f'%(deadfrac),'%d'%deadcount,bitdataStr])
00865             else:
00866                 result.append([str(run),str(cmslsnum),'%.4f'%(deadfrac),'%d'%deadcount])
00867     print ' ==  = '
00868     if isverbose:
00869         labels = [('Run', 'LS', 'dfrac','dcount','(bit,count,presc)')]
00870     else:
00871         labels = [('Run', 'LS', 'dfrac','dcount')]
00872     print tablePrinter.indent (labels+result, hasHeader = True, separateRows = False,
00873                                prefix = '| ', postfix = ' |', justify = 'left',
00874                                delim = ' | ', wrapfunc = lambda x: wrap_onspace (x,70) )
    
def lumiReport::toScreenLumiByLS (   lumidata,
  resultlines,
  scalefactor,
  isverbose 
)
input:
lumidata {run:[lumilsnum(0),cmslsnum(1),timestamp(2),beamstatus(3),beamenergy(4),deliveredlumi(5),recordedlumi(6),calibratedlumierror(7),(bxidx,bxvalues,bxerrs)(8),(bxidx,b1intensities,b2intensities)(9),fillnum(10)]}
resultlines [[resultrow1],[resultrow2],...,] existing result row

Definition at line 285 of file lumiReport.py.

00286                                                                 :
00287     '''
00288     input:
00289     lumidata {run:[lumilsnum(0),cmslsnum(1),timestamp(2),beamstatus(3),beamenergy(4),deliveredlumi(5),recordedlumi(6),calibratedlumierror(7),(bxidx,bxvalues,bxerrs)(8),(bxidx,b1intensities,b2intensities)(9),fillnum(10)]}
00290     resultlines [[resultrow1],[resultrow2],...,] existing result row
00291     '''
00292     result=[]
00293     totalrow = []
00294     
00295     totalDeliveredLS = 0
00296     totalSelectedLS = 0
00297     totalDelivered = 0.0
00298     totalRecorded = 0.0
00299 
00300     totOldDeliveredLS = 0
00301     totOldSelectedLS = 0
00302     totOldDelivered = 0.0
00303     totOldRecorded = 0.0
00304 
00305     maxlslumi = 0.0
00306     for rline in resultlines:
00307         myls=rline[1]
00308         if myls!='n/a':
00309             [luls,cmls]=myls.split(':')
00310             totOldDeliveredLS+=1
00311             if cmls!='0':
00312                 totOldSelectedLS+=1
00313         dl=rline[5]
00314         if rline[5]!='n/a':
00315             dl=float(rline[5])#delivered in /ub
00316             if dl>maxlslumi: maxlslumi=dl
00317             rline[5]=dl
00318             totOldDelivered+=dl
00319         rl=rline[6]
00320         if rline[6]!='n/a':
00321            rl=float(rline[6])#recorded in /ub
00322            rline[6]=rl
00323            totOldRecorded+=rl
00324         result.append(rline)
00325         
00326     for run in lumidata.keys():
00327         rundata=lumidata[run]
00328         if rundata is None:
00329             result.append([str(run),'n/a','n/a','n/a','n/a','n/a','n/a'])
00330             continue
00331         fillnum=0
00332         if rundata[0][10]:
00333             fillnum=rundata[0][10]
00334         for lsdata in rundata:
00335             lumilsnum=lsdata[0]
00336             cmslsnum=lsdata[1]#triggered ls
00337             ts=lsdata[2]
00338             bs=lsdata[3]
00339             begev=lsdata[4]
00340             deliveredlumi=lsdata[5]            
00341             if deliveredlumi>maxlslumi: maxlslumi=deliveredlumi
00342             recordedlumi=lsdata[6]
00343             if cmslsnum!=0:               
00344                 result.append([str(run)+':'+str(fillnum),str(lumilsnum)+':'+str(cmslsnum),ts.strftime('%m/%d/%y %H:%M:%S'),bs,'%.1f'%begev,(deliveredlumi),(recordedlumi)])
00345             totalDelivered+=deliveredlumi
00346             totalRecorded+=recordedlumi
00347             totalDeliveredLS+=1
00348             if(cmslsnum!=0):
00349                 totalSelectedLS+=1
00350     #guess ls lumi unit
00351     (lsunitstring,unitdenomitor)=CommonUtil.lumiUnitForPrint(maxlslumi*scalefactor)
00352     labels = [ ('Run:Fill','LS','UTCTime','Beam Status','E(GeV)','Delivered('+lsunitstring+')','Recorded('+lsunitstring+')') ]
00353     sortedresult=sorted(result,key=lambda x : int(x[0].split(':')[0]))
00354     perlsresult=[]
00355     for entry in sortedresult:
00356         delumi=entry[5]
00357         if delumi!='n/a':
00358             delumi='%.3f'%float(float(delumi*scalefactor)/float(unitdenomitor))        
00359         reclumi=entry[6]
00360         if reclumi!='n/a':
00361             reclumi='%.3f'%float(float(reclumi*scalefactor)/float(unitdenomitor))
00362         perlsresult.append([entry[0],entry[1],entry[2],entry[3],entry[4],delumi,reclumi])
00363     totdeliveredlumi=0.0
00364     deliveredlumiunit='/ub'
00365     #if (totalDelivered+totOldDelivered)!=0:
00366     (totdeliveredlumi,deliveredlumiunit)=CommonUtil.guessUnit((totalDelivered+totOldDelivered)*scalefactor)
00367     totrecordedlumi=0.0
00368     recordedlumiunit='/ub'
00369     #if (totalRecorded+totOldRecorded)!=0:
00370     (totrecordedlumi,recordedlumiunit)=CommonUtil.guessUnit((totalRecorded+totOldRecorded)*scalefactor)
00371     lastrowlabels = [ ('Delivered LS','Selected LS', 'Delivered('+deliveredlumiunit+')', 'Recorded('+recordedlumiunit+')')]
00372     totalrow.append ([str(totalDeliveredLS+totOldDeliveredLS),str(totalSelectedLS+totOldSelectedLS),'%.3f'%(totdeliveredlumi),'%.3f'%(totrecordedlumi)])
00373     print ' ==  = '
00374     print tablePrinter.indent (labels+perlsresult, hasHeader = True, separateRows = False, prefix = '| ',
00375                                postfix = ' |', justify = 'right', delim = ' | ',
00376                                wrapfunc = lambda x: wrap_onspace_strict (x, 22))
00377     print ' ==  =  Total : '
00378     print tablePrinter.indent (lastrowlabels+totalrow, hasHeader = True, separateRows = False, prefix = '| ',
00379                                postfix = ' |', justify = 'right', delim = ' | ',
00380                                wrapfunc = lambda x: wrap_onspace (x, 20))    
00381 
                  
def lumiReport::toScreenNorm (   normdata)

Definition at line 4 of file lumiReport.py.

00005                           :
00006     result=[]
00007     labels=[('Name','amode','E(GeV)','Norm')]
00008     print ' ==  = '
00009     for name,thisnorm in normdata.items():
00010         amodetag=str(thisnorm[0])
00011         normval='%.2f'%thisnorm[1]
00012         egev='%.0f'%thisnorm[2]
00013         result.append([name,amodetag,egev,normval])
00014     print tablePrinter.indent (labels+result, hasHeader = True, separateRows = False,prefix = '| ', postfix = ' |', justify = 'left',delim = ' | ', wrapfunc = lambda x: wrap_onspace (x,20) ) 

def lumiReport::toScreenOverview (   lumidata,
  resultlines,
  scalefactor,
  isverbose 
)
input:
lumidata {run:[lumilsnum(0),cmslsnum(1),timestamp(2),beamstatus(3),beamenergy(4),deliveredlumi(5),recordedlumi(6),calibratedlumierror(7),(bxidx,bxvalues,bxerrs)(8),(bxidx,b1intensities,b2intensities)(9),fillnum(10)]}
resultlines [[resultrow1],[resultrow2],...,] existing result row

Definition at line 149 of file lumiReport.py.

00150                                                                 :
00151     '''
00152     input:
00153     lumidata {run:[lumilsnum(0),cmslsnum(1),timestamp(2),beamstatus(3),beamenergy(4),deliveredlumi(5),recordedlumi(6),calibratedlumierror(7),(bxidx,bxvalues,bxerrs)(8),(bxidx,b1intensities,b2intensities)(9),fillnum(10)]}
00154     resultlines [[resultrow1],[resultrow2],...,] existing result row
00155     '''
00156     result=[]
00157     labels = [('Run:Fill', 'Delivered LS', 'Delivered','Selected LS','Recorded')]
00158     totOldDeliveredLS=0
00159     totOldSelectedLS=0
00160     totOldDelivered=0.0
00161     totOldRecorded=0.0
00162     
00163     totaltable=[]
00164     totalDeliveredLS = 0
00165     totalSelectedLS = 0
00166     totalDelivered = 0.0
00167     totalRecorded = 0.0
00168 
00169     for r in resultlines:
00170         dl=0.0
00171         if(r[2]!='n/a'):            
00172             dl=float(r[2])#delivered in /ub because it comes from file!
00173             (rr,lumiu)=CommonUtil.guessUnit(dl)
00174             r[2]='%.3f'%(rr)+' ('+lumiu+')'
00175         dls=0
00176         if(r[1]!='n/a'):
00177             dls=int(r[1])
00178         totOldDeliveredLS+=dls
00179         totOldDelivered+=dl
00180         rls=0
00181         if(r[3]!='n/a'):
00182             rlsstr=r[3]
00183             listcomp=rlsstr.split(', ')
00184             for lstr in listcomp:
00185                 enddigs=lstr[1:-1].split('-')
00186                 lsmin=int(enddigs[0])
00187                 lsmax=int(enddigs[1])
00188                 rls=lsmax-lsmin+1
00189                 totOldSelectedLS+=rls
00190         if(r[4]!='n/a'):
00191             rcd=float(r[4])#recorded in /ub because it comes from file!
00192             (rrcd,rlumiu)=CommonUtil.guessUnit(rcd)
00193             r[4]='%.3f'%(rrcd)+' ('+rlumiu+')'
00194         totOldRecorded+=rcd
00195         result.append(r)
00196     
00197     for run in lumidata.keys():
00198         lsdata=lumidata[run]
00199         if lsdata is None:
00200             result.append([str(run),'n/a','n/a','n/a','n/a'])
00201             continue
00202         fillnum=0
00203         if lsdata[0][10]:
00204             fillnum=lsdata[0][10]
00205         nls=len(lsdata)
00206         deliveredData=[x[5] for x in lsdata]
00207         totdelivered=sum(deliveredData)
00208         totalDelivered+=totdelivered
00209         totalDeliveredLS+=len(deliveredData)
00210         (totdeliveredlumi,deliveredlumiunit)=CommonUtil.guessUnit(totdelivered)
00211         recordedData=[x[6] for x in lsdata if x[6] is not None]
00212         totrecorded=sum(recordedData)
00213         totalRecorded+=totrecorded
00214         (totrecordedlumi,recordedlumiunit)=CommonUtil.guessUnit(totrecorded)
00215         #print 'x[1] ',[x[1] for x in lsdata]
00216         selectedcmsls=[x[1] for x in lsdata if x[1]!=0]
00217         #print 'selectedcmsls ',selectedcmsls
00218         totalSelectedLS+=len(selectedcmsls)
00219         if len(selectedcmsls)==0:
00220             selectedlsStr='n/a'
00221         else:
00222             selectedlsStr = CommonUtil.splitlistToRangeString(selectedcmsls)
00223         result.append([str(run)+':'+str(fillnum),str(nls),'%.3f'%(totdeliveredlumi*scalefactor)+' ('+deliveredlumiunit+')',selectedlsStr,'%.3f'%(totrecordedlumi*scalefactor)+' ('+recordedlumiunit+')'])
00224     sortedresult=sorted(result,key=lambda x : int(x[0].split(':')[0]))    
00225     print ' ==  = '
00226     print tablePrinter.indent (labels+sortedresult, hasHeader = True, separateRows = False,
00227                                prefix = '| ', postfix = ' |', justify = 'right',
00228                                delim = ' | ', wrapfunc = lambda x: wrap_onspace (x,20) )
00229     print ' ==  =  Total : '
00230     (totalDeliveredVal,totalDeliveredUni)=CommonUtil.guessUnit(totalDelivered+totOldDelivered)
00231     (totalRecordedVal,totalRecordedUni)=CommonUtil.guessUnit(totalRecorded+totOldRecorded)
00232     totrowlabels = [('Delivered LS','Delivered('+totalDeliveredUni+')','Selected LS','Recorded('+totalRecordedUni+')')]
00233     totaltable.append([str(totalDeliveredLS+totOldDeliveredLS),'%.3f'%(totalDeliveredVal*scalefactor),str(totalSelectedLS+totOldSelectedLS),'%.3f'%(totalRecordedVal*scalefactor)])
00234     print tablePrinter.indent (totrowlabels+totaltable, hasHeader = True, separateRows = False, prefix = '| ',
00235                                postfix = ' |', justify = 'right', delim = ' | ',
00236                                wrapfunc = lambda x: wrap_onspace (x, 20))
    
def lumiReport::toScreenTotDelivered (   lumidata,
  resultlines,
  scalefactor,
  isverbose 
)
inputs:
lumidata {run:[lumilsnum(0),cmslsnum(1),timestamp(2),beamstatus(3),beamenergy(4),deliveredlumi(5),calibratedlumierror(6),(bxidx,bxvalues,bxerrs)(7),(bxidx,b1intensities,b2intensities)(8),fillnum)(9)]}
resultlines [[resultrow1],[resultrow2],...,] existing result row

Definition at line 15 of file lumiReport.py.

00016                                                                     :
00017     '''
00018     inputs:
00019     lumidata {run:[lumilsnum(0),cmslsnum(1),timestamp(2),beamstatus(3),beamenergy(4),deliveredlumi(5),calibratedlumierror(6),(bxidx,bxvalues,bxerrs)(7),(bxidx,b1intensities,b2intensities)(8),fillnum)(9)]}
00020     resultlines [[resultrow1],[resultrow2],...,] existing result row
00021     '''
00022     result=[]
00023     totOldDeliveredLS=0
00024     totOldDelivered=0.0
00025     for r in resultlines:
00026         dl=0.0
00027         if(r[2]!='n/a'):            
00028             dl=float(r[2])#in /ub because it comes from file!
00029             (rr,lumiu)=CommonUtil.guessUnit(dl)
00030             r[2]='%.3f'%(rr)+' ('+lumiu+')'
00031         sls=0
00032         if(r[1]!='n/a'):
00033             sls=int(r[1])
00034         totOldDeliveredLS+=sls
00035         totOldDelivered+=dl
00036         if(r[4]!='n/a'):
00037             egv=float(r[4])
00038             r[4]='%.1f'%egv
00039         result.append(r)
00040     totls=0
00041     totdelivered=0.0
00042     totaltable=[]
00043     for run in lumidata.keys():
00044         lsdata=lumidata[run]
00045         if lsdata is None:
00046             result.append([str(run),'n/a','n/a','n/a','n/a','n/a'])
00047             if isverbose:
00048                 result.extend(['n/a'])
00049             continue
00050         nls=0
00051         if len(lsdata):
00052             nls=len(lsdata)
00053         totls+=nls
00054         totlumi=sum([x[5] for x in lsdata])
00055         totdelivered+=totlumi
00056         (totlumival,lumiunit)=CommonUtil.guessUnit(totlumi)
00057         beamenergyPerLS=[float(x[4]) for x in lsdata]
00058         avgbeamenergy=0.0
00059         if len(beamenergyPerLS):
00060             avgbeamenergy=sum(beamenergyPerLS)/len(beamenergyPerLS)
00061         runstarttime='n/a'
00062         if nls!=0:
00063             runstarttime=lsdata[0][2]
00064             runstarttime=runstarttime.strftime("%m/%d/%y %H:%M:%S")
00065             fillnum=0
00066             if lsdata[0][9]:
00067                 fillnum=lsdata[0][9]
00068         if isverbose:
00069             selectedls='n/a'
00070             if nls:
00071                 selectedls=[(x[0],x[1]) for x in lsdata]
00072             result.append([str(run)+':'+str(fillnum),str(nls),'%.3f'%(totlumival*scalefactor)+' ('+lumiunit+')',runstarttime,'%.1f'%(avgbeamenergy), str(selectedls)])
00073         else:
00074             if runstarttime!='n/a':
00075                 result.append([str(run)+':'+str(fillnum),str(nls),'%.3f'%(totlumival*scalefactor)+' ('+lumiunit+')',runstarttime,'%.1f'%(avgbeamenergy)])
00076             else:
00077                 result.append([str(run)+':'+str(fillnum),str(nls),'%.3f'%(totlumival*scalefactor)+' ('+lumiunit+')','n/a','%.1f'%(avgbeamenergy)])
00078     sortedresult=sorted(result,key=lambda x : int(x[0].split(':')[0]))
00079     #print 'sortedresult ',sortedresult
00080     print ' ==  = '
00081     if isverbose:
00082         labels = [('Run:Fill', 'N_LS', 'Delivered','UTCTime','E(GeV)','Selected LS')]
00083         print tablePrinter.indent (labels+sortedresult, hasHeader = True, separateRows = False,
00084                                prefix = '| ', postfix = ' |', justify = 'right',
00085                                delim = ' | ', wrapfunc = lambda x: wrap_onspace (x,20) )
00086     else:
00087         labels = [('Run:Fill', 'N_LS', 'Delivered','UTCTime','E(GeV)')]
00088         print tablePrinter.indent (labels+sortedresult, hasHeader = True, separateRows = False,
00089                                prefix = '| ', postfix = ' |', justify = 'right',
00090                                delim = ' | ', wrapfunc = lambda x: wrap_onspace (x,40) )
00091     print ' ==  =  Total : '
00092     #if (totdelivered+totOldDelivered)!=0:
00093     (totalDeliveredVal,totalDeliveredUni)=CommonUtil.guessUnit(totdelivered+totOldDelivered)
00094     totrowlabels = [('Delivered LS','Delivered('+totalDeliveredUni+')')]
00095     totaltable.append([str(totls+totOldDeliveredLS),'%.3f'%(totalDeliveredVal*scalefactor)])
00096     print tablePrinter.indent (totrowlabels+totaltable, hasHeader = True, separateRows = False, prefix = '| ',
00097                                postfix = ' |', justify = 'right', delim = ' | ',
00098                                wrapfunc = lambda x: wrap_onspace (x, 20))
    
def lumiReport::toScreenTotEffective (   lumidata,
  resultlines,
  scalefactor,
  isverbose 
)
input:  {run:[lumilsnum(0),triggeredls(1),timestamp(2),beamstatus(3),beamenergy(4),deliveredlumi(5),recordedlumi(6),calibratedlumierror(7),{hltpath:[l1name,l1prescale,hltprescale,efflumi]}(8),bxdata(9),beamdata](10),fillnum(11)}
screen Run,SelectedLS,Recorded,HLTPath,L1Bit,Effective

Definition at line 563 of file lumiReport.py.

00564                                                                     :
00565     '''
00566     input:  {run:[lumilsnum(0),triggeredls(1),timestamp(2),beamstatus(3),beamenergy(4),deliveredlumi(5),recordedlumi(6),calibratedlumierror(7),{hltpath:[l1name,l1prescale,hltprescale,efflumi]}(8),bxdata(9),beamdata](10),fillnum(11)}
00567     screen Run,SelectedLS,Recorded,HLTPath,L1Bit,Effective
00568     '''
00569     result=[]#[run,selectedlsStr,recordedofthisrun,hltpath,l1bit,efflumi]
00570     totdict={}#{hltpath:[nls,toteff]}
00571     selectedcmsls=[]
00572     alltotrecorded=0.0
00573     alleffective=0.0
00574     recordedPerpathPerrun={}#{path:{run:recorded}}
00575     selectedPerpathPerrun={}#{path:{run:totselected}}
00576     for rline in resultlines:
00577         myrun=rline[0]
00578         myls=rline[1]
00579         mypath=rline[3]
00580         if mypath!='n/a':
00581             mypath=mypath.split('(')[0]
00582             if not totdict.has_key(mypath):
00583                 totdict[mypath]=[0,0.0]
00584                 recordedPerpathPerrun[mypath]={}
00585                 selectedPerpathPerrun[mypath]={}
00586         if myls!='n/a':
00587             listcomp=myls.split(', ')
00588             for lstr in listcomp:
00589                 enddigs=lstr[1:-1].split('-')
00590                 lsmin=int(enddigs[0])
00591                 lsmax=int(enddigs[1])
00592                 rls=lsmax-lsmin+1
00593                 totdict[mypath][0]+=rls                
00594             selectedPerrun[mypath].setdefault(int(myrun),totdict[mypath][0])
00595         myrecorded=rline[2]
00596         if myrecorded!='n/a':
00597             recordedPerpathPerrun[mypath].setdefault(int(myrun),float(myrecorded))
00598             (rr,lumiu)=CommonUtil.guessUnit(float(myrecorded))
00599             rline[2]='%.3f'%(rr)+' ('+lumiu+')'
00600         myeff=rline[5]
00601         if myeff!='n/a':
00602             reff=float(myeff)
00603             (rr,lumiu)=CommonUtil.guessUnit(float(reff))
00604             rline[5]='%.3f'%(rr)+' ('+lumiu+')'
00605             totdict[mypath][1]+=reff
00606         result.append(rline)
00607     for run in sorted(lumidata):#loop over runs
00608         hprescdict={}
00609         lprescdict={}
00610         rundata=lumidata[run]
00611         if rundata is None:
00612             result.append([str(run),'n/a','n/a','n/a','n/a','n/a'])
00613             continue
00614         fillnum=0
00615         if rundata[0][11]:
00616             fillnum=rundata[0][11]
00617         selectedcmsls=[x[1] for x in rundata if x[1]!=0]
00618         totefflumiDict={}
00619         totrecorded=0.0
00620         toteffective=0.0
00621         pathmap={}#{hltpathname:1lname}
00622         for lsdata in rundata:
00623             cmslsnum=lsdata[1]
00624             efflumiDict=lsdata[8]# this ls has no such path?
00625             recordedlumi=lsdata[6]
00626             totrecorded+=recordedlumi
00627             if not efflumiDict:
00628                 if cmslsnum in selectedcmsls:
00629                     selectedcmsls.remove(cmslsnum)
00630                 continue
00631             for hltpathname,pathdata in efflumiDict.items():
00632                 if not totefflumiDict.has_key(hltpathname):
00633                     totefflumiDict[hltpathname]=0.0
00634                     pathmap[hltpathname]='n/a'
00635                 l1name=pathdata[0]
00636                 l1presc=pathdata[1]
00637                 hltpresc=pathdata[2]
00638                 lumival=pathdata[3]
00639                 recordedPerpathPerrun.setdefault(hltpathname,{})
00640                 selectedPerpathPerrun.setdefault(hltpathname,{})
00641                 if not totdict.has_key(hltpathname):
00642                     totdict[hltpathname]=[0,0.0]
00643                 if l1presc is None or hltpresc is None:#if found all null prescales and if it is in the selectedcmsls, remove it because incomplete
00644                     if cmslsnum in selectedcmsls:
00645                         selectedcmsls.remove(cmslsnum)
00646                 else:                    
00647                     if not hprescdict.has_key(hltpathname):
00648                         hprescdict[hltpathname]=[]
00649                     hprescdict[hltpathname].append(hltpresc)
00650                     if not lprescdict.has_key(l1name):
00651                         lprescdict[l1name]=[]
00652                     lprescdict[l1name].append(l1presc)
00653                     totdict[hltpathname][0]+=1                    
00654                     if lumival:
00655                         totdict[hltpathname][1]+=lumival
00656                         totefflumiDict[hltpathname]+=lumival
00657                         pathmap[hltpathname]=l1name
00658                     recordedPerpathPerrun[hltpathname][run]=totrecorded
00659                     selectedPerpathPerrun[hltpathname][run]=len(selectedcmsls)
00660         if len(selectedcmsls)==0:
00661             selectedlsStr='n/a'
00662         else:
00663             selectedlsStr = CommonUtil.splitlistToRangeString(selectedcmsls)
00664        
00665         for name in sorted(totefflumiDict):
00666             lname=pathmap[name]
00667             if lname=='n/a':
00668                 continue
00669             (efflumival,efflumiunit)=CommonUtil.guessUnit(totefflumiDict[name]*scalefactor)
00670             totrecordedinrun=recordedPerpathPerrun[name][run]
00671             (totrecval,totrecunit)=CommonUtil.guessUnit(totrecordedinrun*scalefactor)
00672             hprescs=list(set(hprescdict[name]))
00673             lprescs=list(set(lprescdict[lname]))
00674             hprescStr='('+','.join(['%d'%(x) for x in hprescs])+')'
00675             lprescStr='('+','.join(['%d'%(x) for x in lprescs])+')'
00676             cleanlname=lname.replace('"','')
00677             result.append([str(run)+':'+str(fillnum),selectedlsStr,'%.3f'%(totrecval)+'('+totrecunit+')',name+hprescStr,cleanlname+lprescStr,'%.3f'%(efflumival)+'('+efflumiunit+')'])
00678     labels = [('Run:Fill','SelectedLS','Recorded','HLTpath(Presc)','L1bit(Presc)','Effective')]
00679     print ' ==  = '
00680     print tablePrinter.indent (labels+result, hasHeader = True, separateRows = False,
00681                                prefix = '| ', postfix = ' |', justify = 'right',
00682                                delim = ' | ', wrapfunc = lambda x: wrap_onspace_strict(x,22) )
00683     print ' ==  =  Total : '
00684     lastrowlabels=[('HLTPath','SelectedLS','Recorded','Effective')]
00685     totresult=[]
00686     for hname in sorted(totdict):
00687         hdata=totdict[hname]
00688         totnls=hdata[0]
00689         (toteffval,toteffunit)=CommonUtil.guessUnit(hdata[1]*scalefactor)
00690         alltotrecorded=0.0
00691         selectedThispath=selectedPerpathPerrun[hname]
00692         for runnumber,nselected in selectedThispath.items():
00693             if nselected==0: continue
00694             alltotrecorded+=recordedPerpathPerrun[hname][runnumber]
00695         (alltotrecordedVal,alltotrecordedunit)=CommonUtil.guessUnit(alltotrecorded*scalefactor)                                                   
00696         totresult.append([hname,str(totnls),'%.3f'%(alltotrecordedVal)+'('+alltotrecordedunit+')','%.3f'%(toteffval)+'('+toteffunit+')'])
00697     print tablePrinter.indent (lastrowlabels+totresult, hasHeader = True, separateRows = False,
00698                                prefix = '| ', postfix = ' |', justify = 'right',
00699                                delim = ' | ', wrapfunc = lambda x: wrap_onspace (x,20) )