IAP GITLAB

Skip to content
Snippets Groups Projects
Commit eabd9072 authored by Maximilian Reininghaus's avatar Maximilian Reininghaus :vulcan:
Browse files

Merge branch '494-time-missing-in-particle-output' into 'master'

Resolve "Time missing in particle output"

Closes #494

See merge request !431
parents a335c4a9 00102e43
No related branches found
No related tags found
1 merge request!431Resolve "Time missing in particle output"
Pipeline #6158 passed with warnings
...@@ -53,7 +53,7 @@ namespace corsika { ...@@ -53,7 +53,7 @@ namespace corsika {
// add our particles to the output file stream // add our particles to the output file stream
double const weight = 1.; // particle.getWeight() double const weight = 1.; // particle.getWeight()
this->write(particle.getPID(), energy, displacement.dot(xAxis_), this->write(particle.getPID(), energy, displacement.dot(xAxis_),
displacement.dot(yAxis_), 0_m, weight); displacement.dot(yAxis_), 0_m, particle.getTime(), weight);
CORSIKA_LOG_TRACE("Particle detected absorbed={}", deleteOnHit_); CORSIKA_LOG_TRACE("Particle detected absorbed={}", deleteOnHit_);
......
...@@ -37,6 +37,8 @@ namespace corsika { ...@@ -37,6 +37,8 @@ namespace corsika {
parquet::ConvertedType::NONE); parquet::ConvertedType::NONE);
output_.addField("z", parquet::Repetition::REQUIRED, parquet::Type::FLOAT, output_.addField("z", parquet::Repetition::REQUIRED, parquet::Type::FLOAT,
parquet::ConvertedType::NONE); parquet::ConvertedType::NONE);
output_.addField("time", parquet::Repetition::REQUIRED, parquet::Type::DOUBLE,
parquet::ConvertedType::NONE);
output_.addField("weight", parquet::Repetition::REQUIRED, parquet::Type::FLOAT, output_.addField("weight", parquet::Repetition::REQUIRED, parquet::Type::FLOAT,
parquet::ConvertedType::NONE); parquet::ConvertedType::NONE);
...@@ -59,16 +61,17 @@ namespace corsika { ...@@ -59,16 +61,17 @@ namespace corsika {
inline void ParticleWriterParquet::endOfLibrary() { output_.closeStreamer(); } inline void ParticleWriterParquet::endOfLibrary() { output_.closeStreamer(); }
inline void ParticleWriterParquet::write(Code const& pid, HEPEnergyType const& energy, inline void ParticleWriterParquet::write(Code const pid, HEPEnergyType const energy,
LengthType const& x, LengthType const& y, LengthType const x, LengthType const y,
LengthType const& z, double const weight) { LengthType const z, TimeType const t,
double const weight) {
// write the next row - we must write `shower_` first. // write the next row - we must write `shower_` first.
*(output_.getWriter()) << showerId_ << static_cast<int>(get_PDG(pid)) *(output_.getWriter()) << showerId_ << static_cast<int>(get_PDG(pid))
<< static_cast<float>(energy / 1_GeV) << static_cast<float>(energy / 1_GeV)
<< static_cast<float>(x / 1_m) << static_cast<float>(y / 1_m) << static_cast<float>(x / 1_m) << static_cast<float>(y / 1_m)
<< static_cast<float>(z / 1_m) << static_cast<float>(weight) << static_cast<float>(z / 1_m) << static_cast<double>(t / 1_s)
<< parquet::EndRow; << static_cast<float>(weight) << parquet::EndRow;
totalEnergy_ += energy; totalEnergy_ += energy;
......
...@@ -49,9 +49,10 @@ namespace corsika { ...@@ -49,9 +49,10 @@ namespace corsika {
/** /**
* Write a PDG/corsika::Code particle to the file. * Write a PDG/corsika::Code particle to the file.
*/ */
void write(Code const& pid, units::si::HEPEnergyType const& energy, void write(Code const pid, units::si::HEPEnergyType const energy,
units::si::LengthType const& x, units::si::LengthType const& y, units::si::LengthType const x, units::si::LengthType const y,
units::si::LengthType const& z, const double weight); units::si::LengthType const z, units::si::TimeType const time,
const double weight);
/** /**
* Return collected library-level summary for output. * Return collected library-level summary for output.
......
...@@ -22,11 +22,11 @@ struct TestWriterPlane : public ParticleWriterParquet { ...@@ -22,11 +22,11 @@ struct TestWriterPlane : public ParticleWriterParquet {
YAML::Node getConfig() const { return YAML::Node(); } YAML::Node getConfig() const { return YAML::Node(); }
void checkWrite() { void checkWrite() {
ParticleWriterParquet::write(Code::Unknown, 1_GeV, 2_m, 3_m, 0_m, 1.0); ParticleWriterParquet::write(Code::Unknown, 1_GeV, 2_m, 3_m, 0_m, 1_us, 1.0);
ParticleWriterParquet::write(Code::Proton, 1_GeV, 2_m, 3_m, 0_m, 1.0); ParticleWriterParquet::write(Code::Proton, 1_GeV, 2_m, 3_m, 0_m, 1_us, 1.0);
ParticleWriterParquet::write(Code::MuPlus, 1_GeV, 2_m, 3_m, 0_m, 1.0); ParticleWriterParquet::write(Code::MuPlus, 1_GeV, 2_m, 3_m, 0_m, 1_us, 1.0);
ParticleWriterParquet::write(Code::MuMinus, 1_GeV, 2_m, 3_m, 0_m, 1.0); ParticleWriterParquet::write(Code::MuMinus, 1_GeV, 2_m, 3_m, 0_m, 1_us, 1.0);
ParticleWriterParquet::write(Code::Photon, 1_GeV, 2_m, 3_m, 0_m, 1.0); ParticleWriterParquet::write(Code::Photon, 1_GeV, 2_m, 3_m, 0_m, 1_us, 1.0);
} }
}; };
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment