1 | SUBROUTINE ADDANI( COST0,PHI0, COST1,PHI1, DCTH,DPHI )
|
---|
2 |
|
---|
3 | C-----------------------------------------------------------------------
|
---|
4 | C ADD(ITION OF) AN(GLES) I(NVERTED)
|
---|
5 | C
|
---|
6 | C GIVEN TWO DIRECTIONS (0 AND 1) IN A COMMON SYSTEM OF REFERENCE.
|
---|
7 | C FIND DCTH AND DPHI SUCH, THAT THE ROUTINE ADDANG TRANSFORMS
|
---|
8 | C (COST0,PHI0) BY ADDING (DCTH,DPHI) INTO (COST1,PHI1).
|
---|
9 | C CALCULATION IS DONE BY SEQUENTIAL ROTATIONS :
|
---|
10 | C 1. ROTATE VECTOR AROUND Z AXIS BY -PHI1
|
---|
11 | C 2. ROTATE VECTOR AROUND Y AXIS BY -THETA1
|
---|
12 | C NOW VECTOR IS (X,Y,Z) WITH DCTH = Z
|
---|
13 | C AND TAN(DPHI) = Y/X
|
---|
14 | C THIS SUBROUTINE IS CALLED FROM MUDECY
|
---|
15 | C ARGUMENTS:
|
---|
16 | C COST0 = COSINE THETA OF PARTICLE BEFORE
|
---|
17 | C PHI0 = PHI OF PARTICLE BEFORE
|
---|
18 | C COST1 = COSINE THETA OF PARTICLE
|
---|
19 | C PHI1 = PHI OF PARTICLE
|
---|
20 | C DCTH = COSINE THETA OF ANGLE
|
---|
21 | C DPHI = PHI OF ANGLE
|
---|
22 | C-----------------------------------------------------------------------
|
---|
23 |
|
---|
24 | IMPLICIT NONE
|
---|
25 | *KEEP,CONST.
|
---|
26 | COMMON /CONST/ PI,PI2,OB3,TB3,ENEPER
|
---|
27 | DOUBLE PRECISION PI,PI2,OB3,TB3,ENEPER
|
---|
28 | *KEEP,RUNPAR.
|
---|
29 | COMMON /RUNPAR/ FIXHEI,THICK0,HILOECM,HILOELB,
|
---|
30 | * STEPFC,NRRUN,NSHOW,PATAPE,MONIIN,
|
---|
31 | * MONIOU,MDEBUG,NUCNUC,
|
---|
32 | * CETAPE,
|
---|
33 | * SHOWNO,ISHW,NOPART,NRECS,NBLKS,MAXPRT,NDEBDL,
|
---|
34 | * N1STTR,MDBASE,
|
---|
35 | * DEBDEL,DEBUG,FDECAY,FEGS,FIRSTI,FIXINC,FIXTAR,
|
---|
36 | * FIX1I,FMUADD,FNKG,FPRINT,FDBASE
|
---|
37 | * ,GHEISH,GHESIG
|
---|
38 | COMMON /RUNPAC/ DSN,HOST,USER
|
---|
39 | DOUBLE PRECISION FIXHEI,THICK0,HILOECM,HILOELB
|
---|
40 | REAL STEPFC
|
---|
41 | INTEGER NRRUN,NSHOW,PATAPE,MONIIN,MONIOU,MDEBUG,NUCNUC,
|
---|
42 | * SHOWNO,ISHW,NOPART,NRECS,NBLKS,MAXPRT,NDEBDL,
|
---|
43 | * N1STTR,MDBASE
|
---|
44 | INTEGER CETAPE
|
---|
45 | CHARACTER*79 DSN
|
---|
46 | CHARACTER*20 HOST,USER
|
---|
47 |
|
---|
48 | LOGICAL DEBDEL,DEBUG,FDECAY,FEGS,FIRSTI,FIXINC,FIXTAR,
|
---|
49 | * FIX1I,FMUADD,FNKG,FPRINT,FDBASE
|
---|
50 | * ,GHEISH,GHESIG
|
---|
51 | *KEND.
|
---|
52 |
|
---|
53 | DOUBLE PRECISION COST0,COST1,CP,CP1,CT,CT1,DCTH,DPHI,PHI0,PHI1,
|
---|
54 | * SP,SP1,ST,ST1,X,XX,Y,YY,Z,ZZ
|
---|
55 | C-----------------------------------------------------------------------
|
---|
56 |
|
---|
57 | CC IF ( DEBUG ) WRITE(MDEBUG,*) 'ADDANI:'
|
---|
58 |
|
---|
59 | CT = COST0
|
---|
60 | ST = SQRT(1.D0-CT**2)
|
---|
61 | CP = COS(PHI0)
|
---|
62 | SP = SIN(PHI0)
|
---|
63 | CT1 = COST1
|
---|
64 | ST1 = SQRT(1.D0-CT1**2)
|
---|
65 | CP1 = COS(PHI1)
|
---|
66 | SP1 = SIN(PHI1)
|
---|
67 |
|
---|
68 | X = ST1 * CP1
|
---|
69 | Y = ST1 * SP1
|
---|
70 | Z = CT1
|
---|
71 |
|
---|
72 | XX = CT*CP*X + CT*SP*Y - ST*Z
|
---|
73 | YY = -SP *X + CP *Y
|
---|
74 | ZZ = ST*CP*X + ST*SP*Y + CT*Z
|
---|
75 |
|
---|
76 | C GET NEW COSINE(THETA) AND PHI
|
---|
77 | DCTH = ZZ
|
---|
78 | IF ( YY .NE. 0.D0 .OR. XX .NE. 0.D0 ) THEN
|
---|
79 | DPHI = ATAN2( YY, XX )
|
---|
80 | ELSE
|
---|
81 | DPHI = 0.D0
|
---|
82 | ENDIF
|
---|
83 |
|
---|
84 | RETURN
|
---|
85 | END
|
---|