subroutine POISINT (n, cl, nu_lo, nu_up, ierr) c Author: Glen Cowan c Date: 24-Jan-1998 c Computes the central confidence interval at a confidence level cl c for the Poisson parameter nu given the observed number n. c Must be linked with the routine CHISIN (quantile of chi^2 distribution) c from the CERN Program Library. implicit NONE c arguments integer ierr ! 0 = ok integer n real cl real nu_lo real nu_up c local variables integer n_dof real alpha real CHISIN real one_minus_beta c begin ierr = 0 if ( n .lt. 0 ) then ierr = 1 elseif ( cl .lt. 0. ) then ierr = 2 elseif ( cl .gt. 1. ) then ierr = 3 endif if ( ierr .ne. 0 ) then nu_lo = -1. nu_up = -1. return ! ---------------------> exit endif n_dof = 2*n alpha = (1.-cl)/2. if ( n .gt. 0 ) then nu_lo = 0.5 * CHISIN (alpha, n_dof) else nu_lo = 0. endif n_dof = 2*(n+1) one_minus_beta = (1.+cl)/2. nu_up = 0.5 * CHISIN (one_minus_beta, n_dof) return END