# How to calculate a correction for a function

**URL:** <https://root-forum.cern.ch/t/how-to-calculate-a-correction-for-a-function/62413>\
**Category:** Newbie\
**Tags:** python, rdataframe, hist, root\
**Created:** [December 6, 2024, 5:54pm UTC](https://root-forum.cern.ch/t/how-to-calculate-a-correction-for-a-function/62413 "2024-12-06T17:54:22Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Terklton](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/terklton/32/37678_2.png) [@Terklton](https://root-forum.cern.ch/u/Terklton)\
**Post date:** [December 6, 2024, 5:54pm UTC](https://root-forum.cern.ch/t/how-to-calculate-a-correction-for-a-function/62413/1 "2024-12-06T17:54:22Z")

</div>

I have a 2D Histogram of values y(x). I know they’re supposed to lie along y=x line but they resemble y=a\*log(x)+b better.

I found the fit for the log function and found “a” and “b” parameters.

Now what I want is to apply some sort of correction to the x values called x\_corr, such that they lie closer to the y=x line. Am I supposed to just do this:

x\_corr = a\*log(x)+b?

_Platform:_ Jupyter Lab

* * *

---

<div class="post-metadata">

**Author:** ![Danilo](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/danilo/32/34528_2.png) [@Danilo](https://root-forum.cern.ch/u/Danilo)\
**Post date:** [December 7, 2024, 12:24pm UTC](https://root-forum.cern.ch/t/how-to-calculate-a-correction-for-a-function/62413/2 "2024-12-07T12:24:14Z")

</div>

Hi,

With ROOT, you can set the value of the bins of a histogram with the `SetBinContent` method ([ROOT: TH1 Class Reference](https://root.cern.ch/doc/master/classTH1.html#aee8453f507af7f4f478c5ceb154ef819)). It is hard to comment about the correctness of the formula, since it seems a very specific problem you are trying to solve.

Cheers,  
Danilo
