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

[RF] Fix ownership problem in RooGenProdProj #14253

Merged
merged 1 commit into from Dec 18, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 4 additions & 2 deletions roofit/roofitcore/src/RooGenProdProj.cxx
Expand Up @@ -166,6 +166,8 @@ RooAbsReal* RooGenProdProj::makeIntegral(const char* name, const RooArgSet& comp
// normalization.
RooArgSet emptyNormSet{};

RooArgSet keepAlive;

for (const auto pdfAsArg : compSet) {
auto pdf = static_cast<const RooAbsPdf*>(pdfAsArg);

Expand All @@ -183,8 +185,8 @@ RooAbsReal* RooGenProdProj::makeIntegral(const char* name, const RooArgSet& comp
// Remove analytically integratable observables from numeric integration list
numIntSet.remove(anaSet) ;

// Declare ownership of integral
saveSet.addOwned(std::move(pai));
// Keep integral alive until the prodSet is cloned later
keepAlive.addOwned(std::move(pai));
} else {
// Analytic integration of factorizable observable not possible, add straight pdf to product
prodSet.add(*pdf) ;
Expand Down