This commit was generated by cvs2svn to compensate for changes in r2,
[u/mrichter/AliRoot.git] / GEANT321 / gheisha / defs1.F
1 *
2 * $Id$
3 *
4 * $Log$
5 * Revision 1.1.1.1  1995/10/24 10:20:58  cernlib
6 * Geant
7 *
8 *
9 #include "geant321/pilot.h"
10 *CMZ :  3.21/02 29/03/94  15.41.38  by  S.Giani
11 *-- Author :
12       SUBROUTINE DEFS1(I,J,K)
13 C
14 C *** NVE 16-MAR-1988 CERN GENEVA ***
15 C
16 C ORIGIN : H.FESEFELDT (15-JAN-1984)
17 C
18 #include "geant321/mxgkgh.inc"
19 #include "geant321/s_blank.inc"
20 C
21       DATA PI/3.141592653589793/
22       PX=PV(1,I)
23       PY=PV(2,I)
24       PZ=PV(3,I)
25       PT2 = PV(1,J)**2+PV(2,J)**2
26       IF(PT2.GT.0.) THEN
27       CALL LENGTX(J,P)
28       COST=PV(3,J)/P
29       SINT1=SQRT(ABS((1.-COST)*(1.+COST)))
30       SINT2=SQRT(PT2)/P
31       SINT=0.5*(SINT1+SINT2)
32       PH=PI*0.5
33       IF(PV(2,J).LT.0.) PH=PI*1.5
34       IF(ABS(PV(1,J)).GT.1.E-6) PH=ATAN2(PV(2,J),PV(1,J))
35       COSP=COS(PH)
36       SINP=SIN(PH)
37       PV(1,K)= COST*COSP*PX-     SINP*PY+SINT*COSP*PZ
38       PV(2,K)= COST*SINP*PX+     COSP*PY+SINT*SINP*PZ
39       PV(3,K)=-SINT     *PX             +COST     *PZ
40       ELSE
41       PV(1,K)=PX
42       PV(2,K)=PY
43       PV(3,K)=PZ
44 C --- Take the case of theta=pi into account (MR/NVE 27-sep-1990) ---
45       IF (PV(3,J) .LT. 0.) PV(3,K)=-PZ
46       ENDIF
47       END