This commit was generated by cvs2svn to compensate for changes in r2,
[u/mrichter/AliRoot.git] / GEANT321 / fluka / tchoic.F
1 *
2 * $Id$
3 *
4 * $Log$
5 * Revision 1.1.1.1  1995/10/24 10:20:01  cernlib
6 * Geant
7 *
8 *
9 #include "geant321/pilot.h"
10 *CMZ :  3.21/02 29/03/94  15.41.44  by  S.Giani
11 *-- Author :
12 *$ CREATE TCHOIC.FOR
13 *COPY TCHOIC
14 *
15 *=== tchoic ===========================================================*
16 *
17       SUBROUTINE TCHOIC(T,P,PP,E,EE,I,II,N,AM1,AM2)
18  
19 #include "geant321/dblprc.inc"
20 #include "geant321/dimpar.inc"
21 #include "geant321/iounit.inc"
22 C     ****************************
23 C     TCHOIC CALCULATES A RANDOM VALUE
24 C     FOR THE FOUR-MOMENTUM-TRANSFER T
25 C     ****************************
26       COMMON /FKGAMR/ REDU,AMO,AMM(15 )
27       COMMON/FKABLT/AM(110),GA(110),TAU(110),ICH(110)
28      *,IBAR(110),K1(110),K2(110)
29       COMMON/FKSLOP/SM(25),BBM(25),BBB(25)
30       REAL RNDM(1)
31       AMA=AM1
32       AMB=AM2
33       IF (I.GT.30.AND.II.GT.30) GO TO 1
34       III=II
35       AM3=AM2
36       IF (I.LE.30) GO TO 11
37       III=I
38       AM3=AM1
39    11 CONTINUE
40       GO TO 10
41     1 CONTINUE
42       III=II
43       AM3=AM2
44       IF (AMA.LE.AMB) GO TO 10
45       III=I
46       AM3=AM1
47    10 CONTINUE
48       IB=IBAR(III)
49       AMA=AM3
50       K=(AMA-0.75D0)/0.05D0
51       IF (K-2.LT.0) K=1
52       IF (K-26.GE.0) K=25
53       IF (IB)21,22,21
54    22 BM=BBM(K)
55       GO TO 23
56    21 BM=BBB(K)
57    23 CONTINUE
58 C     NORMALIZATION
59       TMIN=-2.D0*(E*EE-P*PP)+AM(N)**2+AM1  **2
60       TMAX=-2.D0*(E*EE+P*PP)+AM(N)**2+AM1  **2
61       CALL GRNDM(RNDM,1)
62       VB = RNDM(1)
63       IF (VB.LT.0.2D0) BM=BM*0.1D0
64      **0.5D0
65       TMI=BM*TMIN
66       TMA=BM*TMAX
67       ETMA=0.D0
68       IF (ABS(TMA).GT.120.D0) GO TO 100
69       ETMA=EXP(TMA)
70   100 CONTINUE
71       AN=(1.D0/BM)*(EXP(TMI)-ETMA)
72 C*** RANDOM CHOICE OF THE T - VALUE
73       CALL GRNDM(RNDM,1)
74       R = RNDM(1)
75       T=(1.D0/BM)*LOG(ETMA+R*AN*BM)
76       RETURN
77       END