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
[RF] Several improvements in RooFit chi-square fitting #13651
Conversation
bfc3d9c
to
7db7c18
Compare
7db7c18
to
8355399
Compare
8355399
to
4e44fd6
Compare
Almost a year ago, I fixed the support for comma-separated normalization ranges for pdfs, e.g. `pdf.setNormRange("range1,range2")` was fixed also for RooAddPdfs. As a result, the logic for multi-range likelihood fits was removed from `createNLL()`, because the multi-range fit didn't have to be treated as a special case anymore. The same applies also to chi-square fits. In fact, the reason why the `RooChi2Var` constructor and `RooAbsReal::createChi2()` methods had a `RooAbsPdf` overload was *only* this workaround! For regular RooAbsReals, the workaround was not necessary, because there is no normalization. Therefore, quite a few functions were removed in this commit. The multi-range chi2 fit is now also validated by the multi-range fit unit test in `testRooAbsPdf`. This is a follow-up to PR root-project#11455 (commit fa10523 in particular), where the same change was already make for regular likelihoods.
It can be checked at runtime if a given `RooAbsReal` is a pdf or not. Like this, we also don't need a separate override of `createChi2(RooDataSet &)` in RooAbsPdf.
This is achieved in the same was as in `createNLL()`, by forwarding the configuration options to the `RooAbsOptTestStatistic` base class.
4e44fd6
to
dc693dc
Compare
Starting build on |
After adding support for subrange fits with the `RooXYChi2Var`, it initially didn't work because the y-value errors were missing in the dataset. This is because `RooDataSet::reduce()` is not copying the errors over to the reduced dataset, which is a bug. Fortunately, there is a straighforward solution. To create the reduced `RooDataSet`, it now doesn't use some buggy private constructor (that is now removed), but instead the trusty `RooAbsData::emptyClone()` method, for which I fixed the problem with the errors not being copied already some time ago.
Build failed on windows10/default. Failing tests: |
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.
LGTM!
The changes in this PR address this forum post...
https://root-forum.cern.ch/t/chi2fito-with-yvar-does-not-support-range-option/56369
...and follows up on the discussion here:
#13638
Short summaries of the commits, more detail in the commit descriptions:
createChi2()
, because for a few months already this can be dealt with in the test statistics base classesNumCPU()
andRange()
in createChi2() for RooDataSetsRooDataSet::reduce()
by also copying the stored errors