MARLEY (Model of Argon Reaction Low Energy Yields)  v1.1.0
A Monte Carlo event generator for tens-of-MeV neutrino-nucleus interactions in liquid argon
 All Classes Functions Variables Enumerations Pages
Public Member Functions | Protected Attributes | List of all members
marley::Particle Class Reference

Momentum four-vector for a simulated particle. More...

#include <Particle.hh>

Public Member Functions

 Particle (int pdg_code, double m)
 
 Particle (int pdg_code, double m, int q)
 
 Particle (int pdg_code, double px, double py, double pz, double m)
 
 Particle (int pdg_code, double px, double py, double pz, double m, int q)
 
 Particle (int pdg_code, double E, double px, double py, double pz, double m)
 
 Particle (int pdg_code, double E, double px, double py, double pz, double m, int q)
 
double charge () const
 Get the particle's charge in units of the proton charge.
 
double kinetic_energy () const
 Get the particle's kinetic energy (MeV)
 
double mass () const
 Get the particle's mass (MeV)
 
double momentum_magnitude () const
 Get the magnitude of the particle's 3-momentum (MeV)
 
int pdg_code () const
 Get the Particle Data Group code for this particle.
 
void print (std::ostream &out) const
 Print information about this particle to a std::ostream. More...
 
double px () const
 Get the x component of the particle's 3-momentum (MeV)
 
double py () const
 Get the y component of the particle's 3-momentum (MeV)
 
double pz () const
 Get the z component of the particle's 3-momentum (MeV)
 
void read (std::istream &in)
 Read in this particle from a std::istream. Any previous contents of this particle will be deleted.
 
void set_charge (int q)
 Set the particle's charge. More...
 
void set_mass (double m)
 Set the particle's mass. More...
 
void set_px (double px)
 Set the x component of the particle's 3-momentum. More...
 
void set_py (double py)
 Set the y component of the particle's 3-momentum. More...
 
void set_pz (double pz)
 Set the z component of the particle's 3-momentum. More...
 
void set_total_energy (double Etot)
 Set the particle's total energy. More...
 
marley::JSON to_json () const
 Create a JSON representation of this Particle.
 
double total_energy () const
 Get the particle's total energy (MeV)
 

Protected Attributes

int charge_ = 0
 Electric charge (net charge in the case of atoms) expressed as an integer multiple of the proton charge. More...
 
double four_momentum_ [4]
 momentum 4-vector for this particle (MeV) More...
 
double mass_ = 0.
 mass (MeV) More...
 
int pdg_code_ = 0
 Particle Data Group code identifying this particle More...
 

Detailed Description

Momentum four-vector for a simulated particle.

Constructor & Destructor Documentation

marley::Particle::Particle ( int  pdg_code,
double  m 
)
Parameters
pdg_codeParticle Data Group code
mmass (MeV)
marley::Particle::Particle ( int  pdg_code,
double  m,
int  q 
)
Parameters
pdg_codeParticle Data Group code
mmass (MeV)
qcharge in units of the proton charge
marley::Particle::Particle ( int  pdg_code,
double  px,
double  py,
double  pz,
double  m 
)
Parameters
pdg_codeParticle Data Group code
px3-momentum x component (MeV)
py3-momentum y component (MeV)
pz3-momentum z component (MeV)
mmass (MeV)
marley::Particle::Particle ( int  pdg_code,
double  px,
double  py,
double  pz,
double  m,
int  q 
)
Parameters
pdg_codeParticle Data Group code
px3-momentum x component (MeV)
py3-momentum y component (MeV)
pz3-momentum z component (MeV)
mmass (MeV)
qcharge in units of the proton charge
marley::Particle::Particle ( int  pdg_code,
double  E,
double  px,
double  py,
double  pz,
double  m 
)
Parameters
pdg_codeParticle Data Group code
Etotal energy (MeV)
px3-momentum x component (MeV)
py3-momentum y component (MeV)
pz3-momentum z component (MeV)
mmass (MeV)
marley::Particle::Particle ( int  pdg_code,
double  E,
double  px,
double  py,
double  pz,
double  m,
int  q 
)
Parameters
pdg_codeParticle Data Group code
Etotal energy (MeV)
px3-momentum x component (MeV)
py3-momentum y component (MeV)
pz3-momentum z component (MeV)
mmass (MeV)
qcharge in units of the proton charge

Member Function Documentation

void marley::Particle::print ( std::ostream &  out) const

Print information about this particle to a std::ostream.

Note
Although marley::Event::print() guarantees full precision for stream output, this function does not if it is called directly. If you need to serialize individual particle objects to text and read them back in again, either use an output stream with the proper precision set in advance (at least std::numeric_limits<double>::max_digits10), or consider using JSON input/output.
void marley::Particle::set_charge ( int  q)
inline

Set the particle's charge.

Parameters
qcharge in units of the proton charge
void marley::Particle::set_mass ( double  m)
inline

Set the particle's mass.

Parameters
mmass (MeV)
void marley::Particle::set_px ( double  px)
inline

Set the x component of the particle's 3-momentum.

Parameters
px3-momentum x component (MeV)
void marley::Particle::set_py ( double  py)
inline

Set the y component of the particle's 3-momentum.

Parameters
py3-momentum y component (MeV)
void marley::Particle::set_pz ( double  pz)
inline

Set the z component of the particle's 3-momentum.

Parameters
pz3-momentum z component (MeV)
void marley::Particle::set_total_energy ( double  Etot)
inline

Set the particle's total energy.

Parameters
Etottotal energy (MeV)

Member Data Documentation

int marley::Particle::charge_ = 0
protected

Electric charge (net charge in the case of atoms) expressed as an integer multiple of the proton charge.

This class member allows a marley::Particle to represent an atom or ion. The charge_ data member was added because the 2014 PDG codes do not include a prescription for representing ionization states of atoms.

Todo:
add error handling for cases where a marley::Particle is constructed with a charge that is inappropriate.
double marley::Particle::four_momentum_[4]
protected

momentum 4-vector for this particle (MeV)

The order of the components is (E, px, py, pz)

Note
This should be replaced by the more modern std::array<double, 4>. However, we use a C-style array here to allow ROOT 5, which is widely used but not C++11 compliant, to generate dictionaries for this class for TFile I/O. It'd be nice to include a default initializer here (say, = {0., 0., 0., 0.}), but ROOT 5 can't handle that either.
double marley::Particle::mass_ = 0.
protected

mass (MeV)

Note
We precompute the particle mass (as opposed to obtaining it from the momentum 4-vector) for speed and to avoid roundoff errors.
Todo:
Refactor the Particle class to ensure that the mass, 3-momentum, and total energy are always consistent with each other. MARLEY enforces this by using the Particle class carefully, but consistency should be guaranteed in the Particle class internals.
int marley::Particle::pdg_code_ = 0
protected

Particle Data Group code identifying this particle

See the full list of PDG codes for details.


The documentation for this class was generated from the following files: