MaCh3  2.8.0
Reference Guide
Manager.h
Go to the documentation of this file.
1 #pragma once
2 
3 // MaCh3 Includes
5 #include "Manager/YamlHelper.h"
6 #include "Manager/Monitor.h"
8 #include "Manager/Random.h"
9 
10 //KS: Joy of forward declaration https://gieseanw.wordpress.com/2018/02/25/the-joys-of-forward-declarations-results-from-the-real-world/
11 class TFile;
12 
17 class Manager {
18 public:
21  explicit Manager(std::string const &filename)
22  : config(M3OpenConfig(filename)) {
23  FileName = filename;
24 
25  Initialise();
26  };
27 
31  Manager(const YAML::Node ConfigNode);
32 
34  virtual ~Manager();
35 
38  void SaveSettings(TFile* const OutputFile) const;
39 
41  void Print() const;
42 
44  int GetMCStatLLH() const;
46  inline std::string GetFileName() const {return FileName;}
48  inline YAML::Node const &raw() const {return config;}
50  inline std::string GetName() const {return "Manager";};
51 
57  template <typename... Args>
58  void OverrideSettings(Args&&... args) {
59  OverrideConfig(config, std::forward<Args>(args)...);
60  }
61 
62 private:
64  void Initialise();
65 
67  YAML::Node config;
69  std::string FileName;
70 };
Defines the custom exception class used throughout MaCh3.
System and monitoring utilities for printing system information and status updates.
Utility functions for handling YAML nodes.
void OverrideConfig(YAML::Node node, std::string const &key, TValue val)
Overrides the configuration settings based on provided arguments.
Definition: YamlHelper.h:248
#define M3OpenConfig(filename)
Macro to simplify calling LoadYaml with file and line info.
Definition: YamlHelper.h:589
The manager class is responsible for managing configurations and settings.
Definition: Manager.h:17
void Initialise()
Common inialiser for both constructors.
Definition: Manager.cpp:18
int GetMCStatLLH() const
Get likelihood type defined in the config.
Definition: Manager.cpp:89
virtual ~Manager()
Destroys the manager object.
Definition: Manager.cpp:32
YAML::Node config
The YAML node containing the configuration data.
Definition: Manager.h:67
Manager(std::string const &filename)
Constructs a manager object with the specified file name.
Definition: Manager.h:21
YAML::Node const & raw() const
Return config.
Definition: Manager.h:48
void SaveSettings(TFile *const OutputFile) const
Add manager useful information's to TFile, in most cases to Fitter.
Definition: Manager.cpp:40
std::string FileName
The name of the configuration file.
Definition: Manager.h:69
std::string GetName() const
Get class name.
Definition: Manager.h:50
std::string GetFileName() const
Return name of config.
Definition: Manager.h:46
void OverrideSettings(Args &&... args)
Overrides the configuration settings based on provided arguments.
Definition: Manager.h:58
void Print() const
Print currently used config.
Definition: Manager.cpp:81