[hist] Add option I to TH1::Chisquare for bin integral chi2#21951
Open
JasMehta08 wants to merge 1 commit intoroot-project:masterfrom
Open
[hist] Add option I to TH1::Chisquare for bin integral chi2#21951JasMehta08 wants to merge 1 commit intoroot-project:masterfrom
JasMehta08 wants to merge 1 commit intoroot-project:masterfrom
Conversation
Test Results 21 files 21 suites 2d 23h 31m 5s ⏱️ For more details on these failures, see this check. Results for commit e01ba9e. ♻️ This comment has been updated with latest results. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This Pull Request
Changes or fixes
TH1::Fitsupports option "I" which uses the integral of the fitted function over each bin instead of the value at the bin center.TH1::Chisquaredid not parse this option, soTF1::GetChisquare()andTH1::Chisquare(f, "I")returned different results after a fit with option "I".Changes across 3 files:
TH1.cxx: parse option "I" into useIntegral, pass it toROOT::Fit::Chisquare, anddocument the new option alongside the existing "R", "L", "P" options.
HFitImpl.cxx: add booluseIntegral = falsetoROOT::Fit::Chisquare(TH1)andHFit::ComputeChi2. SetDataOptions::fIntegral = useIntegralbefore BinData is filled.HFitInterface.h: update the public declaration with the new parameter, defaulted tofalse for full backward compatibility.
Before this fix:
h.Fit(f, "QI")
f.GetChisquare() # 7.26965
h.Chisquare(f, "I") # 7.27083 <-- "I" was silently ignored
After this fix:
h.Fit(f, "QI")
f.GetChisquare() # 7.26965
h.Chisquare(f, "I") # 7.26965 <-- correct
Checklist
This PR fixes #21695