5 * Revision 1.1.1.1 1995/10/24 10:21:25 cernlib
9 #include "geant321/pilot.h"
10 *CMZ : 3.21/04 22/02/95 10.38.36 by S.Giani
12 SUBROUTINE GLANDZ(Z,STEP,P,E,DEDX,DE,POTI,POTIL)
14 C. ******************************************************************
16 C. * Energy straggling using a Monte Carlo model. *
17 C. * It can be used with or without delta ray generation. *
19 C. * It is a NEW VERSION of the model , which reproduces *
20 C. * the experimental data rather well. *
22 C. * Input : STEP = current step-length (cm) *
24 C. * Output: DE = actual energy loss (Gev) *
25 C. * ( NOT the fluctuation DE/DX-<DE/DX> !) *
27 C. * ==> Called by : GTELEC,GTHADR,GTMUON *
29 C. * Author : L.Urban *
30 C. * Date : 28.04.1988 Last update : 1.02.90 *
32 C. ******************************************************************
34 #include "geant321/gconsp.inc"
35 #include "geant321/gcflag.inc"
36 #include "geant321/gckine.inc"
37 #include "geant321/gccuts.inc"
38 PARAMETER (MAXRND=100)
39 DIMENSION RNDM(MAXRND),APOIS(3),NPOIS(3),FPOIS(3)
40 #if !defined(CERNLIB_SINGLE)
41 DOUBLE PRECISION E1,E2,P2,B2,BG2,TM,DEC,W,WW,WWW,RR
42 DOUBLE PRECISION X,AK,ALFA,EA,SA,AKL,REALK,FPOIS
43 DOUBLE PRECISION ONE,HALF,ZERO
44 PARAMETER (HMXINT=2**30)
46 #if defined(CERNLIB_SINGLE)
47 PARAMETER (HMXINT=2**45)
49 PARAMETER (ONE=1,HALF=ONE/2,ZERO=0)
50 PARAMETER (RCD=0.40, RCD1=1.-RCD, PROBLM=0.01)
51 PARAMETER( C1=4, C2=16)
53 * ------------------------------------------------------------------
67 E1L= (POTIL-F2*E2L)/F1
76 IF(CHARGE.LT.0.) TM=TM/2.
78 IF(TM.GT.DCUTE) TM=DCUTE
80 TM=EMASS*P2/(0.5*AMASS*AMASS+EMASS*E)
82 IF(TM.GT.DCUTM) TM=DCUTM
86 * *** Protection against negative TM ---------------------
87 * TM can be negative only for heavy particles with a very
88 * low kinetic energy (e.g. for proton with T 100-300 kev)
95 CSB=STEP*RCD1*DEDX/(WL-POTIL-B2)
96 APOIS(1)=CSB*F1*(WL-E1L-B2)/E1
97 APOIS(2)=CSB*F2*(WL-E2L-B2)/E2
100 APOIS(3)=RCD*DEDX*STEP*TM/(POTI*W*LOG(WW))
102 APOIS(1)=APOIS(1)/RCD1
103 APOIS(2)=APOIS(2)/RCD1
107 * calculate the probability of the zero energy loss
109 APSUM=APOIS(1)+APOIS(2)+APOIS(3)
112 ELSEIF(APSUM.LT.50.) THEN
119 * do it differently if prob > problm <====================
120 IF(PROB.GT.PROBLM) THEN
124 * excitation only ....
127 CALL GPOISS(APOIS,NPOIS,1)
132 * ionization only ....
134 APOIS(1)=EMEAN*(EM-E0)/(EM*E0*LOG(EM/E0))
135 CALL GPOISS(APOIS,NPOIS,1)
141 IF(NN.GT.MAXRND) THEN
142 RCORR=FLOAT(NN)/MAXRND
149 DE=DE+E0/(1.-W*RNDM(I))
158 IF(MAX(APOIS(1),APOIS(2),APOIS(3)).LT.HMXINT) THEN
159 CALL GPOISS(APOIS,NPOIS,3)
165 IF(APOIS(JPOIS).LT.HMXINT) THEN
166 CALL GPOISS(APOIS(JPOIS),NPOIS(JPOIS),1)
167 FPOIS(JPOIS)=NPOIS(JPOIS)
170 FPOIS(JPOIS)=ABS(SQRT(-2.*LOG(RNDM(1)*ONE)
171 + *APOIS(JPOIS))*SIN(TWOPI*RNDM(2)*ONE)+APOIS(JPOIS))
177 * Now we have all three numbers in REAL/DOUBLE
178 * variables. REALK is actually an INTEGER that now may
179 * exceed the machine representation limit for integers.
181 DE=FPOIS(1)*E1+FPOIS(2)*E2
183 * smear to avoid peaks in the energy loss (note: E1<<E2)
187 DE=DE+E1*(1.-2.*RNDM(1))
200 RR=SQRT(-2.*LOG(RNDM(1)))
204 ALFA=WW*(C2+ANC)/(C2*WW+ANC)
205 EA=AK*POTI*ALFA*LOG(ALFA)/(ALFA-1.)
206 SA=SQRT(ABS(AK*ALFA*POTI*POTI-EA*EA/AK))
211 REALK=AK+HALF-MOD(AK+HALF,ONE)
216 NN=NINT(FPOIS(3)-REALK)
217 IF(NN.GT.MAXRND) THEN
221 * Here we take a gaussian distribution to avoid loosing
222 * too much time in computing
225 SIGMA =SQRT(NN*(1./(1.-W)-AVERAG**2))
227 DEC = DEC+WW*(NN*AVERAG+SIGMA*SQRT(-2.*LOG(RNDM(1)))*
228 + SIN(TWOPI*RNDM(2)))
235 DEC=DEC+WW/(1.-W*RNDM(I))