Skip to content

[RF] Refactor RooAICRegistry and its usage - #22983

Open
guitargeek wants to merge 1 commit into
root-project:masterfrom
guitargeek:rooaicregistry
Open

[RF] Refactor RooAICRegistry and its usage#22983
guitargeek wants to merge 1 commit into
root-project:masterfrom
guitargeek:rooaicregistry

Conversation

@guitargeek

Copy link
Copy Markdown
Contributor

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_ptrs (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.

AI was only used to generate the commit message, and all the code changes were done by the human.

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.
@guitargeek guitargeek self-assigned this Aug 2, 2026
@guitargeek
guitargeek requested a review from hageboeck as a code owner August 2, 2026 12:46
@github-actions

github-actions Bot commented Aug 2, 2026

Copy link
Copy Markdown

Test Results

    23 files      23 suites   3d 13h 44m 53s ⏱️
 3 852 tests  3 852 ✅ 0 💤 0 ❌
78 483 runs  78 483 ✅ 0 💤 0 ❌

Results for commit 06b35b1.

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.

1 participant