Skip to content

Implement variable rebinning 2-D histogram classes (ROOT-5224)#5280

Closed
pamputt wants to merge 4 commits into
root-project:masterfrom
pamputt:master
Closed

Implement variable rebinning 2-D histogram classes (ROOT-5224)#5280
pamputt wants to merge 4 commits into
root-project:masterfrom
pamputt:master

Conversation

@pamputt

@pamputt pamputt commented Apr 2, 2020

Copy link
Copy Markdown
Contributor

Implement variable rebinning 2-D histogram classes (ROOT-5224)
Implemented for TProfile2D as well

  • Missing TH3 support

@pamputt pamputt requested a review from lmoneta as a code owner April 2, 2020 12:55

@hageboeck hageboeck 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.

Hi, thanks for the work! I left some small formatting comments.

I also had a rough look at the code, and didn't see obvious mistakes, but I cannot test / am not an expert.

I would either

Comment thread hist/hist/inc/TH2.h Outdated
Comment thread hist/hist/src/TH2.cxx Outdated
Comment thread hist/hist/src/TH2.cxx Outdated
Comment thread hist/hist/src/TH2.cxx Outdated
Comment thread hist/hist/src/TH2.cxx Outdated
Comment thread hist/hist/src/TH2.cxx
Comment thread hist/hist/src/TProfile2D.cxx
Comment thread hist/hist/src/TH2.cxx Outdated
Comment thread hist/hist/src/TH2.cxx Outdated
Comment thread hist/hist/src/TH2.cxx Outdated
@couet couet removed their assignment Apr 3, 2020

@lmoneta lmoneta 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.

Thank you for adding this useful extension to the rebinning of the 2D histograms.

The important missing piece is a test. The best and simplest way is to add new functions in test/stressHistogram.cxx
There are two tests for 1d, testArrayRebin() and testArrayRebinProfile(), it would be needed to add similar functions for the 2D case.
See https://github.com/root-project/root/blob/master/test/stressHistogram.cxx#L8082

It would be also great if you have time to add this for the 3D case. But this could be eventually a different PR

Thank you

Lorenzo

@root-project root-project deleted a comment from phsft-bot Nov 7, 2023
@guitargeek

Copy link
Copy Markdown
Contributor

@phsft-bot build

Let's see if we can revive this PR.

@phsft-bot

Copy link
Copy Markdown

Starting build on ROOT-performance-centos8-multicore/soversion, ROOT-ubuntu2204/nortcxxmod, ROOT-ubuntu2004/python3, mac12arm/cxx20, windows10/default
How to customize builds

@phsft-bot

Copy link
Copy Markdown

Build failed on ROOT-ubuntu2204/nortcxxmod.
Running on root-ubuntu-2204-1.cern.ch:/home/sftnight/build/workspace/root-pullrequests-build
See console output.

Failing tests:

@github-actions

github-actions Bot commented Nov 7, 2023

Copy link
Copy Markdown

Test Results

     4 files       4 suites   1d 2h 36m 26s ⏱️
 3 763 tests  3 758 ✅   3 💤 2 ❌
14 360 runs  14 164 ✅ 192 💤 4 ❌

For more details on these failures, see this check.

Results for commit 42f2b3f.

♻️ This comment has been updated with latest results.

@pamputt

pamputt commented Nov 8, 2023

Copy link
Copy Markdown
Contributor Author

Let's see if we can revive this PR.

Thank you for taking up this work again. I'd forgotten about it and I don't think I'll finish it myself. As far as I remember, I stopped when I was writing the test that was required. In the few cases that I tested by hand, it seemed to work but it's not at all impossible for the code to be buggy, hence the need to check it thoroughly with tests.

@guitargeek

Copy link
Copy Markdown
Contributor

No worries @pamputt, I didn't expect you to do any work here! I will take a look at this PR, and if it appears good to merge for me I will finish and merge this development myself.

@guitargeek guitargeek changed the title Patch for ROOT-5224 Implement variable rebinning 2-D histogram classes (ROOT-5224) Nov 13, 2023
Comment thread hist/hist/inc/TH2.h Outdated
Comment thread hist/hist/inc/TProfile2D.h Outdated
Comment thread hist/hist/src/TH2.cxx Outdated
Comment thread hist/hist/src/TH2.cxx Outdated
Comment thread hist/hist/src/TH2.cxx Outdated
Comment thread hist/hist/src/TProfile2D.cxx Outdated
@ferdymercury ferdymercury self-requested a review April 1, 2025 07:11
Comment thread hist/hist/inc/TH2.h
virtual TH2 *RebinY(Int_t ngroup=2, const char *newname=""); // *MENU*
TH2 *Rebin(Int_t ngroup=2, const char*newname="", const Double_t *xbins = nullptr) override; // re-implementation of the TH1 function using RebinX
virtual TH2 *Rebin2D(Int_t nxgroup=2, Int_t nygroup=2, const char *newname=""); // *MENU*
virtual TH2 *Rebin2D(Int_t nxgroup=2, Int_t nygroup=2, const char *newname="", const Double_t *xbins=nullptr, const Double_t *ybins=nullptr); // *MENU*

@ferdymercury ferdymercury Apr 15, 2025

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

(There might be very rare cases where this signature change could potentially break derived user-classes on preexisting code that use override keyword, but doesn't seem to worrying.)

@dpiparo dpiparo closed this Jul 17, 2025
@dpiparo dpiparo reopened this Jul 17, 2025
@dpiparo

dpiparo commented Jul 17, 2025

Copy link
Copy Markdown
Member

revived once again.

@dpiparo dpiparo closed this Dec 19, 2025
@dpiparo dpiparo reopened this Dec 19, 2025
@guitargeek

Copy link
Copy Markdown
Contributor

@dpiparo unfortunately we can't proceed with this PR because the PR branch is called master, which our CI doesn't accept.

I have opened a follow up PR, which is for not an exact copy of this PR by @pamputt:

Let's follow up with the review there and bring it to a merge-able state to finally close ROOT-5224.

@guitargeek guitargeek closed this Jun 19, 2026
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.

8 participants