CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Functions
lumiPlotFiller Namespace Reference

Functions

def create2011RunList
 
def createRunList
 
def findFileTrueName
 Script to fill the lumi monitoring site. More...
 
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.

References lumiQueryAPI.allruns().

Referenced by main().

17 
18 def create2011RunList(c,p='.',o='.',dryrun=False):
19  '''
20  input:
21  c connect string
22  p authenticaion path
23  '''
24  msg=coral.MessageStream('')
25  msg.setMsgVerbosity(coral.message_Level_Error)
26  os.environ['CORAL_AUTH_PATH']='/build1/zx'
27  svc = coral.ConnectionService()
28  connectstr=c
29  session=svc.connect(connectstr,accessMode=coral.access_ReadOnly)
30  session.typeConverter().setCppTypeForSqlType("unsigned int","NUMBER(10)")
31  session.typeConverter().setCppTypeForSqlType("unsigned long long","NUMBER(20)")
32  session.transaction().start(True)
33  schema=session.nominalSchema()
34  allruns=lumiQueryAPI.allruns(schema,requireLumisummary=True,requireTrg=True,requireHlt=True)
35  session.transaction().commit()
36  del session
37  del svc
38  allruns.sort()
39  if not dryrun:
40  report=csvReporter.csvReporter(os.path.join(o,'runlist.txt'))
41  for run in allruns:
42  if run>=160442:
43  report.writeRow([run])
44  else:
45  for run in allruns:
46  if run>=160442:
47  print run
Definition: start.py:1
def allruns
==============real api=====###
def lumiPlotFiller.createRunList (   c,
  p = '.',
  o = '.',
  dryrun = False 
)
 input:
  c connect string
  p authenticaion path

Definition at line 48 of file lumiPlotFiller.py.

References lumiQueryAPI.allruns().

Referenced by main().

48 
49 def createRunList(c,p='.',o='.',dryrun=False):
50  '''
51  input:
52  c connect string
53  p authenticaion path
54  '''
55  msg=coral.MessageStream('')
56  msg.setMsgVerbosity(coral.message_Level_Error)
57  os.environ['CORAL_AUTH_PATH']='/build1/zx'
58  svc = coral.ConnectionService()
59  connectstr=c
60  session=svc.connect(connectstr,accessMode=coral.access_ReadOnly)
61  session.typeConverter().setCppTypeForSqlType("unsigned int","NUMBER(10)")
62  session.typeConverter().setCppTypeForSqlType("unsigned long long","NUMBER(20)")
63  session.transaction().start(True)
64  schema=session.nominalSchema()
65  allruns=lumiQueryAPI.allruns(schema,requireLumisummary=True,requireTrg=True,requireHlt=True)
66  session.transaction().commit()
67  del session
68  del svc
69  allruns.sort()
70  if not dryrun:
71  report=csvReporter.csvReporter(os.path.join(o,'runlist.txt'))
72  for run in allruns:
73  report.writeRow([run])
74  else:
75  print allruns
Definition: start.py:1
def allruns
==============real api=====###
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.

Referenced by main().

8 
9 def findFileTrueName(filename):
10  '''given a filename, find its true name
11  '''
12  truename=filename
13  if os.path.islink(filename):
14  truename=os.path.realpath(filename)
15  else:
16  print '[WARNING] ',filename,' is not a link'
return truename
def findFileTrueName
Script to fill the lumi monitoring site.
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.

References join().

Referenced by main().

484 def instLumiForRuns(c,runnumbers,p='.',o='',dryrun=False):
485  '''
486  draw instlumperrun plot for the given runs
487  input:
488  c connect string
489  runnumbers []
490  p authenticaion path
491  o output path
492  '''
493  plotoutname='rollinginstlumi_'
494  textoutname='rollinginstlumi_'
495  for idx,run in enumerate(runnumbers):
496  batch=os.path.join(o,plotoutname+str(idx+1)+'.png')
497  elements=['lumiInstPlot.py','-c',c,'-P',p,'-begin',str(run),'-batch',batch,'run']
498  command=' '.join(elements)
499  print command
500  if not dryrun:
501  statusAndOutput=commands.getstatusoutput(command)
502  print statusAndOutput[1]
static std::string join(char **cmd)
Definition: RemoteFile.cc:18
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.

References join().

504 def 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):
505  plotoutname='lumipeak-2010.png'
506  textoutname='lumipeak-2010.csv'
507  elements=['lumiInstPlot.py','-c',c,'-P',p,'-begin','"'+begTime+'"','-batch',os.path.join(o,plotoutname),'-yscale both','peakperday']
508  if endTime:
509  elements.append('-end')
510  elements.append('"'+endTime+'"')
511  if withTextOutput:
512  elements.append('-o')
513  elements.append(os.path.join(o,textoutname))
514  if annotateBoundaryRunnum:
515  elements.append('--annotateboundary')
516  command=' '.join(elements)
517  print command
518  if not dryrun:
519  statusAndOutput=commands.getstatusoutput(command)
520  print statusAndOutput[1]
static std::string join(char **cmd)
Definition: RemoteFile.cc:18
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.

References join().

Referenced by main().

522 def instPeak2011Perday(c,p='.',o='.',begTime="03/14/11 09:00:00.00",endTime="",dryrun=False,withTextOutput=False,annotateBoundaryRunnum=False):
523  plotoutname='lumipeak-2011.png'
524  textoutname='lumipeak-2011.csv'
525  elements=['lumiInstPlot.py','-c',c,'-P',p,'-begin','"'+begTime+'"','-batch',os.path.join(o,plotoutname),'-yscale both','peakperday']
526  if endTime:
527  elements.append('-end')
528  elements.append('"'+endTime+'"')
529  if withTextOutput:
530  elements.append('-o')
531  elements.append(os.path.join(o,textoutname))
532  if annotateBoundaryRunnum:
533  elements.append('--annotateboundary')
534  command=' '.join(elements)
535  print command
536  if not dryrun:
537  statusAndOutput=commands.getstatusoutput(command)
538  print statusAndOutput[1]
static std::string join(char **cmd)
Definition: RemoteFile.cc:18
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.

References join().

Referenced by main().

540 def instPeakPerday(c,p='.',o='.',begTime="03/30/10 10:00:00.00",endTime="",dryrun=False,withTextOutput=False,annotateBoundaryRunnum=False):
541  '''
542  input:
543  c connect string
544  p authenticaion path
545  o outout text/csv file
546  '''
547  plotoutname='lumipeak.png'
548  textoutname='lumipeak.csv'
549  elements=['lumiInstPlot.py','-c',c,'-P',p,'-begin','"'+begTime+'"','-batch',os.path.join(o,plotoutname),'-yscale both','peakperday']
550  if endTime:
551  elements.append('-end')
552  elements.append('"'+endTime+'"')
553  if withTextOutput:
554  elements.append('-o')
555  elements.append(os.path.join(o,textoutname))
556  if annotateBoundaryRunnum:
557  elements.append('--annotateboundary')
558  command=' '.join(elements)
559  print command
560  if not dryrun:
561  statusAndOutput=commands.getstatusoutput(command)
562  print statusAndOutput[1]
static std::string join(char **cmd)
Definition: RemoteFile.cc:18
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.

References join().

215 def 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):
216  plotoutname='lumiperday-2010.png'
217  textoutname='lumiperday-2010.csv'
218  elements=['lumiSumPlot.py','-c',c,'-P',p,'-begin','"'+begTime+'"','-batch',os.path.join(o,plotoutname),'-yscale both','perday']
219  if selectionfile:
220  elements.append('-i')
221  elements.append(selectionfile)
222  if endTime:
223  elements.append('-end')
224  elements.append('"'+endTime+'"')
225  if beamstatus:
226  elements.append('-beamstatus')
227  if beamstatus=='stable':
228  elements.append('"STABLE BEAMS"')
229  if beamenergy:
230  elements.append('-beamenergy')
231  elements.append(str(beamenergy))
232  if beamfluctuation:
233  elements.append('-beamfluctuation')
234  elements.append(str(beamfluctuation))
235  if withTextOutput:
236  elements.append('-o')
237  elements.append(os.path.join(o,textoutname))
238  if annotateBoundaryRunnum:
239  elements.append('--annotateboundary')
240  command=' '.join(elements)
241  print command
242  if not dryrun:
243  statusAndOutput=commands.getstatusoutput(command)
244  print statusAndOutput[1]
static std::string join(char **cmd)
Definition: RemoteFile.cc:18
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.

References join().

Referenced by main().

246 def 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):
247  plotoutname='lumiperday-2011.png'
248  textoutname='lumiperday-2011.csv'
249  elements=['lumiSumPlot.py','-c',c,'-P',p,'-begin','"'+begTime+'"','-batch',os.path.join(o,plotoutname),'-yscale both','perday']
250  if selectionfile:
251  elements.append('-i')
252  elements.append(selectionfile)
253  if endTime:
254  elements.append('-end')
255  elements.append('"'+endTime+'"')
256  if beamstatus:
257  elements.append('-beamstatus')
258  if beamstatus=='stable':
259  elements.append('"STABLE BEAMS"')
260  if beamenergy:
261  elements.append('-beamenergy')
262  elements.append(str(beamenergy))
263  if beamfluctuation:
264  elements.append('-beamfluctuation')
265  elements.append(str(beamfluctuation))
266  if withTextOutput:
267  elements.append('-o')
268  elements.append(os.path.join(o,textoutname))
269  if annotateBoundaryRunnum:
270  elements.append('--annotateboundary')
271  command=' '.join(elements)
272  print command
273  if not dryrun:
274  statusAndOutput=commands.getstatusoutput(command)
275  print statusAndOutput[1]
static std::string join(char **cmd)
Definition: RemoteFile.cc:18
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.

References join().

Referenced by main().

277 def 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):
278  '''
279  input:
280  c connect string
281  p authenticaion path
282  i input selection file
283  o outputpath
284  '''
285  plotoutname='lumiperday.png'
286  textoutname='lumiperday.csv'
287  elements=['lumiSumPlot.py','-c',c,'-P',p,'-begin','"'+begTime+'"','-batch',os.path.join(o,plotoutname),'-yscale both','perday']
288  if selectionfile:
289  elements.append('-i')
290  elements.append(selectionfile)
291  if endTime:
292  elements.append('-end')
293  elements.append('"'+endTime+'"')
294  if beamstatus:
295  elements.append('-beamstatus')
296  if beamstatus=='stable':
297  elements.append('"STABLE BEAMS"')
298  if beamenergy:
299  elements.append('-beamenergy')
300  elements.append(str(beamenergy))
301  if beamfluctuation:
302  elements.append('-beamfluctuation')
303  elements.append(str(beamfluctuation))
304  if withTextOutput:
305  elements.append('-o')
306  elements.append(os.path.join(o,textoutname))
307  if annotateBoundaryRunnum:
308  elements.append('--annotateboundary')
309  command=' '.join(elements)
310  print command
311  if not dryrun:
312  statusAndOutput=commands.getstatusoutput(command)
313  print statusAndOutput[1]
static std::string join(char **cmd)
Definition: RemoteFile.cc:18
def lumiPlotFiller.main ( )

Definition at line 563 of file lumiPlotFiller.py.

References create2011RunList(), createRunList(), findFileTrueName(), instLumiForRuns(), instPeak2011Perday(), instPeakPerday(), lumi2011PerDay(), lumiPerDay(), totalLumi2011vsFill(), totalLumi2011vsRun(), totalLumi2011vstime(), totalLumivsFill(), totalLumivsRun(), totalLumivstime(), and totalLumivstimeLastweek().

564 def main():
565  actionlist=['instperrun','instpeakvstime','instpeak2011vstime','totalvstime','total2011vstime','totallumilastweek','totalvsfill','total2011vsfill','totalvsrun','total2011vsrun','perday','perday2011','createrunlist','create2011runlist','physicsperday','physicsvstime']
566  parser = argparse.ArgumentParser(prog=os.path.basename(sys.argv[0]),description="Produce lumi plots")
567  parser.add_argument('-c',dest='connect',action='store',required=True,help='connect string to lumiDB')
568  parser.add_argument('-P',dest='authpath',action='store',required=False,help='auth path. Optional. Default to .')
569  parser.add_argument('-L',dest='logpath',action='store',required=False,help='log path. Optional. Default to .')
570  parser.add_argument('-i',dest='ifile',action='store',required=False,help='input selection file. Optional.')
571  parser.add_argument('-o',dest='opath',action='store',required=False,help='output file path. Optional')
572  parser.add_argument('-beamenergy',dest='beamenergy',action='store',required=False,help='beamenergy (in GeV) selection criteria,e.g. 3.5e3')
573  parser.add_argument('-beamfluctuation',dest='beamfluctuation',action='store',required=False,help='allowed beamenergy fluctuation (in GeV),e.g. 0.2e3')
574  parser.add_argument('--annotateboundary',dest='annotateboundary',action='store_true',help='annotate boundary run numbers')
575  parser.add_argument('-beamstatus',dest='beamstatus',action='store',required=False,help='selection criteria beam status,e.g. stable')
576  parser.add_argument('--withTextOutput',dest='withtextoutput',action='store_true',help='write to text output file')
577  parser.add_argument('--dryrun',dest='dryrun',action='store_true',help='dryrun mode')
578  parser.add_argument('action',choices=actionlist,help='command actions')
579  args=parser.parse_args()
580 
581  authpath='.'
582  logpath='.'
583  opath='.'
584  connectstr=args.connect
585  isDryrun=False
586  withTextOutput=False
587  beamstatus=None
588  beamenergy=None
589  beamfluctuation=None
590  if args.beamenergy:
591  beamenergy=args.beamenergy
592  if args.beamstatus:
593  beamstatus=args.beamstatus
594  if args.beamfluctuation:
595  beamfluctuation=args.beamfluctuation
596  if args.dryrun:
597  isDryrun=True
598  if args.withtextoutput:
599  withTextOutput=True
600  if args.authpath:
601  authpath=args.authpath
602  if args.logpath:
603  lumilogpath=args.logpath
604  if args.ifile:
605  ifile=args.ifile
606  if args.opath:
607  opath=args.opath
608  if args.action == 'create2011runlist':
609  create2011RunList(connectstr,authpath,o=opath,dryrun=isDryrun)
610  if args.action == 'createrunlist':
611  createRunList(connectstr,authpath,o=opath,dryrun=isDryrun)
612  if args.action == 'instperrun':
613  if not args.ifile:
614  print 'option -i is required for action instperrun'
615  return 2
616  f=open(args.ifile,'r')
617  runs=[]
618  for run in f:
619  runs.append(int(run))
620  last2runs=[runs[-2],runs[-1]]
621  instLumiForRuns(connectstr,last2runs,p=authpath,o=opath,dryrun=isDryrun)
622  if args.action == 'total2011vsrun':
623  if args.ifile:
624  f=open(args.ifile,'r')
625  runs=[]
626  for run in f:
627  runs.append(int(run))
628  else:
629  runs=['160442','']
630  totalLumi2011vsRun(connectstr,p=authpath,begRun=str(runs[0]),o=opath,endRun=str(runs[-1]),beamstatus=beamstatus,beamenergy=beamenergy,beamfluctuation=beamfluctuation,dryrun=isDryrun,withTextOutput=withTextOutput)
631 
632  if args.action == 'totalvsrun':
633  if args.ifile:
634  f=open(args.ifile,'r')
635  runs=[]
636  for run in f:
637  runs.append(int(run))
638  else:
639  runs=['132440','']
640  totalLumivsRun(connectstr,p=authpath,begRun=str(runs[0]),o=opath,endRun=str(runs[-1]),beamstatus=beamstatus,beamenergy=beamenergy,beamfluctuation=beamfluctuation,dryrun=isDryrun,withTextOutput=withTextOutput)
641 
642  if args.action == 'instpeakvstime':
643  instPeakPerday(connectstr,p=authpath,o=opath,dryrun=isDryrun,withTextOutput=withTextOutput,annotateBoundaryRunnum=args.annotateboundary)
644 
645  if args.action == 'instpeak2011vstime':
646  instPeak2011Perday(connectstr,p=authpath,o=opath,dryrun=isDryrun,withTextOutput=withTextOutput,annotateBoundaryRunnum=args.annotateboundary)
647  if args.action == 'total2011vstime':
648  totalLumi2011vstime(connectstr,p=authpath,o=opath,beamstatus=beamstatus,beamenergy=beamenergy,beamfluctuation=beamfluctuation,dryrun=isDryrun,withTextOutput=withTextOutput,annotateBoundaryRunnum=args.annotateboundary)
649 
650  if args.action == 'totalvstime':
651  totalLumivstime(connectstr,p=authpath,o=opath,beamstatus=beamstatus,beamenergy=beamenergy,beamfluctuation=beamfluctuation,dryrun=isDryrun,withTextOutput=withTextOutput,annotateBoundaryRunnum=args.annotateboundary)
652 
653  if args.action == 'totallumilastweek':
654  totalLumivstimeLastweek(connectstr,p=authpath,o=opath,beamstatus=beamstatus,beamenergy=beamenergy,beamfluctuation=beamfluctuation,dryrun=isDryrun,withTextOutput=withTextOutput)
655 
656  if args.action == 'total2011vsfill':
657  totalLumi2011vsFill(connectstr,p=authpath,o=opath,beamstatus=beamstatus,beamenergy=beamenergy,beamfluctuation=beamfluctuation,dryrun=isDryrun,withTextOutput=withTextOutput)
658 
659  if args.action == 'totalvsfill':
660  totalLumivsFill(connectstr,p=authpath,o=opath,beamstatus=beamstatus,beamenergy=beamenergy,beamfluctuation=beamfluctuation,dryrun=isDryrun,withTextOutput=withTextOutput)
661 
662  if args.action == 'perday2011':
663  lumi2011PerDay(connectstr,p=authpath,o=opath,dryrun=isDryrun,beamstatus=beamstatus,beamenergy=beamenergy,beamfluctuation=beamfluctuation,withTextOutput=withTextOutput,annotateBoundaryRunnum=args.annotateboundary)
664 
665  if args.action == 'perday':
666  lumiPerDay(connectstr,p=authpath,o=opath,dryrun=isDryrun,beamstatus=beamstatus,beamenergy=beamenergy,beamfluctuation=beamfluctuation,withTextOutput=withTextOutput,annotateBoundaryRunnum=args.annotateboundary)
667 
668  if args.action == 'physicsperday' or args.action == 'physicsvstime':
669  if not args.ifile:
670  print 'input selection file is required'
671  return 3
672  if not os.path.isfile(args.ifile):
673  print 'file: '+args.ifile+' does not exist'
674  return 4
675  truefilename=findFileTrueName(args.ifile)
676  #print 'truefilename ',truefilename
677  #
678  #if truefilename modification time is more recent than the output plot, replot it
679  #
680  inputmodtime=os.path.getmtime(truefilename)
681  #print 'inputmodtime ',inputmodtime
682  if not os.path.isfile(os.path.join(opath,'lumiperday.png')) or not os.path.isfile(os.path.join(opath,'totallumivstime.png')):
683  if not isDryrun:
684  shutil.copy2(truefilename,os.path.join(opath,os.path.basename(truefilename)))
685  print 'cp '+truefilename+' '+os.path.join(opath,os.path.basename(truefilename))
686  if args.action == 'physicsperday':
687  lumiPerDay(connectstr,p=authpath,selectionfile=truefilename,o=opath,beamstatus=beamstatus,beamenergy=beamenergy,beamfluctuation=beamfluctuation,dryrun=isDryrun,withTextOutput=withTextOutput)
688  if args.action == 'physicsvstime':
689  totalLumivstime(connectstr,p=authpath,selectionfile=truefilename,o=opath,beamstatus=beamstatus,beamenergy=beamenergy,beamfluctuation=beamfluctuation,dryrun=isDryrun,withTextOutput=withTextOutput)
690  else:
691  outputmodtime=os.path.getmtime(os.path.join(opath,'lumiperday.png'))
692  #print 'outputmodtime ',outputmodtime
693  if inputmodtime > outputmodtime :
694  print 'physics selection file '+truefilename+' modified, updating physics plots: '
695  if not isDryrun:
696  shutil.copy2(truefilename,os.path.join(opath,os.path.basename(truefilename)))
697  print 'cp '+truefilename+' '+os.path.join(opath,os.path.basename(truefilename))
698  if args.action == 'physicsperday':
699  lumiPerDay(connectstr,p=authpath,selectionfile=truefilename,o=opath,beamstatus=beamstatus,beamenergy=beamenergy,beamfluctuation=beamfluctuation,dryrun=isDryrun,withTextOutput=withTextOutput)
700  if args.action == 'physicsvstime':
701  totalLumivstime(connectstr,p=authpath,selectionfile=truefilename,o=opath,beamstatus=beamstatus,beamenergy=beamenergy,beamfluctuation=beamfluctuation,dryrun=isDryrun,withTextOutput=withTextOutput)
702  else:
703  print 'physics selection file older than plot, do nothing'
704  return 0
def findFileTrueName
Script to fill the lumi monitoring site.
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.

References join().

400 def totalLumi2010vsFill(c,p='.',i='',o='',begFill="1005",endFill="1461",selectionfile=None,beamenergy=None,beamstatus=None,beamfluctuation=None,dryrun=False,withTextOutput=False):
401  plotoutname='totallumivsfill-2010.png'
402  textoutname='totallumivsfill-2010.csv'
403  elements=['lumiSumPlot.py','-c',c,'-P',p,'-begin',begFill,'-batch',os.path.join(o,plotoutname),'-yscale both','fill']
404  if endFill:
405  elements.append('-end')
406  elements.append(endFill)
407  if beamstatus:
408  elements.append('-beamstatus')
409  if beamstatus=='stable':
410  elements.append('"STABLE BEAMS"')
411  if beamenergy:
412  elements.append('-beamenergy')
413  elements.append(str(beamenergy))
414  if beamfluctuation:
415  elements.append('-beamfluctuation')
416  elements.append(str(beamfluctuation))
417  if withTextOutput:
418  elements.append('-o')
419  elements.append(os.path.join(o,textoutname))
420  command=' '.join(elements)
421  print command
422  if not dryrun:
423  statusAndOutput=commands.getstatusoutput(command)
424  print statusAndOutput[1]
static std::string join(char **cmd)
Definition: RemoteFile.cc:18
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.

References join().

315 def totalLumi2010vsRun(c,p='.',i='',o='',begRun="132440",endRun="149509",selectionfile=None,beamstatus=None,beamenergy=None,beamfluctuation=None,dryrun=False,withTextOutput=False):
316  plotoutname='totallumivsrun-2010.png'
317  textoutname='totallumivsrun-2010.csv'
318  elements=['lumiSumPlot.py','-c',c,'-P',p,'-begin',begRun,'-batch',os.path.join(o,plotoutname),'-yscale both','run']
319  if endRun:
320  elements.append('-end')
321  elements.append(endRun)
322  if beamstatus:
323  elements.append('-beamstatus')
324  if beamstatus=='stable':
325  elements.append('"STABLE BEAMS"')
326  if beamenergy:
327  elements.append('-beamenergy')
328  elements.append(str(beamenergy))
329  if beamfluctuation:
330  elements.append('-beamfluctuation')
331  elements.append(str(beamfluctuation))
332  if withTextOutput:
333  elements.append('-o')
334  elements.append(os.path.join(o,textoutname))
335  command=' '.join(elements)
336  print command
337  if not dryrun:
338  statusAndOutput=commands.getstatusoutput(command)
339  print statusAndOutput[1]
static std::string join(char **cmd)
Definition: RemoteFile.cc:18
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.

References join().

108 def 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):
109  plotoutname='totallumivstime-2010.png'
110  textoutname='totallumivstime-2010.csv'
111  elements=['lumiSumPlot.py','-c',c,'-P',p,'-begin','"'+begTime+'"','-batch',os.path.join(o,plotoutname),'-yscale both','time']
112  if selectionfile:
113  elements.append('-i')
114  elements.append(selectionfile)
115  if endTime:
116  elements.append('-end')
117  elements.append('"'+endTime+'"')
118  if beamstatus:
119  elements.append('-beamstatus')
120  if beamstatus=='stable':
121  elements.append('"STABLE BEAMS"')
122  if beamenergy:
123  elements.append('-beamenergy')
124  elements.append(str(beamenergy))
125  if beamfluctuation:
126  elements.append('-beamfluctuation')
127  elements.append(str(beamfluctuation))
128  if withTextOutput:
129  elements.append('-o')
130  elements.append(os.path.join(o,textoutname))
131  if annotateBoundaryRunnum:
132  elements.append('--annotateboundary')
133  command=' '.join(elements)
134  print command
135  if not dryrun:
136  statusAndOutput=commands.getstatusoutput(command)
137  print statusAndOutput[1]
static std::string join(char **cmd)
Definition: RemoteFile.cc:18
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.

References join().

Referenced by main().

426 def totalLumi2011vsFill(c,p='.',i='',o='',begFill="1616",endFill=None,selectionfile=None,beamenergy=None,beamstatus=None,beamfluctuation=None,dryrun=False,withTextOutput=False):
427  plotoutname='totallumivsfill-2011.png'
428  textoutname='totallumivsfill-2011.csv'
429  elements=['lumiSumPlot.py','-c',c,'-P',p,'-begin',begFill,'-batch',os.path.join(o,plotoutname),'-yscale both','fill']
430  if endFill:
431  elements.append('-end')
432  elements.append(endFill)
433  if beamstatus:
434  elements.append('-beamstatus')
435  if beamstatus=='stable':
436  elements.append('"STABLE BEAMS"')
437  if beamenergy:
438  elements.append('-beamenergy')
439  elements.append(str(beamenergy))
440  if beamfluctuation:
441  elements.append('-beamfluctuation')
442  elements.append(str(beamfluctuation))
443  if withTextOutput:
444  elements.append('-o')
445  elements.append(os.path.join(o,textoutname))
446  command=' '.join(elements)
447  print command
448  if not dryrun:
449  statusAndOutput=commands.getstatusoutput(command)
450  print statusAndOutput[1]
static std::string join(char **cmd)
Definition: RemoteFile.cc:18
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.

References join().

Referenced by main().

341 def totalLumi2011vsRun(c,p='.',i='',o='',begRun="160442",endRun=None,selectionfile=None,beamstatus=None,beamenergy=None,beamfluctuation=None,dryrun=False,withTextOutput=False):
342  plotoutname='totallumivsrun-2011.png'
343  textoutname='totallumivsrun-2011.csv'
344  elements=['lumiSumPlot.py','-c',c,'-P',p,'-begin',begRun,'-batch',os.path.join(o,plotoutname),'-yscale both','run']
345  if endRun:
346  elements.append('-end')
347  elements.append(endRun)
348  if beamstatus:
349  elements.append('-beamstatus')
350  if beamstatus=='stable':
351  elements.append('"STABLE BEAMS"')
352  if beamenergy:
353  elements.append('-beamenergy')
354  elements.append(str(beamenergy))
355  if beamfluctuation:
356  elements.append('-beamfluctuation')
357  elements.append(str(beamfluctuation))
358  if withTextOutput:
359  elements.append('-o')
360  elements.append(os.path.join(o,textoutname))
361  command=' '.join(elements)
362  print command
363  if not dryrun:
364  statusAndOutput=commands.getstatusoutput(command)
365  print statusAndOutput[1]
static std::string join(char **cmd)
Definition: RemoteFile.cc:18
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.

References join().

Referenced by main().

76 
77 def 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):
78  plotoutname='totallumivstime-2011.png'
79  textoutname='totallumivstime-2011.csv'
80  elements=['lumiSumPlot.py','-c',c,'-P',p,'-begin','"'+begTime+'"','-batch',os.path.join(o,plotoutname),'-yscale both','time']
81  if selectionfile:
82  elements.append('-i')
83  elements.append(selectionfile)
84  if endTime:
85  elements.append('-end')
86  elements.append('"'+endTime+'"')
87  if beamstatus:
88  elements.append('-beamstatus')
89  if beamstatus=='stable':
90  elements.append('"STABLE BEAMS"')
91  if beamenergy:
92  elements.append('-beamenergy')
93  elements.append(str(beamenergy))
94  if beamfluctuation:
95  elements.append('-beamfluctuation')
96  elements.append(str(beamfluctuation))
97  if withTextOutput:
98  elements.append('-o')
99  elements.append(os.path.join(o,textoutname))
100  if annotateBoundaryRunnum:
101  elements.append('--annotateboundary')
102  command=' '.join(elements)
103  print command
104  if not dryrun:
105  statusAndOutput=commands.getstatusoutput(command)
106  print statusAndOutput[1]
static std::string join(char **cmd)
Definition: RemoteFile.cc:18
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.

References join().

Referenced by main().

452 def totalLumivsFill(c,p='.',i='',o='',begFill="1005",endFill="",selectionfile=None,beamenergy=None,beamstatus=None,beamfluctuation=None,dryrun=False,withTextOutput=False):
453  '''
454  input:
455  c connect string
456  p authenticaion path
457  i input selection file
458  o output path
459  '''
460  plotoutname='totallumivsfill.png'
461  textoutname='totallumivsfill.csv'
462  elements=['lumiSumPlot.py','-c',c,'-P',p,'-begin',begFill,'-batch',os.path.join(o,plotoutname),'-yscale both','fill']
463  if endFill:
464  elements.append('-end')
465  elements.append(endFill)
466  if beamstatus:
467  elements.append('-beamstatus')
468  if beamstatus=='stable':
469  elements.append('"STABLE BEAMS"')
470  if beamenergy:
471  elements.append('-beamenergy')
472  elements.append(str(beamenergy))
473  if beamfluctuation:
474  elements.append('-beamfluctuation')
475  elements.append(str(beamfluctuation))
476  if withTextOutput:
477  elements.append('-o')
478  elements.append(os.path.join(o,textoutname))
479  command=' '.join(elements)
480  print command
481  if not dryrun:
482  statusAndOutput=commands.getstatusoutput(command)
print statusAndOutput[1]
static std::string join(char **cmd)
Definition: RemoteFile.cc:18
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.

References join().

Referenced by main().

367 def totalLumivsRun(c,p='.',i='',o='',begRun="132440",endRun="",selectionfile=None,beamstatus=None,beamenergy=None,beamfluctuation=None,dryrun=False,withTextOutput=False):
368  '''
369  input:
370  c connect string
371  p authenticaion path
372  i input selection file
373  o outputpath
374  '''
375  plotoutname='totallumivsrun.png'
376  textoutname='totallumivsrun.csv'
377  elements=['lumiSumPlot.py','-c',c,'-P',p,'-begin',begRun,'-batch',os.path.join(o,plotoutname),'-yscale both','run']
378  if endRun:
379  elements.append('-end')
380  elements.append(endRun)
381  if beamstatus:
382  elements.append('-beamstatus')
383  if beamstatus=='stable':
384  elements.append('"STABLE BEAMS"')
385  if beamenergy:
386  elements.append('-beamenergy')
387  elements.append(str(beamenergy))
388  if beamfluctuation:
389  elements.append('-beamfluctuation')
390  elements.append(str(beamfluctuation))
391  if withTextOutput:
392  elements.append('-o')
393  elements.append(os.path.join(o,textoutname))
394  command=' '.join(elements)
395  print command
396  if not dryrun:
397  statusAndOutput=commands.getstatusoutput(command)
398  print statusAndOutput[1]
static std::string join(char **cmd)
Definition: RemoteFile.cc:18
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.

References join().

Referenced by main().

139 def 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):
140  '''
141  input:
142  c connect string
143  p authenticaion path
144  i input selection file name
145  o output path
146  '''
147  plotoutname='totallumivstime.png'
148  textoutname='totallumivstime.csv'
149  elements=['lumiSumPlot.py','-c',c,'-P',p,'-begin','"'+begTime+'"','-batch',os.path.join(o,plotoutname),'-yscale both','time']
150  if selectionfile:
151  elements.append('-i')
152  elements.append(selectionfile)
153  if endTime:
154  elements.append('-end')
155  elements.append('"'+endTime+'"')
156  if beamstatus:
157  elements.append('-beamstatus')
158  if beamstatus=='stable':
159  elements.append('"STABLE BEAMS"')
160  if beamenergy:
161  elements.append('-beamenergy')
162  elements.append(str(beamenergy))
163  if beamfluctuation:
164  elements.append('-beamfluctuation')
165  elements.append(str(beamfluctuation))
166  if withTextOutput:
167  elements.append('-o')
168  elements.append(os.path.join(o,textoutname))
169  if annotateBoundaryRunnum:
170  elements.append('--annotateboundary')
171  command=' '.join(elements)
172  print command
173  if not dryrun:
174  statusAndOutput=commands.getstatusoutput(command)
175  print statusAndOutput[1]
static std::string join(char **cmd)
Definition: RemoteFile.cc:18
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.

References join().

Referenced by main().

177 def totalLumivstimeLastweek(c,p='.',i='',o='.',selectionfile=None,beamstatus=None,beamenergy=None,beamfluctuation=None,dryrun=False,withTextOutput=False):
178  '''
179  input:
180  c connect string
181  p authenticaion path
182  i input selection file name
183  o output path
184  ##fix me: year boundary is not considered!
185  '''
187  plotoutname='totallumivstime-weekly.png'
188  textoutname='totallumivstime-weekly.csv'
189  nowTime=datetime.datetime.now()
190  lastMondayStr=' '.join([str(nowTime.isocalendar()[0]),str(nowTime.isocalendar()[1]-1),str(nowTime.isocalendar()[2])])
191 
192  lastweekMonday=datetime.datetime(*time.strptime(lastMondayStr,'%Y %W %w')[0:5])
193  lastweekEndSunday=lastweekMonday+datetime.timedelta(days=7,hours=24)
194 
195  elements=['lumiSumPlot.py','-c',c,'-P',p,'-begin','"'+t.DatetimeToStr(lastweekMonday)+'"','-end','"'+t.DatetimeToStr(lastweekEndSunday)+'"','-batch',os.path.join(o,plotoutname),'time']
196  if withTextOutput:
197  elements.append('-o')
198  elements.append(os.path.join(o,textoutname))
199  if beamstatus:
200  elements.append('-beamstatus')
201  if beamstatus=='stable':
202  elements.append('"STABLE BEAMS"')
203  if beamenergy:
204  elements.append('-beamenergy')
205  elements.append(str(beamenergy))
206  if beamfluctuation:
207  elements.append('-beamfluctuation')
208  elements.append(str(beamfluctuation))
209  command=' '.join(elements)
210  print command
211  if not dryrun:
212  statusAndOutput=commands.getstatusoutput(command)
213  print statusAndOutput[1]
static std::string join(char **cmd)
Definition: RemoteFile.cc:18