6 from FWCore.PythonUtilities.LumiList
import LumiList
10 allRuns = lumiList.getRuns()
13 if minRun
and int(run) < minRun:
14 runsToRemove.append (run)
15 if maxRun
and int(run) > maxRun:
16 runsToRemove.append (run)
17 lumiList.removeRuns (runsToRemove)
21 if __name__ ==
'__main__':
23 parser = optparse.OptionParser (
"Usage: %prog alpha1.json [alpha2.json:142300-145900]")
24 parser.add_option (
'--output', dest=
'output', type=
'string',
25 help=
'Save output to file OUTPUT')
27 (options, args) = parser.parse_args()
29 raise RuntimeError(
"Must provide at least one input file")
31 minMaxRE = re.compile (
r'(\S+):(\d+)-(\d*)')
36 match = minMaxRE.search (filename)
38 filename = match.group(1)
39 minRun =
int( match.group(2) )
41 maxRun =
int( match.group(3) )
44 if maxRun
and minRun > maxRun:
45 raise RuntimeError(
"Minimum value (%d) is greater than maximum value (%d) for file '%s'" % (minRun, maxRun, filename))
46 localList = LumiList (filename = filename)
47 filterRuns (localList, minRun, maxRun)
48 finalList = finalList | localList
51 finalList.writeJSON (options.output)
def filterRuns(lumiList, minRun, maxRun)