1 | SUBROUTINE HOWFAR
|
---|
2 | C
|
---|
3 | C*********************************************************************
|
---|
4 | C DESIGN : D. HECK IK3 FZK KARLSRUHE
|
---|
5 | C DATE : SEP 05, 1988
|
---|
6 | C*********************************************************************
|
---|
7 | C THE FOLLOWING IS A GENERAL SPECIFICATION OF HOWFAR:
|
---|
8 | C GIVEN A PARTICLE AT (X,Y,Z) IN REGION IR AND GOING IN DIRECTION
|
---|
9 | C (U,V,W), THIS ROUTINE ANSWERS THE QUESTION, CAN THE PARTICLE GO
|
---|
10 | C A DISTANCE USTEP WITHOUT CROSSING A BOUNDARY OR OBSERVATION LEVEL?
|
---|
11 | C IF YES, IT CALCULATES DNEAR AND RETURNS.
|
---|
12 | C IF NO, IT SETS USTEP=DISTANCE TO BOUNDARY OR DETECTOR IN
|
---|
13 | C IN THE CURRENT DIRECTION.
|
---|
14 | C IT SETS IRNEW TO THE REGION NUMBER ON THE FAR SIDE
|
---|
15 | C OF THE BOUNDARY (THIS CAN BE MESSY IN GENERAL!);
|
---|
16 | C IT SETS NEWOBS TO THE DETECTOR NUMBER NEXT AFTER THE
|
---|
17 | C DETECTOR JUST PASSING.
|
---|
18 | C THE USER CAN TERMINATE A HISTORY BY SETTING IDISC>0. THE USER
|
---|
19 | C CAN TRANSPORT THE LAST PARTICLE BY SETTING IDISC<0. HERE WE
|
---|
20 | C TERMINATE ALL HISTORIES WHICH ENTER REGION 6 OR ARE GOING
|
---|
21 | C BACKWARDS IN REGION 1 OR HAVE PASSED THE LAST OBSERVATION LEVEL.
|
---|
22 | C*********************************************************************
|
---|
23 | C ELECTRON OR PHOTON POSITIVE Z-DIRECTION (W>0) IS DOWNWARDS
|
---|
24 | C |
|
---|
25 | C | REGION 1 (VACUUM)
|
---|
26 | C V
|
---|
27 | C--------------------------- STARTING PLANE AT -BOUND(1) = -ZALTIT
|
---|
28 | C
|
---|
29 | C REGION 2 (AIR WITH EXPONENTIALLY
|
---|
30 | C INCREASING DENSITY)
|
---|
31 | C
|
---|
32 | C--------------------------- BOUNDARY AT -BOUND(2)
|
---|
33 | C
|
---|
34 | C REGION 3 (AIR WITH EXPONENTIALLY
|
---|
35 | C INCREASING DENSITY)
|
---|
36 | C
|
---|
37 | C--------------------------- BOUNDARY AT -BOUND(3)
|
---|
38 | C
|
---|
39 | C REGION 4 (AIR WITH EXPONENTIALLY
|
---|
40 | C INCREASING DENSITY)
|
---|
41 | C
|
---|
42 | C--------------------------- BOUNDARY AT -BOUND(4)
|
---|
43 | C
|
---|
44 | C REGION 5 (AIR WITH EXPONENTIALLY
|
---|
45 | C INCREASING DENSITY)
|
---|
46 | C
|
---|
47 | C-------------------------Z=0 BOUNDARY AT -BOUND(5) (SEA LEVEL)
|
---|
48 | C////////////|/////////
|
---|
49 | C////////////|///////// REGION 6 (VACUUM)
|
---|
50 | C////////////V///////// (MAY CONTAIN DETECTOR)
|
---|
51 | C ELECTRON OR PHOTON
|
---|
52 | C------------------------ BOUNDARY AT -BOUND(6)
|
---|
53 | C
|
---|
54 | C*********************************************************************
|
---|
55 | *KEEP,EPCONT.
|
---|
56 | COMMON/EPCONT/ EDEP,RATIO,TSTEP,TUSTEP,USTEP,TVSTEP,VSTEP,IDISC,
|
---|
57 | * IROLD,IRNEW,RHOFAC, EOLD,ENEW,EKE,ELKE,BETA2,GLE,
|
---|
58 | * TSCAT,IAUSFL
|
---|
59 | DOUBLE PRECISION EDEP,RATIO
|
---|
60 | REAL TSTEP,TUSTEP,USTEP,TVSTEP,VSTEP,RHOFAC,EOLD,ENEW,
|
---|
61 | * EKE,ELKE,BETA2,GLE,TSCAT
|
---|
62 | INTEGER IDISC,IROLD,IRNEW,IAUSFL(29)
|
---|
63 | *KEND.
|
---|
64 | COMMON/GEOM/ZALTIT,BOUND(6),NEWOBS,OBSLVL(10)
|
---|
65 | *KEEP,OBSPAR.
|
---|
66 | COMMON /OBSPAR/ OBSLEV,THCKOB,XOFF,YOFF,THETAP,PHIP,
|
---|
67 | * THETPR,PHIPR,NOBSLV
|
---|
68 | DOUBLE PRECISION OBSLEV(10),THCKOB(10),XOFF(10),YOFF(10),
|
---|
69 | * THETAP,THETPR(2),PHIP,PHIPR(2)
|
---|
70 | INTEGER NOBSLV
|
---|
71 | *KEEP,RUNPAR.
|
---|
72 | COMMON /RUNPAR/ FIXHEI,THICK0,HILOECM,HILOELB,
|
---|
73 | * STEPFC,NRRUN,NSHOW,PATAPE,MONIIN,
|
---|
74 | * MONIOU,MDEBUG,NUCNUC,
|
---|
75 | * CETAPE,
|
---|
76 | * SHOWNO,ISHW,NOPART,NRECS,NBLKS,MAXPRT,NDEBDL,
|
---|
77 | * N1STTR,MDBASE,
|
---|
78 | * DEBDEL,DEBUG,FDECAY,FEGS,FIRSTI,FIXINC,FIXTAR,
|
---|
79 | * FIX1I,FMUADD,FNKG,FPRINT,FDBASE
|
---|
80 | * ,GHEISH,GHESIG
|
---|
81 | COMMON /RUNPAC/ DSN,HOST,USER
|
---|
82 | DOUBLE PRECISION FIXHEI,THICK0,HILOECM,HILOELB
|
---|
83 | REAL STEPFC
|
---|
84 | INTEGER NRRUN,NSHOW,PATAPE,MONIIN,MONIOU,MDEBUG,NUCNUC,
|
---|
85 | * SHOWNO,ISHW,NOPART,NRECS,NBLKS,MAXPRT,NDEBDL,
|
---|
86 | * N1STTR,MDBASE
|
---|
87 | INTEGER CETAPE
|
---|
88 | CHARACTER*79 DSN
|
---|
89 | CHARACTER*20 HOST,USER
|
---|
90 |
|
---|
91 | LOGICAL DEBDEL,DEBUG,FDECAY,FEGS,FIRSTI,FIXINC,FIXTAR,
|
---|
92 | * FIX1I,FMUADD,FNKG,FPRINT,FDBASE
|
---|
93 | * ,GHEISH,GHESIG
|
---|
94 | *KEEP,STACKE.
|
---|
95 | COMMON/STACKE/ E,TIME,X,Y,Z,U,V,W,DNEAR,IQ,IGEN,IR,IOBS,LPCTE,NP
|
---|
96 | DOUBLE PRECISION E(60),TIME(60)
|
---|
97 | REAL X(60),Y(60),Z(60),U(60),V(60),W(60),DNEAR(60)
|
---|
98 | INTEGER IQ(60),IGEN(60),IR(60),IOBS(60),LPCTE(60),NP
|
---|
99 | *KEND.
|
---|
100 | COMMON/ACLOCK/NCLOCK,JCLOCK
|
---|
101 | C_____IF (NCLOCK.GT.JCLOCK) THEN
|
---|
102 | C______WRITE(MDEBUG,* )' HOWFAR:NP=',NP,' IR=',IR(NP),' IOBS=',IOBS(NP)
|
---|
103 | C______CALL AUSGB2
|
---|
104 | C_____END IF
|
---|
105 | IF (IR(NP).GT.1 .AND. IR(NP).LT.6) THEN
|
---|
106 | C *** WE ARE IN THE ATMOSPHERE - CHECK THE GEOMETRY
|
---|
107 | IRL=IR(NP)
|
---|
108 | C *** GOING FORWARD - CONSIDER FIRST SINCE MOST FREQUENT
|
---|
109 | NOBS=IOBS(NP)
|
---|
110 | IF (W(NP).GT.0.0) THEN
|
---|
111 | C *** TVAL IS DISTANCE TO NEXT BOUNDARY OR
|
---|
112 | C *** OBSERVATION LEVEL IN THIS DIRECTION
|
---|
113 | TVAL=(-Z(NP)-MAX(BOUND(IRL),OBSLVL(NOBS)))/W(NP)
|
---|
114 | IF (TVAL.GT.USTEP) THEN
|
---|
115 | C *** CAN TAKE CURRENTLY REQUESTED STEP
|
---|
116 | DNEAR(NP)=TVAL*W(NP)
|
---|
117 | ELSE
|
---|
118 | C *** GO TO DETECTOR OR BOUNDARY, WHICH IS CLOSER
|
---|
119 | USTEP=MAX(TVAL,0.0001)
|
---|
120 | IF (BOUND(IRL).GE.OBSLVL(NOBS)) THEN
|
---|
121 | C *** PARTICLE CROSSES BOUNDARY
|
---|
122 | IRNEW=IRL+1
|
---|
123 | C *** PARTICLE LEAVES AIR
|
---|
124 | IF((IRNEW.GE.6))IDISC=-1
|
---|
125 | END IF
|
---|
126 | IF (BOUND(IRL).LE.OBSLVL(NOBS)) THEN
|
---|
127 | C *** PARTICLE CROSSES DETECTOR
|
---|
128 | NEWOBS=NOBS+1
|
---|
129 | C *** MAKE A VERY SMALL STEP TO AVOID HANGUP OF PROGRAM
|
---|
130 | IF((USTEP.LE.0.0))USTEP = 0.0001
|
---|
131 | C *** TRANSPORT PARTICLE TO FINAL DETECTOR LEVEL AND DISCARD IT
|
---|
132 | IF((NEWOBS.GT.NOBSLV))IDISC=-1
|
---|
133 | END IF
|
---|
134 | END IF
|
---|
135 | C *** END OF W(NP)>0 CASE
|
---|
136 | C *** GOING UPWARD IN ATMOSPHERE
|
---|
137 | ELSE IF(W(NP).LT.0.0) THEN
|
---|
138 | C *** NO DETECTOR ABOVE PARTICLE
|
---|
139 | IF (NOBS.LE.1) THEN
|
---|
140 | C *** DISTANCE TO BOUNDARY ABOVE
|
---|
141 | TVAL=(-Z(NP)-BOUND(IRL-1))/W(NP)
|
---|
142 | IF (TVAL.GT.USTEP) THEN
|
---|
143 | C *** CAN TAKE CURRENTLY REQUESTED STEP
|
---|
144 | DNEAR(NP)=MIN(Z(NP)+BOUND(IRL-1),-(Z(NP)+BOUND(IRL)))
|
---|
145 | ELSE
|
---|
146 | C *** CROSS BOUNDARY ABOVE
|
---|
147 | USTEP=MAX(TVAL,0.0001)
|
---|
148 | IRNEW=IRL-1
|
---|
149 | END IF
|
---|
150 | ELSE
|
---|
151 | C *** BOUNDARY AND DETECTOR ABOVE PARTICLE
|
---|
152 | TVAL=(-Z(NP)-MIN(BOUND(IRL-1),OBSLVL(NOBS-1)))/W(NP)
|
---|
153 | IF (TVAL.GT.USTEP) THEN
|
---|
154 | C *** CAN TAKE CURRENTLY REQUESTED STEP
|
---|
155 | C *** DNEAR IS CLOSEST DISTANCE TO DETECTOR OR
|
---|
156 | C *** BOUNDARY ABOVE OR BELOW PARTICLE
|
---|
157 | DNEAR(NP)=MIN(Z(NP)+MIN(BOUND(IRL-1),OBSLVL(NOBS-1)), -Z(NP) +
|
---|
158 | * MAX(BOUND(IRL),OBSLVL(NOBS)))
|
---|
159 | ELSE
|
---|
160 | C *** TAKE ONLY STEP UP TO BOUNDARY OR DETECTOR
|
---|
161 | USTEP=MAX(TVAL,0.0001)
|
---|
162 | IF (BOUND(IRL-1).LE.OBSLVL(NOBS-1)) THEN
|
---|
163 | C *** PARTICLE CROSSES BOUNDARY ABOVE
|
---|
164 | IRNEW=IRL-1
|
---|
165 | C *** PARTICLE LEAVES ATMOSPHERE
|
---|
166 | IF((IRNEW.LE.1))IDISC=1
|
---|
167 | END IF
|
---|
168 | IF ((BOUND(IRL-1).GE.OBSLVL(NOBS-1))) THEN
|
---|
169 | C *** PARTICLE CROSSES DETECTOR ABOVE; IT IS NOT
|
---|
170 | C *** PRINTED, BECAUSE IT MUST HIT DETECTOR DOWNWARDS
|
---|
171 | NEWOBS=NOBS-1
|
---|
172 | IOBS(NP)=NEWOBS
|
---|
173 | END IF
|
---|
174 | END IF
|
---|
175 | END IF
|
---|
176 | C *** END W(NP)<0 CASE
|
---|
177 | C *** PARTICLE IS MOVING HORIZONTALLY, CANNOT HIT BOUNDARY
|
---|
178 | ELSE IF(W(NP).EQ.0.0) THEN
|
---|
179 | RETURN
|
---|
180 | END IF
|
---|
181 | C *** END OF ATMOSPHERE REGION CASE
|
---|
182 | ELSE IF(IR(NP).EQ.6) THEN
|
---|
183 | C *** TERMINATE THIS HISTORY, IT IS PAST THE ATMOSPHERE
|
---|
184 | IDISC=1
|
---|
185 | C *** WE ARE IN THE REGION WITH SOURCE ABOVE AIR
|
---|
186 | ELSE IF(IR(NP).EQ.1) THEN
|
---|
187 | IF (W(NP).GT.0.0) THEN
|
---|
188 | C *** IT MUST BE A SOURCE PARTICLE ON BOUNDARY 1
|
---|
189 | USTEP=0.0001
|
---|
190 | IRNEW=2
|
---|
191 | ELSE
|
---|
192 | C *** IT IS A REFLECTED PARTICLE, DISCARD IT
|
---|
193 | IDISC=1
|
---|
194 | END IF
|
---|
195 | C *** END REGION 1 CASE
|
---|
196 | END IF
|
---|
197 | RETURN
|
---|
198 | END
|
---|