CbmRoot
Loading...
Searching...
No Matches
EventBuilderConfig.cxx
Go to the documentation of this file.
1/* Copyright (C) 2021 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Volker Friese [committer] */
4
6
7
8namespace cbm::algo::evbuild
9{
10
11 // ----- Constructor from YAML ------------------------------------------
13 {
14 if (!config) throw std::runtime_error("EventBuilderConfig: no configuration node");
15 for (YAML::const_iterator it = config.begin(); it != config.end(); ++it) {
16 auto det = ToCbmModuleIdCaseInsensitive(it->first.as<std::string>());
17 auto lower = it->second[0].as<double>();
18 auto upper = it->second[1].as<double>();
19 fWindows[det] = std::make_pair(lower, upper);
20 }
21 // TODO: Check if complete (should the parameters be mandatory?)
22 }
23 // --------------------------------------------------------------------------
24
25
26 // ----- Save to YAML ---------------------------------------------------
27 YAML::Node EventBuilderConfig::ToYaml() const
28 {
29 YAML::Node result;
30 for (const auto& entry : fWindows) {
31 auto det = ToString(entry.first);
32 result[det] = entry.second;
33 }
34 return result;
35 }
36 // --------------------------------------------------------------------------
37
38
39} // namespace cbm::algo::evbuild
ECbmModuleId ToCbmModuleIdCaseInsensitive(std::string modIdStr)
Definition CbmDefs.cxx:86
EventBuilderConfig(YAML::Node config)
Constructor from YAML.
YAML::Node ToYaml() const
Save to YAML.
std::map< ECbmModuleId, std::pair< double, double > > fWindows
Key: detector; value: [tmin, tmax].
std::string_view ToString(T t)
Definition EnumDict.h:64