# Area peak integration

**URL:** <https://root-forum.cern.ch/t/area-peak-integration/62878>\
**Category:** Newbie\
**Created:** [February 11, 2025, 2:24pm UTC](https://root-forum.cern.ch/t/area-peak-integration/62878 "2025-02-11T14:24:42Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Illiaklyuyev](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/illiaklyuyev/32/38403_2.png) [@Illiaklyuyev](https://root-forum.cern.ch/u/Illiaklyuyev)\
**Post date:** [February 11, 2025, 2:24pm UTC](https://root-forum.cern.ch/t/area-peak-integration/62878/1 "2025-02-11T14:24:43Z")

</div>

Hello,fellor root users. Im now struggling with intehration of peak (area of peak calculation). Here is part of my code where i do this

```auto
 double integralRangeStart = f->GetParameter(1) - 3 * f->GetParameter(2);
  double integralRangeEnd = f->GetParameter(1) + 3 * f->GetParameter(2);
  // double area = f->Integral(integralRangeStart, integralRangeEnd);
  int bin1 = h1->FindBin(integralRangeStart);
  int bin2 = h1->FindBin(integralRangeEnd);
 double area = h1->Integral(bin1, bin2, "width"); 
  std::cout << "Integral of the peak (area): " << area << std::endl;

```

Here i calculate area of whole fitted peak. the question is how i can subtract from whole area an area of background ?

---

<div class="post-metadata">

**Author:** ![Wile\_E\_Coyote](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/wile_e_coyote/32/12417_2.png) [@Wile\_E\_Coyote](https://root-forum.cern.ch/u/Wile_E_Coyote)\
**Post date:** [February 11, 2025, 3:13pm UTC](https://root-forum.cern.ch/t/area-peak-integration/62878/2 "2025-02-11T15:13:44Z")

</div>

[ROOT Forum → Search → gausn pol1](https://root-forum.cern.ch/search?q=gausn%20pol1%20order%3Alatest)
