diff --git a/corsika/detail/modules/ParticleCut.inl b/corsika/detail/modules/ParticleCut.inl index 4afa7b37f339b919c663754db1511a7eec69d7f0..38746d35918080c4a0e5a6b0735c968a9ba15f02 100644 --- a/corsika/detail/modules/ParticleCut.inl +++ b/corsika/detail/modules/ParticleCut.inl @@ -155,10 +155,11 @@ namespace corsika { } void ParticleCut::printThresholds() { - for(auto p : get_all_particles()) - CORSIKA_LOG_DEBUG("energy threshold for particle {} is {} GeV", p, get_energy_threshold(p) / 1_GeV); + for (auto p : get_all_particles()) + CORSIKA_LOG_DEBUG("energy threshold for particle {} is {} GeV", p, + get_energy_threshold(p) / 1_GeV); } - + void ParticleCut::showResults() { CORSIKA_LOG_INFO( " ******************************\n" diff --git a/corsika/framework/core/ParticleProperties.hpp b/corsika/framework/core/ParticleProperties.hpp index cfc8c55838e4461287e3184b5bd46d15222c7752..85227425c42bf584ffcde2cea20c75d11570709e 100644 --- a/corsika/framework/core/ParticleProperties.hpp +++ b/corsika/framework/core/ParticleProperties.hpp @@ -25,6 +25,7 @@ #include <iosfwd> #include <string_view> #include <type_traits> +#include <unordered_map> #include <corsika/framework/core/PhysicalUnits.hpp> @@ -57,10 +58,11 @@ namespace corsika { Code const, HEPEnergyType const); //!< set energy threshold below which the particle //!< is discarded - inline void set_energy_threshold(std::pair<Code const, HEPEnergyType const>p){ + inline void set_energy_threshold(std::pair<Code const, HEPEnergyType const> p) { set_energy_threshold(p.first, p.second); } - inline void set_energy_thresholds(std::unordered_map<Code const,HEPEnergyType const> const& eCuts){ + inline void set_energy_thresholds( + std::unordered_map<Code const, HEPEnergyType const> const& eCuts) { for (auto v : eCuts) set_energy_threshold(v); } diff --git a/corsika/modules/ParticleCut.hpp b/corsika/modules/ParticleCut.hpp index fe709ee27d470ad385919856c102c09ff6c9e00c..eb56d3e0bfb4dc50487ebdd39685e7bb9b75de01 100644 --- a/corsika/modules/ParticleCut.hpp +++ b/corsika/modules/ParticleCut.hpp @@ -8,6 +8,8 @@ #pragma once +#include <unordered_map> + #include <corsika/framework/core/ParticleProperties.hpp> #include <corsika/framework/core/PhysicalUnits.hpp> #include <corsika/framework/process/SecondariesProcess.hpp> @@ -44,8 +46,9 @@ namespace corsika { //! threshold for specific particles redefined. EM and invisible particles can be set //! to be discarded altogether. - ParticleCut(std::unordered_map<Code const, HEPEnergyType const> const&eCuts, bool em, bool inv); - + ParticleCut(std::unordered_map<Code const, HEPEnergyType const> const& eCuts, bool em, + bool inv); + void doSecondaries(corsika::setup::StackView&); ProcessReturn doContinuous(corsika::setup::Stack::particle_type& vParticle, corsika::setup::Trajectory const& vTrajectory); diff --git a/tests/framework/testParticles.cpp b/tests/framework/testParticles.cpp index 9c80701bd2ad53d8dc5ef8dade365ccb982cb089..b74d836bc47d5715ec4f2504b30fb056af545af4 100644 --- a/tests/framework/testParticles.cpp +++ b/tests/framework/testParticles.cpp @@ -84,7 +84,7 @@ TEST_CASE("ParticleProperties", "[Particles]") { //! by default energy thresholds are set to particle mass CHECK(get_energy_threshold(Electron::code) / Electron::mass == Approx(1)); - set_energy_threshold(Electron::code,10_GeV); + set_energy_threshold(Electron::code, 10_GeV); CHECK_FALSE(get_energy_threshold(Code::Electron) == 1_GeV); CHECK(get_energy_threshold(Code::Electron) == 10_GeV); } diff --git a/tests/modules/testParticleCut.cpp b/tests/modules/testParticleCut.cpp index 5d05f04aff38cd17922e9caca0854d57c704a714..0dede160e563c6abab6a9a3fb2b1f0318f3dc1c7 100644 --- a/tests/modules/testParticleCut.cpp +++ b/tests/modules/testParticleCut.cpp @@ -173,10 +173,10 @@ TEST_CASE("ParticleCut", "[processes]") { SECTION("cut low energy: reset thresholds of arbitrary set of particles") { ParticleCut cut({{Code::Electron, 5_MeV}, {Code::Positron, 50_MeV}}, false, true); - CHECK(get_energy_threshold(Code::Electron)!=get_energy_threshold(Code::Positron)); - CHECK_FALSE(get_energy_threshold(Code::Electron)==Electron::mass); + CHECK(get_energy_threshold(Code::Electron) != get_energy_threshold(Code::Positron)); + CHECK_FALSE(get_energy_threshold(Code::Electron) == Electron::mass); // test default values still correct - CHECK(get_energy_threshold(Code::Proton)==5_GeV); + CHECK(get_energy_threshold(Code::Proton) == 5_GeV); } SECTION("cut on time") {