Problems fitting an histogram with multiple peaks

Hi rooters,
I have a problem with the fitting of histogram. Iā€™m trying to fit a function with multiple peaks. Iā€™m using TSpectrum Class in order to find peaks positions and I have no problem! :smiley: Also the subtraction of background works! :smiley:
But when I try to fit signal with my function, the minimization procedure fails :blush: with message:

Warning in TH1F::Fit: Abnormal termination of minimization.

Iā€™m sending in attachment my macro and the root file with histogram to be fitting!!

Thanks in advance for any suggestions!!


peaks_histo.root (3.77 KB)
peak_finder.c (4.48 KB)

See new version of peak_finder.C in attachement.
See commented lines in your code

peak_finder.C (4.72 KB)

Hello Rene!!
Thank you very much :stuck_out_tongue: !

Best regards,