Package cnuphys.lund

Class LundId

java.lang.Object
cnuphys.lund.LundId
All Implemented Interfaces:
Comparable<LundId>

public class LundId extends Object implements Comparable<LundId>
Used to store a Lund ID
Author:
heddle
  • Field Details

    • unknownLabel

      public static final JComponent unknownLabel
  • Constructor Details

    • LundId

      public LundId(String type, String name, int id, double mass, int chargeX3, int spinX2)
      Create a Lund ID
      Parameters:
      type - "Lepton", "InterBoson", "Nucleus", "Baryon", or "Meson"
      name - e.g., "pi+"
      id - the Lund Id
      mass - the mass in GeV/c^2
      chargeX3 - three times the charge
      spinX2 - twice the spin
  • Method Details

    • getType

      public String getType()
      Get the type, one of {"Lepton","InterBoson", "Nucleus","Baryon", "Meson"}
      Returns:
      the type
    • getName

      public String getName()
      Get the name of the particle.
      Returns:
      the name of the particle.
    • getId

      public int getId()
      Get the Lund Id of the particle.
      Returns:
      the Lund id
    • getSpin

      public double getSpin()
      Get the spin of the particle.
      Returns:
      the spin.
    • getCharge

      public int getCharge()
      Get the charge of the particle in e's.
      Returns:
      the charge of the particle in units of e.
    • getMass

      public double getMass()
      Get the mass in GeV/c^2
      Returns:
      the mass in GeV/c^2
    • getChargeX3

      public int getChargeX3()
      Return three times the charge, in units of e.
      Returns:
      three times the charge, in units of e.
    • toString

      public String toString()
      Obtain a string representation.
      Overrides:
      toString in class Object
    • compareTo

      public int compareTo(LundId o)
      Compare based on Id.
      Specified by:
      compareTo in interface Comparable<LundId>
      Returns:
      -1, 0, or 1 for less than, equal, or greater than.
    • smallString

      public String smallString()
      Obtain a small string representation.
      Returns:
      a small string representation.
    • pFromT

      public double pFromT(double t)
      Get the momentum from the kinetic energy
      Parameters:
      t - the kinetic energy in GeV
      Returns:
      the momentum in Gev/c
    • getChargeCoulombs

      public double getChargeCoulombs()
      Get the charge in Coulombs
      Returns:
      the charge in Coulombs
    • getMassKg

      public double getMassKg()
      Get the mass in kilograms
      Returns:
      the mass in kilograms
    • getLabelForLegend

      public JComponent getLabelForLegend()
      Get a component to place on a legend.
      Returns:
      a component for the legend.
    • drawLineForLegend

      public int drawLineForLegend(Graphics g, int x, int yc)
      Draw a line for use on a toolbar user component, most likely
      Parameters:
      g - the graphics context
      x - the horizontal staring point
      yc - the central vertical position
      Returns:
      the offset
    • getStyle

      public LundStyle getStyle()
      Get the LundStyle for this id
      Returns:
      the LundStyle for this id