Re: [ROOT] built in gaussian

From: Stilianos Kesisoglou (kesisogl@fnal.gov)
Date: Thu Jul 31 2003 - 02:57:52 MEST


Hi Saleem,

    When you fit a TH1F histogram (for example named "hist") that has N events with a Gaussian:

        hist->Fit("gaus");

the Gaussian function is normalized such that it will give you the number of events inside the histogram.

    Doing some math, if G is a Gaussian with some constant term (c), mean (m) and sigma (s) then you have:

        G(x) = c * exp ( -0.5 * [(x-m)/s]^2 )

and

        Integral(-infinity -> infinity) [G(x)] = c * s * sqrt(2*pi) = N 

where:  pi = 3.141592654.

    In your case Area = N so you get the formula:    Area = c * s * sqrt(2*pi)

    That's for the built-in function, if you want to get the area directly then create your own Gaussian and define it as:

    G(x) = { c / [ s * sqrt(2*pi) ] } * exp ( -0.5 * [(x-m)/s]^2 )

    In this case the constant term c is the area directly.

    Hope that helps.
    
Stelios.


----- Original Message ----- 
From: "Saleem, Muhammad" <saleem@SLAC.stanford.edu>
To: <roottalk@pcroot.cern.ch>
Sent: Wednesday, July 30, 2003 6:51 PM
Subject: [ROOT] built in gaussian


> Hi 
> 
> The builtin "gaus" function, when i fit gives me :
>  constant
>  Mean 
>  and width(sigma)
> 
> how do i get the area under the gaussian.
> 
> or why this does not give me the area? 
> 
> am i doing something wrong?
> 
> regards
> 
> ---saleem
>  
> 
> 



This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:14 MET