Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:31:56

0001 #!/usr/bin/env python3
0002 #RelValMacro.py
0003 
0004 import sys
0005 import json
0006 import pprint
0007 import RelValMacro_ext
0008 
0009 def spaceEscape(myString):
0010 #return "\"" + str(myString) + "\""
0011     return str(myString)
0012 
0013 if len(sys.argv) == 6:
0014     ref_vers = sys.argv[1]
0015     val_vers = sys.argv[2]
0016     rfname = sys.argv[3]
0017     vfname = sys.argv[4]
0018     range = sys.argv[5]
0019     
0020     with open('InputRelVal.json', 'r') as fp:
0021         inputFile = json.load(fp)
0022         for histogram in inputFile:
0023             if range in inputFile[histogram]:
0024                 if inputFile[histogram]['drawSwitch']:
0025                     #Call RelValMacro.exe with histogram parameters
0026                     histName = spaceEscape(histogram)
0027                     ofileName = spaceEscape(inputFile[histogram]['outLabel'])
0028                     nRebin = spaceEscape(inputFile[histogram][range]['rebin'])
0029                     xAxisMin = spaceEscape(inputFile[histogram][range]['xAxisMin'])
0030                     xAxisMax = spaceEscape(inputFile[histogram][range]['xAxisMax'])
0031                     yAxisMin = spaceEscape(inputFile[histogram][range]['yAxisMin'])
0032                     yAxisMax = spaceEscape(inputFile[histogram][range]['yAxisMax'])
0033                     dimFlag = spaceEscape(inputFile[histogram]['dimFlag'])
0034                     statFlag = spaceEscape(inputFile[histogram]['statFlag'])
0035                     chi2Flag = spaceEscape(inputFile[histogram]['chi2Flag'])
0036                     logFlag = spaceEscape(inputFile[histogram]['logFlag'])
0037                     ratioFlag = spaceEscape(inputFile[histogram]['ratioFlag'])
0038                     refColor = spaceEscape(inputFile[histogram]['refColor'])
0039                     valColor = spaceEscape(inputFile[histogram]['valColor'])
0040                     xAxisTitle = spaceEscape(inputFile[histogram]['xAxisTitle'])
0041                     histName2 = spaceEscape(inputFile[histogram]['histName2'])
0042                     normFlag = spaceEscape(inputFile[histogram]['normFlag'])
0043                     cmd = ref_vers + "|" + val_vers + "|" + rfname + "|" + vfname + "|" + histName + "|" + ofileName + "|" + nRebin + "|" + xAxisMin + "|" + xAxisMax + "|" + yAxisMin + "|" + yAxisMax + "|" + dimFlag + "|" + statFlag + "|" + chi2Flag + "|" + logFlag + "|" + ratioFlag + "|" + refColor + "|" + valColor + "|" + xAxisTitle + "|" + histName2 + "|" + normFlag
0044                     RelValMacro_ext.RelValMacro(cmd)
0045 else:
0046     print ("Usage: ./RelValMacro.py ref_vers val_vers ref_file_name val_file_name range[High/Medium/Low]")
0047 #std::string ref_vers, std::string val_vers, std::string rfname, std::string vfname, std::string histName, std::string ofileName, int nRebin, double xAxisMin, double xAxisMax, double yAxisMin, double yAxisMax, std::string dimFlag, std::string statFlag, std::string chi2Flag, std::string logFlag, int refCol, int valCol, std::string xAxisTitle, std::string histName2, std::string normFlag