4 from argparse
import ArgumentParser
6 from FWCore.PythonUtilities.LumiList
import LumiList
9 allRuns = lumiList.getRuns()
12 if minRun
and int(run) < minRun:
13 runsToRemove.append (run)
14 if maxRun
and int(run) > maxRun:
15 runsToRemove.append (run)
16 lumiList.removeRuns (runsToRemove)
18 if __name__ ==
'__main__':
20 parser = ArgumentParser()
21 parser.add_argument(
'--output', dest=
'output', type=str,
22 help=
'Save output to file OUTPUT')
23 parser.add_argument(
"alpha_json", metavar=
"alpha.json[:142300-145900]", type=str, nargs=
'+')
25 options = parser.parse_args()
27 minMaxRE = re.compile (
r'(\S+):(\d+)-(\d*)')
30 for filename
in options.alpha_json:
32 match = minMaxRE.search (filename)
34 filename = match.group(1)
35 minRun =
int( match.group(2) )
37 maxRun =
int( match.group(3) )
40 if maxRun
and minRun > maxRun:
41 raise RuntimeError(
"Minimum value (%d) is greater than maximum value (%d) for file '%s'" % (minRun, maxRun, filename))
42 localList = LumiList (filename = filename)
43 filterRuns (localList, minRun, maxRun)
44 finalList = finalList | localList
47 finalList.writeJSON (options.output)
def filterRuns(lumiList, minRun, maxRun)
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)