Please read tips for efficient and successful posting and posting code
ROOT Version: Not Provided
Platform: Not Provided
Compiler: Not Provided
Hi, I have been using frequently the Fit function in general, but mostly with 1D histograms. I usually set the option āSā, to get the fit return to a TFitResultPtr object, from where I can get the parameters.
Now I am trying to do the same with a 2D histogram but seems the syntaxis is not the same as for 1D.
for 1D I do:
TH1D* h1;
TFitResultPtr fitPtr = h1->Fit("myF","SNQ","",x0,x1);
How do I do something equivalent??
I tried:
TH2D* h2;
TFitResultPtr fitPtr = h2->Fit("xygaus","SNQ","",x0,x1,y0,y1);
TH2D* h2;
TFitResultPtr fitPtr = h2->Fit("xygaus","SNQ");
and others, but none seems to be correct.
I got the fit working by simply writing:
TH2D* h2;
TFitResultPtr fitPtr = h2->Fit("xygaus");
but I do not know how to retrieve the results in the code. I do this fit repeatedly, and dealing with the console output is tedious.
Help pls.
Thanks in advance