I have a question regarding directly accessing the likelihood function in RooFit. I currently have my p.d.fs as RooHistPdf objects and I then use this to fit to some binned dataset. Just for sanity check and out of curiosity, I want to manually fix the values of my parameters and see what value of the likelihood comes out. For example, I want to fix par_1= x and par_2 =y and see what value of FCN I get. In this case, no fitting is being done and is therefore independent of the actual dataset I end up fitting to. Is there a way to do this? Thanks!
Hi! You are currently fitting with RooAbsPdf::fitTo(), right?
You can create the negative log-likelihood function in a similar way with RooAbsPdf::createNLL().
This will return you a
RooAbsReal* for the NLL. For your sanity check, you need to set the values of all parameters manually with
setVal(), and then you can evaluate the NLL with
Please let me know if this works for you and if you have further questions!
Hi! Sorry for the slow reply. Yes, I am currently fitting with RooAbsPdf::fitTo(). So you are saying I should do something like this:
RooAbsReal *nll = abspdf->createNLL();
double c = nll->getVal()
Is this what you meant? Thanks!
Yep, exactly! If you used to pass some arguments to
fitTo(), you can also pass the same arguments to
createNLL() by the way.
Just came back to say that it worked like a charm! Thank you!
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.