5 * Revision 1.1.1.1 1995/10/24 10:21:11 cernlib
9 #include "geant321/pilot.h"
10 *CMZ : 3.21/02 29/03/94 15.41.20 by S.Giani
12 SUBROUTINE GSCHIT(ISET,IDET,ITRA,NUMBV,HITS,NHSUM,IHIT)
14 C. ******************************************************************
16 C. * Store HITS values into detector IUDET of set IUSET *
18 C. * NUMBV volume numbers *
19 C. * HITS array of values for the elements of current hit *
20 C. * ITRA track number associated to this hit *
21 C. * IHIT output parameter containing the hit number *
22 C. * If IHIT=0 hit has not been stored *
24 C. * Same action as GSAHIT but in case the physical volume *
25 C. * specified by NUMBV contains already some hit for the *
26 C. * same track, then the routine will sum up the last NHSUM *
27 C. * elements of the hit. *
28 C. * In order to use that routine , no packing must be *
29 C. * specified for these NHSUM last hits. *
30 C. * If NHSUM.LE.0 then GSCHIT is the same as GSAHIT. *
32 C. * ==>Called by : <USER>, GUSTEP *
33 C. * Authors R.Brun, M.Maire ********* *
35 C. ******************************************************************
37 #include "geant321/gcbank.inc"
38 #include "geant321/gcunit.inc"
39 COMMON/GCLOCA/NLOCAL(2),JS,JD,JDH,JH,JHD,LOCAL(15)
40 DIMENSION NUMBV(*),HITS(*)
41 PARAMETER (MAXINT=2147483647)
45 C. ------------------------------------------------------------------
47 CALL GSAHIT(ISET,IDET,ITRA,NUMBV,HITS,IHIT)
48 IF(IHIT.LE.1)GO TO 999
49 IF(NHSUM.LE.0)GO TO 999
54 JNEWH = JHD+(IHIT-1)*NW
60 C Check if track number is ITRA
62 IF(ITRA.NE.IQ(JCURR+1))GO TO 999
64 C Check if volume numbers are the same
67 IF(IQ(JCURR+J).NE.IQ(JNEWH+J))GO TO 30
70 C Volumes are the same. Now sum the last NHSUM hits
72 DO 20 K=NW,NW-NHSUM+1,-1
73 IF(IQ(JCURR+K).GT.MAXINT-IQ(JNEWH+K)) THEN
77 WRITE(CHMAIL,10000)IQ(JSET+ISET),IQ(JS+IDET)
81 IQ(JCURR+K)=IQ(JCURR+K)+IQ(JNEWH+K)
85 C Remove temporarily stored hit
88 IQ(JH+IDET)=IQ(JH+IDET)-NW
92 10000 FORMAT(' ***** GSCHIT OVERFLOW WHEN IUSET= ',A4,' IUDET= ',A4)