TMinuit -> Contour

I am trying to make a contour plot using TMinuit. After the function minimization.
where gMinuit is my TMinuit object, and par1 and par2 are the parameters for which I draw the contour plot. However, I always get at most 4 points in the contour plot , with the warning:

MINUIT WARNING IN MNContour ============== Cannot find midpoint, try closer. Warning in TMinuit::Contour: Returning a TGraph with 4 points only

What should I do to get a reasonable number of points?

Thank you

Hi,

For finding a contour point a minimisation in the N-2 parameters is performed. For some reason
these minimisations fail. One would need tp see the full log, that you should be able to obtain by increasing the Print level, to understand the reason.
It could be a numerical issue with the function to minimise, so a more numerically robust evaluation could fix the problem

Lorenzo

1 Like

TCanvas*c=new TCanvas(β€œc”,"",600,600);

[TMinuit](https://root.cern.ch/root/html/TMinuit.html) *[gMinuit](https://root.cern.ch/root/html/TMinuit.html) = new [TMinuit](https://root.cern.ch/root/html/TMinuit.html)
   (5); [Double_t](https://root.cern.ch/root/html/ListOfTypes.html#Double_t) arglist[10];
[Int_t](https://root.cern.ch/root/html/ListOfTypes.html#Int_t) ierflg = 0;
arglist[0] = 1;

 [gMinuit](https://root.cern.ch/root/html/TMinuit.html)->[mnexcm](https://root.cern.ch/root/html/TMinuit.html#TMinuit:mnexcm)("SET ERR", arglist ,1,ierflg);

gMinuit->SetFCN
(fcn);
gMinuit->mnparm (0, β€œa1”, vstart[0], step[0], 0,0,ierflg);
gMinuit->mnparm (1, β€œa2”, vstart[1], step[1], 0,0,ierflg);
arglist[0] = 500;
arglist[1] = 1.;
gMinuit->mnexcm(β€œMIGRAD”, arglist ,2,ierflg);

gMinuit->SetErrorDef(4);
TGraph gr1 = (TGraph)gMinuit->Contour(80,0,1);
gr1->Draw();
gMinuit->SetErrorDe(1);

gr1->Draw();
}

Warning in TMinuit::Contour: Cannot find more than 4 points, no TGraph returned
How can I manage to draw the right contour in this case?
Thanks in advance!

Here follows part of my code:

void fit(){TGraph gr2 = (TGraph)gMinuit->Contour(80,0,1);

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.