Re: [ROOT] Can I fit a gaussian on to a ntuple plot... how?

From: Rene Brun (Rene.Brun@cern.ch)
Date: Fri Apr 12 2002 - 22:11:23 MEST


Hi Shiva,

OK, run $ROOTSYS/tutorials/cernstaff.C. You get the file cernstaff.root.
Now in a Root session, do:

 TFile f("cernstaff.root");
 T.SetFillColor(38);
 T.Fit("gaus","Age>>hAge","Grade>10","","bar2")

Rene Brun


On Fri, 12 Apr 2002, Siva Subramania wrote:

> Dear Rene,
> I used the same thing before giving the mail also, actually, when I 
> use ntuple.Fit("gaus","area"); I am getting a table of values of the 
> mean, sigma, error, step size, first derivative, and so on.  But 
> nothing is plotted on the graph ie over the ntuple. I also have given 
> ntuple.SetOptFit(1111), still, nothing is displayed about the 
> probability, Chi2 and others on the Legend.  So what to do now? I 
> tried a lot of things, but couldn't figure out. Still trying. Can you 
> do me a favor, try to give a solution based on the the TNtuple Example 
> script or the TTree Example given in the documentation. You have 
> plotted an ntuple graph, plotting the age distribution in the same 
> chapter on Trees, try to tell me, how would you now fit a gaussian 
> distribution to the age distribution shown. Please.... reply.
> Thanx,
> Yours,
> Shiva.
> 
> On Thu, 11 Apr 2002, Rene Brun wrote:
> 
> > Hi Shiva,
> > 
> > See TTree::Fit
> > 
> > example:
> >    ntuple.Fit("gaus","px")
> > 
> > Rene Brun
> > 
> > On Thu, 11 Apr 2002, Siva Subramania wrote:
> > 
> > > Hi,
> > > I am new to using ntuples, I managed to understand about ntuples, and I 
> > > think, they are nearly the same as histograms, so if I can fit a gaussian 
> > > on to a histogram, I should be able to - on an ntuple also, but
> > > I am having trouble with fitting a gaussian function on to a ntuple plot. 
> > > Can I do it or not? If I can, then how to?  Please reply.
> > > Thanx,
> > > Yours,
> > > Shiva.
> > > 
> > 
> > 
> 



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