From 248d9ed565d0b097ca0e3bd48180f4e0a804d760 Mon Sep 17 00:00:00 2001 From: Felix Riehn <felix@matilda> Date: Mon, 18 Jan 2021 17:12:07 +0000 Subject: [PATCH] clang & include --- corsika/detail/modules/ParticleCut.inl | 7 ++++--- corsika/framework/core/ParticleProperties.hpp | 6 ++++-- corsika/modules/ParticleCut.hpp | 7 +++++-- tests/framework/testParticles.cpp | 2 +- tests/modules/testParticleCut.cpp | 6 +++--- 5 files changed, 17 insertions(+), 11 deletions(-) diff --git a/corsika/detail/modules/ParticleCut.inl b/corsika/detail/modules/ParticleCut.inl index 4afa7b37f..38746d359 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 cfc8c5583..85227425c 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 fe709ee27..eb56d3e0b 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 9c80701bd..b74d836bc 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 5d05f04af..0dede160e 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") { -- GitLab