Plotnllon in 5.26+

RooAbsPdf’s plotNLLon seems to have disappeared in 5.26…
What is an alternative?

I have a RooSumPdf
I fit this to data using fitTo and now I want to plot:
-likelihood profile as a function of a given fit parameter - while minimizing all other parameters.
-likelihood sahpe as a function of a given fit parameter while the other parameters stay at the central value.
-two or three (1,2,3 sigma) likelihood contours in 2-parameter plane.
These seem like standard things to do yet I can’t seem to find how to do this in the manual or class refrerence.
How do I do these things?

Something potentially useful:
plotNLLon that googling suggests seems not to exist anymore in root 5.26

quick help appreciated…



The method plotNllOn() was removed because it was a bit of a kludge from
the very old days of RooFit in which likelihoods were not yet represented as
their own function objects.

How you can do the following

RooAbsReal* nll = pdf->createNLL(data,...) ; 

The createNLL function takes the same arguments as fitTo() [ modulo the ones that control
the minimizationprocess ]

Then you can simply plot the nll on a frame in a parameter

RooPlot* frame = param.frame() ;
nll->plotOn(frame) ;

This will make the plot where you keep all parameters constant except the one you plot.
To make the profile likelihood plot where you minimize w.r.t. all non-plotted parameters
is a small variation

RooAbsReal* pll = nll->createProfile(plotParam) ;
pll->plotOn(frame) ;

Note that plotting profile likelihoods can be slow as it is computationally intensive. You can speed it
up by adding a NumCPU(n) argument to the createNLL() call [ if you have a multi-core CPU ]. Also
you can speed it up by requesting less plot precision. If you add Precision(1) to the plotOn() call
the function will be sample exactly nbins*2 times and no adaptive recursion is done. Note than nbins
by default is 100, so you would have to set that to something smaller when you make the plot frame
(e.g. param->frame(pmin,pmax,nbins))