Re: [ROOT] fit gaussian doubts:

From: Rene Brun (Rene.Brun@cern.ch)
Date: Fri Jul 30 2004 - 11:16:27 MEST


Hi Carmen,

The answer to your questions in the small example below

Rene Brun

void fitr() {
   TCanvas *c1 = new TCanvas("c1");
   gStyle->SetOptFit(111);
   TH1F *h = new TH1F("h","h",100,-4,4);
   h->FillRandom("gaus",10000);
   h->Fit("gaus");
   TF1 *f1 = h->GetFunction("gaus");
   double mean  = f1->GetParameter(1);
   double sigma = f1->GetParameter(2);
   f1->SetRange(mean-2.5*sigma,mean+2.5*sigma);
}   
   

Carmen Iglesias wrote:
> 
> Hello:
> I'm new using gaussian fit I have some doubts:
> 1. How I can see in my plot the value for mean and sigma(rms) of the fit?
> 2. How I can do the gaussian fit extended only for a determined number of
> sigma in each direction? (i.e. to do the Energy resolution with a
> Gaussian fit within 2.5 sigma interval from the peak value)
> 
> Thanks
> 
> Carmen,
> 
> --
> ***************************************************************
> Carmen Iglesias Escudero
> INSTITUTO DE FÍSICA CORPUSCULAR (IFIC)
> Universidad de Valencia - CSIC
> 
> EDIFICIO INSTITUTOS DE INVESTIGACION          _/    _/_/_/_/  _/  _/_/_/_/
> Poligono la Coma S/N                         _/    _/        _/   _/
> PATERNA - VALENCIA (SPAIN)                  _/    _/        _/   _/
> PHONE: 963543723   FAX: 963543742          _/    _/_/_/    _/   _/
>                                           _/    _/        _/   _/
> Mail: UV-IFIC Apdo:22085, 46071 Valencia _/    _/        _/   _/_/_/_/
> 
> EMAIL: iglesias@ific.uv.es
>        Carmen.Iglesias@cern.ch
> WWW:   http://ific.uv.es/~iglesias/
> *************************************************************************



This archive was generated by hypermail 2b29 : Sun Jan 02 2005 - 05:50:09 MET