This commit was generated by cvs2svn to compensate for changes in r2,
[u/mrichter/AliRoot.git] / GEANT321 / neutron / micset.F
1 *
2 * $Id$
3 *
4 * $Log$
5 * Revision 1.1.1.1  1995/10/24 10:22:00  cernlib
6 * Geant
7 *
8 *
9 #include "geant321/pilot.h"
10 *CMZ :  3.21/04 23/02/95  14.46.01  by  S.Giani
11 *-- Author :
12       SUBROUTINE MICSET(MATNO,NKEY,CNAME)
13 C***********************************************************************
14 C set a option in MICAP
15 C
16 C INPUT:   MATNO  - GEANT material number
17 C          NKEY   - 0 -> use single isotopes instead of the
18 C                                 natural composition in material MATNO
19 C                   1 -> use natural composition
20 C                   10-> define additional x-section file (MATNO ignored)
21 C          CNAME  - in case NKEY=10 the file name
22 C
23 C************************************************************************
24 C
25 #include "geant321/mmicap.inc"
26 C
27       INTEGER MATNO,NKEY
28       CHARACTER*(*) CNAME
29 C
30       LOGICAL FIRST,FIRST10
31       DATA FIRST/.TRUE./
32       DATA FIRST10/.TRUE./
33 C
34       IF(FIRST.AND.NKEY.LT.10) THEN
35          FIRST = .FALSE.
36          NWW = 100
37          CALL CHKZEB(NWW,IXCONS)
38          CALL MZLINK(IXCONS,'MICPAR',LMIST,LMIST,LMIST)
39          CALL MZBOOK(IXCONS,LMIST,0,2,'MIST',0,0,NWW,0,0)
40       ELSE IF(FIRST10) THEN
41          FIRST10 = .FALSE.
42          NFIL = 101
43          CALL CHKZEB(NFIL,IXCONS)
44          CALL MZLINK(IXCONS,'MICFIL',LMIFIL,LMIFIL,LMIFIL)
45          CALL MZBOOK(IXCONS,LMIFIL,0,2,'MIFL',0,0,NFIL,0,0)
46       ELSE IF(NKEY.EQ.10) THEN
47 C increase the bank for the x-section file name
48         NFIL = 101 + IQ(LMIFIL-1)
49         CALL CHKZEB(NFIL,IXCONS)
50         CALL MZPUSH(IXCONS,LMIFIL,0,101,'I')
51       ENDIF
52       IF(NKEY.LT.10) THEN
53 C store MICAP option for material MATNO in bank 'MIST'
54    10   CONTINUE
55         DO 20 I=1,IQ(LMIST-1),2
56            IF(IQ(LMIST+I).EQ.MATNO) THEN
57               IQ(LMIST+I+1) = NKEY
58               GOTO 30
59            ENDIF
60            IF(IQ(LMIST+I).EQ.0) THEN
61               IQ(LMIST+I) = MATNO
62               IQ(LMIST+I+1) = NKEY
63               GOTO 30
64            ENDIF
65    20   CONTINUE
66 C
67 C  Bank got to small, increase the size
68         NWW = 100 + IQ(LMIST-1)
69         CALL CHKZEB(NWW,IXCONS)
70         CALL MZPUSH(IXCONS,LMIST,0,100,'I')
71         GOTO 10
72       ELSE
73 C store x-section file name in bank 'MIFL'
74 C find the last free index in the bank
75         IF(LNBLNK(CNAME).GT.0) THEN
76           I = LMIFIL+IQ(LMIFIL-1)-100+1
77           CALL UCTOH(CNAME,IQ(I),4,LNBLNK(CNAME))
78           IQ(I-1) = LNBLNK(CNAME)
79         ELSE
80           PRINT*,' MICSET : invalid file name '
81         ENDIF
82       ENDIF
83    30 RETURN
84       END