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] Remove error in RooWorkspace::getSnapshot() if no snapshot found #11584

Merged
merged 2 commits into from
Oct 18, 2022

Conversation

guitargeek
Copy link
Contributor

In this forum post, the point was made that
RooWorkspace::getSnapshot() should not print an error if a snapshot
with the passed name is not found.

https://root-forum.cern.ch/t/roofit-check-if-snapshot-exist-without-showing-objecthandling-error

Just like in the other RooWorkspace access functions, like arg(),
pdf(), or function(), users expect to use getSnapshot() also to
query if a snapshot exists and check if the returned value is nullptr.
So there should be no error printed in getSnapshot() itself. If it is
actually an error for th caller that no snapshot has been found, an
error or exception should be raised by the caller.

A second commit in this PR applies some general code modernization to RooWorkspace.cxx.

In this forum post, the point was made that
`RooWorkspace::getSnapshot()` should not print an error if a snapshot
with the passed name is not found.

https://root-forum.cern.ch/t/roofit-check-if-snapshot-exist-without-showing-objecthandling-error

Just like in the other `RooWorkspace` access functions, like `arg()`,
`pdf()`, or `function()`, users expect to use `getSnapshot()` also to
query if a snapshot exists and check if the returned value is `nullptr`.
So there should be no error printed in `getSnapshot()` itself. If it is
actually an error for th caller that no snapshot has been found, an
error or exception should be raised by the caller.
@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 ROOT-ubuntu2004/python3.
Running on root-ubuntu-2004-1.cern.ch:/home/sftnight/build/workspace/root-pullrequests-build
See console output.

Failing tests:

@phsft-bot
Copy link
Collaborator

Build failed on ROOT-performance-centos8-multicore/cxx17.
Running on olbdw-01.cern.ch:/data/sftnight/workspace/root-pullrequests-build
See console output.

Failing tests:

* replace `getSize()>0` with `!empty()`

* replace manual memory management with smart pointers

* replace manually allocated C-style strings with `std::string`
@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 mac1015/cxx17.
Running on macitois21.dyndns.cern.ch:/Users/sftnight/build/workspace/root-pullrequests-build
See console output.

Failing tests:

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!

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