Bugfix in AliPoints2Memory
[u/mrichter/AliRoot.git] / GEANT321 / gdraw / gdtr2.F
CommitLineData
fe4da5cc 1*
2* $Id$
3*
4* $Log$
5* Revision 1.1.1.1 1995/10/24 10:20:28 cernlib
6* Geant
7*
8*
9#include "geant321/pilot.h"
10*CMZ : 3.21/02 29/03/94 15.41.27 by S.Giani
11*-- Author :
12 SUBROUTINE GDTR2(IROOT,JMAX,LEVMAX,IER)
13C.
14C. ******************************************************************
15C. * *
16C. * Scan all JVOLUM structure *
17C. * *
18C. * IROOT = root of the tree to be built up (input) *
19C. * JMAX = total number of nodes (output) *
20C. * LEVMAX = maximum number of levels to be scanned *
21C. * IER = error flag to detect nodes overflow (output) *
22C. * *
23C. * ==>Called by : GDTR0 *
24C. * Authors : P.Zanarini, S.Banerjee ********* *
25C. * *
26C. ******************************************************************
27C.
28#include "geant321/gcdraw.inc"
29#include "geant321/gcunit.inc"
30#include "geant321/gcbank.inc"
31#include "geant321/gcnum.inc"
32C.
33C. ------------------------------------------------------------------
34C.
35 IER=0
36C
37 IQ(JNAM+1)=IROOT
38 IQ(JMOT+1)=0
39 IQ(JBRO+1)=0
40 J=1
41 JMAX=1
42 LNOD=1
43 LMAX=1
44 10 CONTINUE
45 IF (IQ(JSCA+J).EQ.0) THEN
46 CALL GDTR1(J,JMAX,JNEW,IER)
47 IF (IER.NE.0) GO TO 999
48C
49C Fill array IQ(JDVM+I) for multiplicity by divisioning
50C
51 JJ=IQ(JMOT+J)
52 IF (JJ.EQ.0) THEN
53 IQ(JDVM+J)=0
54 ELSE
55 IVO=IUCOMP(IQ(JNAM+JJ),IQ(JVOLUM+1),NVOLUM)
56 JVO=LQ(JVOLUM-IVO)
57 NIN=Q(JVO+3)
58 IF (NIN.LT.0) THEN
59 JIN=LQ(JVO-1)
60 IQ(JDVM+J)=ABS(Q(JIN+3))
61 ELSE
62 IQ(JDVM+J)=0
63 ENDIF
64 ENDIF
65C
66 JMAX=MAX(JMAX,JNEW)
67 IF (JMAX.GT.MAXNOD) GO TO 20
68 ENDIF
69 J=J+1
70*
71*** IF (J.LE.JMAX) GO TO 10
72*
73 IF (J.LE.LMAX) THEN
74 GO TO 10
75 ELSE
76 LNOD=LNOD+1
77 IF (LNOD.GT.LEVMAX.AND.LEVMAX.GT.0) GO TO 999
78 LMAX=JMAX
79 IF (J.LE.JMAX) GO TO 10
80 ENDIF
81*
82 GO TO 999
83 20 WRITE (CHMAIL,1000) MAXNOD
84 CALL GMAIL(0,0)
85 IER=1
86 1000 FORMAT (' GDTR2 : MAXNOD = ',I5,' - TREE OVERFLOW')
87 999 RETURN
88 END