Skip to content

Commit

Permalink
Merge pull request #363 from tudo-astroparticlephysics/323-no-interac…
Browse files Browse the repository at this point in the history
…tiontypedecay-type-added-to-secondaries-if-particle-decays-at-rest-mass

Add order of `Type` enum in Propagator
  • Loading branch information
Jean1995 authored Apr 18, 2023
2 parents e926f18 + 03d4646 commit b21c14a
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/PROPOSAL/PROPOSAL/Propagator.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ class Propagator {

ParticleDef p_def;
enum Type : int {
MinimalE = 0,
Decay = 1,
Decay = 0,
MinimalE = 1,
Stochastic = 2,
};
enum AdvancementType : int {
Expand Down
41 changes: 41 additions & 0 deletions tests/Propagator_TEST.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include "PROPOSAL/propagation_utility/TimeBuilder.h"
#include "PROPOSAL/propagation_utility/InteractionBuilder.h"
#include "PROPOSAL/propagation_utility/ContRandBuilder.h"
#include "PROPOSAL/propagation_utility/DecayBuilder.h"
#include "PROPOSAL/density_distr/density_homogeneous.h"
#include "PROPOSAL/scattering/ScatteringFactory.h"
#include "PROPOSAL/geometry/Sphere.h"
Expand Down Expand Up @@ -57,6 +58,46 @@ TEST(Propagator, min_energy)
}
}

TEST(Propagator, RestMassDecay)
{
// make sure that all muons decay at the end of their propagation, even if they have reached their rest mass
// (see issue https://github.com/tudo-astroparticlephysics/PROPOSAL/issues/323)
auto p_def = MuMinusDef();
auto medium = Ice();
auto cuts = std::make_shared<EnergyCutSettings>(INF, 0.05, true);
auto cross = GetStdCrossSections(p_def, medium, cuts, true);

auto collection = PropagationUtility::Collection();
collection.interaction_calc = make_interaction(cross, true);
collection.displacement_calc = make_displacement(cross, true);
collection.time_calc = make_time(cross, p_def, true);
collection.cont_rand = make_contrand(cross, true);
collection.scattering = make_scattering(MultipleScatteringType::Highland, {}, p_def, medium);
collection.decay_calc = make_decay(cross, p_def, true);

auto prop_utility = PropagationUtility(collection);

auto density_distr = std::make_shared<Density_homogeneous>(medium);
auto world = std::make_shared<Sphere>(Cartesian3D(0, 0, 0), 1e20);

auto sector = std::make_tuple(world, prop_utility, density_distr);
std::vector<Sector> sec_vec = {sector};

auto prop = Propagator(p_def, sec_vec);

auto init_state = ParticleState();
init_state.energy = 150;
init_state.position = Cartesian3D(0, 0, 0);
init_state.direction = Cartesian3D(0, 0, 1);

for (size_t i=0; i<1000; i++) {
auto sec = prop.Propagate(init_state);
EXPECT_FALSE(sec.GetDecayProducts().empty()); // check that decay products are produced
}

}


int main(int argc, char** argv)
{
::testing::InitGoogleTest(&argc, argv);
Expand Down

0 comments on commit b21c14a

Please sign in to comment.