Skip to content

Commit

Permalink
Merge pull request #60 from uhh-cms/fix/qcd_with_systs
Browse files Browse the repository at this point in the history
Fix data shape in qcd hook.
  • Loading branch information
aalvesan authored Jan 22, 2025
2 parents 71b3dbf + 47895d7 commit 792a2d5
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions hbt/config/hist_hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,20 @@ def qcd_estimation(task, hists):
ss_noniso_data = hist_to_num(get_hist(data_hist, "ss_noniso"), "ss_noniso_data")
ss_iso_data = hist_to_num(get_hist(data_hist, "ss_iso"), "ss_iso_data")

# data will always have a single shift whereas mc might have multiple,
# broadcast numbers in-place manually if necessary
if (n_shifts := mc_hist.axes["shift"].size) > 1:
def broadcast_data_num(num: sn.Number) -> None:
num._nominal = np.repeat(num.nominal, n_shifts, axis=0)
for name, (unc_up, unc_down) in num._uncertainties.items():
num._uncertainties[name] = (
np.repeat(unc_up, n_shifts, axis=0),
np.repeat(unc_down, n_shifts, axis=0),
)
broadcast_data_num(os_noniso_data)
broadcast_data_num(ss_noniso_data)
broadcast_data_num(ss_iso_data)

# estimate qcd shapes in the three sideband regions
# shapes: (SHIFT, VAR)
os_noniso_qcd = os_noniso_data - os_noniso_mc
Expand Down

0 comments on commit 792a2d5

Please sign in to comment.