1 #ifndef MASTER_CONFIG_HH_
2 #define MASTER_CONFIG_HH_
5 #include "Mu2e-STMDAQ/utils/EnvVars.hh"
7 #include "Mu2e-STMDAQ/config/config.hh"
13 const std::string host;
15 const std::string ch0_host;
17 const std::string ch1_host;
21 const std::string ch_name;
26 const bool use_sw_sim;
28 static int compute_ch_num(
const std::string& host,
29 const std::string& ch0_host,
30 const std::string& ch1_host)
32 if (host == ch0_host)
return 0;
33 if (host == ch1_host)
return 1;
34 throw std::runtime_error(
35 "master_info: HOSTNAME '" + host +
36 "' does not match stm.ch0_host ('" + ch0_host +
37 "') or stm.ch1_host ('" + ch1_host +
"')"
41 static std::string compute_ch_name(
int ch_num)
43 return (ch_num == 0) ?
"HPGe" :
"Labr";
46 static int get_daq_socket(
int ch_num) {
47 return (ch_num == 0) ? 1 : 0;
52 host(EnvVars::expand(
"${HOSTNAME}")),
53 ch0_host(cfg.getValue<std::string>(
"stm.ch0_host")),
54 ch1_host(cfg.getValue<std::string>(
"stm.ch1_host")),
55 ch_num(compute_ch_num(host, ch0_host, ch1_host)),
56 ch_name(compute_ch_name(ch_num)),
57 numa_sock(get_daq_socket(ch_num)),
58 use_sw_sim(cfg.getValue<
int>(
"stm.use_sw_sim"))
63 logger->log(
"Config:master_info: HOST = " +
64 host +
", NUMA socket = " +
65 std::to_string(numa_sock),1);
66 logger->log(
"Config:master_info: Channel = " +
67 std::to_string(ch_num) +
68 " (" + ch_name +
")",1);
69 if (ch_num != 0 && ch_num != 1){
70 logger->log(
"Config:master_info: Error in config file --> stm.channel must be equal to 0 (HPGe) or 1 (LaBr)",0);
74 option =
"SOFTWARE SIMULATION";
77 option =
"HARDWARE/FIRMWARE";
79 logger->log(
"Config:master_info: Using " +
80 option +
" as data input.",1);