CbmRoot
Loading...
Searching...
No Matches
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.

◆ ~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.

◆ 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.

◆ 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.

◆ GetVerbosity()

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

Gets verbosity level.

Definition at line 60 of file CaConfigReader.h.

◆ 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.

◆ 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.

◆ ReadMisalignmentTolerances()

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

Reads misalignment tolerances.

Definition at line 239 of file CaConfigReader.cxx.

◆ ReadSingleCAIteration()

Iteration ConfigReader::ReadSingleCAIteration ( const YAML::Node & node,
const Iteration & defaultIter ) const
private

Reads iteration from config file.

Parameters
nodeYAML node containing an iteration
defaultIterDefault iteration
Returns
A CA-iteration object

Definition at line 273 of file CaConfigReader.cxx.

◆ SetDetectorNames()

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

Sets detector names.

Definition at line 322 of file CaConfigReader.cxx.

◆ 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.

◆ 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.

◆ SetVerbosity()

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

Sets verbosity level.

Definition at line 57 of file CaConfigReader.h.

Member Data Documentation

◆ fDetNameMap

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

Definition at line 100 of file CaConfigReader.h.

◆ fMainConfigNode

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

Main configuration node.

Definition at line 105 of file CaConfigReader.h.

◆ fsMainConfigPath

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

Path to the main config file (mandatory)

Definition at line 102 of file CaConfigReader.h.

◆ fsUserConfigPath

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

Path to the user config file (optional)

Definition at line 103 of file CaConfigReader.h.

◆ fUserConfigNode

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

User configuration node.

Definition at line 106 of file CaConfigReader.h.

◆ fVerbose

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

Verbosity level.

Definition at line 108 of file CaConfigReader.h.


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