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
adapted to BreitWigner case.
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