Skip to content

[RF] Refactor C function binding helper code to avoid duplication - #23751

Merged
guitargeek merged 2 commits into
root-project:masterfrom
guitargeek:roofit-cfuncs
Oct 24, 2026
Merged

guitargeek merged 2 commits into
root-project:masterfrom
guitargeek:roofit-cfuncs

Conversation

@guitargeek

Copy link
Copy Markdown
Contributor

The RooCFunction classes contain relatively complicated custom streamer code that should better not be be duplicated.

See the commit descriptions for more detail.

The RooCFunction[1-4]Map classes were four copies of the same class,
differing only in the function pointer type. Replace them with a single
`RooFit::Detail::CFunctionMap<Func>` template, keeping the old names as
alias templates so that `RooCFunctionNRef<...>::fmap().add(...)` keeps
working. Argument names are now passed variadically; unnamed arguments
still fall back to x, y, z, w.

The "registered name or hex address" logic of the
RooCFunctionNRef::name() functions is moved into the map as well.

No class layout or persisted class name changes.

🤖 Done with the help of AI
The custom `Streamer()` of the RooCFunction[1-4]Ref classes and the
`printArgs()` of the RooCFunction[1-4]Binding and PdfBinding classes
were identical copies. Implement them once in
`RooFit::Detail::streamCFunctionRef()` and
`RooFit::Detail::printCFunctionArgs()`.

The on-file format is unchanged: files written before this change are
read back identically and vice versa.

🤖 Done with the help of AI
@guitargeek guitargeek self-assigned this Oct 18, 2026
@guitargeek guitargeek changed the title [RF] Refactor C funciton binding helper code to avoid duplication [RF] Refactor C function binding helper code to avoid duplication Oct 18, 2026
@github-actions

github-actions Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

Test Results

    23 files      23 suites   3d 23h 28m 29s ⏱️
 3 889 tests  3 886 ✅ 0 💤 3 ❌
79 435 runs  79 432 ✅ 0 💤 3 ❌

For more details on these failures, see this check.

Results for commit 25017ce.

♻️ This comment has been updated with latest results.

@guitargeek
guitargeek merged commit 65ef6b4 into root-project:master Oct 24, 2026
58 of 67 checks passed
@guitargeek
guitargeek deleted the roofit-cfuncs branch October 24, 2026 07:26
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