Skip to content

[RF] Make RooBinWidthFunction depend directly on observables - #23298

Open
cburgard wants to merge 3 commits into
root-project:masterfrom
cburgard:roofit/roobinwidthfunction-observables
Open

[RF] Make RooBinWidthFunction depend directly on observables#23298
cburgard wants to merge 3 commits into
root-project:masterfrom
cburgard:roofit/roobinwidthfunction-observables

Conversation

@cburgard

@cburgard cburgard commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

This Pull request:

Changes or fixes:

At the DEMOS meeting on September 4, 2026, the current implementation of RooBinWidthFunction was identified as an obstacle to clean HS3 export: the object references a histogram function rather than directly storing its actual inputs—the observables.

This PR removes that indirection in both RooFit and HS3. RooBinWidthFunction now stores an observable list and computes bin volumes from the observables’ default binnings. HS3 represents those inputs through a "variables" list, with binning restored from "domains".

The changes:

  • Add a RooArgList constructor while retaining the legacy RooHistFunc constructor.
  • Preserve cached bin volumes, RooFit evaluation caching, scalar and batch evaluation, and plotting support.
  • Add schema evolution for version-1 ROOT files and retain support for legacy histogram-reference JSON.
  • Make the live observables’ binning authoritative when it differs from the data histogram’s binning.
  • Add numerical, caching, and serialization regression tests, including a historical ROOT fixture.

Validation includes a successful full ROOT build and 131 passing tests covering RooBinWidthFunction, HS3, HistFactory, and component plotting. The initial regression-test commit also passes against the version-1 implementation.

The meeting also raised the possibility of extracting bin-index computation into a standalone RooFit class. This PR does not preclude that work: depending on the developers’ preference, it can be merged independently or serve as the baseline for that further refactoring.

Checklist:

  • tested changes locally
  • updated the docs (if necessary)

This PR fixes #

Cover multidimensional volumes and inverse volumes, evaluation and bin-volume
caching, plotting hints, disable/compile behavior, and workspace persistence
through the existing RooHistFunc constructor.

Include a version-1 ROOT fixture and its regeneration recipe for the schema
migration tests. Register the tests with the existing RooFitCore test target.

Validation: all six tests pass against the available version-1 ROOT build.
Replace the histogram proxy with a RooListProxy and retain the RooHistFunc
constructor as a forwarding compatibility overload. Use the live observables'
default binnings, including when they differ from the data histogram's bins.

Keep cached bin volumes and RooFit value caching, and implement scalar/batch
bin lookup and plotting hints without a histogram dependency. Add version-1
schema evolution with deferred proxy repair for shared histogram references.
Extend regression coverage for the new API, cache invalidation, observable
redirection, histogram lifetime independence, and migrated workspaces.

Update the HS3 importer/exporter to use variables instead of the removed
histFunc() accessor so the intermediate commit remains buildable. Continue
accepting legacy histogram-reference JSON.

Validation: 12 RooBinWidthFunction tests, source compilation, and the full
ROOT build and HS3/HistFactory integration suites for this implementation.
Check numerical round trips with live-variable binning that differs from the
histogram binning. Verify the variables representation and keep binning
metadata in domains rather than in the bin-volume function.

Add an inline multidimensional domains-only fixture and regression coverage
for importing legacy histogram-reference JSON.

Validation: all 73 HS3 tests pass, including the three bin-volume tests.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants