IAP GITLAB

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

format track file

parent 37836bd0
No related branches found
No related tags found
No related merge requests found
......@@ -15,6 +15,7 @@
#include <corsika/setup/SetupStack.h>
#include <corsika/setup/SetupTrajectory.h>
#include <iomanip>
#include <limits>
using namespace corsika::setup;
......@@ -38,9 +39,16 @@ namespace corsika::process::track_writer {
auto const delta = vT.GetPosition(1).GetCoordinates() - start;
auto const pdg = static_cast<int>(particles::GetPDG(vP.GetPID()));
fFile << pdg << ' ' << vP.GetEnergy() / 1_eV << ' ' << start[0] / 1_m << ' '
<< start[1] / 1_m << ' ' << start[2] / 1_m << " " << delta[0] / 1_m << ' '
<< delta[1] / 1_m << ' ' << delta[2] / 1_m << '\n';
// clang-format off
fFile << std::setw(7) << pdg
<< std::setw(width) << std::scientific << std::setprecision(precision) << vP.GetEnergy() / 1_eV
<< std::setw(width) << std::scientific << std::setprecision(precision) << start[0] / 1_m
<< std::setw(width) << std::scientific << std::setprecision(precision) << start[1] / 1_m
<< std::setw(width) << std::scientific << std::setprecision(precision) << start[2] / 1_m
<< std::setw(width) << std::scientific << std::setprecision(precision) << delta[0] / 1_m
<< std::setw(width) << std::scientific << std::setprecision(precision) << delta[1] / 1_m
<< std::setw(width) << std::scientific << std::setprecision(precision) << delta[2] / 1_m << '\n';
// clang-format on
return process::EProcessReturn::eOk;
}
......
......@@ -36,6 +36,9 @@ namespace corsika::process::track_writer {
private:
std::string const fFilename;
std::ofstream fFile;
int width = 14;
int precision = 6;
};
} // namespace corsika::process::track_writer
......
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