Skip to content

[DF] Support for RHist with VariationsFor (on root master) - #22956

Open
gpetruc wants to merge 3 commits into
root-project:masterfrom
gpetruc:rhist_variationsfor
Open

[DF] Support for RHist with VariationsFor (on root master)#22956
gpetruc wants to merge 3 commits into
root-project:masterfrom
gpetruc:rhist_variationsfor

Conversation

@gpetruc

@gpetruc gpetruc commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Support for RHist with VariationsFor

Changes or fixes:

In order to allow VariationsFor on RHist, this PR does two things:

  • change the plain copy of the object with a call to a template function that I can specialise to use Clone() on RHist and RHistEngine that are non-copiable.
  • implements the MakeNew method for RHistFillHelper and RHistEngineFillHelper

Both changes are trivial, all the existing logic for VariationsFor, copying and filling RHists is unchanged.

To check that the code compiles and run, two unit tests are added, for RHistFillHelper and RHistEngineFillHelper.
No attempt is made of testing VariationsFor on all possible code paths (JIT vs compile time, 1D vs multi-D, weights vs no weights, etc.) because the code changes are agnostic to all that.

This PR is based on the current master, but I have also a branch on top of #22899 from @hahnjo : the two features are orthogonal, but some trivial merge conflicts are expected in the unit tests.

Checklist:

  • tested changes locally
  • tested with ctest -R gtest-tree-dataframe-dataframe-hist

This PR fixes #22954

@vepadulano vepadulano left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! LGTM!

template<typename B>
void addCopyForVariations(std::vector<std::shared_ptr<ROOT::Experimental::RHist<B>>> &vec, const ROOT::Experimental::RHist<B> & obj)
{
// Note that Clone() returns a value and not a pointer, so we call 'new' and pass that value to the RHist move constructor

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe I'm misunderstanding the comment but I don't see new being called. I believe this is a valid use of the Clone method.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

right, when I wrote the comment I still had emplace_back(new T{x.Clone()}, then later I replaced the new with a make_shared and didn't update the comment.

@github-actions

Copy link
Copy Markdown

Test Results

    23 files      23 suites   3d 16h 36m 12s ⏱️
 3 882 tests  3 882 ✅ 0 💤 0 ❌
79 963 runs  79 963 ✅ 0 💤 0 ❌

Results for commit 0803f5a.

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.

[DF] Support for RHist with VariationsFor

3 participants