IAP GITLAB

Skip to content
Snippets Groups Projects
Commit 8284f24a authored by Maximilian Reininghaus's avatar Maximilian Reininghaus :vulcan: Committed by ralfulrich
Browse files

switched to our units-enabled exponential distribution

parent 1145ac29
No related branches found
No related tags found
2 merge requests!91Resolve "define further classes of processes (MaintenanceProcess?)",!76Resolve "Handling of boundary crossings in geometry tree"
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#include <corsika/process/ProcessReturn.h> #include <corsika/process/ProcessReturn.h>
#include <corsika/random/RNGManager.h> #include <corsika/random/RNGManager.h>
#include <corsika/random/UniformRealDistribution.h> #include <corsika/random/UniformRealDistribution.h>
#include <corsika/random/ExponentialDistribution.h>
#include <corsika/setup/SetupTrajectory.h> #include <corsika/setup/SetupTrajectory.h>
#include <corsika/units/PhysicalUnits.h> #include <corsika/units/PhysicalUnits.h>
...@@ -115,8 +116,8 @@ namespace corsika::cascade { ...@@ -115,8 +116,8 @@ namespace corsika::cascade {
fProcessSequence.GetTotalInverseInteractionLength(particle, step); fProcessSequence.GetTotalInverseInteractionLength(particle, step);
// sample random exponential step length in grammage // sample random exponential step length in grammage
std::exponential_distribution expDist(total_inv_lambda * (1_g / (1_m * 1_m))); corsika::random::ExponentialDistribution expDist(1 / total_inv_lambda);
GrammageType const next_interact = (1_g / (1_m * 1_m)) * expDist(fRNG); GrammageType const next_interact = expDist(fRNG);
std::cout << "total_inv_lambda=" << total_inv_lambda std::cout << "total_inv_lambda=" << total_inv_lambda
<< ", next_interact=" << next_interact << std::endl; << ", next_interact=" << next_interact << std::endl;
...@@ -141,8 +142,8 @@ namespace corsika::cascade { ...@@ -141,8 +142,8 @@ namespace corsika::cascade {
fProcessSequence.GetTotalInverseLifetime(particle); fProcessSequence.GetTotalInverseLifetime(particle);
// sample random exponential decay time // sample random exponential decay time
std::exponential_distribution expDistDecay(total_inv_lifetime * 1_s); corsika::random::ExponentialDistribution expDistDecay(1 / total_inv_lifetime);
TimeType const next_decay = 1_s * expDistDecay(fRNG); TimeType const next_decay = expDistDecay(fRNG);
std::cout << "total_inv_lifetime=" << total_inv_lifetime std::cout << "total_inv_lifetime=" << total_inv_lifetime
<< ", next_decay=" << next_decay << std::endl; << ", next_decay=" << next_decay << std::endl;
......
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