I am having a series of data from a pixel detector, and I plot the ADC values of each pixel and know I want to calculate the slope and y-intercept of each pixels using root, will any one help me doing the fit to the line and calculating slope and y-intercept using root?
You can use a TGraph (or TGraphErrors if you have errors for each point) and then do a line fit.
If x[n] and y[n] are your data points you can do:
TGraph * g = new TGraph(n,x,y);
See also several examples for fitting graphs and histograms in root.cern.ch/root/html/tutorials/fit/index.html
Thanks a lot,
Will you tell me how can I put the stat box on my canvas or graph, which consist of both the parameter i.e. p0 and p1 for a line?