       SUBROUTINE UGDEFLID
C
       IMPLICIT NONE
C
       include 'vols.inc'
       include 'materials.inc'
 
C The universe is a big box of air. The size of the universe
C is defined in the datacard using the keywork 'MVOL'
 
       INTEGER IVOL


C This'll create a tube with inner radius
C SCINTPAR(1), outer radius SCINTPAR(2), and 
C half length SCINTPAR(3)

        LIDPAR(1) = 0.
        LIDPAR(2) = LEADTHICKNESS + 0.24
        LIDPAR(3) = LIDHEIGHT/2.

        COLLPAR(1) = LIDPAR(3)
        COLLPAR(2) = 0.
        COLLPAR(3) = 0.24
        COLLPAR(4) = 0.
        COLLPAR(5) = 0.24+2.*COLLPAR(1)*TAN(THETA/180.*3.1415927)

           IF (COLLPAR(5).gt.LIDPAR(2)) THEN
              PRINT*, "The theta specified makes the collimator exit
     +  radius greater than the radius of the lid. Please specify
     +  a different angle"
           READ*, THETA
           COLLPAR(5) = 0.24+2.*COLLPAR(1)*TAN(THETA/180.*3.1415927)
           END IF

        CALL GSVOLU('LID ','TUBE', IMATLEAD, LIDPAR, 3,IVOL)
        CALL GSVOLU('COLL','CONE',IMATAIR, COLLPAR, 5, IVOL)

C Position this in the universe

      CALL GSPOS('LID ',1,'HOLD',0.,0.,
     +              BLOCKPAR(3),0,'ONLY')
      CALL GSPOS('COLL',1, 'LID ', 0.,0.,
     +              0., 0, 'ONLY')

       END
