Skip to content

Commit

Permalink
[mathcore] Fix creating the ParameterSetting when calling SetFCN
Browse files Browse the repository at this point in the history
This fixes using the fit2dHist.C when using the global fit (user defined FCN)

This PR fixes root-project#13906
  • Loading branch information
lmoneta committed Oct 24, 2023
1 parent 92540cb commit 78fbd71
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions math/mathcore/src/Fitter.cxx
Expand Up @@ -144,7 +144,7 @@ bool Fitter::DoSetFCN(bool extFcn, const ROOT::Math::IMultiGenFunction & fcn, co
MATH_ERROR_MSG("Fitter::SetFCN","FCN function has zero parameters ");
return false;
}
if (params != nullptr )
if (params != nullptr || fConfig.ParamsSettings().size() == 0)
fConfig.SetParamsSettings(npar, params);
else {
if ( fConfig.ParamsSettings().size() != npar) {
Expand Down Expand Up @@ -244,7 +244,7 @@ bool Fitter::FitFCN(const ROOT::Math::FitMethodGradFunction &fcn, const double *
bool Fitter::SetFCN(MinuitFCN_t fcn, int npar, const double *params, unsigned int dataSize, bool chi2fit)
{
// set TMinuit style FCN type (global function pointer)
// create corresponfing objective function from that function
// create corresponding objective function from that function

if (npar == 0) {
npar = fConfig.ParamsSettings().size();
Expand Down

0 comments on commit 78fbd71

Please sign in to comment.