source: trunk/MagicSoft/Simulation/Corsika/Mmcs/prange.f@ 8405

Last change on this file since 8405 was 286, checked in by harald, 25 years ago
This is the start point for further developments of the Magic Monte Carlo Simulation written by Jose Carlos Gonzales. Now it is under control of one CVS repository for the whole collaboration. Everyone should use this CVS repository for further developments.
File size: 5.2 KB
Line 
1 SUBROUTINE PRANGE(ARG)
2
3C-----------------------------------------------------------------------
4C (DECAYING) P(ARTICLE'S) RANGE
5C
6C DETERMINES MEAN FREE PATH FOR DECAYING PARTICLES
7C INCLUDING IONIZATION ENERGY LOSS,
8C FOR EACH LAYER OF THE ATMOSOHERE SEPARATELY
9C PRECISELY
10C THIS SUBROUTINE IS CALLED FROM BOX2
11C ARGUMENT:
12C ARG = -LOG(RANDOM NUMBER) * SPEED OF LIGHT * LIFETIME
13C
14C DESIGN : D. HECK IK3 FZK KARLSRUHE
15C-----------------------------------------------------------------------
16
17 IMPLICIT NONE
18*KEEP,AIR.
19 COMMON /AIR/ COMPOS,PROBTA,AVERAW,AVOGAD
20 DOUBLE PRECISION COMPOS(3),PROBTA(3),AVERAW,AVOGAD
21*KEEP,ATMOS.
22 COMMON /ATMOS/ AATM,BATM,CATM,DATM
23 DOUBLE PRECISION AATM(5),BATM(5),CATM(5),DATM(5)
24*KEEP,ATMOS2.
25 COMMON /ATMOS2/ HLAY,THICKL
26 DOUBLE PRECISION HLAY(5),THICKL(5)
27*KEEP,CONST.
28 COMMON /CONST/ PI,PI2,OB3,TB3,ENEPER
29 DOUBLE PRECISION PI,PI2,OB3,TB3,ENEPER
30*KEEP,OBSPAR.
31 COMMON /OBSPAR/ OBSLEV,THCKOB,XOFF,YOFF,THETAP,PHIP,
32 * THETPR,PHIPR,NOBSLV
33 DOUBLE PRECISION OBSLEV(10),THCKOB(10),XOFF(10),YOFF(10),
34 * THETAP,THETPR(2),PHIP,PHIPR(2)
35 INTEGER NOBSLV
36*KEEP,PAM.
37 COMMON /PAM/ PAMA,SIGNUM
38 DOUBLE PRECISION PAMA(6000),SIGNUM(6000)
39*KEEP,PARPAR.
40 COMMON /PARPAR/ CURPAR,SECPAR,PRMPAR,OUTPAR,C,
41 * E00,E00PN,PTOT0,PTOT0N,THICKH,ITYPE,LEVL
42 DOUBLE PRECISION CURPAR(14),SECPAR(14),PRMPAR(14),OUTPAR(14),
43 * C(50),E00,E00PN,PTOT0,PTOT0N,THICKH
44 INTEGER ITYPE,LEVL
45*KEEP,PARPAE.
46 DOUBLE PRECISION GAMMA,COSTHE,PHI,H,T,X,Y,CHI,BETA,GCM,ECM
47 EQUIVALENCE (CURPAR(2),GAMMA), (CURPAR(3),COSTHE),
48 * (CURPAR(4), PHI ), (CURPAR(5), H ),
49 * (CURPAR(6), T ), (CURPAR(7), X ),
50 * (CURPAR(8), Y ), (CURPAR(9), CHI ),
51 * (CURPAR(10),BETA), (CURPAR(11),GCM ),
52 * (CURPAR(12),ECM )
53*KEEP,RUNPAR.
54 COMMON /RUNPAR/ FIXHEI,THICK0,HILOECM,HILOELB,
55 * STEPFC,NRRUN,NSHOW,PATAPE,MONIIN,
56 * MONIOU,MDEBUG,NUCNUC,
57 * CETAPE,
58 * SHOWNO,ISHW,NOPART,NRECS,NBLKS,MAXPRT,NDEBDL,
59 * N1STTR,MDBASE,
60 * DEBDEL,DEBUG,FDECAY,FEGS,FIRSTI,FIXINC,FIXTAR,
61 * FIX1I,FMUADD,FNKG,FPRINT,FDBASE
62 * ,GHEISH,GHESIG
63 COMMON /RUNPAC/ DSN,HOST,USER
64 DOUBLE PRECISION FIXHEI,THICK0,HILOECM,HILOELB
65 REAL STEPFC
66 INTEGER NRRUN,NSHOW,PATAPE,MONIIN,MONIOU,MDEBUG,NUCNUC,
67 * SHOWNO,ISHW,NOPART,NRECS,NBLKS,MAXPRT,NDEBDL,
68 * N1STTR,MDBASE
69 INTEGER CETAPE
70 CHARACTER*79 DSN
71 CHARACTER*20 HOST,USER
72
73 LOGICAL DEBDEL,DEBUG,FDECAY,FEGS,FIRSTI,FIXINC,FIXTAR,
74 * FIX1I,FMUADD,FNKG,FPRINT,FDBASE
75 * ,GHEISH,GHESIG
76*KEND.
77
78 DOUBLE PRECISION AK,ARG,ARG0,BK,CHIT,DK,ELOSS
79 DOUBLE PRECISION GAMK,GAMNEW,GAMSQ,GAM0,GMSQM1,H0,TH0
80 INTEGER ILAY
81C-----------------------------------------------------------------------
82
83 IF ( DEBUG ) WRITE(MDEBUG,444) ARG,THICKH
84 444 FORMAT(' PRANGE: -LOG(RD)*C*TAU = ',1P,E10.3,' THICKH=',E10.3)
85
86C LOOK WITHIN WHICH LAYER THE PARTICLE STARTS
87 IF ( H .LE. HLAY(2) ) THEN
88 ILAY = 1
89 TH0 = THICKH
90 ELSEIF ( H .LE. HLAY(3) ) THEN
91 ILAY = 2
92 TH0 = THICKH
93 ELSEIF ( H .LE. HLAY(4) ) THEN
94 ILAY = 3
95 TH0 = THICKH
96 ELSE
97 ILAY = 4
98 TH0 = MAX( THICKH, 2.D-4 )
99 ENDIF
100C SET START VALUES FOR ITERATION
101 ARG0 = ARG
102 CHIT = 0.D0
103 GAM0 = GAMMA
104 H0 = H
105
106 2 CONTINUE
107 GAM0 = MAX( GAM0, 1.0001D0 )
108 GAMSQ = GAM0**2
109 GMSQM1 = GAMSQ - 1.D0
110C ENERGY LOSS BY IONIZATION
111 ELOSS = SIGNUM(ITYPE)**2 * C(22) *
112 * ( GAMSQ * (LOG(GMSQM1) + C(23)) / GMSQM1 - 1.D0 )
113 ELOSS = ELOSS / (PAMA(ITYPE) * COSTHE )
114 BK = ELOSS * (TH0 - AATM(ILAY))
115 DK = GAM0 + BK
116 AK = ARG0 * DK * COSTHE * DATM(ILAY)
117 IF ( AK .LT. 174.D0 ) THEN
118C LIMIT FOR EXPONENT (ON IBM COMPUTER)
119 GAMNEW = MAX( GAM0 * DK / ( GAM0 + BK * EXP(AK) ), 1.D0 )
120 ELSE
121 GAMNEW = 1.D0
122 ENDIF
123 GAMK = GAM0 - ELOSS * ( THICKL(ILAY) - TH0)
124 IF ( DEBUG ) WRITE(MDEBUG,*) 'PRANGE: GAMNEW,GAMK=',
125 * SNGL(GAMNEW),SNGL(GAMK)
126C LOOK WETHER PARTICLE PENETRATES LAYER BOUNDARY OR DECAYS BEFORE
127 IF ( GAMNEW .LT. GAMK .AND. ILAY. GT. 1 ) THEN
128C CALCULATE PORTION OF RANGE AND NEW START VALUES AT LAYER BOUNDARY
129 ARG0 = ARG0 - ( H0 - HLAY(ILAY) + CATM(ILAY) * LOG(GAM0/GAMK) )
130 * / (DK * COSTHE)
131 CHIT = CHIT + (THICKL(ILAY) - TH0) / COSTHE
132 GAM0 = GAMK
133 H0 = HLAY(ILAY)
134 TH0 = THICKL(ILAY)
135 ILAY = ILAY - 1
136 GOTO 2
137 ENDIF
138C PENETRATED MATTER THICKNESS
139 CHI = CHIT + (GAM0 - GAMNEW) / (ELOSS*COSTHE)
140 IF ( DEBUG ) WRITE(MDEBUG,445) CHI
141 445 FORMAT(' PRANGE: CHI = ',1P,E10.3)
142
143 RETURN
144 END
Note: See TracBrowser for help on using the repository browser.