Dear All,
I have saved some data-sets in a tree. For each entry, there is an array of X and Y variables, which I save in a TGraph and then fit this graph by a linear function. Please note that all the numbers of the X and Y values are integer. For each fit, I am accumulating the fitted parameters in another TTree. At the end, I see the distribution of the chi2/ndf is peaked at 0.1 rather than 1. So the fits are understimated. So can any body tell me how to fix this type of problem? Thanks in advance.
Which error are you using for each point ? If you are fitting TGraph you don;t have an error associated to the point, i.e. a default error of one is assumed, so looking at the value of Chi2/ndf does not make much sense, apart if the error in each point is really 1.
Hello Lorenzo,
Thank you very much for your kind response. Yes, I have used TGraph to draw the data points. As I mesnitioned in my previous mail that all the events of the X and Y values are integers. So I have also tried to fit the graphs using the TGraphErrors class, where I have put Xerror = 1/\sqrt(12) and Yerror = 1/\sqrt(12) (i.e. standard error = 1/\sqrt(12)). But this method does not work for my case. Around 90% of the times, the linear function fails to fit the data.
However, the chi2/ndf distribution peaks at 1 position if I keep Yerror = 1/\sqrt(12) and Xerror = 0 for all the events in a TTree. So now the question arises, why the linear function and chi2/ndf are highly dependent upon the value of Xerror? Can I keep Xerror value = 0 in my code for all the events? Or I have keep its value something else. I am trying to analyze the data of a prototype detector, which consists of 12 layers of 1 \times 1 m^2 resistive plate chamber (RPC). Each RPC has 32 strips of X and Y planes.