CbmRoot
Loading...
Searching...
No Matches
CaConfigReader.h
Go to the documentation of this file.
1/* Copyright (C) 2022-2024 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Sergei Zharko [committer] */
4
9
10#pragma once // include this header only once per compilation unit
11
12#include "CaIteration.h"
13
14#include <functional>
15#include <string>
16#include <unordered_map>
17#include <vector>
18
19#include <yaml-cpp/yaml.h>
20
21namespace YAML
22{
23 class Node;
24}
25
26namespace cbm::algo::ca
27{
28 class InitManager;
29 enum class DetectorID;
30
36 class ConfigReader {
37 public:
40 ConfigReader(InitManager* pInitManager, int verbose = 1);
41
43 ~ConfigReader() = default;
44
46 void Read();
47
50 std::vector<Iteration> ReadCAIterationVector();
51
54 void SetMainConfigPath(const std::string& path);
55
58 void SetUserConfigPath(const std::string& path);
59
61 void SetVerbosity(int verbose) { fVerbose = verbose; }
62
64 int GetVerbosity() const { return fVerbose; }
65
67 bool GetGeometryLock() const { return fbGeometryLock; }
68
70 void SetGeometryLock(bool lock) { fbGeometryLock = lock; }
71
72 private:
75 std::vector<std::set<int>> ReadInactiveStationMap();
76
79
88 YAML::Node GetNode(std::function<YAML::Node(YAML::Node)> fn) const;
89
94 Iteration ReadSingleCAIteration(const YAML::Node& node, const Iteration& defaultIter) const;
95
99 std::vector<std::string> GetNodeKeys(const YAML::Node& node) const;
100
102 int fVerbose = 1;
103
104 std::string fsMainConfigPath = "";
105 std::string fsUserConfigPath = "";
106
107 YAML::Node fMainConfigNode{YAML::NodeType::Undefined};
108 YAML::Node fUserConfigNode{YAML::NodeType::Undefined};
109
111 bool fbGeometryLock = false;
112 };
113} // namespace cbm::algo::ca
void SetGeometryLock(bool lock)
Sets geometry lock status.
YAML::Node fUserConfigNode
User configuration node.
std::vector< Iteration > ReadCAIterationVector()
Reads CA track finder iterations from YAML node.
int fVerbose
Verbosity level.
void SetUserConfigPath(const std::string &path)
Sets user config file.
Iteration ReadSingleCAIteration(const YAML::Node &node, const Iteration &defaultIter) const
Reads iteration from config file.
void SetVerbosity(int verbose)
Sets verbosity level.
YAML::Node fMainConfigNode
Main configuration node.
bool fbGeometryLock
Geometry initialization locked.
void ReadMisalignmentTolerance()
Reads the misalignment tolerance.
bool fbMainConfigInitialized
Main configuration file is initialized (e.g. via parameters obj)
YAML::Node GetNode(std::function< YAML::Node(YAML::Node)> fn) const
Accesses a node either from user config or from main config.
~ConfigReader()=default
Destructor.
int GetVerbosity() const
Gets verbosity level.
std::vector< std::set< int > > ReadInactiveStationMap()
Reads inactive tracking station map.
std::string fsUserConfigPath
Path to the user config file (optional)
InitManager * fpInitManager
Pointer to the L1InitManager instance.
void Read()
Reads configuration from files.
std::vector< std::string > GetNodeKeys(const YAML::Node &node) const
Gets parameters content of the node.
std::string fsMainConfigPath
Path to the main config file (mandatory)
ConfigReader(InitManager *pInitManager, int verbose=1)
Constructor.
void SetMainConfigPath(const std::string &path)
Sets main config file.
bool GetGeometryLock() const
Gets geometry lock status.
A CA Parameters object initialization class.
A set of parameters for the CA Track finder iteration.
TODO: SZh 8.11.2022: add selection of parameterisation.
Definition CaBranch.h:14