ROOT Version: 6.30/02
Platform: Ubuntu 20.04.6 LTS
Compiler: gcc 12.3.0
Hello; I am trying to fit a flat pdf using RooFit, f(x) = b. I would like to recover the value b with an uncertainty, so instead of using RooUniform I am using a RooGenericPdf, that I manually normalize. I have tried both an extended ML, and a non extended ML, and I’m using the fitTo function to make sure I’m fitting the log likelihood rather than a chi2. However, when I perform this fit I get the error message:
Minuit2Minimizer: Minimize with max-calls 1000 convergence for edm < 1 strategy 2
Warning in <Minuit2>: MnHesse 2nd derivative zero for parameter b ; MnHesse fails and will return diagonal matrix
Warning in <Minuit2>: MnHesse 2nd derivative zero for parameter b ; MnHesse fails and will return diagonal matrix
Warning in <Minuit2>: VariableMetricBuilder Invalid Hessian - exit the minimization
Warning in <Minuit2>: Minuit2Minimizer::Minimize Minimization did NOT converge, Hesse is not valid
Minuit2Minimizer : Invalid Minimum - status = 2
FVAL = 1072.61
Edm = 5.92343e-08
Nfcn = 49
Warning in <Minuit2>: MnHesse 2nd derivative zero for parameter b ; MnHesse fails and will return diagonal matrix
Warning in <Minuit2>: Minuit2Minimizer::Hesse Hesse failed - matrix is full but not positive defined
Warning in <Minuit2>: Minuit2Minimizer::Hesse 3
Warning in <ROOT::Math::Fitter::CalculateHessErrors>: Error when calculating Hessian
I don’t understand why the error message says the second derivative of b is 0, as manually calculating the hessian error I would expect b/\sqrt(n_{bins}) because it should be fitting the log likelihood, not just the likelihood. When I perform this fit without RooFit, with just a TF1 function, the fit works and returns Hessian and Minos errors (though the returned error is smaller than what I would expect from b/\sqrt(n_{bins}), which I would also be interested in help understanding, but it does seem to minimize the function at least). Is there a reason that RooFit isn’t doing this hessian calculation?
The code I’m using follows below:
// initialize fit parameter seeds
double maxHist = hist->GetMaximum();
double minHist = hist->GetMinimum();
double GuessBinCont = hist->GetBinContent(0);
RooWorkspace *w = new RooWorkspace("w", kTRUE);
RooRealVar time("time", "time (days)", 0, 1794);
RooDataHist* data = new RooDataHist("data", "data", RooArgSet(time), Import(*hist));
RooRealVar b("b", "b", GuessBinCont, minHist, maxHist);
RooRealVar N("N", "N", 54750, 100, 100000);
RooGenericPdf sigpdf("sigpdf", "sigpdf", "b", RooArgList(b));
RooAbsReal *pdfint = sigpdf.createIntegral(time);
double norm = pdfint->getVal();
RooFormulaVar normform("normform", "normform", "(@0)/@1", RooArgList(sigpdf, *pdfint));
RooGenericPdf normpdf("normpdf", "normpdf", "normform", RooArgList(normform));
RooExtendPdf extendedPdf("extendedPdf", "extendedPdf", normpdf, N);
w->import(b);
w->import(time);
w->import(N);
w->import(extendedPdf);
RooFitResult *result = extendedPdf.fitTo(*data, Strategy(2), Extended(true), Verbose(false), PrintLevel(0), Hesse(true), Save(true));
The data in “hist” is filled with randomly generated numbers from a poisson distribution that I set the mean = 30, just as a test.
Thank you for any help!
Respectfully,
Becky