Skip to content

Commit

Permalink
add fill_hist funtion
Browse files Browse the repository at this point in the history
  • Loading branch information
aalvesan committed Jul 15, 2024
1 parent ed8d064 commit f265547
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions hbt/config/hist_hooks.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import order as od
import numpy as np
from columnflow.util import maybe_import
from columnflow.columnar_util import fill_hist

hist = maybe_import("hist")

Expand Down Expand Up @@ -82,16 +83,11 @@ def ana_ABCD(task, hists):
else:
create_regions(rate, rate_int_dic, rate_int, cat_id, regions, mc_hist, data_hist, cat_name, cat_parent)

# initialise empty QCD histograms
hists[cfg.processes.n.qcd] = rate.copy()
hists[cfg.processes.n.qcd].reset()
# NOTE: the ABCD regions have the same entries for both parent categories (incl and 2j) why ?

# for cat_parent in regions.keys():
# rates[cat_parent] = {}
# per bin conversion factor
# rates[cat_parent]["scale_factor"] = rates[cat_parent]["C"].values() / rates[cat_parent]["D"].values()
# replace NaN with zero in case of division by zero
#scale_factor = np.nan_to_num(rates["C"].values() / rates["D"].values())
# initialise empty QCD histograms
qcd_hist = rate.copy()
qcd_hist = qcd_hist.reset()

scale_factor = {}
for cat_parent in regions.keys():
Expand All @@ -102,7 +98,9 @@ def ana_ABCD(task, hists):
embed()
quit()

# hists[cfg.processes.n.qcd].axes[0][0] = rates[cat_parent]["B"] * rates[cat_parent]["scale_factor"]
# add QCD histogram to hists
# TODO: BUG in fill_hist function (ValueError: got multi-dimensional hist but only one dimensional data)
# hists[cfg.processes.n.qcd] = fill_hist(qcd_hist, rate) * scale_factor["incl"]

return hists

Expand Down

0 comments on commit f265547

Please sign in to comment.