Skip to content

Conversation

@hahnjo
Copy link
Member

@hahnjo hahnjo commented Oct 23, 2025

To fill a regular one-dimensional histogram without specifying an axis interval during construction.

I missed this example in commit 943ee82 ("Accept regular axis
interval as std::pair").
To fill a regular one-dimensional histogram without specifying an
axis interval during construction.
@hahnjo hahnjo requested review from hageboeck and jblomer October 23, 2025 12:26
@hahnjo hahnjo self-assigned this Oct 23, 2025
@hahnjo hahnjo requested a review from bellenot as a code owner October 23, 2025 12:26
@hahnjo hahnjo added the in:Hist label Oct 23, 2025
@hahnjo hahnjo changed the title [hist] Implement initial RHistAutoAxisFiller [hist] Implement initial RHistAutoAxisFiller Oct 23, 2025
@github-actions
Copy link

Test Results

    20 files      20 suites   3d 17h 31m 28s ⏱️
 3 697 tests  3 697 ✅ 0 💤 0 ❌
72 144 runs  72 144 ✅ 0 💤 0 ❌

Results for commit 588e8fb.

Comment on lines +98 to +103
if (x < fMinimum) {
fMinimum = x;
}
if (x > fMaximum) {
fMaximum = x;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
if (x < fMinimum) {
fMinimum = x;
}
if (x > fMaximum) {
fMaximum = x;
}
fMinimum = std::min(x, fMinimum);
fMaximum = std::max(x, fMaximum);

/// \see Flush()
RHist<BinContentType> &GetHist()
{
Flush();
Copy link
Contributor

Choose a reason for hiding this comment

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

That means that we can't get an empty histogram from the auto filler. Is this the desired behavior?

///
/// Throws an exception if the buffer is empty, the axis interval cannot be determined, or if it would be empty
/// because the minimum equals the maximum.
void Flush()
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we want/need to expose this publicly?

EXPECT_EQ(hist.GetBinContent(RBinIndex::Underflow()), 0);
EXPECT_EQ(hist.GetBinContent(RBinIndex::Overflow()), 0);
}

Copy link
Collaborator

Choose a reason for hiding this comment

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

Thanks!
For completeness, I would propose copy-pasting the CTest "TTreeDraw_AutoBinning" from https://github.com/root-project/root/pull/19605/files into this class

Ie filling -999 and 0 and checking that auto-axis does not put them in the overflow or underflow.

Copy link
Member Author

Choose a reason for hiding this comment

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

I briefly looked at the test case, which additional issue does it cover? In other words, what is special about -999? Note that the test for Fill above also already checks that all values landed in the normal bins. I'm against adding more tests that don't increase coverage just for completeness.

Copy link
Collaborator

Choose a reason for hiding this comment

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

In other words, what is special about -999?

In a case where the user filled with 0 and -999, the automatic range calculation was sometimes missing the 0. (putting it in the overflow rather than in the last bin), due to some floating precision effects if I recall correctly.

https://root-forum.cern.ch/t/bug-or-feature-in-ttree-draw/62862

(Checking 0 and -1 might not trigger the issue since the relative error is smaller)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants