From 21cef8d6f631ada82f16d66867d6506ef0bfc3d8 Mon Sep 17 00:00:00 2001
From: Jonas Rembser <jonas.rembser@cern.ch>
Date: Fri, 5 Aug 2022 00:33:12 +0200
Subject: [PATCH] [RF] Also test different BatchModes in `createNLL` in
 stressRooFit

In stressRooFit, you could already globally select the BatchMode for
`fitTo` calls. With this commit, the selection is also considered for
`createNLL` calls, widening the test coverage of the new BatchMode.

In particular, this tests the plotting of likelihood functions, which is
much faster when using the new BatchMode backend (up to a factor of 10
in the first profile NLL tuutorial).
---
 test/stressRooFit_tests.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/test/stressRooFit_tests.h b/test/stressRooFit_tests.h
index 680328377cb..82b2a09efa2 100644
--- a/test/stressRooFit_tests.h
+++ b/test/stressRooFit_tests.h
@@ -4326,7 +4326,7 @@ public:
   RooDataSet* data = model.generate(x,1000) ;
 
   // Construct unbinned likelihood
-  std::unique_ptr<RooAbsReal> nll{model.createNLL(*data)};
+  std::unique_ptr<RooAbsReal> nll{model.createNLL(*data, BatchMode(_batchMode))};
 
 
   // I n t e r a c t i v e   m i n i m i z a t i o n ,   e r r o r   a n a l y s i s
@@ -4628,7 +4628,7 @@ public:
   // ---------------------------------------------------
 
   // Construct unbinned likelihood
-  std::unique_ptr<RooAbsReal> nll{model.createNLL(*data)};
+  std::unique_ptr<RooAbsReal> nll{model.createNLL(*data, BatchMode(_batchMode))};
   nll->SetName("nll");
 
   // Minimize likelihood w.r.t all parameters before making plots
@@ -4753,7 +4753,7 @@ public:
   // ------------------------------------------------------------------
 
   // Construct likelihood function of model and data
-  std::unique_ptr<RooAbsReal> nll{argus.createNLL(*data)};
+  std::unique_ptr<RooAbsReal> nll{argus.createNLL(*data, BatchMode(_batchMode))};
   nll->SetName("nll");
 
   // Plot likelihood in m0 in range that includes problematic values
@@ -5547,7 +5547,7 @@ public:
   RooPlot* frame3 = alpha.frame(Bins(100),Range(0.5,0.9)) ;
 
   // Make 2D pdf of histogram
-  std::unique_ptr<RooAbsReal> nll{lmorph.createNLL(*data)};
+  std::unique_ptr<RooAbsReal> nll{lmorph.createNLL(*data, BatchMode(_batchMode))};
   nll->SetName("nll");
   nll->plotOn(frame3,ShiftToZero()) ;
 
-- 
GitLab