# Fitting with discrete distribution

**URL:** <https://root-forum.cern.ch/t/fitting-with-discrete-distribution/46743>\
**Category:** Newbie\
**Tags:** roofit, root\
**Created:** [September 8, 2021, 3:41pm UTC](https://root-forum.cern.ch/t/fitting-with-discrete-distribution/46743 "2021-09-08T15:41:43Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![davide.rigamonti](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/d/b9bd4f/32.png) [@davide.rigamonti](https://root-forum.cern.ch/u/davide.rigamonti)\
**Post date:** [September 8, 2021, 3:41pm UTC](https://root-forum.cern.ch/t/fitting-with-discrete-distribution/46743/1 "2021-09-08T15:41:43Z")

</div>

Hi all,

I’m writing to you because I have a problem in fittting a histogram with 2 discrete distributions.

I have a histogram (Data: enrergy in x and counts in y) that I would like to fit with two discrete distributions that I’ve already put in two separate histograms (H1 and H2).

I successfully fit the data (Data) with the function = par[0]\*H1+par[1]\*H2 and I successfully retrive the weight of the 2 components (par[0] and par[1]).

The next step is to add in the fit a free parameter that can introduce a shift in the x-axis of H1 and H2.

Any suggestion how to do it?

Thank you.  
Best regards,

Davide

---

<div class="post-metadata">

**Author:** ![jalopezg](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/jalopezg/32/25844_2.png) [@jalopezg](https://root-forum.cern.ch/u/jalopezg)\
**Post date:** [September 8, 2021, 4:22pm UTC](https://root-forum.cern.ch/t/fitting-with-discrete-distribution/46743/2 "2021-09-08T16:22:16Z")

</div>

Hi @davide.rigamonti; I am sure @jonas can help you with your question.

Cheers,  
J.

---

<div class="post-metadata">

**Author:** ![davide.rigamonti](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/d/b9bd4f/32.png) [@davide.rigamonti](https://root-forum.cern.ch/u/davide.rigamonti)\
**Post date:** [September 9, 2021, 1:54pm UTC](https://root-forum.cern.ch/t/fitting-with-discrete-distribution/46743/3 "2021-09-09T13:54:37Z")

</div>

Hi Javier,  
thank you! I’ll wait the @jonas reply 🙂

Cheers,

Davide
