Bugfix in AliPoints2Memory
[u/mrichter/AliRoot.git] / GEANT321 / gdraw / gdprtr.F
CommitLineData
fe4da5cc 1*
2* $Id$
3*
4* $Log$
d43b40e2 5* Revision 1.1.1.1 1999/05/18 15:55:03 fca
6* AliRoot sources
7*
fe4da5cc 8* Revision 1.1.1.1 1995/10/24 10:20:23 cernlib
9* Geant
10*
11*
12#include "geant321/pilot.h"
13*CMZ : 3.21/04 10/01/95 16.43.07 by S.Giani
14*-- Author :
15 SUBROUTINE GDPRTR(NAME,YLEV,XLEV,SIZE,FACHV,
16 +IDUP,IDRAW,IONL,IDET,ISEEN)
17C.
18C. ******************************************************************
19C. * *
20C. * Draws a box centered in (XLEV,YLEV) of size SIZE. *
21C. * On the top half box draws its name NAME and, if IDUP<>1, *
22C. * on the bottom half draw IDUP preceded by a symbol *
23C. * (IDUP<0 means division, IDUP>1 means multiple position, *
24C. * IDUP=1 means single position). *
25C. * If IDRAW=1 then over the box draws a normal-view of *
26C. * volume NAME (with same seen attributes set by GDSPEC). *
27C. * If IONL<>1 then draw two other boxes, slightly shifted, *
28C. * behind the original one. *
29C. * If IDET=1 then draw another box, slightly larger, *
30C. * around the original one. *
31C. * If ISEEN=0 then draw the box(es) with dashed lines. *
32C. * *
33C. * ==>Called by : GDTREE *
34C. * Author : P.Zanarini ; S.Giani ********* *
35C. * *
36C. ******************************************************************
37C.
38#include "geant321/gcbank.inc"
39#include "geant321/gcnum.inc"
40#include "geant321/gcdraw.inc"
41 DIMENSION X(5),Y(5)
42 DIMENSION NAMT0(16),NAM0(4)
d43b40e2 43 DIMENSION PAR(100)
fe4da5cc 44 DIMENSION NNDM(14),INDM(4,14)
45 DIMENSION ATT(10)
46 CHARACTER*4 NAME,NAMSEE,ISON
47 CHARACTER*14 CHNAM0
48 SAVE NNDM,INDM
49 COMMON/NPILEV/NPILE
50C
51 DATA NNDM/0,0,0,4,0,2,0,2,4,3,4,3,0,0/
52 DATA INDM/0,0,0,0, 0,0,0,0, 0,0,0,0, 2,3,7,11, 0,0,0,0,
53 + 4,5,0,0, 0,0,0,0, 6,7,0,0, 3,4,5,6, 4,5,6,0,
54 + 1,2,3,4, 1,2,3,0, 0,0,0,0, 0,0,0,0/
55C.
56C. ------------------------------------------------------------------
57C.
58 IF (ISEEN.EQ.0) THEN
59 LINSTY=4
60 ELSE
61 LINSTY=1
62 ENDIF
63 CALL MVBITS(LINSTY,0,3,LINATT,10)
64C
65C Compute box vertex
66C
67 SIZ2=SIZE/2.
68 SIZ4=SIZE/4.
69 SIZ8=SIZE/8.
70*** X(1)=XLEV-SIZ2
71 X(1)=XLEV-(SIZ2*2.*FACHV)
72 X(2)=X(1)
73*** X(3)=XLEV+SIZ2
74 X(3)=XLEV+(SIZ2*2.*FACHV)
75 X(4)=X(3)
76 X(5)=X(1)
77 Y(1)=YLEV+SIZ2
78 Y(2)=YLEV-SIZ2
79 Y(3)=Y(2)
80 Y(4)=Y(1)
81 Y(5)=Y(1)
82C
83C Draw box
84C
85 IWTY=IGIWTY(1)
86 CALL IGQWK(0,'HWCO',R)
87 IF(IWTY.GT.10.OR.IWTY.LT.1.OR.R.EQ.2.)THEN
88 LINCOL=1
89 CALL MVBITS(LINCOL,0,8,LINATT,16)
90 CALL GDRAWV(X,Y,5)
91 ELSE
92 CALL IGSET('LWID',1.)
93 CALL UCTOH(NAME,IIIN,4,4)
94 CALL IGPID(1,'Tree',IIIN,' ')
95 CALL IGPAVE(X(1),X(3),Y(1),Y(3),SIZ8,1004,1001,'TRS')
96 ENDIF
97C
98C If volume is also detector draw another box outside
99C
100 IF (IDET.EQ.1) THEN
101 X(1)=X(1)-SIZ8
102 X(2)=X(2)-SIZ8
103 X(3)=X(3)+SIZ8
104 X(4)=X(4)+SIZ8
105 X(5)=X(5)-SIZ8
106 Y(1)=Y(1)+SIZ8
107 Y(2)=Y(2)-SIZ8
108 Y(3)=Y(3)-SIZ8
109 Y(4)=Y(4)+SIZ8
110 Y(5)=Y(5)+SIZ8
111 LINCOL=1
112 CALL MVBITS(LINCOL,0,8,LINATT,16)
113 CALL GDRAWV(X,Y,5)
114 ENDIF
115C
116C If volume is not 'ONLY' draw two other boxes behind
117C
118 IF (IONL.NE.1) THEN
119 X(1)=XLEV+(SIZ2*2.*FACHV)-SIZ8
120 Y(1)=YLEV+SIZ2
121 X(2)=X(1)
122 Y(2)=Y(1)+SIZ8
123 X(3)=X(2)-(SIZE*2.*FACHV)
124 Y(3)=Y(2)
125 X(4)=X(3)
126 Y(4)=Y(3)-SIZE
127 X(5)=X(4)+SIZ8
128 Y(5)=Y(4)
129 LINCOL=1
130 CALL MVBITS(LINCOL,0,8,LINATT,16)
131 CALL GDRAWV(X,Y,5)
132 DO 10 I=1,5
133 X(I)=X(I)-SIZ8
134 Y(I)=Y(I)+SIZ8
135 10 CONTINUE
136 CALL GDRAWV(X,Y,5)
137 ENDIF
138C
139 LINSTY=1
140 CALL MVBITS(LINSTY,0,3,LINATT,10)
141C
142C Draw name
143C
144 YL=YLEV-SIZ2+(SIZ8/2.)
145 IF(FACHV.EQ.1.)YL=YLEV-SIZ8
146 XL=XLEV-(SIZ4*FACHV)+SIZ8
147 IF(FACHV.EQ.1.)XL=XLEV
148 SZ=1.5*SIZ4*2.
149 IF(FACHV.EQ.1.)SZ=1.*SIZ4*2.
150 ITXCOL=5
151 CALL MVBITS(ITXCOL,0,4,ITXATT,3)
152 AITXCO=ITXCOL
153 CALL IGSET('TXCI',AITXCO)
154 CALL IGSET('TXFP',-60.)
155 IWTY=IGIWTY(1)
156 IF(IWTY.GT.10.OR.IWTY.LT.1)CALL IGSET('TXFP',-61.)
157*** CALL IGPID(1,'Tree',NPILE,' ')
158 CALL GDRAWT(XL,YL,NAME,SZ,0.,4,0)
159 CALL IGSET('TXFP',2.)
160 CALL IGSET('TXCI',1.)
161C
162 IF (IDUP.EQ.1) GO TO 20
163C
164C Draw IDUP in bottom half box
165C
166 CALL UCTOH('<"4#>',NAMT0(1),1,5)
167 IF (IDUP.LT.0) CALL UCTOH('F',NAMT0(3),1,1)
168 DUP=FLOAT(IABS(IDUP))
169 CALL HBCDF(DUP,8,NAMT0(6))
170 CALL UCTOH('$',NAMT0(14),1,1)
171 CALL UBUNCH(NAMT0,NAM0,14)
172 CALL UHTOC(NAM0,4,CHNAM0,14)
173 XL=XLEV+(SIZ4*FACHV)+SIZ2
174 IF(FACHV.EQ.1.)XL=XLEV-(3.*SIZ8)
175 YL=YLEV-SIZ4-SIZ8
176 IF(FACHV.EQ.1.)YL=YLEV-SIZ2+(SIZ8/2.)
177 SZ=0.7*SIZ4*2.
178 IF(FACHV.EQ.1.)SZ=0.7*SIZ4*1.5
179 ITXCOL=5
180 CALL MVBITS(ITXCOL,0,4,ITXATT,3)
181 AITXCO=ITXCOL
182 CALL IGSET('TXCI',AITXCO)
183 CALL IGSET('TXFP',2.)
184*** CALL IGPID(1,'Tree',NPILE,' ')
185 CALL GDRAWT(XL,YL,CHNAM0,SZ,0.,10,-1)
186 CALL IGSET('TXCI',1.)
187C
188 20 CONTINUE
189C
190 IF (IDRAW.NE.1) GO TO 999
191C
192C Draw a normal view of the volume
193C
194 CALL GLOOK(NAME,IQ(JVOLUM+1),NVOLUM,IVO)
195 IF(IVO.LE.0) GO TO 999
196C
197 JVO=LQ(JVOLUM-IVO)
198C
199C GET PARAMETERS
200C
201 CALL GFPARA(NAME,1,0,NPAR,NATT,PAR,ATT)
202 IF(NPAR.LE.0) GO TO 999
203C
204 ISHAPE=Q(JVO+2)
205C
206C CHECK parametER SIZES
207C
208 PARMAX=-1.
209 DO 50 I=1,NPAR
210 IF(ISHAPE.GT.14)GO TO 50
211 IF(NNDM(ISHAPE).LE.0) GO TO 40
212C
213 NDM=NNDM(ISHAPE)
214 DO 30 IDM=1,NDM
215C
216 IF(I.EQ.INDM(IDM,ISHAPE)) GO TO 50
217C
218 30 CONTINUE
219 40 CONTINUE
220C
221 ABSPAR=ABS(PAR(I))
222 PARMAX=MAX(PARMAX,ABSPAR)
223 50 CONTINUE
224 XSCALE=SIZE/(3.*PARMAX)
225 YSCALE=XSCALE
226 XPOS=XLEV-(SIZE*FACHV*2)+SIZ8
227 YPOS=YLEV
228* YPOS=YLEV+SIZE
229C
230 CALL GFATT(NAME,'SEEN',KSEEN)
231C
232C Add local value KSEEN 1 to starting node of tree
233C
234 KSEEN=KSEEN+110
235 ISEEN=KSEEN
236 CALL GSATT(NAME,'SEEN',ISEEN)
237C
238 CALL GDNSON(NAME,NSON,IDIV)
239 DO 60 N=1,NSON
240 CALL GDSON(N,NAME,ISON)
241 CALL GFATT(ISON,'SEEN',KSEEN)
242C
243C ISON is a volume with multeplicity;
244C first occurrence has already been set
245C
246 IF (KSEEN.GT.50) GO TO 60
247C
248C Add local value SEEN -2 to each one-level-down node
249C
250 KSEEN=KSEEN+80
251 ISEEN=KSEEN
252 CALL GSATT(ISON,'SEEN',ISEEN)
253 60 CONTINUE
254 CALL GDRAW(NAME,45.,135.,0.,XPOS,YPOS,XSCALE,YSCALE)
255C
256C Reset global SEEN values
257C
258 DO 70 IVO=1,NVOLUM
259 CALL UHTOC(IQ(JVOLUM+IVO),4,NAMSEE,4)
260 CALL GFATT(NAMSEE,'SEEN',KSEEN)
261 IF (KSEEN.LT.50) GO TO 70
262 ISEENL=KSEEN/10.+0.5
263 ISEENG=KSEEN-ISEENL*10.
264 CALL GSATT(NAMSEE,'SEEN',ISEENG)
265 70 CONTINUE
266C
267 999 END