[color=#FF4000]See Updates below: Contour question solved, Scan() still trouble.[/color]

Hello,

I seek to minimize a chi squared function over two physical parameters and several systematics. When I plot the 2D contour of both physical parameters, and the 1D scans of each alone, I see that the N-2 remaining minimization parameters are not re-minimized. That is, they are held static, and just the two parameters in question are ‘live’. How do I instruct the code to re-minimize the N-2 parameters? I use the members Contour(unsigned int i, unsigned int j, unsigned int& npoints, double* xi, double* xj) and Scan(unsigned int i, unsigned int& nstep, double* x, double* y, double xmin = 0, double xmax = 0). It seems I should be using the MNContour method, but that is not a member of Minuit2. The code is below.

Thanks!

[code] ROOT::Minuit2::Minuit2Minimizer min ( ROOT::Minuit2::kMigrad );

min.SetMaxFunctionCalls(1000000);

min.SetMaxIterations(100000);

min.SetTolerance(1e-5);

ROOT::Math::Functor f(&Chi2, Npulls+2);

min.SetFunction(f);

const double npstep = 1e-6; // stepsize of nuissance parameters

Int_t mindex = 0; // because renumbering sucks

min.SetVariable(mindex, “systematic #1”, 0.001, npstep); mindex++; //guesses based on test th13=0 < real th13

. . .

min.SetVariable(mindex, “systematic #43”, -0.001, npstep); mindex++;

min.SetLimitedVariable(mindex, “phys param 1”, 0.100, 1e-4, 0.00, 1.00); mindex++; //

min.SetLimitedVariable(mindex, “phys param 2”, 0.000, 1e-6, -1.0, 2.00); mindex++;

min.Minimize();

const double *xs = min.X();

unsigned int Npts = 40;

long int param0 = Npulls+0; //phys param 1

long int param1 = Npulls+1; //phys param 2

//plot 1D scans:

double xarr[Npts], chiarr[Npts];

min.Scan(param0, Npts, xarr, chiarr, 0, 0.20);

TGraph *g = new TGraph(Npts, xarr, chiarr);

TCanvas *C = new TCanvas(“C”, “C”, 600, 450);

C->cd(); g->Draw(“ca”);

```
//plot 2D contour(s)
min.SetErrorDef(1);
double param0arr[Npts], param1arr[Npts];
min.Contour(param0, param1, Npts, ¶m0arr[0], ¶m1arr[0]);
double sig1Xarr[Npts], sig1Yarr[Npts];
TGraph *cont1sig = new TGraph(Npts, sig1Xarr, sig1Yarr);
cont1sig->SetLineStyle(2);
```

[/code]