This commit was generated by cvs2svn to compensate for changes in r2,
[u/mrichter/AliRoot.git] / GEANT321 / ggeom / gtrain.F
1 *
2 * $Id$
3 *
4 * $Log$
5 * Revision 1.1.1.1  1995/10/24 10:20:56  cernlib
6 * Geant
7 *
8 *
9 #include "geant321/pilot.h"
10 *CMZ :  3.21/02 29/03/94  15.41.30  by  S.Giani
11 *-- Author :
12       SUBROUTINE GTRAIN(PARU,P)
13 C.
14 C.    ******************************************************************
15 C.    *                                                                *
16 C.    *                                                                *
17 C.    *              SUBROUTINE GTRAIN(PARU,P)                         *
18 C.    *    Routine to convert from user supplied parameters PARU to    *
19 C.    *    internal parameters P for the twisted trapezoidal shape     *
20 C.    *    GTRA.                                                       *
21 C.    *          Called by : GSPOSP, GSVOLU                            *
22 C.    *          A.C.McPherson    22nd April 1985.                     *
23 C.    *                                                                *
24 C.    *                                                                *
25 C.    ******************************************************************
26 C.
27 #include "geant321/gconsp.inc"
28       DIMENSION PARU(12),P(30),CORN(3,8)
29 C.
30 C.                   -------------------------------------
31 C.
32 C                First copy the 12 user parameters into the internal
33 C                parameter array.
34 C
35       DO 10 I=1,12
36       P(I)=PARU(I)
37    10 CONTINUE
38 C
39 C                Now some trignometrical quantities including the first
40 C                two extra parameters.
41 C
42       P(13) = TAN(P(2)*DEGRAD)*COS(P(3)*DEGRAD)
43       P(14) = TAN(P(2)*DEGRAD)*SIN(P(3)*DEGRAD)
44       STWIS = SIN(P(4)*DEGRAD)
45       CTWIS = COS(P(4)*DEGRAD)
46       DXDY1 = TAN(P(8)*DEGRAD)
47       DXDY2 = TAN(P(12)*DEGRAD)
48 C
49 C                Next the edges outside the constant z faces (derived
50 C                from the eight corner points).
51 C
52       P(15) = (CTWIS*(P(5)*DXDY1+P(7)+P(9)*DXDY2+P(11)) +
53      +STWIS*(P(5)-P(9)))*0.5
54       P(16) = (CTWIS*(P(5)+P(9)) -
55      +STWIS*(P(5)*DXDY1+P(7)-P(9)*DXDY2-P(11)))*0.5
56       P(17) = P(13) - (CTWIS*(P(5)*DXDY1+P(7)-P(9)*DXDY2-P(11)) +
57      +STWIS*(P(5)+P(9)))*0.5/P(1)
58       P(18) = P(14) - (CTWIS*(P(5)-P(9)) -
59      +STWIS*(P(5)*DXDY1+P(7)+P(9)*DXDY2+P(11)))*0.5/P(1)
60 C
61       P(19) = (CTWIS*(P(5)*DXDY1-P(7)+P(9)*DXDY2-P(11)) +
62      +STWIS*(P(5)-P(9)))*0.5
63       P(20) = (CTWIS*(P(5)+P(9)) -
64      +STWIS*(P(5)*DXDY1-P(7)-P(9)*DXDY2+P(11)))*0.5
65       P(21) = P(13) - (CTWIS*(P(5)*DXDY1-P(7)-P(9)*DXDY2+P(11)) +
66      +STWIS*(P(5)+P(9)))*0.5/P(1)
67       P(22) = P(14) - (CTWIS*(P(5)-P(9)) -
68      +STWIS*(P(5)*DXDY1-P(7)+P(9)*DXDY2-P(11)))*0.5/P(1)
69 C
70       P(23) = -(CTWIS*(P(5)*DXDY1+P(6)+P(9)*DXDY2+P(10)) +
71      +STWIS*(P(5)-P(9)))*0.5
72       P(24) = -(CTWIS*(P(5)+P(9)) -
73      +STWIS*(P(5)*DXDY1+P(6)-P(9)*DXDY2-P(10)))*0.5
74       P(25) = P(13) + (CTWIS*(P(5)*DXDY1+P(6)-P(9)*DXDY2-P(10)) +
75      +STWIS*(P(5)+P(9)))*0.5/P(1)
76       P(26) = P(14) + (CTWIS*(P(5)-P(9)) -
77      +STWIS*(P(5)*DXDY1+P(6)+P(9)*DXDY2+P(10)))*0.5/P(1)
78 C
79       P(27) = -(CTWIS*(P(5)*DXDY1-P(6)+P(9)*DXDY2-P(10)) +
80      +STWIS*(P(5)-P(9)))*0.5
81       P(28) = -(CTWIS*(P(5)+P(9)) -
82      +STWIS*(P(5)*DXDY1-P(6)-P(9)*DXDY2+P(10)))*0.5
83       P(29) = P(13) + (CTWIS*(P(5)*DXDY1-P(6)-P(9)*DXDY2+P(10)) +
84      +STWIS*(P(5)+P(9)))*0.5/P(1)
85       P(30) = P(14) + (CTWIS*(P(5)-P(9)) -
86      +STWIS*(P(5)*DXDY1-P(6)+P(9)*DXDY2-P(10)))*0.5/P(1)
87 C
88 C               All done.
89 C
90       DO 970 IL=1,4
91       I0=IL*4+11
92       CORN(3,IL)=-P(1)
93       CORN(1,IL)=P(I0)+P(I0+2)*CORN(3,IL)
94       CORN(2,IL)=P(I0+1)+P(I0+3)*CORN(3,IL)
95       CORN(3,IL+4)=P(1)
96       CORN(1,IL+4)=P(I0)+P(I0+2)*CORN(3,IL+4)
97       CORN(2,IL+4)=P(I0+1)+P(I0+3)*CORN(3,IL+4)
98   970 CONTINUE
99 C
100 #if defined(CERNLIB_DEBUG)
101 C      WRITE(CHMAIL,1000) P,CORN
102 C      CALL GMAIL(0,0)
103 C 1000 FORMAT(' P =',10F10.4,/,4X,10F10.4,/,4X,10F10.4,/,' CORN =',
104 C     +3F10.4,7X,3F10.4,3(/,7X,3F10.4,7X,3F10.4))
105 #endif
106 C
107       RETURN
108       END