5 * Revision 1.1.1.1 1996/03/06 15:37:35 mclareni
6 * Add geane321 source directories
9 #include "geant321/pilot.h"
10 *CMZ : 3.21/02 29/03/94 15.41.49 by S.Giani
14 C. ******************************************************************
16 C. * Perform the tracking of the track *
17 C. * Track parameters are in VECT *
19 C. * ==>Called by : ERTRAK *
20 C. * Original routines : GTRACK + GTVOL *
21 C. * Authors M.Maire, E.Nagy ********* *
23 C. ******************************************************************
25 #include "geant321/gcbank.inc"
26 #include "geant321/gcjloc.inc"
27 #include "geant321/gccuts.inc"
28 #include "geant321/gconst.inc"
29 #include "geant321/gcphys.inc"
30 #include "geant321/gckine.inc"
31 #include "geant321/gcflag.inc"
32 #include "geant321/gctmed.inc"
33 #include "geant321/gcmate.inc"
34 #include "geant321/gctrak.inc"
35 #include "geant321/gcvolu.inc"
36 #include "geant321/gcunit.inc"
37 #include "geant321/gcnum.inc"
38 #include "geant321/ertrio.inc"
39 #include "geant321/erwork.inc"
44 DIMENSION CUTS(10),MECA(5,12)
45 EQUIVALENCE (CUTS(1),CUTGAM),(MECA(1,1),IPAIR)
46 DIMENSION NAMIN(15),NUMIN(15),NAMOUT(15),NUMOUT(15)
49 #if (!defined(CERNLIB_SINGLE))&&(!defined(CERNLIB_IBM))
50 PARAMETER (EPSMAC=5.E-6)
52 #if (!defined(CERNLIB_SINGLE))&&(defined(CERNLIB_IBM))
53 PARAMETER (EPSMAC=5.E-5)
55 #if defined(CERNLIB_SINGLE)
56 PARAMETER (EPSMAC=1.E-11)
59 C. ------------------------------------------------------------------
76 CALL GMEDIA(VECT,NUMED)
77 IF (NUMED.EQ.0) GO TO 200
79 * *** Come back here each time we enter into a new volume
83 * *** Get tracking medium and material parameters
84 IF (NUMED.NE.NUMOLD) THEN
87 JTM = LQ(JTMED- NUMED)
100 PRECOR = MIN(0.1*EPSIL, 0.0010)
108 MECA(1,I)=Q(JTMED+10+I)
118 MECA(1,I)=Q(JTMN+10+I)
120 ILABS = Q(JTMN+10+21)
121 ISYNC = Q(JTMN+10+22)
122 ISTRA = Q(JTMN+10+23)
126 JMA = LQ(JMATE- NMAT)
130 70 NAMATE(I)=IQ(JMA+I)
140 * If now the particle is entering in the same volume where
141 * it was exiting from last step, and if it has done this for
142 * more than 5 times, we decrease the precision of tracking
144 IF(MOD(NSTOUT,5).EQ.0) THEN
146 WRITE(CHMAIL,10000)ITRA,ISTAK,NTMULT,NAPART
147 10000 FORMAT(' *** ERTRGO *** Boundary loop: track ',
148 + I4,' stack ',I4,' NTMULT ',I5,1X,5A4)
150 WRITE(CHMAIL,10100) EPSCUR
151 10100 FORMAT(' Precision now set to ',G10.3)
159 * *** Initialize magnetic field for EMC package
163 IF (IFIELD.EQ.3) THEN
165 ELSEIF (IFIELD.NE.0) THEN
166 CALL GUFLD (VECT, HI)
169 * *** Control given to user at entrance of volume (INWVOL=1)
176 IF((LEVOLU).AND.(SLENG.GT.0.)) THEN
178 CALL EVOLIO(NVLIN,NAMIN,NUMIN,NVLOUT,NAMOUT,NUMOUT)
184 IV = IUCOMP(NAMPR,NAMIN ,NVLIN )
186 IF (NUMPR.EQ.0) NUMPR = NUMIN (IV)
187 IF (NUMPR.EQ.NUMIN (IV)) THEN
194 ELSE IF (IOVPR.EQ.2) THEN
195 IV = IUCOMP(NAMPR,NAMOUT,NVLOUT)
197 IF (NUMPR.EQ.0) NUMPR = NUMOUT(IV)
198 IF (NUMPR.EQ.NUMOUT(IV)) THEN
212 IF (ISTOP.NE.0) GO TO 999
214 * *** Particle is propagated up to the next volume boundary
218 * *** Come back here after each step in the same volume
226 PREC = MAX(PRECOR,MAX(ABS(VECT(1)),ABS(VECT(2)),
227 + ABS(VECT(3)),SLENG)*EPSCUR)
229 IF(CHARGE.NE.0.) THEN
236 IF (NSTEP.GT.MXNSTP) THEN
242 SAFETY = SAFETY - STEP
243 TLRAD = TLRAD + STEP/RADL
244 TLGCM2 = TLGCM2 + STEP*DENS
246 * *** Give control to user after each tracking step
249 IF(ISTOP.NE.0) GO TO 999
251 * *** Renormalize direction cosines
252 CMOD = 1./SQRT(VECT(4)**2 + VECT(5)**2 + VECT(6)**2)
253 VECT(4) = VECT(4)*CMOD
254 VECT(5) = VECT(5)*CMOD
255 VECT(6) = VECT(6)*CMOD
257 IF (INWVOL.EQ.0) GO TO 100
259 * *** Particle is leaving the volume (INWVOL=2) :
261 * Save the current volume's tree before leaving the volume
262 IF(LEVOLU) CALL EVOLIO(NVLIN,NAMIN,NUMIN,NVLOUT,NAMOUT,NUMOUT)
264 * find the new volume
265 IF (NLEVIN.GE.NLEVEL) THEN
268 IF (NLEVIN.EQ.0) GO TO 200
269 INFROM = LINDEX (NLEVIN+1)
271 IF (NLEVIN.NE.NLEVEL) INGOTO = 0
274 CALL GTMEDI (VECT,NUMED)
280 * *** Track outside setup, give control to user (INWVOL=3)