Fitting line in 3D with error on the points

Dear Root Experts, I would like to fit a line in 3D, therefore I search the examples in root using minimizer options. There is an existing example to fit with the line given on the link below.
https://root.cern/doc/v610/line3Dfit_8C_source.html
The example fits the graph but without errors, is there any way to include the uncertainty on the points in the fitting basically using TGraphErrors? It will be very helpful for me.

Thank You in Advance
Shyam

The latest version of this example is: ROOT: tutorials/fit/line3Dfit.C File Reference
@moneta can give you more details.

1 Like

Hi,
If you have errors in both x, y and z you can use th TGraph2DError class and then you will have to modify the least square function to take into account the distance error, that you need to compute from the error on the points.

Note that if you have error only on z and not x and y and your points are distributed in a grid,
you can use the TH2D class to represent your points and use also the direct functionality of TH2::Fit using a TF1 to represent the 1D function (line).

Lorenzo

1 Like

@couet @moneta Thank you for the reply, I will use standard error propagation as suggested by evaluating the formula.

Regards
Shyam

Hi,

I am using the latest version of line3Dfit example (above-mentioned link), and trying to extract the residuals (=measured data - predicted data). Is this something feasible to obtain in a 3D line fit ? I am using this procedure for Track based alignment studies.

Thank You in Advance,
Loyd

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