Skip to content

Multiply splines that share a binning before migrating them to the fit binning - #625

Draft
leehagaman wants to merge 1 commit into
markrosslonergan:developfrom
leehagaman:binned_spline_group_fix
Draft

leehagaman wants to merge 1 commit into
markrosslonergan:developfrom
leehagaman:binned_spline_group_fix

Conversation

@leehagaman

Copy link
Copy Markdown
Contributor

In binned mode, a spline defined in a different binning from the one being filled (e.g. free-flux splines in true E_ν, filled into reco E) is migrated through the (spline bin, reco bin) event histogram. Previously each spline was migrated separately and the migrated factors were multiplied. That's only correct to first order in the shifts. It fails badly for binned_unconstrained (free-flux) splines, where each spline scales a disjoint set of true bins by up to 10×. A reco bin fed by several true bins then gets scaled by every spline's averaged factor: ∏_i (1 + x_i w_i) instead of the correct 1 + Σ_i x_i w_i. For example, with all free-flux knobs at 9 (10×), binned mode predicted 39–392× CV, where event-by-event gives ≤10×.

This change multiplies the per-bin factors of all splines that share a binning first, then migrates the product once. The binning's first spline carries the product, and the others contribute 1. That's exact for free flux. For other splines binned outside the fit variable it removes the second-order error, and splines binned in the fit variable are unchanged. It's applied in the uncached binned fill, the cached fill (full and incremental), and the analytic gradient. Pre-migration flux splines in visible-decay models are left on their own path.

Tested on the GUMP Oct13 free-flux XML with random throws of all 95 splines. Binned now matches event-by-event within 0.16%, the same agreement as configs with no free-flux splines. The cached and incremental fills match the uncached fill to about 1e-6, and the analytic gradient matches finite differences. Free-flux surfaces made with binned mode before this fix should be rerun.

(PR text generated by Claude)

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant