4 from argparse
import ArgumentParser, ArgumentDefaultsHelpFormatter
6 from FWCore.PythonUtilities.LumiList
import LumiList
8 if __name__ ==
'__main__':
10 parser = ArgumentParser(formatter_class=ArgumentDefaultsHelpFormatter)
11 parser.add_argument(
'--output', dest=
'output', type=str,
12 help=
'Save output to file OUTPUT')
13 parser.add_argument(
'--runIndex', dest=
'runIndex', type=int,
15 help=
'column to be converted to run number')
16 parser.add_argument(
'--lumiIndex', dest=
'lumiIndex', type=int,
18 help=
'column to be converted to lumi section number')
19 parser.add_argument(
"input", metavar=
"input.csv", type=str)
20 options = parser.parse_args()
22 sepRE = re.compile (
r'[\s,;:]+')
24 events = open (options.input,
'r') 25 runIndex, lumiIndex = options.runIndex, options.lumiIndex 26 minPieces = max (runIndex, lumiIndex) + 1 28 pieces = sepRE.split (line.strip())
29 if len (pieces) < minPieces:
32 run, lumi =
int( pieces[runIndex] ),
int( pieces[lumiIndex] )
35 runLumiDict.setdefault (run, []).append (lumi)
36 jsonList = LumiList (runsAndLumis = runLumiDict)
38 jsonList.writeJSON (options.output)
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)