       SUBROUTINE UGSETBODY
C
       IMPLICIT NONE
C
C Define geometry sets and hit content for the scintillator
C
       include 'mcflags.inc'
       include 'sets.inc'
       include 'gcbank.inc'

      CHARACTER*4 CVOL, vName
      INTEGER LNAM(2),LNUM(2)
      INTEGER I, iV, NLEVEL
      REAL X(3),POSM(3)
      INTEGER NH,NF
      PARAMETER (NH=10,NF=1)
      CHARACTER*4 NAMESH(NH),NAMEF(NF)
      DIMENSION NBITSH(NH),ORIG(NH),FACT(NH),NBITSF(NF)
      REAL ORIG,FACT
      INTEGER NBITSH,NBITSF

C This is where we define the actual hit format
C store hit position (X,Y,Z)
C       Track identifier
C       Time of flight
C       Momentum components (Px/P,Py/P,Pz,P,Ptot)
C       Deposited energy
C define name of hit variable

      DATA NAMESH/'X   ','Y   ','Z   ','TRAK','PART','PX/P',
     &       'PY/P','PZ/P','P   ','EDEP'/

C All this mucking about is to achieve better packing efficiency
C when the value of the hit is packed into a byte in the data structure.
C In general what is packed into the byte for each hit field is
C VAL(I)=(HIT(I)+ORIG(I))*FACT(I)

C length of hit variables (mostly 24 bit, but integers are 12)

      DATA NBITSH/3*24,12,24,4*24,24/

C Origin of hit variable - for the moment set to 0

      DATA ORIG/3*300.,0.,0.,3*1.,0.,0./

C scale factors for hit information - controls the accuracy (number of
C decimal points, essentially) to which the hit information is stored

      DATA FACT/3*1.E3,1.,1.,3*1.E4,1.E4,1.E6/
  
C This bit defines a chain of path names which *uniquely* defines
C this particular sensitive detector. Since there is only one piece
C of scintillator in this universe, it's fairly short and easy

      DATA NBITSF/1/
      DATA NAMEF/'BODY'/

C   Loop over all volumes looking for modules
 
      IF (JVOLUM.LE.0) THEN
         PRINT *,'ugsetscint: Volume data structure missing'
         STOP
      ENDIF

C Loop through all the volumes looking to see if SCIN exists in
C the structure

      DO iV = 1, IQ(JVOLUM-1)
         CALL UHTOC(IQ(JVOLUM+iV),4,vName,4)
         IF (vName.EQ.'BODY') THEN
             NAMEF(1) = 'BODY'

C It does, so define it in a set 
C Set name is called 'BASE'

             CALL GSDET('FACE',NAMEF(1),1,NAMEF,NBITSF,0,10000,10000,
     &                   iSetBody,iDetBody)

C iSetScint,iDetScint contains the set,detector identifiers which we will
C use later in gustep

C Define the hit format for the set 'BASE'

             CALL GSDETH('FACE',NAMEF(1),NH,NAMESH,NBITSH,ORIG,FACT)

C Print the set to make sure we have things correct

             CALL GPSETS('FACE',NAMEF(1))
         ENDIF
      ENDDO

      END

