# Significance bin by bin

Dear Expert,
Sorry if this is trivial,
I would like to calculate a significance as a function of mass using bin by bin.

for example each bin of mass I should calculate the significance and after that calculate the sum quadratic all of these significances.

What I will try to do :

my histogram declared by:
and I will calculate the number of bin by:
Numbin = (6000-0)/60 =100
Then I will calculate the significance for each bin, start by [0,100]; [100,200],[200,300],[300,400]…etc
and after that I will calculte the sum quadrqtic as:

Sig=(sig1`2 + sig2`2 + sig3`2+ ....... )`½

Could you please confirm me if what I will do is right or no

ROOT Version: Not Provided
Platform: Not Provided
Compiler: Not Provided

Hi,
It is not really correct. You can combine the bins if you know the distribution in each bins. Suppose it is Normal and you get a significance in each bin `sig(i)`. Then you can sum the square of each bin as you are doing and the distribution is a Chi-square distribution with n-degree of freedom. Then from the obtained value you can compute a p-value which you can transform then in a significance.
For example, here is a code example, supposing each bin has a significance `sig[i]`

``````double chi2 = 0;
for (int i = 0; i < N; ++i)
chi2 += sig[i]*sig[i];

double pvalue = ROOT::Math::chisquared_cdf_c(chi2, N);
double significance = ROOT::Math::normal_quantile_c(pvalue, 1);
``````

Lorenzo

Thanks a lot Lorenzo for your reply 