How to fit two Gaussians on two seperate peaks in a spectrum?

I have a spectrum of data (Sodium_22.txt) and I would like to fit the two peaks in the data to Gaussians. However, whenever I use the gaus option, my fit fails spectacularly, forming just a straight line at the bottom. How can the way my code is written now be modified to fit the peaks in my spectrum (and my other spectra data!)?

Please read tips for efficient and successful posting and posting code

ROOT Version: 6.22
Platform: Ubuntu 18.04

Sodium_22.txt (10 KB) Spectrum_fitter.C (2.6 KB)

Hi @Cepheides,
maybe @moneta or @StephanH can help.

Hi all. Here is the most recent version of my code and the result. I am trying to fit gaussian on the peaks and a user-defined linear or polynomial for the rest. How can the code be modified to achieve this.Spectrum_fitter.C (2.7 KB) sodium.pdf (19.7 KB)