CMS 3D CMS Logo

lumiData2.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 from __future__ import print_function
3 VERSION='2.00'
4 import os,sys
5 import coral
6 from RecoLuminosity.LumiDB import argparse,lumiCalcAPI,sessionManager
7 
8 def listRemoveDuplicate(inlist):
9  d={}
10  for x in inlist:
11  d[x]=x
12  return d.values()
13 
14 def main():
15  parser = argparse.ArgumentParser(prog=os.path.basename(sys.argv[0]),description="list lumi data availability")
16  # add required arguments
17  parser.add_argument('-c',dest='connect',action='store',required=True,help='connect string to lumiDB')
18  # add optional arguments
19  parser.add_argument('-P',dest='authpath',action='store',help='path to authentication file')
20  parser.add_argument('-siteconfpath',dest='siteconfpath',action='store',
21  default=None,
22  required=False,
23  help='specific path to site-local-config.xml file, optional. If path undefined, fallback to cern proxy&server')
24  parser.add_argument('action',choices=['listrun'],help='command actions')
25  parser.add_argument('--minrun',
26  dest='minrun',
27  action='store',
28  type=int,
29  help='min run number')
30  parser.add_argument('--maxrun',
31  dest='maxrun',
32  action='store',
33  type=int,
34  help='max run number')
35  parser.add_argument('--minfill',
36  dest='minfill',
37  type=int,
38  action='store',
39  help='min fill number')
40  parser.add_argument('--maxfill',
41  dest='maxfill',
42  type=int,
43  action='store',
44  help='max fill number')
45  parser.add_argument('--verbose',
46  dest='verbose',
47  action='store_true',
48  help='verbose mode for printing' )
49  parser.add_argument('--debug',dest='debug',action='store_true',help='debug')
50  # parse arguments
51  options=parser.parse_args()
52  if options.authpath:
53  os.environ['CORAL_AUTH_PATH'] = options.authpath
54  svc=sessionManager.sessionManager(options.connect,authpath=options.authpath,debugON=options.debug)
55  session=svc.openSession(isReadOnly=True,cpp2sqltype=[('unsigned int','NUMBER(10)'),('unsigned long long','NUMBER(20)')])
56  reqTrg=True
57  reqHLT=False
58  session.transaction().start(True)
59  schema=session.nominalSchema()
60  runlist=lumiCalcAPI.runList(schema,None,runmin=options.minrun,runmax=options.maxrun,startT=None,stopT=None,l1keyPattern=None,hltkeyPattern=None,amodetag=None,nominalEnergy=None,energyFlut=None,requiretrg=reqTrg,requirehlt=reqHLT)
61  session.transaction().commit()
62  if options.action == 'listrun':
63  if not runlist:
64  print('[]')
65  sys.exit(0)
66  singlelist=sorted(listRemoveDuplicate(runlist))
67  print(singlelist)
68  del session
69  del svc
70 if __name__=='__main__':
71  main()
72 
Definition: start.py:1
def main()
Definition: lumiData2.py:14
S & print(S &os, JobReport::InputFile const &f)
Definition: JobReport.cc:66
Definition: main.py:1
def listRemoveDuplicate(inlist)
Definition: lumiData2.py:8
def runList(schema, datatagid, runmin=None, runmax=None, fillmin=None, fillmax=None, startT=None, stopT=None, l1keyPattern=None, hltkeyPattern=None, amodetag=None, nominalEnergy=None, energyFlut=0.2, requiretrg=True, requirehlt=True, preselectedruns=None, lumitype='HF')
Definition: lumiCalcAPI.py:48