# Plotted Likelihood distribution from MINOS?

Hi,

is there a way to get the likelihood distribution for a parameter directly plotted?
~~> i.e. getting for the MINOS variations for one parameter the resulting likelihood changes as a plot.

Cheers & Thanks,
Thomas

Hi,

you can get this using the SCAN functionality. For example if you are fitting using the fit panel GUI you can get this from the advanced drawing options.

Otherwise you can call SCAN on TMinuit or using the ROOT::Math::Minimizer::Scan method

Best Regards

Lorenzo

Hi Lorenzo,

many thanks – I will give it a try

Sorry for a probably another dumb question…:

• In a simple GUI-fit I got the plot of the SCAN.

• Using Minuit I also was able to scan my parameter for my fit result, i.e. for example scanning my second parameter in my fit

``` Int_t iPar_NoBG = 1; arglist[0] = iPar_NoBG; gMinuit->mnexcm("SCAN", arglist ,1,ierflg);```
but how do I get here a plotted result of the SCAN?

• I tried the template call but I did not understand its syntax properly:
If I want to scan my second parameter in 50 steps (40 steps is default in MINUIT’s SCAN routine) I guess I would have to call something like

``` Int_t iPar_NoBG = 1; Int_t iNoSteps = 50; Double_t dXMin = 0.; /* assume that for min/max==0 MINUIT's standard value of 2 standard deviations is used */ Double_t dXMax= 0.; ROOT::Math::Minimizer::Scan(iPar_NoBG,iNoSteps,*x,*y,0,0);```
But what are actually x and y pointing to?? – I guess that one would be my fit-function,or?

Maybe one has another idea for me?

Many Thanks,
Thomas

You can use a TGraph to plot the scan result as following:

``````Int_t iPar_NoBG = 1;
Int_t iNoSteps = 50;
TGraph * gr = new TGraph(iNoSteps);
ROOT::Math::Minimizer::Scan(iPar_NoBG,iNoSteps,gr->GetX(),gr->GetY());
gr->Draw("AL");``````

Best Regards

Lorenzo

Hi Lorenzo,

I still do not get it right

How do I initialize the Minimizer correctly in my case?
Since I am not using Minuit2 via Minimizer but MINUIT directly, I have to pass somehow an object to the Minimizer - but I am not certain what it actually is?!

For my fit I wrote my own FCN and minimized it with MINUIT directly:

``````  TMinuit *gMinuit = new TMinuit(iNPar);
gMinuit->SetFCN(fcnUnbinned); /* -2LL-N return to be minimized : void fcnUnbinned(Int_t &npar,double *gin, double &func, double *dPar, int iflag)*/
gMinuit->mnparm(iPar_NoBG, "NoBG",  dPar_MinuitBG[0], dPar_MinuitBG[1],dPar_MinuitBG[2] ,dPar_MinuitBG[3],  ierflg); /*  iPar_NoBG is a const Int_t with parameter's number;  dPar_MinuitBG{] contains the parameter's start value, step size and boundaries for MINUIT */
gMinuit->mnparm(iPar_...
....
gMinuit->mnexcm("SIMPLEX", arglist ,1,ierflg);
gMinuit->mnexcm("HESSE", arglist ,1,ierflg);
gMinuit->mnexcm("MINOS", arglist ,1,ierflg);
...``````

For further processing the fit results I use mnemat or mnpout etc.
So I am at the moment not sure how or if I could somehow pass the minuit object/fit to the Minimizer interface for getting the scan? Just running `gMinuit->mnexcm("SCAN", arglist ,1,ierflg);` for a parameter seems a bit pointless since I have already my minimum and are not looking for a better one – but just want to get the values for the scanned points.

Hi,

if you are using TMinuit directly then you can do what is implemented in TMinuitMinimizer::Scan

``````   arglist[0] = ipar+1;  // TMinuit starts from 1
arglist[1] = nstep+2;
gMinuit->mnexcm("SCAN",arglist,2,ierr);

// get TGraph object
TGraph * gr = dynamic_cast<TGraph *>(fMinuit->GetPlot() );

if (!gr) gr->Draw("AL");
``````

Lorenzo

Many thanks