Skip to content

Commit

Permalink
Fix lumi calculation (keep pairing of runs and lumisections while sor…
Browse files Browse the repository at this point in the history
…ting)
  • Loading branch information
lredar committed Feb 10, 2025
1 parent 1725016 commit bd63f89
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions scripts/dump_processed.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,16 @@ def dump_lumi(output, fname):
lumi.extend(output[m][f]["lumi"].value)
run.extend(output[m][f]["run"].value)

lumi, run = np.array(sorted(lumi)), np.array(sorted(run))
# Sort runs and keep lumisections matched
run, lumi = np.array(run), np.array(lumi)
sorted_indices = np.lexsort((lumi, run)) # Sort by run first, then lumi
run = run[sorted_indices]
lumi = lumi[sorted_indices]
# Create dictionary with ls values for each run
dicts = {}
for r in list(set(run)):
dicts[str(r)] = lumi[r == run]
for r in np.unique(run):
dicts[str(r)] = lumi[run == r]
# Convert to format for brilcalc
for r in dicts.keys():
ar = ak.singletons(ak.Array(dicts[r]))
ars = ak.concatenate([ar, ar], axis=-1)
Expand Down

0 comments on commit bd63f89

Please sign in to comment.