subroutine POISUP (n, beta, nu_up, ierr) c Author: Glen Cowan c Date: 24-Jan-1998 c Computes the classical upper limit at a confidence level cl=1-beta 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 beta real nu_up c local variables integer n_dof real CHISIN real cl c begin cl = 1.-beta 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_up = -1. return ! ---------------------> exit endif n_dof = 2*(n+1) nu_up = 0.5 * CHISIN (cl, n_dof) return END