Re: getting mean and sigma from a fit

From: Faouzi Attallah (attallah@clri6a.gsi.de)
Date: Mon Jul 05 1999 - 17:32:23 MEST


Hi,

In addition to Yannick answer, you may use the following :

{
Double_t par(np) ;   // np = nbre of parameters
Double_t erpar(np) ; // the error vector
Int_t i ;

 fct = new TF1("xxx",txt, fmin, fmax); //xxx = fonction
 fct->GetParameters(par);    // extract the param. values
 chi2 = fct->GetChisquare() ;  // extract the chi2
 for (i=0 ; i < np; i++)      // extract the param. error values
	 fct->GetParameters(&erpar[i]);
}

Let me know if you need something else about this topic.

Faouzi

 F. Attallah 
GSI mbH 
Planckstr 1
D-64291 Darmstadt 
  Tel: +49 (0)6159 71 2743
  Fax: +49 (0)6159 71 2901
Email: F.Attallah@gsi.de

On Mon, 5 Jul 1999, Patois Yannick wrote:

> Hello,
> 
> You can have a look on the exemple "multifit.C"
> http://root.cern.ch/root/html/examples/multifit.C.html
> 
> Look at the lines :
> 
>    g1->GetParameters(&par[0]);
>    g2->GetParameters(&par[3]);
>    g3->GetParameters(&par[6]);
> 
> look at GetParameter and GetParameters in
> http://root..cern.ch/root/html/TFormula.h.
> 
> Double_t TFormula::GetParameter(Int_t ipar) will let you get one
> parameter, eg :
> Double_t mean = fit->GetParameter(1);
> 
> And void GetParameters(Double_t* params) will gives you every parameter in
> an array.
> 
> Hope it helps,
> 
> 	Yannick
> 
>  _/ Yannick Patois \_________________ Address (home) __________________ 
> | irc(undernet): Garp on #france25+ | La Villa des Sciences            |
> | email : patois@ganil.fr           | 12, avenue de Cambridge          |
> | web :http://www.sura.org/~patois/ | 14200 Herouville-Saint-Clair     |
> | Tel(home) :+33 02 31 94 50 32     | FRANCE                           |
> |___________________________________|__________________________________|
> 
> On Mon, 5 Jul 1999, Stephen Markacs wrote:
> 
> > 
> > How do I get the mean and sigma from a fit?  I know it prints them to the
> > root session, but I want to actually get at them within my code so I can
> > put them on my plot. 
> > 
> > Thanks.
> > 
> >    S t e p h e n   M a r k a c s
> >    stephen@phys.columbia.edu
> >    http://phys.columbia.edu/~stephen/ 
> > 
> > 
> 
> 
> 



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:43:35 MET