Hello! I have a gamma spec histogram which I’d like to fit & remove the background of. I tried using the Background() function from TSpectrum, following the class reference example (ROOT: TSpectrum Class Reference), but the result I’m getting is that the supposed background fit is the same as the original histogram.
I’m modifying the bin number, but in the background-removed histogram I end up getting negative counts.
This is the snippet of code I’m using for the background fit:
TH1 *bHist = new TH1F ("bHist", "Simulated Background Histogram", simBinNumber, 0, 700);
TH1F *noBckgHist = (TH1F*)simHist->Clone("noBckgHist");
for (int i=0;i<simBinNumber;i++) source[i] = simHist->GetBinContent(i);
TSpectrum *spec = new TSpectrum();
bHist = spec->Background(simHist, 7, "");
noBckgHist->Add(bHist, -1.0); `
Any help is appreciated, thanks!
Please read tips for efficient and successful posting and posting code
ROOT Version: Not Provided
Platform: Not Provided
Compiler: Not Provided