I am counting events that follow the Poisson distribution and I need to put a threshold to the number of counts. The threshold is defined as the value associated to the probability P that the number of counts C is bigger than the threshold; to my knowledge this translates into the quantile of the Poisson distribution.

I was given the following code for boost

boost::math::poisson_distribution<> pd(C);
threshold = boost::math::quantile(complement(pd, P);
I would like to do it in ROOT, but in the documentation I couldn’t find a function named poisson_quantile or equivalent. I also searched the forum but I found no posts of immediate solution.

@behrenhoff: thanks, it works for me as well, at least when I compile. But I forgot to mention that we are trying to reduce the number of dependencies and I am pushing for keeping only ROOT for the math…

@moneta: apparently it works. But before it can be accepted I have to demonstrate that for the same values of C and P the results are consistent with the previous implementation, or explain the differences. I expect some discrepancies, let’s call them “rounding errors”, and I am not worried about that, but with ROOT I also get non-monotonic behavior in some circumstances. The upper boundary of the formula definition seems to be particularly important and I don’t understand why. You can see what I mean if you run this: