# How to fit a skew gaussian?

**URL:** <https://root-forum.cern.ch/t/how-to-fit-a-skew-gaussian/50922>\
**Category:** Newbie\
**Created:** [July 22, 2022, 10:14pm UTC](https://root-forum.cern.ch/t/how-to-fit-a-skew-gaussian/50922 "2022-07-22T22:14:30Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![ferhue](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/ferhue/32/29462_2.png) [@ferhue](https://root-forum.cern.ch/u/ferhue)\
**Post date:** [July 26, 2022, 8:53am UTC](https://root-forum.cern.ch/t/how-to-fit-a-skew-gaussian/50922/5 "2022-07-26T08:53:04Z")

</div>

See also:

> [@Clarifying a user defined function (skewed gaussian)](https://root-forum.cern.ch/t/clarifying-a-user-defined-function-skewed-gaussian/42186/3):
>
> Hi, I don’t think what provided there is a good implementation. (x\<[1]) means that this term is equal to zero when false (x greater than Gaussian mean, parameter [1]) and has value = 1 when is true. Now in that implementation you multiply with a negative term which for some value of x \< [1] you will get negative sigma. For the skewed normal I would use the implementation as suggested in [https://en.wikipedia.org/wiki/Skew\_normal\_distribution](https://en.wikipedia.org/wiki/Skew_normal_distribution) TF1 \* f = new TF1("f","2.\*gaus(x,[0],[1],[2])\*ROOT::…

and:

[https://root.cern/doc/master/langaus\_8C.html](https://root.cern/doc/master/langaus_8C.html)

---

_[View the full topic](https://root-forum.cern.ch/t/how-to-fit-a-skew-gaussian/50922)._
