1 #ifndef WRITE_CONFIG_HH_
2 #define WRITE_CONFIG_HH_
7 #include "Mu2e-STMDAQ/config/config.hh"
8 #include "Mu2e-STMDAQ/config/include/fw_config.hh"
14 const std::string output_dir;
17 const std::string file_prefix;
20 const std::vector<std::string> streamID = {
"events",
"raw",
"zs",
"ph"};
23 const std::vector<bool> stream_enabled;
26 const int tot_streams_enabled;
29 const size_t max_file_size;
32 const int file_buffer_depth;
35 const int log_interval_sec;
39 output_dir(cfg.getValue<std::string>(
"stm.write_data.write_dir")),
40 file_prefix(cfg.getValue<std::string>(
"stm.write_data.filename_prefix")),
41 stream_enabled({cfg.getValue<
bool>(
"stm.operations.WriteManager.write_events"),
42 cfg.getValue<
bool>(
"stm.operations.WriteManager.write_raw"),
43 cfg.getValue<
bool>(
"stm.operations.WriteManager.write_zs"),
44 cfg.getValue<
bool>(
"stm.operations.WriteManager.write_ph")}),
45 tot_streams_enabled(
static_cast<int>(std::accumulate(
46 stream_enabled.begin(), stream_enabled.end(), 0,
47 [](
int sum,
bool b){ return sum + (b ? 1 : 0); }
49 max_file_size(cfg.getValue<
double>(
"stm.write_data.max_file_size") * 1e9),
50 file_buffer_depth(cfg.getValue<
int>(
"stm.write_data.file_buffer")),
51 log_interval_sec(cfg.getValue<
int>(
"stm.write_data.log_interval"))
55 logger->log(
"Config:write_info: Output_dir = " + output_dir, 1);
56 logger->log(
"Config:write_info: Filename prefix = " + file_prefix, 1);
57 logger->log(
"Config:write_info: Maximum file size set to " +
58 std::to_string(max_file_size*1e-9) +
" GB.", 1);
59 logger->log(
"Config:write_info: Set file buffer depth to " +
60 std::to_string(file_buffer_depth) +
" files.", 1);
61 logger->log(
"Config:write_info: Set log interval = " +
62 std::to_string(log_interval_sec) +
" s.", 1);
63 for (
size_t i = 0; i < streamID.size(); i++){
64 logger->log(
"Config:write_info: " + streamID[i] +
" stream " +
65 std::string(stream_enabled[i] ?
"ENABLED" :
"DISABLED"),1);
67 logger->log(
"Config:write_info: total number of enabled write streams = " +
68 std::to_string(tot_streams_enabled),1);