Re: Fit Statistics

From: Alexey Toptygin (alexeyt@mind.umd.edu)
Date: Mon Jan 17 2000 - 16:06:57 MET


The fit range is actually narrower for the second plot, and the second
plot is a better fit. I verified this visually several times. 
Also, the fit parameters root prints in the interactive console are
diffirent(and better). My only problem is that the parameters do not get
updated in the canvas.
( BTW, can->Update() does not solve the problem.)
				Alexey

P.S. Why did you think that my hist only has a few entries? it has over
6000.

On Fri, 14 Jan 2000, Rene Brun wrote:

> Hi Alexey,
> What you do below is correct. If an histogram has multiple associated
> fitted functions, you get a pointer to one function via
>    hist->GetFunction(functionName);
> 
> You have likely a different problem in your example.
> You use the results of the first fit to set the range of the second fit.
> By default, the first function is fitted using the histogram range.
> The range of the second function is likely larger than the original
> histogram. In this case, the parameters of the first and second fit will
> be identical.
> In your example you are fitting with a gaussian an histogram with a few
> entries only. You should request the "log likelihood method" instead of
> the
> default "chisquare" method using the fitting option "l".
>  hist->Fit("gaus","l");
>  hist->Fit("limited","lR0+");
> 
> Rene Brun
> 
> Alexey Toptygin wrote:
> > 
> > Hi,
> > If you create a histogram with 2 or more functions, how do you get the fit
> > statistics to correspond to a particular function?
> > For Example, I do:
> > 
> > TFile file("Science.root");
> > gStyle->SetOptStat(1110);
> > gStyle->SetOptFit(73);
> > TCanvas *can;
> > TH1F *hist;
> > TF1 *fn,*lim;
> > Double_t parm[3];
> > Float_t width = 1.5;
> > 
> > can = new TCanvas("canvas","Canvas",700,500);
> > bgoir.Draw("val01","val01>10&&val01<99&&lay==0&&cry==15");
> > hist = (TH1F*)can->GetPrimitive("htemp");
> > hist->Fit("gaus");
> > fn = hist->GetFunction("gaus");
> > fn->GetParameters(parm);
> > lim = new TF1("limited","gaus",parm[1]-width*parm[2],parm[1]+width*parm[2]);
> > hist->Fit("limited","R0+");
> > 
> > I get the stats for gaus, and I want to see the fit parameters for
> > limited, not gaus?
> >                                 Thanks
> >                                 Alexey
> 



This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:17 MET