Re: [ROOT] fitting ntuple plots

From: Rene Brun (Rene.Brun@cern.ch)
Date: Fri Nov 08 2002 - 12:48:52 MET


Hi Vic,

>From what you describe, it is my impression that you should simply
create a TGraph objects with N points X[i], Y[i] and call TGraph::Fit
with a 1-d function.

You can construct a TGraph automatically by giving a file name containing
your list of points X,Y
example
  TGraph g("file.dat")
  g.Fit("pol4");

Rene Brun


On Thu, 7 Nov 2002, Vic Gehman wrote:

> I'm trying to plot a two-column data file in root.  I've read it into
> root as an ntuple.  Now it seems that when I directly plot the ntuple
> (i.e. using "ntuple_name->Draw()") that root creates a scatter plot of the
> data by making it a 2D histogram, and plotting that.  I'm trying to do a
> fit to this data (root's nice fitting routines are why I'm doing this in
> the first place), and I can't use any of the predefined functions since
> they are all 1D functions (and therefore only capable of fitting 1D
> histograms).  I am also not certain that defining my own function of two
> variables is the right way to do this since I'm not really trying to fit a
> surface.
> Can anyone help with this?  I can't be the only one who has tried to do
> this...
> 
> Thanks,
> 
> Vic Gehman
> 



This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:51:16 MET