11#include <TAttMarker.h> 
   12#include <TGraphErrors.h> 
   16#include "MultiGraph.h" 
   25  const unsigned short int HistoStyle::kTitle = 0;
 
   26  const unsigned short int HistoStyle::kMin   = 1;
 
   27  const unsigned short int HistoStyle::kMax   = 2;
 
   28  void HistoStyle::SetTitle(TString title) {
 
   33  AxisStyle& HistoStyle::GetAxisStyle(Char_t x) {
 
   34    if (x == 
'y' || x == 
'Y') 
return fYAxis;
 
   35    if (x == 
'z' || x == 
'Z') 
return fZAxis;
 
   39  void HistoStyle::ExportToXML(XMLNode* node)
 const {
 
   43    XMLNode* xAxis  = 
new XMLNode(
"XAxis");
 
   44    XMLNode* yAxis  = 
new XMLNode(
"YAxis");
 
   45    XMLNode* zAxis  = 
new XMLNode(
"ZAxis");
 
   46    XMLNode* fill   = 
new XMLNode(
"Fill");
 
   47    XMLNode* marker = 
new XMLNode(
"Marker");
 
   48    XMLNode* line   = 
new XMLNode(
"Line");
 
   49    fXAxis.ExportToXML(xAxis);
 
   50    fYAxis.ExportToXML(yAxis);
 
   51    fZAxis.ExportToXML(zAxis);
 
   52    fMarker.ExportToXML(marker);
 
   53    fLine.ExportToXML(line);
 
   54    fFill.ExportToXML(fill);
 
   55    node->AddChild(xAxis);
 
   56    node->AddChild(yAxis);
 
   57    node->AddChild(zAxis);
 
   59    node->AddChild(marker);
 
   65    if (Hal::Std::FindParam(style, 
"05", kTRUE)) {
 
   66      res.
SetAxis(0.05, 0.8, 0.05, 0.005, 
'x');
 
   67      res.
SetAxis(0.05, 0.8, 0.05, 0.005, 
'y');
 
   69    if (Hal::Std::FindParam(style, 
"color", kTRUE)) res.
SetColor(kRed);
 
   70    if (Hal::Std::FindParam(style, 
"circle", kTRUE)) res.GetMarkerStyle().SetStyle(kFullCircle);
 
   71    if (Hal::Std::FindParam(style, 
"center", kTRUE)) {
 
 
   89    fMarker.SetStyle(marker);
 
   90    fMarker.SetSize(size);
 
 
   95    fLine.SetStyle(style);
 
   96    fLine.SetWidth(widgth);
 
 
  105    if (ax == 
'x') fXAxis.SetRangeUser(min, max);
 
  106    if (ax == 
'y') fYAxis.SetRangeUser(min, max);
 
  107    if (ax == 
'z') fZAxis.SetRangeUser(min, max);
 
 
  112    fXAxis.SetTitle(xAxis);
 
  113    fYAxis.SetTitle(yAxis);
 
  114    fZAxis.SetTitle(zAxis);
 
 
  117  void HistoStyle::SetAxis(Double_t titleSize, Double_t titleOffset, Double_t labelSize, Double_t labelOffset, Char_t x) {
 
  118    auto setAx = [](
AxisStyle& st, Double_t _titleSize, Double_t _titleOffset, Double_t _labelSize, Double_t _labelOffset) {
 
  119      st.SetTitleSize(_titleSize);
 
  120      st.SetTitleOffset(_titleOffset);
 
  121      st.SetLabelOffset(_labelOffset);
 
  122      st.SetLabelSize(_labelSize);
 
  124    if (x == 
'x') setAx(fXAxis, titleSize, titleOffset, labelSize, labelOffset);
 
  125    if (x == 
'y') setAx(fYAxis, titleSize, titleOffset, labelSize, labelOffset);
 
  126    if (x == 
'z') setAx(fZAxis, titleSize, titleOffset, labelSize, labelOffset);
 
 
  130    if (x == 
'x') fXAxis.SetCenterTitle(center);
 
  131    if (x == 
'y') fYAxis.SetCenterTitle(center);
 
  132    if (x == 
'z') fZAxis.SetCenterTitle(center);
 
 
  135  void HistoStyle::Apply(TObject& h, Int_t no)
 const {
 
  136    if (h.InheritsFrom(
"TH1")) {
 
  137      ApplyInternal(*
dynamic_cast<TH1*
>(&h));
 
  138      auto zax = 
static_cast<TH1&
>(h).GetZaxis();
 
  139      if (zax) fZAxis.Apply(*zax);
 
  140    } 
else if (h.InheritsFrom(
"Hal::MultiGraph")) {
 
  143        for (
int i = 0; i < gr->GetNGraphs(); i++) {
 
  144          ApplyInternal(*gr->GetGraph(i));
 
  146        fXAxis.Apply(*gr->GetXaxis());
 
  147        fYAxis.Apply(*gr->GetYaxis());
 
  149        ApplyInternal(*gr->GetGraph(no));
 
  151    } 
else if (h.InheritsFrom(
"Hal::DividedHisto1D")) {
 
  154    if (h.InheritsFrom(
"TGraph")) { ApplyInternal(
dynamic_cast<TGraph&
>(h)); }
 
  159    auto GetCol = [&](Int_t col) {
 
  160      col = Hal::Std::GetAntiColor(col);
 
  163    fMarker.SetColor(GetCol(i));
 
  164    fLine.SetColor(GetCol(i));
 
 
  168  void Hal::HistoStyle::ApplyInternal(T& 
object)
 const {
 
  169    if (Find(kTitle)) 
object.SetTitle(fTitle);
 
  170    if (Find(kMin)) 
object.SetMinimum(GetF(kMin));
 
  171    if (Find(kMax)) 
object.SetMaximum(GetF(kMax));
 
  173    fMarker.Apply(
object);
 
  176    auto xax = 
object.GetXaxis();
 
  177    if (xax) fXAxis.Apply(*xax);
 
  178    auto yax = 
object.GetYaxis();
 
  179    if (yax) fYAxis.Apply(*yax);
 
  182  void HistoStyle::ImportFromXML(XMLNode* node) {
 
  183    if (
auto atr = node->GetAttrib(
"Title")) {
 
  184      TString x = atr->GetValue();
 
  187    if (
auto atr = node->GetAttrib(
"Min")) {
 
  188      float x = atr->GetValue().Atof();
 
  191    if (
auto atr = node->GetAttrib(
"Max")) {
 
  192      float x = atr->GetValue().Atof();
 
  195    if (
auto xAxis = node->GetChild(
"XAxis")) { fXAxis.ImportFromXML(xAxis); }
 
  196    if (
auto yAxis = node->GetChild(
"YAxis")) { fYAxis.ImportFromXML(yAxis); }
 
  197    if (
auto zAxis = node->GetChild(
"ZAxis")) { fZAxis.ImportFromXML(zAxis); }
 
  198    if (
auto xAxis = node->GetChild(
"Fill")) { fFill.ImportFromXML(xAxis); }
 
  199    if (
auto xAxis = node->GetChild(
"Marker")) { fMarker.ImportFromXML(xAxis); }
 
  200    if (
auto line = node->GetChild(
"Line")) { fLine.ImportFromXML(line); }
 
void SetAxis(Double_t titleSize, Double_t titleOffset, Double_t labelSize, Double_t labelOffset, Char_t x='x')
 
static HistoStyle GetStyle(TString style)
 
void SetLineProperties(Color_t c, Style_t style, Double_t widgth)
 
void SetMarkerProperties(Color_t c, Int_t marker, Size_t size)
 
void CenterTitle(Bool_t center=kTRUE, Char_t='x')
 
void SetMax(Double_t val)
 
void SetMinMax(Double_t minVal, Double_t maxVal)
 
void SetRangeUser(Double_t min, Double_t max, Char_t ax)
 
void SetAntiColor(Bool_t safe=kFALSE)
 
void SetMin(Double_t val)
 
void SetTitles(TString histo, TString xAxis="", TString yAxis="", TString zAxis="")
 
Bool_t Find(Int_t bit) const