Subtracting spectra

Hi all,

I have a energy spectrum and a background spectrum and need a background-subtracted spectrum. Is it possible to produce this from the spectra I have and, if so, how can it be done?

Thanks in advance,


If you are using histograms for your “spectra” and either histograms or functions for your “background”, put “c1” = -1 (and “c2” = -1) in any of:
TH1::Add(const TH1* h1, Double_t c1 = 1)
TH1::Add(TF1* h1, Double_t c1 = 1, Option_t* option = “”)
TH1::Add(const TH1* h, const TH1* h2, Double_t c1 = 1, Double_t c2 = 1)