3 from __future__
import print_function
7 from FWCore.PythonUtilities.LumiList
import LumiList
11 allRuns = lumiList.getRuns()
14 if minRun
and int(run) < minRun:
15 runsToRemove.append (run)
16 if maxRun
and int(run) > maxRun:
17 runsToRemove.append (run)
18 lumiList.removeRuns (runsToRemove)
22 if __name__ ==
'__main__':
24 parser = optparse.OptionParser (
"Usage: %prog alpha1.json [alpha2.json:142300-145900]")
25 parser.add_option (
'--output', dest=
'output', type=
'string',
26 help=
'Save output to file OUTPUT')
28 (options, args) = parser.parse_args()
30 raise RuntimeError(
"Must provide at least one input file")
32 minMaxRE = re.compile (
r'(\S+):(\d+)-(\d*)')
37 match = minMaxRE.search (filename)
39 filename = match.group(1)
40 minRun =
int( match.group(2) )
42 maxRun =
int( match.group(3) )
45 if maxRun
and minRun > maxRun:
46 raise RuntimeError(
"Minimum value (%d) is greater than maximum value (%d) for file '%s'" % (minRun, maxRun, filename))
47 localList = LumiList (filename = filename)
48 filterRuns (localList, minRun, maxRun)
49 finalList = finalList | localList
52 finalList.writeJSON (options.output)