Skip to content
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] Fix recently-introduced RooAbsReal::getPropagatedError problems and add several new unit tests #11445

Merged
merged 6 commits into from
Sep 28, 2022

Conversation

guitargeek
Copy link
Contributor

The recent commit 565e9aa19a updated the getPropagatedError with
some additional checks, but these checks caused segfaults in some
specifit usecases:

  • where the RooAbsReal is a parameter in the fit result itself

  • where the RooAbsReal is a variable unrelated to the fit result

  • where the RooAbsReal depends only on some of the parameters in the
    fit result

This commit fixes these usecases again.

A unit test that checks that these usecases don't fail anymore is now
implemented in testRooAbsReal.

This PR also adds some other new unit tests that cover recent PRs and issues.

The unit test checks whether a RooAddPdf defined with recursive
coefficients is equivalent to mathematically equivalent RooAddPdf
defined without the recursive coefficient flag.
@phsft-bot
Copy link
Collaborator

Starting build on ROOT-debian10-i386/soversion, ROOT-performance-centos8-multicore/cxx17, ROOT-ubuntu18.04/nortcxxmod, ROOT-ubuntu2004/python3, mac1015/cxx17, mac11/cxx14, windows10/cxx14
How to customize builds

The recent commit `565e9aa19a` updated the `getPropagatedError` with
some additional checks, but these checks caused segfaults in some
specifit usecases:

* where the `RooAbsReal` is a parameter in the fit result itself

* where the `RooAbsReal` is a variable unrelated to the fit result

* where the `RooAbsReal` depends only on some of the parameters in the
  fit result

This commit fixes these usecases again.

A unit test that checks that these usecases don't fail anymore is now
implemented in `testRooAbsReal`.
@phsft-bot
Copy link
Collaborator

Starting build on ROOT-debian10-i386/soversion, ROOT-performance-centos8-multicore/cxx17, ROOT-ubuntu18.04/nortcxxmod, ROOT-ubuntu2004/python3, mac1015/cxx17, mac11/cxx14, windows10/cxx14
How to customize builds

@guitargeek guitargeek changed the title [RF] Fix recently-introduced RooAbsReal::getPropagatedError problems and several new unit tests [RF] Fix recently-introduced RooAbsReal::getPropagatedError problems and add several new unit tests Sep 27, 2022
@phsft-bot
Copy link
Collaborator

Build failed on ROOT-ubuntu18.04/nortcxxmod.
Running on sft-ubuntu-1804-2.cern.ch:/build/workspace/root-pullrequests-build
See console output.

Warnings:

  • [2022-09-27T15:55:46.968Z] /mnt/build/workspace/root-pullrequests-build/root/roofit/roofitcore/test/testRooSimultaneous.cxx:188:17: warning: unused variable ‘nllSimRefVal’ [-Wunused-variable]
  • [2022-09-27T15:55:46.968Z] /mnt/build/workspace/root-pullrequests-build/root/roofit/roofitcore/test/testRooSimultaneous.cxx:190:17: warning: unused variable ‘nllSimVal’ [-Wunused-variable]

@phsft-bot
Copy link
Collaborator

Build failed on ROOT-ubuntu2004/python3.
Running on root-ubuntu-2004-1.cern.ch:/home/sftnight/build/workspace/root-pullrequests-build
See console output.

Warnings:

  • [2022-09-27T15:57:22.640Z] /home/sftnight/build/workspace/root-pullrequests-build/root/roofit/roofitcore/test/testRooSimultaneous.cxx:188:17: warning: unused variable ‘nllSimRefVal’ [-Wunused-variable]
  • [2022-09-27T15:57:22.640Z] /home/sftnight/build/workspace/root-pullrequests-build/root/roofit/roofitcore/test/testRooSimultaneous.cxx:190:17: warning: unused variable ‘nllSimVal’ [-Wunused-variable]

Failing tests:

@phsft-bot
Copy link
Collaborator

Build failed on ROOT-debian10-i386/soversion.
Running on pcepsft10.dyndns.cern.ch:/build/workspace/root-pullrequests-build
See console output.

Warnings:

  • [2022-09-27T16:01:45.256Z] /home/sftnight/build/workspace/root-pullrequests-build/root/roofit/roofitcore/test/testRooSimultaneous.cxx:188:17: warning: unused variable ‘nllSimRefVal’ [-Wunused-variable]
  • [2022-09-27T16:01:45.256Z] /home/sftnight/build/workspace/root-pullrequests-build/root/roofit/roofitcore/test/testRooSimultaneous.cxx:190:17: warning: unused variable ‘nllSimVal’ [-Wunused-variable]

@phsft-bot
Copy link
Collaborator

Starting build on ROOT-debian10-i386/soversion, ROOT-performance-centos8-multicore/cxx17, ROOT-ubuntu18.04/nortcxxmod, ROOT-ubuntu2004/python3, mac1015/cxx17, mac11/cxx14, windows10/cxx14
How to customize builds

@guitargeek
Copy link
Contributor Author

The last push didn't change much, just commenting out the unused variables

Copy link
Member

@lmoneta lmoneta left a comment

Choose a reason for hiding this comment

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

LGTM!
Thanks for the fix, I have just a couple of small comments

@@ -2660,9 +2673,9 @@ double RooAbsReal::getPropagatedError(const RooFitResult &fr, const RooArgSet &n
TMatrixDSym C(paramList.getSize()) ;
vector<double> errVec(paramList.getSize()) ;
Copy link
Member

Choose a reason for hiding this comment

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

here better using std::vector

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Okay! I have done the same for all std:: classes in the file

if(rrvFitRes->namePtr() == namePtr()) return rrvFitRes->getError();

// Strip out parameters with zero error
if (rrvFitRes->getError() <= 1e-20) continue;
Copy link
Member

Choose a reason for hiding this comment

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

why hard coding here 1.E-20 ? Maybe use numerical precision epsilon ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, that is indeed a better choice than this magic number. I have updated it here and also in another place in that file

@phsft-bot
Copy link
Collaborator

Starting build on ROOT-debian10-i386/soversion, ROOT-performance-centos8-multicore/cxx17, ROOT-ubuntu18.04/nortcxxmod, ROOT-ubuntu2004/python3, mac1015/cxx17, mac11/cxx14, windows10/cxx14
How to customize builds

The recent commit 922dec5 fixed GitHub issue root-project#11396, but there was
still no unit test implemented with the reproducer code from that issue.
This commit is implementing such a unit test.
@phsft-bot
Copy link
Collaborator

Starting build on ROOT-debian10-i386/soversion, ROOT-performance-centos8-multicore/cxx17, ROOT-ubuntu18.04/nortcxxmod, ROOT-ubuntu2004/python3, mac1015/cxx17, mac11/cxx14, windows10/cxx14
How to customize builds

In some places in RooAbsReal, the magic constant 1e-20 was used to
denote a negligibly small error greater than zero. Instead of using that
arbitrary value, one should use the variable value times the
`std::numeric_limits<double>::epsilon()`, which is the correct way to
figure out how small the error needs to be to have numerically no effect
on the value.
The `binBoundaries` function that was used in RooAbsReal returns an
owning pointer, and in the code it was forgotten to delete that pointer
later. This is fixed now by using a smart pointer.
@phsft-bot
Copy link
Collaborator

Starting build on ROOT-debian10-i386/soversion, ROOT-performance-centos8-multicore/cxx17, ROOT-ubuntu18.04/nortcxxmod, ROOT-ubuntu2004/python3, mac1015/cxx17, mac11/cxx14, windows10/cxx14
How to customize builds

@phsft-bot
Copy link
Collaborator

Build failed on mac11/cxx14.
Running on macphsft23.dyndns.cern.ch:/Users/sftnight/build/workspace/root-pullrequests-build
See console output.

Failing tests:

@guitargeek guitargeek merged commit 6012144 into root-project:master Sep 28, 2022
@guitargeek guitargeek deleted the roofit_fixes_2 branch September 28, 2022 09:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants