      integer function pdg2Geant(pdgCode)
      IMPLICIT NONE
      integer pdgCode

      if (pdgCode .EQ. 22) then
C  gamma
          pdg2Geant = 1
      else if (pdgCode.EQ. 11) then
C  electron
          pdg2Geant = 3
      else if (pdgCode .EQ. -11) then
C  positron
          pdg2Geant = 2
      else if (pdgCode .EQ. 13) then
C  mu-
          pdg2Geant = 6
      else if (pdgCode .EQ. -13) then
C  mu+
          pdg2Geant = 5
      else if (abs(pdgCode) .EQ. 15) then
C  tau - can't handle it
          print *,'pdg2Geant: Tau lepton not implemented in Geant'
          print *,'pdg2Geant: Particle will be treated as Geantino'
          pdg2Geant = 48
      else if (abs(pdgCode).gt.10 .and. abs(pdgCode).le.16) then
C  neutrino
          pdg2Geant = 4
      else if (pdgCode .EQ. 111) then
C  pi0
          pdg2Geant = 7
      else if (pdgCode .EQ. 211) then
C  pi+
          pdg2Geant = 8
      else if (pdgCode .EQ. -211) then
C  pi-
          pdg2Geant = 9
      else if (pdgCode .EQ. 321) then
C  K+
          pdg2Geant = 11
      else if (pdgCode .EQ. -321) then
C  K-
          pdg2Geant = 12
      else if (pdgCode .EQ. 130) then
C  Klong
          pdg2Geant = 10
      else if (pdgCode .EQ. 310) then
C  Kshort
          pdg2Geant = 16
      else if (abs(pdgCode).EQ.311) then
C  K0 or K0bar; can't handle it for now
C  We could randomly choose Ks or KL...
          print *,'pdg2Geant: K0/K0bar not implemented in Geant'
          print *,'pdg2Geant: Particle treated as Geantino'
          pdg2Geant = 48
      else if (pdgCode .EQ. 2112) then
C  neutron
          pdg2Geant = 13
      else if (pdgCode .EQ. -2112) then
C  anti-neutron
          pdg2Geant = 25
      else if (pdgCode .EQ. 2212) then
C  proton
          pdg2Geant = 14
      else if (pdgCode .EQ. -2212) then
C  anti-proton
          pdg2Geant = 15
      else if (pdgCode .EQ. 221) then
C  eta
          pdg2Geant = 17
      else if (pdgCode .EQ. 3122) then
C  lambda
          pdg2Geant = 18
      else if (pdgCode .EQ. -3122) then
C  anti-lambda
          pdg2Geant = 26
      else if (pdgCode .EQ. 3222) then
C  sigma+
          pdg2Geant = 19
      else if (pdgCode .EQ. 3212) then
C  sigma0
          pdg2Geant = 20
      else if (pdgCode .EQ. 3112) then
C  sigma-
          pdg2Geant = 21
      else if (pdgCode .EQ. -3222) then
C  antisigma -
          pdg2Geant = 27
      else if (pdgCode .EQ. -3212) then
C  antisigma 0
          pdg2Geant = 28
      else if (pdgCode .EQ. -3112) then
C  antisigma +
          pdg2Geant = 29
      else if (pdgCode .EQ. 3322) then
C  xi0
          pdg2Geant = 22
      else if (pdgCode .EQ. -3322) then
C  antixi0
          pdg2Geant = 30
      else if (pdgCode .EQ. 3312) then
C  xi-
          pdg2Geant = 23
      else if (pdgCode .EQ. -3312) then
C antixi+
          pdg2Geant = 31
      else if (pdgCode .EQ. 3334) then
C Omega-
          pdg2Geant = 24
      else if (pdgCode .EQ. -3334) then
C antiOmega+
          pdg2Geant = 32
      else
C unknown - call it a geantino?
          print *,'pdg2geant: Unknown PDG particle code: ',pdgCode
          print *,'pdg2geant: Particle will be treated as geantino'
          pdg2Geant = 48
      endif
      return
      end
