From 423cfbf9eccc988d7864cd1466943a31e941c415 Mon Sep 17 00:00:00 2001 From: Jonas Rembser Date: Mon, 28 Oct 2024 17:48:14 +0100 Subject: [PATCH] [RF] Take out RooFit code generation context outside of Detail namespace We are expecting users to interact with this class, since it is essential to implement code generation for your own RooFit primitives. Putting the class in the "Detail" namespace sends the wrong message and normalized it for users to ignore the convention that "Detail" or "Internal" stuff should not be used. While removing the namespace, also rename the class to a shorter and more succinct name, matching the "codegen" evaluation backend name. "Codegen" also sounds more friendly than "CodeSquash", which reminds me of "fly squash". --- roofit/doc/developers/roofit_ad.md | 46 +++++++++---------- .../RooStats/HistFactory/FlexibleInterpVar.h | 2 +- .../inc/RooStats/HistFactory/ParamHistFunc.h | 2 +- .../HistFactory/PiecewiseInterpolation.h | 2 +- roofit/histfactory/src/FlexibleInterpVar.cxx | 2 +- roofit/histfactory/src/ParamHistFunc.cxx | 2 +- .../src/PiecewiseInterpolation.cxx | 2 +- roofit/roofit/inc/RooBernstein.h | 4 +- roofit/roofit/inc/RooBifurGauss.h | 4 +- roofit/roofit/inc/RooCBShape.h | 4 +- roofit/roofit/inc/RooChebychev.h | 4 +- roofit/roofit/inc/RooExponential.h | 4 +- roofit/roofit/inc/RooGamma.h | 4 +- roofit/roofit/inc/RooGaussian.h | 4 +- roofit/roofit/inc/RooLandau.h | 4 +- roofit/roofit/inc/RooLognormal.h | 4 +- roofit/roofit/inc/RooParamHistFunc.h | 2 +- roofit/roofit/inc/RooPoisson.h | 4 +- roofit/roofit/inc/RooPolynomial.h | 4 +- roofit/roofit/inc/RooUniform.h | 4 +- roofit/roofit/src/RooBernstein.cxx | 4 +- roofit/roofit/src/RooBifurGauss.cxx | 4 +- roofit/roofit/src/RooCBShape.cxx | 4 +- roofit/roofit/src/RooChebychev.cxx | 4 +- roofit/roofit/src/RooExponential.cxx | 4 +- roofit/roofit/src/RooGamma.cxx | 4 +- roofit/roofit/src/RooGaussian.cxx | 4 +- roofit/roofit/src/RooLandau.cxx | 4 +- roofit/roofit/src/RooLognormal.cxx | 4 +- roofit/roofit/src/RooParamHistFunc.cxx | 2 +- roofit/roofit/src/RooPoisson.cxx | 4 +- roofit/roofit/src/RooPolynomial.cxx | 4 +- roofit/roofit/src/RooUniform.cxx | 4 +- roofit/roofitcore/CMakeLists.txt | 4 +- roofit/roofitcore/inc/RooAbsArg.h | 6 +-- roofit/roofitcore/inc/RooAbsReal.h | 4 +- roofit/roofitcore/inc/RooAddPdf.h | 2 +- roofit/roofitcore/inc/RooAddition.h | 2 +- roofit/roofitcore/inc/RooConstVar.h | 2 +- roofit/roofitcore/inc/RooConstraintSum.h | 2 +- roofit/roofitcore/inc/RooDataHist.h | 4 +- roofit/roofitcore/inc/RooEffProd.h | 2 +- roofit/roofitcore/inc/RooEfficiency.h | 4 +- roofit/roofitcore/inc/RooExtendPdf.h | 2 +- .../CodeSquashContext.h => CodegenContext.h} | 20 ++++---- roofit/roofitcore/inc/RooFormulaVar.h | 2 +- roofit/roofitcore/inc/RooGenericPdf.h | 2 +- roofit/roofitcore/inc/RooHistFunc.h | 4 +- roofit/roofitcore/inc/RooHistPdf.h | 6 +-- roofit/roofitcore/inc/RooPolyVar.h | 4 +- roofit/roofitcore/inc/RooProduct.h | 2 +- roofit/roofitcore/inc/RooRatio.h | 2 +- roofit/roofitcore/inc/RooRealIntegral.h | 2 +- roofit/roofitcore/inc/RooRealSumFunc.h | 2 +- roofit/roofitcore/inc/RooRealSumPdf.h | 4 +- roofit/roofitcore/inc/RooRealVar.h | 2 +- roofit/roofitcore/inc/RooRecursiveFraction.h | 2 +- roofit/roofitcore/src/RooAbsArg.cxx | 2 +- roofit/roofitcore/src/RooAbsReal.cxx | 2 +- roofit/roofitcore/src/RooAddPdf.cxx | 2 +- roofit/roofitcore/src/RooAddition.cxx | 2 +- roofit/roofitcore/src/RooClassFactory.cxx | 4 +- roofit/roofitcore/src/RooConstVar.cxx | 2 +- roofit/roofitcore/src/RooConstraintSum.cxx | 2 +- roofit/roofitcore/src/RooDataHist.cxx | 4 +- roofit/roofitcore/src/RooEffProd.cxx | 2 +- roofit/roofitcore/src/RooEfficiency.cxx | 4 +- roofit/roofitcore/src/RooExtendPdf.cxx | 2 +- ...deSquashContext.cxx => CodegenContext.cxx} | 39 ++++++++-------- roofit/roofitcore/src/RooFormulaVar.cxx | 2 +- roofit/roofitcore/src/RooFuncWrapper.cxx | 4 +- roofit/roofitcore/src/RooGenericPdf.cxx | 2 +- roofit/roofitcore/src/RooHistFunc.cxx | 4 +- roofit/roofitcore/src/RooHistPdf.cxx | 6 +-- roofit/roofitcore/src/RooNLLVarNew.cxx | 2 +- roofit/roofitcore/src/RooNLLVarNew.h | 2 +- roofit/roofitcore/src/RooNormalizedPdf.cxx | 2 +- roofit/roofitcore/src/RooNormalizedPdf.h | 2 +- roofit/roofitcore/src/RooPolyVar.cxx | 4 +- roofit/roofitcore/src/RooProdPdf.cxx | 2 +- roofit/roofitcore/src/RooProduct.cxx | 2 +- roofit/roofitcore/src/RooRatio.cxx | 2 +- roofit/roofitcore/src/RooRealIntegral.cxx | 2 +- roofit/roofitcore/src/RooRealSumFunc.cxx | 2 +- roofit/roofitcore/src/RooRealSumPdf.cxx | 4 +- roofit/roofitcore/src/RooRealVar.cxx | 2 +- .../roofitcore/src/RooRecursiveFraction.cxx | 2 +- 87 files changed, 176 insertions(+), 185 deletions(-) rename roofit/roofitcore/inc/RooFit/{Detail/CodeSquashContext.h => CodegenContext.h} (93%) rename roofit/roofitcore/src/RooFit/{Detail/CodeSquashContext.cxx => CodegenContext.cxx} (88%) diff --git a/roofit/doc/developers/roofit_ad.md b/roofit/doc/developers/roofit_ad.md index 991ae8824e7cee..5f8e09ca1c699d 100644 --- a/roofit/doc/developers/roofit_ad.md +++ b/roofit/doc/developers/roofit_ad.md @@ -94,7 +94,7 @@ computation, but without any overhead that is hard to digest by the AD tool. On a high level, this *code generation* is implemented as follows: 1. The computation graph is visited recursively by a - RooFit::Detail::CodeSquashContext object, via the virtual + RooFit::CodegenContext object, via the virtual RooAbsArg::translate() function that implements the translation of a given RooFit class to minimal C++ code. This is an example of the visitor pattern. @@ -183,7 +183,7 @@ properties out of the RooFit classes that make up the statistical model. The `translate()` function helps implement the Code Squashing logic that is used to optimize numerical evaluations. It accomplishes this by using a small subset of helper functions that are available in the -`RooFit::Detail::CodeSquashContext` and `RooFuncWrapper` classes +`RooFit::CodegenContext` and `RooFuncWrapper` classes (see Appendix B). It converts a RooFit expression into a form that can be efficiently evaluated by Clad. @@ -285,7 +285,7 @@ To translate the `RooPoisson` class, create a translate function and in it include a call to the updated function. ``` {.cpp} -void RooPoisson::translate(RooFit::Detail::RooFit::Detail::CodeSquashContext &ctx) const +void RooPoisson::translate(RooFit::CodegenContext &ctx) const { std::string xName = ctx.getResult(x); if (!_noRounding) @@ -326,7 +326,7 @@ more complicated. For a specific class, it will add whatever is represented on *after* it has AD support. ``` {.cpp} -void RooGaussian::translate(RooFit::Detail::RooFit::Detail::CodeSquashContext &ctx) const +void RooGaussian::translate(RooFit::CodegenContext &ctx) const { ctx.addResult(this, ctx.buildCall("RooFit::Detail::MathFuncs::gaussianEvaluate", x, mean, sigma)); } @@ -350,7 +350,7 @@ the only way to propagate these upwards into the compute graph. function can be seen here: ``` {.cpp} -void RooNLLVarNew::translate(RooFit::Detail::RooFit::Detail::CodeSquashContext &ctx) const +void RooNLLVarNew::translate(RooFit::CodegenContext &ctx) const { std::string weightSumName = ctx.makeValidVarName(GetName()) + "WeightSum"; std::string resName = ctx.makeValidVarName(GetName()) + "Result"; @@ -516,7 +516,7 @@ the `res` variable in the following example) of this class, which can then be propagated in the rest of the compute graph. ``` {.cpp} - void translate(RooFit::Detail::RooFit::Detail::CodeSquashContext &ctx) const override { + void translate(RooFit::CodegenContext &ctx) const override { std::string res = ctx.buildCall("MathFuncs::doFoo", a, b); ctx.addResult(this, res); } @@ -561,7 +561,7 @@ return the output using the `buildCall()` function. ``` {.cpp} std::string - buildCallToAnalyticIntegral(Int_t code, const char *rangeName, RooFit::Detail::RooFit::Detail::CodeSquashContext &ctx) const override { + buildCallToAnalyticIntegral(Int_t code, const char *rangeName, RooFit::CodegenContext &ctx) const override { return ctx.buildCall("EvaluateFunc::integralFoo", a, b); } ``` @@ -594,13 +594,13 @@ class RooFoo : public RooAbsReal { } //// ************************** functions for AD Support *********************** - void translate(RooFit::Detail::RooFit::Detail::CodeSquashContext &ctx) const override { + void translate(RooFit::CodegenContext &ctx) const override { std::string res = ctx.buildCall("EvaluateFunc::doFoo", a, b); ctx.addResult(this, res); } std::string - buildCallToAnalyticIntegral(Int_t code, const char *rangeName, RooFit::Detail::RooFit::Detail::CodeSquashContext &ctx) const override { + buildCallToAnalyticIntegral(Int_t code, const char *rangeName, RooFit::CodegenContext &ctx) const override { return ctx.buildCall("EvaluateFunc::integralFoo", a, b); } //// ************************** functions for AD Support *********************** @@ -717,19 +717,19 @@ compile times are reasonable, but with an increase in the level of complexity, Following classes provide several Helper Functions to translate existing logic into AD-supported logic. -a - RooFit::Detail::CodeSquashContext +a - RooFit::CodegenContext b - RooFuncWrapper -### a. RooFit::Detail::CodeSquashContext +### a. RooFit::CodegenContext -> [roofit/roofitcore/inc/RooFit/Detail/CodeSquashContext.h](https://github.com/root-project/root/blob/master/roofit/roofitcore/inc/RooFit/Detail/CodeSquashContext.h) +> [roofit/roofitcore/inc/RooFit/CodegenContext.h](https://github.com/root-project/root/blob/master/roofit/roofitcore/inc/RooFit/CodegenContext.h) It handles how to create a C++ function out of the compute graph (which is created with different RooFit classes). This C++ function will be independent of these RooFit classes. -RooFit::Detail::CodeSquashContext helps traverse the compute graph received from RooFit and +RooFit::CodegenContext helps traverse the compute graph received from RooFit and then it translates that into a single piece of code (a C++ function), that can then be differentiated using Clad. It also helps evaluate the model. @@ -747,7 +747,7 @@ the squashing to happen. #### Helper Functions -- **RooFit::Detail::CodeSquashContext**: this class maintains the context for squashing of +- **RooFit::CodegenContext**: this class maintains the context for squashing of RooFit models into code. It keeps track of the results of various expressions to avoid redundant calculations. @@ -787,7 +787,7 @@ code body of the squashed function. These functions will appear again in this document with more contextual examples. For detailed in-line documentation (code comments), please see: -> [roofit/roofitcore/src/RooFit/Detail/CodeSquashContext.cxx](https://github.com/root-project/root/blob/master/roofit/roofitcore/src/RooFit/Detail/CodeSquashContext.cxx) +> [roofit/roofitcore/src/RooFit/CodegenContext.cxx](https://github.com/root-project/root/blob/master/roofit/roofitcore/src/RooFit/Detail/CodegenContext.cxx) ### b. RooFuncWrapper @@ -828,7 +828,7 @@ examples. For detailed in-line documentation (code comments), please see: ## Appendix C - Helper functions discussed in this document -- **RooFit::Detail::CodeSquashContext::addResult()**: For a specific class, it +- **RooFit::CodegenContext::addResult()**: For a specific class, it will add whatever is represented on the right-hand side (a function call, an expression, etc.) to the result of this class, which can then be propagated in the rest of the compute graph. A to call `addResult()`must be included in @@ -838,14 +838,14 @@ expression, etc.) to the result of this class, which can then be propagated in new name to assign/overwrite). - Output: Adds (or overwrites) the string representing the result of a node. -- **RooFit::Detail::CodeSquashContext::getResult()**: It helps lookup the +- **RooFit::CodegenContext::getResult()**: It helps lookup the result of a child node (the string that the child node previously saved in a variable using the `addResult()` function). - Input: `key` (the node to get the result string for). - Output: String representing the result of this node. -- **RooFit::Detail::CodeSquashContext::addToCodeBody()**: Takes whatever string +- **RooFit::CodegenContext::addToCodeBody()**: Takes whatever string is computed in its arguments and adds it to the overall function string (which will later be just-in-time compiled). @@ -853,7 +853,7 @@ variable using the `addResult()` function). (string to add to the squashed code). - Output: Adds the input string to the squashed code body. -- **RooFit::Detail::CodeSquashContext::addToGlobalScope()**: Helps declare and +- **RooFit::CodegenContext::addToGlobalScope()**: Helps declare and initialize the results variable, so that it can be available globally (throughout the function body). @@ -861,14 +861,14 @@ initialize the results variable, so that it can be available globally - Output: Adds the given string to the string block that will be emitted at the top of the squashed function. -- **RooFit::Detail::CodeSquashContext::assembleCode()**: combines the generated +- **RooFit::CodegenContext::assembleCode()**: combines the generated code statements into the final code body of the squashed function. - Input: `returnExpr` (he string representation of what the squashed function should return, usually the head node). - Output: The final body of the function. -- **RooFit::Detail::CodeSquashContext::beginLoop()**: The code squashing task +- **RooFit::CodegenContext::beginLoop()**: The code squashing task will automatically build a For loop around the indented statements that follow this function. @@ -876,13 +876,13 @@ will automatically build a For loop around the indented statements that follow dependent variables). - Output: A scope for iterating over vector observables. -- **RooFit::Detail::CodeSquashContext::buildArg()**: helps convert RooFit +- **RooFit::CodegenContext::buildArg()**: helps convert RooFit objects into arrays or other C++ representations for efficient computation. - Input: `in` (the list to convert to array). - Output: Name of the array that stores the input list in the squashed code. -- **RooFit::Detail::CodeSquashContext::buildCall()**: Creates a string +- **RooFit::CodegenContext::buildCall()**: Creates a string representation of the function to be called and its arguments. - Input: A function with name `funcname`, passing some arguments. diff --git a/roofit/histfactory/inc/RooStats/HistFactory/FlexibleInterpVar.h b/roofit/histfactory/inc/RooStats/HistFactory/FlexibleInterpVar.h index 7fbdf1ddacb30f..e35a3124c86476 100644 --- a/roofit/histfactory/inc/RooStats/HistFactory/FlexibleInterpVar.h +++ b/roofit/histfactory/inc/RooStats/HistFactory/FlexibleInterpVar.h @@ -58,7 +58,7 @@ namespace HistFactory{ void doEval(RooFit::EvalContext &) const override; - void translate(RooFit::Detail::CodeSquashContext &ctx) const override; + void translate(RooFit::CodegenContext &ctx) const override; protected: diff --git a/roofit/histfactory/inc/RooStats/HistFactory/ParamHistFunc.h b/roofit/histfactory/inc/RooStats/HistFactory/ParamHistFunc.h index f94b506e3350ad..6e3517b0dbd060 100644 --- a/roofit/histfactory/inc/RooStats/HistFactory/ParamHistFunc.h +++ b/roofit/histfactory/inc/RooStats/HistFactory/ParamHistFunc.h @@ -103,7 +103,7 @@ class ParamHistFunc : public RooAbsReal { double evaluate() const override; void doEval(RooFit::EvalContext &) const override; - void translate(RooFit::Detail::CodeSquashContext &ctx) const override; + void translate(RooFit::CodegenContext &ctx) const override; private: static NumBins getNumBinsPerDim(RooArgSet const& vars); diff --git a/roofit/histfactory/inc/RooStats/HistFactory/PiecewiseInterpolation.h b/roofit/histfactory/inc/RooStats/HistFactory/PiecewiseInterpolation.h index cd47e4dcd12c46..6a4870ab6cff03 100644 --- a/roofit/histfactory/inc/RooStats/HistFactory/PiecewiseInterpolation.h +++ b/roofit/histfactory/inc/RooStats/HistFactory/PiecewiseInterpolation.h @@ -69,7 +69,7 @@ class PiecewiseInterpolation : public RooAbsReal { std::list* plotSamplingHint(RooAbsRealLValue& obs, double xlo, double xhi) const override ; bool isBinnedDistribution(const RooArgSet& obs) const override ; - void translate(RooFit::Detail::CodeSquashContext &ctx) const override; + void translate(RooFit::CodegenContext &ctx) const override; protected: diff --git a/roofit/histfactory/src/FlexibleInterpVar.cxx b/roofit/histfactory/src/FlexibleInterpVar.cxx index 11c97bdacec02d..4f856668cedaee 100644 --- a/roofit/histfactory/src/FlexibleInterpVar.cxx +++ b/roofit/histfactory/src/FlexibleInterpVar.cxx @@ -218,7 +218,7 @@ double FlexibleInterpVar::evaluate() const return total; } -void FlexibleInterpVar::translate(RooFit::Detail::CodeSquashContext &ctx) const +void FlexibleInterpVar::translate(RooFit::CodegenContext &ctx) const { unsigned int n = _interpCode.size(); diff --git a/roofit/histfactory/src/ParamHistFunc.cxx b/roofit/histfactory/src/ParamHistFunc.cxx index 94321ca0f28f93..3fb7963efd7808 100644 --- a/roofit/histfactory/src/ParamHistFunc.cxx +++ b/roofit/histfactory/src/ParamHistFunc.cxx @@ -560,7 +560,7 @@ double ParamHistFunc::evaluate() const return getParameter().getVal(); } -void ParamHistFunc::translate(RooFit::Detail::CodeSquashContext &ctx) const +void ParamHistFunc::translate(RooFit::CodegenContext &ctx) const { auto const &n = _numBinsPerDim; diff --git a/roofit/histfactory/src/PiecewiseInterpolation.cxx b/roofit/histfactory/src/PiecewiseInterpolation.cxx index 3810a8b4132a6d..535779d2d88623 100644 --- a/roofit/histfactory/src/PiecewiseInterpolation.cxx +++ b/roofit/histfactory/src/PiecewiseInterpolation.cxx @@ -184,7 +184,7 @@ double PiecewiseInterpolation::evaluate() const } -void PiecewiseInterpolation::translate(RooFit::Detail::CodeSquashContext &ctx) const +void PiecewiseInterpolation::translate(RooFit::CodegenContext &ctx) const { std::size_t n = _interpCode.size(); diff --git a/roofit/roofit/inc/RooBernstein.h b/roofit/roofit/inc/RooBernstein.h index 3241fedc761dbf..5b3f02552e079d 100644 --- a/roofit/roofit/inc/RooBernstein.h +++ b/roofit/roofit/inc/RooBernstein.h @@ -32,9 +32,9 @@ class RooBernstein : public RooAbsPdf { double analyticalIntegral(Int_t code, const char *rangeName = nullptr) const override; void selectNormalizationRange(const char *rangeName = nullptr, bool force = false) override; - void translate(RooFit::Detail::CodeSquashContext &ctx) const override; + void translate(RooFit::CodegenContext &ctx) const override; std::string buildCallToAnalyticIntegral(Int_t code, const char *rangeName, - RooFit::Detail::CodeSquashContext &ctx) const override; + RooFit::CodegenContext &ctx) const override; private: void fillBuffer() const; diff --git a/roofit/roofit/inc/RooBifurGauss.h b/roofit/roofit/inc/RooBifurGauss.h index 29553ff1a991a8..d6a9ae64431d5e 100644 --- a/roofit/roofit/inc/RooBifurGauss.h +++ b/roofit/roofit/inc/RooBifurGauss.h @@ -31,9 +31,9 @@ class RooBifurGauss : public RooAbsPdf { Int_t getAnalyticalIntegral(RooArgSet &allVars, RooArgSet &analVars, const char *rangeName = nullptr) const override; double analyticalIntegral(Int_t code, const char *rangeName = nullptr) const override; - void translate(RooFit::Detail::CodeSquashContext &ctx) const override; + void translate(RooFit::CodegenContext &ctx) const override; std::string buildCallToAnalyticIntegral(Int_t code, const char *rangeName, - RooFit::Detail::CodeSquashContext &ctx) const override; + RooFit::CodegenContext &ctx) const override; protected: RooRealProxy x; diff --git a/roofit/roofit/inc/RooCBShape.h b/roofit/roofit/inc/RooCBShape.h index 348f6c2bc7588c..7fc24a69c15507 100644 --- a/roofit/roofit/inc/RooCBShape.h +++ b/roofit/roofit/inc/RooCBShape.h @@ -38,9 +38,9 @@ class RooCBShape : public RooAbsPdf { Int_t getMaxVal(const RooArgSet& vars) const override ; double maxVal(Int_t code) const override ; - void translate(RooFit::Detail::CodeSquashContext &ctx) const override; + void translate(RooFit::CodegenContext &ctx) const override; std::string - buildCallToAnalyticIntegral(Int_t code, const char *rangeName, RooFit::Detail::CodeSquashContext &ctx) const override; + buildCallToAnalyticIntegral(Int_t code, const char *rangeName, RooFit::CodegenContext &ctx) const override; protected: diff --git a/roofit/roofit/inc/RooChebychev.h b/roofit/roofit/inc/RooChebychev.h index 1b2354b2a8ad0d..2c94254ee58656 100644 --- a/roofit/roofit/inc/RooChebychev.h +++ b/roofit/roofit/inc/RooChebychev.h @@ -37,9 +37,9 @@ class RooChebychev : public RooAbsPdf { void selectNormalizationRange(const char* rangeName=nullptr, bool force=false) override ; - void translate(RooFit::Detail::CodeSquashContext &ctx) const override; + void translate(RooFit::CodegenContext &ctx) const override; std::string - buildCallToAnalyticIntegral(Int_t code, const char *rangeName, RooFit::Detail::CodeSquashContext &ctx) const override; + buildCallToAnalyticIntegral(Int_t code, const char *rangeName, RooFit::CodegenContext &ctx) const override; private: RooRealProxy _x; diff --git a/roofit/roofit/inc/RooExponential.h b/roofit/roofit/inc/RooExponential.h index 6604f6da290d0d..0894e91b8fdb32 100644 --- a/roofit/roofit/inc/RooExponential.h +++ b/roofit/roofit/inc/RooExponential.h @@ -38,9 +38,9 @@ class RooExponential : public RooAbsPdf { bool negateCoefficient() const { return _negateCoefficient; } - void translate(RooFit::Detail::CodeSquashContext &ctx) const override; + void translate(RooFit::CodegenContext &ctx) const override; std::string buildCallToAnalyticIntegral(Int_t code, const char *rangeName, - RooFit::Detail::CodeSquashContext &ctx) const override; + RooFit::CodegenContext &ctx) const override; protected: RooRealProxy x; diff --git a/roofit/roofit/inc/RooGamma.h b/roofit/roofit/inc/RooGamma.h index 4000787dd0cb5b..a05b5823d39807 100644 --- a/roofit/roofit/inc/RooGamma.h +++ b/roofit/roofit/inc/RooGamma.h @@ -31,9 +31,9 @@ class RooGamma : public RooAbsPdf { Int_t getGenerator(const RooArgSet& directVars, RooArgSet &generateVars, bool staticInitOK=true) const override; void generateEvent(Int_t code) override; - void translate(RooFit::Detail::CodeSquashContext &ctx) const override; + void translate(RooFit::CodegenContext &ctx) const override; std::string - buildCallToAnalyticIntegral(Int_t code, const char *rangeName, RooFit::Detail::CodeSquashContext &ctx) const override; + buildCallToAnalyticIntegral(Int_t code, const char *rangeName, RooFit::CodegenContext &ctx) const override; protected: diff --git a/roofit/roofit/inc/RooGaussian.h b/roofit/roofit/inc/RooGaussian.h index 571cdd39428148..6e5d82fdc04865 100644 --- a/roofit/roofit/inc/RooGaussian.h +++ b/roofit/roofit/inc/RooGaussian.h @@ -50,9 +50,9 @@ class RooGaussian : public RooAbsPdf { /// Get the sigma parameter. RooAbsReal const& getSigma() const { return sigma.arg(); } - void translate(RooFit::Detail::CodeSquashContext &ctx) const override; + void translate(RooFit::CodegenContext &ctx) const override; std::string - buildCallToAnalyticIntegral(Int_t code, const char *rangeName, RooFit::Detail::CodeSquashContext &ctx) const override; + buildCallToAnalyticIntegral(Int_t code, const char *rangeName, RooFit::CodegenContext &ctx) const override; protected: diff --git a/roofit/roofit/inc/RooLandau.h b/roofit/roofit/inc/RooLandau.h index 4e7f91c1cf3143..eccaa37d1a67d7 100644 --- a/roofit/roofit/inc/RooLandau.h +++ b/roofit/roofit/inc/RooLandau.h @@ -37,9 +37,9 @@ class RooLandau : public RooAbsPdf { Int_t getAnalyticalIntegral(RooArgSet &allVars, RooArgSet &analVars, const char *rangeName = nullptr) const override; double analyticalIntegral(Int_t code, const char *rangeName) const override; - void translate(RooFit::Detail::CodeSquashContext &ctx) const override; + void translate(RooFit::CodegenContext &ctx) const override; std::string - buildCallToAnalyticIntegral(Int_t code, const char *rangeName, RooFit::Detail::CodeSquashContext &ctx) const override; + buildCallToAnalyticIntegral(Int_t code, const char *rangeName, RooFit::CodegenContext &ctx) const override; protected: diff --git a/roofit/roofit/inc/RooLognormal.h b/roofit/roofit/inc/RooLognormal.h index f824bfae046e84..a2ef80a9009fd8 100644 --- a/roofit/roofit/inc/RooLognormal.h +++ b/roofit/roofit/inc/RooLognormal.h @@ -28,9 +28,9 @@ class RooLognormal : public RooAbsPdf { Int_t getGenerator(const RooArgSet &directVars, RooArgSet &generateVars, bool staticInitOK = true) const override; void generateEvent(Int_t code) override; - void translate(RooFit::Detail::CodeSquashContext &ctx) const override; + void translate(RooFit::CodegenContext &ctx) const override; std::string - buildCallToAnalyticIntegral(int code, const char *rangeName, RooFit::Detail::CodeSquashContext &ctx) const override; + buildCallToAnalyticIntegral(int code, const char *rangeName, RooFit::CodegenContext &ctx) const override; /// Get the x variable. RooAbsReal const &getX() const { return x.arg(); } diff --git a/roofit/roofit/inc/RooParamHistFunc.h b/roofit/roofit/inc/RooParamHistFunc.h index b42392bd59e333..15edbe59d1bb3e 100644 --- a/roofit/roofit/inc/RooParamHistFunc.h +++ b/roofit/roofit/inc/RooParamHistFunc.h @@ -45,7 +45,7 @@ class RooParamHistFunc : public RooAbsReal { const RooArgList& paramList() const { return _p ; } - void translate(RooFit::Detail::CodeSquashContext &ctx) const override; + void translate(RooFit::CodegenContext &ctx) const override; protected: diff --git a/roofit/roofit/inc/RooPoisson.h b/roofit/roofit/inc/RooPoisson.h index ab1ec42591a6c1..c0d6e30562de57 100644 --- a/roofit/roofit/inc/RooPoisson.h +++ b/roofit/roofit/inc/RooPoisson.h @@ -45,9 +45,9 @@ class RooPoisson : public RooAbsPdf { /// Get the mean parameter. RooAbsReal const& getMean() const { return mean.arg(); } - void translate(RooFit::Detail::CodeSquashContext &ctx) const override; + void translate(RooFit::CodegenContext &ctx) const override; std::string - buildCallToAnalyticIntegral(int code, const char *rangeName, RooFit::Detail::CodeSquashContext &ctx) const override; + buildCallToAnalyticIntegral(int code, const char *rangeName, RooFit::CodegenContext &ctx) const override; protected: diff --git a/roofit/roofit/inc/RooPolynomial.h b/roofit/roofit/inc/RooPolynomial.h index 8a9282ca5d5d91..3188d35b7b2955 100644 --- a/roofit/roofit/inc/RooPolynomial.h +++ b/roofit/roofit/inc/RooPolynomial.h @@ -48,9 +48,9 @@ class RooPolynomial : public RooAbsPdf { // pdf is a reducer node because it doesn't depend on the observables. bool isReducerNode() const override { return _coefList.empty(); } - void translate(RooFit::Detail::CodeSquashContext &ctx) const override; + void translate(RooFit::CodegenContext &ctx) const override; std::string buildCallToAnalyticIntegral(Int_t code, const char *rangeName, - RooFit::Detail::CodeSquashContext &ctx) const override; + RooFit::CodegenContext &ctx) const override; protected: RooRealProxy _x; diff --git a/roofit/roofit/inc/RooUniform.h b/roofit/roofit/inc/RooUniform.h index 2f13a735b398db..33009892e4b8f2 100644 --- a/roofit/roofit/inc/RooUniform.h +++ b/roofit/roofit/inc/RooUniform.h @@ -34,9 +34,9 @@ class RooUniform : public RooAbsPdf { Int_t getGenerator(const RooArgSet& directVars, RooArgSet &generateVars, bool staticInitOK=true) const override; void generateEvent(Int_t code) override; - void translate(RooFit::Detail::CodeSquashContext &ctx) const override; + void translate(RooFit::CodegenContext &ctx) const override; std::string - buildCallToAnalyticIntegral(Int_t code, const char *rangeName, RooFit::Detail::CodeSquashContext &ctx) const override; + buildCallToAnalyticIntegral(Int_t code, const char *rangeName, RooFit::CodegenContext &ctx) const override; protected: diff --git a/roofit/roofit/src/RooBernstein.cxx b/roofit/roofit/src/RooBernstein.cxx index ff7a440f91d513..b4dcba2a4f9d71 100644 --- a/roofit/roofit/src/RooBernstein.cxx +++ b/roofit/roofit/src/RooBernstein.cxx @@ -81,7 +81,7 @@ double RooBernstein::evaluate() const return RooFit::Detail::MathFuncs::bernstein(_x, xmin(), xmax(), _buffer.data(), _coefList.size()); } -void RooBernstein::translate(RooFit::Detail::CodeSquashContext &ctx) const +void RooBernstein::translate(RooFit::CodegenContext &ctx) const { fillBuffer(); ctx.addResult(this, ctx.buildCall("RooFit::Detail::MathFuncs::bernstein", _x, xmin(), xmax(), _coefList, @@ -108,7 +108,7 @@ double RooBernstein::analyticalIntegral(Int_t /*code*/, const char *rangeName) c } std::string RooBernstein::buildCallToAnalyticIntegral(Int_t /*code*/, const char *rangeName, - RooFit::Detail::CodeSquashContext &ctx) const + RooFit::CodegenContext &ctx) const { fillBuffer(); // to get the right xmin() and xmax() return ctx.buildCall("RooFit::Detail::MathFuncs::bernsteinIntegral", _x.min(rangeName), _x.max(rangeName), diff --git a/roofit/roofit/src/RooBifurGauss.cxx b/roofit/roofit/src/RooBifurGauss.cxx index 80b736ebda9b2b..9ce1a6d0447858 100644 --- a/roofit/roofit/src/RooBifurGauss.cxx +++ b/roofit/roofit/src/RooBifurGauss.cxx @@ -62,7 +62,7 @@ double RooBifurGauss::evaluate() const //////////////////////////////////////////////////////////////////////////////// -void RooBifurGauss::translate(RooFit::Detail::CodeSquashContext &ctx) const +void RooBifurGauss::translate(RooFit::CodegenContext &ctx) const { ctx.addResult(this, ctx.buildCall("RooFit::Detail::MathFuncs::bifurGauss", x, mean, sigmaL, sigmaR)); } @@ -100,7 +100,7 @@ double RooBifurGauss::analyticalIntegral(Int_t code, const char *rangeName) cons //////////////////////////////////////////////////////////////////////////////// std::string RooBifurGauss::buildCallToAnalyticIntegral(Int_t code, const char *rangeName, - RooFit::Detail::CodeSquashContext &ctx) const + RooFit::CodegenContext &ctx) const { auto &constant = code == 1 ? mean : x; auto &integrand = code == 1 ? x : mean; diff --git a/roofit/roofit/src/RooCBShape.cxx b/roofit/roofit/src/RooCBShape.cxx index 69962dcd69d294..7f49e9df07a525 100644 --- a/roofit/roofit/src/RooCBShape.cxx +++ b/roofit/roofit/src/RooCBShape.cxx @@ -64,7 +64,7 @@ double RooCBShape::evaluate() const return RooFit::Detail::MathFuncs::cbShape(m, m0, sigma, alpha, n); } -void RooCBShape::translate(RooFit::Detail::CodeSquashContext &ctx) const +void RooCBShape::translate(RooFit::CodegenContext &ctx) const { ctx.addResult(this, ctx.buildCall("RooFit::Detail::MathFuncs::cbShape", m, m0, sigma, alpha, n)); } @@ -96,7 +96,7 @@ double RooCBShape::analyticalIntegral(Int_t /*code*/, const char *rangeName) con } std::string -RooCBShape::buildCallToAnalyticIntegral(Int_t /*code*/, const char *rangeName, RooFit::Detail::CodeSquashContext &ctx) const +RooCBShape::buildCallToAnalyticIntegral(Int_t /*code*/, const char *rangeName, RooFit::CodegenContext &ctx) const { return ctx.buildCall("RooFit::Detail::MathFuncs::cbShapeIntegral", m.min(rangeName), m.max(rangeName), m0, sigma, alpha, n); diff --git a/roofit/roofit/src/RooChebychev.cxx b/roofit/roofit/src/RooChebychev.cxx index 8aa19c71becc02..826b4b88df1659 100644 --- a/roofit/roofit/src/RooChebychev.cxx +++ b/roofit/roofit/src/RooChebychev.cxx @@ -90,7 +90,7 @@ double RooChebychev::evaluate() const return RooFit::Detail::MathFuncs::chebychev(coeffs.data(), _coefList.size(), _x, xmin, xmax); } -void RooChebychev::translate(RooFit::Detail::CodeSquashContext &ctx) const +void RooChebychev::translate(RooFit::CodegenContext &ctx) const { // first bring the range of the variable _x to the normalised range [-1, 1] // calculate sum_k c_k T_k(x) where x is given in the normalised range, @@ -145,7 +145,7 @@ double RooChebychev::analyticalIntegral(Int_t code, const char* rangeName) const } std::string RooChebychev::buildCallToAnalyticIntegral(Int_t /* code */, const char *rangeName, - RooFit::Detail::CodeSquashContext &ctx) const + RooFit::CodegenContext &ctx) const { double xmax = _x.max(_refRangeName ? _refRangeName->GetName() : nullptr); double xmaxFull = _x.max(rangeName); diff --git a/roofit/roofit/src/RooExponential.cxx b/roofit/roofit/src/RooExponential.cxx index be95366154a1e1..dd2ffd10f5b101 100644 --- a/roofit/roofit/src/RooExponential.cxx +++ b/roofit/roofit/src/RooExponential.cxx @@ -113,7 +113,7 @@ double RooExponential::analyticalIntegral(Int_t code, const char *rangeName) con //////////////////////////////////////////////////////////////////////////////// -void RooExponential::translate(RooFit::Detail::CodeSquashContext &ctx) const +void RooExponential::translate(RooFit::CodegenContext &ctx) const { // Build a call to the stateless exponential defined later. std::string coef; @@ -127,7 +127,7 @@ void RooExponential::translate(RooFit::Detail::CodeSquashContext &ctx) const //////////////////////////////////////////////////////////////////////////////// std::string RooExponential::buildCallToAnalyticIntegral(Int_t code, const char *rangeName, - RooFit::Detail::CodeSquashContext &ctx) const + RooFit::CodegenContext &ctx) const { bool isOverX = code == 1; diff --git a/roofit/roofit/src/RooGamma.cxx b/roofit/roofit/src/RooGamma.cxx index 91ada3f568c227..5d9e607cd00b4c 100644 --- a/roofit/roofit/src/RooGamma.cxx +++ b/roofit/roofit/src/RooGamma.cxx @@ -87,7 +87,7 @@ double RooGamma::evaluate() const //////////////////////////////////////////////////////////////////////////////// -void RooGamma::translate(RooFit::Detail::CodeSquashContext &ctx) const +void RooGamma::translate(RooFit::CodegenContext &ctx) const { ctx.addResult(this, ctx.buildCall("TMath::GammaDist", x, gamma, mu, beta)); } @@ -120,7 +120,7 @@ double RooGamma::analyticalIntegral(Int_t /*code*/, const char *rangeName) const //////////////////////////////////////////////////////////////////////////////// std::string RooGamma::buildCallToAnalyticIntegral(Int_t /*code*/, const char *rangeName, - RooFit::Detail::CodeSquashContext &ctx) const + RooFit::CodegenContext &ctx) const { const std::string a = ctx.buildCall("ROOT::Math::gamma_cdf", x.max(rangeName), gamma, beta, mu); const std::string b = ctx.buildCall("ROOT::Math::gamma_cdf", x.min(rangeName), gamma, beta, mu); diff --git a/roofit/roofit/src/RooGaussian.cxx b/roofit/roofit/src/RooGaussian.cxx index 79b2e4adaec65c..75c741417a9816 100644 --- a/roofit/roofit/src/RooGaussian.cxx +++ b/roofit/roofit/src/RooGaussian.cxx @@ -129,7 +129,7 @@ void RooGaussian::generateEvent(Int_t code) //////////////////////////////////////////////////////////////////////////////// -void RooGaussian::translate(RooFit::Detail::CodeSquashContext &ctx) const +void RooGaussian::translate(RooFit::CodegenContext &ctx) const { // Build a call to the stateless gaussian defined later. ctx.addResult(this, ctx.buildCall("RooFit::Detail::MathFuncs::gaussian", x, mean, sigma)); @@ -138,7 +138,7 @@ void RooGaussian::translate(RooFit::Detail::CodeSquashContext &ctx) const //////////////////////////////////////////////////////////////////////////////// std::string RooGaussian::buildCallToAnalyticIntegral(Int_t code, const char *rangeName, - RooFit::Detail::CodeSquashContext &ctx) const + RooFit::CodegenContext &ctx) const { auto& constant = code == 1 ? mean : x; auto& integrand = code == 1 ? x : mean; diff --git a/roofit/roofit/src/RooLandau.cxx b/roofit/roofit/src/RooLandau.cxx index 9262ae714a3f71..a0e461d3c93ac6 100644 --- a/roofit/roofit/src/RooLandau.cxx +++ b/roofit/roofit/src/RooLandau.cxx @@ -63,7 +63,7 @@ double RooLandau::evaluate() const //////////////////////////////////////////////////////////////////////////////// -void RooLandau::translate(RooFit::Detail::CodeSquashContext &ctx) const +void RooLandau::translate(RooFit::CodegenContext &ctx) const { ctx.addResult(this, ctx.buildCall("RooFit::Detail::MathFuncs::landau", x, mean, sigma)); } @@ -104,7 +104,7 @@ Double_t RooLandau::analyticalIntegral(Int_t /*code*/, const char *rangeName) co //////////////////////////////////////////////////////////////////////////////// std::string RooLandau::buildCallToAnalyticIntegral(Int_t /*code*/, const char *rangeName, - RooFit::Detail::CodeSquashContext &ctx) const + RooFit::CodegenContext &ctx) const { // Don't do anything with "code". It can only be "1" anyway (see // implementation of getAnalyticalIntegral). diff --git a/roofit/roofit/src/RooLognormal.cxx b/roofit/roofit/src/RooLognormal.cxx index f771d83e75b29a..1ab9474722d6cc 100644 --- a/roofit/roofit/src/RooLognormal.cxx +++ b/roofit/roofit/src/RooLognormal.cxx @@ -82,7 +82,7 @@ double RooLognormal::evaluate() const return ROOT::Math::lognormal_pdf(x, ln_m0, ln_k); } -void RooLognormal::translate(RooFit::Detail::CodeSquashContext &ctx) const +void RooLognormal::translate(RooFit::CodegenContext &ctx) const { std::string funcName = _useStandardParametrization ? "logNormalEvaluateStandard" : "logNormal"; ctx.addResult(this, ctx.buildCall("RooFit::Detail::MathFuncs::" + funcName, x, k, m0)); @@ -117,7 +117,7 @@ double RooLognormal::analyticalIntegral(Int_t /*code*/, const char *rangeName) c } std::string RooLognormal::buildCallToAnalyticIntegral(int /*code*/, const char *rangeName, - RooFit::Detail::CodeSquashContext &ctx) const + RooFit::CodegenContext &ctx) const { std::string funcName = _useStandardParametrization ? "logNormalIntegralStandard" : "logNormalIntegral"; return ctx.buildCall("RooFit::Detail::MathFuncs::" + funcName, x.min(rangeName), x.max(rangeName), m0, k); diff --git a/roofit/roofit/src/RooParamHistFunc.cxx b/roofit/roofit/src/RooParamHistFunc.cxx index 0ca4527d5448e6..bcd3d04e574fbf 100644 --- a/roofit/roofit/src/RooParamHistFunc.cxx +++ b/roofit/roofit/src/RooParamHistFunc.cxx @@ -77,7 +77,7 @@ double RooParamHistFunc::evaluate() const return _relParam ? ret * getNominal(idx) : ret; } -void RooParamHistFunc::translate(RooFit::Detail::CodeSquashContext &ctx) const +void RooParamHistFunc::translate(RooFit::CodegenContext &ctx) const { std::string const &idx = _dh.calculateTreeIndexForCodeSquash(this, ctx, _x); std::string arrName = ctx.buildArg(_p); diff --git a/roofit/roofit/src/RooPoisson.cxx b/roofit/roofit/src/RooPoisson.cxx index 247605f287ccbf..7a872e4f94751e 100644 --- a/roofit/roofit/src/RooPoisson.cxx +++ b/roofit/roofit/src/RooPoisson.cxx @@ -64,7 +64,7 @@ double RooPoisson::evaluate() const return RooFit::Detail::MathFuncs::poisson(k, mean); } -void RooPoisson::translate(RooFit::Detail::CodeSquashContext &ctx) const +void RooPoisson::translate(RooFit::CodegenContext &ctx) const { std::string xName = ctx.getResult(x); if (!_noRounding) @@ -103,7 +103,7 @@ double RooPoisson::analyticalIntegral(Int_t code, const char* rangeName) const } std::string -RooPoisson::buildCallToAnalyticIntegral(int code, const char *rangeName, RooFit::Detail::CodeSquashContext &ctx) const +RooPoisson::buildCallToAnalyticIntegral(int code, const char *rangeName, RooFit::CodegenContext &ctx) const { R__ASSERT(code == 1 || code == 2); std::string xName = ctx.getResult(x); diff --git a/roofit/roofit/src/RooPolynomial.cxx b/roofit/roofit/src/RooPolynomial.cxx index eac663acf88e10..053b95ff7df585 100644 --- a/roofit/roofit/src/RooPolynomial.cxx +++ b/roofit/roofit/src/RooPolynomial.cxx @@ -111,7 +111,7 @@ double RooPolynomial::evaluate() const return RooFit::Detail::MathFuncs::polynomial(_wksp.data(), sz, _lowestOrder, _x); } -void RooPolynomial::translate(RooFit::Detail::CodeSquashContext &ctx) const +void RooPolynomial::translate(RooFit::CodegenContext &ctx) const { const unsigned sz = _coefList.size(); if (!sz) { @@ -153,7 +153,7 @@ double RooPolynomial::analyticalIntegral(Int_t code, const char *rangeName) cons } std::string RooPolynomial::buildCallToAnalyticIntegral(Int_t /* code */, const char *rangeName, - RooFit::Detail::CodeSquashContext &ctx) const + RooFit::CodegenContext &ctx) const { const double xmin = _x.min(rangeName); const double xmax = _x.max(rangeName); diff --git a/roofit/roofit/src/RooUniform.cxx b/roofit/roofit/src/RooUniform.cxx index 14a3391fd6fb15..5b232e541e5b1b 100644 --- a/roofit/roofit/src/RooUniform.cxx +++ b/roofit/roofit/src/RooUniform.cxx @@ -50,7 +50,7 @@ double RooUniform::evaluate() const return 1 ; } -void RooUniform::translate(RooFit::Detail::CodeSquashContext &ctx) const +void RooUniform::translate(RooFit::CodegenContext &ctx) const { ctx.addResult(this, "1.0"); } @@ -94,7 +94,7 @@ double RooUniform::analyticalIntegral(Int_t code, const char* rangeName) const } std::string RooUniform::buildCallToAnalyticIntegral(Int_t code, const char *rangeName, - RooFit::Detail::CodeSquashContext & /*ctx*/) const + RooFit::CodegenContext & /*ctx*/) const { // The integral of a uniform distribution is static, so we can just hardcode // the result in a string. diff --git a/roofit/roofitcore/CMakeLists.txt b/roofit/roofitcore/CMakeLists.txt index 29ffc54ab12394..4ec41da7c0d15b 100644 --- a/roofit/roofitcore/CMakeLists.txt +++ b/roofit/roofitcore/CMakeLists.txt @@ -117,7 +117,7 @@ ROOT_STANDARD_LIBRARY_PACKAGE(RooFitCore RooFirstMoment.h RooFit.h RooFit/Config.h - RooFit/Detail/CodeSquashContext.h + RooFit/CodegenContext.h RooFit/Detail/MathFuncs.h RooFit/Detail/NormalizationHelpers.h RooFit/EvalContext.h @@ -324,7 +324,7 @@ ROOT_STANDARD_LIBRARY_PACKAGE(RooFitCore src/RooFFTConvPdf.cxx src/RooFactoryWSTool.cxx src/RooFirstMoment.cxx - src/RooFit/Detail/CodeSquashContext.cxx + src/RooFit/CodegenContext.cxx src/RooFit/EvalContext.cxx src/RooFit/Evaluator.cxx src/RooFitImplHelpers.cxx diff --git a/roofit/roofitcore/inc/RooAbsArg.h b/roofit/roofitcore/inc/RooAbsArg.h index c69bfdd0ffc1d4..9a982373562bb9 100644 --- a/roofit/roofitcore/inc/RooAbsArg.h +++ b/roofit/roofitcore/inc/RooAbsArg.h @@ -56,9 +56,7 @@ using RooListProxy = RooCollectionProxy; class RooExpensiveObjectCache ; class RooWorkspace ; namespace RooFit { -namespace Detail { -class CodeSquashContext; -} +class CodegenContext; } class RooRefArray : public TObjArray { @@ -554,7 +552,7 @@ class RooAbsArg : public TNamed, public RooPrintable { virtual bool isCategory() const { return false; } - virtual void translate(RooFit::Detail::CodeSquashContext &ctx) const; + virtual void translate(RooFit::CodegenContext &ctx) const; protected: void graphVizAddConnections(std::set >&) ; diff --git a/roofit/roofitcore/inc/RooAbsReal.h b/roofit/roofitcore/inc/RooAbsReal.h index 8537b0192e7e17..2c5d22b7d507ab 100644 --- a/roofit/roofitcore/inc/RooAbsReal.h +++ b/roofit/roofitcore/inc/RooAbsReal.h @@ -21,7 +21,7 @@ #include "RooArgSet.h" #include "RooCmdArg.h" #include "RooCurve.h" -#include "RooFit/Detail/CodeSquashContext.h" +#include "RooFit/CodegenContext.h" #include "RooFit/EvalContext.h" #include "RooGlobalFunc.h" @@ -390,7 +390,7 @@ class RooAbsReal : public RooAbsArg { } virtual std::string - buildCallToAnalyticIntegral(Int_t code, const char *rangeName, RooFit::Detail::CodeSquashContext &ctx) const; + buildCallToAnalyticIntegral(Int_t code, const char *rangeName, RooFit::CodegenContext &ctx) const; // PlotOn with command list virtual RooPlot* plotOn(RooPlot* frame, RooLinkedList& cmdList) const ; diff --git a/roofit/roofitcore/inc/RooAddPdf.h b/roofit/roofitcore/inc/RooAddPdf.h index e2b5036cc9554d..1face4668cbfc2 100644 --- a/roofit/roofitcore/inc/RooAddPdf.h +++ b/roofit/roofitcore/inc/RooAddPdf.h @@ -93,7 +93,7 @@ class RooAddPdf : public RooAbsPdf { CacheMode canNodeBeCached() const override { return RooAbsArg::NotAdvised ; }; void setCacheAndTrackHints(RooArgSet&) override; - void translate(RooFit::Detail::CodeSquashContext &ctx) const override; + void translate(RooFit::CodegenContext &ctx) const override; std::unique_ptr compileForNormSet(RooArgSet const &normSet, RooFit::Detail::CompileContext & ctx) const override; diff --git a/roofit/roofitcore/inc/RooAddition.h b/roofit/roofitcore/inc/RooAddition.h index d1f1f743673169..9b29befeebaaf9 100644 --- a/roofit/roofitcore/inc/RooAddition.h +++ b/roofit/roofitcore/inc/RooAddition.h @@ -56,7 +56,7 @@ class RooAddition : public RooAbsReal { void doEval(RooFit::EvalContext &) const override; - void translate(RooFit::Detail::CodeSquashContext &ctx) const override; + void translate(RooFit::CodegenContext &ctx) const override; protected: diff --git a/roofit/roofitcore/inc/RooConstVar.h b/roofit/roofitcore/inc/RooConstVar.h index c89d0b9d1edd49..aceac109df01e4 100644 --- a/roofit/roofitcore/inc/RooConstVar.h +++ b/roofit/roofitcore/inc/RooConstVar.h @@ -48,7 +48,7 @@ class RooConstVar final : public RooAbsReal { _value = value; } - void translate(RooFit::Detail::CodeSquashContext &ctx) const override; + void translate(RooFit::CodegenContext &ctx) const override; protected: diff --git a/roofit/roofitcore/inc/RooConstraintSum.h b/roofit/roofitcore/inc/RooConstraintSum.h index 73360e39653077..c659dd18ab8dea 100644 --- a/roofit/roofitcore/inc/RooConstraintSum.h +++ b/roofit/roofitcore/inc/RooConstraintSum.h @@ -45,7 +45,7 @@ class RooConstraintSum : public RooAbsReal { std::unique_ptr compileForNormSet(RooArgSet const &normSet, RooFit::Detail::CompileContext & ctx) const override; - void translate(RooFit::Detail::CodeSquashContext &ctx) const override; + void translate(RooFit::CodegenContext &ctx) const override; protected: RooListProxy _set1 ; ///< Set of constraint terms diff --git a/roofit/roofitcore/inc/RooDataHist.h b/roofit/roofitcore/inc/RooDataHist.h index 2da88fc9da5a9c..54794b9ae36c5a 100644 --- a/roofit/roofitcore/inc/RooDataHist.h +++ b/roofit/roofitcore/inc/RooDataHist.h @@ -218,9 +218,9 @@ class RooDataHist : public RooAbsData, public RooDirItem { double const* wgtErrHiArray() const { return _errHi; } double const* sumW2Array() const { return _sumw2; } - std::string calculateTreeIndexForCodeSquash(RooAbsArg const *klass, RooFit::Detail::CodeSquashContext &ctx, + std::string calculateTreeIndexForCodeSquash(RooAbsArg const *klass, RooFit::CodegenContext &ctx, const RooAbsCollection &coords, bool reverse = false) const; - std::string declWeightArrayForCodeSquash(RooFit::Detail::CodeSquashContext &ctx, + std::string declWeightArrayForCodeSquash(RooFit::CodegenContext &ctx, bool correctForBinSize) const; protected: diff --git a/roofit/roofitcore/inc/RooEffProd.h b/roofit/roofitcore/inc/RooEffProd.h index dd14c5f6e6cad8..ad9d8f431a6863 100644 --- a/roofit/roofitcore/inc/RooEffProd.h +++ b/roofit/roofitcore/inc/RooEffProd.h @@ -32,7 +32,7 @@ class RooEffProd: public RooAbsPdf { // Function evaluation double evaluate() const override ; - void translate(RooFit::Detail::CodeSquashContext &ctx) const override; + void translate(RooFit::CodegenContext &ctx) const override; RooRealProxy _pdf ; ///< Probability Density function diff --git a/roofit/roofitcore/inc/RooEfficiency.h b/roofit/roofitcore/inc/RooEfficiency.h index c5232ba2da12ed..36e660784e3432 100644 --- a/roofit/roofitcore/inc/RooEfficiency.h +++ b/roofit/roofitcore/inc/RooEfficiency.h @@ -33,9 +33,9 @@ class RooEfficiency : public RooAbsPdf { Int_t getAnalyticalIntegral(RooArgSet& allVars, RooArgSet& analVars, const char* rangeName=nullptr) const override ; double analyticalIntegral(Int_t code, const char* rangeName=nullptr) const override ; - void translate(RooFit::Detail::CodeSquashContext &ctx) const override; + void translate(RooFit::CodegenContext &ctx) const override; std::string - buildCallToAnalyticIntegral(Int_t code, const char *rangeName, RooFit::Detail::CodeSquashContext &ctx) const override; + buildCallToAnalyticIntegral(Int_t code, const char *rangeName, RooFit::CodegenContext &ctx) const override; protected: diff --git a/roofit/roofitcore/inc/RooExtendPdf.h b/roofit/roofitcore/inc/RooExtendPdf.h index dfb287e3554ea6..ccdac65c8fcbe5 100644 --- a/roofit/roofitcore/inc/RooExtendPdf.h +++ b/roofit/roofitcore/inc/RooExtendPdf.h @@ -48,7 +48,7 @@ class RooExtendPdf : public RooAbsPdf { double expectedEvents(const RooArgSet* nset) const override ; std::unique_ptr createExpectedEventsFunc(const RooArgSet* nset) const override; - void translate(RooFit::Detail::CodeSquashContext &ctx) const override; + void translate(RooFit::CodegenContext &ctx) const override; protected: diff --git a/roofit/roofitcore/inc/RooFit/Detail/CodeSquashContext.h b/roofit/roofitcore/inc/RooFit/CodegenContext.h similarity index 93% rename from roofit/roofitcore/inc/RooFit/Detail/CodeSquashContext.h rename to roofit/roofitcore/inc/RooFit/CodegenContext.h index f80f018c45fbaa..c45ae2bb77ffba 100644 --- a/roofit/roofitcore/inc/RooFit/Detail/CodeSquashContext.h +++ b/roofit/roofitcore/inc/RooFit/CodegenContext.h @@ -11,8 +11,8 @@ * listed in LICENSE (http://roofit.sourceforge.net/license.txt) */ -#ifndef RooFit_Detail_CodeSquashContext_h -#define RooFit_Detail_CodeSquashContext_h +#ifndef RooFit_Detail_CodegenContext_h +#define RooFit_Detail_CodegenContext_h #include #include @@ -32,10 +32,8 @@ class RooTemplateProxy; namespace RooFit { -namespace Detail { - /// @brief A class to maintain the context for squashing of RooFit models into code. -class CodeSquashContext { +class CodegenContext { public: void addResult(RooAbsArg const *key, std::string const &value); void addResult(const char *key, std::string const &value); @@ -86,13 +84,13 @@ class CodeSquashContext { /// } class LoopScope { public: - LoopScope(CodeSquashContext &ctx, std::vector &&vars) : _ctx{ctx}, _vars{vars} {} + LoopScope(CodegenContext &ctx, std::vector &&vars) : _ctx{ctx}, _vars{vars} {} ~LoopScope() { _ctx.endLoop(*this); } std::vector const &vars() const { return _vars; } private: - CodeSquashContext &_ctx; + CodegenContext &_ctx; const std::vector _vars; }; @@ -193,18 +191,18 @@ class CodeSquashContext { }; template <> -inline std::string CodeSquashContext::typeName() const +inline std::string CodegenContext::typeName() const { return "double"; } template <> -inline std::string CodeSquashContext::typeName() const +inline std::string CodegenContext::typeName() const { return "int"; } template -std::string CodeSquashContext::buildArgSpanImpl(std::span arr) +std::string CodegenContext::buildArgSpanImpl(std::span arr) { unsigned int n = arr.size(); std::string arrName = getTmpVarName(); @@ -219,8 +217,6 @@ std::string CodeSquashContext::buildArgSpanImpl(std::span arr) return arrName; } -} // namespace Detail - } // namespace RooFit #endif diff --git a/roofit/roofitcore/inc/RooFormulaVar.h b/roofit/roofitcore/inc/RooFormulaVar.h index 1a44a4348667cb..7fe78095869eed 100644 --- a/roofit/roofitcore/inc/RooFormulaVar.h +++ b/roofit/roofitcore/inc/RooFormulaVar.h @@ -74,7 +74,7 @@ class RooFormulaVar : public RooAbsReal { // Function evaluation double evaluate() const override ; void doEval(RooFit::EvalContext &ctx) const override; - void translate(RooFit::Detail::CodeSquashContext &ctx) const override; + void translate(RooFit::CodegenContext &ctx) const override; protected: // Post-processing of server redirection diff --git a/roofit/roofitcore/inc/RooGenericPdf.h b/roofit/roofitcore/inc/RooGenericPdf.h index fede017979fb66..64b58ce8557347 100644 --- a/roofit/roofitcore/inc/RooGenericPdf.h +++ b/roofit/roofitcore/inc/RooGenericPdf.h @@ -67,7 +67,7 @@ class RooGenericPdf : public RooAbsPdf { RooListProxy _actualVars ; double evaluate() const override ; void doEval(RooFit::EvalContext &) const override; - void translate(RooFit::Detail::CodeSquashContext &ctx) const override; + void translate(RooFit::CodegenContext &ctx) const override; // Post-processing of server redirection bool redirectServersHook(const RooAbsCollection& newServerList, bool mustReplaceAll, bool nameChange, bool isRecursive) override ; diff --git a/roofit/roofitcore/inc/RooHistFunc.h b/roofit/roofitcore/inc/RooHistFunc.h index 0304e38bbefe02..1da24ad220eab5 100644 --- a/roofit/roofitcore/inc/RooHistFunc.h +++ b/roofit/roofitcore/inc/RooHistFunc.h @@ -99,9 +99,9 @@ class RooHistFunc : public RooAbsReal { Int_t getBin() const; std::vector getBins(RooFit::EvalContext & ctx) const; - void translate(RooFit::Detail::CodeSquashContext &ctx) const override; + void translate(RooFit::CodegenContext &ctx) const override; std::string - buildCallToAnalyticIntegral(int code, const char *rangeName, RooFit::Detail::CodeSquashContext &ctx) const override; + buildCallToAnalyticIntegral(int code, const char *rangeName, RooFit::CodegenContext &ctx) const override; RooArgSet const &variables() const { return _depList; } diff --git a/roofit/roofitcore/inc/RooHistPdf.h b/roofit/roofitcore/inc/RooHistPdf.h index f520fced18a32b..3b803648e71a11 100644 --- a/roofit/roofitcore/inc/RooHistPdf.h +++ b/roofit/roofitcore/inc/RooHistPdf.h @@ -95,9 +95,9 @@ class RooHistPdf : public RooAbsPdf { void doEval(RooFit::EvalContext &) const override; - void translate(RooFit::Detail::CodeSquashContext &ctx) const override; + void translate(RooFit::CodegenContext &ctx) const override; std::string - buildCallToAnalyticIntegral(int code, const char *rangeName, RooFit::Detail::CodeSquashContext &ctx) const override; + buildCallToAnalyticIntegral(int code, const char *rangeName, RooFit::CodegenContext &ctx) const override; protected: bool areIdentical(const RooDataHist& dh1, const RooDataHist& dh2) ; @@ -147,7 +147,7 @@ class RooHistPdf : public RooAbsPdf { double xlo, double xhi); - static void rooHistTranslateImpl(RooAbsArg const *klass, RooFit::Detail::CodeSquashContext &ctx, int intOrder, + static void rooHistTranslateImpl(RooAbsArg const *klass, RooFit::CodegenContext &ctx, int intOrder, RooDataHist const *dataHist, const RooArgSet &obs, bool correctForBinSize, bool cdfBoundaries); static std::string rooHistIntegralTranslateImpl(int code, RooAbsArg const *klass, RooDataHist const *dataHist, diff --git a/roofit/roofitcore/inc/RooPolyVar.h b/roofit/roofitcore/inc/RooPolyVar.h index d793c4c4931240..6ea0f1cba15fa1 100644 --- a/roofit/roofitcore/inc/RooPolyVar.h +++ b/roofit/roofitcore/inc/RooPolyVar.h @@ -34,9 +34,9 @@ class RooPolyVar : public RooAbsReal { Int_t getAnalyticalIntegral(RooArgSet &allVars, RooArgSet &analVars, const char *rangeName = nullptr) const override; double analyticalIntegral(Int_t code, const char *rangeName = nullptr) const override; - void translate(RooFit::Detail::CodeSquashContext &ctx) const override; + void translate(RooFit::CodegenContext &ctx) const override; std::string buildCallToAnalyticIntegral(Int_t code, const char *rangeName, - RooFit::Detail::CodeSquashContext &ctx) const override; + RooFit::CodegenContext &ctx) const override; protected: RooRealProxy _x; diff --git a/roofit/roofitcore/inc/RooProduct.h b/roofit/roofitcore/inc/RooProduct.h index 6b51c33d6f425a..fcb2d0977f0b1c 100644 --- a/roofit/roofitcore/inc/RooProduct.h +++ b/roofit/roofitcore/inc/RooProduct.h @@ -63,7 +63,7 @@ class RooProduct : public RooAbsReal { CacheMode canNodeBeCached() const override { return RooAbsArg::NotAdvised ; } ; void setCacheAndTrackHints(RooArgSet&) override ; - void translate(RooFit::Detail::CodeSquashContext &ctx) const override; + void translate(RooFit::CodegenContext &ctx) const override; protected: void ioStreamerPass2() override ; diff --git a/roofit/roofitcore/inc/RooRatio.h b/roofit/roofitcore/inc/RooRatio.h index ffd1123fbb0eb3..0e24a8d0347e77 100644 --- a/roofit/roofitcore/inc/RooRatio.h +++ b/roofit/roofitcore/inc/RooRatio.h @@ -36,7 +36,7 @@ class RooRatio : public RooAbsReal { void doEval(RooFit::EvalContext &) const override; inline bool canComputeBatchWithCuda() const override { return true; } - void translate(RooFit::Detail::CodeSquashContext &ctx) const override; + void translate(RooFit::CodegenContext &ctx) const override; RooRealProxy _numerator; RooRealProxy _denominator; diff --git a/roofit/roofitcore/inc/RooRealIntegral.h b/roofit/roofitcore/inc/RooRealIntegral.h index 8660f1d38a5125..40a0624d75b460 100644 --- a/roofit/roofitcore/inc/RooRealIntegral.h +++ b/roofit/roofitcore/inc/RooRealIntegral.h @@ -78,7 +78,7 @@ class RooRealIntegral : public RooAbsReal { std::unique_ptr compileForNormSet(RooArgSet const &normSet, RooFit::Detail::CompileContext & ctx) const override; - void translate(RooFit::Detail::CodeSquashContext &ctx) const override; + void translate(RooFit::CodegenContext &ctx) const override; inline RooArgSet const* funcNormSet() const { return _funcNormSet.get(); } diff --git a/roofit/roofitcore/inc/RooRealSumFunc.h b/roofit/roofitcore/inc/RooRealSumFunc.h index 29a765b45191fb..0f3f55fa51ca2c 100644 --- a/roofit/roofitcore/inc/RooRealSumFunc.h +++ b/roofit/roofitcore/inc/RooRealSumFunc.h @@ -60,7 +60,7 @@ class RooRealSumFunc : public RooAbsReal { std::unique_ptr compileForNormSet(RooArgSet const &normSet, RooFit::Detail::CompileContext & ctx) const override; - void translate(RooFit::Detail::CodeSquashContext &ctx) const override; + void translate(RooFit::CodegenContext &ctx) const override; protected: mutable RooObjCacheManager _normIntMgr; //! The integration cache manager diff --git a/roofit/roofitcore/inc/RooRealSumPdf.h b/roofit/roofitcore/inc/RooRealSumPdf.h index 0f231848a2d1ac..4dee397a8a0057 100644 --- a/roofit/roofitcore/inc/RooRealSumPdf.h +++ b/roofit/roofitcore/inc/RooRealSumPdf.h @@ -71,7 +71,7 @@ class RooRealSumPdf : public RooAbsPdf { std::unique_ptr createExpectedEventsFunc(const RooArgSet* nset) const override; - void translate(RooFit::Detail::CodeSquashContext &ctx) const override; + void translate(RooFit::CodegenContext &ctx) const override; protected: @@ -109,7 +109,7 @@ class RooRealSumPdf : public RooAbsPdf { bool doFloor, bool & hasWarnedBefore); - static std::string translateImpl(RooFit::Detail::CodeSquashContext &ctx, RooAbsArg const *klass, + static std::string translateImpl(RooFit::CodegenContext &ctx, RooAbsArg const *klass, RooArgList const &funcList, RooArgList const &coefList, bool normalize=false); static bool checkObservables(RooAbsReal const &caller, RooArgSet const *nset, RooArgList const &funcList, diff --git a/roofit/roofitcore/inc/RooRealVar.h b/roofit/roofitcore/inc/RooRealVar.h index 0cd3199d630d79..f2ff2af1dfe3cb 100644 --- a/roofit/roofitcore/inc/RooRealVar.h +++ b/roofit/roofitcore/inc/RooRealVar.h @@ -132,7 +132,7 @@ class RooRealVar : public RooAbsRealLValue { static void cleanup() ; - void translate(RooFit::Detail::CodeSquashContext &ctx) const override; + void translate(RooFit::CodegenContext &ctx) const override; protected: diff --git a/roofit/roofitcore/inc/RooRecursiveFraction.h b/roofit/roofitcore/inc/RooRecursiveFraction.h index 3b2849c4795436..bff61f7880869c 100644 --- a/roofit/roofitcore/inc/RooRecursiveFraction.h +++ b/roofit/roofitcore/inc/RooRecursiveFraction.h @@ -31,7 +31,7 @@ class RooRecursiveFraction : public RooAbsReal { RooRecursiveFraction(const RooRecursiveFraction& other, const char *name = nullptr); TObject* clone(const char* newname) const override { return new RooRecursiveFraction(*this, newname); } - void translate(RooFit::Detail::CodeSquashContext &ctx) const override; + void translate(RooFit::CodegenContext &ctx) const override; protected: diff --git a/roofit/roofitcore/src/RooAbsArg.cxx b/roofit/roofitcore/src/RooAbsArg.cxx index 5ddf4af4d2ae69..8229e28e976fe8 100644 --- a/roofit/roofitcore/src/RooAbsArg.cxx +++ b/roofit/roofitcore/src/RooAbsArg.cxx @@ -2543,7 +2543,7 @@ std::unique_ptr RooAbsArg::compileForNormSet(RooArgSet const & normSe /// /// \param[in] ctx An object to manage auxiliary information for code-squashing. Also takes the /// code string that this class outputs into the squashed code through the 'addToCodeBody' function. -void RooAbsArg::translate(RooFit::Detail::CodeSquashContext & /*ctx*/) const +void RooAbsArg::translate(RooFit::CodegenContext & /*ctx*/) const { std::stringstream errorMsg; errorMsg << "Translate function for class \"" << ClassName() << "\" has not yet been implemented."; diff --git a/roofit/roofitcore/src/RooAbsReal.cxx b/roofit/roofitcore/src/RooAbsReal.cxx index 8d69ef584d31b5..2f532a3b9c5cf7 100644 --- a/roofit/roofitcore/src/RooAbsReal.cxx +++ b/roofit/roofitcore/src/RooAbsReal.cxx @@ -4423,7 +4423,7 @@ void RooAbsReal::doEval(RooFit::EvalContext & ctx) const /// /// \returns The representative code string of the integral for the given object. std::string RooAbsReal::buildCallToAnalyticIntegral(Int_t /* code */, const char * /* rangeName */, - RooFit::Detail::CodeSquashContext & /*ctx*/) const + RooFit::CodegenContext & /*ctx*/) const { std::stringstream errorMsg; errorMsg << "An analytical integral function for class \"" << ClassName() << "\" has not yet been implemented."; diff --git a/roofit/roofitcore/src/RooAddPdf.cxx b/roofit/roofitcore/src/RooAddPdf.cxx index e10e8525f413df..d89559831bedaa 100644 --- a/roofit/roofitcore/src/RooAddPdf.cxx +++ b/roofit/roofitcore/src/RooAddPdf.cxx @@ -545,7 +545,7 @@ double RooAddPdf::getValV(const RooArgSet* normSet) const return _value; } -void RooAddPdf::translate(RooFit::Detail::CodeSquashContext &ctx) const +void RooAddPdf::translate(RooFit::CodegenContext &ctx) const { ctx.addResult(this, RooRealSumPdf::translateImpl(ctx, this, _pdfList, _coefList, true)); } diff --git a/roofit/roofitcore/src/RooAddition.cxx b/roofit/roofitcore/src/RooAddition.cxx index 6c78621e5febc7..b28d0c55151fc5 100644 --- a/roofit/roofitcore/src/RooAddition.cxx +++ b/roofit/roofitcore/src/RooAddition.cxx @@ -156,7 +156,7 @@ void RooAddition::doEval(RooFit::EvalContext &ctx) const //////////////////////////////////////////////////////////////////////////////// -void RooAddition::translate(RooFit::Detail::CodeSquashContext &ctx) const +void RooAddition::translate(RooFit::CodegenContext &ctx) const { if (_set.empty()) { ctx.addResult(this, "0.0"); diff --git a/roofit/roofitcore/src/RooClassFactory.cxx b/roofit/roofitcore/src/RooClassFactory.cxx index 6dbd104305da17..8db3a94dcdeff8 100644 --- a/roofit/roofitcore/src/RooClassFactory.cxx +++ b/roofit/roofitcore/src/RooClassFactory.cxx @@ -555,7 +555,7 @@ class CLASS_NAME : public BASE_NAME { hf << R"( double evaluate() const override; void doEval(RooFit::EvalContext &) const override; - void translate(RooFit::Detail::CodeSquashContext &ctx) const override; + void translate(RooFit::CodegenContext &ctx) const override; private: @@ -674,7 +674,7 @@ CLASS_NAME::CLASS_NAME(const char *name, const char *title, << " }\n" << "} \n"; -cf << "void CLASS_NAME::translate(RooFit::Detail::CodeSquashContext &ctx) const\n" +cf << "void CLASS_NAME::translate(RooFit::CodegenContext &ctx) const\n" << "{\n" << " ctx.addResult(this, ctx.buildCall(\"CLASS_NAME_evaluate\", " << listVars(alist) << "));\n" <<"}\n"; diff --git a/roofit/roofitcore/src/RooConstVar.cxx b/roofit/roofitcore/src/RooConstVar.cxx index d2d2aaa96fe05b..595bd74ada8ce8 100644 --- a/roofit/roofitcore/src/RooConstVar.cxx +++ b/roofit/roofitcore/src/RooConstVar.cxx @@ -58,7 +58,7 @@ void RooConstVar::writeToStream(std::ostream& os, bool /*compact*/) const //////////////////////////////////////////////////////////////////////////////// -void RooConstVar::translate(RooFit::Detail::CodeSquashContext &ctx) const +void RooConstVar::translate(RooFit::CodegenContext &ctx) const { // Just return a stringy-field version of the const value. // Formats to the maximum precision. diff --git a/roofit/roofitcore/src/RooConstraintSum.cxx b/roofit/roofitcore/src/RooConstraintSum.cxx index 18348e69385d0b..f464812ba49ba3 100644 --- a/roofit/roofitcore/src/RooConstraintSum.cxx +++ b/roofit/roofitcore/src/RooConstraintSum.cxx @@ -79,7 +79,7 @@ double RooConstraintSum::evaluate() const return sum; } -void RooConstraintSum::translate(RooFit::Detail::CodeSquashContext &ctx) const +void RooConstraintSum::translate(RooFit::CodegenContext &ctx) const { ctx.addResult(this, ctx.buildCall("RooFit::Detail::MathFuncs::constraintSum", _set1, _set1.size())); } diff --git a/roofit/roofitcore/src/RooDataHist.cxx b/roofit/roofitcore/src/RooDataHist.cxx index cb31a6f73ca6ac..b216c2d0c270c6 100644 --- a/roofit/roofitcore/src/RooDataHist.cxx +++ b/roofit/roofitcore/src/RooDataHist.cxx @@ -992,7 +992,7 @@ Int_t RooDataHist::getIndex(const RooAbsCollection& coord, bool fast) const { return calcTreeIndex(coord, fast); } -std::string RooDataHist::declWeightArrayForCodeSquash(RooFit::Detail::CodeSquashContext &ctx, +std::string RooDataHist::declWeightArrayForCodeSquash(RooFit::CodegenContext &ctx, bool correctForBinSize) const { std::vector vals(_arrSize); @@ -1008,7 +1008,7 @@ std::string RooDataHist::declWeightArrayForCodeSquash(RooFit::Detail::CodeSquash return ctx.buildArg(vals); } -std::string RooDataHist::calculateTreeIndexForCodeSquash(RooAbsArg const * /*klass*/, RooFit::Detail::CodeSquashContext &ctx, +std::string RooDataHist::calculateTreeIndexForCodeSquash(RooAbsArg const * /*klass*/, RooFit::CodegenContext &ctx, const RooAbsCollection &coords, bool reverse) const { assert(coords.size() == _vars.size()); diff --git a/roofit/roofitcore/src/RooEffProd.cxx b/roofit/roofitcore/src/RooEffProd.cxx index e4e1f27a39f751..4d3cf88e2aa111 100644 --- a/roofit/roofitcore/src/RooEffProd.cxx +++ b/roofit/roofitcore/src/RooEffProd.cxx @@ -72,7 +72,7 @@ RooAbsGenContext* RooEffProd::genContext(const RooArgSet &vars, const RooDataSet vars,prototype,auxProto,verbose) ; } -void RooEffProd::translate(RooFit::Detail::CodeSquashContext &ctx) const +void RooEffProd::translate(RooFit::CodegenContext &ctx) const { ctx.addResult(this, ctx.buildCall("RooFit::Detail::MathFuncs::effProd", _eff, _pdf)); } diff --git a/roofit/roofitcore/src/RooEfficiency.cxx b/roofit/roofitcore/src/RooEfficiency.cxx index a5078ec7bef8fa..1ca1ff9928fc47 100644 --- a/roofit/roofitcore/src/RooEfficiency.cxx +++ b/roofit/roofitcore/src/RooEfficiency.cxx @@ -87,14 +87,14 @@ double RooEfficiency::analyticalIntegral(int /*code*/, const char * /*rangeName* return 1.0; } -void RooEfficiency::translate(RooFit::Detail::CodeSquashContext &ctx) const +void RooEfficiency::translate(RooFit::CodegenContext &ctx) const { int sigCatIndex = _cat->lookupIndex(_sigCatName.Data()); ctx.addResult(this, ctx.buildCall("RooFit::Detail::MathFuncs::efficiency", _effFunc, _cat, sigCatIndex)); } std::string RooEfficiency::buildCallToAnalyticIntegral(int /*code*/, const char * /*rangeName*/, - RooFit::Detail::CodeSquashContext &) const + RooFit::CodegenContext &) const { return "1.0"; } diff --git a/roofit/roofitcore/src/RooExtendPdf.cxx b/roofit/roofitcore/src/RooExtendPdf.cxx index 556d5c53910aa3..e12529fdb80808 100644 --- a/roofit/roofitcore/src/RooExtendPdf.cxx +++ b/roofit/roofitcore/src/RooExtendPdf.cxx @@ -174,7 +174,7 @@ std::unique_ptr RooExtendPdf::createExpectedEventsFunc(const RooArgS } -void RooExtendPdf::translate(RooFit::Detail::CodeSquashContext &ctx) const +void RooExtendPdf::translate(RooFit::CodegenContext &ctx) const { // Use the result of the underlying pdf. ctx.addResult(this, ctx.getResult(_pdf)); diff --git a/roofit/roofitcore/src/RooFit/Detail/CodeSquashContext.cxx b/roofit/roofitcore/src/RooFit/CodegenContext.cxx similarity index 88% rename from roofit/roofitcore/src/RooFit/Detail/CodeSquashContext.cxx rename to roofit/roofitcore/src/RooFit/CodegenContext.cxx index a9760586bd9864..ccbe801b17f174 100644 --- a/roofit/roofitcore/src/RooFit/Detail/CodeSquashContext.cxx +++ b/roofit/roofitcore/src/RooFit/CodegenContext.cxx @@ -11,7 +11,7 @@ * listed in LICENSE (http://roofit.sourceforge.net/license.txt) */ -#include +#include #include "RooFitImplHelpers.h" @@ -31,19 +31,17 @@ bool startsWith(std::string_view str, std::string_view prefix) namespace RooFit { -namespace Detail { - /// @brief Adds (or overwrites) the string representing the result of a node. /// @param key The name of the node to add the result for. /// @param value The new name to assign/overwrite. -void CodeSquashContext::addResult(const char *key, std::string const &value) +void CodegenContext::addResult(const char *key, std::string const &value) { const TNamed *namePtr = RooNameReg::known(key); if (namePtr) addResult(namePtr, value); } -void CodeSquashContext::addResult(TNamed const *key, std::string const &value) +void CodegenContext::addResult(TNamed const *key, std::string const &value) { _nodeNames[key] = value; } @@ -53,7 +51,7 @@ void CodeSquashContext::addResult(TNamed const *key, std::string const &value) /// existing code body. /// @param key The node to get the result string for. /// @return String representing the result of this node. -std::string const &CodeSquashContext::getResult(RooAbsArg const &arg) +std::string const &CodegenContext::getResult(RooAbsArg const &arg) { // If the result has already been recorded, just return the result. // It is usually the responsibility of each translate function to assign @@ -81,7 +79,7 @@ std::string const &CodeSquashContext::getResult(RooAbsArg const &arg) /// @brief Adds the given string to the string block that will be emitted at the top of the squashed function. Useful /// for variable declarations. /// @param str The string to add to the global scope. -void CodeSquashContext::addToGlobalScope(std::string const &str) +void CodegenContext::addToGlobalScope(std::string const &str) { _globalScope += str; } @@ -91,7 +89,7 @@ void CodeSquashContext::addToGlobalScope(std::string const &str) /// element. For example, a vector valued variable x with 10 entries will be squashed to obs[start_idx + i]. /// @param key The name of the node representing the vector valued observable. /// @param idx The start index (or relative position of the observable in the set of all observables). -void CodeSquashContext::addVecObs(const char *key, int idx) +void CodegenContext::addVecObs(const char *key, int idx) { const TNamed *namePtr = RooNameReg::known(key); if (namePtr) @@ -103,7 +101,7 @@ void CodeSquashContext::addVecObs(const char *key, int idx) /// loops, automatically determines if code needs to be stored inside or outside loop scope. /// @param klass The class requesting this addition, usually 'this'. /// @param in String to add to the squashed code. -void CodeSquashContext::addToCodeBody(RooAbsArg const *klass, std::string const &in) +void CodegenContext::addToCodeBody(RooAbsArg const *klass, std::string const &in) { // If we are in a loop and the value is scope independent, save it at the top of the loop. // else, just save it in the current scope. @@ -115,7 +113,7 @@ void CodeSquashContext::addToCodeBody(RooAbsArg const *klass, std::string const /// a value/collection of values is scope independent. /// @param in String to add to the squashed code. /// @param isScopeIndep The value determining if the input is scope dependent. -void CodeSquashContext::addToCodeBody(std::string const &in, bool isScopeIndep /* = false */) +void CodegenContext::addToCodeBody(std::string const &in, bool isScopeIndep /* = false */) { // If we are in a loop and the value is scope independent, save it at the top of the loop. // else, just save it in the current scope. @@ -129,7 +127,7 @@ void CodeSquashContext::addToCodeBody(std::string const &in, bool isScopeIndep / /// @brief Create a RAII scope for iterating over vector observables. You can't use the result of vector observables /// outside these loop scopes. /// @param in A pointer to the calling class, used to determine the loop dependent variables. -std::unique_ptr CodeSquashContext::beginLoop(RooAbsArg const *in) +std::unique_ptr CodegenContext::beginLoop(RooAbsArg const *in) { std::string idx = "loopIdx" + std::to_string(_loopLevel); @@ -165,7 +163,7 @@ std::unique_ptr CodeSquashContext::beginLoop(RooAb return std::make_unique(*this, std::move(vars)); } -void CodeSquashContext::endLoop(LoopScope const &scope) +void CodegenContext::endLoop(LoopScope const &scope) { _code += "}\n"; @@ -183,7 +181,7 @@ void CodeSquashContext::endLoop(LoopScope const &scope) } /// @brief Get a unique variable name to be used in the generated code. -std::string CodeSquashContext::getTmpVarName() const +std::string CodegenContext::getTmpVarName() const { return "t" + std::to_string(_tmpVarIdx++); } @@ -191,7 +189,7 @@ std::string CodeSquashContext::getTmpVarName() const /// @brief A function to save an expression that includes/depends on the result of the input node. /// @param in The node on which the valueToSave depends on/belongs to. /// @param valueToSave The actual string value to save as a temporary. -void CodeSquashContext::addResult(RooAbsArg const *in, std::string const &valueToSave) +void CodegenContext::addResult(RooAbsArg const *in, std::string const &valueToSave) { // std::string savedName = RooFit::Detail::makeValidVarName(in->GetName()); std::string savedName = getTmpVarName(); @@ -216,7 +214,7 @@ void CodeSquashContext::addResult(RooAbsArg const *in, std::string const &valueT /// @brief Function to save a RooListProxy as an array in the squashed code. /// @param in The list to convert to array. /// @return Name of the array that stores the input list in the squashed code. -std::string CodeSquashContext::buildArg(RooAbsCollection const &in) +std::string CodegenContext::buildArg(RooAbsCollection const &in) { if (in.empty()) { return "nullptr"; @@ -244,7 +242,7 @@ std::string CodeSquashContext::buildArg(RooAbsCollection const &in) return savedName; } -std::string CodeSquashContext::buildArg(std::span arr) +std::string CodegenContext::buildArg(std::span arr) { unsigned int n = arr.size(); std::string offset = std::to_string(_xlArr.size()); @@ -255,14 +253,14 @@ std::string CodeSquashContext::buildArg(std::span arr) return "xlArr + " + offset; } -bool CodeSquashContext::isScopeIndependent(RooAbsArg const *in) const +bool CodegenContext::isScopeIndependent(RooAbsArg const *in) const { return !in->isReducerNode() && outputSize(in->namePtr()) == 1; } /// @brief Register a function that is only know to the interpreter to the context. /// This is useful to dump the standalone C++ code for the computation graph. -void CodeSquashContext::collectFunction(std::string const &name) +void CodegenContext::collectFunction(std::string const &name) { _collectedFunctions.emplace_back(name); } @@ -270,9 +268,9 @@ void CodeSquashContext::collectFunction(std::string const &name) /// @brief Assemble and return the final code with the return expression and global statements. /// @param returnExpr The string representation of what the squashed function should return, usually the head node. /// @return The name of the declared function. -std::string CodeSquashContext::buildFunction(RooAbsArg const &arg, std::map const &outputSizes) +std::string CodegenContext::buildFunction(RooAbsArg const &arg, std::map const &outputSizes) { - CodeSquashContext ctx; + CodegenContext ctx; ctx._nodeOutputSizes = outputSizes; ctx._vecObsIndices = _vecObsIndices; // We only want to take over parameters and observables @@ -308,5 +306,4 @@ std::string CodeSquashContext::buildFunction(RooAbsArg const &arg, std::mapgetTFormula()->GetUniqueFuncName().Data(); diff --git a/roofit/roofitcore/src/RooFuncWrapper.cxx b/roofit/roofitcore/src/RooFuncWrapper.cxx index 4895fcff9128e3..12f91634357395 100644 --- a/roofit/roofitcore/src/RooFuncWrapper.cxx +++ b/roofit/roofitcore/src/RooFuncWrapper.cxx @@ -13,7 +13,7 @@ #include #include -#include +#include #include #include #include @@ -71,7 +71,7 @@ RooFuncWrapper::RooFuncWrapper(const char *name, const char *title, RooAbsReal & return found != spans.end() ? found->second.size() : -1; }); - RooFit::Detail::CodeSquashContext ctx; + RooFit::CodegenContext ctx; // First update the result variable of params in the compute graph to in[]. int idx = 0; diff --git a/roofit/roofitcore/src/RooGenericPdf.cxx b/roofit/roofitcore/src/RooGenericPdf.cxx index 83fc3da3b1a657..d515c53c3bea40 100644 --- a/roofit/roofitcore/src/RooGenericPdf.cxx +++ b/roofit/roofitcore/src/RooGenericPdf.cxx @@ -202,7 +202,7 @@ void RooGenericPdf::writeToStream(ostream& os, bool compact) const } } -void RooGenericPdf::translate(RooFit::Detail::CodeSquashContext &ctx) const +void RooGenericPdf::translate(RooFit::CodegenContext &ctx) const { getVal(); // to trigger the creation of the TFormula std::string funcName = _formula->getTFormula()->GetUniqueFuncName().Data(); diff --git a/roofit/roofitcore/src/RooHistFunc.cxx b/roofit/roofitcore/src/RooHistFunc.cxx index 67eaf780c9198c..586cb4ea4de6a0 100644 --- a/roofit/roofitcore/src/RooHistFunc.cxx +++ b/roofit/roofitcore/src/RooHistFunc.cxx @@ -190,7 +190,7 @@ double RooHistFunc::evaluate() const return ret ; } -void RooHistFunc::translate(RooFit::Detail::CodeSquashContext &ctx) const +void RooHistFunc::translate(RooFit::CodegenContext &ctx) const { RooHistPdf::rooHistTranslateImpl(this, ctx, _intOrder, _dataHist, _depList, false, _cdfBoundaries); } @@ -323,7 +323,7 @@ bool RooHistFunc::forceAnalyticalInt(const RooAbsArg& dep) const } std::string RooHistFunc::buildCallToAnalyticIntegral(int code, const char * /* rangeName */, - RooFit::Detail::CodeSquashContext & /* ctx */) const + RooFit::CodegenContext & /* ctx */) const { return RooHistPdf::rooHistIntegralTranslateImpl(code, this, _dataHist, _depList, true); } diff --git a/roofit/roofitcore/src/RooHistPdf.cxx b/roofit/roofitcore/src/RooHistPdf.cxx index fc11d305a34d0f..4726b11f98ad33 100644 --- a/roofit/roofitcore/src/RooHistPdf.cxx +++ b/roofit/roofitcore/src/RooHistPdf.cxx @@ -222,7 +222,7 @@ double RooHistPdf::evaluate() const return std::max(ret, 0.0); } -void RooHistPdf::rooHistTranslateImpl(RooAbsArg const *klass, RooFit::Detail::CodeSquashContext &ctx, int intOrder, +void RooHistPdf::rooHistTranslateImpl(RooAbsArg const *klass, RooFit::CodegenContext &ctx, int intOrder, RooDataHist const *dataHist, const RooArgSet &obs, bool correctForBinSize, bool cdfBoundaries) { @@ -245,7 +245,7 @@ void RooHistPdf::rooHistTranslateImpl(RooAbsArg const *klass, RooFit::Detail::Co ctx.addResult(klass, "*(" + weightArr + " + " + offset + ")"); } -void RooHistPdf::translate(RooFit::Detail::CodeSquashContext &ctx) const +void RooHistPdf::translate(RooFit::CodegenContext &ctx) const { rooHistTranslateImpl(this, ctx, _intOrder, _dataHist, _pdfObsList, !_unitNorm, _cdfBoundaries); } @@ -408,7 +408,7 @@ std::string RooHistPdf::rooHistIntegralTranslateImpl(int code, RooAbsArg const * } std::string RooHistPdf::buildCallToAnalyticIntegral(int code, const char * /*rangeName */, - RooFit::Detail::CodeSquashContext & /* ctx */) const + RooFit::CodegenContext & /* ctx */) const { return rooHistIntegralTranslateImpl(code, this, _dataHist, _pdfObsList, false); } diff --git a/roofit/roofitcore/src/RooNLLVarNew.cxx b/roofit/roofitcore/src/RooNLLVarNew.cxx index 5af0c0b9092e87..58319804ea71fc 100644 --- a/roofit/roofitcore/src/RooNLLVarNew.cxx +++ b/roofit/roofitcore/src/RooNLLVarNew.cxx @@ -331,7 +331,7 @@ void RooNLLVarNew::finalizeResult(RooFit::EvalContext &ctx, ROOT::Math::KahanSum ctx.setOutputWithOffset(this, result, _offset); } -void RooNLLVarNew::translate(RooFit::Detail::CodeSquashContext &ctx) const +void RooNLLVarNew::translate(RooFit::CodegenContext &ctx) const { if (_binnedL && !_pdf->getAttribute("BinnedLikelihoodActiveYields")) { std::stringstream errorMsg; diff --git a/roofit/roofitcore/src/RooNLLVarNew.h b/roofit/roofitcore/src/RooNLLVarNew.h index ce0dbfcc6cbe51..89954aa4318090 100644 --- a/roofit/roofitcore/src/RooNLLVarNew.h +++ b/roofit/roofitcore/src/RooNLLVarNew.h @@ -52,7 +52,7 @@ class RooNLLVarNew : public RooAbsReal { void setSimCount(int simCount) { _simCount = simCount; } - void translate(RooFit::Detail::CodeSquashContext &ctx) const override; + void translate(RooFit::CodegenContext &ctx) const override; private: double evaluate() const override { return _value; } diff --git a/roofit/roofitcore/src/RooNormalizedPdf.cxx b/roofit/roofitcore/src/RooNormalizedPdf.cxx index 52512365212b54..4c23fe3e7531d7 100644 --- a/roofit/roofitcore/src/RooNormalizedPdf.cxx +++ b/roofit/roofitcore/src/RooNormalizedPdf.cxx @@ -48,7 +48,7 @@ void RooNormalizedPdf::doEval(RooFit::EvalContext &ctx) const } } -void RooNormalizedPdf::translate(RooFit::Detail::CodeSquashContext &ctx) const +void RooNormalizedPdf::translate(RooFit::CodegenContext &ctx) const { // For now just return function/normalization integral. ctx.addResult(this, ctx.getResult(_pdf) + "/" + ctx.getResult(_normIntegral)); diff --git a/roofit/roofitcore/src/RooNormalizedPdf.h b/roofit/roofitcore/src/RooNormalizedPdf.h index 090e7e780c731d..a495580a0c42c1 100644 --- a/roofit/roofitcore/src/RooNormalizedPdf.h +++ b/roofit/roofitcore/src/RooNormalizedPdf.h @@ -64,7 +64,7 @@ class RooNormalizedPdf : public RooAbsPdf { return _pdf->createExpectedEventsFunc(&_normSet); } - void translate(RooFit::Detail::CodeSquashContext &ctx) const override; + void translate(RooFit::CodegenContext &ctx) const override; bool canComputeBatchWithCuda() const override { return true; } diff --git a/roofit/roofitcore/src/RooPolyVar.cxx b/roofit/roofitcore/src/RooPolyVar.cxx index db6b14d577047b..13a75e2742d88e 100644 --- a/roofit/roofitcore/src/RooPolyVar.cxx +++ b/roofit/roofitcore/src/RooPolyVar.cxx @@ -112,7 +112,7 @@ double RooPolyVar::evaluate() const return RooFit::Detail::MathFuncs::polynomial(_wksp.data(), sz, _lowestOrder, _x); } -void RooPolyVar::translate(RooFit::Detail::CodeSquashContext &ctx) const +void RooPolyVar::translate(RooFit::CodegenContext &ctx) const { const unsigned sz = _coefList.size(); if (!sz) { @@ -189,7 +189,7 @@ double RooPolyVar::analyticalIntegral(Int_t code, const char *rangeName) const } std::string RooPolyVar::buildCallToAnalyticIntegral(Int_t /* code */, const char *rangeName, - RooFit::Detail::CodeSquashContext &ctx) const + RooFit::CodegenContext &ctx) const { const double xmin = _x.min(rangeName); const double xmax = _x.max(rangeName); diff --git a/roofit/roofitcore/src/RooProdPdf.cxx b/roofit/roofitcore/src/RooProdPdf.cxx index 5a178f77ec2bc4..a7071860f8fc20 100644 --- a/roofit/roofitcore/src/RooProdPdf.cxx +++ b/roofit/roofitcore/src/RooProdPdf.cxx @@ -2340,7 +2340,7 @@ class RooFixedProdPdf : public RooAbsPdf { _prodPdf->doEvalImpl(this, *_cache, ctx); } - void translate(RooFit::Detail::CodeSquashContext &ctx) const override + void translate(RooFit::CodegenContext &ctx) const override { if (_cache->_isRearranged) { ctx.addResult(this, ctx.buildCall("RooFit::Detail::MathFuncs::ratio", *_cache->_rearrangedNum, *_cache->_rearrangedDen)); diff --git a/roofit/roofitcore/src/RooProduct.cxx b/roofit/roofitcore/src/RooProduct.cxx index 911e8e2cf5cb2c..9eff60b366a0bc 100644 --- a/roofit/roofitcore/src/RooProduct.cxx +++ b/roofit/roofitcore/src/RooProduct.cxx @@ -490,7 +490,7 @@ void RooProduct::setCacheAndTrackHints(RooArgSet& trackNodes) //////////////////////////////////////////////////////////////////////////////// -void RooProduct::translate(RooFit::Detail::CodeSquashContext &ctx) const +void RooProduct::translate(RooFit::CodegenContext &ctx) const { ctx.addResult(this, ctx.buildCall("RooFit::Detail::MathFuncs::product", _compRSet, _compRSet.size())); } diff --git a/roofit/roofitcore/src/RooRatio.cxx b/roofit/roofitcore/src/RooRatio.cxx index e58acce3dc3ece..53a6d55cfd06b6 100644 --- a/roofit/roofitcore/src/RooRatio.cxx +++ b/roofit/roofitcore/src/RooRatio.cxx @@ -124,7 +124,7 @@ void RooRatio::doEval(RooFit::EvalContext &ctx) const {ctx.at(_numerator), ctx.at(_denominator)}); } -void RooRatio::translate(RooFit::Detail::CodeSquashContext &ctx) const +void RooRatio::translate(RooFit::CodegenContext &ctx) const { ctx.addResult(this, ctx.buildCall("RooFit::Detail::MathFuncs::ratio", _numerator, _denominator)); } diff --git a/roofit/roofitcore/src/RooRealIntegral.cxx b/roofit/roofitcore/src/RooRealIntegral.cxx index 816813cf103927..4e40317e9c3d7a 100644 --- a/roofit/roofitcore/src/RooRealIntegral.cxx +++ b/roofit/roofitcore/src/RooRealIntegral.cxx @@ -1031,7 +1031,7 @@ void RooRealIntegral::setAllowComponentSelection(bool allow){ _respectCompSelect = allow; } -void RooRealIntegral::translate(RooFit::Detail::CodeSquashContext &ctx) const +void RooRealIntegral::translate(RooFit::CodegenContext &ctx) const { if (_sumList.empty() && _intList.empty()) { ctx.addResult(this, _function.arg().buildCallToAnalyticIntegral(_mode, RooNameReg::str(_rangeName), ctx)); diff --git a/roofit/roofitcore/src/RooRealSumFunc.cxx b/roofit/roofitcore/src/RooRealSumFunc.cxx index 191dc14333a65d..d8297ce3593c5a 100644 --- a/roofit/roofitcore/src/RooRealSumFunc.cxx +++ b/roofit/roofitcore/src/RooRealSumFunc.cxx @@ -114,7 +114,7 @@ double RooRealSumFunc::evaluate() const return RooRealSumPdf::evaluate(*this, _funcList, _coefList, _doFloor || _doFloorGlobal, _haveWarned); } -void RooRealSumFunc::translate(RooFit::Detail::CodeSquashContext &ctx) const +void RooRealSumFunc::translate(RooFit::CodegenContext &ctx) const { ctx.addResult(this, RooRealSumPdf::translateImpl(ctx, this, _funcList, _coefList)); } diff --git a/roofit/roofitcore/src/RooRealSumPdf.cxx b/roofit/roofitcore/src/RooRealSumPdf.cxx index 30c792be50669f..53725970c98489 100644 --- a/roofit/roofitcore/src/RooRealSumPdf.cxx +++ b/roofit/roofitcore/src/RooRealSumPdf.cxx @@ -297,7 +297,7 @@ void RooRealSumPdf::doEval(RooFit::EvalContext & ctx) const } } -std::string RooRealSumPdf::translateImpl(RooFit::Detail::CodeSquashContext &ctx, RooAbsArg const *klass, +std::string RooRealSumPdf::translateImpl(RooFit::CodegenContext &ctx, RooAbsArg const *klass, RooArgList const &funcList, RooArgList const &coefList, bool normalize) { bool noLastCoeff = funcList.size() != coefList.size(); @@ -328,7 +328,7 @@ std::string RooRealSumPdf::translateImpl(RooFit::Detail::CodeSquashContext &ctx, return sum; } -void RooRealSumPdf::translate(RooFit::Detail::CodeSquashContext &ctx) const +void RooRealSumPdf::translate(RooFit::CodegenContext &ctx) const { ctx.addResult(this, translateImpl(ctx, this, _funcList, _coefList)); } diff --git a/roofit/roofitcore/src/RooRealVar.cxx b/roofit/roofitcore/src/RooRealVar.cxx index 33b7adb8f9a409..ca6594b4599fd0 100644 --- a/roofit/roofitcore/src/RooRealVar.cxx +++ b/roofit/roofitcore/src/RooRealVar.cxx @@ -82,7 +82,7 @@ void RooRealVar::cleanup() //////////////////////////////////////////////////////////////////////////////// -void RooRealVar::translate(RooFit::Detail::CodeSquashContext &ctx) const +void RooRealVar::translate(RooFit::CodegenContext &ctx) const { if(!isConstant()) { ctx.addResult(this, GetName()); diff --git a/roofit/roofitcore/src/RooRecursiveFraction.cxx b/roofit/roofitcore/src/RooRecursiveFraction.cxx index 5f0460ef9319a2..1ed2a039a817a3 100644 --- a/roofit/roofitcore/src/RooRecursiveFraction.cxx +++ b/roofit/roofitcore/src/RooRecursiveFraction.cxx @@ -88,7 +88,7 @@ double RooRecursiveFraction::evaluate() const return prod ; } -void RooRecursiveFraction::translate(RooFit::Detail::CodeSquashContext &ctx) const +void RooRecursiveFraction::translate(RooFit::CodegenContext &ctx) const { ctx.addResult(this, ctx.buildCall("RooFit::Detail::MathFuncs::recursiveFraction", _list, _list.size())); }