Skip to content

Commit 7b3872e

Browse files
committed
[RF] Make RooEvaluatorWrapper public in experimental interface
Exposing this class has become useful now, because it allows us to do more low-level checks when developing AD in CMS Combine.
1 parent 33ea434 commit 7b3872e

File tree

6 files changed

+18
-26
lines changed

6 files changed

+18
-26
lines changed

roofit/roofitcore/src/RooEvaluatorWrapper.h renamed to roofit/roofitcore/inc/RooEvaluatorWrapper.h

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,22 +16,19 @@
1616
#define RooFit_RooEvaluatorWrapper_h
1717

1818
#include <RooAbsData.h>
19-
#include <RooFit/EvalContext.h>
2019
#include <RooFit/Evaluator.h>
2120
#include <RooGlobalFunc.h>
22-
#include <RooHelpers.h>
2321
#include <RooRealProxy.h>
2422
#include <RooSetProxy.h>
2523

26-
#include "RooFit/BatchModeDataHelpers.h"
27-
28-
#include <chrono>
29-
#include <memory>
3024
#include <stack>
3125

3226
class RooAbsArg;
3327
class RooAbsCategory;
3428
class RooAbsPdf;
29+
30+
namespace RooFit::Experimental {
31+
3532
class RooFuncWrapper;
3633

3734
class RooEvaluatorWrapper final : public RooAbsReal {
@@ -93,6 +90,8 @@ class RooEvaluatorWrapper final : public RooAbsReal {
9390
std::map<RooFit::Detail::DataKey, std::span<const double>> _dataSpans;
9491
};
9592

93+
} // namespace RooFit::Experimental
94+
9695
#endif
9796

9897
/// \endcond

roofit/roofitcore/res/RooFitImplHelpers.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,17 +96,15 @@ void getSortedComputationGraph(RooAbsArg const &func, RooArgSet &out);
9696

9797
} // namespace RooHelpers
9898

99-
namespace RooFit {
100-
namespace Detail {
99+
namespace RooFit::Detail {
101100

102101
std::string makeValidVarName(std::string const &in);
103102

104103
void replaceAll(std::string &inOut, std::string_view what, std::string_view with);
105104

106105
std::string makeSliceCutString(RooArgSet const &sliceDataSet);
107106

108-
} // namespace Detail
109-
} // namespace RooFit
107+
} // namespace RooFit::Detail
110108

111109
double toDouble(const char *s);
112110
double toDouble(const std::string &s);

roofit/roofitcore/src/FitHelpers.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -806,7 +806,7 @@ std::unique_ptr<RooAbsReal> createNLL(RooAbsPdf &pdf, RooAbsData &data, const Ro
806806
nll = std::move(correctedNLL);
807807
}
808808

809-
auto nllWrapper = std::make_unique<RooEvaluatorWrapper>(
809+
auto nllWrapper = std::make_unique<RooFit::Experimental::RooEvaluatorWrapper>(
810810
*nll, &data, evalBackend == RooFit::EvalBackend::Value::Cuda, rangeName ? rangeName : "", pdfClone.get(),
811811
takeGlobalObservablesFromData);
812812

roofit/roofitcore/src/RooEvaluatorWrapper.cxx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,18 @@ Wraps a RooFit::Evaluator that evaluates a RooAbsReal back into a RooAbsReal.
2525

2626
#include <RooAbsData.h>
2727
#include <RooAbsPdf.h>
28-
#include <RooConstVar.h>
29-
#include <RooHelpers.h>
3028
#include <RooMsgService.h>
3129
#include <RooRealVar.h>
3230
#include <RooSimultaneous.h>
3331

32+
#include "RooFit/BatchModeDataHelpers.h"
33+
3434
#include <TInterpreter.h>
3535

3636
#include <fstream>
3737

38+
namespace RooFit::Experimental {
39+
3840
RooEvaluatorWrapper::RooEvaluatorWrapper(RooAbsReal &topNode, RooAbsData *data, bool useGPU,
3941
std::string const &rangeName, RooAbsPdf const *pdf,
4042
bool takeGlobalObservablesFromData)
@@ -519,4 +521,6 @@ void RooEvaluatorWrapper::writeDebugMacro(std::string const &filename) const
519521
return _funcWrapper->writeDebugMacro(filename);
520522
}
521523

524+
} // namespace RooFit::Experimental
525+
522526
/// \endcond

roofit/roofitcore/src/RooFit/BatchModeDataHelpers.h

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,22 +18,16 @@
1818
#include <RooFit/EvalContext.h>
1919

2020
#include <ROOT/RSpan.hxx>
21-
#include <string_view>
2221

2322
#include <functional>
2423
#include <map>
25-
#include <memory>
2624
#include <stack>
2725
#include <vector>
2826

29-
class RooAbsCategory;
3027
class RooAbsData;
3128
class RooSimultaneous;
3229

33-
class TNamed;
34-
35-
namespace RooFit {
36-
namespace BatchModeDataHelpers {
30+
namespace RooFit::BatchModeDataHelpers {
3731

3832
std::map<RooFit::Detail::DataKey, std::span<const double>>
3933
getDataSpans(RooAbsData const &data, std::string const &rangeName, RooSimultaneous const *simPdf, bool skipZeroWeights,
@@ -42,8 +36,7 @@ getDataSpans(RooAbsData const &data, std::string const &rangeName, RooSimultaneo
4236
std::map<RooFit::Detail::DataKey, std::size_t>
4337
determineOutputSizes(RooAbsArg const &topNode, std::function<int(RooFit::Detail::DataKey)> const &inputSizeFunc);
4438

45-
} // namespace BatchModeDataHelpers
46-
} // namespace RooFit
39+
} // namespace RooFit::BatchModeDataHelpers
4740

4841
#endif
4942

roofit/roofitcore/test/testRooFuncWrapper.cxx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,15 @@
1111
* listed in LICENSE (http://roofit.sourceforge.net/license.txt)
1212
*/
1313

14-
#include <RooAbsData.h>
15-
#include <RooAbsPdf.h>
1614
#include <RooAddPdf.h>
1715
#include <RooBinWidthFunction.h>
1816
#include <RooCategory.h>
1917
#include <RooClassFactory.h>
2018
#include <RooDataHist.h>
2119
#include <RooDataSet.h>
20+
#include <RooEvaluatorWrapper.h>
2221
#include <RooExponential.h>
2322
#include <RooFitResult.h>
24-
#include <../src/RooEvaluatorWrapper.h>
2523
#include <RooGaussian.h>
2624
#include <RooHelpers.h>
2725
#include <RooHistFunc.h>
@@ -161,7 +159,7 @@ TEST_P(FactoryTest, NLLFit)
161159

162160
// We want to use the generated code also for the nominal likelihood. Like
163161
// this, we make sure to validate also the NLL values of the generated code.
164-
static_cast<RooEvaluatorWrapper &>(*nllFunc).setUseGeneratedFunctionCode(true);
162+
static_cast<RooFit::Experimental::RooEvaluatorWrapper &>(*nllFunc).setUseGeneratedFunctionCode(true);
165163

166164
double tol = _params._fitResultTolerance;
167165

0 commit comments

Comments
 (0)