The manager class is responsible for managing configurations and settings.
More...
#include <Manager/Manager.h>
|
| | Manager (std::string const &filename) |
| | Constructs a manager object with the specified file name. More...
|
| |
| | Manager (const YAML::Node ConfigNode) |
| | Constructs a manager object with the specified YAML. More...
|
| |
| virtual | ~Manager () |
| | Destroys the manager object. More...
|
| |
| void | SaveSettings (TFile *const OutputFile) const |
| | Add manager useful information's to TFile, in most cases to Fitter. More...
|
| |
| void | Print () const |
| | Print currently used config. More...
|
| |
| int | GetMCStatLLH () const |
| | Get likelihood type defined in the config. More...
|
| |
| std::string | GetFileName () const |
| | Return name of config. More...
|
| |
| YAML::Node const & | raw () const |
| | Return config. More...
|
| |
| std::string | GetName () const |
| | Get class name. More...
|
| |
| template<typename... Args> |
| void | OverrideSettings (Args &&... args) |
| | Overrides the configuration settings based on provided arguments. More...
|
| |
The manager class is responsible for managing configurations and settings.
- Author
- Ed Atkin
-
Kamil Skwarczynski
Definition at line 16 of file Manager.h.
◆ Manager() [1/2]
| Manager::Manager |
( |
std::string const & |
filename | ) |
|
|
inlineexplicit |
Constructs a manager object with the specified file name.
- Parameters
-
| filename | The name of the configuration file. |
Definition at line 20 of file Manager.h.
#define M3OpenConfig(filename)
Macro to simplify calling LoadYaml with file and line info.
void Initialise()
Common inialiser for both constructors.
YAML::Node config
The YAML node containing the configuration data.
std::string FileName
The name of the configuration file.
◆ Manager() [2/2]
Constructs a manager object with the specified YAML.
- Note
- This is primarily used when initializing from a previous chain, allowing the creation of a manager instance based embedded YAML in that chain.
- Parameters
-
| ConfigNode | Actual YAML config |
Definition at line 9 of file Manager.cpp.
◆ ~Manager()
Destroys the manager object.
Definition at line 32 of file Manager.cpp.
◆ GetFileName()
| std::string Manager::GetFileName |
( |
| ) |
const |
|
inline |
Return name of config.
Definition at line 45 of file Manager.h.
◆ GetMCStatLLH()
| int Manager::GetMCStatLLH |
( |
| ) |
const |
Get likelihood type defined in the config.
Definition at line 89 of file Manager.cpp.
92 if (
config[
"LikelihoodOptions"])
94 auto likelihood = GetFromManager<std::string>(
config[
"LikelihoodOptions"][
"TestStatistic"],
"Barlow-Beeston", __FILE__ , __LINE__);
TestStatistic TestStatFromString(const std::string &likelihood)
Convert a string to a TestStatistic enum.
std::string TestStatistic_ToString(const TestStatistic TestStat)
Convert a LLH type to a string.
@ kNTestStatistics
Number of test statistics.
@ kPoisson
Standard Poisson likelihood .
◆ GetName()
| std::string Manager::GetName |
( |
| ) |
const |
|
inline |
Get class name.
Definition at line 49 of file Manager.h.
◆ Initialise()
| void Manager::Initialise |
( |
| ) |
|
|
private |
Common inialiser for both constructors.
Definition at line 18 of file Manager.cpp.
void SetMaCh3LoggerFormat()
Set messaging format of the logger.
void PrintConfig(const YAML::Node &node)
KS: Print Yaml config using logger.
void MaCh3Welcome()
KS: Prints welcome message with MaCh3 logo.
◆ OverrideSettings()
template<typename... Args>
| void Manager::OverrideSettings |
( |
Args &&... |
args | ) |
|
|
inline |
Overrides the configuration settings based on provided arguments.
- Note
- Example usage:
FitManager->OverrideSettings("General", "OutputFile", "Wooimbouttamakeanameformyselfere.root");
Definition at line 57 of file Manager.h.
void OverrideConfig(YAML::Node node, std::string const &key, TValue val)
Overrides the configuration settings based on provided arguments.
◆ Print()
| void Manager::Print |
( |
| ) |
const |
Print currently used config.
Definition at line 81 of file Manager.cpp.
◆ raw()
| YAML::Node const& Manager::raw |
( |
| ) |
const |
|
inline |
Return config.
Definition at line 47 of file Manager.h.
◆ SaveSettings()
| void Manager::SaveSettings |
( |
TFile *const |
OutputFile | ) |
const |
Add manager useful information's to TFile, in most cases to Fitter.
- Parameters
-
| OutputFile | The ROOT TFile to which the information will be added. |
Definition at line 40 of file Manager.cpp.
42 std::string OutputFilename = std::string(OutputFile->GetName());
50 TTree *SaveBranch =
new TTree(
"Settings",
"Settings");
53 SaveBranch->Branch(
"Output", &OutputFilename);
57 bool cpu_mp_on =
true;
58 int n_cpus = omp_get_max_threads();
60 bool cpu_mp_on =
false;
70 SaveBranch->Branch(
"GPU", &gpu_on);
71 SaveBranch->Branch(
"CPUMP", &cpu_mp_on);
72 SaveBranch->Branch(
"nCPUs", &n_cpus);
TMacro YAMLtoTMacro(const YAML::Node &yaml_node, const std::string &name)
Convert a YAML node to a ROOT TMacro object.
◆ config
| YAML::Node Manager::config |
|
private |
The YAML node containing the configuration data.
Definition at line 66 of file Manager.h.
◆ FileName
| std::string Manager::FileName |
|
private |
The name of the configuration file.
Definition at line 68 of file Manager.h.
The documentation for this class was generated from the following files: