9 std::string prettyName = origName;
11 YAML::Node prettyNames =
_styleConfig[
"PrettyNames"][nameType];
13 if (prettyNames[origName])
15 prettyName = prettyNames[origName].as<std::string>();
23 gStyle->SetPalette(rootPlotStyle);
31 std::vector<std::vector<double>> paletteDef =
32 palettes[configStyleName].as<std::vector<std::vector<double>>>();
34 const Int_t NCont = Int_t(paletteDef[0][0]);
36 std::vector<double> stopVec = paletteDef[1];
37 std::vector<double> redsVec = paletteDef[2];
38 std::vector<double> greensVec = paletteDef[3];
39 std::vector<double> bluesVec = paletteDef[4];
42 const size_t NRGBs = stopVec.size();
43 if (redsVec.size() != NRGBs || greensVec.size() != NRGBs ||
44 bluesVec.size() != NRGBs)
46 MACH3LOG_ERROR(
"invalid colour palettet defined in style config file: {}");
47 MACH3LOG_ERROR(
"RGB arrays dont all have the same size, please fix that");
51 TColor::CreateGradientColorTable(
int(NRGBs), stopVec.data(), redsVec.data(), greensVec.data(), bluesVec.data(), NCont);
52 gStyle->SetNumberContours(NCont);
58 YAML::Node styleDef = TH1Styles[styleName];
60 if (styleDef[
"MarkerColor"])
62 hist->SetMarkerColor(styleDef[
"MarkerColor"].as<Color_t>());
64 if (styleDef[
"MarkerStyle"])
66 hist->SetMarkerStyle(styleDef[
"MarkerStyle"].as<Color_t>());
68 if (styleDef[
"FillColor"])
70 hist->SetFillColor(styleDef[
"FillColor"].as<Color_t>());
72 if (styleDef[
"FillStyle"])
74 hist->SetFillStyle(styleDef[
"FillStyle"].as<Color_t>());
76 if (styleDef[
"LineColor"])
78 hist->SetLineColor(styleDef[
"LineColor"].as<Color_t>());
80 if (styleDef[
"LineStyle"])
82 hist->SetLineStyle(styleDef[
"LineStyle"].as<Color_t>());
void setTH1Style(TH1 *hist, std::string styleName) const
Set the style of a TH1 to one of the styles defined in the style config.
std::string prettifyName(const std::string &origName, const std::string &nameType) const
void setPalette(int rootPlotStyle) const
Set the root colour palette to one of the default root pallettes as defined in (root docs)[https://ro...
StyleManager(std::string configName)
Constructor.