Bugfix in AliPoints2Memory
[u/mrichter/AliRoot.git] / GEANT321 / gdraw / gdtrak.F
1 *
2 * $Id$
3 *
4 * $Log$
5 * Revision 1.1.1.1  1995/10/24 10:20:29  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 GDTRAK(CHOPTT)
13 C.
14 C.    ******************************************************************
15 C.    *                                                                *
16 C.    *       Store space point VECT in banks JXYZ                     *
17 C.    *                                                                *
18 C.    *    ==>Called by : <USER>                                       *
19 C.    *       Authors    R.Brun, F.Carena  *********                   *
20 C.    *                                                                *
21 C.    ******************************************************************
22 C.
23 #include "geant321/gcbank.inc"
24 #include "geant321/gcnum.inc"
25 #include "geant321/gctrak.inc"
26 #include "geant321/gcpush.inc"
27 #include "geant321/gckine.inc"
28 #include "geant321/gcunit.inc"
29 #include "geant321/gcdraw.inc"
30       PARAMETER (NPOBUF=50)
31       CHARACTER*(*) CHOPTT
32       CHARACTER*10  CHOPT
33       LOGICAL OPTDRW, OPTREM, FIRST
34       INTEGER COLO(8), OLDCOL, OLDLIN
35       DIMENSION U(NPOBUF),V(NPOBUF),MODE(8)
36 C
37 C             MODE(ITRTYP) and COLO(ITRTYP) are used by ISLN and GDCOL
38 C             ITRTYP (the track type) correspond to :
39 C
40 C             ITRTYP  PARTICLE  |       HIGZ         |
41 C             ----------------------------------------
42 C                 1   gammas    | dotted      blue   |
43 C                 2   electrons | solid       red    |
44 C                 3   neutral   | dot-dashed  black  |
45 C                 4   hadrons   | solid       red    |
46 C                 5   muons     | dashed      green  |
47 C                 6   geantino  | dot-dashed  black  |
48 C                 7   Cerenkov  | dotted      yellow |
49 C                 8   Ions      | solid       light b|
50 C
51       SAVE MODE,COLO,FIRST,IOFF,ILINE,OLDCOL,OLDLIN
52       DATA MODE /3, 1, 4, 1, 2, 1, 3, 1/
53       DATA COLO/4, 2, 1, 2, 3, 1, 6, 5/
54       DATA FIRST /.TRUE./
55       DATA OLDCOL/ -1 /, OLDLIN / -1 /
56 *
57 *     ------------------------------------------------------------------
58 *
59       IF(JXYZ.EQ.0)THEN
60 *
61 *  ***         No bank...
62 *
63          WRITE(CHMAIL,10000)
64          CALL GMAIL(0,0)
65          GOTO 999
66       ENDIF
67 *
68       IF(ITRA.GT.IQ(JXYZ-2)) GOTO 40
69 *
70       JX=LQ(JXYZ-ITRA)
71       IF(JX.EQ.0) GOTO 40
72 *
73       CHOPT  = CHOPTT
74       CALL CLTOU(CHOPT)
75       OPTDRW = INDEX(CHOPT,'D') .NE. 0
76       OPTREM = INDEX(CHOPT,'R') .NE. 0
77       IF(.NOT.(OPTDRW.OR.OPTREM)) THEN
78          OPTDRW = .TRUE.
79          OPTREM = .TRUE.
80       ENDIF
81 *
82       IF (FIRST) THEN
83          CALL UCTOH('OFF ',IOFF,4,4)
84          CALL UCTOH('LINE',ILINE,4,4)
85          FIRST  = .FALSE.
86       ENDIF
87 *
88       IF (OPTDRW) THEN
89 *
90 *  ***        Draw the current track
91 *
92          IPOINT = JX+Q(JX+2)
93          NPOINT = Q(IPOINT)
94          IPART  = Q(IPOINT+1)
95          JPA    = LQ(JPART-IPART)
96          ITRTYP = Q(JPA+6)
97 *
98 *  ***        Line style and color code
99 *
100          IMOD   = MODE(ITRTYP)
101          ICOL   = COLO(ITRTYP)
102          IF(ICOL.NE.OLDCOL) THEN
103             CALL GDCOL(ICOL)
104             CALL GDCOL1(ICOL)
105             OLDCOL=ICOL
106          ENDIF
107 *
108          NDONE  = 0
109    10    NDO    = MIN(NPOINT-NDONE,NPOBUF)
110          IF (NDO.GT.0) THEN
111 *
112 *            Is THRZ option set on (R-Z projection)
113 *            and the cut lateral (vertical or horizontal) ?
114 *
115             IF (ITHRZ.NE.IOFF) THEN
116                IF (ICUT.EQ.1.OR.ICUT.EQ.2) ITR3D=-ITRA
117             ELSE
118                ITR3D=0
119             ENDIF
120 *
121             CALL GDFR3D(Q(IPOINT+3*NDONE+2),NDO,U,V)
122 *
123             IF (IDVIEW.EQ.0) THEN
124                IF (ITRKOP.EQ.ILINE.AND.NDO.GT.1) THEN
125                   IF(OLDLIN.NE.IMOD) THEN
126                      CALL ISLN(IMOD)
127                      OLDLIN=IMOD
128                   ENDIF
129                   CALL IPL(NDO,U,V)
130                ELSE
131                   DO 20 IP=1,NDO
132                      CALL IPM(1,U(IP),V(IP))
133    20             CONTINUE
134                ENDIF
135 *
136             ELSE
137                CALL GDRAWP(U,V,NDO)
138 *
139             ENDIF
140             NDONE = NDONE + NDO
141             GOTO 10
142          ENDIF
143       ENDIF
144       IF (OPTREM) THEN
145 *
146 * ***      Remove the current track
147 *
148          IPOINT = JX+INT(Q(JX+2))
149          Q(JX+1)= Q(JX+1) + 3.*Q(IPOINT)
150          Q(IPOINT) = 0.
151          IQ(JX) = -77
152       ENDIF
153       GOTO 999
154 *
155    40 WRITE (CHMAIL,10100) ITRA
156       CALL GMAIL(0,0)
157 *
158 10000 FORMAT(' *** GDTRAK: No JXYZ bank')
159 10100 FORMAT(' *** GDTRAK: No points stored for track ',I10)
160   999 END