CbmRoot
Loading...
Searching...
No Matches
sim/response/steer/Config.h
Go to the documentation of this file.
1/* Copyright (C) 2023 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Frederic Linz [committer], Volker Friese */
4
10#ifndef CBMSIM_DIGITIZATION_STEER_CONFIG_H
11#define CBMSIM_DIGITIZATION_STEER_CONFIG_H 1
12
13#include "CbmDefs.h"
14#include "CbmDigitization.h"
15
16#include <array>
17#include <fstream>
18#include <sstream>
19#include <string>
20#include <vector>
21
22#include <yaml-cpp/yaml.h>
23
25{
26
34 class Config {
35 public:
37 Config() = default;
38
39
41 virtual ~Config() = default;
42
43
47 void LoadYaml(const std::string& filename);
48
49
51 std::string ToString()
52 {
53 std::stringstream out;
54 out << ToYaml();
55 return out.str();
56 }
57
58
62 void SaveYaml(const std::string& filename)
63 {
64 std::ofstream fout(filename);
65 fout << ToYaml();
66 }
67
68
69 private:
70 cbm::sim::Mode ToCbmDigiMode(std::string tag);
71 std::string ToString(cbm::sim::Mode mode);
72
73 cbm::sim::TimeDist ToCbmSimTimeDist(std::string tag);
74 std::string ToString(cbm::sim::TimeDist dist);
75
76 ECbmModuleId ToECbmModuleId(std::string moduleString);
77 std::string ToString(ECbmModuleId moduleId);
78
79 ECbmTreeAccess ToECbmTreeAccess(std::string treeAccessString);
80 std::string ToString(ECbmTreeAccess treeAccessString);
81
83 YAML::Node ToYaml();
84
85
86 public:
87 // --- Global settings
88 std::string f_glb_logLevel = "INFO";
89 std::string f_glb_logVerbose = "LOW";
90 std::string f_glb_logColor = "true";
92 int f_glb_numTs = -1;
94
95 // --- Detector selection
97 std::vector<ECbmModuleId> f_det_deactivate;
98
99 // --- Timeslice settings
100 float f_ts_tslength = 1.e5;
101 float f_ts_startTime = 1000.;
102 bool f_ts_storeAllTS = false;
104 cbm::sim::TimeDist::Undefined; // Event time distribution model: poisson or uniform
105
106 // --- Background settings
107 bool f_bg_produceNoise = false;
108
109 // --- Input sources settings
110 std::vector<int> f_src_id;
111 std::vector<float> f_src_rate;
112 std::vector<ECbmTreeAccess> f_src_treeAccessMode;
113 std::vector<int> f_src_embedToId;
114 };
115
116} // namespace cbm::sim::digitization
117
118
119#endif /* CBMSIM_DIGITIZATION_STEER_CONFIG_H */
ECbmTreeAccess
Mode to read entries from a ROOT TTree.
Definition CbmDefs.h:152
ECbmModuleId
Definition CbmDefs.h:39
@ kNotExist
If not found.
std::string ToString()
String output (YAML format)
std::vector< ECbmModuleId > f_det_deactivate
void SaveYaml(const std::string &filename)
Save to YAML file.
YAML::Node ToYaml()
Save to YAML node.
void LoadYaml(const std::string &filename)
Load from YAML file.
virtual ~Config()=default
Destructor.
ECbmTreeAccess ToECbmTreeAccess(std::string treeAccessString)
cbm::sim::TimeDist ToCbmSimTimeDist(std::string tag)
cbm::sim::Mode ToCbmDigiMode(std::string tag)
Config()=default
Constructor.
ECbmModuleId ToECbmModuleId(std::string moduleString)
std::vector< ECbmTreeAccess > f_src_treeAccessMode
TimeDist
Definition Defs.h:29