5 * Revision 1.1.1.1 1995/10/24 10:20:52 cernlib
9 #include "geant321/pilot.h"
10 *CMZ : 3.21/02 29/03/94 15.41.29 by S.Giani
12 SUBROUTINE GNOHYP (X, PAR, IACT, SNEXT, SNXT, SAFE)
14 C. ******************************************************************
16 C. * COMPUTE DISTANCE UP TO INTERSECTION WITH HYPErboloid *
17 C. * VOLUME, FROM OUTSIDE POINT X(1-3) ALONG DIRECTION X(4-6) *
19 C. * PAR (input) : volume parameters *
22 C. * half length in z *
23 C. * straw stereo angle in degrees *
24 C. * r**2 = (z*tan(theta))**2 + a**2 *
26 C. * IACT (input) : action flag *
27 C. * = 0 Compute SAFE only *
28 C. * = 1 Compute SAFE, and SNXT only if SNEXT .GT.new SAFE *
29 C. * = 2 Compute both SAFE and SNXT *
30 C. * = 3 Compute SNXT only *
31 C. * SNEXT (input) : see IACT = 1 *
32 C. * SNXT (output) : distance to volume boundary *
33 C. * SAFE (output) : shortest distance to any boundary *
35 C. * ==>Called by : GNEXT, GTNEXT *
36 C. * Authors M.J.Corden, A.Palounek *
38 C. ******************************************************************
40 #include "geant321/gconsp.inc"
41 DIMENSION X(6),PAR(4),ENDR(2)
43 * ------------------------------------------------------------------
46 TANTHS= (TAN(PAR(4)*DEGRAD))**2
47 R2 = X(1)*X(1)+X(2)*X(2)
48 ENDR(1)=SQRT(PAR(1)**2+PAR(3)**2*TANTHS)
49 ENDR(2)=SQRT(PAR(2)**2+PAR(3)**2*TANTHS)
52 IF(IACT.EQ.3) GO TO 10
54 * compute SAFE from escribed cylinders
59 SAFE = MAX(0.,SAF1,SAF2,SAF3)
61 IF(IACT.EQ.0) GO TO 999
62 IF(IACT.EQ.1.AND.SAFE.GT.SNEXT) GO TO 999
68 IF((SAF3.GT.0.).AND.(X(3)*X(6).GE.0.)) GO TO 999
70 C Compute intercept with inner & outer surfaces.
72 A = X(4)**2 + X(5)**2 - X(6)**2*TANTHS
73 B = X(1)*X(4) + X(2)*X(5) - X(3)*X(6)*TANTHS
76 C = R2 - X(3)**2*TANTHS - PAR(NCYL)**2
78 IF(SURD.LE.0.0) GO TO 30
83 IF((S.LT.0.).OR.(S.GT.SNXT)) GO TO 20
87 IF(ABS(ZI).GT.PAR(3)) GO TO 20
88 * Intersection with hyperboloid ok
93 * *** Intersection with Z end planes
95 IF(SAF3.LE.0.) GO TO 999
101 RI = SQRT(XI*XI + YI*YI)
102 IF(RI.LT.ENDR(1).OR.RI.GT.ENDR(2)) GO TO 999
103 * Intersection with Z end plane ok