Number of signal events

Hello!

I wonder if there is a way to obtain the number of signal events after fitting.
The Stat window only shows mean, sigma and constant etc.
It does not show the area under the fit function.
For example, when a histogram is fitted with a Gaussian or a Gaussian signal + polynomial background,
the number of background subtracted signal is an important parameter.
The error on the number of signal after fit is also necessary.

Best Regards,
Sangryul Ro

See the example below showing how to add one or more lines to the TPaveStats.

Rene

{ TCanvas *c1 = new TCanvas("c1"); TH1F *h = new TH1F("h","test",100,-4,4); h->FillRandom("gaus",5000); h->Fit("gaus"); TF1 *f1 = (TF1*)h->GetFunction("gaus"); Double_t integ = f1->Integral(-4,4); integ /= h->GetXaxis()->GetBinWidth(1); gStyle->SetOptFit(); h->Draw(); c1->Update(); //force the creation of the TPaveStats TPaveStats *ps = (TPaveStats*)h->GetFunction("stats"); ps->SetName("mystats"); //name must be changed, otherwise "stats" is regenerated ps->AddText(Form("Integral = %g",integ)); h->SetStats(0); //to avoid a new "stats" to be drawn c1->Modified(); }

That seems working.
How can I get the error on the Integral similar to the error on the Sigma, for example?

Cheers

see tutorial $ROOTSYS/tutorials/fit/ErrorIntegral.C (also in attachment)

Rene
ErrorIntegral.C (3.67 KB)

Thanks a lot, Rene.
Cheers