11#include <spdlog/spdlog.h>
18 : WriterTask{
"RootFile", convert_mode, n_lines }
19 , base_filename_{ filename }
21 root_files_.resize(n_lines);
22 trees_.resize(n_lines);
23 output_data_.resize(n_lines);
24 data_struct_buffers_.resize(n_lines);
25 for (
auto [idx, root_file, tree] : std::views::zip(std::views::iota(0), root_files_, trees_))
28 root_file = std::make_unique<TFile>(full_filename.c_str(),
"RECREATE");
30 tree = std::make_unique<TTree>(
"srs_data_tree",
"Data structures from SRS system").release();
31 tree->SetDirectory(root_file.get());
32 tree->Branch(
"srs_frame_data", &data_struct_buffers_[
static_cast<std::size_t
>(idx)]);
38 for (
auto [root_file, tree] : std::views::zip(root_files_, trees_))
40 root_file->WriteObject(tree, tree->GetName());
42 spdlog::info(
"Writer: Root file {:?} is Closed.", root_file->GetName());
constexpr auto insert_index_to_filename(std::string_view native_name, int idx) -> std::string