IAP GITLAB

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

changed implementation to PYTHIA-like

parent b1a1ac53
No related branches found
No related tags found
No related merge requests found
...@@ -53,9 +53,12 @@ namespace corsika::units::constants { ...@@ -53,9 +53,12 @@ namespace corsika::units::constants {
constexpr quantity<speed_d> c{Rep(299792458L) * meter / second}; constexpr quantity<speed_d> c{Rep(299792458L) * meter / second};
constexpr auto cSquared = c * c; constexpr auto cSquared = c * c;
// hbar * c
constexpr quantity<dimensions<1, 0, 0, 0, 0, 0, 0, 1>> hBarC{ constexpr quantity<dimensions<1, 0, 0, 0, 0, 0, 0, 1>> hBarC{
Rep(1.973'269'78e-7L) * electronvolt * meter}; // from RPP 2018 Rep(1.973'269'78e-7L) * electronvolt * meter}; // from RPP 2018
auto constexpr invGeVsq = 1e-18 / (electronvolt * electronvolt);
// unified atomic mass unit // unified atomic mass unit
constexpr quantity<mass_d> u{Rep(1.6605402e-27L) * kilogram}; constexpr quantity<mass_d> u{Rep(1.6605402e-27L) * kilogram};
......
...@@ -36,8 +36,10 @@ namespace corsika::process::HadronicElasticModel { ...@@ -36,8 +36,10 @@ namespace corsika::process::HadronicElasticModel {
: public corsika::process::InteractionProcess<HadronicElasticInteraction> { : public corsika::process::InteractionProcess<HadronicElasticInteraction> {
private: private:
corsika::units::si::CrossSectionType const fX, fY; corsika::units::si::CrossSectionType const fX, fY;
static double constexpr fEpsilon = 0.0808;
static double constexpr fEta = 0.4525; static double constexpr gfEpsilon = 0.0808;
static double constexpr gfEta = 0.4525;
// Froissart-Martin is not violated up for sqrt s < 10^32 eV with these values [DL].
using SquaredHEPEnergyType = decltype(corsika::units::si::HEPEnergyType() * using SquaredHEPEnergyType = decltype(corsika::units::si::HEPEnergyType() *
corsika::units::si::HEPEnergyType()); corsika::units::si::HEPEnergyType());
...@@ -47,33 +49,32 @@ namespace corsika::process::HadronicElasticModel { ...@@ -47,33 +49,32 @@ namespace corsika::process::HadronicElasticModel {
"HadronicElasticModel"); "HadronicElasticModel");
corsika::environment::Environment const& fEnvironment; corsika::environment::Environment const& fEnvironment;
auto B(corsika::units::si::HEPEnergyType sqrtS) const { auto B(decltype(units::si::detail::static_pow<2>(units::si::electronvolt)) s) const {
using namespace corsika::units::si; using namespace corsika::units::constants;
auto constexpr a = auto constexpr b_p = 2.3;
2.5 / (1_GeV * 1_GeV); // read off by eye from Gaisser, Engel, Resconi, fig. 4.9 return (2 * b_p + 2 * b_p + 4 * pow(s * invGeVsq, gfEpsilon) - 4.2) * invGeVsq;
auto constexpr b = 10 / (1_GeV * 1_GeV);
return a * std::log10(sqrtS / 10_GeV) + b;
} }
corsika::units::si::CrossSectionType CrossSection(SquaredHEPEnergyType s) const { corsika::units::si::CrossSectionType CrossSection(SquaredHEPEnergyType s) const {
using namespace corsika::units::si; using namespace corsika::units::si;
// according to Gaisser, Engel, Resconi, eq. (4.41) using namespace corsika::units::constants;
// assuming every target behaves like a proton // assuming every target behaves like a proton, fX and fY are universal
CrossSectionType const sigmaTot = fX * pow(s * (1 / (1_GeV * 1_GeV)), fEpsilon) + CrossSectionType const sigmaTot =
fY * pow(s * (1 / (1_GeV * 1_GeV)), -fEta); fX * pow(s * invGeVsq, gfEpsilon) + fY * pow(s * invGeVsq, -gfEta);
// we ignore rho because rho^2 is just ~2 % // according to Schuler & Sjöstrand, PRD 49, 2257 (1994)
// (we ignore rho because rho^2 is just ~2 %)
auto const sigmaElastic = auto const sigmaElastic =
sigmaTot * sigmaTot / units::si::detail::static_pow<2>(sigmaTot) /
(16 * M_PI * ConvertHEPToSI<CrossSectionType::dimension_type>(B(sqrt(s)))); (16 * M_PI * ConvertHEPToSI<CrossSectionType::dimension_type>(B(s)));
return sigmaElastic; return sigmaElastic;
} }
public: public:
HadronicElasticInteraction(corsika::environment::Environment const&, HadronicElasticInteraction(corsika::environment::Environment const&,
units::si::CrossSectionType x = 2.17e-5 * units::si::barn, // x & y values taken from Pythia8 for pp collisions
units::si::CrossSectionType y = 5.608e-5 * units::si::CrossSectionType x = 0.217 * units::si::barn,
units::si::barn); units::si::CrossSectionType y = 0.5608 * units::si::barn);
void Init(); void Init();
template <typename Particle, typename Track> template <typename Particle, typename Track>
...@@ -126,6 +127,7 @@ namespace corsika::process::HadronicElasticModel { ...@@ -126,6 +127,7 @@ namespace corsika::process::HadronicElasticModel {
} }
using namespace units::si; using namespace units::si;
using namespace units::constants;
const auto* currentNode = const auto* currentNode =
fEnvironment.GetUniverse()->GetContainingNode(p.GetPosition()); fEnvironment.GetUniverse()->GetContainingNode(p.GetPosition());
...@@ -166,8 +168,8 @@ namespace corsika::process::HadronicElasticModel { ...@@ -166,8 +168,8 @@ namespace corsika::process::HadronicElasticModel {
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);
auto const B = this->B(sqrtS); auto const B = this->B(s);
std::cout << B << std::endl; std::cout << B << std::endl;
corsika::random::ExponentialDistribution tDist(1 / B); corsika::random::ExponentialDistribution tDist(1 / B);
...@@ -176,41 +178,35 @@ namespace corsika::process::HadronicElasticModel { ...@@ -176,41 +178,35 @@ namespace corsika::process::HadronicElasticModel {
auto const maxT = 4 * pProjectileCoMSqNorm; auto const maxT = 4 * pProjectileCoMSqNorm;
do { do {
// |t| cannot become arbitrarily large, max. given by GEN eq. (4.16), so we just // |t| cannot become arbitrarily large, max. given by GER eq. (4.16), so we just
// throw again until we have an acceptable value note that the formula holds in // throw again until we have an acceptable value. Note that the formula holds in
// any frame despite of what is stated there // any frame despite of what is stated in the book.
absT = tDist(fRNG); absT = tDist(fRNG);
} while (absT >= maxT); } while (absT >= maxT);
return absT; return absT;
}(); }();
auto constexpr GeVsq = 1_GeV * 1_GeV; std::cout << "HadronicElasticInteraction: s = " << s * invGeVsq
std::cout << "s = " << s / GeVsq << " GeV²; absT = " << absT / GeVsq << " GeV²; absT = " << absT * invGeVsq
<< " GeV² (max./GeV² = " << 4 * projectileMomentumSquaredNorm / GeVsq << " GeV² (max./GeV² = " << 4 * invGeVsq * projectileMomentumSquaredNorm
<< ')' << std::endl; << ')' << std::endl;
auto const theta = auto const theta =
2 * asin(sqrt(absT / (4 * pProjectileCoMSqNorm))); // would work for in any frame 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{ geometry::QuantityVector<units::si::hepmomentum_d> const scatteredMomentum{
pProjectileCoMNorm * sin(theta) * cos(phi), pProjectileCoMNorm * sin(theta) * cos(phi),
pProjectileCoMNorm * sin(theta) * sin(phi), pProjectileCoMNorm * cos(theta)}; pProjectileCoMNorm * sin(theta) * sin(phi), pProjectileCoMNorm * cos(theta)};
auto const [eProjectileScatteredLab, pProjectileScatteredLab] = auto const [eProjectileScatteredLab, pProjectileScatteredLab] =
boost.fromCoM(eProjectileCoM, scatteredMomentum); boost.fromCoM(eProjectileCoM, scatteredMomentum);
std::cout << "xxx: " << pProjectileScatteredLab.squaredNorm() / p.GetMomentum().squaredNorm() << std::endl;
p.SetMomentum(pProjectileScatteredLab); p.SetMomentum(pProjectileScatteredLab);
p.SetEnergy(eProjectileScatteredLab); // alternatively recalculate energy from
// alternatives: 1. do not touch energy // momentum and mass
// 2. take back-boosted energy
// 3. recalculate energy from momentum
//~ p.SetEnergy(sqrt(pProjectileScatteredLab.squaredNorm() +
//~ units::si::detail::static_pow<2>(corsika::particles::GetMass(p.GetPID()))));
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