diff --git a/corsika/detail/modules/ObservationPlane.inl b/corsika/detail/modules/ObservationPlane.inl index 2f0bdab9847fa943f87f44c26a62bfd6a6ac8f57..4a9efbca6fb1a99c03b11212edbf19da08537a33 100644 --- a/corsika/detail/modules/ObservationPlane.inl +++ b/corsika/detail/modules/ObservationPlane.inl @@ -55,11 +55,11 @@ namespace corsika { if (pid == Code::Nucleus) { // add our particles to the output file stream output_.write(particle.getNuclearA(), particle.getNuclearZ(), energy, - displacement.dot(xAxis_), displacement.dot(yAxis_), weight); + displacement.dot(xAxis_), displacement.dot(yAxis_), 0_m, weight); } else { // add our particles to the output file stream output_.write(particle.getPID(), energy, displacement.dot(xAxis_), - displacement.dot(yAxis_), weight); + displacement.dot(yAxis_), 0_m, weight); } CORSIKA_LOG_TRACE("Particle detected absorbed={}", deleteOnHit_); diff --git a/corsika/detail/modules/writers/ParticleWriterParquet.inl b/corsika/detail/modules/writers/ParticleWriterParquet.inl index d89db474ffa2748f9a771b22abecd4dcff690ed7..5fdd9ba517a82479978c73c5dddc649a9b2dd16f 100644 --- a/corsika/detail/modules/writers/ParticleWriterParquet.inl +++ b/corsika/detail/modules/writers/ParticleWriterParquet.inl @@ -15,7 +15,7 @@ namespace corsika { inline ParticleWriterParquet::ParticleWriterParquet() : output_() , showerId_(0) - , energyGround_(0_eV) {} + , totalEnergy_(0_eV) {} inline void ParticleWriterParquet::startOfLibrary( boost::filesystem::path const& directory) { @@ -35,6 +35,10 @@ namespace corsika { parquet::ConvertedType::NONE); output_.addField("y", parquet::Repetition::REQUIRED, parquet::Type::FLOAT, parquet::ConvertedType::NONE); + output_.addField("z", parquet::Repetition::REQUIRED, parquet::Type::FLOAT, + parquet::ConvertedType::NONE); + output_.addField("z", parquet::Repetition::REQUIRED, parquet::Type::FLOAT, + parquet::ConvertedType::NONE); output_.addField("weight", parquet::Repetition::REQUIRED, parquet::Type::FLOAT, parquet::ConvertedType::NONE); @@ -42,7 +46,7 @@ namespace corsika { output_.buildStreamer(); showerId_ = 0; - energyGround_ = 0_eV; + totalEnergy_ = 0_eV; countHadrons_ = 0; countOthers_ = 0; countEM_ = 0; @@ -59,15 +63,17 @@ namespace corsika { inline void ParticleWriterParquet::write(Code const& pid, HEPEnergyType const& energy, LengthType const& x, LengthType const& y, + LengthType const& z, double const weight) { // write the next row - we must write `shower_` first. *(output_.getWriter()) << showerId_ << static_cast<int>(get_PDG(pid)) << static_cast<float>(energy / 1_GeV) << static_cast<float>(x / 1_m) << static_cast<float>(y / 1_m) + << static_cast<float>(z / 1_m) << static_cast<float>(weight) << parquet::EndRow; - energyGround_ += energy; + totalEnergy_ += energy; if (is_hadron(pid)) { ++countHadrons_; @@ -83,13 +89,15 @@ namespace corsika { inline void ParticleWriterParquet::write(unsigned int const A, unsigned int const Z, HEPEnergyType const& energy, LengthType const& x, LengthType const& y, + LengthType const& z, double const weight) { // write the next row - we must write `shower_` first. *(output_.getWriter()) << showerId_ << static_cast<int>(get_PDG(A, Z)) << static_cast<float>(energy / 1_GeV) << static_cast<float>(x / 1_m) << static_cast<float>(y / 1_m) + << static_cast<float>(z / 1_m) << static_cast<float>(weight) << parquet::EndRow; - energyGround_ += energy; + totalEnergy_ += energy; ++countHadrons_; } diff --git a/corsika/modules/writers/ParticleWriterOff.hpp b/corsika/modules/writers/ParticleWriterOff.hpp index 6f036a74b47810129e93c59ac49d03b157575bf4..27a6ab76328c370584a0e212273b785bd713d0a9 100644 --- a/corsika/modules/writers/ParticleWriterOff.hpp +++ b/corsika/modules/writers/ParticleWriterOff.hpp @@ -27,12 +27,12 @@ namespace corsika { void endOfLibrary() final override {} // for pdg particles - void write(Code const&, HEPEnergyType const&, LengthType const&, LengthType const&, + void write(Code const&, HEPEnergyType const&, LengthType const&, LengthType const&, LengthType const&, double const) {} // for nuclei void write(unsigned int const, unsigned int const, HEPEnergyType const&, - LengthType const&, LengthType const&, double const) {} + LengthType const&, LengthType const&, LengthType const&, double const) {} }; // class ParticleWriterOff diff --git a/corsika/modules/writers/ParticleWriterParquet.hpp b/corsika/modules/writers/ParticleWriterParquet.hpp index dd5bd1c944e1bdc6a9098e107369039e8045a607..05b49cce89982682856ca8c3f5617e24dc9fafd5 100644 --- a/corsika/modules/writers/ParticleWriterParquet.hpp +++ b/corsika/modules/writers/ParticleWriterParquet.hpp @@ -51,6 +51,7 @@ namespace corsika { */ void write(Code const& pid, units::si::HEPEnergyType const& energy, units::si::LengthType const& x, units::si::LengthType const& y, + units::si::LengthType const& z, const double weight); /** @@ -58,7 +59,7 @@ namespace corsika { */ void write(unsigned int const A, unsigned int const Z, units::si::HEPEnergyType const& energy, units::si::LengthType const& x, - units::si::LengthType const& y, const double weight); + units::si::LengthType const& y, units::si::LengthType const& z, const double weight); /** * Return collected library-level summary for output. @@ -68,7 +69,7 @@ namespace corsika { /** * If plane is absorbing particles: return the total energy absorbed. */ - HEPEnergyType getEnergyGround() const { return energyGround_; } + HEPEnergyType getTotalEnergy() const { return totalEnergy_; } private: ParquetStreamer output_; ///< The primary output file. @@ -79,7 +80,7 @@ namespace corsika { double countEM_ = 0; ///< count EM particles hitting plane. double countOthers_ = 0; ///< count othe types of particles hitting plane - HEPEnergyType energyGround_; ///< energy absorbed in ground. + HEPEnergyType totalEnergy_; ///< energy absorbed in ground. }; // class ParticleWriterParquet diff --git a/tests/output/testWriterObservationPlane.cpp b/tests/output/testWriterObservationPlane.cpp index 71fefabaa177329022e0b3beaa1b1f054cc1815a..8ac8787a843a5b590509a2b8e28d3a0ca2cc3bbc 100644 --- a/tests/output/testWriterObservationPlane.cpp +++ b/tests/output/testWriterObservationPlane.cpp @@ -21,7 +21,7 @@ struct TestWriterPlane : public ParticleWriterParquet { YAML::Node getConfig() const { return YAML::Node(); } - void checkWrite() { ParticleWriterParquet::write(Code::Unknown, 1_eV, 2_m, 3_m, 1.0); } + void checkWrite() { ParticleWriterParquet::write(Code::Unknown, 1_eV, 2_m, 3_m, 0_m, 1.0); } }; TEST_CASE("ObservationPlaneWriterParquet") {