[RF][HS3] Add structured interpolation support for HistFactory modifiers - #22844
[RF][HS3] Add structured interpolation support for HistFactory modifiers#22844Phmonski wants to merge 6 commits into
Conversation
Test Results 23 files 23 suites 3d 16h 56m 30s ⏱️ Results for commit b080fa3. ♻️ This comment has been updated with latest results. |
ad9e6ac to
4535201
Compare
|
There is still some interpolation codes that need to be adressed: elem["interpolationCodes"].fill_seq(fip->interpolationCodes());@cburgard i assume this should also follow the interpolation conventions of the histfactory modifiers? |
yes, that would be ideal |
4535201 to
b080fa3
Compare
|
@Phmonski is this ready to be reviewed? |
|
Yes, It should be ready. |
|
thanks! @guitargeek would you mind reviewing this PR? |
…able The mapping between the structured HS3 interpolation descriptors and the RooFit integer codes was spread across four functions (two per direction, one pair per interpolation class) plus a pair of dispatchers. They all encoded the same table and had to be kept mutually consistent by hand. Replace them with a single static table that mirrors the documented mapping, plus two generic lookups. The class-specific quirks (legacy code 3 aliasing code 2, and FlexibleInterpVar treating code 4 and 5 identically) are now captured by two explicit normalization lines rather than being scattered across switch cases. No behavioural change; all HS3 interpolation tests still pass.
The analytical-integral routines carried several large commented-out blocks (old dirty-inhibit experiments, an abandoned numeric integral attempt, and two obsolete per-code interpolation loops), and the file ended with a fully commented-out printMetaArgs implementation. None of it is compiled; remove it. The git history preserves the old code for anyone who wants to revisit those ideas. No behavioural change.
FlexibleInterpVar and PiecewiseInterpolation had an almost identical setInterpCodeForParam(): the same range check, the same code-3 -> code-2 aliasing (with the same explanatory comment), and the same error messages, differing only in the highest supported code and the class name in the log output. Keeping the code-3 rule correct meant editing it in two places in lockstep. Extract the shared logic into a small internal helper, Detail::setInterpolationCode(), used by both classes. Each override now just forwards its parameter list and maximum code and flags itself value-dirty when a code was stored. No behavioural change; the error messages are preserved verbatim.
b080fa3 to
7d3dd58
Compare
Summary
This PR adds bidirectional RooFit support for the structured interpolation representation introduced in hep-statistics-serialization-standard/hep-statistics-serialization-standard#103.
RooFit now exports interpolation behavior using the descriptive HS3
{type, in, out}structure instead of RooFit-specific integer codes. Import remains backward compatible with legacy integer interpolation fields and files relying on the previous implicit defaults.Main changes
type,in, and nullableoutfields.FlexibleInterpVarandPiecewiseInterpolation.default_interpolation, selected from the most common interpolation behavior acrossnormsysandhistosysmodifiers.{type: mult, in: poly6, out: exp}when frequencies are tied, followed by deterministic descriptor ordering.default_interpolationwhen a channel has no eligible modifiers.FlexibleInterpVarcodes 4 and 5.PiecewiseInterpolationconstructor accepting one interpolation code per parameter. This allows mixed histosys interpolation codes and repeated parameters to round-trip faithfully.No interpolation mathematics or persistent class data layouts are changed.
Supported mappings
PiecewiseInterpolationFlexibleInterpVar{add, poly1, null}{mult, exp, null}{add, poly2, poly1}{add, poly6, poly1}{mult, poly6, exp}{mult, poly6, poly1}The class-dependent interpretation is important because RooFit code 4 has different semantics in
PiecewiseInterpolationandFlexibleInterpVar.Import compatibility
Interpolation is resolved in the following order:
default_interpolation.Structured objects must contain all three fields, including an explicit
"out": nullwhere appropriate. Malformed, unknown, and class-unsupported interpolation descriptions produce contextual errors identifying the channel, sample, and modifier.RooFit exports only the new structured representation.
Tests
The tests cover:
PiecewiseInterpolation.PiecewiseInterpolationcodes.@cburgard @stalbrec