Simultaneous fitting of graphs taking into account both x and y errors

I’m looking for the way to fit the several graphs (TGraphErrors) simultaneously taking into account both x and y axis errors.
I found the good script to do simultaneous fit of two histograms. (combinedFit.C)

Dose the way in this script take into account both x and y axis errors when the fitting is done for graphs (TGraphErrors) instead of histograms ?
If not, how can I do simultaneous fitting taking into account both x and y axis errors other than to define the equation for minimization (e.g. calculation of chi square) in the FCN of MINUIT, which would be quite complicated to treat both x and y axis errors ?

TMultiGraph Class Reference → MultiGraphs’ fitting

Dear Wile_E_Coyote,

Thank you so much for your reply.
I’m sorry I didn’t make it clear enough.
I want to fit several separate graphs (not multigraph) by using same fitting function (e.g. gaussian).
Some of fitting parameters (e.g. sigma) are common for all graphs and others (e.g. amplitude, mean) should be determined to reproduce each plots.

I found similar questions in the forum but those hasn’t been solved yet.

I think one of the solution is to plot all graphs on different x ranges in one graph and do fitting when the definition of x and y axis are same for all graphs.
I will try it.

Attached below is a ROOT macro that performs a combined (simultaneous) fit of two TGraphAsymmErrors with separate functions and some common parameters.
I think we need @moneta to (dis?)confirm that the asymmetric errors in “X” and “Y” are correctly taken into account when fitting.
It is a modified version of the “${ROOTSYS}/tutorials/fit/combinedFit.C” macro (by @moneta), which fits two histograms.

combinedFitTGraphAsymmErrors.cxx (5.5 KB)

1 Like

Thank you for sharing the macro.
I will test that macro and share the results later.

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