diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index fe2865b43182d3afac7a1513212bcd1cde988e13..746c78c9a976826ae271d8c2f46af98d3935e0a3 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -304,7 +304,7 @@ build_test-clang-8: - cd build_examples - cmake ../install/share/corsika/examples - make -j4 - - make -j4 run_examples | gzip -v -9 > examples.log.gz + - make run_examples | gzip -v -9 > examples.log.gz rules: - if: '$CI_MERGE_REQUEST_ID && $CI_MERGE_REQUEST_TITLE =~ /^Draft:/' when: manual @@ -421,7 +421,7 @@ install-clang-8: - cd build_examples - cmake ../install/share/corsika/examples - make -j4 - - make -j4 run_examples | gzip -v -9 > examples.log.gz + - make run_examples | gzip -v -9 > examples.log.gz rules: - if: '$CI_MERGE_REQUEST_LABELS =~ /Ready for code review/' # run on merge requests, if label 'Ready for code review' is set - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH diff --git a/corsika/detail/framework/utility/CorsikaData.inl b/corsika/detail/framework/utility/CorsikaData.inl index fc638b81a7f2e1a7c66908835d06182d99e69610..c3a82ad11d59e6849617b521735d8b6a92212e1d 100644 --- a/corsika/detail/framework/utility/CorsikaData.inl +++ b/corsika/detail/framework/utility/CorsikaData.inl @@ -16,7 +16,7 @@ inline boost::filesystem::path corsika::corsika_data(boost::filesystem::path const& key) { if (auto const* p = std::getenv("CORSIKA_DATA"); p != nullptr) { return boost::filesystem::path(p) / key; - } else { + } else { // LCOV_EXCL_START, this cannot be easily tested system-independently throw std::runtime_error("CORSIKA_DATA not set"); - } + } // LCOV_EXCL_STOP } diff --git a/corsika/detail/modules/ParticleCut.inl b/corsika/detail/modules/ParticleCut.inl index 9fc69b4a947677128b57b6d33152907bc1ff9e6f..a5c6dceda32463b237c6e2995c2c9151fe2b8ff0 100644 --- a/corsika/detail/modules/ParticleCut.inl +++ b/corsika/detail/modules/ParticleCut.inl @@ -25,7 +25,7 @@ namespace corsika { , em_count_(0) , inv_count_(0) { for (auto p : get_all_particles()) - if (is_hadron(p)) + if (is_hadron(p)) // nuclei are also hadrons set_kinetic_energy_threshold(p, eHadCut); else if (is_muon(p)) set_kinetic_energy_threshold(p, eMuCut); @@ -33,9 +33,6 @@ namespace corsika { set_kinetic_energy_threshold(p, eEleCut); else if (p == Code::Photon) set_kinetic_energy_threshold(p, ePhoCut); - else if (p == Code::Nucleus) - // nuclei have same threshold as hadrons on the nucleon level. - set_kinetic_energy_threshold(p, eHadCut); CORSIKA_LOG_DEBUG( "setting kinetic energy thresholds: electrons = {} GeV, photons = {} GeV, " "hadrons = {} GeV, " diff --git a/modules/qgsjetII/qgsjet-II-04.cpp b/modules/qgsjetII/qgsjet-II-04.cpp index 8ffd24df4bd7b860116b7792e16671562af051b6..550091632723bb6127ce8c3e20145b4868ed40a1 100644 --- a/modules/qgsjetII/qgsjet-II-04.cpp +++ b/modules/qgsjetII/qgsjet-II-04.cpp @@ -3,10 +3,10 @@ #include <iostream> datadir::datadir(std::string const& dir) { - if (dir.length() > 130) { + if (dir.length() > 130) { // LCOV_EXCL_START since we can't test this error message std::cerr << "QGSJetII error, will cut datadir \"" << dir << "\" to 130 characters: " << std::endl; - } + } // LCOV_EXCL_STOP int i = 0; for (i = 0; i < std::min(130, int(dir.length())); ++i) data[i] = dir[i]; data[i + 0] = ' '; diff --git a/tests/modules/testObservationPlane.cpp b/tests/modules/testObservationPlane.cpp index e6fd80ee5f48575162ef9fbe72f95367cd2378a3..1ed62d52453cf5c235d359e4958c2f2dbaa3a177 100644 --- a/tests/modules/testObservationPlane.cpp +++ b/tests/modules/testObservationPlane.cpp @@ -28,7 +28,7 @@ using namespace corsika; TEST_CASE("ObservationPlane", "interface") { - logging::set_level(logging::level::trace); + logging::set_level(logging::level::info); auto [env, csPtr, nodePtr] = setup::testing::setup_environment(Code::Oxygen); auto const& cs = *csPtr; @@ -48,7 +48,7 @@ TEST_CASE("ObservationPlane", "interface") { // dummy track. Not used for calculation! Point const start(cs, {0_m, 1_m, 10_m}); - VelocityVector vec(cs, 0_m / second, 0_m / second, -constants::c); + VelocityVector vec(cs, constants::c, 0_m / second, 0_m / second); Line line(start, vec); setup::Trajectory no_used_track = setup::testing::make_track<setup::Trajectory>(line, 12_m / constants::c); @@ -75,7 +75,7 @@ TEST_CASE("ObservationPlane", "interface") { // particle past plane: { - particle.setPosition({cs, {0_m, 0_m, -1_m}}); + particle.setPosition({cs, {11_m, 0_m, -1_m}}); setup::Trajectory no_hit_track = setup::testing::make_track<setup::Trajectory>(line, 1_nm / constants::c); LengthType const no_hit = obs.getMaxStepLength(particle, no_hit_track); @@ -90,9 +90,11 @@ TEST_CASE("ObservationPlane", "interface") { LengthType const length = obs.getMaxStepLength(particle, no_used_track); ProcessReturn const ret = obs.doContinuous(particle, no_used_track, false); + ProcessReturn const ret2 = obs.doContinuous(particle, no_used_track, true); CHECK(length / 1_m == Approx(1).margin(1e-4)); CHECK(ret == ProcessReturn::Ok); + CHECK(ret2 == ProcessReturn::Ok); } SECTION("inclined plane, inclined particle") { diff --git a/tests/modules/testStackInspector.cpp b/tests/modules/testStackInspector.cpp index f4675a09c17f62cd90b99ce802f6a77cd2c9322a..9464e54a55508bf5948ff4650a834f5a04bd34de 100644 --- a/tests/modules/testStackInspector.cpp +++ b/tests/modules/testStackInspector.cpp @@ -38,10 +38,14 @@ TEST_CASE("StackInspector", "modules") { stack.addParticle(std::make_tuple(Code::Electron, MomentumVector(rootCS, {0_GeV, 0_GeV, -1_GeV}), Point(rootCS, {0_m, 0_m, 10_km}), 0_ns)); + stack.addParticle(std::make_tuple(Code::Nucleus, + MomentumVector(rootCS, {0_GeV, 0_GeV, -1_GeV}), + Point(rootCS, {0_m, 0_m, 10_km}), 0_ns, 16, 8)); SECTION("interface") { StackInspector<TestCascadeStack> model(1, true, E0); model.doStack(stack); + // there are no actions, nothing to check... } } diff --git a/tests/stack/testGeometryNodeStackExtension.cpp b/tests/stack/testGeometryNodeStackExtension.cpp index e0673f3c33da61acedec35ddb0a1cae365d40044..9cc29edcce53750f3ab1b4c5ba4b5f2def5885ad 100644 --- a/tests/stack/testGeometryNodeStackExtension.cpp +++ b/tests/stack/testGeometryNodeStackExtension.cpp @@ -37,10 +37,9 @@ using StackWithGeometryInterface = using TestStack = CombinedStack<typename dummy_stack::DummyStack::stack_data_type, node::GeometryData<DummyEnv>, StackWithGeometryInterface>; -TEST_CASE("GeometryNodeStackExtension", "[stack]") { +TEST_CASE("GeometryNodeStackExtension", "stack") { logging::set_level(logging::level::info); - corsika_logger->set_pattern("[%n:%^%-8l%$] custom pattern: %v"); dummy_stack::NoData noData; diff --git a/tests/stack/testHistoryStack.cpp b/tests/stack/testHistoryStack.cpp index 485b794a531a25a0b0a55c7ec637a40432745872..4542db2ebf1dfe218b8566a04987696aff0b194a 100644 --- a/tests/stack/testHistoryStack.cpp +++ b/tests/stack/testHistoryStack.cpp @@ -46,10 +46,9 @@ using TestStack = using EvtPtr = std::shared_ptr<DummyEvent>; -TEST_CASE("HistoryStackExtension", "[stack]") { +TEST_CASE("HistoryStackExtension", "stack") { logging::set_level(logging::level::info); - corsika_logger->set_pattern("[%n:%^%-8l%$] custom pattern: %v"); [[maybe_unused]] CoordinateSystemPtr const& dummyCS = get_root_CoordinateSystem(); @@ -64,4 +63,14 @@ TEST_CASE("HistoryStackExtension", "[stack]") { EvtPtr evt = p.getEvent(); CHECK(evt == nullptr); } + + SECTION("add and remove particles") { + + auto p = s.addParticle(std::tuple<dummy_stack::NoData>{noData}); + CHECK(s.getEntries() == 2); + p.erase(); + CHECK(s.getEntries() == 1); + s.purge(); + CHECK(s.getEntries() == 1); + } } diff --git a/tests/stack/testNuclearStackExtension.cpp b/tests/stack/testNuclearStackExtension.cpp index fa9201023ee13e6d4fcc00460ecd67175f0b950d..198fe7da953b8f7567e733501280f89ed7f71d6e 100644 --- a/tests/stack/testNuclearStackExtension.cpp +++ b/tests/stack/testNuclearStackExtension.cpp @@ -227,6 +227,15 @@ TEST_CASE("NuclearStackExtension", "stack") { nuclear_stack::ExtendedParticleInterfaceType> s; + // not valid, no A,Z: + // not valid, no A,Z: + CHECK_THROWS(s.addParticle( + std::make_tuple(Code::Nucleus, 100_GeV, DirectionVector(dummyCS, {1, 0, 0}), + Point(dummyCS, {1 * meter, 1 * meter, 1 * meter}), 100_s))); + CHECK_THROWS(s.addParticle( + std::make_tuple(Code::Nucleus, MomentumVector(dummyCS, {1_GeV, 1_GeV, 1_GeV}), + Point(dummyCS, {1 * meter, 1 * meter, 1 * meter}), 100_s))); + // not valid: CHECK_THROWS(s.addParticle(std::make_tuple( Code::Oxygen, MomentumVector(dummyCS, {1_GeV, 1_GeV, 1_GeV}),