[RF] Let RooGenericPdf/RooFormulaVar declare a piecewise-flat binning#22708
Open
guitargeek wants to merge 1 commit into
Open
[RF] Let RooGenericPdf/RooFormulaVar declare a piecewise-flat binning#22708guitargeek wants to merge 1 commit into
guitargeek wants to merge 1 commit into
Conversation
A RooGenericPdf or RooFormulaVar that is constant within bins of an
observable (a step function) was always integrated with the generic
adaptive numeric integrator, which is needlessly expensive: for a flat
distribution the integral is just the sum of each bin's value times its
width.
Add RooGenericPdf::setBinBoundaries() and RooFormulaVar::setBinBoundaries(),
which take a RooAbsBinning for an observable and declare the function to be
flat within those bins. Once set:
* isBinnedDistribution() reports the observable as binned, so
RooRealIntegral selects the fast RooBinIntegrator;
* binBoundaries() and plotSamplingHint() expose the bins so that
integration covers exactly the range and plotting draws crisp steps.
A binning can be registered for several observables (e.g. for a
multi-dimensional flat distribution). By default the function is sampled
inside each bin to verify that it really is flat, and the binning is
rejected with an error otherwise; pass checkFlatness=false to skip this.
The binnings are stored in a std::map keyed by the observable's index in
the internal variable list, so they survive renaming of a variable or a
server redirection, and a RooUniformBinning keeps the storage compact even
for many bins. Lookups resolve the observable by name, so a same-named
stand-in (e.g. one read back separately from a file) is accepted too.
The shared flatness check and bin-boundary helpers live in RooHelpers.
The persistent schema version of both classes is bumped to 2.
Test Results 22 files 22 suites 3d 8h 3m 36s ⏱️ For more details on these failures, see this check. Results for commit 8d9620e. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A RooGenericPdf or RooFormulaVar that is constant within bins of an observable (a step function) was always integrated with the generic adaptive numeric integrator, which is needlessly expensive: for a flat distribution the integral is just the sum of each bin's value times its width.
Add RooGenericPdf::setBinBoundaries() and RooFormulaVar::setBinBoundaries(), which take a RooAbsBinning for an observable and declare the function to be flat within those bins. Once set:
A binning can be registered for several observables (e.g. for a multi-dimensional flat distribution). By default the function is sampled inside each bin to verify that it really is flat, and the binning is rejected with an error otherwise; pass checkFlatness=false to skip this.
The binnings are stored in a std::map keyed by the observable's index in the internal variable list, so they survive renaming of a variable or a server redirection, and a RooUniformBinning keeps the storage compact even for many bins. Lookups resolve the observable by name, so a same-named stand-in (e.g. one read back separately from a file) is accepted too.
The shared flatness check and bin-boundary helpers live in RooHelpers. The persistent schema version of both classes is bumped to 2.
Feature requested by @Phmonski and @will-cern for supporting the ATLAS Higgs discovery workspaces without custom ATLAS RooFit classes.