diff --git a/corsika/detail/framework/random/random_iterator/detail/Random123/uniform.hpp b/corsika/detail/framework/random/random_iterator/detail/Random123/uniform.hpp index 55cb8e940c1ce6cc16f63ae4f70eb5751f42fc16..3b5a7891d4e8f814434fa33d4237e981a690b896 100644 --- a/corsika/detail/framework/random/random_iterator/detail/Random123/uniform.hpp +++ b/corsika/detail/framework/random/random_iterator/detail/Random123/uniform.hpp @@ -286,7 +286,7 @@ namespace random_iterator_r123 { static inline std::array<Ftype, CollType::static_size> u01all(CollType in) { std::array<Ftype, CollType::static_size> ret; size_t i = 0; - for (auto& e : in) { ret[i++] = u01<Ftype>(e); } + for (auto const& e : in) { ret[i++] = u01<Ftype>(e); } return ret; } @@ -300,7 +300,7 @@ namespace random_iterator_r123 { static inline std::array<Ftype, CollType::static_size> uneg11all(CollType in) { std::array<Ftype, CollType::static_size> ret; size_t i = 0; - for (auto& e : in) { ret[i++] = uneg11<Ftype>(e); } + for (auto const& e : in) { ret[i++] = uneg11<Ftype>(e); } return ret; } @@ -314,7 +314,7 @@ namespace random_iterator_r123 { static inline std::array<Ftype, CollType::static_size> u01fixedptall(CollType in) { std::array<Ftype, CollType::static_size> ret; size_t i = 0; - for (auto& e : in) { ret[i++] = u01fixedpt<Ftype>(e); } + for (auto const& e : in) { ret[i++] = u01fixedpt<Ftype>(e); } return ret; } #endif // __cplusplus >= 201103L diff --git a/corsika/detail/framework/utility/QuarticSolver.inl b/corsika/detail/framework/utility/QuarticSolver.inl index 150f658a976b4687a6c0bd9a82e9c8d5f7d94ec2..b3eead4d534d2d11a81b89123516a8b540a49b10 100644 --- a/corsika/detail/framework/utility/QuarticSolver.inl +++ b/corsika/detail/framework/utility/QuarticSolver.inl @@ -79,7 +79,7 @@ namespace corsika { std::vector<double> quad1 = solve_quadratic_real(1, p1, q1, 1e-5); std::vector<double> quad2 = solve_quadratic_real(1, p2, q2, 1e-5); if (quad2.size() > 0) { - for (auto& val : quad2) quad1.push_back(val); + for (auto const& val : quad2) quad1.push_back(val); } return quad1; } diff --git a/corsika/detail/modules/ParticleCut.inl b/corsika/detail/modules/ParticleCut.inl index cadf431a79cada49a2b411ed05ae254fd12c09b4..f470a475e250e180a6163fe68f46815ab24199d5 100644 --- a/corsika/detail/modules/ParticleCut.inl +++ b/corsika/detail/modules/ParticleCut.inl @@ -26,7 +26,7 @@ namespace corsika { , cut_muons_(eMuCut) , cut_tau_(eTauCut) , doCutInv_(inv) { - for (auto& p : get_all_particles()) { + for (auto const& p : get_all_particles()) { if (is_hadron(p)) // nuclei are also hadrons set_kinetic_energy_propagation_threshold(p, eHadCut); else if (is_muon(p)) diff --git a/corsika/detail/modules/proposal/ContinuousProcess.inl b/corsika/detail/modules/proposal/ContinuousProcess.inl index 6a27c105cac13d875b2a3aee4df052385e3c089d..7961d72231af6363651aefe25f93b3cc29e20332 100644 --- a/corsika/detail/modules/proposal/ContinuousProcess.inl +++ b/corsika/detail/modules/proposal/ContinuousProcess.inl @@ -50,8 +50,8 @@ namespace corsika::proposal { : ProposalProcessBase(_env) , TOutput(args...) { //! Initialize PROPOSAL tables for all media and all particles - for (auto& medium : media) { - for (auto& particle_code : tracked) { + for (auto const& medium : media) { + for (auto const& particle_code : tracked) { buildCalculator(particle_code, medium.first); } } diff --git a/corsika/detail/modules/proposal/InteractionModel.inl b/corsika/detail/modules/proposal/InteractionModel.inl index 846bd5b41626c78885e59ee6eaa34dc691ea2b9d..b903fdde2bb90fbae8f2888163b49053cb428f87 100644 --- a/corsika/detail/modules/proposal/InteractionModel.inl +++ b/corsika/detail/modules/proposal/InteractionModel.inl @@ -28,8 +28,8 @@ namespace corsika::proposal { , HadronicPhotonModel<THadronicLEModel, THadronicHEModel>(_hadintLE, _hadintHE, _enthreshold) { //! Initialize PROPOSAL tables for all media and all particles - for (auto& medium : media) { - for (auto& particle_code : tracked) { + for (auto const& medium : media) { + for (auto const& particle_code : tracked) { buildCalculator(particle_code, medium.first); } } diff --git a/corsika/detail/modules/proposal/ProposalProcessBase.inl b/corsika/detail/modules/proposal/ProposalProcessBase.inl index 47d7e8d286b8bc118e24212d42d312bd387ab745..b0f5032220ae3ab9928dfdb460e68105885d8c27 100644 --- a/corsika/detail/modules/proposal/ProposalProcessBase.inl +++ b/corsika/detail/modules/proposal/ProposalProcessBase.inl @@ -33,7 +33,7 @@ namespace corsika::proposal { HEPEnergyType lowest_table_value = 0_GeV; // find tables for EnergyCuts closest (but still smaller than) production_threshold - for (auto& table_energy : energycut_table_values) { + for (auto const& table_energy : energycut_table_values) { if (table_energy <= production_threshold && table_energy > lowest_table_value) { lowest_table_value = table_energy; } @@ -57,7 +57,7 @@ namespace corsika::proposal { auto comp_vec = std::vector<PROPOSAL::Component>(); const auto& comp = prop.getNuclearComposition(); auto frac_iter = comp.getFractions().cbegin(); - for (auto& pcode : comp.getComponents()) { + for (auto const& pcode : comp.getComponents()) { comp_vec.emplace_back(std::string(get_name(pcode)), get_nucleus_Z(pcode), get_nucleus_A(pcode), *frac_iter); ++frac_iter; @@ -76,7 +76,7 @@ namespace corsika::proposal { PROPOSAL::InterpolationSettings::TABLES_PATH = corsika_data("PROPOSAL").c_str(); //! Initialize EnergyCutSettings - for (auto& particle_code : tracked) { + for (auto const& particle_code : tracked) { if (particle_code == Code::Photon) { // no EnergyCut for photon, only-stochastic propagation continue; @@ -89,8 +89,8 @@ namespace corsika::proposal { } //! Initialize PROPOSAL tables for all media and all particles - for (auto& medium : media) { - for (auto& particle_code : tracked) { + for (auto const& medium : media) { + for (auto const& particle_code : tracked) { buildTables(medium.second, particle_code, proposal_energycutsettings[particle_code]); } diff --git a/corsika/detail/modules/pythia8/Decay.inl b/corsika/detail/modules/pythia8/Decay.inl index 780ce272ab8bba50e1ed59ce1930a125bd61936b..d98a43a45aac72ae18703272dbf607269f329230 100644 --- a/corsika/detail/modules/pythia8/Decay.inl +++ b/corsika/detail/modules/pythia8/Decay.inl @@ -88,7 +88,7 @@ namespace corsika::pythia8 { inline void Decay::setHandleDecay(std::vector<Code> const& vParticleList) { handleAllDecays_ = false; - for (auto& p : vParticleList) setHandleDecay(p); + for (auto const& p : vParticleList) setHandleDecay(p); } inline bool Decay::isDecayHandled(Code const vParticleCode) { @@ -99,7 +99,7 @@ namespace corsika::pythia8 { } inline void Decay::setStable(std::vector<Code> const& particleList) { - for (auto& p : particleList) Decay::setStable(p); + for (auto const& p : particleList) Decay::setStable(p); } inline void Decay::setUnstable(Code const pCode) { @@ -134,7 +134,7 @@ namespace corsika::pythia8 { if (handleAllDecays_) CORSIKA_LOG_INFO(" all particles known to Pythia are handled by Pythia::Decay!"); else - for (auto& pCode : handledDecays_) + for (auto const& pCode : handledDecays_) CORSIKA_LOG_INFO("Decay of {} is handled by Pythia!", pCode); } diff --git a/corsika/detail/modules/sibyll/Decay.inl b/corsika/detail/modules/sibyll/Decay.inl index fd843a7329c7d969457b3b0983ff0707c9bccabc..1910626d2e8324c32e4dc21801d44c57be6a862e 100644 --- a/corsika/detail/modules/sibyll/Decay.inl +++ b/corsika/detail/modules/sibyll/Decay.inl @@ -63,7 +63,7 @@ namespace corsika::sibyll { inline void Decay::setHandleDecay(std::vector<Code> const& vParticleList) { handleAllDecays_ = false; - for (auto& p : vParticleList) Decay::setHandleDecay(p); + for (auto const& p : vParticleList) Decay::setHandleDecay(p); } inline bool Decay::isDecayHandled(corsika::Code const vParticleCode) { @@ -76,11 +76,11 @@ namespace corsika::sibyll { } inline void Decay::setStable(std::vector<Code> const& vParticleList) { - for (auto& p : vParticleList) Decay::setStable(p); + for (auto const& p : vParticleList) Decay::setStable(p); } inline void Decay::setUnstable(std::vector<Code> const& vParticleList) { - for (auto& p : vParticleList) Decay::setUnstable(p); + for (auto const& p : vParticleList) Decay::setUnstable(p); } inline bool Decay::isStable(Code const vCode) { @@ -130,7 +130,7 @@ namespace corsika::sibyll { logger_, " all particles known to Sibyll are handled by Sibyll::Decay!"); } else { - for ([[maybe_unused]] auto& pCode : handledDecays_) { + for ([[maybe_unused]] auto const& pCode : handledDecays_) { CORSIKA_LOGGER_DEBUG(logger_, " Decay of {} is handled by Sibyll!", pCode); } } diff --git a/corsika/detail/modules/sibyll/HadronInteractionModel.inl b/corsika/detail/modules/sibyll/HadronInteractionModel.inl index a841d5d22a264a726df18f93ec717ad17a5b2ec3..8cb74a96eca9a75884a20409066f2acb5cc73d75 100644 --- a/corsika/detail/modules/sibyll/HadronInteractionModel.inl +++ b/corsika/detail/modules/sibyll/HadronInteractionModel.inl @@ -58,7 +58,7 @@ namespace corsika::sibyll { inline void HadronInteractionModel::setParticleListStable(std::set<Code> vList) { // de-activate specific decays in SIBYLL - for (auto& p : vList) { + for (auto const& p : vList) { CORSIKA_LOGGER_DEBUG(logger_, "setting {} as \"stable\". ", p); auto const sib_code = sibyll::convertToSibyll(p); if (sib_code != corsika::sibyll::SibyllCode::Unknown) { @@ -196,7 +196,7 @@ namespace corsika::sibyll { auto const& originalCS = boost.getOriginalCS(); MomentumVector Plab_final(originalCS, {0.0_GeV, 0.0_GeV, 0.0_GeV}); HEPEnergyType Elab_final = 0_GeV, Ecm_final = 0_GeV; - for (auto& psib : ss) { + for (auto const& psib : ss) { // abort on particles that have decayed in Sibyll. Should not happen! if (psib.hasDecayed()) { // LCOV_EXCL_START if (internal_decays_) { diff --git a/corsika/detail/modules/tracking/TrackingLeapFrogCurved.inl b/corsika/detail/modules/tracking/TrackingLeapFrogCurved.inl index 909b8660a1c58537f1cc384caa1ca4ff80a8467d..6874eeb2279d659d18dc90662fc4e19f9eb31cc6 100644 --- a/corsika/detail/modules/tracking/TrackingLeapFrogCurved.inl +++ b/corsika/detail/modules/tracking/TrackingLeapFrogCurved.inl @@ -193,7 +193,7 @@ namespace corsika { if (!solutions.size()) { return Intersections(); } LengthType d_enter, d_exit; int first = 0, first_entry = 0, first_exit = 0; - for (auto& solution : solutions) { + for (auto const& solution : solutions) { LengthType const dist = solution * 1_m; CORSIKA_LOG_TRACE( "Solution (real) for current Volume: deltaL/2*2={} (deltaL/2*2/v={}) ", dist, diff --git a/examples/cascade_examples/em_shower.cpp b/examples/cascade_examples/em_shower.cpp index 0aaf3b029873fb6a38046ca52654fd037d16608e..4c3b15d8ba009e37006b4a556caddbe0c63e42a4 100644 --- a/examples/cascade_examples/em_shower.cpp +++ b/examples/cascade_examples/em_shower.cpp @@ -105,7 +105,7 @@ int main(int argc, char** argv) { {Code::Positron, 5_MeV}, {Code::Photon, 5_MeV}, }; - for (auto& [pcode, energy] : energy_resolution) + for (auto const& [pcode, energy] : energy_resolution) set_energy_production_threshold(pcode, energy); const Code beamCode = Code::Electron; diff --git a/examples/cascade_examples/radio_em_shower.cpp b/examples/cascade_examples/radio_em_shower.cpp index 06aa5bc10a10dd86d8df1a0e5dccc40073f293fb..abd4fa3f8c438a8883aa5449145f3536ff19be52 100644 --- a/examples/cascade_examples/radio_em_shower.cpp +++ b/examples/cascade_examples/radio_em_shower.cpp @@ -129,7 +129,7 @@ int main(int argc, char** argv) { {Code::Positron, 5_MeV}, {Code::Photon, 5_MeV}, }; - for (auto& [pcode, energy] : energy_resolution) + for (auto const& [pcode, energy] : energy_resolution) set_energy_production_threshold(pcode, energy); Code const beamCode = Code::Electron; diff --git a/examples/framework_examples/known_particles.cpp b/examples/framework_examples/known_particles.cpp index 92adf881dd80500084d4a7a0f87a6d9d3d6826a8..94ad08285b26ceb4e17629bb6234ddd3289622df 100644 --- a/examples/framework_examples/known_particles.cpp +++ b/examples/framework_examples/known_particles.cpp @@ -41,7 +41,7 @@ int main() { "PDG-mass (GeV) | " "SIBYLL-mass (GeV)|"); logging::info("{:->{}}", ' ', width); - for (auto& p : get_all_particles()) { + for (auto const& p : get_all_particles()) { if (!is_nucleus(p)) { corsika::sibyll::SibyllCode sib_id = corsika::sibyll::convertToSibyll(p); auto const sib_mass = (sib_id != corsika::sibyll::SibyllCode::Unknown diff --git a/tests/modules/testOnShellCheck.cpp b/tests/modules/testOnShellCheck.cpp index 33724e4085b24b203745a46869ff3124cab99b9e..697e0ae58b880f703503770ce42b2814a1daa6f2 100644 --- a/tests/modules/testOnShellCheck.cpp +++ b/tests/modules/testOnShellCheck.cpp @@ -57,7 +57,7 @@ TEST_CASE("OnShellCheck", "[processes]") { // add secondaries, all with energies above the threshold // only cut is by species int count = -1; - for (auto& proType : particleList) { + for (auto const& proType : particleList) { count++; const auto pz = sqrt((E - get_mass(proType) * mass_shifts[count]) * (E + get_mass(proType) * mass_shifts[count])); @@ -67,7 +67,7 @@ TEST_CASE("OnShellCheck", "[processes]") { } check.doSecondaries(view); int i = -1; - for (auto& p : view) { + for (auto const& p : view) { i++; auto const Plab = FourVector(p.getEnergy(), p.getMomentum()); auto const m_kinetic = Plab.getNorm(); diff --git a/tests/modules/testParticleCut.cpp b/tests/modules/testParticleCut.cpp index 7bed87e2c6a75490fd0cca1d9b33ab796d0c284f..85b344faa9f61ce6700b989621f01e57050db29b 100644 --- a/tests/modules/testParticleCut.cpp +++ b/tests/modules/testParticleCut.cpp @@ -69,7 +69,7 @@ TEST_CASE("ParticleCut", "process,continuous,secondary") { auto projectile = view.getProjectile(); // add secondaries, all with energies above the threshold // only cut is by species - for (auto& proType : particleList) + for (auto const& proType : particleList) projectile.addSecondary( std::make_tuple(proType, Eabove, DirectionVector(rootCS, {1, 0, 0}))); CHECK(view.getEntries() == 11); @@ -94,7 +94,7 @@ TEST_CASE("ParticleCut", "process,continuous,secondary") { auto projectile = view.getProjectile(); // add secondaries, all with energies above the threshold // only cut is by species - for (auto& proType : particleList) { + for (auto const& proType : particleList) { projectile.addSecondary( std::make_tuple(proType, Eabove, DirectionVector(rootCS, {1, 0, 0}))); } @@ -116,7 +116,7 @@ TEST_CASE("ParticleCut", "process,continuous,secondary") { auto projectile = view.getProjectile(); // add secondaries, all with energies below the threshold // only cut is by species - for (auto& proType : particleList) + for (auto const& proType : particleList) projectile.addSecondary( std::make_tuple(proType, Ebelow, DirectionVector(rootCS, {1, 0, 0}))); unsigned short A = 18; @@ -189,7 +189,7 @@ TEST_CASE("ParticleCut", "process,continuous,secondary") { auto projectile = view.getProjectile(); // add secondaries, all with energies above the threshold // only cut is by time - for (auto& proType : particleList) { + for (auto const& proType : particleList) { projectile.addSecondary( std::make_tuple(proType, Eabove, DirectionVector(rootCS, {1, 0, 0}))); } @@ -208,7 +208,7 @@ TEST_CASE("ParticleCut", "process,continuous,secondary") { // add particles, all with energies above the threshold // only cut is by species - for (auto& proType : particleList) { + for (auto const& proType : particleList) { auto particle = stack.addParticle( std::make_tuple(proType, Eabove - get_mass(proType), DirectionVector(rootCS, {1, 0, 0}), point0, 0_ns)); diff --git a/tests/modules/testUrQMD.cpp b/tests/modules/testUrQMD.cpp index 0bdf1313c956f6f21415d5ab9424051abb97c1dd..676d97269ba7debfd54752fdbcd0557f0bf0f356 100644 --- a/tests/modules/testUrQMD.cpp +++ b/tests/modules/testUrQMD.cpp @@ -94,7 +94,7 @@ TEST_CASE("UrQMD") { 303_mb, 189_mb, 198_mb, 172_mb}; int i = 0; - for (auto& code : validProjectileCodes) { + for (auto const& code : validProjectileCodes) { FourMomentum const projectileP4{ sqrt(static_pow<2>(get_mass(code)) + static_pow<2>(P0)), {rootCS, {0_GeV, 0_GeV, P0}}}; diff --git a/tests/output/testInteractionWriter.cpp b/tests/output/testInteractionWriter.cpp index 0bcb3bf1f3c8e3c2f8287679e0ef93036def1358..9d4d3e3bd675dab44198561e9cf068e3a6d9ca99 100644 --- a/tests/output/testInteractionWriter.cpp +++ b/tests/output/testInteractionWriter.cpp @@ -87,7 +87,7 @@ TEST_CASE("InteractionWriter", "process") { Code::Electron, Code::MuPlus, Code::NuE, Code::Neutron, Code::NuMu}; - for (auto& proType : particleList) + for (auto const& proType : particleList) projectile.addSecondary( std::make_tuple(proType, 1_GeV, DirectionVector(rootCS, {1, 0, 0})));