Some function moved to AliZDC
[u/mrichter/AliRoot.git] / GEANT321 / gstrag / giasho.F
1 *
2 * $Id$
3 *
4 * $Log$
5 * Revision 1.1.1.1  1995/10/24 10:21:37  cernlib
6 * Geant
7 *
8 *
9 #include "geant321/pilot.h"
10 #if defined(CERNLIB_ASHO)
11 *CMZ :  3.21/02 29/03/94  15.41.25  by  S.Giani
12 *-- Author :
13       SUBROUTINE GIASHO
14 #include "geant321/gcbank.inc"
15 #include "geant321/gcmate.inc"
16       DIMENSION E0ELM(100),NSELM(100)
17       DIMENSION ZSELM(7,100),ESELM(7,100)
18       DATA E0ELM /
19      + 0.0204,0.0385,3*0.,0.0738,0.0978,0.1157,0.1248,0.1338,
20      + 3*0.,0.1745,0.1791,2*0.,0.1816,12*0.,0.3018,0.2806,
21      + 0.2906,2*0.,0.3408,12*0.,0.4823,4*0.,0.5088,46*0. /
22       DATA NSELM /
23      + 1,1,3*0,2,2,2,2,2,3*0,3,3,2*0,3,12*0,4,4,4,2*0,4,12*0,
24      + 5,4*0,5,46*0/
25       DATA ZSELM /
26      + 1.,0.,0.,0.,0.,0.,0.,2.,0.,0.,0.,0.,0.,0.,21*0.,
27      + 4.,2.,0.,0.,0.,0.,0.,5.,2.,0.,0.,0.,0.,0.,
28      + 6.,2.,0.,0.,0.,0.,0.,7.,2.,0.,0.,0.,0.,0.,
29      + 8.,2.,0.,0.,0.,0.,0.,21*0.,
30      + 4.,8.,2.,0.,0.,0.,0.,5.,8.,2.,0.,0.,0.,0.,14*0.,
31      + 8.,8.,2.,0.,0.,0.,0.,84*0.,
32      + 3.,18.,8.,2.,0.,0.,0.,4.,18.,8.,2.,0.,0.,0.,
33      + 5.,18.,8.,2.,0.,0.,0.,14*0.,
34      + 8.,18.,8.,2.,0.,0.,0.,84*0.,
35      + 5.,18.,16.,8.,2.,0.,0.,28*0.,
36      + 8.,18.,18.,8.,2.,0.,0.,322*0./
37 *23456789_123456789_123456789_123456789_123456789_123456789_123456789_12
38       DATA ESELM / 0.01360,0.,0.,0.,0.,0.,0.,0.02459,0.,0.,0.,0.,0.,0.,
39      +21*0., 0.01367,0.288,0.,0.,0.,0.,0.,0.01662,0.4030,0.,0.,0.,0.,
40      +0., 0.01742,0.5380,0.,0.,0.,0.,0.,0.02174,0.6940,0.,0.,0.,0.,0.,
41      +0.02643,0.8701,0.,0.,0.,0.,0.,21*0., .01047,.1147,1.844,0.,0.,0.,
42      +0.,.01247,.1467,2.148,0.,0.,0.,0., 14*0.,0.01845,0.2666,3.206,0.,
43      +0.,0.,0.,84*0., 0.00899,0.04480,1.169,10.37,0.,0.,0., 0.01063,
44      +0.06190,1.274,11.11,0.,0.,0., 0.01291,0.07953,1.384,11.87,0.,0.,
45      +0.,14*0., 0.01676,0.1412,1.750,14.33,0.,0.,0.,84*0., 0.00720,
46      +0.04012,0.5682,3.908,27.93,0.,0.,28*0., 0.01466,0.1006,0.8097,
47      +5.030,34.570,0.,0.,322*0./
48 *
49 *-----------------------------------------------------------------------
50 *
51       DIMENSION ZSMED(50),ESMED(50)
52 C-----------------------------------------------------------------------
53 C
54       JMA   = LQ(JMATE-NMAT)
55       JMIXT = LQ(JMA-5)
56       NCOMP = ABS(Q(JMA+11))
57       AMED = 0.
58       ZMED = 0.
59       E0CAL = 0.   !Sum of Z(i)*log(I(i))
60       E0MED = 0.
61       NSMED = 0
62  
63       DO 20 I = 1,NCOMP
64          IF(NCOMP.GT.1) THEN
65             IZ = Q(JMIXT+NCOMP+I)+0.5
66             WEIGHT = Q(JMIXT+2*NCOMP+I)/Q(JMIXT+I)
67             E0MED = E0MED + Q(JMIXT+NCOMP+I)*WEIGHT*LOG(E0ELM(IZ))
68             ZMED = ZMED + Q(JMIXT+NCOMP+I)*WEIGHT
69             AMED = AMED + Q(JMIXT+I)*WEIGHT
70          ELSE
71             IZ = Z+0.5
72             E0MED = E0ELM(IZ)
73             ZMED = Z
74             AMED = A
75          ENDIF
76          DO 10 J = 1,NSELM(IZ)
77             NSMED = NSMED + 1
78             IF(NCOMP.GT.1) THEN
79                ZSMED(NSMED) = ZSELM(J,IZ)*WEIGHT
80             ELSE
81                ZSMED(NSMED) = ZSELM(J,IZ)
82             ENDIF
83             ESMED(NSMED) = ESELM(J,IZ)
84             E0CAL = E0CAL + ZSMED(NSMED)*LOG(ESELM(J,IZ))
85    10    CONTINUE
86    20 CONTINUE
87       IF (NCOMP.GT.1) E0MED = EXP(E0MED/ZMED)
88       E0CAL = EXP(E0CAL/ZMED)
89       ALFA = E0MED/E0CAL
90 C-----------------------------------------------------------------------
91 C      The following sets ZSMED and ESMED in the order of increase
92 C      of ESMED.
93 C-----------------------------------------------------------------------
94       DO 40 I = 1,NSMED - 1
95          IMIN = I
96          EMIN = ESMED(I)
97          DO 30 J = I + 1,NSMED
98             IF (EMIN.LE.ESMED(J)) GOTO 30
99             EMIN = ESMED(J)
100             IMIN = J
101    30    CONTINUE
102          IF (I.EQ.IMIN) GOTO 40
103          X = ESMED(I)
104          Y = ZSMED(I)
105          ESMED(I) = ESMED(IMIN)
106          ZSMED(I) = ZSMED(IMIN)
107          ESMED(IMIN) = X
108          ZSMED(IMIN) = Y
109    40 CONTINUE
110 C-----------------------------------------------------------------------
111 C      The following combines the first smallest oscillators whose
112 C      integer relative potentials are equal to 1.
113 C-----------------------------------------------------------------------
114       ZMIN = 0.
115       EMIN = 0.
116       IMIN = 1
117       DO 50 I = 1,NSMED
118          J = ESMED(I)/ESMED(1) + 0.5
119          IF (J.GT.1) GOTO 60
120          ZMIN = ZMIN + ZSMED(I)
121          EMIN = EMIN + ZSMED(I)*LOG(ESMED(I))
122          IMIN = I
123    50 CONTINUE
124    60 ESMED(1) = EXP(EMIN/ZMIN)
125       ZSMED(1)        = ZMIN
126       DO 70 I = IMIN + 1,NSMED
127          ZSMED(I - IMIN + 1) = ZSMED(I)
128          ESMED(I - IMIN + 1) = ESMED(I)
129    70 CONTINUE
130       NSMED = NSMED - IMIN + 1
131       JASHO = LQ(JMA-20)
132 *
133 * *** Store parameters of ASHO in material bank 20
134       Q(JASHO+1) = NSMED
135       Q(JASHO+2) = ZMED
136       Q(JASHO+3) = AMED
137       Q(JASHO+4) = ALFA
138       Q(JASHO+5) = E0MED
139       DO 80 KMED=1,NSMED
140          Q(JASHO+5+KMED) = ZSMED(KMED)
141          Q(JASHO+5+NSMED+KMED) = ESMED(KMED)
142    80 CONTINUE
143       NLEFT = 2*NSMED - 100
144       CALL MZPUSH(IXCONS,JASHO,0,NLEFT,'I')
145       END
146 #endif