I’ve perform a fit to data with 4 inputs parameters (MC) using TFractionFitter. After doing that, I was trying to retrieve the log likelihood as a function of one of my parameters, specifically, my signal MC. So I added the following lines:

Int_t iNoSteps = 50;
TGraph * gr = new TGraph(iNoSteps);
unsigned int par = 3 ;
TBackCompFitter fFitter = (TBackCompFitter)TVirtualFitter::GetFitter();
double xmin = 0.0;
double xmax = 1.0;
fFitter->SetErrorDef(1);
fFitter->Scan(par,gr,xmin,xmax);
TCanvas* cv0 = new TCanvas();
graph->Draw(“APL”);

But it always appear a message of segmentation fault. I’ve also tried the other command TBackCompFitter::Contour, and it also crashes. When I use other commands it works:

The TFractionFitter class does not use internally the new ROOT::Math::Fitter (and TBackCompFitter) but the old class TFitter which is based directly on TMinuit.
In that case if you want to make a scan of the likelihood or the contour you can use either gMinuit or the TMInuit instance from ((TFitter*)TVirtualFitter::GetFitter())->GetMinuit()

For the contour you can call TMinuit::Contour and for scan you can call the command “SCAN” via TMinuit::mnexcm or you can also use in this case TVirtualFitter::ExecuteCommand(“SCAN”, args, narg);

Hi Lorenzo,
thanks for your reply, but I have a question related with the plot of the log likelihood curve, I want to study this curve to perform a convolution with a Gaussian function to take into account systematics uncertainties.

During the fit procedure to data I used the following constraints:

fit->Constrain(2,0.01,0.99);
fit->Constrain(3,0.01,0.99);
fit->Constrain(4,0.0,0.99);//signal , parameter of interesr

It should work and plot a scan of the log-likelihood function. Are you sure you have used the right parameter index and parameter range ? I think in TMinuit the parameter number starts from 1.
Are you sure also that the fit converged to a minimum ?