Warning, file /include/celeritas/phys/ParticleView.hh was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003
0004
0005
0006
0007 #pragma once
0008
0009 #include "ParticleData.hh"
0010
0011 namespace celeritas
0012 {
0013
0014
0015
0016
0017
0018
0019
0020 class ParticleView
0021 {
0022 public:
0023
0024
0025 using ParticleParamsRef = NativeCRef<ParticleParamsData>;
0026
0027
0028 public:
0029
0030 inline CELER_FUNCTION ParticleView(ParticleParamsRef const&, ParticleId);
0031
0032
0033 CELER_FORCEINLINE_FUNCTION ParticleId particle_id() const;
0034
0035
0036 CELER_FORCEINLINE_FUNCTION units::MevMass mass() const;
0037
0038
0039 CELER_FORCEINLINE_FUNCTION units::ElementaryCharge charge() const;
0040
0041
0042 CELER_FORCEINLINE_FUNCTION real_type decay_constant() const;
0043
0044
0045 CELER_FORCEINLINE_FUNCTION bool is_antiparticle() const;
0046
0047 private:
0048 ParticleParamsRef const& params_;
0049 ParticleId const particle_;
0050 };
0051
0052
0053
0054
0055
0056
0057
0058 CELER_FUNCTION
0059 ParticleView::ParticleView(ParticleParamsRef const& params, ParticleId id)
0060 : params_(params), particle_(id)
0061 {
0062 CELER_EXPECT(particle_ < params_.size());
0063 }
0064
0065
0066
0067
0068
0069 CELER_FUNCTION ParticleId ParticleView::particle_id() const
0070 {
0071 return particle_;
0072 }
0073
0074
0075
0076
0077
0078 CELER_FUNCTION units::MevMass ParticleView::mass() const
0079 {
0080 return params_.mass[particle_];
0081 }
0082
0083
0084
0085
0086
0087 CELER_FUNCTION units::ElementaryCharge ParticleView::charge() const
0088 {
0089 return params_.charge[particle_];
0090 }
0091
0092
0093
0094
0095
0096 CELER_FUNCTION real_type ParticleView::decay_constant() const
0097 {
0098 return params_.decay_constant[particle_];
0099 }
0100
0101
0102
0103
0104
0105 CELER_FUNCTION bool ParticleView::is_antiparticle() const
0106 {
0107 return params_.matter[particle_] == MatterType::antiparticle;
0108 }
0109
0110
0111 }