MaCh3  2.6.1
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 namespace M3 {
16 namespace Plotting {
17 
21 class StyleManager {
22 public:
25  StyleManager(const std::string& configName);
26 
27  // NO COPYING!
28  StyleManager( const StyleManager& ) = delete;
29  StyleManager( StyleManager&& ) = default;
30 
32  MACH3LOG_DEBUG("##### Deleting StyleManager Instance #####");
33  }
34 
40  std::string prettifyParamName(const std::string &origName) const {
41  return prettifyName(origName, "parameters");
42  };
43 
49  std::string prettifySampleName(const std::string &origName) const {
50  return prettifyName(origName, "samples");
51  };
52 
58  std::string prettifyKinematicName(const std::string &origName) const {
59  return prettifyName(origName, "kinematics");
60  };
61 
64  double getBinWidthScale(const std::string &Name) const;
65 
66  // style setting options
70  void setPalette(const int rootPlotStyle) const;
71 
75  void setPalette(const std::string& configStyleName) const;
76 
80  void setTH1Style(TH1 *hist, const std::string& styleName) const;
81 
82 private:
83  YAML::Node _styleConfig;
84 
85  // helper to basically just read fancy names from config
86  std::string prettifyName(const std::string &origName, const std::string &nameType) const;
87 
88 };
89 } // namespace Plotting
90 } // namespace M3
#define _MaCh3_Safe_Include_Start_
KS: Avoiding warning checking for headers.
Definition: Core.h:126
#define _MaCh3_Safe_Include_End_
Defines the custom exception class used throughout MaCh3.
MaCh3 Logging utilities built on top of SPDLOG.
#define MACH3LOG_DEBUG
Definition: MaCh3Logger.h:34
Utility functions for handling YAML nodes.
EW: provides centralized styling utilities for plots, including name prettification and style applica...
Definition: StyleManager.h:21
double getBinWidthScale(const std::string &Name) const
Get bin-width scaling factor for a given kinematic variable.
StyleManager(const std::string &configName)
Constructor.
Definition: StyleManager.cpp:5
std::string prettifySampleName(const std::string &origName) const
Convert hideous and vulgar internal sample name into a beautiful presentable name.
Definition: StyleManager.h:49
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.
std::string prettifyKinematicName(const std::string &origName) const
Convert hideous and vulgar internal kinematics name into a beautiful presentable name.
Definition: StyleManager.h:58
std::string prettifyParamName(const std::string &origName) const
Convert hideous and vulgar internal parameter name into a beautiful presentable name.
Definition: StyleManager.h:40
StyleManager(StyleManager &&)=default
StyleManager(const StyleManager &)=delete
std::string prettifyName(const std::string &origName, const std::string &nameType) const
Definition: StyleManager.cpp:9
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...
Main namespace for MaCh3 software.