-
Notifications
You must be signed in to change notification settings - Fork 1.4k
[hist] Enable chi2 tests for TProfile #19930
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Test Results 21 files 21 suites 3d 20h 44m 56s ⏱️ For more details on these failures, see this check. Results for commit e1a1548. ♻️ This comment has been updated with latest results. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! LGTM
hist/hist/src/TProfile.cxx
Outdated
{ | ||
TString opt = option; | ||
opt.ToUpper(); | ||
opt += "WW"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this happen only if h2 is a TProfile?
Actually, does it make sense to compute a chi2 between a TProfile and a non-TProfile?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally, you could compare something that's not a TProfile with a TProfile, but I don't see how this makes sense. I was thinking that users either compare "normal" histograms with normal histograms, or profiles with profiles. For mixed cases, it probably depends on the case whether this makes sense.
On second thought, I agree that this modification of the options is safe only when h2
is also a profile. I'll change the code accordingly, and leave the options for the mixed cases as the user inputs them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, maybe you can consider overloading only the case where the other histogram is actually a TProfile
and not a generic TH1
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I considered this, but an overload TProfile::Chi2Test(TProfile*, ...)
could not be called via a TH1
pointer. So this one
TH1* profile = new TProfile(...);
profile->Chi2Test( new TProfile(...) );
would call TH1::Chi2Test(TH1*)
. This might be OK if users use their TProfiles always as TProfiles, but maybe polymorphism isn't such a bad thing here, when you e.g. want to collect histograms and profiles in the same container.
For this reason, I tend towards overriding instead of overloading. That would get us back to casting h2
, and if the cast succeeds, the options get set to WW
. If it fails, the users can choose any option they desire, like you did with the original version of the function.
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/
987e2dc
to
e1a1548
Compare
In reaction to this question
https://root-forum.cern.ch/t/chi2test-using-tprofile/64156
Note: I decided to ignore clang-format for the headers, because the indentation would look out of place.