CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
printJSON.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 
3 import sys
4 import optparse
5 from FWCore.PythonUtilities.LumiList import LumiList
6 
7 
8 if __name__ == '__main__':
9 
10  parser = optparse.OptionParser ("Usage: %prog alpha.json")
11  parser.add_option ('--range', dest='range', action='store_true',
12  help='Print out run range only')
13  # required parameters
14  (options, args) = parser.parse_args()
15  if len (args) != 1:
16  raise RuntimeError("Must provide exactly one input file")
17 
18  alphaList = LumiList (filename = args[0]) # Read in first JSON file
19  if options.range:
20  keys = alphaList.compactList.keys()
21  minRun = min (keys)
22  maxRun = max (keys)
23  print "runs %s - %s" % (minRun, maxRun)
24  sys.exit()
25  print alphaList