A Bayesian approach to evaluate confidence intervals in counting experiments with background