Repository navigation
Conversation
cburgard
requested review from
dpiparo,
guitargeek,
hageboeck and
silverweed
as code owners
November 5, 2026 13:36
Closed
1 task done
A RooParamHistFunc with relative parameters (the default) takes in bin i the value p_i times the content of bin i of its histogram. This is what a HistFactory sample does, so it is now written like one: as a `product` of a `step` with the histogram (RooHistFunc, `<name>_nominal`) and a `step` with the parameters (ParamHistFunc, `<name>_scale`). It is read back as a RooProduct of these two, with the same values and integral. RooParamHistFunc with absolute parameters (paramRelative = false) is not supported and raises an error: its analytical integral is not consistent with its value. The observable must have the binning of the histogram. Assisted-by: claude-code:claude-opus-5-5
cburgard
force-pushed
the
hs3-paramhistfunc
branch
from
November 6, 2026 06:16
00715f2 to
9d290b0
Compare
Contributor
|
Hi @cburgard! If we deprecate RooParamHistFunc and remove in ROOT 6.46 (see #24003 (comment)), would you still want this PR? |
Contributor
|
The deprecation PR was already merged: So RooParamHistFunc is frozen, and we don't have to add HS3 export. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This Pull request:
Adds HS3 export of
RooParamHistFunc(RooFit core), which so far had no HS3 mapping at all.A
RooParamHistFuncwith relative parameters (paramRelative = true, the default, e.g. inrf709_BarlowBeeston) takes in bin i the value pi times the content wi of bin i of its histogram. That is what a HistFactory sample does, so it is written like one:{"name": "func", "type": "product", "factors": ["func_nominal", "func_scale"]} {"name": "func_nominal", "type": "step", "data": {"axes": [...], "contents": [...]}} {"name": "func_scale", "type": "step", "variables": ["x"], "parameters": ["func_gamma_bin_0", ...], "axes": [...]}i.e. a
productof the dataset-likestep(RooHistFunc) and the parameter-liststep(the HistFactoryParamHistFunc). On import, it becomes aRooProductof these two, with the same value in every bin and the same integral. From the second export on, the JSON is stable.Not supported, with an explicit error:
paramRelative = false): the analytical integral ofRooParamHistFuncis then not consistent with its value (it is Σ pi · wi · voli instead of Σ pi · voli), see [RF] RooParamHistFunc: analytical integral inconsistent with value forparamRelative = false#24003. A mapping toParamHistFuncwould have a different integral than the original. This can be added once it is clear whether this will be fixed inRooParamHistFuncor the class is going to be deprecated.ParamHistFunctakes its bins from the observable).RooHistConstraint, the constraint term that goes withRooParamHistFuncin Barlow-Beeston setups, is built on the fly when the likelihood is created and is not persisted in workspaces, so it is not mapped.Related: #24001 (per-bin parameters of
ParamHistFuncin HS3 bin order; one-dimensional functions like the one written here are not affected).Changes or fixes:
JSONFactories_RooFitCore.cxxRooParamHistFunc. It creates the two step functions as temporary objects and queues them for export (registered withautoExportDependants = false, so that the queued objects are exported).testRooFitHS3.cxxRooParamHistFuncAsHistFactoryProduct: the written structure, values per bin and integral after the round trip, a stable JSON from the second export on, and the errors for absolute parameters and for a differing binning.Checklist:
Tests run (Linux, Ubuntu 26.04, GCC 15.2, RelWithDebInfo,
-Droofit=ON -Dtesting=ON):testRooFitHS3105 → 106 tests,testJSONInterface1,testHistFactory69, all passing. clang-format clean.AI assistance: Claude Code (claude-opus-5-5) implemented the changes, the test and this description under review of the author. The commit carries
Assisted-by: claude-code:claude-opus-5-5.🤖 Generated with Claude Code