Scan in TMinit

Hi,

I am trying to use the scan function of TMinuit, and I am not being very successful so far…

AFTER doing the minimization (after having called migrad)
I am trying this code:

gMinuit->SetGraphicsMode(kTRUE);
gMinuit->mncomd(“scan 0”,ierflag);
TGraph gr = (TGraph)gMinuit->GetPlot();
gr->Draw(“al”);

But the canvas plotted is empty…
Also in the help I have read that this command can be use before the minimization to
scan the value of fcn versus a given parameter to get a feeling on what is the right starting value for the minimization. How can I do this? If I could get an example that would be great!!

Thanks

Berta

TMinuit::mnscan is documented as follows

root [0] gMinuit.mnhelp("SCAN") ***>SCAn [parno] [numpts] [from] [to] Scans the value of the user function by varying parameter number [parno], leaving all other parameters fixed at the current value. If [parno] is not specified, all variable parameters are scanned in sequence. The number of points [numpts] in the scan is 40 by default, and cannot exceed 100. The range of the scan is by default 2 standard deviations on each side of the current best value, but can be specified as from [from] to [to]. After each scan, if a new minimum is found, the best parameter values are retained as start values for future scans or minimizations. The curve resulting from each scan is plotted on the output unit in order to show the approximate behaviour of the function. This command is not intended for minimization, but is sometimes useful for debugging the user function or finding a reasonable starting point.

A better alternative to SCAN is to use the FitPanel and use the slider to change a parameter and visualize the corresponding function in real time.

Rene

[quote=“brun”]TMinuit::mnscan is documented as follows
After each scan, if a new minimum is found, the best parameter
values are retained as start values for future scans or
minimizations. The curve resulting from each scan is plotted
on the output unit in order to show the approximate behaviour
of the function.
/code]

A better alternative to SCAN is to use the FitPanel and use the slider to change a parameter and visualize the corresponding function in real time.

Rene[/quote]

Hi Rene,

Thanks for your reply but still I have some remarks :
I am running my program as a compiled C++ code and not as a macro in the CINT, so there is no output coming out of the screen but I have to save all the graphs in a file instead.
This is why I was trying to use the code that I copied in my first post, but it doesn’t show anything, so I must be doing something wrong. Any help would be highly appreciated.

Hi,
normally what you are doing should work (at least it does for me).
You should maybe do

gMinuit->mncomd(“scan 1”,ierflg);

if you want to scan parameter 1. “scan 0” scans all the parameters, but then you should get the plot of only the last one.
If you still have problems, please send me your macro and tell me the ROOT version you are using,

Best Regards

Lorenzo