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) |
| Add manager useful information's to TFile, in most cases to Fitter. More...
|
|
void | Print () |
| Print currently used config. More...
|
|
int | GetMCStatLLH () |
| Get likelihood type defined in the config. More...
|
|
std::string | GetFileName () |
| Return name of config. More...
|
|
YAML::Node const & | raw () |
| 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.
- See also
- For more details, visit the Wiki.
- Author
- Ed Atkin
-
Kamil Skwarczynski
Definition at line 16 of file Manager.h.
◆ manager() [1/2]
Constructs a manager object with the specified file name.
- Parameters
-
filename | The name of the configuration file. |
Definition at line 9 of file Manager.cpp.
#define M3OpenConfig(filename)
Macro to simplify calling LoadYaml with file and line info.
std::string FileName
The name of the configuration file.
YAML::Node config
The YAML node containing the configuration data.
void Initialise()
Common inialiser for both constructors.
◆ manager() [2/2]
manager::manager |
( |
const YAML::Node |
ConfigNode | ) |
|
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 18 of file Manager.cpp.
◆ ~manager()
Destroys the manager object.
Definition at line 41 of file Manager.cpp.
◆ GetFileName()
std::string manager::GetFileName |
( |
| ) |
|
|
inline |
Return name of config.
Definition at line 39 of file Manager.h.
◆ GetMCStatLLH()
int manager::GetMCStatLLH |
( |
| ) |
|
Get likelihood type defined in the config.
Definition at line 98 of file Manager.cpp.
101 if (
config[
"LikelihoodOptions"])
103 auto likelihood = GetFromManager<std::string>(
config[
"LikelihoodOptions"][
"TestStatistic"],
"Barlow-Beeston", __FILE__ , __LINE__);
std::string TestStatistic_ToString(const TestStatistic TestStat)
Convert a LLH type to a string.
TestStatistic
Make an enum of the test statistic that we're using.
@ kNTestStatistics
Number of test statistics.
@ kPoisson
Standard Poisson likelihood .
Custom exception class for MaCh3 errors.
◆ GetName()
std::string manager::GetName |
( |
| ) |
const |
|
inline |
Get class name.
Definition at line 43 of file Manager.h.
◆ Initialise()
void manager::Initialise |
( |
| ) |
|
|
private |
Common inialiser for both constructors.
Definition at line 27 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 51 of file Manager.h.
void OverrideConfig(YAML::Node node, std::string const &key, TValue val)
Overrides the configuration settings based on provided arguments.
◆ Print()
Print currently used config.
Definition at line 90 of file Manager.cpp.
◆ raw()
YAML::Node const& manager::raw |
( |
| ) |
|
|
inline |
Return config.
Definition at line 41 of file Manager.h.
◆ SaveSettings()
void manager::SaveSettings |
( |
TFile *const |
OutputFile | ) |
|
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 49 of file Manager.cpp.
51 std::string OutputFilename = std::string(OutputFile->GetName());
59 TTree *SaveBranch =
new TTree(
"Settings",
"Settings");
62 SaveBranch->Branch(
"Output", &OutputFilename);
66 bool cpu_mp_on =
true;
67 int n_cpus = omp_get_max_threads();
69 bool cpu_mp_on =
false;
79 SaveBranch->Branch(
"GPU", &gpu_on);
80 SaveBranch->Branch(
"CPUMP", &cpu_mp_on);
81 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 60 of file Manager.h.
◆ FileName
std::string manager::FileName |
|
private |
The name of the configuration file.
Definition at line 62 of file Manager.h.
The documentation for this class was generated from the following files: