# Curve Fitting (python)

**URL:** <https://root-forum.cern.ch/t/curve-fitting-python/33839>\
**Category:** Newbie\
**Created:** [April 30, 2019, 4:21pm UTC](https://root-forum.cern.ch/t/curve-fitting-python/33839 "2019-04-30T16:21:09Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ricky\_Dube](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/r/b2d939/32.png) [@Ricky\_Dube](https://root-forum.cern.ch/u/Ricky_Dube)\
**Post date:** [April 30, 2019, 4:21pm UTC](https://root-forum.cern.ch/t/curve-fitting-python/33839/1 "2019-04-30T16:21:09Z")

</div>

Hello!

I am extremely new to ROOT, and I have produced a 2d dE/dx histogram, and now I am trying to fit a curve in order to make cuts on the particles. I have tried to find a guide but all the manuals appear to be for the C++ version.

So far I’ve tried to go to the fit panel and entering an equation like this:  
y=([0]/(x+[1]))+[2]

However, whenever I press fit, it spits out nonsense values for each of the parameters, and draws a group of red lines somewhere on the histogram. Is there any simple way for me to get an upper and lower bound for the curve in the photo?

Thank you!

 ![image](https://root-forum.cern.ch/uploads/default/original/3X/c/1/c172f77e68da56460cd2bc653871da3100ad9a28.png)

---

<div class="post-metadata">

**Author:** ![amadio](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/amadio/32/12562_2.png) [@amadio](https://root-forum.cern.ch/u/amadio)\
**Post date:** [May 2, 2019, 3:46am UTC](https://root-forum.cern.ch/t/curve-fitting-python/33839/2 "2019-05-02T03:46:11Z")

</div>

In your case, depending on what you want to do, it might be better to use a [TCutG](https://root.cern.ch/doc/master/classTCutG.html).
