java.lang.Object
simpa.core.api.track.Particle
Object that represents a particle.
-
Constructor Summary
ConstructorsConstructorDescriptionParticle
(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 TypeMethodDescriptioncopy
(Particle p, PotentialProvider pp) 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
getMass()
Gets the particle's mass.getName()
Gets the name of the particle.org.apache.commons.math3.geometry.euclidean.threed.Vector3D
org.apache.commons.math3.geometry.euclidean.threed.Vector3D
double
getPx()
Gets the particle's canonical momentum on the X axis.double
getPy()
Gets the particle's canonical momentum on the Y axis.double
getPz()
Gets the particle's canonical momentum on the Z axis.double
getTime()
Gets the lifetime of the particle.double
getX()
Gets the X position of the particle.double
getY()
Gets the Y position of the particle.double
getZ()
Gets the Z position of the particle.boolean
isLost()
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) toString()
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)
-
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 vectordir
- direction vectorvp
- the vector potential at the positionpInGeV
- 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 positionay
- Y component of the vector potential at the particle positionaz
- Z component of the vector potential at the particle positioncharge
- 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
- Returns:
- Header sting for the toString method.
-
toString
-
getName
Gets the name of the particle.- Returns:
- String of the particle name.
-
setName
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 componentpy
- - Canonical momentum Y componentpz
- - Canonical momentum Z componentax
- - Vector potential X componentay
- - Vector potential Y componentaz
- - 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
-