Re: Problems with the contour using TMinuit

From: Lorenzo Moneta <Lorenzo.Moneta_at_cern.ch>
Date: Tue, 21 Feb 2012 09:32:10 +0000


Hi Michelle,

 Probably the contour fails because you are having very local minima. There is no much you can do, if your function is not too expensive to evaluate you can try to scan it in a 2d grid, (for example filling an histogram) and then get the contour from the histogram values.

 Best Regards

 Lorenzo
On Feb 20, 2012, at 10:38 PM, Michelle Medeiros wrote:

Hello ROOTers,

I'm trying to get a contour using TMinuit but I'm having some problems. If I define limits for my 2 parameters very close to their minimum, I get good errors and the contour is drawn. But this contour is squeezed by the parameter limits, regardless of the number of points:

  MINUIT WARNING IN MNContour

If I try to put the limits more far away from the minimum, having a larger range for the parameters, the errors for them are very large and I get no contour:

 MNCONT UNABLE TO FIND FOUR POINTS.
Warning in <TMinuit::Contour>: Cannot find more than 4 points, no TGraph returned

Does anyone know how can I manage to draw the right contour in this case? I must say that my FCN has several local minimums.

Thanks in advance!

Here follows part of my code:

void myFit_test_3(){

  (...) some definitions (...)

  TMinuit* minuit = new TMinuit(npar);

  Double_t arglist[10];
  Int_t ierflg = 0.;
  arglist[0] = 0.5;
  minuit->mnexcm("SET ERR", arglist ,1,ierflg);

  minuit->SetFCN(fcn);

  double par1 = 0.945414;
  double par0 = 2.6235E-3;
  Double_t step[2] = {0.0001,0.001};
  Double_t vstart[2] = {par0,par1};

  Double_t slimits[2] = {0.9,1.0};
  Double_t Dlimits[2] = {0.0015,0.003};

  minuit->mnparm(0, "Dm", vstart[0], step[0], Dlimits[0],Dlimits[1],ierflg);   minuit->mnparm(1, "sin", vstart[1], step[1],slimits[0],slimits[1],ierflg);

  arglist[0] = 500;
  arglist[1] = 1.;
  minuit->mnexcm("MIGRAD", arglist ,2,ierflg);

  minuit->GetParameter(0,Dmfit,Dmfit_err);   minuit->GetParameter(1,sfit, sfit_err);

  TH2D* conthist = new TH2D("conthist","Contours",100,smin,smax,100,Dmmin,Dmmax);   TCanvas* ccan = new TCanvas("ccan","Contour Canvas",650,650);   conthist->Draw();

  gMinuit->SetErrorDef(1);
  TGraph* interpcont1sig = (TGraph*)minuit->Contour(10,1,0);   Int_t ge = minuit->GetStatus();
  cout<<"Contour Result = "<<ge<<endl;
  interpcont1sig->Draw("ALP");
}

Cheers,
Michelle Mesquita de Medeiros. Received on Tue Feb 21 2012 - 10:32:18 CET

This archive was generated by hypermail 2.2.0 : Wed Feb 22 2012 - 17:50:01 CET