Get value of log-likelihood fit for all values of fit param?

I have a data-sample that I’m trying to fit with a user defined function. I use log-likelihood fit via the “L” option.

My function depends on x (ofcourse) and one fitting parameter called Lambda. When using my fit-function (based on root.cern.ch/root/html/examples/myfit.C.html) I get my Lambda, which is nice. But what I would like is to get the log-likelihood-value for each Lambda it tries to fit, store this in an ntuple and plot Lambda vs. -Delta-Log-Likelihood. Can this be done?

I have searched the archieves and only found references on how to obtain the log-likelihood-value for the fitted Lambda, but not for the series of Lambdas that it uses during the fitting procedure.

What about a brute force attempt?

foreach lambda in a reasonable range around your fit value {

  1. fix the parameter lambda with the ParLimits() method
    
  2. do the fit using the "L" option
    
  3. obtain the  log-likelihood value for lambda
    

}

[quote=“joern”]What about a brute force attempt?

foreach lambda in a reasonable range around your fit value {

  1. fix the parameter lambda with the ParLimits() method
    
  2. do the fit using the "L" option
    
  3. obtain the  log-likelihood value for lambda
    

}[/quote]

Simple and to the point. This sounds like a good solution. Thank you!
(And why didn’t I think of that? :laughing: )