Skip to content

Commit

Permalink
write idea chi2 infos propagation, chi2 calculation not possible in h…
Browse files Browse the repository at this point in the history
…ist_hooks due to axes concatenation with categories
  • Loading branch information
nprouvost committed Dec 16, 2024
1 parent 7497d2c commit 7bd5768
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
2 changes: 2 additions & 0 deletions hbt/config/hist_hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -872,6 +872,7 @@ def LO_primitive_funtion(values, a, b, c, d, e, f):

pcovs = []
# minuit_pcovs = []
chi2_infos = {}

# loop over bins and calculate the morphed value
for cat_ in range(len(model_hists[0].axes[0].centers)):
Expand Down Expand Up @@ -1017,6 +1018,7 @@ def LO_primitive_funtion(values, a, b, c, d, e, f):
morphed_variances_correct_categorization = morphed_variances[np.argsort(np.argsort(model_hists[0].axes[0]))]

# insert the new hist into the hists dict
new_proc.x.chi2_infos = chi2_infos
hist[new_proc] = new_hist

# insert values into the new histogram
Expand Down
11 changes: 8 additions & 3 deletions hbt/plotting/morphing_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -837,9 +837,14 @@ def plot_3d_morphing(
# morphed histogram? The error of the bin value of the non-morphed histogram?
# might depend on which method is chosen above.

# TODO: implement my solution: calculate the chi2 for the morphed histograms for each point
# in the hist_hooks and propagate the chi2 values to the plotting function as auxiliary data
# in the process instance from the hists dictionary
# TODO: implement my solution: propagate the points used for the fit from the hist_hooks
# then calculate the chi2 for each point with the corresponding guidance points
# BUT IS IT EVEN NECESSARY?

# -> for which fit do we want the chi 2? fit all the points in the histogram (= different coupling values)
# without caring about how they were created? or only the points that were used for the fit of the histogram
# at this specific coupling constant value (=points used for the morphing)?


chi2 = np.sum((hists_to_plot[vbf_point["name"]].values() - non_morphed_hists["name"].values())**2 /
hists_to_plot[vbf_point["name"]].variances())
Expand Down

0 comments on commit 7bd5768

Please sign in to comment.