Bugfix in AliPoints2Memory
[u/mrichter/AliRoot.git] / GEANT321 / gphys / gdrele.F
1 *
2 * $Id$
3 *
4 * $Log$
5 * Revision 1.1.1.1  1995/10/24 10:21:24  cernlib
6 * Geant
7 *
8 *
9 #include "geant321/pilot.h"
10 *CMZ :  3.21/02 29/03/94  15.41.21  by  S.Giani
11 *-- Author :
12       SUBROUTINE GDRELE(EEL,CHARGE,JMA,DEDX)
13 C.
14 C.    ******************************************************************
15 C.    *                                                                *
16 C.    *       Compute ion losses for electron/positron                 *
17 C.    *                                                                *
18 C.    *    ==>Called by : GDRELA                                       *
19 C.    *       Author    G.Patrick *********                            *
20 C.    *                                                                *
21 C.    ******************************************************************
22 C.
23 #include "geant321/gcbank.inc"
24 #include "geant321/gconsp.inc"
25 #include "geant321/gccuts.inc"
26 C
27       DATA CONS/0.153536E-3/
28 C.
29 C.    ------------------------------------------------------------------
30 C.
31       JPROB=LQ(JMA-4)
32 C
33       GAM=EEL/EMASS + 1.
34       GAM2=GAM*GAM
35       T=GAM-1.
36       DEDX=0.
37       IF(T.LE.0.)GO TO 99
38       TCME=DCUTE/EMASS
39       BET2=1.-1./GAM2
40 C     ------------------------------
41       IF(CHARGE.GT.0.) THEN
42          Y=1./(1.+GAM)
43          D=TCME
44          IF(T.LT.TCME) D=T
45          D2=D*D/2.
46          D3=2.*D2*D/3.
47          D4=D2*D2
48          F=LOG(T*D)-BET2*(T+2.*D-Y*(3.*D2
49      *    +Y*(D-D3+Y*(D2-T*D3+D4))))/T
50 C
51       ELSE
52         D=TCME
53          IF(T.LT.2.*TCME) D=0.5*T
54          F=-1.-BET2+LOG((T-D)*D)+T/(T-D)
55      *    +(0.5*D*D+(1.+2.*T)*LOG(1.-D/T))/GAM2
56       ENDIF
57 C
58       POTL=Q(JPROB+11)
59       FAC=Q(JPROB+12)
60       C=Q(JPROB+13)
61       X0=Q(JPROB+14)
62       X1=Q(JPROB+15)
63       AA=Q(JPROB+16)
64 C
65       X=LOG(GAM2-1.)/4.606
66       DEL=0.
67       IF(X.GT.X0)THEN
68          DEL=4.606*X+C
69          IF(X.LE.X1)DEL=DEL+AA*(X1-X)**3.
70       ENDIF
71 C
72       DEDX=CONS*FAC*(LOG(2.*T+4.)-2.*POTL+F-DEL)/BET2
73       IF(DEDX.LT.0.)DEDX=0.
74 C
75   99  RETURN
76       END