Problem with embed TFitEditor

Hi rooters,
I added in my gui a TFitEditor panel, in this way the user can have a sort of interactive fitter.
I embedded the fitpanel in my gui in the following way

 vFrameTab3_2b->SetEditable(kTRUE);
 new TFitEditor(NULL,NULL);
 vFrameTab3_2b->SetEditable(kFALSE);

where vFrameTab3_2b is a TGCompositeFrame.

But when I run the code everything I have the following error

 Error in <TList::AddLast>: argument is a null pointer

Any suggestion?

Cheers
mmoo

Hi,

I see the same message, but the Fit Editor is correctly embedded, right?

Cheers, Bertrand.

Yes, graphically speaking it seems perfect.

Concerning the error, I am not an expert but may it be related to the fact that I launch my TFitEditor with neither an object to fit nor a function to perform such fit.

Moreover, I have no idea how to retrieve informations after the fit has been performed: since I did not build the TFitEditor, I have no Fit-button to connect to some method.

Cheers,
mmoo

correct

Well, I’m not the author of the editor, but I think you’re using it the wrong way. It should be connected to a TCanvas in order to automatically get connected to its histogram…

correct

But can I leave it this way?

Well, I’m not the author of the editor, but I think you’re using it the wrong way. It should be connected to a TCanvas in order to automatically get connected to its histogram…

Maybe I did not explained myself correctly…
I can connect the TFitEditor to the object I want to fit by clicking on it.
The one thing I am interested in and which I cannot get (up to now) is retrieving the fitted information such as the fitted function.
I tried to use the TFItEditor::GetListOfFittedFunctions()->Print() but such command is called when I launch my gui and because of no fit has been performed yet no function is listed.
What I would like to do is to connect the Fit-button to a function so that I can call these methods after the fit has been performed.

Probably, if it works…

I’ll have to investigate…

Is there any news? Thanks in advance!

Sorry, I’m away this week, but maybe @moneta can help you…

For getting the functions, you can use

gROOT->GetListOfFunctions()

I think this is what the fit panel uses

Lorenzo

Hi Lorenzo,

that command gives the list of the predefined functions of ROOT.
Anyway, it could be useful in the future for me but right now I am looking for something that allow me to know whether the fit has been performed or not.
More precisely, I would like to produce a residual graph, but only after the fit has been executed.

Thanks in advance for the help!!

Cheers,
mmoo

Hi,

You would need in this case to have access to the object that has been fit (e.g histogram or graph).

Lorenzo

Actually I have access to the graph that has been fitted.
I wanted to plot the residual graph only when it makes sense, i.e. when the fit has been performed.
Do you have any suggestion?

HI,

From the TGraph you can get the fitted function using TGraph::GetFunction(name) or TGraph::GetListOfFunctions() if you don’t know the name.
The function contains information about the fit, such as the chi2-square. If it is not zero, a fit has been performed.
Although you cannot really know if the fit was successful. The return status from the fitter is saved only in the FitResult class.

Lorenzo

Thanks a lot: it worked perfectly!
Concerning the TFitEditor I have another problem: is it possible to change the dimensions of the TFitEditor embedded into my frame in my gui?

Thanks in advance!

Cheers,
mmoo

Hi,

if you embed it in a TGCompositeFrame using the kLHintsExpandY | kLHintsExpandX flags in your layout hints, then it will fit the composite frame size.

Cheers, Bertrand.

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