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!
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);
}
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:
Set a reasonable range for your RooRealVar.
Make selections before importing the input to the RooDataSet.