MaCh3  2.2.3
Reference Guide
styleManager.h
Go to the documentation of this file.
1 #pragma once
2 
3 // MaCh3 Includes
4 #include "Manager/MaCh3Logger.h"
5 #include "Manager/YamlHelper.h"
7 
9 // ROOT Things
10 #include "TColor.h"
11 #include "TH1.h"
12 #include "TStyle.h"
14 
15 
16 namespace MaCh3Plotting {
18 
20 class StyleManager {
21 public:
24  StyleManager(std::string configName);
25 
26  // NO COPYING!
27  StyleManager( const StyleManager& ) = delete;
28  StyleManager( StyleManager&& ) = default;
29 
31  MACH3LOG_DEBUG("##### Deleting StyleManager Instance #####");
32  }
33 
39  inline std::string prettifyParamName(const std::string &origName) const {
40  return prettifyName(origName, "parameters");
41  };
42 
48  inline std::string prettifySampleName(const std::string &origName) const {
49  return prettifyName(origName, "samples");
50  };
51 
52  // style setting options
56  void setPalette(const int rootPlotStyle) const;
57 
61  void setPalette(const std::string& configStyleName) const;
62 
66  void setTH1Style(TH1 *hist, const std::string& styleName) const;
67 
68 private:
69  YAML::Node _styleConfig;
70 
71  // helper to basically just read fancy names from config
72  std::string prettifyName(const std::string &origName, const std::string &nameType) const;
73 
74 };
75 
76 } // namespace MaCh3Plotting
#define _MaCh3_Safe_Include_Start_
KS: Avoiding warning checking for headers.
Definition: Core.h:109
#define _MaCh3_Safe_Include_End_
KS: Restore warning checking after including external headers.
Definition: Core.h:120
KS: Based on this https://github.com/gabime/spdlog/blob/a2b4262090fd3f005c2315dcb5be2f0f1774a005/incl...
#define MACH3LOG_DEBUG
Definition: MaCh3Logger.h:24
Utility functions for handling YAML nodes.
EW: provides centralized styling utilities for plots, including name prettification and style applica...
Definition: styleManager.h:20
std::string prettifyParamName(const std::string &origName) const
Convert hideous and vulgar internal parameter name into a beautiful presentable name.
Definition: styleManager.h:39
std::string prettifyName(const std::string &origName, const std::string &nameType) const
Definition: styleManager.cpp:8
std::string prettifySampleName(const std::string &origName) const
Convert hideous and vulgar internal sample name into a beautiful presentable name.
Definition: styleManager.h:48
StyleManager(const StyleManager &)=delete
StyleManager(std::string configName)
Constructor.
Definition: styleManager.cpp:4
StyleManager(StyleManager &&)=default
void setTH1Style(TH1 *hist, const std::string &styleName) const
Set the style of a TH1 to one of the styles defined in the style config.
void setPalette(const int rootPlotStyle) const
Set the root colour palette to one of the default root pallettes as defined in (root docs)[https://ro...