# Yields fro signal+background fit

Dear rooters,
we are trying to fit a data sample with signal made of convolution of BreitWigner and Gaussian distribution plus an exponential background.
For the convolution we used the tutorial code under \$ROOTSYS/tutorials/langaus.C
Our code looks like this:

``````// exponential background

Double_t exponential(Double_t *x, Double_t *par) {
return par[0]*TMath::Exp(par[1] + par[2]*x[0]);
}

// fit function = Breit-wigner x Gaussian + exponential

Double_t fitFunction(Double_t *x, Double_t *par) {
return exponential(x,par) + breitgausfun(x,&par[3]);
}

void SB(Int_t nerrors = 0) {

TH1F *h = new TH1F("h","h",80,40,120);
TF1 *fitFCN = new TF1("fitFCN",fitFunction, 40, 120 ,7);

Double_t par[7];
// Exponential
par[0] = 3000;   // N B
par[1] = 1;
par[2] = -0.1;
// Breit-Wigner x Gaussian convolution
par[3] = 2.5;
par[4] = 90.;
par[5] = 500.;   // N S
par[6]=  2.;

fitFCN->SetParameters(par);
h->FillRandom("fitFCN", 3500);
h->Draw();
h->Fit(fitFCN,"V");
}``````

As you can see we are using two normalization costants as the yields of signal
and background.
The strange thing is that the sum of these numbers after the fit is always greater than
the total number of events (in the example 3500) and their ratio is not well reproduced.

Are we missing something ?

Many thanks !!
Max

Dear rooters,
i’ve tried normalizing the background distribution by this new
definition

``````Double_t exponential(Double_t *x, Double_t *par) {
Double_t N = (TMath::Exp(par[0] + par[1]*120) - TMath::Exp(par[0] + par[1]*40))/par[1];
return (1/N)*TMath::Exp(par[0] + par[1]*x[0]);
}``````

while the signal one was already normalized to unity.
Now the yields of signal+background are correctly fitted with respect
the total entries and their relative ratio too.

I’m not completely happy because of the histogram limits dependence that is present
in the normalization of the exponential but a the moment i don’t see any other way.

Cheers,
Max