use Pion::AntiBaryon;
use Pion::Baryon;
use Pion::AntiLepton;
use Pion::Lepton;
use crate::nstruct::Nuclide;
#[derive(Debug, Clone)]
pub enum Particle {
Photon(f64),
Lepton(Lepton),
AntiLepton(AntiLepton),
Baryon(Baryon),
AntiBaryon(AntiBaryon),
Alpha(f64),
Deuteron(f64),
Triton(f64),
Element(Nuclide, f64),
}
impl Particle {
pub fn identity(&self) -> String {
match self {
Particle::Photon(x) => x.to_string() + " MeV γ",
Particle::Lepton(x) => match x {
Lepton::Electron(y) => y.to_string() + " MeV β-",
Lepton::Muon(y) => y.to_string() + " MeV μ",
Lepton::Tau(y) => y.to_string() + " MeV τ",
Lepton::ElectronNeutrino(y) => y.to_string() + " MeV νe",
Lepton::MuNeutrino(y) => y.to_string() + " MeV νμ",
Lepton::TauNeutrino(y) => y.to_string() + " MeV ντ",
},
Particle::AntiLepton(x) => match x {
AntiLepton::Electron(y) => y.to_string() + " MeV β+",
AntiLepton::Muon(y) => y.to_string() + " MeV -μ",
AntiLepton::Tau(y) => y.to_string() + " MeV -τ",
AntiLepton::ElectronNeutrino(y) => y.to_string() + " MeV -ve",
AntiLepton::MuNeutrino(y) => y.to_string() + " MeV -νμ",
AntiLepton::TauNeutrino(y) => y.to_string() + " MeV -ντ",
},
Particle::Baryon(x) => match x {
Baryon::Proton(y) => y.to_string() + " MeV p",
Baryon::Neutron(y) => y.to_string() + " MeV n",
},
Particle::AntiBaryon(x) => match x {
AntiBaryon::Proton(y) => y.to_string() + " MeV -p",
AntiBaryon::Neutron(y) => y.to_string() + " MeV -n",
},
Particle::Alpha(x) => x.to_string() + " MeV α",
Particle::Deuteron(x) => x.to_string() + " MeV d",
Particle::Triton(x) => x.to_string() + " MeV t",
Particle::Element(x, z) => z.to_string() + &x.to_string(),
}
}
#[allow(dead_code)]
pub fn energy(&self) -> f64 {
match self {
Particle::Photon(x) => *x,
Particle::Lepton(x) => match x {
Lepton::Electron(y) => *y,
Lepton::Muon(y) => *y,
Lepton::Tau(y) => *y,
Lepton::ElectronNeutrino(y) => *y,
Lepton::MuNeutrino(y) => *y,
Lepton::TauNeutrino(y) => *y,
},
Particle::AntiLepton(x) => match x {
AntiLepton::Electron(y) => *y,
AntiLepton::Muon(y) => *y,
AntiLepton::Tau(y) => *y,
AntiLepton::ElectronNeutrino(y) => *y,
AntiLepton::MuNeutrino(y) => *y,
AntiLepton::TauNeutrino(y) => *y,
},
Particle::Baryon(x) => match x {
Baryon::Proton(y) => *y,
Baryon::Neutron(y) => *y,
},
Particle::AntiBaryon(x) => match x {
AntiBaryon::Proton(y) => *y,
AntiBaryon::Neutron(y) => *y,
},
Particle::Alpha(x) => *x,
Particle::Deuteron(x) => *x,
Particle::Triton(x) => *x,
Particle::Element(_, z) => *z,
}
}
}