Skip to content

Commit d3ece5c

Browse files
committed
[RF] Use RooRealVar::setValFast() in minimizer interface
The `setVal()` function has the overhead of checking if the parameter value is in the valid range. This is expensive, and it is the responsability of the minimizer like Minuit 2 to only evaluate points that are withing the defined parameter range.
1 parent 060241e commit d3ece5c

2 files changed

Lines changed: 3 additions & 1 deletion

File tree

roofit/roofitcore/inc/RooRealVar.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,8 @@ class RooRealVar : public RooAbsRealLValue {
138138
static bool _printScientific ;
139139
static Int_t _printSigDigits ;
140140

141+
friend class RooAbsMinimizerFcn;
142+
141143
void setValFast(double value) override
142144
{
143145
if (_value != value) {

roofit/roofitcore/src/RooAbsMinimizerFcn.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ bool RooAbsMinimizerFcn::SetPdfParamVal(int index, double value) const
234234
if (cfg().verbose)
235235
std::cout << par.GetName() << "=" << value << ", ";
236236

237-
par.setVal(value);
237+
par.setValFast(value);
238238
return true;
239239
}
240240

0 commit comments

Comments
 (0)