1 *
2 * \$Id\$
3 *
4 * \$Log\$
5 * Revision 1.1.1.1  1995/10/24 10:21:33  cernlib
6 * Geant
7 *
8 *
9 #include "geant321/pilot.h"
10 #if defined(CERNLIB_NEVER)
11 *CMZ :  3.21/02 29/03/94  15.41.23  by  S.Giani
12 *-- Author :
13       SUBROUTINE GRANGI
14 C.
15 C.    ******************************************************************
16 C.    *                                                                *
17 C.    *  Calculates the stopping range , in cm.                        *
18 C.    *     (i.e. the maximum step due to the continuous energy loss)  *
19 C.    *      The stopping range is the integral of the inverse of the  *
20 C.    *      DE/DX table.                                              *
21 C.    *     There are 4 tables : electron,positron,muon,proton         *
22 C.    *                                                                *
23 C.    *    ==>Called by : GPHYSI                                       *
24 C.    *       Author      M.Maire   *********                          *
25 C.    *                                                                *
26 C.    ******************************************************************
27 C.
28 #include "geant321/gcbank.inc"
29 #include "geant321/gctrak.inc"
30 #include "geant321/gcjloc.inc"
31 #include "geant321/gcmulo.inc"
32 #include "geant321/gconsp.inc"
33 #include "geant321/gcmate.inc"
34 *
35       DO 50 IEKBIN=1,NEK1
36 *
37 * *** Electrons
38 *
39          JLOSS = LQ(JMA-1)
40          JRANG = LQ(JMA-15)
41          IF (Z.LT.1.) THEN
42             Q(JRANG+IEKBIN) = BIG
43          ELSE IF ((IEKBIN.EQ.1).OR.(Q(JLOSS+IEKBIN-1).LE.0.)) THEN
44             Q(JRANG+IEKBIN) = 0.
45          ELSE
46             DEBIN=ELOW(IEKBIN) - ELOW(IEKBIN-1)
47             FRACT= Q(JLOSS+IEKBIN)/Q(JLOSS+IEKBIN-1) - 1.
48             IF (ABS(FRACT).GE.0.1) THEN
49                DRANG=DEBIN/(Q(JLOSS+IEKBIN)-Q(JLOSS+IEKBIN-1))
50                DRANG=DRANG*LOG(1.+FRACT)
51             ELSE
52                DRANG=DEBIN/Q(JLOSS+IEKBIN-1)
53                DRANG= DRANG*(1. - 0.5*FRACT + 0.3333*FRACT*FRACT)
54             ENDIF
55             Q(JRANG+IEKBIN)=Q(JRANG+IEKBIN-1) + DRANG
56          ENDIF
57 *
58 * *** Positons
59 *
60          JLOSS = LQ(JMA-1) + NEK1
61          JRANG = LQ(JMA-15) + NEK1
62          IF (Z.LT.1.) THEN
63             Q(JRANG+IEKBIN) = BIG
64          ELSE IF ((IEKBIN.EQ.1).OR.(Q(JLOSS+IEKBIN-1).LE.0.)) THEN
65             Q(JRANG+IEKBIN) = 0.
66          ELSE
67             DEBIN=ELOW(IEKBIN) - ELOW(IEKBIN-1)
68             FRACT= Q(JLOSS+IEKBIN)/Q(JLOSS+IEKBIN-1) - 1.
69             IF (ABS(FRACT).GE.0.1) THEN
70                DRANG=DEBIN/(Q(JLOSS+IEKBIN)-Q(JLOSS+IEKBIN-1))
71                DRANG=DRANG*LOG(1.+FRACT)
72             ELSE
73                DRANG=DEBIN/Q(JLOSS+IEKBIN-1)
74                DRANG= DRANG*(1. - 0.5*FRACT + 0.3333*FRACT*FRACT)
75             ENDIF
76             Q(JRANG+IEKBIN)=Q(JRANG+IEKBIN-1) + DRANG
77          ENDIF
78 *
79 * *** Muons
80 *
81          JLOSS = LQ(JMA-2)
82          JRANG = LQ(JMA-16)
83          IF (Z.LT.1.) THEN
84             Q(JRANG+IEKBIN) = BIG
85          ELSE IF ((IEKBIN.EQ.1).OR.(Q(JLOSS+IEKBIN-1).LE.0.)) THEN
86             Q(JRANG+IEKBIN) = 0.
87          ELSE
88             DEBIN=ELOW(IEKBIN) - ELOW(IEKBIN-1)
89             FRACT= Q(JLOSS+IEKBIN)/Q(JLOSS+IEKBIN-1) - 1.
90             IF (ABS(FRACT).GE.0.1) THEN
91                DRANG=DEBIN/(Q(JLOSS+IEKBIN)-Q(JLOSS+IEKBIN-1))
92                DRANG=DRANG*LOG(1.+FRACT)
93             ELSE
94                DRANG=DEBIN/Q(JLOSS+IEKBIN-1)
95                DRANG= DRANG*(1. - 0.5*FRACT + 0.3333*FRACT*FRACT)
96             ENDIF
97             Q(JRANG+IEKBIN)=Q(JRANG+IEKBIN-1) + DRANG
98          ENDIF
99 *
100 * *** Protons
101 *
102          JLOSS = LQ(JMA-3)
103          JRANG = LQ(JMA-16) + NEK1
104          IF (Z.LT.1.) THEN
105             Q(JRANG+IEKBIN) = BIG
106          ELSE IF ((IEKBIN.EQ.1).OR.(Q(JLOSS+IEKBIN-1).LE.0.)) THEN
107             Q(JRANG+IEKBIN) = 0.
108          ELSE
109             DEBIN=ELOW(IEKBIN) - ELOW(IEKBIN-1)
110             FRACT= Q(JLOSS+IEKBIN)/Q(JLOSS+IEKBIN-1) - 1.
111             IF (ABS(FRACT).GE.0.1) THEN
112                DRANG=DEBIN/(Q(JLOSS+IEKBIN)-Q(JLOSS+IEKBIN-1))
113                DRANG=DRANG*LOG(1.+FRACT)
114             ELSE
115                DRANG=DEBIN/Q(JLOSS+IEKBIN-1)
116                DRANG= DRANG*(1. - 0.5*FRACT + 0.3333*FRACT*FRACT)
117             ENDIF
118             Q(JRANG+IEKBIN)=Q(JRANG+IEKBIN-1) + DRANG
119          ENDIF
120    50 CONTINUE
121 *
122       END
123 #endif