[RF] Refactor RooAICRegistry and its usage - #22983
Open
guitargeek wants to merge 1 commit into
Open
Conversation
Modernize RooAICRegistry, the helper that operator p.d.f.s use to cache
analytical integration codes and their associated RooArgSets, and clean
up its usage across RooFitCore.
Storage and ownership:
- Replace the four parallel `std::vector<RooArgSet*>` members and the
hand-written copy/destroy bookkeeping with a single
`std::array<std::vector<std::unique_ptr<RooArgSet>>, 4>`. The manual
destructor and `copyImpl()` helper are gone; lifetime is now handled
by the smart pointers.
- `store()` no longer takes ownership of the RooArgSets passed to it;
it only snapshots them. Callers are updated accordingly: they either
keep their `unique_ptr`s (RooAbsAnaConvPdf) or pass stack objects
instead of heap allocations (RooAbsCachedPdf), removing several
`new`/`release()`/`delete` dances.
API:
- Replace the four `retrieve()` out-parameter overloads with a single
method returning a small `Output` struct (the code list plus the
four set pointers), so call sites no longer declare and thread raw
pointers by reference.
- Drop the `ClassDef`/dictionary and the corresponding LinkDef entry:
all data members were transient, so the registry was never persisted
and does not need I/O support.
Cleanups in the consumers:
- Remove the unused `_codeReg` registry members (and the now-redundant
RooAICRegistry.h includes) from RooHistFunc, RooHistPdf and
RooAddModel.
- In RooProdPdf, `_genCode` only ever stored code lists without any
RooArgSets, so demote it from a RooAICRegistry to a plain
`std::vector<std::vector<int>>` and look codes up directly.
Test Results 23 files 23 suites 3d 13h 44m 53s ⏱️ Results for commit 06b35b1. |
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.
Modernize RooAICRegistry, the helper that operator p.d.f.s use to cache analytical integration codes and their associated RooArgSets, and clean up its usage across RooFitCore.
Storage and ownership:
std::vector<RooArgSet*>members and the hand-written copy/destroy bookkeeping with a singlestd::array<std::vector<std::unique_ptr<RooArgSet>>, 4>. The manual destructor andcopyImpl()helper are gone; lifetime is now handled by the smart pointers.store()no longer takes ownership of the RooArgSets passed to it; it only snapshots them. Callers are updated accordingly: they either keep theirunique_ptrs (RooAbsAnaConvPdf) or pass stack objects instead of heap allocations (RooAbsCachedPdf), removing severalnew/release()/deletedances.API:
retrieve()out-parameter overloads with a single method returning a smallOutputstruct (the code list plus the four set pointers), so call sites no longer declare and thread raw pointers by reference.ClassDef/dictionary and the corresponding LinkDef entry: all data members were transient, so the registry was never persisted and does not need I/O support.Cleanups in the consumers:
_codeRegregistry members (and the now-redundant RooAICRegistry.h includes) from RooHistFunc, RooHistPdf and RooAddModel._genCodeonly ever stored code lists without any RooArgSets, so demote it from a RooAICRegistry to a plainstd::vector<std::vector<int>>and look codes up directly.AI was only used to generate the commit message, and all the code changes were done by the human.