Breitwigner in roofit


I’m learning the roofit package now and was trying to do some simple unbinned fitting, as the attached code. However, I cannot fit the breitwigner peak right whatever I tryed, which is shown in the picture. Could anyone help me ? Thank you!

Roofit_Unbinned.C (2.06 KB)

I could see four Gaussian picks! Does that help?


Did you notice the bin around -4.5? Please note that RooFit rounds the number which is not in your “x” range to the boundary values. If you add something like:

y=gRandom->Gaus(2.0,0.8); if( y>-4.5 && y<4.5) { x = y ; data.add(x); }

You could obtain a good fitting result.

Cheers, Jibo

Problem is solved now. Thank you.

But what if I am asked to fit some existed data? Is there any method that I can solve this problem by revising the fitting part?


Sorry, I don’t know whether I understood your question. I think the problem here is just the mismatch between the range of your RooRealVar and that of the input. For the real data, you can:

  1. Set a reasonable range for your RooRealVar.
  2. Make selections before importing the input to the RooDataSet.

Cheers, Jibo

I think I understand now. Thank you!