Statistical error of the Integral of a Gaussian

Dear Rooters,

I am new to the list, and I have the following which I coud not figure out
how to do it under root. I’m fitting my J/psi peaks by a Gaussian function :
f=NExp[-(x-\bar{x})^2/2 sigma^2]. Then I utilized the function
Integral(min,max) to find the area or the number of counts under this fit.
.
.
.
n[j]->Fit(“Gaus”,“R”);
G->SetParameters(par[0],par[1],par[2]);
float mean = par[1];
float sigma = par[2];
float mlo = mean-3.0
sigma;
float mhi = mean+3.0*sigma;
cout <<mean<<" and “<<sigma<<” and " <<mlo<<"and "<<mhi<<endl;
float binw = n[j]->GetBinWidth(1);
double COUNTS = G->Integral(mlo,mhi)/binw;
.
.
.

I need to know how to find the statistical error of the integral, i.e. "COUNTS"
in root.

Thank you very much

Ahmed.

=======================================
Ahmed Al-Jamel
Physics Department(physics.nmsu.edu)
New Mexico State University
Box 30001, MSC 3D
Las Cruces, NM 88003-8001
Tel (off): (505)-646-7614.
feynman.nmsu.edu
phenix.bnl.gov/phenix/WWW/publish/ahmed1/

integral is area under the curve, so the statistical error of your integral
is sum of all bins statistical errors multiplied by bin width ( assuming all bins are same width).

Cheers, Khamit

wait a sec, another assumption I made was that all bins are NOT correlated.

or, was the question about implementation here ?

I would do simple loop over bins

for(Int_t i = -; i< hist->GetNbinsX(); i++)
{

hey, I accidentally hit enter :wink:

so do loop and look up errros of you hist:

hist->GetBinError(i);

add them up and thats you error of COUNTS.

Of course it is only true if your histogram has stat. errors in it.

did you do hist->Sumw2(); ?

If you want to consider bins correlated then I guess it is more complicated

I am not sure now, perhaps, divide that sum of errors by number of non-zero bins to account for degrees of freedom ?

Interesting, post what you come up with please.

Your are correct ardashev. But, I need to deal with my fit functions and not the bin contents.

I did the following to avoid this:

[1]. I re-define my Gaussian function so that the norm is just the number of J/psis:

F(x)= norm exp(bla bla bla);

norm = (sqrt[2*psi] * sigma * N ) / binwidth

where N is the peak. Then the statistical error of J/psi will be calculated directly by root and will be shown on the statistical window on the Canvas. Does this sound Ok for you?

                                            Ahmed.

Hi Ahmed,

I am new on this platform. Please, how do post my question to this forum?

Also, when a do a gaussian fitting of a curve or peak, how do I obtain the strength of the peak?

Regards
Sunday.

https://root-forum.cern.ch/t/tips-for-efficient-and-successful-posting/28292/2