Baseline for spectrum

_ROOT Version: 6.26
_Platform: Linux
_Compiler: GCC 8.5.0


Hi all,

Newbie here. I want to know what class and functions should I use to calculate the baseline of the TH1F spectrum below, and also, how to constrain the gaus fit to the baseline; you can see the gaus fit (in red) extending below.

I’m looking to compute the peak area properly using the gaus fit. I have done by hist->IntegralAndError() & fit->Integral()

I found TVirtualFitter, is this a good choice? or are there better solutions for baselines?

Any other advice would be much appreciated.

-MJ

Welcome to the ROOT fourm.

I guess @moneta can help.

Hi All,

It seems I overlooked an easy one.

TSpectrum *s = new TSpectrum();
TH1* backGroundOfHist = s->Background(hist0,20,"same");
hist0->Add(backGroundOfHist,-1);

I hope this can help others.

Kind regards,
MJ