*
* $Id: gpgapart.F,v 3.1.1.1 2002/07/11 16:02:15 cafagna Exp $
*
* $Log: gpgapart.F,v $
* Revision 3.1.1.1  2002/07/11 16:02:15  cafagna
* First GPAMELA release on CVS
*
*
*CMZ :  3.00/00 11/05/2001  18.16.48  by  Unknown
*-- Author :    Marialuigia Ambriola   02/05/2001
      SUBROUTINE GPGAPART(IDPART,IFAIL)
***************************************************************************
*
* This is a silly subroutine to fill the GARFIELD common with the PARTICLE
* characteristic given the
* GEANT particle Id.
*
* Variables definition:
* IN
*     -IDPART, GEANT particle ID
*
* Called by: <USER>
*
* By Caf & ML on 2 May 2001
*
***************************************************************************
*
* GARFIELD commons
*
      IMPLICIT NONE
#include "dimensions.inc"
#include "parameters.inc"
*
* LOCAL VARIABLES
*
#include "gcunit.inc"
      INTEGER IFAIL
      INTEGER IDPART
CML      LOGICAL CHARGE,MASS
      IFAIL = -1
      IF(IDPART.EQ.3)THEN
         TRMASS=0.51099907
         TRCHAR=-1
CML         MASS=.TRUE.
CML         CHARGE=.TRUE.
         PNAME='electron-'
         NCPNAM=9
         ITRTYP=4
         GO TO 20
      ENDIF
      IF(IDPART.EQ.2)THEN
         TRMASS=0.51099907
         TRCHAR=+1
CML         MASS=.TRUE.
CML         CHARGE=.TRUE.
         PNAME='electron+'
         NCPNAM=9
         ITRTYP=4
         GO TO 20
      ENDIF
      IF(IDPART.EQ.6)THEN
         TRMASS=105.658389
         TRCHAR=-1
CML         MASS=.TRUE.
CML         CHARGE=.TRUE.
         PNAME='mu-'
         NCPNAM=3
         ITRTYP=4
         GOTO 20
      ENDIF
      IF(IDPART.EQ.5) THEN
         TRMASS=105.658389
         TRCHAR=+1
CML         MASS=.TRUE.
CML         CHARGE=.TRUE.
         PNAME='mu+'
         NCPNAM=3
         ITRTYP=4
         GO TO 20
      ENDIF
*** NO TAUS IN GEANT 3 ...........
C #        IF(INPCMP(I,'TAU-#MINUS').NE.0)THEN
C #             TRMASS=1777.00
C #             TRCHAR=-1
C #             MASS=.TRUE.
C #             CHARGE=.TRUE.
C #             PNAME='tau-'
C #             NCPNAM=4
C #             ITRTYP=4
C #        ELSEIF(INPCMP(I,'TAU-P#LUS')+INPCMP(I,'TAU+').NE.0)THEN
C #             TRMASS=1777.00
C #             TRCHAR=+1
C #             MASS=.TRUE.
C #             CHARGE=.TRUE.
C #             PNAME='tau+'
C #             NCPNAM=4
C #             ITRTYP=4
C #        ENDIF
      IF(IDPART.EQ.1)THEN
         GOTO 10
      ENDIF
      IF(IDPART.EQ.9)THEN
         TRMASS=139.56995
         TRCHAR=-1
CML         MASS=.TRUE.
CML         CHARGE=.TRUE.
         PNAME='pi-'
         NCPNAM=3
         ITRTYP=4
         GOTO 20
      ENDIF
      IF(IDPART.EQ.7) THEN
         TRMASS=134.9764
         TRCHAR= 0
CML         MASS=.TRUE.
CML         CHARGE=.TRUE.
         PNAME='pi0'
         NCPNAM=3
         ITRTYP=4
         GOTO 20
      ENDIF
      IF(IDPART.EQ.8) THEN
         TRMASS=139.56995
         TRCHAR=+1
CML         MASS=.TRUE.
CML         CHARGE=.TRUE.
         PNAME='pi+'
         NCPNAM=3
         ITRTYP=4
         GOTO 20
      ENDIF
      IF(IDPART.EQ.12) THEN
         TRMASS=493.677
         TRCHAR=-1
CML         MASS=.TRUE.
CML         CHARGE=.TRUE.
         PNAME='K-'
         NCPNAM=2
         ITRTYP=4
         GOTO 20
      ENDIF
      IF( (IDPART.EQ.16).OR.(IDPART.EQ.10)) THEN
         TRMASS=497.672
         TRCHAR= 0
CML         MASS=.TRUE.
CML         CHARGE=.TRUE.
         PNAME='K0'
         NCPNAM=2
         ITRTYP=4
         GOTO 20
      ENDIF
      IF(IDPART.EQ.11) THEN
         TRMASS=493.677
         TRCHAR=-1
CML         MASS=.TRUE.
CML         CHARGE=.TRUE.
         PNAME='K+'
         NCPNAM=2
         ITRTYP=4
         GOTO 20
      ENDIF
      IF(IDPART.EQ.14) THEN
         TRMASS=938.27231
         TRCHAR=+1
CML         MASS=.TRUE.
CML         CHARGE=.TRUE.
         PNAME='proton'
         NCPNAM=6
         ITRTYP=4
         GOTO 20
      ENDIF
      IF(IDPART.EQ.15) THEN
         TRMASS=938.27231
         TRCHAR=-1
CML         MASS=.TRUE.
CML         CHARGE=.TRUE.
         PNAME='antiproton'
         NCPNAM=10
         ITRTYP=4
         GOTO 20
      ENDIF
      IF( (IDPART.EQ.13).AND.(IDPART.EQ.25) ) THEN
         TRMASS=939.56563
         TRCHAR= 0
CML         MASS=.TRUE.
CML         CHARGE=.TRUE.
         PNAME='neutron'
         NCPNAM=7
         ITRTYP=4
         GOTO 20
      ENDIF
*
* here there are some errors .....
*
 10    continue
c   10 WRITE(CHMAIL,10000)IDPART
c      CALL GMAIL(1,0)
c 10000  FORMAT(' GPGAPART: ERROR !!!! No HEED corresponding particle ',
c     +  'found. GEANT ID: ',I8)
      IFAIL=1
   20 RETURN
      END
