      SUBROUTINE GDCXYZ
C.
C.    ******************************************************************
C.    *                                                                *
C.    *       Online display of the track trajectory                   *
C.    *                                                                *
C.    *    ==>Called by : <USER>                                       *
C.    *       Authors : R.Brun, P.Zanarini, S.Giani  ****              *
C.    *                                                                *
C.    ******************************************************************
C.
      COMMON/GCDRAW/NUMNOD,MAXNOD,NUMND1,LEVVER,LEVHOR,MAXV,IPICK,      *
     + MLEVV,MLEVH,NWCUT,JNAM,JMOT,JXON,JBRO,JDUP,JSCA,JDVM,JPSM,       *
     + JNAM1,JMOT1,JXON1,JBRO1,JDUP1,JSCA1,JULEV,JVLEV,                 *
     + LOOKTB(16),                                                      *
     + GRMAT0(10),GTRAN0(3),IDRNUM,GSIN(41),GCOS(41),SINPSI,COSPSI,     *
     + GTHETA,GPHI,GPSI,GU0,GV0,GSCU,GSCV,NGVIEW,                       *
     + ICUTFL,ICUT,CTHETA,CPHI,DCUT,NSURF,ISURF,                        *
     + GZUA,GZVA,GZUB,GZVB,GZUC,GZVC,PLTRNX,PLTRNY,                     *
     + LINATT,LINATP,ITXATT,ITHRZ,IPRJ,DPERS,ITR3D,IPKHIT,IOBJ,LINBUF,  *
     + MAXGU,MORGU,MAXGS,MORGS,MAXTU,MORTU,MAXTS,MORTS,                 *
     + IGU,IGS,ITU,ITS,NKVIEW,IDVIEW,                                   *
     + NOPEN,IGMR,IPIONS,ITRKOP,IHIDEN,                                 *
     + DDUMMY(18)                                                       *
C                                                                      *
      INTEGER       IKINE,ITRA,ISTAK,IVERT,IPART,ITRTYP,NAPART,IPAOLD
      REAL          PKINE,AMASS,CHARGE,TLIFE,VERT,PVERT
C
      COMMON/GCKINE/IKINE,PKINE(10),ITRA,ISTAK,IVERT,IPART,ITRTYP
     +      ,NAPART(5),AMASS,CHARGE,TLIFE,VERT(3),PVERT(4),IPAOLD
C---
      INTEGER  NJTMAX,NJTMIN,NTSTKP,NTSTKS,NDBOOK,NDPUSH,NJFREE,NJGARB,
     +         NJINVO,LINSAV,LMXSAV,NWSTAK,NWINT,NWREAL,NWTRAC
      INTEGER ISTORD
C
      PARAMETER (NWSTAK=12,NWINT=11,NWREAL=12,NWTRAC=NWINT+NWREAL+5)
      COMMON /GCSTAK/ NJTMAX, NJTMIN, NTSTKP, NTSTKS, NDBOOK, NDPUSH,
     +                NJFREE, NJGARB, NJINVO, LINSAV(15), LMXSAV(15)
      EQUIVALENCE (ISTORD,NJTMIN)
C---
      INTEGER NMEC,LMEC,NAMEC,NSTEP ,MAXNST,IGNEXT,INWVOL,ISTOP,MAXMEC
     + ,IGAUTO,IEKBIN,ILOSL, IMULL,INGOTO,NLDOWN,NLEVIN,NLVSAV,ISTORY
     + ,MAXME1,NAMEC1
      REAL  VECT,GETOT,GEKIN,VOUT,DESTEP,DESTEL,SAFETY,SLENG ,STEP
     + ,SNEXT,SFIELD,TOFG  ,GEKRAT,UPWGHT
      REAL POLAR
      PARAMETER (MAXMEC=30)
      COMMON/GCTRAK/VECT(7),GETOT,GEKIN,VOUT(7),NMEC,LMEC(MAXMEC)
     + ,NAMEC(MAXMEC),NSTEP ,MAXNST,DESTEP,DESTEL,SAFETY,SLENG
     + ,STEP  ,SNEXT ,SFIELD,TOFG  ,GEKRAT,UPWGHT,IGNEXT,INWVOL
     + ,ISTOP ,IGAUTO,IEKBIN, ILOSL, IMULL,INGOTO,NLDOWN,NLEVIN
     + ,NLVSAV,ISTORY
      PARAMETER (MAXME1=30)
      COMMON/GCTPOL/POLAR(3), NAMEC1(MAXME1)
C
      PARAMETER (NTRTYP=8)
      DIMENSION UU(2),VV(2)
      DIMENSION MODE(NTRTYP),KCOLO(NTRTYP),VOLD(3)
      SAVE MODE,KCOLO,IFIRST,IOFF,ILINE,UU,VV
      DATA MODE /3, 1, 4, 1, 2, 1, 1, 1/
      DATA KCOLO/4, 2, 1, 3, 5, 1, 6, 6/
      DATA IFIRST/0/
C.
C.    ------------------------------------------------------------------
C.
C                                            skip neutral hadrons
c      if(itrtyp.eq.1.and.getot.lt.0.1) return
      IF(ITRTYP.EQ.1) RETURN
C------------------------------------------------------------------
*      IF(SLENG.GT.0..AND.STEP.LT.0.1)RETURN
      IF(IFIRST.EQ.0)THEN
         CALL UCTOH('OFF ',IOFF,4,4)
         CALL UCTOH('LINE',ILINE,4,4)
         IFIRST=1
      ENDIF
C
C             Set IOBJ to TRACK
C
      IOBJ=2
C
C             Is THRZ option set on (R-Z projection)
C             and the cut lateral (vertical or horizontal) ?
C
      IF (ITHRZ.NE.IOFF) THEN
         IF (ICUT.EQ.1.OR.ICUT.EQ.2) ITR3D=-ITRA
      ELSE
         ITR3D=0
      ENDIF
      ICOL=KCOLO(ITRTYP)
c-----------------------------------------------------
         if(charge.gt.0.0) icol = 3
c-----------------------------------------------------
      KCOL=LOOKTB(ICOL)
C
      IF(NJTMAX.EQ.0)THEN
*
*            Normal sequential tracking
         IF(SLENG.LE.0.)THEN
            CALL GDFR3D(VECT,1,UU(1),VV(1))
            IF (ITRKOP.NE.ILINE) THEN
               CALL IGPID(1,'Kine',ITRA,' ')
               CALL IPM(1,UU,VV)
            ENDIF
         ELSE
            CALL GDFR3D(VECT,1,UU(2),VV(2))
            IF (ITRKOP.EQ.ILINE) THEN
               CALL ISPLCI(KCOL)
               CALL ISLN(MODE(ITRTYP))
               CALL IGPID(1,'Kine',ITRA,' ')
               CALL IPL(2,UU,VV)
            ELSE
               CALL IGPID(1,'Kine',ITRA,' ')
               CALL IPM(1,UU(2),VV(2))
            ENDIF
            UU(1)=UU(2)
            VV(1)=VV(2)
         ENDIF
      ELSE
*
*            Parallel tracking
         CALL GDFR3D(VECT,1,UU(2),VV(2))
         IF (ITRKOP.NE.ILINE) THEN
            CALL IGPID(1,'Kine',ITRA,' ')
            CALL IPM(1,UU(2),VV(2))
         ELSE
            CALL ISPLCI(KCOL)
            CALL ISLN(MODE(ITRTYP))
            VOLD(1)=VECT(1)-STEP*VECT(4)
            VOLD(2)=VECT(2)-STEP*VECT(5)
            VOLD(3)=VECT(3)-STEP*VECT(6)
            CALL GDFR3D(VOLD,1,UU(1),VV(1))
            CALL IGPID(1,'Kine',ITRA,' ')
            CALL IPL(2,UU,VV)
            IF (MODE(ITRTYP).NE.1) CALL ISLN(1)
         ENDIF
      ENDIF
C
C             Reset ITR3D to 'standard projection'
C
      ITR3D=0
      IOBJ=0
C
      END
