From 00337c6af80bf7ad36459f517b18a924adb4a2fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20L=C3=BCke?= Date: Fri, 27 Dec 2024 14:39:48 +0100 Subject: [PATCH] mana root histograms: output file name based on daq run name --- src/mana_plugin_root_histogram.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/mana_plugin_root_histogram.cc b/src/mana_plugin_root_histogram.cc index 7669cdb..f0c8e08 100644 --- a/src/mana_plugin_root_histogram.cc +++ b/src/mana_plugin_root_histogram.cc @@ -1,5 +1,6 @@ #include #include +#include #include #include #include @@ -165,13 +166,16 @@ MANA_DEFINE_PLUGIN_BEGIN_RUN(begin_run) { log_debug("begin_run: context=%p, descriptor_json=%s", context, descriptor_json); auto jRun = nlohmann::json::parse(descriptor_json); + std::filesystem::path rp(jRun["name"].get()); + auto filename = fmt::format("{}_histograms.root", rp.filename().replace_extension().string()); auto ctx = reinterpret_cast(context); ctx->hitCounts.clear(); - ctx->outputFile = std::make_unique("output.root", "RECREATE"); + ctx->outputFile = std::make_unique(filename.c_str(), "RECREATE"); ctx->hitCounts = make_hitcount_histos(ctx->outputFile.get(), jRun); ctx->rawHistograms = make_raw_histos(ctx->outputFile.get(), jRun); log_info("hitCount histograms: %s", histo_info(ctx->hitCounts).c_str()); log_info("raw histograms: %s", histo_info(ctx->rawHistograms).c_str()); + log_info("writing histograms into: %s", filename.c_str()); } MANA_DEFINE_PLUGIN_END_RUN(end_run)