# How can I retrieve the background data from spectrum

**URL:** <https://root-forum.cern.ch/t/how-can-i-retrieve-the-background-data-from-spectrum/38437>\
**Category:** ROOT\
**Tags:** hist, root\
**Created:** [March 17, 2020, 4:00pm UTC](https://root-forum.cern.ch/t/how-can-i-retrieve-the-background-data-from-spectrum/38437 "2020-03-17T16:00:58Z")\
**Posts on this page:** 3\
**Page:** 3

<div class="post-metadata">

**Author:** ![robertfroast](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/robertfroast/32/21121_2.png) [@robertfroast](https://root-forum.cern.ch/u/robertfroast)\
**Post date:** [March 22, 2020, 8:41am UTC](https://root-forum.cern.ch/t/how-can-i-retrieve-the-background-data-from-spectrum/38437/43 "2020-03-22T08:41:46Z")

</div>

Thanks @Wile_E_Coyote.

 ![peak4](https://root-forum.cern.ch/uploads/default/original/3X/3/3/33592f9dbd1405eae643b8f291780ccd99a06959.png)  
This is one of the fitted peak in the spectrum(red)  
I think background is eliminated but i’m still not sure about the blue line in the spectrum.  
Looking at my code could you please elaborate what does this blue line signifies? [fithisto.C](https://root-forum.cern.ch/uploads/short-url/zl5hkyEUisb6ShOjEmSdyggPkZU.C) (3.4 KB)

---

<div class="post-metadata">

**Author:** ![robertfroast](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/robertfroast/32/21121_2.png) [@robertfroast](https://root-forum.cern.ch/u/robertfroast)\
**Post date:** [March 22, 2020, 11:53am UTC](https://root-forum.cern.ch/t/how-can-i-retrieve-the-background-data-from-spectrum/38437/44 "2020-03-22T11:53:44Z")

</div>

Thanks @Wile_E_Coyote.  
please tell me about this blue line also.

> [@Problem in calculating areas under fitted peak](https://root-forum.cern.ch/t/problem-in-calculating-areas-under-fitted-peak/38519/12):
>
> TSpectrum::Background

// Estimate the background

[s](https://root.cern/doc/master/namespaceTGeant4Unit.html#a5d450e80998065902b102dca2a69066a)-\>Background(source,nbins,6,[TSpectrum::kBackIncreasingWindow](https://root.cern/doc/master/classTSpectrum.html#a4fa0dd8bf14325f01b2aa32857e325c8a4133774c283c838d5473fa75127ae22f),

[TSpectrum::kBackOrder2](https://root.cern/doc/master/classTSpectrum.html#a4fa0dd8bf14325f01b2aa32857e325c8a22ca3a5b1f9745fabaaa8bef2cb39d35),[kFALSE](https://root.cern/doc/master/RtypesCore_8h.html#a7e568baf910535e8ffd438acb843434d),

[TSpectrum::kBackSmoothing3](https://root.cern/doc/master/classTSpectrum.html#a4fa0dd8bf14325f01b2aa32857e325c8af1af12f6d81dd70d82c188845db4af20),[kFALSE](https://root.cern/doc/master/RtypesCore_8h.html#a7e568baf910535e8ffd438acb843434d));

// Draw the estimated background

for (i = 0; i \< nbins; i++) [d](https://root.cern/doc/master/RSha256_8hxx.html#a23b5b0a85bf5762c93a855f40c0343ce)-\>SetBinContent(i + 1,source[i]);

[d](https://root.cern/doc/master/RSha256_8hxx.html#a23b5b0a85bf5762c93a855f40c0343ce)-\>SetLineColor([kRed](https://root.cern/doc/master/Rtypes_8h.html#ac31db05c6cb5891c704eae374f6926a8a5a655b1a02e5b0311571ca57ce4f3900));

[d](https://root.cern/doc/master/RSha256_8hxx.html#a23b5b0a85bf5762c93a855f40c0343ce)-\>Draw(“SAME L”);

In Example 1 script [Background\_incr.C](https://root.cern/doc/master/Background__incr_8C.html):

1. they are estimating the background and then they are drawing it.  
In the same way, I am thinking that this blue line is showing the estimated background.  
Am I right? If not then please correct me.

---

<div class="post-metadata">

**Author:** ![system](https://root-forum.cern.ch/uploads/default/original/3X/e/f/efe4f24398fd8ffeb76bccb6ecc46d9d9c003376.png) [@system](https://root-forum.cern.ch/u/system)\
**Post date:** [April 5, 2020, 11:53am UTC](https://root-forum.cern.ch/t/how-can-i-retrieve-the-background-data-from-spectrum/38437/45 "2020-04-05T11:53:47Z")

</div>

Closed on April 5, 2020, 11:53am UTC

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.

[Previous page](https://root-forum.cern.ch/t/how-can-i-retrieve-the-background-data-from-spectrum/38437.md?page=2)
