From 2de64c839135d7499ab5f67f8c2bb1adf91338c5 Mon Sep 17 00:00:00 2001 From: Felix Riehn <friehn@lip.pt> Date: Wed, 21 Feb 2024 20:51:23 +0100 Subject: [PATCH] add flag to switch off output for interaction histograms --- applications/c8_air_shower.cpp | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/applications/c8_air_shower.cpp b/applications/c8_air_shower.cpp index f97f100b1..eba25b3e2 100644 --- a/applications/c8_air_shower.cpp +++ b/applications/c8_air_shower.cpp @@ -218,6 +218,10 @@ int main(int argc, char** argv) { app.add_flag("--force-interaction", force_interaction, "Force the location of the first interaction.") ->group("Misc."); + bool disable_interaction_hists = false; + app.add_flag("--disable-interaction-histograms", disable_interaction_hists, + "Store interaction histograms") + ->group("Misc."); app.add_option("-v,--verbosity", "Verbosity level: warn, info, debug, trace.") ->default_val("info") ->check(CLI::IsMember({"warn", "info", "debug", "trace"})) @@ -600,14 +604,12 @@ int main(int argc, char** argv) { CORSIKA_LOG_INFO("Shower {} / {} ", i_shower, nevent); - // directory for outputs - string const outdir(app["--filename"]->as<std::string>()); - // construct the directory for this library - boost::filesystem::create_directories(outdir + "/interaction_hist"); - string const labHist_file = - outdir + "/interaction_hist" + "/inthist_lab_" + to_string(i_shower) + ".npz"; - string const cMSHist_file = - outdir + "/interaction_hist" + "/inthist_cms_" + to_string(i_shower) + ".npz"; + // directory for output of interaction histograms + string const outdir(app["--filename"]->as<std::string>() + "/interaction_hist"); + // construct the directory + boost::filesystem::create_directories(outdir); + string const labHist_file = outdir + "/inthist_lab_" + to_string(i_shower) + ".npz"; + string const cMSHist_file = outdir + "/inthist_cms_" + to_string(i_shower) + ".npz"; // setup particle stack, and add primary particle stack.clear(); @@ -640,8 +642,10 @@ int main(int argc, char** argv) { auto const hists = heCounted.getHistogram() + leIntCounted.getHistogram(); - save_hist(hists.labHist(), labHist_file, true); - save_hist(hists.CMSHist(), cMSHist_file, true); + if (!disable_interaction_hists) { + save_hist(hists.labHist(), labHist_file, true); + save_hist(hists.CMSHist(), cMSHist_file, true); + } } // and finalize the output on disk -- GitLab