Nuclide/
particle.rs

1use Pion::AntiBaryon;
2use Pion::Baryon;
3use Pion::AntiLepton;
4use Pion::Lepton;
5//use Pion::photon::Photon;
6
7use crate::nstruct::Nuclide;
8
9/// Generalized representation of potential decay particles
10#[derive(Debug, Clone)]
11pub enum Particle {
12    /// Photon and frequency
13    Photon(f64),
14    /// Leptons including Electrons, Neutrinos, and AntiNeutrinos  
15    Lepton(Lepton),
16    /// AntiLeptons  
17    AntiLepton(AntiLepton),
18    /// Proton or Neutron  
19    Baryon(Baryon),
20    /// AntiBaryons   
21    AntiBaryon(AntiBaryon),
22    /// Alpha particle    
23    Alpha(f64),
24    /// Deuterium nucleus    
25    Deuteron(f64),
26    /// Tritium nucleus     
27    Triton(f64),
28    /// Elemental nucleus    
29    Element(Nuclide, f64),
30    // IsoElement(Isomer,f64),
31}
32
33impl Particle {
34    pub fn identity(&self) -> String {
35        match self {
36            Particle::Photon(x) => x.to_string() + " MeV γ",
37            Particle::Lepton(x) => match x {
38                Lepton::Electron(y) => y.to_string() + " MeV β-",
39                Lepton::Muon(y) => y.to_string() + " MeV μ",
40                Lepton::Tau(y) => y.to_string() + " MeV τ",
41                Lepton::ElectronNeutrino(y) => y.to_string() + " MeV νe",
42                Lepton::MuNeutrino(y) => y.to_string() + " MeV νμ",
43                Lepton::TauNeutrino(y) => y.to_string() + " MeV ντ",
44            },
45            Particle::AntiLepton(x) => match x {
46                AntiLepton::Electron(y) => y.to_string() + " MeV β+",
47                AntiLepton::Muon(y) => y.to_string() + " MeV -μ",
48                AntiLepton::Tau(y) => y.to_string() + " MeV -τ",
49                AntiLepton::ElectronNeutrino(y) => y.to_string() + " MeV -ve",
50                AntiLepton::MuNeutrino(y) => y.to_string() + " MeV -νμ",
51                AntiLepton::TauNeutrino(y) => y.to_string() + " MeV -ντ",
52            },
53
54            Particle::Baryon(x) => match x {
55                Baryon::Proton(y) => y.to_string() + " MeV p",
56                Baryon::Neutron(y) => y.to_string() + " MeV n",
57            },
58            Particle::AntiBaryon(x) => match x {
59                AntiBaryon::Proton(y) => y.to_string() + " MeV -p",
60                AntiBaryon::Neutron(y) => y.to_string() + " MeV -n",
61            },
62            Particle::Alpha(x) => x.to_string() + " MeV α",
63            Particle::Deuteron(x) => x.to_string() + " MeV d",
64            Particle::Triton(x) => x.to_string() + " MeV t",
65            Particle::Element(x, z) => z.to_string() + &x.to_string(),
66        }
67    }
68    
69    #[allow(dead_code)]
70    pub fn energy(&self) -> f64 {
71        match self {
72            Particle::Photon(x) => *x,
73            Particle::Lepton(x) => match x {
74                Lepton::Electron(y) => *y,
75                Lepton::Muon(y) => *y,
76                Lepton::Tau(y) => *y,
77                Lepton::ElectronNeutrino(y) => *y,
78                Lepton::MuNeutrino(y) => *y,
79                Lepton::TauNeutrino(y) => *y,
80            },
81            Particle::AntiLepton(x) => match x {
82                AntiLepton::Electron(y) => *y,
83                AntiLepton::Muon(y) => *y,
84                AntiLepton::Tau(y) => *y,
85                AntiLepton::ElectronNeutrino(y) => *y,
86                AntiLepton::MuNeutrino(y) => *y,
87                AntiLepton::TauNeutrino(y) => *y,
88            },
89
90            Particle::Baryon(x) => match x {
91                Baryon::Proton(y) => *y,
92                Baryon::Neutron(y) => *y,
93            },
94            Particle::AntiBaryon(x) => match x {
95                AntiBaryon::Proton(y) => *y,
96                AntiBaryon::Neutron(y) => *y,
97            },
98            Particle::Alpha(x) => *x,
99            Particle::Deuteron(x) => *x,
100            Particle::Triton(x) => *x,
101            Particle::Element(_, z) => *z,
102        }
103    }
104}