Skip to content

Commit

Permalink
update lumi selection tools to support a simple lumi list
Browse files Browse the repository at this point in the history
  • Loading branch information
slava77devel committed Oct 21, 2021
1 parent e69a7cd commit 44a3dc1
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 5 deletions.
6 changes: 5 additions & 1 deletion Configuration/PyReleaseValidation/python/MatrixUtil.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,11 @@ def lumis(self):
if self.ls:
for run in self.ls.keys():
run_lumis = []
for rng in self.ls[run]: run_lumis.append(str(rng[0])+","+str(rng[1]))
for rng in self.ls[run]:
if isinstance(rng, int):
run_lumis.append(str(rng))
else:
run_lumis.append(str(rng[0])+","+str(rng[1]))
query_lumis.append(":".join(run_lumis))
return query_lumis

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@

def match_in(sub_list,lumi_list):
for i in range(int(sub_list[0]),int(sub_list[1])+1):
if i >= int(lumi_list[0]) and i <= int(lumi_list[1]): return True
if len(lumi_list) == 1:
if i == int(lumi_list[0]): return True
else:
if i >= int(lumi_list[0]) and i <= int(lumi_list[1]): return True
return False

def check_lumi_ranges(given_lumi_list , sub_range):
Expand Down
12 changes: 9 additions & 3 deletions FWCore/PythonUtilities/python/LumiList.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,13 @@ def __init__(self, filename = None, lumis = None, runsAndLumis = None, runs = No
newLumis = []
for lumi in sorted(self.compactList[run]):
# If the next lumi starts inside or just after the last just change the endpoint of the first
if newLumis and newLumis[-1][0] <= lumi[0] <= newLumis[-1][1] + 1:
newLumis[-1][1] = max(newLumis[-1][1], lumi[1])
else:
if isinstance(lumi, int):
newLumis.append(lumi)
else:
if newLumis and newLumis[-1][0] <= lumi[0] <= newLumis[-1][1] + 1:
newLumis[-1][1] = max(newLumis[-1][1], lumi[1])
else:
newLumis.append(lumi)
self.compactList[run] = newLumis

def __sub__(self, other): # Things from self not in other
Expand Down Expand Up @@ -272,6 +275,9 @@ def _getLumiParts(self):
for run in runs:
lumis = self.compactList[run]
for lumiPair in sorted(lumis):
if isinstance(lumiPair, int):
parts.append(str("%s:%s" % (run, lumiPair)))
continue
if lumiPair[0] == lumiPair[1]:
parts.append(str("%s:%s" % (run, lumiPair[0])))
else:
Expand Down

0 comments on commit 44a3dc1

Please sign in to comment.