1 | SUBROUTINE UPHI(IENTRY,LVL)
|
---|
2 | C VERSION 4.00 -- 26 JAN 1986/1900
|
---|
3 | C******************************************************************
|
---|
4 | C UPHI STANDS FOR 'UNIFORM PHI DISTRIBUTION'.
|
---|
5 | C SET COORDINATES FOR NEW PARTICLE OR RESET DIRECTION COSINES OF
|
---|
6 | C OLD ONE. GENERATE RANDOM AZIMUTH SELECTION AND REPLACE THE
|
---|
7 | C DIRECTION COSINES WITH THEIR NEW VALUES.
|
---|
8 | C******************************************************************
|
---|
9 | *KEEP,EPCONT.
|
---|
10 | COMMON/EPCONT/ EDEP,RATIO,TSTEP,TUSTEP,USTEP,TVSTEP,VSTEP,IDISC,
|
---|
11 | * IROLD,IRNEW,RHOFAC, EOLD,ENEW,EKE,ELKE,BETA2,GLE,
|
---|
12 | * TSCAT,IAUSFL
|
---|
13 | DOUBLE PRECISION EDEP,RATIO
|
---|
14 | REAL TSTEP,TUSTEP,USTEP,TVSTEP,VSTEP,RHOFAC,EOLD,ENEW,
|
---|
15 | * EKE,ELKE,BETA2,GLE,TSCAT
|
---|
16 | INTEGER IDISC,IROLD,IRNEW,IAUSFL(29)
|
---|
17 | *KEEP,RANDPA.
|
---|
18 | COMMON /RANDPA/ FAC,U1,U2,RD,NSEQ,ISEED,KNOR
|
---|
19 | DOUBLE PRECISION FAC,U1,U2
|
---|
20 | REAL RD(3000)
|
---|
21 | INTEGER ISEED(103,10),NSEQ
|
---|
22 | LOGICAL KNOR
|
---|
23 | *KEEP,RUNPAR.
|
---|
24 | COMMON /RUNPAR/ FIXHEI,THICK0,HILOECM,HILOELB,
|
---|
25 | * STEPFC,NRRUN,NSHOW,PATAPE,MONIIN,
|
---|
26 | * MONIOU,MDEBUG,NUCNUC,
|
---|
27 | * CETAPE,
|
---|
28 | * SHOWNO,ISHW,NOPART,NRECS,NBLKS,MAXPRT,NDEBDL,
|
---|
29 | * N1STTR,MDBASE,
|
---|
30 | * DEBDEL,DEBUG,FDECAY,FEGS,FIRSTI,FIXINC,FIXTAR,
|
---|
31 | * FIX1I,FMUADD,FNKG,FPRINT,FDBASE
|
---|
32 | * ,GHEISH,GHESIG
|
---|
33 | COMMON /RUNPAC/ DSN,HOST,USER
|
---|
34 | DOUBLE PRECISION FIXHEI,THICK0,HILOECM,HILOELB
|
---|
35 | REAL STEPFC
|
---|
36 | INTEGER NRRUN,NSHOW,PATAPE,MONIIN,MONIOU,MDEBUG,NUCNUC,
|
---|
37 | * SHOWNO,ISHW,NOPART,NRECS,NBLKS,MAXPRT,NDEBDL,
|
---|
38 | * N1STTR,MDBASE
|
---|
39 | INTEGER CETAPE
|
---|
40 | CHARACTER*79 DSN
|
---|
41 | CHARACTER*20 HOST,USER
|
---|
42 |
|
---|
43 | LOGICAL DEBDEL,DEBUG,FDECAY,FEGS,FIRSTI,FIXINC,FIXTAR,
|
---|
44 | * FIX1I,FMUADD,FNKG,FPRINT,FDBASE
|
---|
45 | * ,GHEISH,GHESIG
|
---|
46 | *KEEP,STACKE.
|
---|
47 | COMMON/STACKE/ E,TIME,X,Y,Z,U,V,W,DNEAR,IQ,IGEN,IR,IOBS,LPCTE,NP
|
---|
48 | DOUBLE PRECISION E(60),TIME(60)
|
---|
49 | REAL X(60),Y(60),Z(60),U(60),V(60),W(60),DNEAR(60)
|
---|
50 | INTEGER IQ(60),IGEN(60),IR(60),IOBS(60),LPCTE(60),NP
|
---|
51 | *KEND.
|
---|
52 | COMMON/UPHIIN/SINC0,SINC1,SIN0(20002),SIN1(20002)
|
---|
53 | COMMON/UPHIOT/THETA,SINTHE,COSTHE,SINPHI, COSPHI,PI,TWOPI,PI5D2
|
---|
54 | SAVE A,B,C
|
---|
55 | IF((IENTRY.EQ.2))GO TO1070
|
---|
56 | IF((IENTRY.EQ.3))GO TO1080
|
---|
57 | 1090 LTHETA=SINC1*THETA+SINC0
|
---|
58 | SINTHE=SIN1(LTHETA)*THETA+SIN0(LTHETA)
|
---|
59 | CTHET=PI5D2-THETA
|
---|
60 | LCTHET=SINC1*CTHET+SINC0
|
---|
61 | COSTHE=SIN1(LCTHET)*CTHET+SIN0(LCTHET)
|
---|
62 | C USE THE FOLLOWING ENTRY IF SINTHE AND COSTHE ARE ALREADY KNOWN.
|
---|
63 | C SELECT PHI UNIFORMLY OVER THE INTERVAL (0,TWO PI). THEN USE
|
---|
64 | C PWLF OF SIN FUNCTION TO GET SIN(PHI) AND COS(PHI). THE COSINE
|
---|
65 | C IS GOTTEN BY COS(PHI)=SIN(9*PI/4 - PHI).
|
---|
66 | 1070 CALL RMMAR(RNNO38,1,2)
|
---|
67 | PHI=RNNO38*TWOPI
|
---|
68 | LPHI=SINC1*PHI+SINC0
|
---|
69 | SINPHI=SIN1(LPHI)*PHI+SIN0(LPHI)
|
---|
70 | CPHI=PI5D2-PHI
|
---|
71 | LCPHI=SINC1*CPHI+SINC0
|
---|
72 | COSPHI=SIN1(LCPHI)*CPHI+SIN0(LCPHI)
|
---|
73 | C USE THE FOLLOWING ENTRY FOR THE SECOND OF TWO PARTICLES WHEN WE
|
---|
74 | C KNOW TWO PARTICLES HAVE A RELATIONSHIP IN THEIR CORRECTIONS.
|
---|
75 | C NOTE: SINTHE AND COSTHE CAN BE CHANGED OUTSIDE THROUGH COMMON.
|
---|
76 | C LVL IS A PARAMETER TELLING WHICH PARTICLES TO WORK WITH.
|
---|
77 | C THETA (SINTHE AND COSTHE) ARE ALWAYS RELATIVE TO THE DIRECTION
|
---|
78 | C OF THE INCIDENT PARTICLE BEFORE ITS DIRECTION WAS ADJUSTED.
|
---|
79 | C THUS WHEN TWO PARTICLES NEED TO HAVE THEIR DIRECTIONS COMPUTED,
|
---|
80 | C THE ORIGINAL INCIDENT DIRECTION IS SAVED IN THE VARIABLE A,B,C
|
---|
81 | C SO THAT IT CAN BE USED ON BOTH CALLS.
|
---|
82 | C LVL=1 -- OLD PARTICLE, SAVE ITS DIRECTION AND ADJUST IT
|
---|
83 | C LVL=2 -- NEW PARTICLE. ADJUST DIRECTION USING SAVED A,B,C
|
---|
84 | C LVL=3 -- BREMSSTRAHLUNG GAMMA. SAVE ELECTRON DIRECTION (NEXT
|
---|
85 | C TO TOP OF STACK), AND THEN ADJUST GAMMA DIRECTION.
|
---|
86 | 1080 IF (LVL.EQ.2) GO TO1100
|
---|
87 | IF((LVL.EQ.3))GO TO1110
|
---|
88 | 1120 A=U(NP)
|
---|
89 | B=V(NP)
|
---|
90 | C=W(NP)
|
---|
91 | GO TO 1130
|
---|
92 | 1110 A=U(NP-1)
|
---|
93 | B=V(NP-1)
|
---|
94 | C=W(NP-1)
|
---|
95 | 1100 X(NP)=X(NP-1)
|
---|
96 | Y(NP)=Y(NP-1)
|
---|
97 | Z(NP)=Z(NP-1)
|
---|
98 | LPCTE(NP)=LPCTE(NP-1)
|
---|
99 | IR(NP)=IR(NP-1)
|
---|
100 | DNEAR(NP)=DNEAR(NP-1)
|
---|
101 | TIME(NP)=TIME(NP-1)
|
---|
102 | IGEN(NP)=IGEN(NP-1)
|
---|
103 | IOBS(NP)=IOBS(NP-1)
|
---|
104 | 1130 SINPS2=A*A+B*B
|
---|
105 | IF (SINPS2.LT.1.0E-10) THEN
|
---|
106 | U(NP)=SINTHE*COSPHI
|
---|
107 | V(NP)=SINTHE*SINPHI
|
---|
108 | W(NP)=C*COSTHE
|
---|
109 | ELSE
|
---|
110 | SINPSI=SQRT(SINPS2)
|
---|
111 | US=SINTHE*COSPHI
|
---|
112 | VS=SINTHE*SINPHI
|
---|
113 | SINDEL=B*(1./SINPSI)
|
---|
114 | COSDEL=A*(1./SINPSI)
|
---|
115 | U(NP)=C*COSDEL*US-SINDEL*VS+A*COSTHE
|
---|
116 | V(NP)=C*SINDEL*US+COSDEL*VS+B*COSTHE
|
---|
117 | W(NP)=-SINPSI*US+C*COSTHE
|
---|
118 | END IF
|
---|
119 | RADINV=1.5-0.5*(U(NP)**2+V(NP)**2+W(NP)**2)
|
---|
120 | U(NP)=U(NP)*RADINV
|
---|
121 | V(NP)=V(NP)*RADINV
|
---|
122 | W(NP)=W(NP)*RADINV
|
---|
123 | RETURN
|
---|
124 | END
|
---|