TFractionFitter problem (fit not stable)

I was working with TFractionFitter to fit some data to some mc
distributions. To summarize, I generated some distributions using a
simulation program, and sampled data out of it. Now, I am trying to fit
that data to the mc distributions using TFractionFitter. The problem is
that, even if my fit converges, the fractions which I receive for different
mc distributions is varying a lot. Somehow, I feel that the fit is not
stable. I tried to use high statistics but even that doesn’t work. I hope
you can help me out with this.


I would need to look at a macro reproducing your problem, including the data.
It could be that, even with high statistics you could have bins with very few entries that could give a problem in the fitting

Best Regards


I am uploading my code here. The explanations for the relevant functions are:
loadshapes(): Opens the histogram file and copies it for use in the program.
fitdata(): The function where I use the TFractionFitter

Also, I am attaching the root file with all the data histograms in it.
hist_func.root (1.93 KB)
fit_code.cxx (9.6 KB)


Thanks for the code. I see you have a very fast falling spectrum, with not so menu events in the tails. So by having few events in the tails, you risk to have some instabilities there.
One thing I noticed that is not good, is that you are using TH1F. The range of your histogram is very large, so I would first try to use a TH1D.