# Nentries in gaussian

i have a original histogram(hInvMassAll). I am fitting it with a gaussian. I want to get the number of entries under this gaussian. My original histogram has about 8000 Nentries…but the method
double ar=fit1->Integral(2.8,3.3);
gives value in the range of 200.

can anyone please tell me what is the correct way of doing it

with regards

bool Integrate()
{
TFile *f = TFile::Open(“MUONhistos.root”);
TH1F hist = (TH1F)(f->Get(“hInvMassAll”));

// hist->Fit(“mygaus”,"","",2.8,3.3);

TF1 f1(“f1”,“gaus”,2.8,3.3);
f1.SetParameters(1,-0.5,1);
hist->Fit(“gaus”,“w”,“M”,2.8,3.3);
TF1 fit1=(TF1)hist->GetFunction(“gaus”);
fit1->Draw();
double ar=fit1->Integral(2.8,3.3);
cout<<ar << endl;

// TF1 *f1= new TF1(“mygaus”,fitfunction,0,10,3);
TCanvas *c1 = new TCanvas(“c1”,“c1”);
hist->Draw();

return kTRUE;
}

Hi,

you will have to divide the integral by the histogram bin width to get the number of entries

Regards

Lorenzo

thanks!
but dividing will still reduce the number of entries
do i have to multiply by the bin width!!!

with regards