# TUnfolding algorithm

Dear scientists,
I have a very simple algorithm that implements the Iterative Bayesian Unfolding algorithms and that deals with lists. Here is the code:

``````def IBU(m,t0,Rin,n):
""" this is the implementation of IBU.
args:
m (list): the measured distribution.
t0 (list): the prior truth spectrum often chosen as a uniform distribution.
Rin (ndarray): the response matrix.
n (int): number of iterations.
Returns:
returns a list representing the approximate true distribution.
"""
tn = t0
for i in range(n):
Rjitni = [np.array(Rin[:][i])*tn[i] for i in range(len(tn))]
Pm_given_t = Rjitni / np.matmul(Rin,tn)
tn = np.dot(Pm_given_t,m)
pass
return tn
``````

So I wonder if such a Tufold implementation is possible.
(i.e. you give it the list representing the measured distribution and the algorithm corrects it via Tufold and gives you the corrected distribution).

Thaks for helping

Hi,

I guess @moneta you could help here?

Hi,
If I have understood you well you would like to add the iterative Bayesian unfolding algorithm to ROOT. I think is part of the external package RooUnfold. There are some plans to merge it at some point in ROOT.
You are welcomed anyway to propose a PR to ROOT with these improvements

Lorenzo

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.