5 * Revision 1.1.1.1 1995/10/24 10:20:11 cernlib
9 #include "geant321/pilot.h"
10 #if defined(CERNLIB_OLD)
11 *CMZ : 3.21/02 29/03/94 15.41.19 by S.Giani
15 C. ******************************************************************
17 C. * Closes off the geometry setting. *
18 C. * Initializes the search list for the contents of each *
19 C. * volume following the order they have been positioned, and *
20 C. * inserting the content '0' when a call to GSNEXT (-1) has *
21 C. * been required by the user. *
22 C. * Performs the development of the JVOLUM structure for all *
23 C. * volumes with variable parameters, by calling GGDVLP. *
24 C. * Interprets the user calls to GSORD, through GGORD. *
25 C. * Computes and stores in a bank (next to JVOLUM mother bank) *
26 C. * the number of levels in the geometrical tree and the *
27 C. * maximum number of contents per level, by calling GGNLEV. *
28 C. * Sets status bit for CONCAVE volumes, through GGCAVE. *
29 C. * Completes the JSET structure with the list of volume names *
30 C. * which identify uniquely a given physical detector, the *
31 C. * list of bit numbers to pack the corresponding volume copy *
32 C. * numbers, and the generic path(s) in the JVOLUM tree, *
33 C. * through the routine GHCLOS. *
35 C. * Called by : <USER> *
36 C. * Authors : R.Brun, F.Bruyant ********* *
38 C. * Modified by S.Egli at 15.9.90: automatic sorting of volumes *
39 C * done by calling GGORDQ for each volume *
40 C. ******************************************************************
42 #include "geant321/gcbank.inc"
43 #include "geant321/gcflag.inc"
44 #include "geant321/gclist.inc"
45 #include "geant321/gcnum.inc"
46 #include "geant321/gcunit.inc"
47 #include "geant321/gcopti.inc"
51 C. ------------------------------------------------------------------
54 * *** Stop the run in case of serious anomaly during initialization
63 WRITE (CHMAIL, 1002) NVOLUM
68 NPUSH = NVOLUM -IQ(JVOLUM-2)
69 CALL MZPUSH (IXCONS, JVOLUM, NPUSH, NPUSH,'I')
71 * *** Loop over volumes, create default JNear banks as relevant,
72 * and release unused bank space
78 * *** Check if Tracking medium has been defined
81 IF(NMED.LE.0.OR.NMED.GT.IQ(JTMED-2))THEN
82 WRITE(CHMAIL,1003)IQ(JVOLUM+IVO)
85 IF(LQ(JTMED-NMED).EQ.0)THEN
86 WRITE(CHMAIL,1003)IQ(JVOLUM+IVO)
90 IF (BTEST(IQ(JVO),0)) GO TO 80
92 IQ(JVO) = IBSET(IQ(JVO),0)
97 * reserve enough additional space for sorted volumes
98 IF(NIN.LE.1.OR.NIN.GT.500.OR.IOPTIM.LT.0)THEN
106 DO 90 IN=NINL,NUSED+1,-1
109 CALL MZDROP(IXCONS,JIN,'L')
112 CALL MZPUSH (IXCONS, JVO, NPUSH, 0, 'I')
113 IF (NIN.LE.0) GO TO 80
115 IF(BTEST(IQ(JVO),3)) THEN
123 CALL MZBOOK (IXCONS,JN,JVO,-NIN-1,'VONE',0,0,NEL+1,2,0)
131 IF (IZERO.NE.0) IQ(JN+1) = 0
137 * *** Perform development of JVOLUM structure where necessary
141 * *** Fill GSORD ordering banks if required
143 * Modified by S.Egli to allow GGORDQ to find the optimum sorting for
147 WRITE(6,'(A)')' GGCLOS: Start automatic volume ordering:'
153 IF(ISEARC.GT.0) GO TO 91
154 * check if sorting not possible or not wanted
155 IF(NIN.LE.1.OR.NIN.GT.500.OR.IOPTIM.LT.0)THEN
157 IF(NIN.GT.500.AND.IOPTIM.GE.1)THEN
158 CALL UHTOC(IQ(JVOLUM+IVO),4,NAME,4)
159 WRITE (CHMAIL,1004) NAME,NIN
162 ELSEIF(IOPTIM.EQ.0)THEN
163 IF(ISEARC.LT.0)CALL GGORD (IVO)
164 ELSEIF(IOPTIM.EQ.1)THEN
175 * *** Set status bit for concave volumes
179 * *** Compute maximum number of levels and of contents per level
185 * *** Scan the volume structure to retrieve the path through
186 * the physical tree for all sensitive detectors
190 * *** Books STAT banks if data card STAT is submitted
192 IF (NSTAT.GT.0) CALL GBSTAT
194 CALL MZGARB (IXCONS, 0)
196 1001 FORMAT (' Severe diagnostic in initialization phase. STOP')
197 1002 FORMAT (' GGCLOS : NVOLUM =',I5,' *****')
198 1003 FORMAT (' Illegal tracking medium number in volume : ',A4)
199 1004 FORMAT (' GGORDQ : Volume ',A4,' has more than 500 (',
200 + I3,') daughters ; volume sorting not possible !')