CMS 3D CMS Logo

Functions

lumiPlotFiller Namespace Reference

Functions

def create2011RunList
def createRunList
def findFileTrueName
 Script to fill the lumi monitoring site.
def instLumiForRuns
def instPeak2010Perday
def instPeak2011Perday
def instPeakPerday
def lumi2010PerDay
def lumi2011PerDay
def lumiPerDay
def main
def totalLumi2010vsFill
def totalLumi2010vsRun
def totalLumi2010vstime
def totalLumi2011vsFill
def totalLumi2011vsRun
def totalLumi2011vstime
def totalLumivsFill
def totalLumivsRun
def totalLumivstime
def totalLumivstimeLastweek

Function Documentation

def lumiPlotFiller::create2011RunList (   c,
  p = '.',
  o = '.',
  dryrun = False 
)
 input:
  c connect string
  p authenticaion path

Definition at line 17 of file lumiPlotFiller.py.

00018                                                  :
00019     '''
00020      input:
00021       c connect string
00022       p authenticaion path
00023     '''
00024     msg=coral.MessageStream('')
00025     msg.setMsgVerbosity(coral.message_Level_Error)
00026     os.environ['CORAL_AUTH_PATH']='/build1/zx'
00027     svc = coral.ConnectionService()
00028     connectstr=c
00029     session=svc.connect(connectstr,accessMode=coral.access_ReadOnly)
00030     session.typeConverter().setCppTypeForSqlType("unsigned int","NUMBER(10)")
00031     session.typeConverter().setCppTypeForSqlType("unsigned long long","NUMBER(20)")
00032     session.transaction().start(True)
00033     schema=session.nominalSchema()
00034     allruns=lumiQueryAPI.allruns(schema,requireLumisummary=True,requireTrg=True,requireHlt=True)
00035     session.transaction().commit()  
00036     del session
00037     del svc
00038     allruns.sort()
00039     if not dryrun:
00040         report=csvReporter.csvReporter(os.path.join(o,'runlist.txt'))
00041         for run in allruns:
00042             if run>=160442:
00043                report.writeRow([run])
00044     else:
00045         for run in allruns:
00046             if run>=160442:
00047                 print run
        
def lumiPlotFiller::createRunList (   c,
  p = '.',
  o = '.',
  dryrun = False 
)
 input:
  c connect string
  p authenticaion path

Definition at line 48 of file lumiPlotFiller.py.

00049                                              :
00050     '''
00051      input:
00052       c connect string
00053       p authenticaion path
00054     '''
00055     msg=coral.MessageStream('')
00056     msg.setMsgVerbosity(coral.message_Level_Error)
00057     os.environ['CORAL_AUTH_PATH']='/build1/zx'
00058     svc = coral.ConnectionService()
00059     connectstr=c
00060     session=svc.connect(connectstr,accessMode=coral.access_ReadOnly)
00061     session.typeConverter().setCppTypeForSqlType("unsigned int","NUMBER(10)")
00062     session.typeConverter().setCppTypeForSqlType("unsigned long long","NUMBER(20)")
00063     session.transaction().start(True)
00064     schema=session.nominalSchema()
00065     allruns=lumiQueryAPI.allruns(schema,requireLumisummary=True,requireTrg=True,requireHlt=True)
00066     session.transaction().commit()  
00067     del session
00068     del svc
00069     allruns.sort()
00070     if not dryrun:
00071         report=csvReporter.csvReporter(os.path.join(o,'runlist.txt'))
00072         for run in allruns:
00073             report.writeRow([run])
00074     else:
00075         print allruns
        
def lumiPlotFiller::findFileTrueName (   filename)

Script to fill the lumi monitoring site.

This is not a generic tool

given a filename, find its true name

Definition at line 8 of file lumiPlotFiller.py.

00009                               :
00010     '''given a filename, find its true name
00011     '''
00012     truename=filename
00013     if os.path.islink(filename):
00014         truename=os.path.realpath(filename)
00015     else:
00016         print '[WARNING] ',filename,' is not a link'
    return truename
def lumiPlotFiller::instLumiForRuns (   c,
  runnumbers,
  p = '.',
  o = '',
  dryrun = False 
)
draw instlumperrun plot for the given runs
input:
  c connect string
  runnumbers []
  p authenticaion path
  o output path

Definition at line 483 of file lumiPlotFiller.py.

00484                                                          :
00485     '''
00486     draw instlumperrun plot for the given runs
00487     input:
00488       c connect string
00489       runnumbers []
00490       p authenticaion path
00491       o output path
00492     '''
00493     plotoutname='rollinginstlumi_'
00494     textoutname='rollinginstlumi_'
00495     for idx,run in enumerate(runnumbers):
00496         batch=os.path.join(o,plotoutname+str(idx+1)+'.png')
00497         elements=['lumiInstPlot.py','-c',c,'-P',p,'-begin',str(run),'-batch',batch,'run']
00498         command=' '.join(elements)
00499         print command
00500         if not dryrun:
00501             statusAndOutput=commands.getstatusoutput(command)
00502             print statusAndOutput[1]
            
def lumiPlotFiller::instPeak2010Perday (   c,
  p = '.',
  o = '.',
  begTime = "03/30/10 10:00:00.00",
  endTime = "11/03/10 00:00:00.00",
  dryrun = False,
  withTextOutput = False,
  annotateBoundaryRunnum = False 
)

Definition at line 503 of file lumiPlotFiller.py.

00503                                                          :00:00.00",endTime="11/03/10 00:00:00.00",dryrun=False,withTextOutput=False,annotateBoundaryRunnum=False):
00504     plotoutname='lumipeak-2010.png'
00505     textoutname='lumipeak-2010.csv'
00506     elements=['lumiInstPlot.py','-c',c,'-P',p,'-begin','"'+begTime+'"','-batch',os.path.join(o,plotoutname),'-yscale both','peakperday']
00507     if endTime:
00508         elements.append('-end')
00509         elements.append('"'+endTime+'"')
00510     if withTextOutput:
00511         elements.append('-o')
00512         elements.append(os.path.join(o,textoutname))
00513     if annotateBoundaryRunnum:
00514         elements.append('--annotateboundary')
00515     command=' '.join(elements)
00516     print command
00517     if not dryrun:
00518         statusAndOutput=commands.getstatusoutput(command)
00519         print statusAndOutput[1]
00520         
def lumiPlotFiller::instPeak2011Perday (   c,
  p = '.',
  o = '.',
  begTime = "03/14/11 09:00:00.00",
  endTime = "",
  dryrun = False,
  withTextOutput = False,
  annotateBoundaryRunnum = False 
)

Definition at line 521 of file lumiPlotFiller.py.

00521                                                          :00:00.00",endTime="",dryrun=False,withTextOutput=False,annotateBoundaryRunnum=False):
00522     plotoutname='lumipeak-2011.png'
00523     textoutname='lumipeak-2011.csv'
00524     elements=['lumiInstPlot.py','-c',c,'-P',p,'-begin','"'+begTime+'"','-batch',os.path.join(o,plotoutname),'-yscale both','peakperday']
00525     if endTime:
00526         elements.append('-end')
00527         elements.append('"'+endTime+'"')
00528     if withTextOutput:
00529         elements.append('-o')
00530         elements.append(os.path.join(o,textoutname))
00531     if annotateBoundaryRunnum:
00532         elements.append('--annotateboundary')
00533     command=' '.join(elements)
00534     print command
00535     if not dryrun:
00536         statusAndOutput=commands.getstatusoutput(command)
00537         print statusAndOutput[1]
00538         
def lumiPlotFiller::instPeakPerday (   c,
  p = '.',
  o = '.',
  begTime = "03/30/10 10:00:00.00",
  endTime = "",
  dryrun = False,
  withTextOutput = False,
  annotateBoundaryRunnum = False 
)
input:
  c connect string
  p authenticaion path
  o outout text/csv file

Definition at line 539 of file lumiPlotFiller.py.

00539                                                      :00:00.00",endTime="",dryrun=False,withTextOutput=False,annotateBoundaryRunnum=False):
00540     '''
00541     input:
00542       c connect string
00543       p authenticaion path
00544       o outout text/csv file
00545     '''
00546     plotoutname='lumipeak.png'
00547     textoutname='lumipeak.csv'
00548     elements=['lumiInstPlot.py','-c',c,'-P',p,'-begin','"'+begTime+'"','-batch',os.path.join(o,plotoutname),'-yscale both','peakperday']
00549     if endTime:
00550         elements.append('-end')
00551         elements.append('"'+endTime+'"')
00552     if withTextOutput:
00553         elements.append('-o')
00554         elements.append(os.path.join(o,textoutname))
00555     if annotateBoundaryRunnum:
00556         elements.append('--annotateboundary')
00557     command=' '.join(elements)
00558     print command
00559     if not dryrun:
00560         statusAndOutput=commands.getstatusoutput(command)
00561         print statusAndOutput[1]
00562         
def lumiPlotFiller::lumi2010PerDay (   c,
  p = '.',
  i = '',
  o = '',
  begTime = "03/30/10 10:00:00.00",
  endTime = "11/03/10 00:00:00.00",
  selectionfile = None,
  beamstatus = None,
  beamenergy = None,
  beamfluctuation = None,
  dryrun = False,
  withTextOutput = False,
  annotateBoundaryRunnum = False 
)

Definition at line 214 of file lumiPlotFiller.py.

00214                                                          :00:00.00",endTime="11/03/10 00:00:00.00",selectionfile=None,beamstatus=None,beamenergy=None,beamfluctuation=None,dryrun=False,withTextOutput=False,annotateBoundaryRunnum=False):
00215     plotoutname='lumiperday-2010.png'
00216     textoutname='lumiperday-2010.csv'
00217     elements=['lumiSumPlot.py','-c',c,'-P',p,'-begin','"'+begTime+'"','-batch',os.path.join(o,plotoutname),'-yscale both','perday']
00218     if selectionfile:
00219         elements.append('-i')
00220         elements.append(selectionfile)
00221     if endTime:
00222         elements.append('-end')
00223         elements.append('"'+endTime+'"')
00224     if beamstatus:
00225         elements.append('-beamstatus')
00226         if beamstatus=='stable':
00227             elements.append('"STABLE BEAMS"')
00228     if beamenergy:
00229         elements.append('-beamenergy')
00230         elements.append(str(beamenergy))
00231     if beamfluctuation:
00232         elements.append('-beamfluctuation')
00233         elements.append(str(beamfluctuation))
00234     if withTextOutput:
00235         elements.append('-o')
00236         elements.append(os.path.join(o,textoutname))
00237     if annotateBoundaryRunnum:
00238         elements.append('--annotateboundary')
00239     command=' '.join(elements)
00240     print command
00241     if not dryrun:
00242         statusAndOutput=commands.getstatusoutput(command)
00243         print statusAndOutput[1]
00244         
def lumiPlotFiller::lumi2011PerDay (   c,
  p = '.',
  i = '',
  o = '',
  begTime = "03/14/11 09:00:00.00",
  endTime = None,
  selectionfile = None,
  beamstatus = None,
  beamenergy = None,
  beamfluctuation = None,
  dryrun = False,
  withTextOutput = False,
  annotateBoundaryRunnum = False 
)

Definition at line 245 of file lumiPlotFiller.py.

00245                                                          :00:00.00",endTime=None,selectionfile=None,beamstatus=None,beamenergy=None,beamfluctuation=None,dryrun=False,withTextOutput=False,annotateBoundaryRunnum=False):
00246     plotoutname='lumiperday-2011.png'
00247     textoutname='lumiperday-2011.csv'
00248     elements=['lumiSumPlot.py','-c',c,'-P',p,'-begin','"'+begTime+'"','-batch',os.path.join(o,plotoutname),'-yscale both','perday']
00249     if selectionfile:
00250         elements.append('-i')
00251         elements.append(selectionfile)
00252     if endTime:
00253         elements.append('-end')
00254         elements.append('"'+endTime+'"')
00255     if beamstatus:
00256         elements.append('-beamstatus')
00257         if beamstatus=='stable':
00258             elements.append('"STABLE BEAMS"')
00259     if beamenergy:
00260         elements.append('-beamenergy')
00261         elements.append(str(beamenergy))
00262     if beamfluctuation:
00263         elements.append('-beamfluctuation')
00264         elements.append(str(beamfluctuation))
00265     if withTextOutput:
00266         elements.append('-o')
00267         elements.append(os.path.join(o,textoutname))
00268     if annotateBoundaryRunnum:
00269         elements.append('--annotateboundary')
00270     command=' '.join(elements)
00271     print command
00272     if not dryrun:
00273         statusAndOutput=commands.getstatusoutput(command)
00274         print statusAndOutput[1]
00275         
def lumiPlotFiller::lumiPerDay (   c,
  p = '.',
  i = '',
  o = '',
  begTime = "03/30/10 10:00:00.00",
  endTime = "",
  selectionfile = None,
  beamstatus = None,
  beamenergy = None,
  beamfluctuation = None,
  dryrun = False,
  withTextOutput = False,
  annotateBoundaryRunnum = False 
)
input:
  c connect string
  p authenticaion path
  i input selection file
  o outputpath

Definition at line 276 of file lumiPlotFiller.py.

00276                                                      :00:00.00",endTime="",selectionfile=None,beamstatus=None,beamenergy=None,beamfluctuation=None,dryrun=False,withTextOutput=False,annotateBoundaryRunnum=False):
00277     '''
00278     input:
00279       c connect string
00280       p authenticaion path
00281       i input selection file
00282       o outputpath
00283     '''
00284     plotoutname='lumiperday.png'
00285     textoutname='lumiperday.csv'
00286     elements=['lumiSumPlot.py','-c',c,'-P',p,'-begin','"'+begTime+'"','-batch',os.path.join(o,plotoutname),'-yscale both','perday']
00287     if selectionfile:
00288         elements.append('-i')
00289         elements.append(selectionfile)
00290     if endTime:
00291         elements.append('-end')
00292         elements.append('"'+endTime+'"')
00293     if beamstatus:
00294         elements.append('-beamstatus')
00295         if beamstatus=='stable':
00296             elements.append('"STABLE BEAMS"')
00297     if beamenergy:
00298         elements.append('-beamenergy')
00299         elements.append(str(beamenergy))
00300     if beamfluctuation:
00301         elements.append('-beamfluctuation')
00302         elements.append(str(beamfluctuation))
00303     if withTextOutput:
00304         elements.append('-o')
00305         elements.append(os.path.join(o,textoutname))
00306     if annotateBoundaryRunnum:
00307         elements.append('--annotateboundary')
00308     command=' '.join(elements)
00309     print command
00310     if not dryrun:
00311         statusAndOutput=commands.getstatusoutput(command)
00312         print statusAndOutput[1]
00313         
def lumiPlotFiller::main ( )

Definition at line 563 of file lumiPlotFiller.py.

00564           :
00565     actionlist=['instperrun','instpeakvstime','instpeak2011vstime','totalvstime','total2011vstime','totallumilastweek','totalvsfill','total2011vsfill','totalvsrun','total2011vsrun','perday','perday2011','createrunlist','create2011runlist','physicsperday','physicsvstime']
00566     parser = argparse.ArgumentParser(prog=os.path.basename(sys.argv[0]),description="Produce lumi plots")
00567     parser.add_argument('-c',dest='connect',action='store',required=True,help='connect string to lumiDB')
00568     parser.add_argument('-P',dest='authpath',action='store',required=False,help='auth path. Optional. Default to .')
00569     parser.add_argument('-L',dest='logpath',action='store',required=False,help='log path. Optional. Default to .')
00570     parser.add_argument('-i',dest='ifile',action='store',required=False,help='input selection file. Optional.')
00571     parser.add_argument('-o',dest='opath',action='store',required=False,help='output file path. Optional')
00572     parser.add_argument('-beamenergy',dest='beamenergy',action='store',required=False,help='beamenergy (in GeV) selection criteria,e.g. 3.5e3')
00573     parser.add_argument('-beamfluctuation',dest='beamfluctuation',action='store',required=False,help='allowed beamenergy fluctuation (in GeV),e.g. 0.2e3')
00574     parser.add_argument('--annotateboundary',dest='annotateboundary',action='store_true',help='annotate boundary run numbers')
00575     parser.add_argument('-beamstatus',dest='beamstatus',action='store',required=False,help='selection criteria beam status,e.g. stable')
00576     parser.add_argument('--withTextOutput',dest='withtextoutput',action='store_true',help='write to text output file')
00577     parser.add_argument('--dryrun',dest='dryrun',action='store_true',help='dryrun mode')
00578     parser.add_argument('action',choices=actionlist,help='command actions')
00579     args=parser.parse_args()
00580 
00581     authpath='.'
00582     logpath='.'
00583     opath='.'
00584     connectstr=args.connect
00585     isDryrun=False
00586     withTextOutput=False
00587     beamstatus=None
00588     beamenergy=None
00589     beamfluctuation=None
00590     if args.beamenergy:
00591         beamenergy=args.beamenergy
00592     if args.beamstatus:
00593         beamstatus=args.beamstatus
00594     if args.beamfluctuation:
00595         beamfluctuation=args.beamfluctuation
00596     if args.dryrun:
00597         isDryrun=True
00598     if args.withtextoutput:
00599         withTextOutput=True
00600     if args.authpath:
00601         authpath=args.authpath
00602     if args.logpath:
00603         lumilogpath=args.logpath
00604     if args.ifile:
00605         ifile=args.ifile
00606     if args.opath:
00607         opath=args.opath
00608     if args.action == 'create2011runlist':
00609         create2011RunList(connectstr,authpath,o=opath,dryrun=isDryrun)
00610     if args.action == 'createrunlist':
00611         createRunList(connectstr,authpath,o=opath,dryrun=isDryrun)
00612     if args.action == 'instperrun':
00613         if not args.ifile:
00614             print 'option -i is required for action instperrun'
00615             return 2
00616         f=open(args.ifile,'r')
00617         runs=[]
00618         for run in f:
00619             runs.append(int(run))
00620         last2runs=[runs[-2],runs[-1]]
00621         instLumiForRuns(connectstr,last2runs,p=authpath,o=opath,dryrun=isDryrun)
00622     if args.action == 'total2011vsrun':
00623         if args.ifile:
00624             f=open(args.ifile,'r')
00625             runs=[]
00626             for run in f:
00627                 runs.append(int(run))
00628         else:
00629             runs=['160442','']
00630         totalLumi2011vsRun(connectstr,p=authpath,begRun=str(runs[0]),o=opath,endRun=str(runs[-1]),beamstatus=beamstatus,beamenergy=beamenergy,beamfluctuation=beamfluctuation,dryrun=isDryrun,withTextOutput=withTextOutput)
00631         
00632     if args.action == 'totalvsrun':
00633         if args.ifile:
00634             f=open(args.ifile,'r')
00635             runs=[]
00636             for run in f:
00637                 runs.append(int(run))
00638         else:
00639             runs=['132440','']
00640         totalLumivsRun(connectstr,p=authpath,begRun=str(runs[0]),o=opath,endRun=str(runs[-1]),beamstatus=beamstatus,beamenergy=beamenergy,beamfluctuation=beamfluctuation,dryrun=isDryrun,withTextOutput=withTextOutput)
00641         
00642     if args.action == 'instpeakvstime':
00643         instPeakPerday(connectstr,p=authpath,o=opath,dryrun=isDryrun,withTextOutput=withTextOutput,annotateBoundaryRunnum=args.annotateboundary)
00644         
00645     if args.action == 'instpeak2011vstime':
00646         instPeak2011Perday(connectstr,p=authpath,o=opath,dryrun=isDryrun,withTextOutput=withTextOutput,annotateBoundaryRunnum=args.annotateboundary)    
00647     if args.action == 'total2011vstime':
00648         totalLumi2011vstime(connectstr,p=authpath,o=opath,beamstatus=beamstatus,beamenergy=beamenergy,beamfluctuation=beamfluctuation,dryrun=isDryrun,withTextOutput=withTextOutput,annotateBoundaryRunnum=args.annotateboundary)
00649         
00650     if args.action == 'totalvstime':
00651         totalLumivstime(connectstr,p=authpath,o=opath,beamstatus=beamstatus,beamenergy=beamenergy,beamfluctuation=beamfluctuation,dryrun=isDryrun,withTextOutput=withTextOutput,annotateBoundaryRunnum=args.annotateboundary)
00652         
00653     if args.action == 'totallumilastweek':
00654         totalLumivstimeLastweek(connectstr,p=authpath,o=opath,beamstatus=beamstatus,beamenergy=beamenergy,beamfluctuation=beamfluctuation,dryrun=isDryrun,withTextOutput=withTextOutput)
00655 
00656     if args.action == 'total2011vsfill':
00657         totalLumi2011vsFill(connectstr,p=authpath,o=opath,beamstatus=beamstatus,beamenergy=beamenergy,beamfluctuation=beamfluctuation,dryrun=isDryrun,withTextOutput=withTextOutput)
00658 
00659     if args.action == 'totalvsfill':
00660         totalLumivsFill(connectstr,p=authpath,o=opath,beamstatus=beamstatus,beamenergy=beamenergy,beamfluctuation=beamfluctuation,dryrun=isDryrun,withTextOutput=withTextOutput)
00661         
00662     if args.action == 'perday2011':       
00663         lumi2011PerDay(connectstr,p=authpath,o=opath,dryrun=isDryrun,beamstatus=beamstatus,beamenergy=beamenergy,beamfluctuation=beamfluctuation,withTextOutput=withTextOutput,annotateBoundaryRunnum=args.annotateboundary)
00664 
00665     if args.action == 'perday':       
00666         lumiPerDay(connectstr,p=authpath,o=opath,dryrun=isDryrun,beamstatus=beamstatus,beamenergy=beamenergy,beamfluctuation=beamfluctuation,withTextOutput=withTextOutput,annotateBoundaryRunnum=args.annotateboundary)
00667         
00668     if args.action == 'physicsperday' or args.action == 'physicsvstime':
00669         if not args.ifile:
00670             print 'input selection file is required'
00671             return 3
00672         if not os.path.isfile(args.ifile):
00673             print 'file: '+args.ifile+' does not exist'
00674             return 4
00675         truefilename=findFileTrueName(args.ifile)
00676         #print 'truefilename ',truefilename
00677         #
00678         #if truefilename modification time is more recent than the output plot, replot it
00679         #
00680         inputmodtime=os.path.getmtime(truefilename)
00681         #print 'inputmodtime ',inputmodtime
00682         if not os.path.isfile(os.path.join(opath,'lumiperday.png')) or not os.path.isfile(os.path.join(opath,'totallumivstime.png')):
00683             if not isDryrun:
00684                 shutil.copy2(truefilename,os.path.join(opath,os.path.basename(truefilename)))
00685             print 'cp '+truefilename+' '+os.path.join(opath,os.path.basename(truefilename))
00686             if args.action == 'physicsperday':
00687                 lumiPerDay(connectstr,p=authpath,selectionfile=truefilename,o=opath,beamstatus=beamstatus,beamenergy=beamenergy,beamfluctuation=beamfluctuation,dryrun=isDryrun,withTextOutput=withTextOutput)
00688             if args.action == 'physicsvstime':
00689                 totalLumivstime(connectstr,p=authpath,selectionfile=truefilename,o=opath,beamstatus=beamstatus,beamenergy=beamenergy,beamfluctuation=beamfluctuation,dryrun=isDryrun,withTextOutput=withTextOutput)
00690         else:
00691             outputmodtime=os.path.getmtime(os.path.join(opath,'lumiperday.png'))
00692             #print 'outputmodtime ',outputmodtime
00693             if inputmodtime > outputmodtime :
00694                 print 'physics selection file '+truefilename+' modified, updating physics plots: '
00695                 if not isDryrun:
00696                     shutil.copy2(truefilename,os.path.join(opath,os.path.basename(truefilename)))
00697                     print 'cp '+truefilename+' '+os.path.join(opath,os.path.basename(truefilename))
00698                     if args.action == 'physicsperday':
00699                         lumiPerDay(connectstr,p=authpath,selectionfile=truefilename,o=opath,beamstatus=beamstatus,beamenergy=beamenergy,beamfluctuation=beamfluctuation,dryrun=isDryrun,withTextOutput=withTextOutput)
00700                     if args.action == 'physicsvstime':
00701                         totalLumivstime(connectstr,p=authpath,selectionfile=truefilename,o=opath,beamstatus=beamstatus,beamenergy=beamenergy,beamfluctuation=beamfluctuation,dryrun=isDryrun,withTextOutput=withTextOutput)
00702             else:
00703                 print 'physics selection file older than plot, do nothing'
00704                 return 0

def lumiPlotFiller::totalLumi2010vsFill (   c,
  p = '.',
  i = '',
  o = '',
  begFill = "1005",
  endFill = "1461",
  selectionfile = None,
  beamenergy = None,
  beamstatus = None,
  beamfluctuation = None,
  dryrun = False,
  withTextOutput = False 
)

Definition at line 399 of file lumiPlotFiller.py.

00400                                                                                                                                                                                   :
00401     plotoutname='totallumivsfill-2010.png'
00402     textoutname='totallumivsfill-2010.csv'
00403     elements=['lumiSumPlot.py','-c',c,'-P',p,'-begin',begFill,'-batch',os.path.join(o,plotoutname),'-yscale both','fill']
00404     if endFill:
00405         elements.append('-end')
00406         elements.append(endFill)
00407     if beamstatus:
00408         elements.append('-beamstatus')
00409         if beamstatus=='stable':
00410             elements.append('"STABLE BEAMS"')
00411     if beamenergy:
00412         elements.append('-beamenergy')
00413         elements.append(str(beamenergy))
00414     if beamfluctuation:
00415         elements.append('-beamfluctuation')
00416         elements.append(str(beamfluctuation))
00417     if withTextOutput:
00418         elements.append('-o')
00419         elements.append(os.path.join(o,textoutname))
00420     command=' '.join(elements)
00421     print command
00422     if not dryrun:
00423         statusAndOutput=commands.getstatusoutput(command)
00424         print statusAndOutput[1]
        
def lumiPlotFiller::totalLumi2010vsRun (   c,
  p = '.',
  i = '',
  o = '',
  begRun = "132440",
  endRun = "149509",
  selectionfile = None,
  beamstatus = None,
  beamenergy = None,
  beamfluctuation = None,
  dryrun = False,
  withTextOutput = False 
)

Definition at line 314 of file lumiPlotFiller.py.

00315                                                                                                                                                                                    :
00316     plotoutname='totallumivsrun-2010.png'
00317     textoutname='totallumivsrun-2010.csv'
00318     elements=['lumiSumPlot.py','-c',c,'-P',p,'-begin',begRun,'-batch',os.path.join(o,plotoutname),'-yscale both','run']
00319     if endRun:
00320         elements.append('-end')
00321         elements.append(endRun)
00322     if beamstatus:
00323         elements.append('-beamstatus')
00324         if beamstatus=='stable':
00325             elements.append('"STABLE BEAMS"')
00326     if beamenergy:
00327         elements.append('-beamenergy')
00328         elements.append(str(beamenergy))
00329     if beamfluctuation:
00330         elements.append('-beamfluctuation')
00331         elements.append(str(beamfluctuation))
00332     if withTextOutput:
00333         elements.append('-o')
00334         elements.append(os.path.join(o,textoutname))
00335     command=' '.join(elements)
00336     print command
00337     if not dryrun:
00338         statusAndOutput=commands.getstatusoutput(command)
00339         print statusAndOutput[1]
        
def lumiPlotFiller::totalLumi2010vstime (   c,
  p = '.',
  i = '',
  o = '.',
  begTime = "03/30/10 10:00:00.00",
  endTime = "11/03/10 00:00:00.00",
  selectionfile = None,
  beamstatus = None,
  beamenergy = None,
  beamfluctuation = None,
  dryrun = False,
  withTextOutput = False,
  annotateBoundaryRunnum = False 
)

Definition at line 107 of file lumiPlotFiller.py.

00107                                                                :00:00.00",endTime="11/03/10 00:00:00.00",selectionfile=None,beamstatus=None,beamenergy=None,beamfluctuation=None,dryrun=False,withTextOutput=False,annotateBoundaryRunnum=False):
00108     plotoutname='totallumivstime-2010.png'
00109     textoutname='totallumivstime-2010.csv'
00110     elements=['lumiSumPlot.py','-c',c,'-P',p,'-begin','"'+begTime+'"','-batch',os.path.join(o,plotoutname),'-yscale both','time']
00111     if selectionfile:
00112         elements.append('-i')
00113         elements.append(selectionfile)
00114     if endTime:
00115         elements.append('-end')
00116         elements.append('"'+endTime+'"')
00117     if beamstatus:
00118         elements.append('-beamstatus')
00119         if beamstatus=='stable':
00120             elements.append('"STABLE BEAMS"')
00121     if beamenergy:
00122         elements.append('-beamenergy')
00123         elements.append(str(beamenergy))
00124     if beamfluctuation:
00125         elements.append('-beamfluctuation')
00126         elements.append(str(beamfluctuation))   
00127     if withTextOutput:
00128         elements.append('-o')
00129         elements.append(os.path.join(o,textoutname))
00130     if annotateBoundaryRunnum:
00131         elements.append('--annotateboundary')
00132     command=' '.join(elements)
00133     print command
00134     if not dryrun:
00135         statusAndOutput=commands.getstatusoutput(command)
00136         print statusAndOutput[1]
00137         
def lumiPlotFiller::totalLumi2011vsFill (   c,
  p = '.',
  i = '',
  o = '',
  begFill = "1616",
  endFill = None,
  selectionfile = None,
  beamenergy = None,
  beamstatus = None,
  beamfluctuation = None,
  dryrun = False,
  withTextOutput = False 
)

Definition at line 425 of file lumiPlotFiller.py.

00426                                                                                                                                                                                 :
00427     plotoutname='totallumivsfill-2011.png'
00428     textoutname='totallumivsfill-2011.csv'
00429     elements=['lumiSumPlot.py','-c',c,'-P',p,'-begin',begFill,'-batch',os.path.join(o,plotoutname),'-yscale both','fill']
00430     if endFill:
00431         elements.append('-end')
00432         elements.append(endFill)
00433     if beamstatus:
00434         elements.append('-beamstatus')
00435         if beamstatus=='stable':
00436             elements.append('"STABLE BEAMS"')
00437     if beamenergy:
00438         elements.append('-beamenergy')
00439         elements.append(str(beamenergy))
00440     if beamfluctuation:
00441         elements.append('-beamfluctuation')
00442         elements.append(str(beamfluctuation))
00443     if withTextOutput:
00444         elements.append('-o')
00445         elements.append(os.path.join(o,textoutname))
00446     command=' '.join(elements)
00447     print command
00448     if not dryrun:
00449         statusAndOutput=commands.getstatusoutput(command)
00450         print statusAndOutput[1]
        
def lumiPlotFiller::totalLumi2011vsRun (   c,
  p = '.',
  i = '',
  o = '',
  begRun = "160442",
  endRun = None,
  selectionfile = None,
  beamstatus = None,
  beamenergy = None,
  beamfluctuation = None,
  dryrun = False,
  withTextOutput = False 
)

Definition at line 340 of file lumiPlotFiller.py.

00341                                                                                                                                                                                :
00342     plotoutname='totallumivsrun-2011.png'
00343     textoutname='totallumivsrun-2011.csv'
00344     elements=['lumiSumPlot.py','-c',c,'-P',p,'-begin',begRun,'-batch',os.path.join(o,plotoutname),'-yscale both','run']
00345     if endRun:
00346         elements.append('-end')
00347         elements.append(endRun)
00348     if beamstatus:
00349         elements.append('-beamstatus')
00350         if beamstatus=='stable':
00351             elements.append('"STABLE BEAMS"')
00352     if beamenergy:
00353         elements.append('-beamenergy')
00354         elements.append(str(beamenergy))
00355     if beamfluctuation:
00356         elements.append('-beamfluctuation')
00357         elements.append(str(beamfluctuation))
00358     if withTextOutput:
00359         elements.append('-o')
00360         elements.append(os.path.join(o,textoutname))
00361     command=' '.join(elements)
00362     print command
00363     if not dryrun:
00364         statusAndOutput=commands.getstatusoutput(command)
00365         print statusAndOutput[1]
                
def lumiPlotFiller::totalLumi2011vstime (   c,
  p = '.',
  i = '',
  o = '.',
  begTime = "03/14/11 09:00:00.00",
  endTime = "",
  selectionfile = None,
  beamstatus = None,
  beamenergy = None,
  beamfluctuation = None,
  dryrun = False,
  withTextOutput = False,
  annotateBoundaryRunnum = False 
)

Definition at line 76 of file lumiPlotFiller.py.

00076                                                                :00:00.00",endTime="",selectionfile=None,beamstatus=None,beamenergy=None,beamfluctuation=None,dryrun=False,withTextOutput=False,annotateBoundaryRunnum=False):
00077     plotoutname='totallumivstime-2011.png'
00078     textoutname='totallumivstime-2011.csv'
00079     elements=['lumiSumPlot.py','-c',c,'-P',p,'-begin','"'+begTime+'"','-batch',os.path.join(o,plotoutname),'-yscale both','time']
00080     if selectionfile:
00081         elements.append('-i')
00082         elements.append(selectionfile)
00083     if endTime:
00084         elements.append('-end')
00085         elements.append('"'+endTime+'"')
00086     if beamstatus:
00087         elements.append('-beamstatus')
00088         if beamstatus=='stable':
00089             elements.append('"STABLE BEAMS"')
00090     if beamenergy:
00091         elements.append('-beamenergy')
00092         elements.append(str(beamenergy))
00093     if beamfluctuation:
00094         elements.append('-beamfluctuation')
00095         elements.append(str(beamfluctuation))   
00096     if withTextOutput:
00097         elements.append('-o')
00098         elements.append(os.path.join(o,textoutname))
00099     if annotateBoundaryRunnum:
00100         elements.append('--annotateboundary')
00101     command=' '.join(elements)
00102     print command
00103     if not dryrun:
00104         statusAndOutput=commands.getstatusoutput(command)
00105         print statusAndOutput[1]
00106         
def lumiPlotFiller::totalLumivsFill (   c,
  p = '.',
  i = '',
  o = '',
  begFill = "1005",
  endFill = "",
  selectionfile = None,
  beamenergy = None,
  beamstatus = None,
  beamfluctuation = None,
  dryrun = False,
  withTextOutput = False 
)
input:
  c connect string
  p authenticaion path
  i input selection file
  o output path

Definition at line 451 of file lumiPlotFiller.py.

00452                                                                                                                                                                           :
00453     '''
00454     input:
00455       c connect string
00456       p authenticaion path
00457       i input selection file
00458       o output path
00459     '''
00460     plotoutname='totallumivsfill.png'
00461     textoutname='totallumivsfill.csv'
00462     elements=['lumiSumPlot.py','-c',c,'-P',p,'-begin',begFill,'-batch',os.path.join(o,plotoutname),'-yscale both','fill']
00463     if endFill:
00464         elements.append('-end')
00465         elements.append(endFill)
00466     if beamstatus:
00467         elements.append('-beamstatus')
00468         if beamstatus=='stable':
00469             elements.append('"STABLE BEAMS"')
00470     if beamenergy:
00471         elements.append('-beamenergy')
00472         elements.append(str(beamenergy))
00473     if beamfluctuation:
00474         elements.append('-beamfluctuation')
00475         elements.append(str(beamfluctuation))
00476     if withTextOutput:
00477         elements.append('-o')
00478         elements.append(os.path.join(o,textoutname))
00479     command=' '.join(elements)
00480     print command
00481     if not dryrun:
00482         statusAndOutput=commands.getstatusoutput(command)
        print statusAndOutput[1]
def lumiPlotFiller::totalLumivsRun (   c,
  p = '.',
  i = '',
  o = '',
  begRun = "132440",
  endRun = "",
  selectionfile = None,
  beamstatus = None,
  beamenergy = None,
  beamfluctuation = None,
  dryrun = False,
  withTextOutput = False 
)
input:
  c connect string
  p authenticaion path
  i input selection file
  o outputpath 

Definition at line 366 of file lumiPlotFiller.py.

00367                                                                                                                                                                          :
00368     '''
00369     input:
00370       c connect string
00371       p authenticaion path
00372       i input selection file
00373       o outputpath 
00374     '''
00375     plotoutname='totallumivsrun.png'
00376     textoutname='totallumivsrun.csv'
00377     elements=['lumiSumPlot.py','-c',c,'-P',p,'-begin',begRun,'-batch',os.path.join(o,plotoutname),'-yscale both','run']
00378     if endRun:
00379         elements.append('-end')
00380         elements.append(endRun)
00381     if beamstatus:
00382         elements.append('-beamstatus')
00383         if beamstatus=='stable':
00384             elements.append('"STABLE BEAMS"')
00385     if beamenergy:
00386         elements.append('-beamenergy')
00387         elements.append(str(beamenergy))
00388     if beamfluctuation:
00389         elements.append('-beamfluctuation')
00390         elements.append(str(beamfluctuation))
00391     if withTextOutput:
00392         elements.append('-o')
00393         elements.append(os.path.join(o,textoutname))
00394     command=' '.join(elements)
00395     print command
00396     if not dryrun:
00397         statusAndOutput=commands.getstatusoutput(command)
00398         print statusAndOutput[1]

def lumiPlotFiller::totalLumivstime (   c,
  p = '.',
  i = '',
  o = '.',
  begTime = "03/30/10 10:00:00.00",
  endTime = None,
  selectionfile = None,
  beamstatus = None,
  beamenergy = None,
  beamfluctuation = None,
  dryrun = False,
  withTextOutput = False,
  annotateBoundaryRunnum = False 
)
input:
  c connect string
  p authenticaion path
  i input selection file name
  o output path

Definition at line 138 of file lumiPlotFiller.py.

00138                                                            :00:00.00",endTime=None,selectionfile=None,beamstatus=None,beamenergy=None,beamfluctuation=None,dryrun=False,withTextOutput=False,annotateBoundaryRunnum=False):
00139     '''
00140     input:
00141       c connect string
00142       p authenticaion path
00143       i input selection file name
00144       o output path
00145     '''
00146     plotoutname='totallumivstime.png'
00147     textoutname='totallumivstime.csv'
00148     elements=['lumiSumPlot.py','-c',c,'-P',p,'-begin','"'+begTime+'"','-batch',os.path.join(o,plotoutname),'-yscale both','time']
00149     if selectionfile:
00150         elements.append('-i')
00151         elements.append(selectionfile)
00152     if endTime:
00153         elements.append('-end')
00154         elements.append('"'+endTime+'"')
00155     if beamstatus:
00156         elements.append('-beamstatus')
00157         if beamstatus=='stable':
00158             elements.append('"STABLE BEAMS"')
00159     if beamenergy:
00160         elements.append('-beamenergy')
00161         elements.append(str(beamenergy))
00162     if beamfluctuation:
00163         elements.append('-beamfluctuation')
00164         elements.append(str(beamfluctuation))   
00165     if withTextOutput:
00166         elements.append('-o')
00167         elements.append(os.path.join(o,textoutname))
00168     if annotateBoundaryRunnum:
00169         elements.append('--annotateboundary')
00170     command=' '.join(elements)
00171     print command
00172     if not dryrun:
00173         statusAndOutput=commands.getstatusoutput(command)
00174         print statusAndOutput[1]
00175         
def lumiPlotFiller::totalLumivstimeLastweek (   c,
  p = '.',
  i = '',
  o = '.',
  selectionfile = None,
  beamstatus = None,
  beamenergy = None,
  beamfluctuation = None,
  dryrun = False,
  withTextOutput = False 
)
input:
  c connect string
  p authenticaion path
  i input selection file name
  o output path
  ##fix me: year boundary is not considered!

Definition at line 176 of file lumiPlotFiller.py.

00177                                                                                                                                                          :
00178     '''
00179     input:
00180       c connect string
00181       p authenticaion path
00182       i input selection file name
00183       o output path
00184       ##fix me: year boundary is not considered!
00185     '''
00186     t=lumiTime.lumiTime()
00187     plotoutname='totallumivstime-weekly.png'
00188     textoutname='totallumivstime-weekly.csv'
00189     nowTime=datetime.datetime.now()
00190     lastMondayStr=' '.join([str(nowTime.isocalendar()[0]),str(nowTime.isocalendar()[1]-1),str(nowTime.isocalendar()[2])])
00191     
00192     lastweekMonday=datetime.datetime(*time.strptime(lastMondayStr,'%Y %W %w')[0:5])
00193     lastweekEndSunday=lastweekMonday+datetime.timedelta(days=7,hours=24)
00194     
00195     elements=['lumiSumPlot.py','-c',c,'-P',p,'-begin','"'+t.DatetimeToStr(lastweekMonday)+'"','-end','"'+t.DatetimeToStr(lastweekEndSunday)+'"','-batch',os.path.join(o,plotoutname),'time']
00196     if withTextOutput:
00197         elements.append('-o')
00198         elements.append(os.path.join(o,textoutname))
00199     if beamstatus:
00200         elements.append('-beamstatus')
00201         if beamstatus=='stable':
00202             elements.append('"STABLE BEAMS"')
00203     if beamenergy:
00204         elements.append('-beamenergy')
00205         elements.append(str(beamenergy))
00206     if beamfluctuation:
00207         elements.append('-beamfluctuation')
00208         elements.append(str(beamfluctuation))   
00209     command=' '.join(elements)
00210     print command
00211     if not dryrun:
00212         statusAndOutput=commands.getstatusoutput(command)
00213         print statusAndOutput[1]