Skip to content

Conversation

@guitargeek
Copy link
Contributor

@guitargeek guitargeek commented Jan 12, 2023

When generating such a pdf from prototype data, the prototype needs to
contain all the subcategories of the super-category, and it does so by
checking the super-category servers. However, recently
RooSuperCategory was changed to contain a RooMultiCategory
internally, and the only reported direct server is the internal
multi-category. This leads to a wrong generation (the prototype data is
ignored, the gen context refers to the current labels).

The solution that this commit suggests is to use
RooSuperCategory::inputCatList() to inspect the internal categories
instead of using the client-server interface. Actually, the
client-server interface is not meant to be used for inspection like
that, just for general dependency management in the evaluation.

Closes #12020.

When generating such a pdf from prototype data, the prototype needs to
contain all the subcategories of the super-category, and it does so by
checking the super-category servers. However, recently
`RooSuperCategory` was changed to contain a `RooMultiCategory`
internally, and the only reported direct server is the internal
multi-category. This leads to a wrong generation (the prototype data is
ignored, the gen context refers to the current labels).

The solution that this commit suggests is to use
`RooSuperCategory::inputCatList()` to inspect the internal categories
instead of using the client-server interface. Actually, the
client-server interface is not meant to be used for inspection like
that, just for general dependency management in the evaluation.

Closes root-project#12020.
 * avoid code duplication

 * less manual memory management

 * more range-based loops
Plus some code modernization of the gen context implementations
@phsft-bot
Copy link

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

@root-project root-project deleted a comment from phsft-bot Jan 12, 2023
@root-project root-project deleted a comment from phsft-bot Jan 12, 2023
@root-project root-project deleted a comment from phsft-bot Jan 12, 2023
@phsft-bot
Copy link

Build failed on mac12/noimt.
Running on macphsft17.dyndns.cern.ch:/Users/sftnight/build/jenkins/workspace/root-pullrequests-build
See console output.

Warnings:

  • [2023-01-12T21:28:13.707Z] /Users/sftnight/build/jenkins/workspace/root-pullrequests-build/root/core/base/src/TDirectory.cxx:1245:7: warning: 'sprintf' is deprecated: This function is provided for compatibility reasons only. Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. [-Wdeprecated-declarations]

Failing tests:

And 63 more

@phsft-bot
Copy link

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

@phsft-bot
Copy link

Build failed on windows10/cxx14.
Running on null:C:\build\workspace\root-pullrequests-build
See console output.

Errors:

  • [2023-01-12T22:41:41.261Z] LINK : fatal error LNK1104: cannot open file 'C:\build\workspace\root-pullrequests-build\build\bin\libCore.dll' [C:\build\workspace\root-pullrequests-build\build\core\Core.vcxproj]

@phsft-bot
Copy link

Build failed on mac12/noimt.
Running on macphsft17.dyndns.cern.ch:/Users/sftnight/build/jenkins/workspace/root-pullrequests-build
See console output.

Warnings:

  • [2023-01-12T22:43:14.600Z] /Users/sftnight/build/jenkins/workspace/root-pullrequests-build/root/core/base/src/TDirectory.cxx:1245:7: warning: 'sprintf' is deprecated: This function is provided for compatibility reasons only. Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. [-Wdeprecated-declarations]

Failing tests:

And 63 more

In the `RooSimultaneous::genContext` function, the logic that figures
out which `RooAbsGenContext` implementation to instantiate needs to know
the list of all category components. The way to figure this out depends
on the type of the index category, and this logic is also reused in the
`RooAbsGenContext` implementations for the RooSimultaneous. That's why
it is now factored out into a protected function called
`RooSimultaneous::flattenCatList()`.
Add unit test that checks if the dataset generation from a nested
RooSimultaneous with protodata containing the category values works.
Covers GitHub issue root-project#12020.
In the `RooSimGenContex` and `RooSimSplitGenContex` classes, there is a
place where the servers of a derived category are redirected. The
`mustReplaceAll` flag was set to true here. This made sense when the
internal categories were still the only servers of the
`RooSuperCategory`, but since the refactor in root-project#5502 this is not the case
anymore. Therefore, a harmless error is printed now, which should be
avoided by setting the `mustReplaceAll` flag to `false`.
The `RooAbsArg::redirectServers()` funciton has an optional flag to
print an error if not all servers listed in the new server set were
replaced.

However, if one was already using this `mustReplaceAll` flag, it means
that the error is intentional and should be considered fatal. An
exception should be thrown with it.
@phsft-bot
Copy link

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

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!
Thank you Jonas for fixing this problem!

@guitargeek guitargeek merged commit c532a0e into root-project:master Jan 13, 2023
@guitargeek guitargeek deleted the issue-12020 branch January 13, 2023 09:29
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.

[RF] Cannot generate nested RooSimultaneous from prototype category data

3 participants