This commit was generated by cvs2svn to compensate for changes in r2,
[u/mrichter/AliRoot.git] / GEANT321 / ggeom / gintrp.F
1 *
2 * $Id$
3 *
4 * $Log$
5 * Revision 1.1.1.1  1995/10/24 10:20:51  cernlib
6 * Geant
7 *
8 *
9 #include "geant321/pilot.h"
10 *CMZ :  3.21/02 29/03/94  15.41.29  by  S.Giani
11 *-- Author :
12       SUBROUTINE GINTRP(X,P,IYES)
13 C.
14 C.    ******************************************************************
15 C.    *                                                                *
16 C.    *    ROUTINE TO PERFORM GINME FUNCTION FOR A GENERAL TRAPEZOID.  *
17 C.    *        X  -  A VECTOR DIMENSION 3 GIVING THE POINT.            *
18 C.    *        P  -  THE VECTOR OF PARAMETERS;                         *
19 C.    *                  DZ - HALF LENGTH ALONG Z AXIS,                *
20 C.    *                  TX - DX/DZ OF LINE LINKING FACE CENTRES,      *
21 C.    *                  TY - DY/DZ   ''                               *
22 C.    *                  H1 - HALF LENGTH IN Y DIR OF FACE AT Z=-DZ,   *
23 C.    *                 LB1 - HALF LEN. OF LOW Y EDGE OF SAME FACE,    *
24 C.    *                 LT1 - HALF LEN. OF HIGH Y EDGE OF SAME FACE,   *
25 C.    *                TTH1 - DX/DY OF LINE LINKING EDGE CENTRES,      *
26 C.    *                  H2 - AS 1 FOR FACE AT Z=DZ                    *
27 C.    *                 LB2 -   ''                                     *
28 C.    *                 LT2 -   ''                                     *
29 C.    *                TTH2 -   ''                                     *
30 C.    *     IYES  -  RETURNED AS 1 IF POINT IS INSIDE, OTHERWISE 0.    *
31 C.    *                                                                *
32 C.    *    ==>Called by : GINME                                        *
33 C.    *         Author  A.McPherson  *********                         *
34 C.    *                                                                *
35 C.    ******************************************************************
36 C.
37       DIMENSION X(3),P(11)
38       SAVE LDZ,LLTAN,LH1,LTTH1,LH2,LTTH2
39 C
40       DATA LDZ,LLTAN,LH1,LTTH1,LH2,LTTH2/1,2,4,7,8,11/
41 C.
42 C.              ----------------------------------------
43 C.
44       IYES=0
45 C
46 C             CHECK Z FIRST.
47 C
48       IF(ABS(X(3)).GT.P(LDZ)) GO TO 99
49 C
50 C             COMPUTE TRAPEZIUM PARAMETERS AND X,Y IN TRAP COORDS.
51 C
52       SP1=(P(LDZ)-X(3))*0.5/P(LDZ)
53       SP2=(P(LDZ)+X(3))*0.5/P(LDZ)
54       H=P(LH1)*SP1+P(LH2)*SP2
55       YL=X(2)-X(3)*P(LLTAN+1)
56 C
57 C            CHECK Y.
58 C
59       IF(ABS(YL).GT.H) GO TO 99
60       IF ( H .EQ. 0 ) THEN
61          TTH = 0.
62       ELSE
63          TTH=(P(LH1)*P(LTTH1)*SP1+P(LH2)*P(LTTH2)*SP2)/H
64       END IF
65       BL=P(LH1+1)*SP1+P(LH2+1)*SP2
66       TL=P(LH1+2)*SP1+P(LH2+2)*SP2
67       XL=X(1)-X(3)*P(LLTAN)
68 C
69 C            CHECK X.
70 C
71       DX=BL*(H-YL)*0.5/H+TL*(H+YL)*0.5/H
72       XL=XL-YL*TTH
73       IF(ABS(XL).GT.DX) GO TO 99
74 C
75 C            INSIDE.
76 C
77       IYES=1
78 C
79    99 CONTINUE
80       END