CbmRoot
Loading...
Searching...
No Matches
cbm::algo::ca::ConfigReader Class Reference

A reader for the CA parameters from the YAML configuration files. More...

#include <CaConfigReader.h>

Public Member Functions

 ConfigReader (int verbose=1)
 Constructor.
 
 ~ConfigReader ()=default
 Destructor.
 
void SetDetectorNames (const std::array< std::string, constants::size::MaxNdetectors > &input)
 Sets detector names.
 
void SetMainConfigPath (const std::string &path)
 Sets main config file.
 
void SetUserConfigPath (const std::string &path)
 Sets user config file.
 
void SetVerbosity (int verbose)
 Sets verbosity level.
 
int GetVerbosity () const
 Gets verbosity level.
 
Config CreateConfig () const
 Creates a config.
 
std::vector< IterationReadCAIterationVector () const
 Reads CA track finder iterations from YAML node.
 
std::vector< std::pair< EDetectorID, int > > ReadInactiveStationMap () const
 Reads inactive tracking station map.
 

Private Member Functions

YAML::Node GetNode (std::function< YAML::Node(YAML::Node)> fn, bool optional=false) const
 Accesses a node either from user config or from main config.
 
Config::MisalignmentTolArray_t ReadMisalignmentTolerances () const
 Reads misalignment tolerances.
 
Iteration ReadSingleCAIteration (const YAML::Node &node, const Iteration &defaultIter) const
 Reads iteration from config file.
 
std::vector< std::string > GetNodeKeys (const YAML::Node &node) const
 Gets parameters content of the node.
 

Private Attributes

std::unordered_map< std::string, EDetectorIDfDetNameMap
 
std::string fsMainConfigPath = ""
 Path to the main config file (mandatory)
 
std::string fsUserConfigPath = ""
 Path to the user config file (optional)
 
YAML::Node fMainConfigNode {YAML::NodeType::Undefined}
 Main configuration node.
 
YAML::Node fUserConfigNode {YAML::NodeType::Undefined}
 User configuration node.
 
int fVerbose = 1
 Verbosity level.
 

Detailed Description

A reader for the CA parameters from the YAML configuration files.

TODO: Describe configuration procedure here... (main config, user config etc...)

Definition at line 37 of file CaConfigReader.h.

Constructor & Destructor Documentation

◆ ConfigReader()

ConfigReader::ConfigReader ( int verbose = 1)
explicit

Constructor.

Definition at line 30 of file CaConfigReader.cxx.

References fVerbose.

◆ ~ConfigReader()

cbm::algo::ca::ConfigReader::~ConfigReader ( )
default

Destructor.

Member Function Documentation

◆ CreateConfig()

Config ConfigReader::CreateConfig ( ) const

Creates a config.

Definition at line 312 of file CaConfigReader.cxx.

References GetNode(), ReadCAIterationVector(), and ReadMisalignmentTolerances().

◆ GetNode()

YAML::Node ConfigReader::GetNode ( std::function< YAML::Node(YAML::Node)> fn,
bool optional = false ) const
private

Accesses a node either from user config or from main config.

Parameters
fnA function, which returns a YAML::Node reference object
optionaltrue: node is not mandatory
Note
If the node is not found in both configs
Exceptions
std::runtime_error,ifthe path does not exist in the config

This function is to be used, if the desired node should exist either in main or in user config. Firstly, the user config is checked, if it is provided. If the node is not found in user config, the main config is checked. If the node does not exist in the main config as well, an exception will be thrown.

Definition at line 35 of file CaConfigReader.cxx.

References fMainConfigNode, fsMainConfigPath, fsUserConfigPath, and fUserConfigNode.

Referenced by CreateConfig(), ReadInactiveStationMap(), and ReadMisalignmentTolerances().

◆ GetNodeKeys()

std::vector< std::string > ConfigReader::GetNodeKeys ( const YAML::Node & node) const
private

Gets parameters content of the node.

Parameters
nodeYAML node
Returns
Vector of key names

Definition at line 58 of file CaConfigReader.cxx.

Referenced by ReadSingleCAIteration().

◆ GetVerbosity()

int cbm::algo::ca::ConfigReader::GetVerbosity ( ) const
inline

Gets verbosity level.

Definition at line 60 of file CaConfigReader.h.

References fVerbose.

◆ ReadCAIterationVector()

std::vector< Iteration > ConfigReader::ReadCAIterationVector ( ) const

Reads CA track finder iterations from YAML node.

Returns
A vector of iterations

Definition at line 78 of file CaConfigReader.cxx.

References fMainConfigNode, fUserConfigNode, fVerbose, and ReadSingleCAIteration().

Referenced by CreateConfig(), and cbm::ca::tools::WindowFinder::ReadTrackingIterationsFromYAML().

◆ ReadInactiveStationMap()

std::vector< std::pair< EDetectorID, int > > ConfigReader::ReadInactiveStationMap ( ) const

Reads inactive tracking station map.

Returns
A vector of {detId, locId} station indices, which are marked as inactive
Note
If locId == -1, all stations of a given EDetectorID will be disabled

Definition at line 164 of file CaConfigReader.cxx.

References fDetNameMap, and GetNode().

◆ ReadMisalignmentTolerances()

Config::MisalignmentTolArray_t ConfigReader::ReadMisalignmentTolerances ( ) const
private

Reads misalignment tolerances.

Definition at line 239 of file CaConfigReader.cxx.

References fDetNameMap, GetNode(), and v.

Referenced by CreateConfig().

◆ ReadSingleCAIteration()

◆ SetDetectorNames()

void ConfigReader::SetDetectorNames ( const std::array< std::string, constants::size::MaxNdetectors > & input)

Sets detector names.

Definition at line 322 of file CaConfigReader.cxx.

References fDetNameMap.

Referenced by cbm::algo::ca::ParametersBuilder::Build().

◆ SetMainConfigPath()

void ConfigReader::SetMainConfigPath ( const std::string & path)

Sets main config file.

Parameters
pathPath to the file

Definition at line 334 of file CaConfigReader.cxx.

References fMainConfigNode, fsMainConfigPath, and fVerbose.

Referenced by cbm::ca::tools::WindowFinder::ReadTrackingIterationsFromYAML().

◆ SetUserConfigPath()

void ConfigReader::SetUserConfigPath ( const std::string & path)

Sets user config file.

Parameters
pathPath to user config file

Definition at line 352 of file CaConfigReader.cxx.

References fsUserConfigPath, fUserConfigNode, and fVerbose.

◆ SetVerbosity()

void cbm::algo::ca::ConfigReader::SetVerbosity ( int verbose)
inline

Sets verbosity level.

Definition at line 57 of file CaConfigReader.h.

References fVerbose.

Member Data Documentation

◆ fDetNameMap

std::unordered_map<std::string, EDetectorID> cbm::algo::ca::ConfigReader::fDetNameMap
private

◆ fMainConfigNode

YAML::Node cbm::algo::ca::ConfigReader::fMainConfigNode {YAML::NodeType::Undefined}
private

Main configuration node.

Definition at line 105 of file CaConfigReader.h.

Referenced by GetNode(), ReadCAIterationVector(), and SetMainConfigPath().

◆ fsMainConfigPath

std::string cbm::algo::ca::ConfigReader::fsMainConfigPath = ""
private

Path to the main config file (mandatory)

Definition at line 102 of file CaConfigReader.h.

Referenced by GetNode(), and SetMainConfigPath().

◆ fsUserConfigPath

std::string cbm::algo::ca::ConfigReader::fsUserConfigPath = ""
private

Path to the user config file (optional)

Definition at line 103 of file CaConfigReader.h.

Referenced by GetNode(), and SetUserConfigPath().

◆ fUserConfigNode

YAML::Node cbm::algo::ca::ConfigReader::fUserConfigNode {YAML::NodeType::Undefined}
private

User configuration node.

Definition at line 106 of file CaConfigReader.h.

Referenced by GetNode(), ReadCAIterationVector(), and SetUserConfigPath().

◆ fVerbose

int cbm::algo::ca::ConfigReader::fVerbose = 1
private

The documentation for this class was generated from the following files: