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

More standard implementation of RooMultiPdf #1024

Merged
merged 3 commits into from
Nov 20, 2024

Conversation

guitargeek
Copy link
Contributor

The people that implemented RooMultiPdf had a doubt: they didn't dare to
implement RooMultiPdf::evaluate() because they were not sure how the
normalization set information is propagated.

The anser is: it's propagated in the base implementation of getValV()
via the proxies, like the RooListProxy with the pdf in this case. The
propagated normalization set can be queried from the proxy with
nset().

Hence, this PR suggests to implement evaluate() accordingly.

Furthermore, the selfNormalized() method needs to be overridden, to
indicate that the base implementation of RooAbsPdf::getValV() doesn't
need to create any normalization integrals implicitly, which would be a
huge performance hit.

This more standard implementation makes sure that the class is more
compatible with regular RooFit, which expects that evaluate() is
implemented.

It was validated with the following command that results and performance
remain unaffected:

text2workspace.py data/ci/datacard_RooMultiPdf.txt.gz -o multipdf_ws.root
combine -M MultiDimFit -m 125.38  --setParameters pdf_index_ggh=2 --freezeParameters MH --cminDefaultMinimizerStrategy 0 --X-rtd FAST_VERTICAL_MORPH --X-rtd MINIMIZER_freezeDisassociatedParams --X-rtd MINIMIZER_multiMin_maskChannels=2 --algo singles ws_RooMultiPdf.root

Two additional commits in this PR fix a memory leak and refactor the code to be less verbose respectively.

The people that implemented RooMultiPdf had a doubt: they didn't dare to
implement `RooMultiPdf::evaluate()` because they were not sure how the
normalization set information is propagated.

The anser is: it's propagated in the base implementation of `getValV()`
via the proxies, like the RooListProxy with the pdf in this case. The
propagated normalization set can be queried from the proxy with
`nset()`.

Hence, this PR suggests to implement `evaluate()` accordingly.

Furthermore, the `selfNormalized()` method needs to be overridden, to
indicate that the base implementation of `RooAbsPdf::getValV()` doesn't
need to create any normalization integrals implicitly, which would be a
huge performance hit.

This more standard implementation makes sure that the class is more
compatible with regular RooFit, which expects that `evaluate()` is
implemented.

It was validated with the following command that results and performance
remain unaffected:

```bash
text2workspace.py data/ci/datacard_RooMultiPdf.txt.gz -o multipdf_ws.root
combine -M MultiDimFit -m 125.38  --setParameters pdf_index_ggh=2 --freezeParameters MH --cminDefaultMinimizerStrategy 0 --X-rtd FAST_VERTICAL_MORPH --X-rtd MINIMIZER_freezeDisassociatedParams --X-rtd MINIMIZER_multiMin_maskChannels=2 --algo singles ws_RooMultiPdf.root
```
Some RooConstVars were missing an owner.
@anigamova anigamova merged commit 7c8888a into cms-analysis:main Nov 20, 2024
8 checks passed
@guitargeek guitargeek deleted the roomultipdf branch November 20, 2024 09:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants