Hello, I have been attempting to fit a histogram using another histogram which represents a probability distribution. My fit function is of the form fitval = std::round(par[0] * dist->Interpolate(x[0])); . Whenever I try to fit using this function I run into an invalid fit status error, in particular I have been running into the status = 3 error recently, which, from what I understand, means the EDM is above maximum. So far, I have tried adding more bins to my probability distribution and smoothing the histogram, but I am still running into errors. Does anyone know how to fix this? I am guessing this has something to do with my fit function not having a well defined derivative.
Thanks
Hi @aclarke,
Welcome to the ROOT Forum.
Let me add our RooFit expert @jonas in the loop. In the meantime, it would be helpful if you can add snippets of the code you are trying to run and the error messages you are seeing.
Cheers,
Dev
Hello,
Here is an example of the error messages I’m seeing:
Invalid FitResult (status = 3 )
Minimizer is Minuit2 / Migrad
MinFCN = 15078.8
Chi2 = 30157.6
NDf = 999
Edm = 0.0094626
NCalls = 78
p0 = 36.4999 +/- 0.019146
Warning in : Abnormal termination of minimization.
Here is the relevant code:
Double_t fitfunc2(Double_t *x, Double_t * par)
{
Double_t fitval = 0;
fitval = std::round(par[0] * dist->Interpolate(x[0]));
return fitval;
}
while (ti!=l1.end())
{
auto tj = ti;
//tj++; //tj starts as ti+1
delete temphist;
temphist = new TH1D(“dist”, “Photon Cluster Time Distribution; time(ns); Counts”, 1000, 0, 6e-6);
//photons->Fill((*tj).realtime-(*ti).realtime);
while (((*tj).realtime - (*ti).realtime) < 6e-6)
{
temphist->Fill((*tj).realtime - (*ti).realtime);
tj++;
}
if(temphist->GetEntries() >= 10)
{
func->SetParameters(temphist->GetEntries());
temphist->Fit(“fitfunc2”, “LI”);
}…
dist is also a TH1D.