Minuit: Scan a function and get the graph of the variable

Hello,
I have a compiled root macro that has to minimize a function using minuit. One parameter gives me problems, it takes on values that physically make no sense. The suggested procedure in the Minuit manual is that I fix this parameter at a reasonable value, minimize the function with respect to the other parameters, release the fixed parameter and minimize again. That doesn’t work.
As a second step it is suggested that I scan the problematic parameter. It should be possible to get a graph of the function in the scanned area. Here lies my problem: the graph I get doesn’t seem to contain anything.
Below is the relevant code - is there anything obvious that I have missed?
Thanks a lot,
Kilian

// root file that shall store the graph:
TFile *f = new TFile(“MinuitGraph.root”,“RECREATE”);

// get the data:
TChain chain = new TChain(“TB/tree”);
chain->Add("…/RecExTB_2102096_TB04-XTC-01-fix_PED=TB04-RndTrig-2.20000events.
.root");

// some processing of the data … not important for my problem I think
rec_data_tree test(chain);
fcn_nentries = test.Loop(ECluster, EClusterPr, EClusterSt, EClusterMi, EClusterBa);

// initialize minuit and set parameters:
TMinuit *gMinuit = new TMinuit(3);
gMinuit->SetFCN(fcn);
Double_t arglist[10];
Int_t ierflg = 0;
arglist[0] = 1;
gMinuit->mnexcm(“SET ERR”, arglist ,1,ierflg);
Double_t vstart[3] = {1., 10., 1.};
Double_t step[3] = {0.01, 0.01, 0.01};
gMinuit->mnparm(0, “lambda”, vstart[0], step[0],0,0,ierflg);
gMinuit->mnparm(1, “a”, vstart[1], step[1], 0,0,ierflg);
gMinuit->mnparm(2, “b”, vstart[2], step[2], 0,0,ierflg);
arglist[0] = 500.;
arglist[1] = 1.;

// fix parameter 1 and run the minimazation:
gMinuit->FixParameter(1);
gMinuit->mnexcm(“MIGRAD”, arglist, 2, ierflg);

// release the parameter again and scan it:
gMinuit->Release(1);
gMinuit->Command(“SCAn 2 90 0 1000”);

// get the graph and write it to the root file:
TGraph gr = (TGraph)gMinuit->GetPlot();
gr->Write();

// print out minuit stuff:
Double_t amin,edm,errdef;
Int_t nvpar,nparx,icstat;
gMinuit->mnstat(amin,edm,errdef,nvpar,nparx,icstat);
gMinuit->mnprin(3,amin);

f->Close();[/img]

I cannot reproduce your problem.
Are you sure the graph is empty ? Have you tried to do gr->Dump() before writing it to the file ?
In the case the graph is really empty, please send me the full code as attachment so I can reproduce it.

Best Regards

Lorenzo