Problem in Background fitting

A spectrum is drawn by me using the code and text file below:
fithisto.C (3.4 KB)
eu_gu_1.txt (44.1 KB)
In my code, I have subtracted the background but I want to fit the background which was subtracted.
Please help me in fitting the background.
_ROOT Version:6.16
_Platform:Ubuntu

Maybe @moneta can give you some advice

@Wile_E_Coyote @couet
Hi,
Could you please help me in the above fitting problem?
After a hard time, I am still unable to fit the background.
Thanks

You would need to write a function which describes / models the background but I don’t think it makes sense.
Talk to your supervisor.

Thanks @Wile_E_Coyote he said to fit the background using quadratic function only.

So why don’t you let him do it.

For each peak separately, you can try something like this (though I think the “linear background” is perfectly sufficient):

  TF1 *f1 = new TF1("f1", "gausn(0) + pol2(3)", 395., 435.); // quadratic background
  f1->SetParameters(1.5e4, 415., 2., 0., 0., 0.);
  h->Fit("f1", "LBR+");
  std::cout << "peak area = " << f1->GetParameter(0) << std::endl;
  std::cout << "background = " << f1->Integral(395., 435.) - f1->GetParameter(0) << std::endl;

Thanks @Wile_E_Coyote.
But i have tried that also it doesn’t make much difference.
I am attaching a plot.


Just like this straight line I have to fit the background.
The code for this is peaks.C (4.1 KB)

Change your supervisor.

@Wile_E_Coyote.
Sorry to bother you again. Can anything be done for this background fit?

Ok. @Wile_E_Coyote @couet
One more thing that i want to ask is the following:
If i Comment this part of code
/*s->Background(h->GetArray() + 1, n, 10, TSpectrum::kBackDecreasingWindow, TSpectrum::kBackOrder8, kTRUE, TSpectrum::kBackSmoothing15, kTRUE);*/
and write TH1 *hb = s->Background(h,20,“same”);
then it is showing.


Is it fitting or what if not?!
This is the zoom view.

TH1 *TSpectrum::Background(const TH1 *h, …)