IAP GITLAB

Skip to content
Snippets Groups Projects
Commit eac2cb73 authored by Jean-Marco Alameddine's avatar Jean-Marco Alameddine Committed by Ralf Ulrich
Browse files

Fix wrong treatment of energies in proposal::ContinuousProcess:doContinuous

Update particle direction in proposal::ContinuousProcess::scatter
parent e3e036c3
No related branches found
No related tags found
No related merge requests found
...@@ -73,14 +73,17 @@ namespace corsika::proposal { ...@@ -73,14 +73,17 @@ namespace corsika::proposal {
for (auto& it : rnd) it = distr(RNG_); for (auto& it : rnd) it = distr(RNG_);
// calculate deflection based on particle energy, loss // calculate deflection based on particle energy, loss
[[maybe_unused]] auto deflection = (c->second).scatter->CalculateMultipleScattering( auto deflection = (c->second).scatter->CalculateMultipleScattering(
grammage / 1_g * square(1_cm), vP.getEnergy() / 1_MeV, E_f / 1_MeV, rnd); grammage / 1_g * square(1_cm), vP.getEnergy() / 1_MeV, E_f / 1_MeV, rnd);
// TODO: multiple scattering is temporary deactivated !!!!! [[maybe_unused]] auto [unused1, final_direction] = PROPOSAL::multiple_scattering::ScatterInitialDirection(direction, deflection);
// update particle direction after continuous loss caused by multiple // update particle direction after continuous loss caused by multiple
// scattering // scattering
auto vec = QuantityVector(direction.GetX() * E_f, direction.GetY() * E_f, auto particle_momentum = vP.getMomentum().getNorm();
direction.GetZ() * E_f); auto vec = QuantityVector(final_direction.GetX() * particle_momentum,
final_direction.GetY() * particle_momentum,
final_direction.GetZ() * particle_momentum);
vP.setMomentum(MomentumVector(vP_dir.getCoordinateSystem(), vec)); vP.setMomentum(MomentumVector(vP_dir.getCoordinateSystem(), vec));
} }
...@@ -108,7 +111,8 @@ namespace corsika::proposal { ...@@ -108,7 +111,8 @@ 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);
vP.setMomentum(vP.getMomentum() * vP.getEnergy() / vP.getMomentum().getNorm()); 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;
} }
......
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