      SUBROUTINE UGINIT
C
C To initialise GEANT/USER  program and read data cards
C
      implicit none

      include 'mcflags.inc'
      include 'spec.inc'

      integer i,pointer,j
      real intensity(10)
      

C Local variables

*******************************************************************************

C
C Initialise GEANT
C
      CALL GINIT

C User flags: default values

      CALL UGDEFAULT
C     
C Define user FFREAD data cards (format free input)
C
      CALL UGFFREAD
C
C This section of code defines the random number seed to
C start the simulation. Monte Carlo programs are "pseudo-random"
C in the sense that if you start them off with exactly the same
C seed you always get the same result, but each sequence started
C by a given seed is essentially random.
C
C Geant contains either (i) a predefined set of sequences which
C I can access if RSEQ>0 in the datacard or (ii) you can put the
C random seed sequence in yourself by setting RSEQ=0 and playing with
C RNDM
C
      IF (IRSEQ.EQ.0) THEN
       IF ((IRURNDM(1).EQ.0).AND.(IRURNDM(2).EQ.0)) THEN
        CALL GRNDMQ(IRURNDM(1),IRURNDM(2),1,' ')
        WRITE (6,8800) IRURNDM(1),IRURNDM(2)
 8800 FORMAT (//,10X,' Start of job rndm has been defined by'
     +          ,' default as :',2I20)
       ELSE
        CALL GRNDMQ(IRURNDM(1),IRURNDM(2),0,'S')
       ENDIF
      ELSE
       CALL GRNDMQ(IRURNDM(1),IRURNDM(2),IRSEQ,' ')
      ENDIF
C
C Geometry and materials description
C
      CALL UGEOM
C
C Definition of detector sets
C
      CALL UGSETS
C
C Print the defined materials, tracking media and volumes
C
      CALL GPRINT('MATE',0)
      CALL GPRINT('TMED',0)
      CALL GPRINT('VOLU',0)
C
C Define user histograms and n-tuple
C
      CALL UHINIT

      open(unit=10,file='Sr90-spectrum',status='old')
      do i=1,55
       pointer = 10*(i-1)
       read(10,*) intensity
       do j=1,10
        beta_spectrum(pointer+j)=intensity(j)
       enddo
      enddo
      close(10)
      call rnhpre(beta_spectrum,550)


      IRUN = 0
      IEV = 0

      ibatch = 1
C
      open(unit=61,file='event.list',status='unknown')
C
      END
