# Full Width at Half Maximum

**URL:** <https://root-forum.cern.ch/t/full-width-at-half-maximum/36270>\
**Category:** Newbie\
**Created:** [October 9, 2019, 2:04am UTC](https://root-forum.cern.ch/t/full-width-at-half-maximum/36270 "2019-10-09T02:04:22Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![DANTE0316](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/d/e79b87/32.png) [@DANTE0316](https://root-forum.cern.ch/u/DANTE0316)\
**Post date:** [October 9, 2019, 2:04am UTC](https://root-forum.cern.ch/t/full-width-at-half-maximum/36270/1 "2019-10-09T02:04:22Z")

</div>

Hello， I would like to know if there is a way to compute the Full Width at Half Maximum for a Irregular curve with only one peak? Thank you！

---

<div class="post-metadata">

**Author:** ![Dilicus](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/dilicus/32/14338_2.png) [@Dilicus](https://root-forum.cern.ch/u/Dilicus)\
**Post date:** [October 9, 2019, 8:50am UTC](https://root-forum.cern.ch/t/full-width-at-half-maximum/36270/2 "2019-10-09T08:50:38Z")

</div>

Hi,  
the curve are you talking about, is a graph or a proper function?

Cheers,  
Stefano

---

<div class="post-metadata">

**Author:** ![DANTE0316](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/d/e79b87/32.png) [@DANTE0316](https://root-forum.cern.ch/u/DANTE0316)\
**Post date:** [October 9, 2019, 12:56pm UTC](https://root-forum.cern.ch/t/full-width-at-half-maximum/36270/3 "2019-10-09T12:56:07Z")

</div>

Hi，  
the curve is a function which is used to fit a histogram .  
If you can, I want to know the difference between the two——a graph and a proper function.  
Thank you very much!

---

<div class="post-metadata">

**Author:** ![Dilicus](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/dilicus/32/14338_2.png) [@Dilicus](https://root-forum.cern.ch/u/Dilicus)\
**Post date:** [October 9, 2019, 2:44pm UTC](https://root-forum.cern.ch/t/full-width-at-half-maximum/36270/4 "2019-10-09T14:44:18Z")

</div>

Ok, if is a function is simpler, because there are a lot of method to use.

The idea here is find the maximum, then search for the two point with a half maximum.

```auto
//In this way you find the maximum
double max = f->GetMaximum();
double x_maximum = f->GetMaximumX();

//let's search for the point of half maximum, 
//one will be on the left and the other one on the right
//so the reason for the two call, using he lower and upper bound
//of the x range for the fuction.

double fwhm_left = f->GetX(max/2,x_lower_range, x_maximum);
double fwhm_right = f->GetX(max/2, x_maximum, upper_range_x);

cout<<"FWHM = " << fwhm_right - fwhm_left<<endl;

```

The method I used are quite self-explantory, but below there is the link to the root page  
[TF1::GetMaximum()](https://root.cern.ch/doc/master/classTF1.html#adb9c2104b4877d97ce00e7f1e81085e5)  
[TF1::GetMaximumX();](https://root.cern.ch/doc/master/classTF1.html#aebeaadffdeb2c566984c0127c94fcc6a)  
[TF1::GetX()](https://root.cern.ch/doc/master/classTF1.html#aaa11403e909bf42f0d04356ede442763)

The TGraph is only a 2D collection of point.

on the other hand the TF1, is most of the time defined analytically and you can have parameters to change, and for each x you have only one y, and you have a lot of calculus method to find the different property.

Hope is enough.

S

---

<div class="post-metadata">

**Author:** ![DANTE0316](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/d/e79b87/32.png) [@DANTE0316](https://root-forum.cern.ch/u/DANTE0316)\
**Post date:** [October 9, 2019, 2:59pm UTC](https://root-forum.cern.ch/t/full-width-at-half-maximum/36270/5 "2019-10-09T14:59:19Z")

</div>

It is enough .Thank you again!
