diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index b632dda7765f723ffd79fc7dd1e14807fe4f57b5..d654067f1e6fc4c683c4f8aedb0a32877df2b860 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -22,7 +22,7 @@ variables: # # multi-step pipeline for each commit # -# Mote: "Draft/WIP:" merge request, non-Draft/non-WIP merge requests and "Ready for Code Review" MR are all +# Note: "Draft/WIP:" merge request, non-Draft/non-WIP merge requests and "Ready for Code Review" MR are all # handled explicitly # stages: diff --git a/corsika/detail/modules/ObservationPlane.inl b/corsika/detail/modules/ObservationPlane.inl index a8882c7d38d2addf91684563651d0890c000f4f8..8fa3302e52564f0e0f83dbf96d0e91e77459332e 100644 --- a/corsika/detail/modules/ObservationPlane.inl +++ b/corsika/detail/modules/ObservationPlane.inl @@ -8,12 +8,12 @@ namespace corsika { - template <typename TOutput> + template <typename TTracking, typename TOutput> template <typename... TArgs> - ObservationPlane<TOutput>::ObservationPlane(Plane const& obsPlane, - DirectionVector const& x_axis, - bool const deleteOnHit, - TArgs&&... args) + ObservationPlane<TTracking, TOutput>::ObservationPlane(Plane const& obsPlane, + DirectionVector const& x_axis, + bool const deleteOnHit, + TArgs&&... args) : plane_(obsPlane) , deleteOnHit_(deleteOnHit) , energy_ground_(0_GeV) @@ -57,11 +57,11 @@ namespace corsika { if (pid == Code::Nucleus) { // add our particles to the output file stream this->write(particle.getNuclearA(), particle.getNuclearZ(), energy, - displacement.dot(xAxis_), displacement.dot(yAxis_), 0_m, weight); + displacement.dot(xAxis_), displacement.dot(yAxis_), 0_m, weight); } else { // add our particles to the output file stream this->write(particle.getPID(), energy, displacement.dot(xAxis_), - displacement.dot(yAxis_), 0_m, weight); + displacement.dot(yAxis_), 0_m, weight); } CORSIKA_LOG_TRACE("Particle detected absorbed={}", deleteOnHit_); diff --git a/corsika/detail/modules/ParticleCut.inl b/corsika/detail/modules/ParticleCut.inl index 789cf5b5972a1a00ccbb6b02117afad12bb05c33..647228b7e09f90ccb0f71d55baee480e792f468f 100644 --- a/corsika/detail/modules/ParticleCut.inl +++ b/corsika/detail/modules/ParticleCut.inl @@ -122,6 +122,7 @@ namespace corsika { template <typename TOutput> + template <typename TStackView> inline void ParticleCut<TOutput>::doSecondaries(TStackView& vS) { energy_event_ = 0_GeV; // per event counting for printout auto particle = vS.begin(); @@ -136,10 +137,11 @@ namespace corsika { CORSIKA_LOG_DEBUG("Event cut: {} GeV", energy_event_ / 1_GeV); } - template <typename TParticle, typename TTrajectory> template <typename TOutput> - inline ProcessReturn ParticleCut<TOutput>::doContinuous(TParticle& particle, TTrajectory const&, - bool const) { + template <typename TParticle, typename TTrajectory> + inline ProcessReturn ParticleCut<TOutput>::doContinuous(TParticle& particle, + TTrajectory const&, + bool const) { if (checkCutParticle(particle)) { this->write(particle.getPosition(), particle.getPID(), particle.getKineticEnergy()); CORSIKA_LOG_TRACE("removing during continuous"); diff --git a/corsika/modules/ObservationPlane.hpp b/corsika/modules/ObservationPlane.hpp index cb84db4be4adbbce215d1d5cc8afcec2018ad833..43b9d74beb344421a055d060367a63ac283cd34a 100644 --- a/corsika/modules/ObservationPlane.hpp +++ b/corsika/modules/ObservationPlane.hpp @@ -11,7 +11,8 @@ #include <corsika/framework/core/PhysicalUnits.hpp> #include <corsika/framework/geometry/Plane.hpp> #include <corsika/framework/process/ContinuousProcess.hpp> -#include <corsika/modules/writers/ObservationPlaneWriterParquet.hpp> +#include <corsika/modules/writers/ParticleWriterParquet.hpp> +#include <corsika/modules/writers/WriterOff.hpp> namespace corsika { @@ -30,10 +31,9 @@ namespace corsika { small gap in between the two plane in such a scenario, or develop another more specialized output class. */ - template <typename TTracking, typename TOutputWriter = ObservationPlaneWriterParquet> - class ObservationPlane - : public ContinuousProcess<ObservationPlane<TTracking, TOutputWriter>>, - public TOutputWriter { + template <typename TTracking, typename TOutput = WriterOff> + class ObservationPlane : public ContinuousProcess<ObservationPlane<TTracking, TOutput>>, + public TOutput { public: template <typename... TArgs> diff --git a/corsika/modules/conex/CONEXhybrid.hpp b/corsika/modules/conex/CONEXhybrid.hpp index 3fb23c95bed607e12f4c24c378a001cf20359148..a4942727f2a8ab1389537325483b81f68d809ca7 100644 --- a/corsika/modules/conex/CONEXhybrid.hpp +++ b/corsika/modules/conex/CONEXhybrid.hpp @@ -17,10 +17,8 @@ #include <corsika/framework/geometry/Vector.hpp> #include <corsika/media/ShowerAxis.hpp> -#include <corsika/modules/writers/EnergyLossWriterOff.hpp> +#include <corsika/modules/writers/WriterOff.hpp> #include <corsika/modules/writers/EnergyLossWriterParquet.hpp> - -#include <corsika/modules/writers/LongitudinalProfileWriterOff.hpp> #include <corsika/modules/writers/LongitudinalProfileWriterParquet.hpp> #include <corsika/modules/conex/CONEX_f.hpp> @@ -31,11 +29,9 @@ namespace corsika { LengthType constexpr earthRadius{6371315 * meter}; } // namespace conex - template <typename TOutput = EnergyLossWriterOff, - typename TProfileOutput = LongitudinalProfileWriterOff> + template <typename TOutput = WriterOff, typename TProfileOutput = WriterOff> class CONEXhybrid : public CascadeEquationsProcess<CONEXhybrid<TOutput, TProfileOutput>>, - public SecondariesProcess<CONEXhybrid<TOutput, TProfileOutput>> { - + public SecondariesProcess<CONEXhybrid<TOutput, TProfileOutput>> { public: /** @@ -69,9 +65,8 @@ namespace corsika { */ CONEXhybrid(Point const& center, ShowerAxis const& showerAxis, LengthType groundDist, LengthType injectionHeight, HEPEnergyType primaryEnergy, PDGCode pdg) - : CONEXhybrid(*(new EnergyLossWriterOff()), *(new LongitudinalProfileWriterOff()), - center, showerAxis, groundDist, injectionHeight, primaryEnergy, - pdg) {} + : CONEXhybrid(*(new WriterOff()), *(new WriterOff()), center, showerAxis, + groundDist, injectionHeight, primaryEnergy, pdg) {} template <typename TStackView> void doSecondaries(TStackView&); diff --git a/corsika/modules/writers/WriterOff.hpp b/corsika/modules/writers/WriterOff.hpp index 783507a481a2f02da5523d6d77a6e8ca0b5d5be4..6c21e7763ee926d16b92ec5472ba44fdf72598dc 100644 --- a/corsika/modules/writers/WriterOff.hpp +++ b/corsika/modules/writers/WriterOff.hpp @@ -10,9 +10,14 @@ #include <corsika/output/BaseOutput.hpp> - namespace corsika { + /** + * Generic class to switch off any output. + * + * The 'write' method is catch-all and does nothing. + */ + class WriterOff : public BaseOutput { public: @@ -25,8 +30,10 @@ namespace corsika { void endOfLibrary() final override {} + // YAML::Node getConfig() const final override { return YAML::Node(); } + template <typename... TArgs> - void write(TArgs&&... args) {} + void write(TArgs&&...) {} }; // class WriterOff diff --git a/corsika/output/NoOutput.hpp b/corsika/output/NoOutput.hpp index ddcabc8efa14f7d05f7105b5c076cf5ae5964d66..cda72d0f1647b9ed79fa211c72548f70599f5810 100644 --- a/corsika/output/NoOutput.hpp +++ b/corsika/output/NoOutput.hpp @@ -50,7 +50,7 @@ namespace corsika { /** * Get any summary information for the entire library. */ - YAML::Node getSummary() final override { return YAML::Node(); }; + YAML::Node getSummary() const final override { return YAML::Node(); }; protected: void write(Code const&, units::si::HEPEnergyType const&, units::si::LengthType const&, diff --git a/tests/modules/CMakeLists.txt b/tests/modules/CMakeLists.txt index a4e1c1b63c1b86df66e347d3ab28ca294985e97e..00f28c41cf60e57530d63d248b7208c21c3859a6 100644 --- a/tests/modules/CMakeLists.txt +++ b/tests/modules/CMakeLists.txt @@ -8,7 +8,6 @@ set (test_modules_sources testPythia8.cpp testUrQMD.cpp testCONEX.cpp - ## testOnShellCheck.cpp testParticleCut.cpp testSibyll.cpp testEpos.cpp diff --git a/tests/modules/testObservationPlane.cpp b/tests/modules/testObservationPlane.cpp index 5457cd622b68decac1f8d9bfa786dc103559d629..ce6ad20ab82ea299f797e14aa96d3086c4b6696b 100644 --- a/tests/modules/testObservationPlane.cpp +++ b/tests/modules/testObservationPlane.cpp @@ -53,8 +53,7 @@ TEST_CASE("ObservationPlane", "interface") { SECTION("horizontal plane") { Plane const obsPlane(Point(cs, {10_m, 0_m, 0_m}), DirectionVector(cs, {1., 0., 0.})); - ObservationPlane<setup::Tracking, NoOutput> obs(obsPlane, - DirectionVector(cs, {0., 1., 0.})); + ObservationPlane<setup::Tracking> obs(obsPlane, DirectionVector(cs, {0., 1., 0.})); LengthType const length = obs.getMaxStepLength(particle, no_used_track); ProcessReturn const ret = obs.doContinuous(particle, no_used_track, true); @@ -82,8 +81,8 @@ TEST_CASE("ObservationPlane", "interface") { SECTION("transparent plane") { Plane const obsPlane(Point(cs, {1_m, 0_m, 0_m}), DirectionVector(cs, {1., 0., 0.})); - ObservationPlane<setup::Tracking, NoOutput> obs( - obsPlane, DirectionVector(cs, {0., 0., 1.}), false); + ObservationPlane<setup::Tracking> obs(obsPlane, DirectionVector(cs, {0., 0., 1.}), + false); LengthType const length = obs.getMaxStepLength(particle, no_used_track); ProcessReturn const ret = obs.doContinuous(particle, no_used_track, false); @@ -103,8 +102,7 @@ TEST_CASE("ObservationPlane", "interface") { Plane const obsPlane(Point(cs, {10_m, 5_m, 5_m}), DirectionVector(cs, {1, 0.1, -0.05})); - ObservationPlane<setup::Tracking, NoOutput> obs(obsPlane, - DirectionVector(cs, {0., 1., 0.})); + ObservationPlane<setup::Tracking> obs(obsPlane, DirectionVector(cs, {0., 1., 0.})); LengthType const length = obs.getMaxStepLength(particle, no_used_track); ProcessReturn const ret = obs.doContinuous(particle, no_used_track, true); @@ -115,8 +113,8 @@ TEST_CASE("ObservationPlane", "interface") { SECTION("output") { Plane const obsPlane(Point(cs, {1_m, 0_m, 0_m}), DirectionVector(cs, {1., 0., 0.})); - ObservationPlane<setup::Tracking, NoOutput> obs( - obsPlane, DirectionVector(cs, {0., 0., 1.}), false); + ObservationPlane<setup::Tracking> obs(obsPlane, DirectionVector(cs, {0., 0., 1.}), + false); auto const cfg = obs.getConfig(); CHECK(cfg["type"]); } diff --git a/tests/output/testOutputManager.cpp b/tests/output/testOutputManager.cpp index b57a8be956b6c26b3162871a3d0a2cb23578566e..d06b7d3b2b15042d0d9d7f950677b9e2c75aa7b1 100644 --- a/tests/output/testOutputManager.cpp +++ b/tests/output/testOutputManager.cpp @@ -24,6 +24,7 @@ struct DummyNoOutput : public NoOutput { NoOutput::endOfShower(0); NoOutput::endOfLibrary(); } + YAML::Node getConfig() const final override { return YAML::Node(); } void checkWrite() { NoOutput::write(Code::Unknown, 1_eV, 1_m, 1_m, 1_ns); } }; @@ -45,6 +46,8 @@ struct DummyOutput : public BaseOutput { void endOfLibrary() override { endLibrary_ = true; } + YAML::Node getConfig() const final override { return YAML::Node(); } + YAML::Node getSummary() const final override { YAML::Node summary; summary["test"] = "test"; @@ -154,4 +157,4 @@ TEST_CASE("OutputManager") { nothing.check(); nothing.checkWrite(); } -} \ No newline at end of file +}