IAP GITLAB

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

write time

parent a335c4a9
No related branches found
No related tags found
1 merge request!431Resolve "Time missing in particle output"
Pipeline #6111 passed
......@@ -53,7 +53,7 @@ namespace corsika {
// add our particles to the output file stream
double const weight = 1.; // particle.getWeight()
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_);
......
......@@ -37,6 +37,8 @@ namespace corsika {
parquet::ConvertedType::NONE);
output_.addField("z", parquet::Repetition::REQUIRED, parquet::Type::FLOAT,
parquet::ConvertedType::NONE);
output_.addField("time", parquet::Repetition::REQUIRED, parquet::Type::DOUBLE,
parquet::ConvertedType::NONE);
output_.addField("weight", parquet::Repetition::REQUIRED, parquet::Type::FLOAT,
parquet::ConvertedType::NONE);
......@@ -59,16 +61,17 @@ namespace corsika {
inline void ParticleWriterParquet::endOfLibrary() { output_.closeStreamer(); }
inline void ParticleWriterParquet::write(Code const& pid, HEPEnergyType const& energy,
LengthType const& x, LengthType const& y,
LengthType const& z, double const weight) {
inline void ParticleWriterParquet::write(Code const pid, HEPEnergyType const energy,
LengthType const x, LengthType const y,
LengthType const z, TimeType const t,
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;
<< static_cast<float>(z / 1_m) << static_cast<double>(t / 1_s)
<< static_cast<float>(weight) << parquet::EndRow;
totalEnergy_ += energy;
......
......@@ -49,9 +49,10 @@ namespace corsika {
/**
* Write a PDG/corsika::Code particle to the file.
*/
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);
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, units::si::TimeType const time,
const double weight);
/**
* Return collected library-level summary for output.
......
......@@ -22,11 +22,11 @@ struct TestWriterPlane : public ParticleWriterParquet {
YAML::Node getConfig() const { return YAML::Node(); }
void checkWrite() {
ParticleWriterParquet::write(Code::Unknown, 1_GeV, 2_m, 3_m, 0_m, 1.0);
ParticleWriterParquet::write(Code::Proton, 1_GeV, 2_m, 3_m, 0_m, 1.0);
ParticleWriterParquet::write(Code::MuPlus, 1_GeV, 2_m, 3_m, 0_m, 1.0);
ParticleWriterParquet::write(Code::MuMinus, 1_GeV, 2_m, 3_m, 0_m, 1.0);
ParticleWriterParquet::write(Code::Photon, 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_us, 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_us, 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