diff --git a/corsika/detail/modules/LongitudinalProfile.inl b/corsika/detail/modules/LongitudinalProfile.inl index 2a9327ceacc0af368353ef6b03173873ce2b93ac..0a2ec2e777651f00d51c98243c593016c7d7f59e 100644 --- a/corsika/detail/modules/LongitudinalProfile.inl +++ b/corsika/detail/modules/LongitudinalProfile.inl @@ -35,9 +35,11 @@ namespace corsika { GrammageType const grammageStart = shower_axis_.getProjectedX(vTrack.getPosition(0)); GrammageType const grammageEnd = shower_axis_.getProjectedX(vTrack.getPosition(1)); - CORSIKA_LOG_INFO( - "pos1={} m, pos2={}, X1={} g/cm2, X2={} g/cm2", vTrack.getPosition(0).getCoordinates() / 1_m, - vTrack.getPosition(1).getCoordinates() / 1_m, grammageStart / 1_g * square(1_cm), grammageEnd / 1_g * square(1_cm)); + CORSIKA_LOG_INFO("pos1={} m, pos2={}, X1={} g/cm2, X2={} g/cm2", + vTrack.getPosition(0).getCoordinates() / 1_m, + vTrack.getPosition(1).getCoordinates() / 1_m, + grammageStart / 1_g * square(1_cm), + grammageEnd / 1_g * square(1_cm)); // Note: particle may go also "upward", thus, grammageEnd<grammageStart const int binStart = std::ceil(grammageStart / dX_); diff --git a/corsika/detail/modules/proposal/ContinuousProcess.inl b/corsika/detail/modules/proposal/ContinuousProcess.inl index f43265fd1d20aea67abf666d049a7cc0b19e4e96..0e230a762aae1ca039e06570ea0bb2f87fa54a50 100644 --- a/corsika/detail/modules/proposal/ContinuousProcess.inl +++ b/corsika/detail/modules/proposal/ContinuousProcess.inl @@ -125,13 +125,14 @@ namespace corsika::proposal { // hyper parameter which must be adjusted. // auto const energy = vP.getEnergy(); - auto const energy_lim = - std::max(energy * 0.9, // either 10% relative loss max., or - get_energy_threshold( - code) // energy thresholds globally defined for individual particles - * 0.99 // need to go 1% below global e-cut to assure removal in ParticleCut. The - // 1% does not matter since at cut-time the entire energy is removed. - ); + auto const energy_lim = std::max( + energy * 0.9, // either 10% relative loss max., or + get_energy_threshold( + code) // energy thresholds globally defined for individual particles + * + 0.99 // need to go 1% below global e-cut to assure removal in ParticleCut. The + // 1% does not matter since at cut-time the entire energy is removed. + ); // solving the track integral for giving energy lim auto c = getCalculator(vP, calc); diff --git a/corsika/detail/modules/tracking/TrackingLeapFrogCurved.inl b/corsika/detail/modules/tracking/TrackingLeapFrogCurved.inl index 415c1ada386c5840dd2c9ded27a28fdf7c3f2236..ee18af1fbf52672b596101ab19d6742d154dcc44 100644 --- a/corsika/detail/modules/tracking/TrackingLeapFrogCurved.inl +++ b/corsika/detail/modules/tracking/TrackingLeapFrogCurved.inl @@ -176,7 +176,7 @@ namespace corsika { CORSIKA_LOG_TRACE("Solution (real) for current Volume: {} ", dist); if (numericallyInside) { // there must be an entry (negative) and exit (positive) solution - if (dist < 0.0001_m) { // security margin to assure transfer to next + if (dist < -0.0001_m) { // security margin to assure transfer to next // logical volume if (first_entry == 0) { d_enter = dist; @@ -200,7 +200,7 @@ namespace corsika { // both physical solutions (entry, exit) must be positive, and as small as // possible - if (dist < 0.0001_m) { // need small numerical margin, to assure transport + if (dist < -0.0001_m) { // need small numerical margin, to assure transport // into next logical volume continue; } diff --git a/corsika/framework/core/ParticleProperties.hpp b/corsika/framework/core/ParticleProperties.hpp index 549884b3953478c532f0f760eb030f1fb99ad21e..e133d68679c27bc597050a46d84c5bba2bfed70e 100644 --- a/corsika/framework/core/ParticleProperties.hpp +++ b/corsika/framework/core/ParticleProperties.hpp @@ -73,12 +73,14 @@ namespace corsika { //! true iff the particle is a hard-coded nucleus or Code::Nucleus bool constexpr is_nucleus(Code const); - bool constexpr is_hadron(Code const); //!< true iff particle is hadron - bool constexpr is_em(Code const); //!< true iff particle is electron, positron or gamma - bool constexpr is_muon(Code const); //!< true iff particle is mu+ or mu- - bool constexpr is_neutrino(Code const); //!< true iff particle is (anti-) neutrino - int constexpr get_nucleus_A(Code const); //!< returns A for hard-coded nucleus, otherwise 0 - int constexpr get_nucleus_Z(Code const); //!< returns Z for hard-coded nucleus, otherwise 0 + bool constexpr is_hadron(Code const); //!< true iff particle is hadron + bool constexpr is_em(Code const); //!< true iff particle is electron, positron or gamma + bool constexpr is_muon(Code const); //!< true iff particle is mu+ or mu- + bool constexpr is_neutrino(Code const); //!< true iff particle is (anti-) neutrino + int constexpr get_nucleus_A( + Code const); //!< returns A for hard-coded nucleus, otherwise 0 + int constexpr get_nucleus_Z( + Code const); //!< returns Z for hard-coded nucleus, otherwise 0 //! returns mass of (A,Z) nucleus, disregarding binding energy HEPMassType get_nucleus_mass(unsigned int const, unsigned int const); diff --git a/corsika/setup/SetupTrajectory.hpp b/corsika/setup/SetupTrajectory.hpp index 24a51f79c68c937189860f9ddd8b7e0832cc2a15..c40351d26f1c7bdef9d9b8ac18d3653caaf1927d 100644 --- a/corsika/setup/SetupTrajectory.hpp +++ b/corsika/setup/SetupTrajectory.hpp @@ -38,7 +38,7 @@ namespace corsika::setup { The default tracking algorithm. */ - //typedef corsika::tracking_leapfrog_curved::Tracking Tracking; + // typedef corsika::tracking_leapfrog_curved::Tracking Tracking; // typedef corsika::tracking_leapfrog_straight::Tracking Tracking; typedef corsika::tracking_line::Tracking Tracking; @@ -47,6 +47,6 @@ namespace corsika::setup { */ /// definition of Trajectory base class, to be used in tracking and cascades typedef StraightTrajectory Trajectory; - //typedef corsika::LeapFrogTrajectory Trajectory; + // typedef corsika::LeapFrogTrajectory Trajectory; } // namespace corsika::setup diff --git a/examples/vertical_EAS.cpp b/examples/vertical_EAS.cpp index 14edc194a1df38c41bc5f0462f3dcbd32ff63d5f..56bf78c3d0fda147243640377618c1537694ee3e 100644 --- a/examples/vertical_EAS.cpp +++ b/examples/vertical_EAS.cpp @@ -131,7 +131,7 @@ int main(int argc, char** argv) { builder.addExponentialLayer(1144.9069_g / (1_cm * 1_cm), 878153.55_cm, 10_km); builder.addExponentialLayer(1305.5948_g / (1_cm * 1_cm), 636143.04_cm, 40_km); builder.addExponentialLayer(540.1778_g / (1_cm * 1_cm), 772170.16_cm, 100_km); - builder.addLinearLayer(1e9_cm, 112.8_km+constants::EarthRadius::Mean); + builder.addLinearLayer(1e9_cm, 112.8_km + constants::EarthRadius::Mean); builder.assemble(env); CORSIKA_LOG_DEBUG( @@ -157,7 +157,7 @@ int main(int argc, char** argv) { Code beamCode; HEPEnergyType mass; unsigned short Z = 0; - if (A>0) { + if (A > 0) { beamCode = Code::Nucleus; Z = std::stoi(std::string(argv[2])); mass = get_nucleus_mass(A, Z); @@ -200,14 +200,14 @@ int main(int argc, char** argv) { stack.addParticle(std::make_tuple(beamCode, E0, plab, injectionPos, 0_ns, A, Z)); } else { - if (A==1) { + if (A == 1) { if (Z == 1) { - stack.addParticle(std::make_tuple(Code::Proton, E0, plab, injectionPos, 0_ns)); + stack.addParticle(std::make_tuple(Code::Proton, E0, plab, injectionPos, 0_ns)); } else if (Z == 0) { - stack.addParticle(std::make_tuple(Code::Neutron, E0, plab, injectionPos, 0_ns)); + stack.addParticle(std::make_tuple(Code::Neutron, E0, plab, injectionPos, 0_ns)); } else { - std::cerr << "illegal parameters" << std::endl; - return EXIT_FAILURE; + std::cerr << "illegal parameters" << std::endl; + return EXIT_FAILURE; } } else { stack.addParticle(std::make_tuple(beamCode, E0, plab, injectionPos, 0_ns)); diff --git a/tests/modules/testParticleCut.cpp b/tests/modules/testParticleCut.cpp index ef12f58e8489341ad64adcfd0d67194c064514cb..1bc67084bc633c62539ec8a644eb42528a8e4106 100644 --- a/tests/modules/testParticleCut.cpp +++ b/tests/modules/testParticleCut.cpp @@ -23,7 +23,7 @@ using namespace corsika; -TEST_CASE("ParticleCut", "[processes]") { +TEST_CASE("ParticleCut", "processes") { logging::set_level(logging::level::info); corsika_logger->set_pattern("[%n:%^%-8l%$] %v"); @@ -222,7 +222,10 @@ TEST_CASE("ParticleCut", "[processes]") { for (auto proType : particleList) { auto particle = stack.addParticle(std::make_tuple( proType, Eabove, MomentumVector(rootCS, {0_GeV, 0_GeV, 0_GeV}), point0, 0_ns)); - cut.doContinuous(particle, track); + + if (cut.doContinuous(particle, track) == ProcessReturn::ParticleAbsorbed) { + particle.erase(); + } } CHECK(stack.getEntries() == 9);