IAP GITLAB

Skip to content
Snippets Groups Projects
Commit 4042bf3d authored by ralfulrich's avatar ralfulrich
Browse files

found few more setMomentum

parent e7e34470
No related branches found
No related tags found
No related merge requests found
...@@ -81,18 +81,15 @@ namespace corsika::proposal { ...@@ -81,18 +81,15 @@ namespace corsika::proposal {
// update particle direction after continuous loss caused by multiple // update particle direction after continuous loss caused by multiple
// scattering // scattering
auto particle_momentum = vP.getMomentum().getNorm(); vP.setDirection(
auto vec = QuantityVector(final_direction.GetX() * particle_momentum, {vP_dir.getCoordinateSystem(),
final_direction.GetY() * particle_momentum, {final_direction.GetX(), final_direction.GetY(), final_direction.GetZ()}});
final_direction.GetZ() * particle_momentum);
vP.setMomentum(MomentumVector(vP_dir.getCoordinateSystem(), vec));
} }
template <typename TParticle, typename TTrajectory> template <typename TParticle, typename TTrajectory>
inline ProcessReturn ContinuousProcess::doContinuous(TParticle& vP, inline ProcessReturn ContinuousProcess::doContinuous(TParticle& vP,
TTrajectory const& vT, TTrajectory const& vT,
bool const) { bool const) {
if (!canInteract(vP.getPID())) return ProcessReturn::Ok; if (!canInteract(vP.getPID())) return ProcessReturn::Ok;
if (vT.getLength() == 0_m) return ProcessReturn::Ok; if (vT.getLength() == 0_m) return ProcessReturn::Ok;
...@@ -110,10 +107,7 @@ namespace corsika::proposal { ...@@ -110,10 +107,7 @@ namespace corsika::proposal {
// if the particle has a charge take multiple scattering into account // if the particle has a charge take multiple scattering into account
if (vP.getChargeNumber() != 0) scatter(vP, dE, dX); if (vP.getChargeNumber() != 0) scatter(vP, dE, dX);
vP.setEnergy(final_energy); vP.setEnergy(final_energy); // on the stack, this is just kinetic energy, E-m
auto new_momentum =
sqrt(vP.getEnergy() * vP.getEnergy() - vP.getMass() * vP.getMass());
vP.setMomentum(vP.getMomentum() * new_momentum / vP.getMomentum().getNorm());
return ProcessReturn::Ok; return ProcessReturn::Ok;
} }
...@@ -123,8 +117,8 @@ namespace corsika::proposal { ...@@ -123,8 +117,8 @@ namespace corsika::proposal {
auto const code = vP.getPID(); auto const code = vP.getPID();
if (!canInteract(code)) return meter * std::numeric_limits<double>::infinity(); if (!canInteract(code)) return meter * std::numeric_limits<double>::infinity();
// Limit the step size of a conitnuous loss. The maximal continuous loss seems to be a // Limit the step size of a conitnuous loss. The maximal continuous loss seems to be
// hyper parameter which must be adjusted. // a hyper parameter which must be adjusted.
// //
auto const energy = vP.getEnergy(); auto const energy = vP.getEnergy();
auto const energy_lim = auto const energy_lim =
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment