Class ParticleState
Defined in File ParticleState.h
Class Documentation
-
class ParticleState
State of the particle: ID, energy, position, direction.
The ParticleState defines the state of an ultra-high energy cosmic ray, which is assumed to be traveling at the exact speed of light. The cosmic ray state is defined by particle ID, energy and position and direction vector. For faster lookup mass and charge of the particle are stored as members.
Public Functions
-
ParticleState(int id = 0, double energy = 0, Vector3d position = Vector3d(0, 0, 0), Vector3d direction = Vector3d(-1, 0, 0))
Constructor for a particle state.
- Parameters:
id – id of the particle following the PDG numbering scheme
energy – energy of the particle [in Joules]
position – vector containing the coordinates of the particle [in meters]
direction – vector containing the direction of motion of the particle
-
void setPosition(const Vector3d &pos)
Set particle position. In simulations including cosmological effects, the position is given in comoving coordinates.
- Parameters:
pos – vector containing the coordinates of the particle [in meters]
-
const Vector3d &getPosition() const
Get position of particle.
- Returns:
Position vector of particle. If cosmological effects are included, the coordinates are comoving.
-
void setDirection(const Vector3d &dir)
Set direction unit vector, non unit-vectors are normalized
- Parameters:
dir – vector containing the direction of motion of the particle
-
const Vector3d &getDirection() const
Get direction unit vector
- Returns:
Normalized vector containing direction of motion of particle.
-
void setEnergy(double newEnergy)
Set energy of particle.
- Parameters:
newEnergy – energy to be assigned to particle [in Joules]
-
double getEnergy() const
Get energy of particle.
- Returns:
Energy of particle [in Joules]
-
double getRigidity() const
Get rigidity of particle, defined as E/(Z*e).
- Returns:
Rigidity of the particle [in Volts]
-
void setId(int newId)
Set particle ID. This follows the PDG numbering scheme: https://pdg.lbl.gov/2019/reviews/rpp2019-rev-monte-carlo-numbering.pdf
- Parameters:
newId – id to be assigned to the particle
-
int getId() const
Get particle ID
- Returns:
Particle ID (in PDG format).
-
std::string getDescription() const
-
double getCharge() const
Get electrical charge of the particle.
- Returns:
Charge of the particle [in Coulombs]
-
double getMass() const
Get mass of the particle.
- Returns:
Mass of the particle [kg]
-
void setLorentzFactor(double gamma)
Set Lorentz factor and modify the particle’s energy accordingly.
- Parameters:
gamma – Lorentz factor
-
double getLorentzFactor() const
Get Lorentz factor
- Returns:
Lorentz factor of particle
-
ParticleState(int id = 0, double energy = 0, Vector3d position = Vector3d(0, 0, 0), Vector3d direction = Vector3d(-1, 0, 0))