5 * Revision 1.1.1.1 1995/10/24 10:22:03 cernlib
9 #include "geant321/pilot.h"
10 *CMZ : 3.21/02 29/03/94 15.41.46 by S.Giani
15 *=== sbcomp ===========================================================*
17 SUBROUTINE SBCOMP ( SBHAL0, SBSKI0, SBCEN0, SBCEN1, SBSKI1,
20 #include "geant321/dblprc.inc"
21 #include "geant321/dimpar.inc"
22 #include "geant321/iounit.inc"
24 *----------------------------------------------------------------------*
25 *----------------------------------------------------------------------*
27 #include "geant321/nucgeo.inc"
29 SAVE R0HLA , R0HLB , R0SKA , R0SKB , R0CEA , R0CEB ,
30 & R1CEA , R1CEB , R1SKA , R1SKB , R1HLA , R1HLB ,
31 & SQRH0A, SQRH0B, SQRS0A, SQRS0B, SQRC0A, SQRC0B,
32 & SQRC1A, SQRC1B, SQRS1A, SQRS1B, SQRH1A, SQRH1B,
34 #include "geant321/nucstf.inc"
36 IF ( ABS (R0TRAJ) .LT. BIMPCT .OR. ABS (R1TRAJ) .LT. BIMPCT )
38 BIMPSQ = BIMPCT * BIMPCT
39 IF ( R0TRAJ .GE. 0.D+00 ) THEN
44 IF ( BIMPCT .GE. RADIU1 ) THEN
50 R0HLB = MAX ( BIMPCT, - R1TRAJ )
51 SQRH0A = SQRT ( ( R0HLA - BIMPCT ) * ( R0HLA + BIMPCT ) )
52 SQRH0B = SQRT ( ( R0HLB - BIMPCT ) * ( R0HLB + BIMPCT ) )
53 SBHAL0 = RHOSKN * ( ( 1.D+00 + RADIU1 / HALODP ) * ( SQRH0A
54 & - SQRH0B ) - 0.5D+00 * ( R0HLA / HALODP * SQRH0A
55 & - R0HLB / HALODP * SQRH0B + BIMPSQ / HALODP
56 & * LOG ( ( R0HLA + SQRH0A ) / ( R0HLB + SQRH0B ) ) ) )
57 ELSE IF ( R0TRAJ .GE. -RADIU0 ) THEN
61 R0CEB = MAX ( BIMPCT, - R1TRAJ )
62 SQRC0A = SQRT ( ( R0CEA - BIMPCT ) * ( R0CEA + BIMPCT ) )
63 SQRC0B = SQRT ( ( R0CEB - BIMPCT ) * ( R0CEB + BIMPCT ) )
64 SBCEN0 = RHOCEN * ( SQRC0A - SQRC0B )
65 ELSE IF ( R0TRAJ .GE. -RADIU1 ) THEN
67 RHELP = MAX ( BIMPCT, - R1TRAJ )
69 R0SKB = MAX ( RHELP, RADIU0 )
70 SQRS0A = SQRT ( ( R0SKA - BIMPCT ) * ( R0SKA + BIMPCT ) )
71 SQRS0B = SQRT ( ( R0SKB - BIMPCT ) * ( R0SKB + BIMPCT ) )
72 SBSKI0 = RHOCEN * ( ( 1.D+00 + RADIU0 / SKNEFF ) * ( SQRS0A
73 & - SQRS0B ) - 0.5D+00 * ( R0SKA / SKNEFF * SQRS0A
74 & - R0SKB / SKNEFF * SQRS0B + BIMPSQ / SKNEFF
75 & * LOG ( ( R0SKA + SQRS0A ) / ( R0SKB + SQRS0B ) ) ) )
76 IF ( RHELP .LT. RADIU0 ) THEN
79 SQRC0A = SQRT ( ( R0CEA - BIMPCT ) * ( R0CEA + BIMPCT ) )
80 SQRC0B = SQRT ( ( R0CEB - BIMPCT ) * ( R0CEB + BIMPCT ) )
81 SBCEN0 = RHOCEN * ( SQRC0A - SQRC0B )
86 RHELP = MAX ( BIMPCT, - R1TRAJ )
88 R0HLB = MAX ( RHELP, RADIU1 )
89 SQRH0A = SQRT ( ( R0HLA - BIMPCT ) * ( R0HLA + BIMPCT ) )
90 SQRH0B = SQRT ( ( R0HLB - BIMPCT ) * ( R0HLB + BIMPCT ) )
91 SBHAL0 = RHOSKN * ( ( 1.D+00 + RADIU1 / HALODP ) * ( SQRH0A
92 & - SQRH0B ) - 0.5D+00 * ( R0HLA / HALODP * SQRH0A
93 & - R0HLB / HALODP * SQRH0B + BIMPSQ / HALODP
94 & * LOG ( ( R0HLA + SQRH0A ) / ( R0HLB + SQRH0B ) ) ) )
95 IF ( RHELP .LT. RADIU1 ) THEN
97 R0SKB = MAX ( RHELP, RADIU0 )
98 SQRS0A = SQRT ( ( R0SKA - BIMPCT ) * ( R0SKA + BIMPCT ) )
99 SQRS0B = SQRT ( ( R0SKB - BIMPCT ) * ( R0SKB + BIMPCT ) )
100 SBSKI0 = RHOCEN * ( ( 1.D+00 + RADIU0 / SKNEFF )
101 & * ( SQRS0A - SQRS0B ) - 0.5D+00 * ( R0SKA / SKNEFF
102 & * SQRS0A - R0SKB / SKNEFF * SQRS0B + BIMPSQ
103 & / SKNEFF * LOG ( ( R0SKA + SQRS0A ) / ( R0SKB
105 IF ( RHELP .LT. RADIU0 ) THEN
107 R0CEB = MAX ( BIMPCT, - R1TRAJ )
109 SQRC0B = SQRT ( ( R0CEB - BIMPCT )*( R0CEB + BIMPCT ))
110 SBCEN0 = RHOCEN * ( SQRC0A - SQRC0B )
120 IF ( R1TRAJ .EQ. - R0TRAJ ) THEN
136 ELSE IF ( R1TRAJ .LE. 0.D+00 ) THEN
141 IF ( BIMPCT .GE. RADIU1 ) THEN
145 R1HLA = MAX ( BIMPCT, R0TRAJ )
146 SQRH1A = SQRT ( ( R1HLA - BIMPCT ) * ( R1HLA + BIMPCT ) )
147 SQRH1B = SQRT ( ( R1HLB - BIMPCT ) * ( R1HLB + BIMPCT ) )
148 SBHAL1 = RHOSKN * ( ( 1.D+00 + RADIU1 / HALODP ) * ( SQRH1B
149 & - SQRH1A ) - 0.5D+00 * ( R1HLB / HALODP * SQRH1B
150 & - R1HLA / HALODP * SQRH1A + BIMPSQ / HALODP
151 & * LOG ( ( R1HLB + SQRH1B ) / ( R1HLA + SQRH1A ) ) ) )
152 ELSE IF ( R1TRAJ .LE. RADIU0 ) THEN
156 R1CEA = MAX ( BIMPCT, R0TRAJ )
157 SQRC1A = SQRT ( ( R1CEA - BIMPCT ) * ( R1CEA + BIMPCT ) )
158 SQRC1B = SQRT ( ( R1CEB - BIMPCT ) * ( R1CEB + BIMPCT ) )
159 SBCEN1 = RHOCEN * ( SQRC1B - SQRC1A )
160 ELSE IF ( R1TRAJ .LE. RADIU1 ) THEN
162 RHELP = MAX ( BIMPCT, R0TRAJ )
164 R1SKA = MAX ( RHELP, RADIU0 )
165 SQRS1A = SQRT ( ( R1SKA - BIMPCT ) * ( R1SKA + BIMPCT ) )
166 SQRS1B = SQRT ( ( R1SKB - BIMPCT ) * ( R1SKB + BIMPCT ) )
167 SBSKI1 = RHOCEN * ( ( 1.D+00 + RADIU0 / SKNEFF ) * ( SQRS1B
168 & - SQRS1A ) - 0.5D+00 * ( R1SKB / SKNEFF * SQRS1B
169 & - R1SKA / SKNEFF * SQRS1A + BIMPSQ / SKNEFF
170 & * LOG ( ( R1SKB + SQRS1B ) / ( R1SKA + SQRS1A ) ) ) )
171 IF ( RHELP .LT. RADIU0 ) THEN
174 SQRC1A = SQRT ( ( R1CEA - BIMPCT ) * ( R1CEA + BIMPCT ) )
175 SQRC1B = SQRT ( ( R1CEB - BIMPCT ) * ( R1CEB + BIMPCT ) )
176 SBCEN1 = RHOCEN * ( SQRC1B - SQRC1A )
181 RHELP = MAX ( BIMPCT, R0TRAJ )
183 R1HLA = MAX ( RHELP, RADIU1 )
184 SQRH1A = SQRT ( ( R1HLA - BIMPCT ) * ( R1HLA + BIMPCT ) )
185 SQRH1B = SQRT ( ( R1HLB - BIMPCT ) * ( R1HLB + BIMPCT ) )
186 SBHAL1 = RHOSKN * ( ( 1.D+00 + RADIU1 / HALODP ) * ( SQRH1B
187 & - SQRH1A ) - 0.5D+00 * ( R1HLB / HALODP * SQRH1B
188 & - R1HLA / HALODP * SQRH1A + BIMPSQ / HALODP
189 & * LOG ( ( R1HLB + SQRH1B ) / ( R1HLA + SQRH1A ) ) ) )
190 IF ( RHELP .LT. RADIU1 ) THEN
192 R1SKA = MAX ( RHELP, RADIU0 )
193 SQRS1A = SQRT ( ( R1SKA - BIMPCT ) * ( R1SKA + BIMPCT ) )
194 SQRS1B = SQRT ( ( R1SKB - BIMPCT ) * ( R1SKB + BIMPCT ) )
195 SBSKI1 = RHOCEN * ( ( 1.D+00 + RADIU0 / SKNEFF )
196 & * ( SQRS1B - SQRS1A ) - 0.5D+00 * ( R1SKB / SKNEFF
197 & * SQRS1B - R1SKA / SKNEFF * SQRS1A + BIMPSQ
198 & / SKNEFF * LOG ( ( R1SKB + SQRS1B ) / ( R1SKA
200 IF ( RHELP .LT. RADIU0 ) THEN
204 SQRC1A = SQRT ( ( R1CEA - BIMPCT )*( R1CEA + BIMPCT ))
205 SBCEN1 = RHOCEN * ( SQRC1B - SQRC1A )
217 *----------------------------------------------------------------------*
218 *----------------------------------------------------------------------*
220 ENTRY RSCOMP ( SBHAL0, SBSKI0, SBCEN0, SBCEN1, SBSKI1, SBHAL1 )
221 SBTTOT = SBHAL0 + SBSKI0 + SBCEN0 + SBCEN1 + SBSKI1 + SBHAL1
222 IF ( SBUSED .GT. SBTTOT ) STOP 'RSCOMP'
223 IF ( SBUSED .LT. SBHAL0 ) THEN
230 RIMPCT = 0.5D+00 * ( RDMORE + RDLESS )
231 SQRIMP = SQRT ( ( RIMPCT - BIMPCT ) * ( RIMPCT + BIMPCT ) )
232 SBRIMP = RHOSKN * ( ( 1.D+00 + RADIU1 / HALODP ) * ( SQRH0A
233 & - SQRIMP ) - 0.5D+00 * ( R0HLA / HALODP * SQRH0A
234 & - RIMPCT / HALODP * SQRIMP + BIMPSQ / HALODP
235 & * LOG ( ( R0HLA + SQRH0A ) / ( RIMPCT + SQRIMP ) ) ))
236 IF ( SBRIMP .GE. SBUSEF ) THEN
244 RIMPCT = RDLESS + ( SBUSEF - SBLESS ) / ( SBMORE - SBLESS )
245 & * ( RDMORE - RDLESS )
247 SQRIMP = SQRT ( ( RIMPCT - BIMPCT ) * ( RIMPCT + BIMPCT ) )
248 ELSE IF ( SBUSED .LT. SBHAL0 + SBSKI0 ) THEN
249 SBUSEF = SBUSED - SBHAL0
255 RIMPCT = 0.5D+00 * ( RDMORE + RDLESS )
256 SQRIMP = SQRT ( ( RIMPCT - BIMPCT ) * ( RIMPCT + BIMPCT ) )
257 SBRIMP = RHOCEN * ( ( 1.D+00 + RADIU0 / SKNEFF ) * ( SQRS0A
258 & - SQRIMP ) - 0.5D+00 * ( R0SKA / SKNEFF * SQRS0A
259 & - RIMPCT / SKNEFF * SQRIMP + BIMPSQ / SKNEFF
260 & * LOG ( ( R0SKA + SQRS0A ) / ( RIMPCT + SQRIMP ) ) ))
261 IF ( SBRIMP .GE. SBUSEF ) THEN
269 RIMPCT = RDLESS + ( SBUSEF - SBLESS ) / ( SBMORE - SBLESS )
270 & * ( RDMORE - RDLESS )
272 SQRIMP = SQRT ( ( RIMPCT - BIMPCT ) * ( RIMPCT + BIMPCT ) )
273 ELSE IF ( SBUSED .LT. SBHAL0 + SBSKI0 + SBCEN0 ) THEN
274 SBUSEF = SBUSED - SBHAL0 - SBSKI0
275 SQRIMP = SQRC0A - SBUSEF / RHOCEN
276 RIMPCT = SQRT ( SQRIMP**2 + BIMPSQ )
278 ELSE IF ( SBUSED .LT. SBTTOT - SBSKI1 - SBHAL1 ) THEN
279 SBUSEF = SBUSED - SBHAL0 - SBSKI0 - SBCEN0
280 SQRIMP = SBUSEF / RHOCEN + SQRC1A
281 RIMPCT = SQRT ( SQRIMP**2 + BIMPSQ )
282 ELSE IF ( SBUSED .LT. SBTTOT - SBHAL1 ) THEN
283 SBUSEF = SBUSED - SBHAL0 - SBSKI0 - SBCEN0 - SBCEN1
289 RIMPCT = 0.5D+00 * ( RDMORE + RDLESS )
290 SQRIMP = SQRT ( ( RIMPCT - BIMPCT ) * ( RIMPCT + BIMPCT ) )
291 SBRIMP = RHOCEN * ( ( 1.D+00 + RADIU0 / SKNEFF ) * ( SQRIMP
292 & - SQRS1A ) - 0.5D+00 * ( RIMPCT / SKNEFF * SQRIMP
293 & - R1SKA / SKNEFF * SQRS1A + BIMPSQ / SKNEFF
294 & * LOG ( ( RIMPCT + SQRIMP ) / ( R1SKA + SQRS1A ) ) ))
295 IF ( SBRIMP .GE. SBUSEF ) THEN
303 RIMPCT = RDLESS + ( SBUSEF - SBLESS ) / ( SBMORE - SBLESS )
304 & * ( RDMORE - RDLESS )
305 SQRIMP = SQRT ( ( RIMPCT - BIMPCT ) * ( RIMPCT + BIMPCT ) )
307 SBUSEF = SBUSED - SBHAL0 - SBSKI0 - SBCEN0 - SBCEN1 - SBSKI1
313 RIMPCT = 0.5D+00 * ( RDMORE + RDLESS )
314 SQRIMP = SQRT ( ( RIMPCT - BIMPCT ) * ( RIMPCT + BIMPCT ) )
315 SBRIMP = RHOSKN * ( ( 1.D+00 + RADIU1 / HALODP ) * ( SQRIMP
316 & - SQRH1A ) - 0.5D+00 * ( RIMPCT / HALODP * SQRIMP
317 & - R1HLA / HALODP * SQRH1A + BIMPSQ / HALODP
318 & * LOG ( ( RIMPCT + SQRIMP ) / ( R1HLA + SQRH1A ) ) ))
319 IF ( SBRIMP .GE. SBUSEF ) THEN
327 RIMPCT = RDLESS + ( SBUSEF - SBLESS ) / ( SBMORE - SBLESS )
328 & * ( RDMORE - RDLESS )
329 SQRIMP = SQRT ( ( RIMPCT - BIMPCT ) * ( RIMPCT + BIMPCT ) )
331 IF ( RIMPCT .GT. 0.D+00 ) THEN
332 XIMPCT = XBIMPC + CXIMPC * SQRIMP
333 YIMPCT = YBIMPC + CYIMPC * SQRIMP
334 ZIMPCT = ZBIMPC + CZIMPC * SQRIMP
336 XIMPCT = XBIMPC - CXIMPC * SQRIMP
337 YIMPCT = YBIMPC - CYIMPC * SQRIMP
338 ZIMPCT = ZBIMPC - CZIMPC * SQRIMP
340 IF ( BIMPCT .GT. ANGLGB ) THEN
341 TRUFAC = BIMPTR / BIMPCT
342 XIMPTR = XIMPCT * TRUFAC
343 YIMPTR = YIMPCT * TRUFAC
344 ZIMPTR = ZIMPCT * TRUFAC
345 RIMPTR = RIMPCT * TRUFAC
353 *=== End of subroutine Sbcomp =========================================*