CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_4_5_patch3/src/FWCore/PythonUtilities/scripts/printJSON.py

Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 
00003 import sys
00004 import optparse
00005 from FWCore.PythonUtilities.LumiList import LumiList
00006 
00007 
00008 if __name__ == '__main__':
00009     
00010     parser = optparse.OptionParser ("Usage: %prog alpha.json")
00011     parser.add_option ('--range', dest='range', action='store_true',
00012                        help='Print out run range only')
00013     # required parameters
00014     (options, args) = parser.parse_args()
00015     if len (args) != 1:
00016         raise RuntimeError, "Must provide exactly one input file"
00017 
00018     alphaList = LumiList (filename = args[0])  # Read in first  JSON file
00019     if options.range:
00020         keys = alphaList.compactList.keys()
00021         minRun = min (keys)
00022         maxRun = max (keys)
00023         print "runs %s - %s" % (minRun, maxRun)
00024         sys.exit()
00025     print alphaList