Skip to content

Commit 710330f

Browse files
committed
Add lumisection output options, 100k wfs
1 parent 31e4882 commit 710330f

File tree

2 files changed

+22
-5
lines changed

2 files changed

+22
-5
lines changed

Configuration/PyReleaseValidation/python/relval_steps.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@
4545
steps = Steps()
4646

4747
#### Event to runs
48-
event_steps = [0.01,0.05,0.15,0.25,0.5,1] #in millions
49-
event_steps_k = ["10k","50k","150k","250k","500k","1M"]
48+
event_steps = [0.01,0.05,0.1,0.15,0.25,0.5,1] #in millions
49+
event_steps_k = ["10k","50k","100k","150k","250k","500k","1M"] ##TODO add an helper to convert the numbers to strings
5050
event_steps_dict = dict(zip(event_steps_k,event_steps))
5151
#### Production test section ####
5252
steps['ProdMinBias']=merge([{'cfg':'MinBias_8TeV_pythia8_TuneCUETP8M1_cff','--relval':'9000,300'},step1Defaults])

Configuration/PyReleaseValidation/scripts/das-up-to-nevents.py

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
import os
1212
import json
1313
import sys
14+
import itertools
15+
import json
1416

1517
## Helpers
1618
base_cert_url = "https://cms-service-dqmdc.web.cern.ch/CAF/certification/"
@@ -27,6 +29,13 @@ def get_url_clean(url):
2729

2830
return BeautifulSoup(buffer.getvalue(), "lxml").text
2931

32+
def get_lumi_ranges(i):
33+
result = []
34+
for _, b in itertools.groupby(enumerate(i), lambda pair: pair[1] - pair[0]):
35+
b = list(b)
36+
result.append([b[0][1],b[-1][1]])
37+
return result
38+
3039
def das_do_command(cmd):
3140
out = subprocess.check_output(cmd, shell=True, executable="/bin/bash").decode('utf8')
3241
return out.split("\n")
@@ -90,6 +99,7 @@ def no_intersection():
9099
parser.add_argument('--pandas', '-pd',action='store_true',help="Store the whole dataset (no event or threshold cut) in a csv")
91100
parser.add_argument('--proxy','-p', help='Allow to parse a x509 proxy if needed', type=str, default=None)
92101
parser.add_argument('--site','-s', help='Only data at specific site', type=str, default=None)
102+
parser.add_argument('--lumis','-l', help='Output file for lumi ranges for the selected files (if black no lumiranges calculated)', type=str, default=None)
93103
parser.add_argument('--precheck','-pc', action='store_true', help='Check run per run before building the dataframes, to avoid huge caching.')
94104
args = parser.parse_args()
95105

@@ -106,6 +116,7 @@ def no_intersection():
106116
threshold = args.threshold
107117
outfile = args.outfile
108118
site = args.site
119+
lumis = args.lumis
109120

110121
## get the greatest golden json
111122
year = dataset.split("Run")[1][2:4] # from 20XX to XX
@@ -134,7 +145,7 @@ def no_intersection():
134145
if web_fallback:
135146
cert_url = base_cert_url + cert_type + "/"
136147
json_list = get_url_clean(cert_url).split("\n")
137-
json_list = [c for c in json_list if "Golden" in c and "era" not in c]
148+
json_list = [c for c in json_list if "Golden" in c and "era" not in c and "Cert_C" in c]
138149
json_list = [[cc for cc in c.split(" ") if cc.startswith("Cert_C") and cc.endswith("json")][0] for c in json_list]
139150

140151
# the larger the better, assuming file naming schema
@@ -222,8 +233,14 @@ def no_intersection():
222233
df = df[df["events"] <= events] #jump too big files
223234
df.loc[:,"sum_evs"] = df.loc[:,"events"].cumsum()
224235
df = df[df["sum_evs"] < events]
225-
236+
226237
files = df.file
238+
239+
if lumis is not None:
240+
lumi_ranges = { int(r) : list(get_lumi_ranges(np.sort(np.concatenate(df.loc[df["run"]==r,"lumis"].values).ravel()).tolist())) for r in np.unique(df.run.values)}
241+
242+
with open(lumis, 'w') as fp:
243+
json.dump(lumi_ranges, fp)
227244

228245
if outfile is not None:
229246
with open(outfile, 'w') as f:
@@ -234,4 +251,4 @@ def no_intersection():
234251

235252
sys.exit(0)
236253

237-
254+

0 commit comments

Comments
 (0)