Fitting 3D points with a 3D line


I would like to know if there is already something implemented in ROOT to fit a 3D line to a distribution of 3D points. (I am using ROOT 5.14.00). Thank you in advance for any help.




to fit points to a 3D line, you need to minimize the distance between the points and the line using Minuit. There is nothing existing directly in ROOT, but it is quite easy to implement.
Attached you find an example. If you are interested in the errors you have probably to be careful in calculating correctly the error on the distance, given the errors on the points

Best Regards

line3Dfit.C (4.17 KB)