/* Copyright (C) 2002-2003, CompHEP Collaboration
 * Author: Alexander Sherstnev
 *----------------------------------------------
 *
 * $Id: kfcodes.c,v 1.3 2003/11/01 21:45:32 kryukov Exp $
 *
 * $Log: kfcodes.c,v $
 * Revision 1.3  2003/11/01 21:45:32  kryukov
 * Copyright record
 *
*/
#include <string.h>
#include <stdio.h>

#include "kfcodes.h"


/****************************************************/
/*                     KFBEAM routine               */
/****************************************************/
int 
kfbeam (char *bname)
{
  int i;
  if (!strcmp (bname, "Proton") ||
      !strcmp (bname, "proton") ||
      !strcmp (bname, "p+"))
    return 2212;

  if (!strcmp (bname, "AntiProton") ||
      !strcmp (bname, "Antiproton") ||
      !strcmp (bname, "antiProton") ||
      !strcmp (bname, "antiproton") ||
      !strcmp (bname, "anti-proton") ||
      !strcmp (bname, "pbar-"))
    return -2212;

  if (!strcmp (bname, "electron") || !strcmp (bname, "e-"))
    return 11;
  if (!strcmp (bname, "positron") || !strcmp (bname, "e+"))
    return -11;
  if (!strcmp (bname, "gamma"))
    return 22;
  i = kfpart (bname);
  if (i)
    return i;
  fprintf (stderr, "Unknown for CompHEP-PYTHIA Interface beam particle name:%s\n", bname);
  return 0;
}

/****************************************************/
/*                     KFPART routine               */
/****************************************************/
int 
kfpart (char *pname)
{
  if (!strcmp (pname, "e1"))
    return 11;
  if (!strcmp (pname, "E1"))
    return -11;
  if (!strcmp (pname, "e"))
    return 11;
  if (!strcmp (pname, "E"))
    return -11;
  if (!strcmp (pname, "e2"))
    return 13;
  if (!strcmp (pname, "E2"))
    return -13;
  if (!strcmp (pname, "m"))
    return 13;
  if (!strcmp (pname, "M"))
    return -13;
  if (!strcmp (pname, "e3"))
    return 15;
  if (!strcmp (pname, "E3"))
    return -15;
  if (!strcmp (pname, "l"))
    return 15;
  if (!strcmp (pname, "L"))
    return -15;
  if (!strcmp (pname, "e4"))
    return 17;
  if (!strcmp (pname, "E4"))
    return -17;
  if (!strcmp (pname, "n1"))
    return 12;
  if (!strcmp (pname, "N1"))
    return -12;
  if (!strcmp (pname, "ne"))
    return 12;
  if (!strcmp (pname, "Ne"))
    return -12;
  if (!strcmp (pname, "n2"))
    return 14;
  if (!strcmp (pname, "N2"))
    return -14;
  if (!strcmp (pname, "nm"))
    return 14;
  if (!strcmp (pname, "Nm"))
    return -14;
  if (!strcmp (pname, "n3"))
    return 16;
  if (!strcmp (pname, "N3"))
    return -16;
  if (!strcmp (pname, "nl"))
    return 16;
  if (!strcmp (pname, "Nl"))
    return -16;
  if (!strcmp (pname, "n4"))
    return 18;
  if (!strcmp (pname, "N4"))
    return -18;
  if (!strcmp (pname, "d#"))
    return 1;
  if (!strcmp (pname, "D#"))
    return -1;
  if (!strcmp (pname, "u#"))
    return 2;
  if (!strcmp (pname, "U#"))
    return -2;
  if (!strcmp (pname, "q#"))
    return 2;
  if (!strcmp (pname, "Q#"))
    return -2;
  if (!strcmp (pname, "d"))
    return 1;
  if (!strcmp (pname, "D"))
    return -1;
  if (!strcmp (pname, "u"))
    return 2;
  if (!strcmp (pname, "U"))
    return -2;
  if (!strcmp (pname, "s"))
    return 3;
  if (!strcmp (pname, "S"))
    return -3;
  if (!strcmp (pname, "c"))
    return 4;
  if (!strcmp (pname, "C"))
    return -4;
  if (!strcmp (pname, "b"))
    return 5;
  if (!strcmp (pname, "B"))
    return -5;
  if (!strcmp (pname, "t"))
    return 6;
  if (!strcmp (pname, "T"))
    return -6;
  if (!strcmp (pname, "b4"))
    return 7;
  if (!strcmp (pname, "B4"))
    return -7;
  if (!strcmp (pname, "t4"))
    return 8;
  if (!strcmp (pname, "T4"))
    return -8;
  if (!strcmp (pname, "G"))
    return 21;
  if (!strcmp (pname, "g"))
    return 21;
  if (!strcmp (pname, "A"))
    return 22;
  if (!strcmp (pname, "gamma"))
    return 22;
  if (!strcmp (pname, "Z"))
    return 23;
  if (!strcmp (pname, "Z0"))
    return 23;
  if (!strcmp (pname, "W+"))
    return 24;
  if (!strcmp (pname, "W-"))
    return -24;
  if (!strcmp (pname, "H"))
    return 25;
  if (!strcmp (pname, "h"))
    return 25;
  if (!strcmp (pname, "h0"))
    return 25;
  if (!strcmp (pname, "H0"))
    return 35;
  if (!strcmp (pname, "A0"))
    return 36;
  if (!strcmp (pname, "H3"))
    return 36;
  if (!strcmp (pname, "H+"))
    return 37;
  if (!strcmp (pname, "H-"))
    return -37;
  if (!strcmp (pname, "Gr"))
    return 39;			// Graviton

  if (!strcmp (pname, "R0"))
    return 41;
  if (!strcmp (pname, "LQ"))
    return 42;

  if (!strcmp (pname, "~g "))
    return 1000021;		// gluino

  if (!strcmp (pname, "~dL"))
    return 1000001;
  if (!strcmp (pname, "~DL"))
    return -1000001;
  if (!strcmp (pname, "~dR"))
    return 2000001;
  if (!strcmp (pname, "~DR"))
    return -2000001;
  if (!strcmp (pname, "~uL"))
    return 1000002;
  if (!strcmp (pname, "~UL"))
    return -1000002;
  if (!strcmp (pname, "~uR"))
    return 2000002;
  if (!strcmp (pname, "~UR"))
    return -2000002;
  if (!strcmp (pname, "~sL"))
    return 1000003;
  if (!strcmp (pname, "~SL"))
    return -1000003;
  if (!strcmp (pname, "~sR"))
    return 2000003;
  if (!strcmp (pname, "~SR"))
    return -2000003;
  if (!strcmp (pname, "~cL"))
    return 1000004;
  if (!strcmp (pname, "~CL"))
    return -1000004;
  if (!strcmp (pname, "~cR"))
    return 2000004;
  if (!strcmp (pname, "~CR"))
    return -2000004;
  if (!strcmp (pname, "~b1"))
    return 1000005;
  if (!strcmp (pname, "~B1"))
    return -1000005;
  if (!strcmp (pname, "~b2"))
    return 2000005;
  if (!strcmp (pname, "~B2"))
    return -2000005;
  if (!strcmp (pname, "~t1"))
    return 1000006;
  if (!strcmp (pname, "~T1"))
    return -1000006;
  if (!strcmp (pname, "~t2"))
    return 2000006;
  if (!strcmp (pname, "~T2"))
    return -2000006;
  if (!strcmp (pname, "~eL"))
    return 1000011;
  if (!strcmp (pname, "~EL"))
    return -1000011;
  if (!strcmp (pname, "~eR"))
    return 2000011;
  if (!strcmp (pname, "~ER"))
    return -2000011;
  if (!strcmp (pname, "~ne"))
    return 1000012;
  if (!strcmp (pname, "~Ne"))
    return -1000012;
  if (!strcmp (pname, "~mL"))
    return 1000013;
  if (!strcmp (pname, "~ML"))
    return -1000013;
  if (!strcmp (pname, "~mR"))
    return 2000013;
  if (!strcmp (pname, "~MR"))
    return -2000013;
  if (!strcmp (pname, "~nm"))
    return 1000014;
  if (!strcmp (pname, "~Nm"))
    return -1000014;
  if (!strcmp (pname, "~l1"))
    return 1000015;
  if (!strcmp (pname, "~L1"))
    return -1000015;
  if (!strcmp (pname, "~l2"))
    return 2000015;
  if (!strcmp (pname, "~L2"))
    return -2000015;
  if (!strcmp (pname, "~nl"))
    return 1000016;
  if (!strcmp (pname, "~Nl"))
    return -1000016;

  if (!strcmp (pname, "~o1"))
    return 1000022;		// neutralino chi_10

  if (!strcmp (pname, "~o2"))
    return 1000023;		// neutralino chi_20

  if (!strcmp (pname, "~o3"))
    return 1000025;		// neutralino chi_30

  if (!strcmp (pname, "~o4"))
    return 1000035;		// neutralino chi_40

  if (!strcmp (pname, "~1+"))
    return 1000024;		// chargino chi_1+

  if (!strcmp (pname, "~1-"))
    return -1000024;		// chargino chi_1-

  if (!strcmp (pname, "~2+"))
    return 1000037;		// chargino chi_2+

  if (!strcmp (pname, "~2-"))
    return -1000037;		// chargino chi_2-

  if (!strcmp (pname, "~G"))
    return 1000039;		// gravitino

  if (!strcmp (pname, "~sS"))
    return 1000040;		// sgoldstino S

  if (!strcmp (pname, "~sP"))
    return 1000041;		// sgoldstino P

  return 0;
}
