Module simpa.core

Class Particle

java.lang.Object
simpa.core.api.track.Particle

public class Particle extends Object
Object that represents a particle.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Particle(double x, double y, double z, double px, double py, double pz, double ax, double ay, double az, double charge, double mass)
    Constructs a particle with the given parameters.
    Particle(org.apache.commons.math3.geometry.euclidean.threed.Vector3D pos, org.apache.commons.math3.geometry.euclidean.threed.Vector3D dir, org.apache.commons.math3.geometry.euclidean.threed.Vector3D vp, double pInGeV, double charge, double mass)
    Constructor with a direction vector, the direction will be normalized, so its amplitude doesn't matter.
  • Method Summary

    Modifier and Type
    Method
    Description
     
    double
    Gets the particle's charge.
    static String
     
    org.apache.commons.math3.geometry.euclidean.threed.Vector3D
    Calculates and returns the kinetic momentum of the particle.
    double
    Gets the particle's mass.
    Gets the name of the particle.
    org.apache.commons.math3.geometry.euclidean.threed.Vector3D
     
    org.apache.commons.math3.geometry.euclidean.threed.Vector3D
     
    double
    Gets the particle's canonical momentum on the X axis.
    double
    Gets the particle's canonical momentum on the Y axis.
    double
    Gets the particle's canonical momentum on the Z axis.
    double
    Gets the lifetime of the particle.
    double
    Gets the X position of the particle.
    double
    Gets the Y position of the particle.
    double
    Gets the Z position of the particle.
    boolean
     
    boolean
     
    void
    reset(boolean reverse)
    Resets the terminated flag to false, so the particle already tracked can be reused.
    void
    setCharge(double charge)
    method for setting/updating the charge.
    void
    setMass(double mass)
    method for setting/updating the mass.
    void
    Sets the name for the particle.
    void
    setPreviousKineticMomentum(org.apache.commons.math3.geometry.euclidean.threed.Vector3D prevMom)
     
    void
    setPreviousPosition(org.apache.commons.math3.geometry.euclidean.threed.Vector3D prevPos)
     
    void
    setTerminated(boolean terminated)
     
    void
    setTime(double time)
     
     
    void
    updateMomentum(double px, double py, double pz, double ax, double ay, double az)
    Update the canonical momentum.
    void
    updatePosition(double xc, double yc, double zc)
     

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • Particle

      public Particle(org.apache.commons.math3.geometry.euclidean.threed.Vector3D pos, org.apache.commons.math3.geometry.euclidean.threed.Vector3D dir, org.apache.commons.math3.geometry.euclidean.threed.Vector3D vp, double pInGeV, double charge, double mass)
      Constructor with a direction vector, the direction will be normalized, so its amplitude doesn't matter.
      Parameters:
      pos - position vector
      dir - direction vector
      vp - the vector potential at the position
      pInGeV - Nominal momentum [GeV/c]
      charge - charge of the particle in Culombs.
      mass - mass of the particle in kilograms.
    • Particle

      public Particle(double x, double y, double z, double px, double py, double pz, double ax, double ay, double az, double charge, double mass)
      Constructs a particle with the given parameters.
      Parameters:
      x - x position [m]
      y - y position [m]
      z - z position [m]
      px - x kinetic momentum [kg m/s]
      py - y kinetic momentum [kg m/s]
      pz - z kinetic momentum [kg m/s]
      ax - X component of the vector potential at the particle position
      ay - Y component of the vector potential at the particle position
      az - Z component of the vector potential at the particle position
      charge - The charge [coulomb]
      mass - The mass [kg]
  • Method Details

    • getX

      public double getX()
      Gets the X position of the particle.
      Returns:
      the X position of the particle.
    • getY

      public double getY()
      Gets the Y position of the particle.
      Returns:
      the Y position of the particle.
    • getZ

      public double getZ()
      Gets the Z position of the particle.
      Returns:
      the Z position of the particle.
    • getPx

      public double getPx()
      Gets the particle's canonical momentum on the X axis.
      Returns:
      the particle's canonical momentum on the X axis.
    • getPy

      public double getPy()
      Gets the particle's canonical momentum on the Y axis.
      Returns:
      the particle's canonical momentum on the Y axis.
    • getPz

      public double getPz()
      Gets the particle's canonical momentum on the Z axis.
      Returns:
      the particle's canonical momentum on the Z axis.
    • getCharge

      public double getCharge()
      Gets the particle's charge.
      Returns:
      the particle's charge.
    • setCharge

      public void setCharge(double charge)
      method for setting/updating the charge.
      Parameters:
      charge - the desired charge.
    • getMass

      public double getMass()
      Gets the particle's mass.
      Returns:
      the particle's mass.
    • setMass

      public void setMass(double mass)
      method for setting/updating the mass.
      Parameters:
      mass - the desired mass.
    • getHeader

      public static String getHeader()
      Returns:
      Header sting for the toString method.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getName

      public String getName()
      Gets the name of the particle.
      Returns:
      String of the particle name.
    • setName

      public void setName(String name)
      Sets the name for the particle.
      Parameters:
      name - The desired name.
    • getTime

      public double getTime()
      Gets the lifetime of the particle.
      Returns:
      the lifetime of the particle
    • getKineticMomentum

      public org.apache.commons.math3.geometry.euclidean.threed.Vector3D getKineticMomentum()
      Calculates and returns the kinetic momentum of the particle.
      Returns:
      A vector of the kinetic momentum. [kg*m/s]
    • updatePosition

      public void updatePosition(double xc, double yc, double zc)
    • updateMomentum

      public void updateMomentum(double px, double py, double pz, double ax, double ay, double az)
      Update the canonical momentum. We store in the particle object the vector potential too, in order to get the kinetic momentum if needed.
      Parameters:
      px - - Canonical momentum X component
      py - - Canonical momentum Y component
      pz - - Canonical momentum Z component
      ax - - Vector potential X component
      ay - - Vector potential Y component
      az - - Vector potential Z component
    • setTime

      public void setTime(double time)
    • getPreviousPosition

      public org.apache.commons.math3.geometry.euclidean.threed.Vector3D getPreviousPosition()
    • setPreviousPosition

      public void setPreviousPosition(org.apache.commons.math3.geometry.euclidean.threed.Vector3D prevPos)
    • setTerminated

      public void setTerminated(boolean terminated)
    • isTerminated

      public boolean isTerminated()
    • getPreviousKineticMomentum

      public org.apache.commons.math3.geometry.euclidean.threed.Vector3D getPreviousKineticMomentum()
    • setPreviousKineticMomentum

      public void setPreviousKineticMomentum(org.apache.commons.math3.geometry.euclidean.threed.Vector3D prevMom)
    • isLost

      public boolean isLost()
    • reset

      public void reset(boolean reverse)
      Resets the terminated flag to false, so the particle already tracked can be reused. If the terminated flag before the reset call is true and the reverse parameter is also true, it reverses the vector potential in the canonical momentum.
      Parameters:
      reverse - If true it reverses the momentum of the particle and attach the string "-backward" to the name of the particle.
    • copy

      public Particle copy(Particle p, PotentialProvider pp)