From fd685b722affc7a3b1be315e5b42f949d0005b53 Mon Sep 17 00:00:00 2001 From: ralfulrich <ralf.ulrich@kit.edu> Date: Mon, 25 Jan 2021 09:44:02 +0100 Subject: [PATCH] guidelines, const --- .../detail/framework/geometry/FourVector.inl | 2 +- .../framework/geometry/QuantityVector.inl | 4 +-- corsika/detail/media/WeightProvider.inl | 2 +- corsika/detail/modules/ParticleCut.inl | 26 ++++++++++--------- corsika/modules/ParticleCut.hpp | 14 +++++----- modules/conex | 2 +- modules/data | 2 +- 7 files changed, 27 insertions(+), 25 deletions(-) diff --git a/corsika/detail/framework/geometry/FourVector.inl b/corsika/detail/framework/geometry/FourVector.inl index 6c0a039e5..135790bfc 100644 --- a/corsika/detail/framework/geometry/FourVector.inl +++ b/corsika/detail/framework/geometry/FourVector.inl @@ -95,7 +95,7 @@ namespace corsika { template <typename TTimeType, typename TSpaceVecType> typename FourVector<TTimeType, TSpaceVecType>::norm_type - FourVector<TTimeType, TSpaceVecType>::operator*(FourVector const& b) { + FourVector<TTimeType, TSpaceVecType>::operator*(FourVector const& b) { if constexpr (std::is_same<time_type, decltype(std::declval<space_type>() / meter * second)>::value) return timeLike_ * b.timeLike_ * constants::cSquared - spaceLike_.norm(); diff --git a/corsika/detail/framework/geometry/QuantityVector.inl b/corsika/detail/framework/geometry/QuantityVector.inl index 151b35dae..994f70689 100644 --- a/corsika/detail/framework/geometry/QuantityVector.inl +++ b/corsika/detail/framework/geometry/QuantityVector.inl @@ -17,8 +17,8 @@ namespace corsika { template <typename TDimension> - inline typename QuantityVector<TDimension>::quantity_type QuantityVector<TDimension>:: - operator[](size_t const index) const { + inline typename QuantityVector<TDimension>::quantity_type + QuantityVector<TDimension>::operator[](size_t const index) const { return quantity_type(phys::units::detail::magnitude_tag, eigenVector_[index]); } diff --git a/corsika/detail/media/WeightProvider.inl b/corsika/detail/media/WeightProvider.inl index af9849aa3..c075b2363 100644 --- a/corsika/detail/media/WeightProvider.inl +++ b/corsika/detail/media/WeightProvider.inl @@ -20,7 +20,7 @@ namespace corsika { template <class AConstIterator, class BConstIterator> typename WeightProviderIterator<AConstIterator, BConstIterator>::value_type - WeightProviderIterator<AConstIterator, BConstIterator>::operator*() const { + WeightProviderIterator<AConstIterator, BConstIterator>::operator*() const { return ((*aIter_) * (*bIter_)).magnitude(); } diff --git a/corsika/detail/modules/ParticleCut.inl b/corsika/detail/modules/ParticleCut.inl index 551234fc9..7a22b4d71 100644 --- a/corsika/detail/modules/ParticleCut.inl +++ b/corsika/detail/modules/ParticleCut.inl @@ -12,9 +12,9 @@ namespace corsika { - ParticleCut::ParticleCut(const HEPEnergyType eEleCut, const HEPEnergyType ePhoCut, - const HEPEnergyType eHadCut, const HEPEnergyType eMuCut, - bool inv) + ParticleCut::ParticleCut(HEPEnergyType const eEleCut, HEPEnergyType const ePhoCut, + HEPEnergyType const eHadCut, HEPEnergyType const eMuCut, + bool const inv) : doCutEm_(false) , doCutInv_(inv) , energy_(0_GeV) @@ -41,8 +41,8 @@ namespace corsika { printThresholds(); } - ParticleCut::ParticleCut(const HEPEnergyType eHadCut, const HEPEnergyType eMuCut, - bool inv) + ParticleCut::ParticleCut(HEPEnergyType const eHadCut, HEPEnergyType const eMuCut, + bool const inv) : doCutEm_(true) , doCutInv_(inv) , energy_(0_GeV) @@ -63,7 +63,7 @@ namespace corsika { printThresholds(); } - ParticleCut::ParticleCut(const HEPEnergyType eCut, bool em, bool inv) + ParticleCut::ParticleCut(HEPEnergyType const eCut, bool const em, bool const inv) : doCutEm_(em) , doCutInv_(inv) , energy_(0_GeV) @@ -77,7 +77,8 @@ namespace corsika { } ParticleCut::ParticleCut( - std::unordered_map<Code const, HEPEnergyType const> const& eCuts, bool em, bool inv) + std::unordered_map<Code const, HEPEnergyType const> const& eCuts, bool const em, + bool const inv) : doCutEm_(em) , doCutInv_(inv) , energy_(0_GeV) @@ -107,9 +108,9 @@ namespace corsika { bool ParticleCut::isInvisible(Code const& vCode) const { return is_neutrino(vCode); } template <typename TParticle> - bool ParticleCut::checkCutParticle(const TParticle& particle) { + bool ParticleCut::checkCutParticle(TParticle const& particle) { - const Code pid = particle.getPID(); + Code const pid = particle.getPID(); HEPEnergyType energy = particle.getEnergy(); CORSIKA_LOG_DEBUG("ParticleCut: checking {}, E= {} GeV, EcutTot={} GeV", pid, energy / 1_GeV, (em_energy_ + inv_energy_ + energy_) / 1_GeV); @@ -156,9 +157,10 @@ 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()) { + auto const Eth = get_energy_threshold(p); + CORSIKA_LOG_INFO("energy threshold for particle {} is {} GeV", p, Eth / 1_GeV); + } } void ParticleCut::showResults() { diff --git a/corsika/modules/ParticleCut.hpp b/corsika/modules/ParticleCut.hpp index c9771c936..ca7f87013 100644 --- a/corsika/modules/ParticleCut.hpp +++ b/corsika/modules/ParticleCut.hpp @@ -33,21 +33,21 @@ namespace corsika { * hadrons (including nuclei with energy per nucleon) and muons * invisible particles (neutrinos) can be cut or not **/ - ParticleCut(const HEPEnergyType eEleCut, const HEPEnergyType ePhoCut, - const HEPEnergyType eHadCut, const HEPEnergyType eMuCut, bool inv); + ParticleCut(HEPEnergyType const eEleCut, HEPEnergyType const ePhoCut, + HEPEnergyType const eHadCut, HEPEnergyType const eMuCut, bool const inv); //! simple cut. hadrons and muons are cut by threshold. EM particles are all //! discarded. - ParticleCut(const HEPEnergyType eHadCut, const HEPEnergyType eMuCut, bool inv); + ParticleCut(HEPEnergyType const eHadCut, HEPEnergyType const euCut, bool const inv); //! simplest cut. all particles have same threshold. EM particles can be set to be //! discarded altogether. - ParticleCut(const HEPEnergyType eCut, bool em, bool inv); + ParticleCut(HEPEnergyType const eCut, bool const em, bool const inv); //! 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 const em, bool const inv); void doSecondaries(corsika::setup::StackView&); ProcessReturn doContinuous(corsika::setup::Stack::particle_type& vParticle, @@ -73,7 +73,7 @@ namespace corsika { private: template <typename TParticle> - bool checkCutParticle(const TParticle& p); + bool checkCutParticle(TParticle const& p); template <typename TParticle> bool isBelowEnergyCut(TParticle const&) const; diff --git a/modules/conex b/modules/conex index 73e3d1fa8..820f042b6 160000 --- a/modules/conex +++ b/modules/conex @@ -1 +1 @@ -Subproject commit 73e3d1fa850d2d3602a15b3b948ac1789fbc968d +Subproject commit 820f042b6a055276d465437c74160ef7c199b646 diff --git a/modules/data b/modules/data index afe83dc19..8b76a9ca2 160000 --- a/modules/data +++ b/modules/data @@ -1 +1 @@ -Subproject commit afe83dc19c1464deb176f38c3ddab80a64e081f4 +Subproject commit 8b76a9ca2599cd0ce1f204b17362eb06bbcf5277 -- GitLab