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!!

                                                         Michela

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

Rene
peak_finder.C (4.72 KB)

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

Best regards,

                               Michela