CMS 3D CMS Logo

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