10#ifndef IMPACTX_REFERENCE_PARTICLE_H
11#define IMPACTX_REFERENCE_PARTICLE_H
32 amrex::ParticleReal
s = 0.0;
33 amrex::ParticleReal
x = 0.0;
34 amrex::ParticleReal
y = 0.0;
35 amrex::ParticleReal
z = 0.0;
36 amrex::ParticleReal
t = 0.0;
37 amrex::ParticleReal
px = 0.0;
38 amrex::ParticleReal
py = 0.0;
39 amrex::ParticleReal
pz = 0.0;
40 amrex::ParticleReal
pt = 0.0;
41 amrex::ParticleReal
mass = 0.0;
44 amrex::ParticleReal
sedge = 0.0;
64 reset (
bool keep_mass=
false,
bool keep_charge=
false)
72 if (keep_mass) {
mass = old_mass; }
73 if (keep_charge) {
charge = old_charge; }
84 amrex::ParticleReal
const ref_gamma = -
pt;
96 using namespace amrex::literals;
99 amrex::ParticleReal
const ref_gamma = -
pt;
100 amrex::ParticleReal
const ref_beta = std::sqrt(1.0_prt - 1.0_prt / powi<2>(ref_gamma));
112 using namespace amrex::literals;
115 amrex::ParticleReal
const ref_gamma = -
pt;
116 amrex::ParticleReal
const ref_betagamma = std::sqrt(powi<2>(ref_gamma) - 1.0_prt);
117 return ref_betagamma;
128 using namespace amrex::literals;
131 return amrex::ParticleReal(
mass * inv_MeV_invc2);
142 using namespace amrex::literals;
146 "set_mass_MeV: Mass cannot be zero!");
154 pz = std::sqrt(powi<2>(
pt) - 1.0_prt);
168 using namespace amrex::literals;
170 amrex::ParticleReal
const ref_gamma = -
pt;
171 amrex::ParticleReal
const ref_kin_energy =
mass_MeV() * (ref_gamma - 1.0_prt);
172 return ref_kin_energy;
183 using namespace amrex::literals;
187 "set_kin_energy_MeV: Set mass first!");
192 pz = std::sqrt(powi<2>(
pt) - 1.0_prt);
205 using namespace amrex::literals;
208 amrex::ParticleReal
const ref_gamma = -
pt;
209 amrex::ParticleReal
const ref_betagamma = std::sqrt(powi<2>(ref_gamma) - 1.0_prt);
222 using namespace amrex::literals;
225 return amrex::ParticleReal(
charge * inv_qe);
236 using namespace amrex::literals;
#define AMREX_ASSERT_WITH_MESSAGE(EX, MSG)
#define AMREX_FORCE_INLINE
#define AMREX_GPU_HOST_DEVICE
static constexpr auto MeV_invc2
static constexpr auto q_e
constexpr T powi(T x) noexcept
Definition CovarianceMatrixMath.H:25
Definition ReferenceParticle.H:31
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::ParticleReal qm_ratio_SI() const
Definition ReferenceParticle.H:249
amrex::ParticleReal px
momentum in x divided by m*c = beta_x*gamma [unitless]
Definition ReferenceParticle.H:37
amrex::ParticleReal y
vertical position y, in meters
Definition ReferenceParticle.H:34
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::ParticleReal beta_gamma() const
Definition ReferenceParticle.H:110
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE RefPart & set_mass_MeV(amrex::ParticleReal const massE)
Definition ReferenceParticle.H:140
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::ParticleReal kin_energy_MeV() const
Definition ReferenceParticle.H:166
amrex::ParticleReal pt
energy, normalized by rest energy
Definition ReferenceParticle.H:40
amrex::ParticleReal py
momentum in y divided by m*c = beta_y*gamma [unitless]
Definition ReferenceParticle.H:38
amrex::SmallMatrix< amrex::ParticleReal, 6, 6, amrex::Order::F, 1 > map
linearized map
Definition ReferenceParticle.H:45
amrex::ParticleReal charge
reference charge, in C
Definition ReferenceParticle.H:42
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::ParticleReal rigidity_Tm() const
Definition ReferenceParticle.H:203
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE RefPart & set_kin_energy_MeV(amrex::ParticleReal const kin_energy)
Definition ReferenceParticle.H:181
amrex::ParticleReal s
integrated orbit path length, in meters
Definition ReferenceParticle.H:32
amrex::ParticleReal z
longitudinal position z, in meters
Definition ReferenceParticle.H:35
amrex::ParticleReal pz
momentum in z divided by m*c = beta_z*gamma [unitless]
Definition ReferenceParticle.H:39
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::ParticleReal mass_MeV() const
Definition ReferenceParticle.H:126
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE RefPart & set_charge_qe(amrex::ParticleReal const charge_qe)
Definition ReferenceParticle.H:234
amrex::ParticleReal mass
reference rest mass, in kg
Definition ReferenceParticle.H:41
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::ParticleReal charge_qe() const
Definition ReferenceParticle.H:220
amrex::ParticleReal x
horizontal position x, in meters
Definition ReferenceParticle.H:33
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::ParticleReal beta() const
Definition ReferenceParticle.H:94
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::ParticleReal gamma() const
Definition ReferenceParticle.H:82
amrex::ParticleReal t
clock time * c in meters
Definition ReferenceParticle.H:36
void reset(bool keep_mass=false, bool keep_charge=false)
Definition ReferenceParticle.H:64
amrex::ParticleReal sedge
value of s at entrance of the current beamline element
Definition ReferenceParticle.H:44
RefPart copy() const
Definition ReferenceParticle.H:53