17#include <yaml-cpp/yaml.h>
29 LOG(info) <<
"Config: Reading configuration from " << fileName;
30 YAML::Node settings = YAML::LoadFile(fileName);
37 f_glb_numTs = settings[
"global"][
"nTimeslices"].as<
int>();
38 f_glb_firstTs = settings[
"global"][
"firstTimeslice"].as<
int>();
43 YAML::Node deactivatedSystems = settings[
"detectors"][
"deactivate"];
44 for (
auto det : deactivatedSystems)
48 f_ts_tslength = settings[
"timeslice"][
"timeslicelength"].as<
float>();
49 f_ts_storeAllTS = settings[
"timeslice"][
"storeAllTimeslices"].as<
bool>();
57 YAML::Node sources = settings[
"sources"];
59 for (
auto source : sources) {
60 f_src_id.push_back(source[
"id"].as<int>());
61 f_src_rate.push_back(source[
"rate"].as<float>());
73 std::transform(temp.begin(), temp.end(), temp.begin(), [](
unsigned char c) { return std::tolower(c); });
74 if (temp ==
"timeslice")
76 else if (temp ==
"event")
100 string temp = choice;
101 std::transform(temp.begin(), temp.end(), temp.begin(), [](
unsigned char c) { return std::tolower(c); });
102 if (temp ==
"poisson")
104 else if (temp ==
"uniform")
128 std::string temp = moduleString;
129 std::transform(temp.begin(), temp.end(), temp.begin(), [](
unsigned char c) { return std::tolower(c); });
132 else if (temp ==
"sts")
134 else if (temp ==
"rich")
136 else if (temp ==
"much")
138 else if (temp ==
"trd")
140 else if (temp ==
"tof")
142 else if (temp ==
"psd")
144 else if (temp ==
"fsd")
146 else if (temp ==
"bmon")
184 std::string temp = treeAccessString;
185 std::transform(temp.begin(), temp.end(), temp.begin(), [](
unsigned char c) { return std::tolower(c); });
186 if (temp ==
"random")
188 else if (temp ==
"repeat")
239 for (
int i = 0; i < (int)
f_src_id.size(); ++i) {
240 settings[
"sources"][i][
"id"] =
f_src_id.at(i);
241 settings[
"sources"][i][
"rate"] =
f_src_rate.at(i);
ECbmTreeAccess
Mode to read entries from a ROOT TTree.
@ kMvd
Micro-Vertex Detector.
@ kTrd
Transition Radiation Detector.
@ kTof
Time-of-flight Detector.
@ kPsd
Projectile spectator detector.
@ kSts
Silicon Tracking System.
@ kMuch
Muon detection system.
@ kFsd
Forward spectator detector.
@ kRich
Ring-Imaging Cherenkov Detector.
std::string ToString()
String output (YAML format)
std::vector< int > f_src_id
std::vector< ECbmModuleId > f_det_deactivate
std::vector< float > f_src_rate
std::vector< int > f_src_embedToId
cbm::sim::TimeDist f_ts_timeDist
ECbmModuleId f_det_deactivateAllBut
YAML::Node ToYaml()
Save to YAML node.
void LoadYaml(const std::string &filename)
Load from YAML file.
std::string f_glb_logLevel
ECbmTreeAccess ToECbmTreeAccess(std::string treeAccessString)
cbm::sim::Mode f_glb_mode
cbm::sim::TimeDist ToCbmSimTimeDist(std::string tag)
std::string f_glb_logColor
cbm::sim::Mode ToCbmDigiMode(std::string tag)
std::string f_glb_logVerbose
ECbmModuleId ToECbmModuleId(std::string moduleString)
std::vector< ECbmTreeAccess > f_src_treeAccessMode