Integration constants in a Breit-Wigner

Dear all,

I am a newbie of RooFit, so probably this is a silly question, but I would be sure to face the problem in the correct way.

I am studying a resonance, and then I want to fit its invariant mass spectrum (from which I already subtracted the background) with a Breit-Wigner function.
In this operation, one fundamental quantity I want to estimate is the yield of the resonance, besides its mass and gamma, since I am interested in counting them to make pt distributions and so on.

Now, if I understood well the behaviour of RooFit, when I use a Breit-Wigner PDF, it will be normalized by the RooFit engine before fitting, so I can only estimate the mass and gamma of the peak, but not the yield.

What is the correct procedure to add a multiplicative constant to the normalized Breit-Wigner function (or any other similar peak function, like Gaussian) in order to estimate the yield besides the peak position and width?

Thanks, cheers

If I understand correctly, you already removed all background from the sample you are trying to fit. Then all events are signal. How many events do you have ? That is, if I understood correctly, the answer to your question.


I have explained above how I compute the yield. It is the integral of a function. Then, instead of estimating the yield, by simply counting, I want to fit the peak and estimate the yield from integrating it, as explaiend above. But I need to add a multiplicative scale constant to the function, if I want to have this number.


To estimate yields, you can perform an extended ML fit.

In general, this only makes sense if your model has at least
two components, e.g. signal and background (in case of
a single component the yield would always be exactly the
number of events in the dataset you fit).

To set up a model in RooFit for an extended ML fit, simply
provide equal number of coefficients and pdf. A complete
example is provided here … fit.C.html

If you wish to restrict the definition of the yield (in either signal
or background) to a range in your observables, e.g. “what is the
fitted number of signal events in the range x=[10,20]”) please
look at example … fit.C.html



probably I don’t manage to be clear in explaining the problem, since the answers don’t seem to get the point.

Let’s do with an example:

  1. create a TH1D with adequate bins and edges
  2. use the “FillRandom” function to fill it according to a Breit-Wigner, with any number of entries you want, say 100000
  3. you then fit the obtained histogram using RooFit, and if you use the Breit-Wigner PDF, it should return, of course, a mean and width close to the one you have set in the TF1 you use in the “FillRandom” function

The question is now: in this case I know that I have 100000 entries. But how can I ad a fit parameter in this function which should reproduce this number of entries? Suppose I have no background and no side effects, just the good entries which I want to count.


If want to count events in a ML fit, you always need the extended ML formalism. In the case of >1 component, RooAddPdf can do this automatically for you (as I wrote earlier). With a single component
you can do this too, as follows

RooRealVar N("N","N",0,1000000) ;
RooExtendPdf pdfe("pdfe","pdfe",pdf,N) ;

where pdf is your original (Breit-Wigner) pdf. If you now fit pdfe instead
of pdf, you will gain an extra parameter N which will fit the number of events in your sample.

In the example above, the fitted N, will always exactly be the number of events in the dataset, so I don’t consider that to be very useful.
The more useful cases are when you have >1 components, or if you wish to count the number of events in a sub range of the observable.
The latter can be accomplished by introducing a named range in your observable, e.g.

x.setRange(“sigRange”,-10,10) ;

and the modifying the RooExtendPdf ctor as follows

RooExtendPdf pdfe("pdfe","pdfe",pdf,N,"sigRange") ;

now N will no longer count the number of total events in the dataset, but the number of events that are in sigRange according to the model
(which is not necessarily exactly the number of data events in that range),i.e. it is N*fSig where fSig is the fraction of the pdf in the given range.



this was an example, of course, and in the example I just want to reproduce exactly that number. In the real application, it will fit some data histograms, and then the fit will give me an estimation of the yield.

Usually, the study one does with resonances consists in estimating the background with some technique, and then subtracting it from the signal. Then, in the “ideal” case one should have left the breit-wigner only. In case a residual background is still there, one fits it with a N-order polynomial, but this case is not so frequent in my approaches, fortunately.

Thanks for the clarifications.

One question: apparently, when I do like you suggest, I find that the error on this additional parameter is just its root square. Is this correct?


On your last question: the extended ML term adds a log(Poisson(N,Ndata)) to the likelihood to be minimized. The error that minuit will estimate from thi s term will be consistent with the uncertainty of the Poisson model, which approximates will to sqrt(N) at large N.