pub struct ParticleID(/* private fields */);Expand description
Particle ID according to the Monte Carlo Particle Numbering Scheme
Implementations§
Source§impl ParticleID
impl ParticleID
Sourcepub const fn new(id: i32) -> ParticleID
pub const fn new(id: i32) -> ParticleID
Construct from the given id
Sourcepub const fn latex_symbol(&self) -> Option<&'static str>
pub const fn latex_symbol(&self) -> Option<&'static str>
Particle symbol in LaTeX format
Sourcepub const fn id(self) -> i32
pub const fn id(self) -> i32
Get the corresponding integer
§Example
use particle_id::sm_elementary_particles::*;
assert_eq!(photon.id(), 22);Sourcepub const fn anti(self) -> ParticleID
pub const fn anti(self) -> ParticleID
Get the corresponding anti-particle
§Example
use particle_id::sm_elementary_particles::*;
assert_eq!(positron.anti(), electron);
assert_eq!(electron.anti(), positron);Sourcepub const fn abs(self) -> ParticleID
pub const fn abs(self) -> ParticleID
Get the corresponding particle for an anti-particle
If not used on an anti-particle, returns the particle itself
§Example
use particle_id::sm_elementary_particles::*;
assert_eq!(positron.abs(), electron);
assert_eq!(electron.abs(), electron);Sourcepub const fn is_anti_particle(&self) -> bool
pub const fn is_anti_particle(&self) -> bool
Check if this is an anti-particle
§Example
use particle_id::sm_elementary_particles::*;
assert!(!electron.is_anti_particle());
assert!(positron.is_anti_particle());Sourcepub const fn is_gauge_boson(&self) -> bool
pub const fn is_gauge_boson(&self) -> bool
Check if this is a gauge boson
§Example
use particle_id::sm_elementary_particles::*;
assert!(photon.is_gauge_boson());
assert!(!electron.is_gauge_boson());
assert!(!Higgs.is_gauge_boson());Sourcepub const fn is_quark(&self) -> bool
pub const fn is_quark(&self) -> bool
Check if this is a quark
Note that anti-quarks are not treated as quarks! Use abs()
if you want to include both quarks and anti-quarks.
§Example
use particle_id::sm_elementary_particles::*;
assert!(top.is_quark());
assert!(!anti_top.is_quark());
assert!(anti_top.abs().is_quark());
assert!(anti_top.anti().is_quark());Sourcepub const fn is_anti_quark(&self) -> bool
pub const fn is_anti_quark(&self) -> bool
Check if this is an anti-quark
§Example
use particle_id::sm_elementary_particles::*;
assert!(!top.is_anti_quark());
assert!(anti_top.is_anti_quark());Sourcepub const fn is_lepton(&self) -> bool
pub const fn is_lepton(&self) -> bool
Check if this is a lepton
Note that anti-leptons are not treated as leptons! Use abs()
if you want to include both leptons and anti-leptons.
Both charged leptons and neutrinos are included.
§Example
use particle_id::sm_elementary_particles::*;
assert!(muon.is_lepton());
assert!(!anti_muon.is_lepton());
assert!(anti_muon.abs().is_lepton());
assert!(anti_muon.anti().is_lepton());Sourcepub const fn is_anti_lepton(&self) -> bool
pub const fn is_anti_lepton(&self) -> bool
Check if this is an anti-lepton
§Example
use particle_id::sm_elementary_particles::*;
assert!(!muon.is_anti_lepton());
assert!(anti_muon.is_anti_lepton());Sourcepub const fn is_neutrino(&self) -> bool
pub const fn is_neutrino(&self) -> bool
Check if this is a neutrino
Note that anti-neutrinos are not treated as neutrinos! Use abs()
if you want to include both neutrinos and anti-neutrinos.
§Example
use particle_id::sm_elementary_particles::*;
assert!(muon_neutrino.is_neutrino());
assert!(!muon_anti_neutrino.is_neutrino());Sourcepub const fn is_anti_neutrino(&self) -> bool
pub const fn is_anti_neutrino(&self) -> bool
Check if this is an anti-neutrino
§Example
use particle_id::sm_elementary_particles::*;
assert!(!muon_neutrino.is_anti_neutrino());
assert!(muon_anti_neutrino.is_anti_neutrino());Sourcepub const fn is_charged_lepton(&self) -> bool
pub const fn is_charged_lepton(&self) -> bool
Check if this is a charged lepton
Note that anti-leptons are not treated as leptons! Use abs()
if you want to include both leptons and anti-leptons.
§Example
use particle_id::sm_elementary_particles::*;
assert!(muon.is_charged_lepton());
assert!(!electron_neutrino.is_charged_lepton());Sourcepub const fn is_charged_anti_lepton(&self) -> bool
pub const fn is_charged_anti_lepton(&self) -> bool
Check if this is a charged anti-lepton
§Example
use particle_id::sm_elementary_particles::*;
assert!(!muon.is_charged_anti_lepton());
assert!(anti_muon.is_charged_anti_lepton());Trait Implementations§
Source§impl Clone for ParticleID
impl Clone for ParticleID
Source§fn clone(&self) -> ParticleID
fn clone(&self) -> ParticleID
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ParticleID
impl Debug for ParticleID
Source§impl<'de> Deserialize<'de> for ParticleID
impl<'de> Deserialize<'de> for ParticleID
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<ParticleID, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<ParticleID, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl Hash for ParticleID
impl Hash for ParticleID
Source§impl Ord for ParticleID
impl Ord for ParticleID
Source§fn cmp(&self, other: &ParticleID) -> Ordering
fn cmp(&self, other: &ParticleID) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for ParticleID
impl PartialEq for ParticleID
Source§impl PartialOrd for ParticleID
impl PartialOrd for ParticleID
Source§impl Serialize for ParticleID
impl Serialize for ParticleID
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl Copy for ParticleID
impl Eq for ParticleID
impl StructuralPartialEq for ParticleID
Auto Trait Implementations§
impl Freeze for ParticleID
impl RefUnwindSafe for ParticleID
impl Send for ParticleID
impl Sync for ParticleID
impl Unpin for ParticleID
impl UnwindSafe for ParticleID
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more