Skip to content

Commit 66c0195

Browse files
committed
[RF] Don't disable dirty flag propagation in generation contexts
We should avoid to disable RooFits internal caching if not well justified, because not doing the caching can lead to severe performance hits like in #21788. There are some places in RooFit where the caching is disabled on purpose, because sometimes the overhead of the bookkeeping for caching can occasionally be more expensive than model evalution itself. However, this should not be done in general. One place where this happened were the **RooGenContext** and **RooAddGenContext** helper classes for toy dataset sampling via `RooAbsPdf::generate()`, and this commit suggests to remove it. The performance hit that it incurres if the model is actually expensive to evalutate is too high. Partialy closes #21788.
1 parent 785d8af commit 66c0195

2 files changed

Lines changed: 0 additions & 6 deletions

File tree

roofit/roofitcore/src/RooAddGenContext.cxx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ RooAddGenContext::RooAddGenContext(const RooAddPdf &model, const RooArgSet &vars
5858
_pdfSet = std::make_unique<RooArgSet>();
5959
RooArgSet(model).snapshot(*_pdfSet, true);
6060
_pdf = static_cast<RooAddPdf*>(_pdfSet->find(model.GetName())) ;
61-
_pdf->setOperMode(RooAbsArg::ADirty,true) ;
6261

6362
// Fix normalization set of this RooAddPdf
6463
if (prototype)

roofit/roofitcore/src/RooGenContext.cxx

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@ RooGenContext::RooGenContext(const RooAbsPdf &model, const RooArgSet &vars,
8282

8383
// Find the clone in the snapshot list
8484
_pdfClone = static_cast<RooAbsPdf*>(_cloneSet.find(model.GetName()));
85-
_pdfClone->setOperMode(RooAbsArg::ADirty,true) ;
8685

8786
// Optionally fix RooAddPdf normalizations
8887
if (prototype&&_pdfClone->dependsOn(*prototype->get())) {
@@ -322,10 +321,6 @@ void RooGenContext::attach(const RooArgSet& args)
322321

323322
void RooGenContext::initGenerator(const RooArgSet &theEvent)
324323
{
325-
for (auto* arg : theEvent) {
326-
arg->setOperMode(RooAbsArg::ADirty) ;
327-
}
328-
329324
attach(theEvent) ;
330325

331326
// Reset the cloned model's error counters.

0 commit comments

Comments
 (0)