Some function moved to AliZDC
[u/mrichter/AliRoot.git] / GEANT321 / gstrag / gstini.F
1 *
2 * $Id$
3 *
4 * $Log$
5 * Revision 1.1.1.1  1995/10/24 10:21:39  cernlib
6 * Geant
7 *
8 *
9 #include "geant321/pilot.h"
10 *CMZ :  3.21/02 29/03/94  15.41.25  by  S.Giani
11 *-- Author :
12       SUBROUTINE GSTINI
13 C.
14 C.    ******************************************************************
15 C.    *                                                                *
16 C.    *   Initialization of tables for energy loss straggling in       *
17 C.    *   thin gas layers                                              *
18 C.    *                                                                *
19 C.    *   ==> Called by : GPHYSI                                       *
20 C.    *       Authors   : K. Lassila-Perini, I. Gavrilenko, P. Nevski  *
21 C.    *                                                                *
22 C.    ******************************************************************
23 C.
24 #include "geant321/gcbank.inc"
25 #include "geant321/gccuts.inc"
26 #include "geant321/gcjloc.inc"
27 #include "geant321/gcmate.inc"
28 #include "geant321/gcstra.inc"
29 C...
30       DIMENSION GAMTT(21),FN(300),EN(300)
31       DIMENSION ENOLD(300)
32 C...
33       DATA GAMTT
34      +  /     1.1 ,     1.2 ,     1.3 ,     1.5 ,     1.8 ,
35      +        2.0 ,     2.5 ,     3.0 ,     4.0 ,     7.0 ,
36      +       10.0 ,    20.0 ,    40.0 ,    70.0 ,   100.0 ,
37      +      300.0 ,   600.0 ,  1000.0 ,  3000.0 , 10000.0 ,
38      +    50000.0 /
39 C...
40       DO 10 I=1,21
41          GAMLOG(I) = LOG(GAMTT(I))
42    10 CONTINUE
43 *
44       JPHXS = LQ(JPHOT-1)
45 * NZ = number of elements in the cross-section bank
46       NZ    = Q(JPHXS+1)
47 * NI = number of intervals
48       NI    = Q(JPHXS+2+3*NZ)
49       NFACT = 140/NI
50       EMAX  = LOG(DCUTE*1E9)
51       DO 30 NNP = 1,NI
52          EM(NNP) = LOG(1E3*Q(JPHXS+2+3*NZ+1+(NNP-1)*5))
53          IF (NNP.NE.NI) THEN
54             EM2 = LOG(1E3*Q(JPHXS+2+3*NZ+1+NNP*5))
55          ELSE
56             EM2 = EMAX
57          ENDIF
58          EESTE = (EM2-EM(NNP))/NFACT
59          DO 20 NPNP=1,NFACT
60             EMM((NNP-1)*NFACT+NPNP) = EM(NNP) + (NPNP-1)*EESTE
61             IF (NPNP.EQ.1.AND.NNP.NE.1)
62      +        EMM((NNP-1)*NFACT+NPNP) = EM(NNP) + .3*EESTE
63             IF (EMM((NNP-1)*NFACT+NPNP).GT.EMAX) THEN
64                NP = (NNP-1)*NFACT+NPNP -1
65                GOTO 40
66             ENDIF
67    20    CONTINUE
68    30 CONTINUE
69    40 EPS   = .001
70 *
71       CALL GSTXIN
72 *
73 *
74 * Create and fill the banks. The number of intervals is decreased
75 * in GSTTAB. It is supposed that the EN vector is the same for
76 * every GAM, if not en error message is printed.
77 *
78       DO 80 I = 1,21
79          GAM = GAMTT(I)
80          CALL GSTTAB(GAM,NT,EN,FN)
81          IF (I.EQ.1) THEN
82             CALL MZBOOK(IXCONS,JTSTCO,JTSTRA,-1,'STCO',0,0,NT*21,3,-1)
83             CALL MZBOOK(IXCONS,JTSTEN,JTSTRA,-2,'STEN',0,0,NT,3,-1)
84             DO 50 II=1,NT
85                ENOLD(II) = EN(II)
86    50       CONTINUE
87          ELSE
88             DO 60 III=1,NT
89                IF (ENOLD(III).NE.EN(III)) PRINT *,'ERROR in GSTINI     '
90      +         //'              (straggling): Energy vector EN is '
91      +         //'changing in GSTTAB'
92    60       CONTINUE
93          ENDIF
94          DO 70 J=1,NT
95             Q(JTSTCO+(J-1)*21+I) = FN(NT+1-J)
96    70    CONTINUE
97    80 CONTINUE
98 *
99 * ***
100       DO 90 J=1,NT
101          Q(JTSTEN+J) = EN(NT+1-J)
102    90 CONTINUE
103 *
104       NNWE = 0
105       DO 110 J=1,NT
106          DO 100 I=1,21
107             ANL1 = Q(JTSTCO+(J-1)*21+I)
108             IF(ANL1.LE.0.) THEN
109                GO TO 120
110             ENDIF
111             Q(JTSTCO+(J-1)*21+I) = LOG(ANL1)
112   100    CONTINUE
113          NNWE = NNWE+1
114   110 CONTINUE
115   120 Q(JTSTRA+1) = NNWE
116 *
117       END