IAP GITLAB

Skip to content
Snippets Groups Projects
Commit 7320b195 authored by Maximilian Reininghaus's avatar Maximilian Reininghaus :vulcan:
Browse files

energy recalculation

parent 2b0a9ee7
No related branches found
No related tags found
No related merge requests found
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include <corsika/environment/Environment.h> #include <corsika/environment/Environment.h>
#include <corsika/environment/NuclearComposition.h> #include <corsika/environment/NuclearComposition.h>
#include <corsika/geometry/FourVector.h>
#include <corsika/particles/ParticleProperties.h> #include <corsika/particles/ParticleProperties.h>
#include <corsika/process/InteractionProcess.h> #include <corsika/process/InteractionProcess.h>
#include <corsika/random/ExponentialDistribution.h> #include <corsika/random/ExponentialDistribution.h>
...@@ -156,16 +157,22 @@ namespace corsika::process::HadronicElasticModel { ...@@ -156,16 +157,22 @@ namespace corsika::process::HadronicElasticModel {
std::uniform_real_distribution phiDist(0., 2 * M_PI); std::uniform_real_distribution phiDist(0., 2 * M_PI);
utl::COMBoost const boost(projectileEnergy, projectileMomentum, targetMass); geometry::FourVector const projectileLab(projectileEnergy, projectileMomentum);
auto const [eProjectileCoM, pProjectileCoM] = geometry::FourVector const targetLab(
boost.toCoM(projectileEnergy, projectileMomentum);
auto const [eTargetCoM, pTargetCoM] = boost.toCoM(
targetMass, geometry::Vector<units::si::hepmomentum_d>( targetMass, geometry::Vector<units::si::hepmomentum_d>(
projectileMomentum.GetCoordinateSystem(), {0_eV, 0_eV, 0_eV})); projectileMomentum.GetCoordinateSystem(), {0_eV, 0_eV, 0_eV}));
utl::COMBoost const boost(projectileLab, targetMass);
auto const pProjectileCoMSqNorm = pProjectileCoM.squaredNorm(); auto const projectileCoM = boost.toCoM(projectileLab);
auto const targetCoM = boost.toCoM(targetLab);
auto const pProjectileCoMSqNorm =
projectileCoM.GetSpaceLikeComponents().squaredNorm();
auto const pProjectileCoMNorm = sqrt(pProjectileCoMSqNorm); auto const pProjectileCoMNorm = sqrt(pProjectileCoMSqNorm);
auto const eProjectileCoM = projectileCoM.GetTimeLikeComponent();
auto const eTargetCoM = targetCoM.GetTimeLikeComponent();
auto const sqrtS = eProjectileCoM + eTargetCoM; auto const sqrtS = eProjectileCoM + eTargetCoM;
auto const s = units::si::detail::static_pow<2>(sqrtS); auto const s = units::si::detail::static_pow<2>(sqrtS);
...@@ -192,21 +199,23 @@ namespace corsika::process::HadronicElasticModel { ...@@ -192,21 +199,23 @@ namespace corsika::process::HadronicElasticModel {
<< " GeV² (max./GeV² = " << 4 * invGeVsq * projectileMomentumSquaredNorm << " GeV² (max./GeV² = " << 4 * invGeVsq * projectileMomentumSquaredNorm
<< ')' << std::endl; << ')' << std::endl;
auto const theta = auto const theta = 2 * asin(sqrt(absT / (4 * pProjectileCoMSqNorm)));
2 *
asin(sqrt(absT / (4 * pProjectileCoMSqNorm))); // would work for in any frame
auto const phi = phiDist(fRNG); auto const phi = phiDist(fRNG);
geometry::QuantityVector<units::si::hepmomentum_d> const scatteredMomentum{ auto const projectileScatteredLab = boost.fromCoM(
pProjectileCoMNorm * sin(theta) * cos(phi), geometry::FourVector<HEPEnergyType, geometry::Vector<hepmomentum_d>>(
pProjectileCoMNorm * sin(theta) * sin(phi), pProjectileCoMNorm * cos(theta)}; eProjectileCoM,
geometry::Vector<hepmomentum_d>(projectileMomentum.GetCoordinateSystem(),
auto const [eProjectileScatteredLab, pProjectileScatteredLab] = {pProjectileCoMNorm * sin(theta) * cos(phi),
boost.fromCoM(eProjectileCoM, scatteredMomentum); pProjectileCoMNorm * sin(theta) * sin(phi),
pProjectileCoMNorm * cos(theta)})));
p.SetMomentum(pProjectileScatteredLab);
p.SetEnergy(eProjectileScatteredLab); // alternatively recalculate energy from p.SetMomentum(projectileScatteredLab.GetSpaceLikeComponents());
// momentum and mass p.SetEnergy(
sqrt(projectileScatteredLab.GetSpaceLikeComponents().squaredNorm() +
units::si::detail::static_pow<2>(corsika::particles::GetMass(
p.GetPID())))); // Don't use energy from boost. It can be smaller than
// the momentum due to limited numerical accuracy.
return process::EProcessReturn::eOk; return process::EProcessReturn::eOk;
} }
......
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