MaCh3  2.5.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 
9 //KS: Joy of forward declaration https://gieseanw.wordpress.com/2018/02/25/the-joys-of-forward-declarations-results-from-the-real-world/
10 class TFile;
11 
16 class Manager {
17 public:
20  explicit Manager(std::string const &filename)
21  : config(M3OpenConfig(filename)) {
22  FileName = filename;
23 
24  Initialise();
25  };
26 
30  Manager(const YAML::Node ConfigNode);
31 
33  virtual ~Manager();
34 
37  void SaveSettings(TFile* const OutputFile) const;
38 
40  void Print() const;
41 
43  int GetMCStatLLH() const;
45  inline std::string GetFileName() const {return FileName;}
47  inline YAML::Node const &raw() const {return config;}
49  inline std::string GetName() const {return "Manager";};
50 
56  template <typename... Args>
57  void OverrideSettings(Args&&... args) {
58  OverrideConfig(config, std::forward<Args>(args)...);
59  }
60 
61 private:
63  void Initialise();
64 
66  YAML::Node config;
68  std::string FileName;
69 };
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:249
#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:16
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:66
Manager(std::string const &filename)
Constructs a manager object with the specified file name.
Definition: Manager.h:20
YAML::Node const & raw() const
Return config.
Definition: Manager.h:47
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:68
std::string GetName() const
Get class name.
Definition: Manager.h:49
std::string GetFileName() const
Return name of config.
Definition: Manager.h:45
void OverrideSettings(Args &&... args)
Overrides the configuration settings based on provided arguments.
Definition: Manager.h:57
void Print() const
Print currently used config.
Definition: Manager.cpp:81