Skip to content

Conversation

hageboeck
Copy link
Member

In reaction to this question
https://root-forum.cern.ch/t/chi2test-using-tprofile/64156

  • Override the Chi2Test() function for TProfiles, so the "WW" option is used to obtain correct errors.
  • Test that the profiles have the correct error option set (which is the error of the mean)
  • Add unit tests.

Note: I decided to ignore clang-format for the headers, because the indentation would look out of place.

Copy link

github-actions bot commented Sep 19, 2025

Test Results

    21 files      21 suites   3d 22h 21m 37s ⏱️
 3 668 tests  3 667 ✅ 0 💤 1 ❌
75 210 runs  75 204 ✅ 5 💤 1 ❌

For more details on these failures, see this check.

Results for commit 3c61b5b.

♻️ This comment has been updated with latest results.

Copy link
Collaborator

@ferdymercury ferdymercury left a comment

Choose a reason for hiding this comment

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

Thanks! LGTM

Copy link
Contributor

@guitargeek guitargeek left a comment

Choose a reason for hiding this comment

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

Thank you very much! Changes that constrain the the inputs to prevent invalid computations are always welcome.

I would just prefer to return zero in the error case, to make it clear that the value can't be used. But if you prefer falling through to the TH1::Chi2Test(), I'd be also fine with it.

@hageboeck
Copy link
Member Author

I would just prefer to return zero in the error case

Good idea! I'll change it to return 0.

The test can only work if the uncertainties are taken into account
correctly, so the Chi2Test function was overridden for all TProfile
classes.
Furthermore, the function will check if the profiles have the correct
error option set.

See also the discussion in:
https://root-forum.cern.ch/t/chi2test-using-tprofile/64156/
@guitargeek
Copy link
Contributor

Thanks!

@hageboeck hageboeck merged commit 1f46f3c into root-project:master Sep 25, 2025
43 of 48 checks passed
@hageboeck hageboeck deleted the TProfileChi2Test branch September 25, 2025 08:51
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.

4 participants