In case of a hadronic interaction, discard the neutrinos, store the protons in the permanent data structure JVERTX/JKINE, and store all the other particles produced in the temporary stack.
Add to the protons in the JKINE bank the JVOLUM and copy number of the volume and the number of the tracking medium where they have been produced by an interaction.
SUBROUTINE GUSTEP
+SEQ,GCKING,GCVOLU,GCTMED.
CHARACTER*4 CHCASE
DIMENSION UBUF(3)
.
.
.
CALL UHTOC(KCASE,4,CHCASE,4)
IF(CHCASE.EQ.'HADR') THEN
DO 10 IG=1, NGKINE
IPART = GKIN(5,IG)
IF(IPART.EQ.4) THEN
*--- Discard neutrinos
IFLGK(IG)=-1
ELSEIF(IPART.EQ.14) THEN
*--- Save protons in JKINE and transport them
IFLGK(IG)=1
ELSE
*--- Simply transport the rest
IFLGK(IG)=0
ENDIF
10 CONTINUE
ENDIF
*--- Perform action on all the particles
CALL GSKING(0)
*--- Add information to the JKINE bank
DO 20 IG=1,NGKINE
IPART = GKIN(5,IG)
IF(IPART.EQ.14) THEN
*--- This is a proton
*--- Get the track number
IT = IFLGK(IG)
NUBUF = 3
UBUF(1) = LVOLUM(NLEVEL)
UBUF(2) = NUMBER(NLEVEL)
UBUF(3) = NUMED
IADR = 0
*--- Store the information
CALL GSKINU(IT,NUBUF,UBUF,IADR)
ENDIF
20 CONTINUE