TF1 integral

Dear experts,

I computed a simple integral for a gauss function [1] but I do not understand the output [2]. Actually the histogram is fill with 10000 events, so why intA is not lose to 10000?

Regards

[2]
intA: 197.945
intB: 99.5247

[1]
void test(){

TH1D *hgaus = new TH1D (“hgaus”, “”, 100, -1, 1);

hgaus->FillRandom(“gaus”, 10000);
hgaus->Draw();
hgaus->Fit(“gaus”);

TF1 *fit=hgaus->GetFunction(“gaus”);

double intA{fit->Integral(-1, 1)};
double intB{fit->Integral(0, 1)};

cout<<"intA: "<<intA<<endl;
cout<<"intB: "<<intB<<endl;
}

double intA = fit->Integral(-1, 1) / hgaus->GetBinWidth(1); double intB = fit->Integral(0, 1) / hgaus->GetBinWidth(1);

Dear Pepe,

thank you, the output now match my expectation.

Regards

Actually, you’d better use:
hgaus->Fit(“gaus”, “L”);
or:
hgaus->Fit(“gaus”, “W”);
or:
hgaus->Fit(“gaus”, “WW”);
and maybe add “I” to the fit options (so, use “IL”, “IW”, “IWW”).

Dear Pepe,

ok, thank you for your answer.

Regards