You need to use one of the two:
- first eliminate the background and then fit your (clean) peaks,
- fit your histogram using a fit function which simultaneously models the peaks and the background.
BTW. The TSpectrum class provides some background estimation / elimination methods.