mana root histograms: output file name based on daq run name
This commit is contained in:
parent
f5fc1d49e7
commit
00337c6af8
1 changed files with 5 additions and 1 deletions
|
@ -1,5 +1,6 @@
|
|||
#include <TFile.h>
|
||||
#include <TH1.h>
|
||||
#include <filesystem>
|
||||
#include <regex>
|
||||
#include <spdlog/spdlog.h>
|
||||
#include <vector>
|
||||
|
@ -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<std::string>());
|
||||
auto filename = fmt::format("{}_histograms.root", rp.filename().replace_extension().string());
|
||||
auto ctx = reinterpret_cast<Context *>(context);
|
||||
ctx->hitCounts.clear();
|
||||
ctx->outputFile = std::make_unique<TFile>("output.root", "RECREATE");
|
||||
ctx->outputFile = std::make_unique<TFile>(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)
|
||||
|
|
Loading…
Reference in a new issue