# How to get the area of peaks in histogram using TSpectrum

**URL:** <https://root-forum.cern.ch/t/how-to-get-the-area-of-peaks-in-histogram-using-tspectrum/40413>\
**Category:** Newbie\
**Tags:** hist\
**Created:** [July 13, 2020, 12:15pm UTC](https://root-forum.cern.ch/t/how-to-get-the-area-of-peaks-in-histogram-using-tspectrum/40413 "2020-07-13T12:15:30Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rick\_Andy](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/rick_andy/32/22763_2.png) [@Rick\_Andy](https://root-forum.cern.ch/u/Rick_Andy)\
**Post date:** [July 13, 2020, 12:15pm UTC](https://root-forum.cern.ch/t/how-to-get-the-area-of-peaks-in-histogram-using-tspectrum/40413/1 "2020-07-13T12:15:31Z")

</div>

Hi All,  
I am a newbie on root. I am trying to find the area of the peaks in the histogram (energy-spectrum).  
I Know how to calculate using the function TF1 where I have to set initial parameters and write the user-defined functions.  
Is there any other approach using TSpectrum fit to find the area of all the peaks in the histogram?

Any suggestions would be appreciated.

Have a nice day!

_ROOT Version:_ Not Provided  
_Platform:_ Not Provided  
_Compiler:_ Not Provided

* * *

---

<div class="post-metadata">

**Author:** ![bellenot](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/bellenot/32/29217_2.png) [@bellenot](https://root-forum.cern.ch/u/bellenot)\
**Post date:** [July 13, 2020, 12:56pm UTC](https://root-forum.cern.ch/t/how-to-get-the-area-of-peaks-in-histogram-using-tspectrum/40413/2 "2020-07-13T12:56:17Z")

</div>

Did you try to [search the forum](https://root-forum.cern.ch/search?q=%20find%20the%20area%20of%20the%20peaks)?

---

<div class="post-metadata">

**Author:** ![Rick\_Andy](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/rick_andy/32/22763_2.png) [@Rick\_Andy](https://root-forum.cern.ch/u/Rick_Andy)\
**Post date:** [July 13, 2020, 3:12pm UTC](https://root-forum.cern.ch/t/how-to-get-the-area-of-peaks-in-histogram-using-tspectrum/40413/3 "2020-07-13T15:12:13Z")

</div>

Yes but I didn’t find similar problem

---

<div class="post-metadata">

**Author:** ![bellenot](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/bellenot/32/29217_2.png) [@bellenot](https://root-forum.cern.ch/u/bellenot)\
**Post date:** [July 13, 2020, 3:13pm UTC](https://root-forum.cern.ch/t/how-to-get-the-area-of-peaks-in-histogram-using-tspectrum/40413/4 "2020-07-13T15:13:26Z")

</div>

Then maybe @moneta can help you
