3 from FWCore.PythonUtilities.XML2Python
import xml2obj
4 from FWCore.PythonUtilities.LumiList
import LumiList
5 from pprint
import pprint
8 from argparse
import ArgumentParser
11 if __name__ ==
'__main__':
13 parser = ArgumentParser()
14 parser.add_argument(
'--output', dest=
'output', type=str,
15 help=
'Save output to file OUTPUT')
16 parser.add_argument(
"job_fjr", metavar=
"job.fjr", nargs=
'+', type=str)
17 options = parser.parse_args()
20 for fjr
in options.job_fjr:
22 obj = xml2obj (filename=fjr)
24 print(
"'%s' is not an framework job report. Skipping." % fjr)
26 for inputFile
in obj.InputFile:
28 runObjects = inputFile.Runs.Run
29 for run
in runObjects:
30 runNumber = int (run.ID)
31 runList = runsLumisDict.setdefault (runNumber, [])
32 for lumiPiece
in run.LumiSection:
33 lumi = int (lumiPiece.ID)
37 if isinstance(inputFile.Runs, str):
38 runObjects = [inputFile.Runs]
40 runObjects = inputFile.Runs
42 for runObject
in runObjects:
44 runs = ast.literal_eval(runObject)
45 for (run, lumis)
in runs.items():
46 runList = runsLumisDict.setdefault (
int(run), [])
51 print(
"Run missing in '%s'. Skipping." % fjr)
54 jsonList = LumiList (runsAndLumis = runsLumisDict)
56 jsonList.writeJSON (options.output)
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)