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 GNHYPE (X, PAR, IACT, SNEXT, SNXT, SAFE)
14 C. ******************************************************************
16 C. * COMPUTE DISTANCE UP TO INTERSECTION WITH HYPErboloid *
17 C. * VOLUME FROM INSIDE 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"
43 C-------------------------------------------------------------
46 R2 = X(1)*X(1) + X(2)*X(2)
47 TANTHS=(TAN(PAR(4)*DEGRAD))**2
49 C -------------------------------------------------
50 C | Compute safety-distance 'SAFE' (P.Weidhaas) |
51 C -------------------------------------------------
60 C IF (PAR(1).NE.0.) THEN
67 C SAFE = MIN (SAFZ1, SAFZ2, SAFR1, SAFR2)
69 C simple, safe choice for hyperboloid for now:
72 IF (IACT .EQ. 0) GO TO 999
74 IF (SNEXT .LT. SAFE) GO TO 999
78 C ------------------------------------------------
79 C | Compute vector-distance 'SNXT' (McPherson) |
80 C ------------------------------------------------
83 C Compute intersection with z-boundaries.
87 ELSEIF(X(6).LT.0.)THEN
91 C Compute intercepts with inner & outer curved surfaces:
93 A = X(4)**2 + X(5)**2 - X(6)**2*TANTHS
94 B = X(1)*X(4) + X(2)*X(5) - X(3)*X(6)*TANTHS
97 C = R2 - X(3)**2*TANTHS - PAR(NCYL)**2
102 IF(DIST1.GT.0.) SNXT=MIN(SNXT,DIST1)
104 IF(DIST2.GT.0.) SNXT=MIN(SNXT,DIST2)
105 C not necessary to compute intercept with outer surface
106 C if there is a positive intercept with inner surface:
107 IF(DIST1.GT.0. .OR. DIST2.GT.0.) GO TO 999