<commit_before>// @(#)root/base:$Id$
// Author: <NAME>   12/12/94

/*************************************************************************
 * Copyright (C) 1995-2000, <NAME> and <NAME>.               *
 * All rights reserved.                                                  *
 *                                                                       *
 * For the licensing terms see $ROOTSYS/LICENSE.                         *
 * For the list of contributors see $ROOTSYS/README/CREDITS.             *
 *************************************************************************/

#include <string.h>
#include <stdio.h>
#include <ctype.h>
#include <cmath>

#include "Riostream.h"
#include "TApplication.h"
#include "TColor.h"
#include "TROOT.h"
#include "TStyle.h"
#include "TSystem.h"
#include "TVirtualPad.h"
#include "TVirtualMutex.h"

TStyle  *gStyle;
const UInt_t kTakeStyle = BIT(17);

ClassImp(TStyle)


//______________________________________________________________________________
//
// TStyle objects may be created to define special styles.
// By default ROOT creates a default style that can be accessed via
// the gStyle pointer.
//
// This class includes functions to set some of the following object attributes.
//   - Canvas
//   - Pad
//   - Histogram axis
//   - Lines
//   - Fill areas
//   - Text
//   - Markers
//   - Functions
//   - Histogram Statistics and Titles


//______________________________________________________________________________
TStyle::TStyle() :TNamed()
{
   // Default constructor.

   Reset();
}


//______________________________________________________________________________
TStyle::TStyle(const char *name, const char *title)
{
   // Create a new TStyle.
   // The following names are reserved to create special styles
   //   -Default: the default style set in TStyle::Reset
   //   -Plain: a black&white oriented style
   //   -Bold:
   //   -Video;
   //   -Pub:
   //     (see the definition of these styles below).
   //
   // Note a side-effect of calling gStyle->SetFillColor(0). This is nearly
   // equivalent of selecting the "Plain" style.
   //
   // Many graphics attributes may be set via the TStyle, see in particular
   //  - TStyle::SetNdivisions
   //  - TStyle::SetAxisColor
   //  - TStyle::SetHeaderPS
   //  - TStyle::SetTitlePS
   //  - TStyle::SetLabelColor
   //  - TStyle::SetLabelFont
   //  - TStyle::SetLabelOffset
   //  - TStyle::SetLabelSize
   //  - TStyle::SetOptDate
   //  - TStyle::SetLineStyleString
   //  - TStyle::SetOptFit
   //  - TStyle::SetOptStat
   //  - TStyle::SetPaperSize
   //  - TStyle::SetTickLength
   //  - TStyle::SetTitleOffset
   //  - TStyle::SetTitleSize
   //  - TStyle::SetPalette
   //  - TStyle::SetTimeOffset
   //  - TStyle::SetStripDecimals
   //
   //  The current style is pointed by gStyle.
   //  When calling myStyle->cd(), gStyle is set to myStyle.
   //  One can also use gROOT to change the current style, e.g.
   //    gROOT->SetStyle("Plain") will change the current style gStyle to the
   //    "Plain" style
   //  See also TROOT::ForceStyle and TROOT::UseCurrentStyle

   TString style_name = name;
   style_name.ToLower();

   SetNameTitle(style_name, title);

   // If another style was already created with the same name, it is overwrite.
   delete gROOT->GetStyle(style_name);

   Reset();

   {
      R__LOCKGUARD2(gROOTMutex);
      gROOT->GetListOfStyles()->Add(this);
   }

   if (strcmp(style_name,"clean") == 0) {
      // Clean style
      SetFrameBorderMode(0);
      SetFrameFillColor(0);
      SetCanvasBorderMode(0);
      SetCanvasColor(0);
      SetPadBorderMode(0);
      SetPadColor(0);
      SetStatColor(0);
      SetTitleFont(42,"");
      SetLabelFont(42,"x");
      SetTitleFont(42,"x");
      SetLabelFont(42,"y");
      SetTitleFont(42,"y");
      SetLabelFont(42,"z");
      SetTitleFont(42,"z");
      SetStatFont(42);
      SetLabelSize(0.035,"x");
      SetTitleSize(0.035,"x");
      SetLabelSize(0.035,"y");
      SetTitleSize(0.035,"y");
      SetLabelSize(0.035,"z");
      SetTitleSize(0.035,"z");
      SetTitleSize(0.050,"");
      SetTitleAlign(23);
      SetTitleX(0.5);
      SetTitleBorderSize(0);
      SetTitleFillColor(0);
      SetStatBorderSize(1);
      SetOptStat(1110);
      SetOptFit(111);
      SetHistFillColor(38);
      SetHistLineColor(kBlue+2);
      SetLegendBorderSize(1);
      SetLegendFillColor(0);
      SetLegendFont(42);
      SetFuncWidth(2);
      SetFuncColor(2);
   }
   if (strcmp(style_name,"plain") == 0) {
      // May be a standard style to be initialized
      SetFrameBorderMode(0);
      SetFrameFillColor(0);
      SetCanvasBorderMode(0);
      SetPadBorderMode(0);
      SetPadColor(0);
      SetCanvasColor(0);
      SetTitleFillColor(0);
      SetTitleBorderSize(1);
      SetStatColor(0);
      SetStatBorderSize(1);
      SetLegendBorderSize(1);
      return;
   }
   if (strcmp(style_name,"bold") == 0) {
      // Authors: <NAME> and <NAME>, LBNL, Oct. 2000
      SetPalette(1,0);
      SetCanvasColor(10);
      SetCanvasBorderMode(0);
      SetFrameLineWidth(3);
      SetFrameFillColor(10);
      SetPadColor(10);
      SetPadTickX(1);
      SetPadTickY(1);
      SetPadBottomMargin(0.15);
      SetPadLeftMargin(0.15);
      SetHistLineWidth(3);
      SetHistLineColor(kRed);
      SetFuncWidth(3);
      SetFuncColor(kGreen);
      SetLineWidth(3);
      SetLabelSize(0.05,"xyz");
      SetLabelOffset(0.01,"y");
      SetLabelColor(kBlue,"xy");
      SetTitleSize(0.06,"xyz");
      SetTitleOffset(1.3,"Y");
      SetTitleFillColor(10);
      SetTitleTextColor(kBlue);
      SetStatColor(10);
      return;
   }
   if (strcmp(style_name,"video") == 0) {
      // Author: <NAME>, LBNL, Oct. 1999
      SetPalette(1,0);
      SetCanvasColor(10);
      SetCanvasBorderMode(0);
      SetFrameLineWidth(3);
      SetFrameFillColor(10);
      SetPadColor(10);
      SetPadTickX(1);
      SetPadTickY(1);
      SetPadBottomMargin(0.2);
      SetPadLeftMargin(0.2);
      SetHistLineWidth(8);
      SetHistLineColor(kRed);
      SetLabelSize(0.06,"xyz");
      SetLabelColor(kBlue,"xyz");
      SetTitleSize(0.08,"xyz");
      SetTitleFillColor(10);
      SetTitleTextColor(kBlue);
      SetStatColor(10);
      SetFuncWidth(8);
      SetFuncColor(kGreen);
      SetLineWidth(3);
      return;
   }
   if (strcmp(style_name,"pub") == 0) {
      // Authors: <NAME> and <NAME>, LBNL, Oct. 2000
      SetOptTitle(0);
      SetOptStat(0);
      SetPalette(8,0);
      SetCanvasColor(10);
      SetCanvasBorderMode(0);
      SetFrameLineWidth(3);
      SetFrameFillColor(10);
      SetPadColor(10);
      SetPadTickX(1);
      SetPadTickY(1);
      SetPadBottomMargin(0.15);
      SetPadLeftMargin(0.15);
      SetHistLineWidth(3);
      SetHistLineColor(kRed);
      SetFuncWidth(3);
      SetFuncColor(kGreen);
      SetLineWidth(3);
      SetLabelSize(0.05,"xyz");
      SetLabelOffset(0.01,"y");
      SetLabelColor(kBlack,"xyz");
      SetTitleSize(0.06,"xyz");
      SetTitleOffset(1.3,"y");
      SetTitleFillColor(10);
      SetTitleTextColor(kBlue);
      return;
   }

}


//______________________________________________________________________________
TStyle::~TStyle()
{
   // Destructor.

   R__LOCKGUARD2(gROOTMutex);
   gROOT->GetListOfStyles()->Remove(this);
   if (gStyle == this) gStyle = (TStyle*)gROOT->GetListOfStyles()->Last();
}


//______________________________________________________________________________
TStyle::TStyle(const TStyle &style) : TNamed(style), TAttLine(style), TAttFill(style), TAttMarker(style), TAttText(style)
{
   // Copy constructor.

   ((TStyle&)style).Copy(*this);
}


//______________________________________________________________________________
void TStyle::Browse(TBrowser *)
{
   // Browse the style object.

   cd();
}


//______________________________________________________________________________
void TStyle::BuildStyles()
{
   // Create some standard styles.

   TColor *col = new TColor(); // force the initialisation of fgPalette
   new TStyle("Plain",  "Plain Style (no colors/fill areas)");
   new TStyle("Bold",   "Bold Style");;
   new TStyle("Video",  "Style for video presentation histograms");
   new TStyle("Pub",    "Style for Publications");
   new TStyle("Default","Default Style");
   new TStyle("Clean",  "Clean Style");
   delete col;
}


//______________________________________________________________________________
void TStyle::cd()
{
   // Change current style.

   gStyle = this;
}


//______________________________________________________________________________
void TStyle::Copy(TObject &obj) const
{
   // Copy this style.

   TAttLine::Copy(((TStyle&)obj));
   TAttFill::Copy(((TStyle&)obj));
   TAttMarker::Copy(((TStyle&)obj));
   TAttText::Copy(((TStyle&)obj));
   fXaxis.Copy(((TStyle&)obj).fXaxis);
   fYaxis.Copy(((TStyle&)obj).fYaxis);
   fZaxis.Copy(((TStyle&)obj).fZaxis);
   fAttDate.Copy(((TStyle&)obj).fAttDate);
   ((TStyle&)obj).fIsReading      = fIsReading;
   ((TStyle&)obj).fScreenFactor   = fScreenFactor;
   ((TStyle&)obj).fCanvasPreferGL = fCanvasPreferGL;
   ((TStyle&)obj).fCanvasColor    = fCanvasColor;
   ((TStyle&)obj).fCanvasBorderSize= fCanvasBorderSize;
   ((TStyle&)obj).fCanvasBorderMode= fCanvasBorderMode;
   ((TStyle&)obj).fCanvasDefH     = fCanvasDefH;
   ((TStyle&)obj).fCanvasDefW     = fCanvasDefW;
   ((TStyle&)obj).fCanvasDefX     = fCanvasDefX;
   ((TStyle&)obj).fCanvasDefY     = fCanvasDefY;
   ((TStyle&)obj).fPadColor       = fPadColor;
   ((TStyle&)obj).fPadBorderSize  = fPadBorderSize;
   ((TStyle&)obj).fPadBorderMode  = fPadBorderMode;
   ((TStyle&)obj).fPadBottomMargin= fPadBottomMargin;
   ((TStyle&)obj).fPadTopMargin   = fPadTopMargin;
   ((TStyle&)obj).fPadLeftMargin  = fPadLeftMargin;
   ((TStyle&)obj).fPadRightMargin = fPadRightMargin;
   ((TStyle&)obj).fPadGridX       = fPadGridX;
   ((TStyle&)obj).fPadGridY       = fPadGridY;
   ((TStyle&)obj).fPadTickX       = fPadTickX;
   ((TStyle&)obj).fPadTickY       = fPadTickY;
   ((TStyle&)obj).fPaperSizeX     = fPaperSizeX;
   ((TStyle&)obj).fPaperSizeY     = fPaperSizeY;
   ((TStyle&)obj).fFuncColor      = fFuncColor;
   ((TStyle&)obj).fFuncStyle      = fFuncStyle;
   ((TStyle&)obj).fFuncWidth      = fFuncWidth;
   ((TStyle&)obj).fGridColor      = fGridColor;
   ((TStyle&)obj).fGridStyle      = fGridStyle;
   ((TStyle&)obj).fGridWidth      = fGridWidth;
   ((TStyle&)obj).fHatchesSpacing = fHatchesSpacing;
   ((TStyle&)obj).fHatchesLineWidth= fHatchesLineWidth;
   ((TStyle&)obj).fFrameFillColor = fFrameFillColor;
   ((TStyle&)obj).fFrameFillStyle = fFrameFillStyle;
   ((TStyle&)obj).fFrameLineColor = fFrameLineColor;
   ((TStyle&)obj).fFrameLineStyle = fFrameLineStyle;
   ((TStyle&)obj).fFrameLineWidth = fFrameLineWidth;
   ((TStyle&)obj).fFrameBorderSize= fFrameBorderSize;
   ((TStyle&)obj).fFrameBorderMode= fFrameBorderMode;
   ((TStyle&)obj).fHistFillColor  = fHistFillColor;
   ((TStyle&)obj).fHistFillStyle  = fHistFillStyle;
   ((TStyle&)obj).fHistLineColor  = fHistLineColor;
   ((TStyle&)obj).fHistLineStyle  = fHistLineStyle;
   ((TStyle&)obj).fHistLineWidth  = fHistLineWidth;
   ((TStyle&)obj).fHistMinimumZero= fHistMinimumZero;
   ((TStyle&)obj).fHistTopMargin  = fHistTopMargin;
   ((TStyle&)obj).fBarWidth       = fBarWidth;
   ((TStyle&)obj).fBarOffset      = fBarOffset;
   ((TStyle&)obj).fDrawBorder     = fDrawBorder;
   ((TStyle&)obj).fOptLogx        = fOptLogx;
   ((TStyle&)obj).fOptLogy        = fOptLogy;
   ((TStyle&)obj).fOptLogz        = fOptLogz;
   ((TStyle&)obj).fOptDate        = fOptDate;
   ((TStyle&)obj).fOptFit         = fOptFit;
   ((TStyle&)obj).fOptStat        = fOptStat;
   ((TStyle&)obj).fOptTitle       = fOptTitle;
   ((TStyle&)obj).fEndErrorSize   = fEndErrorSize;
   ((TStyle&)obj).fErrorX         = fErrorX;
   ((TStyle&)obj).fStatColor      = fStatColor;
   ((TStyle&)obj).fStatTextColor  = fStatTextColor;
   ((TStyle&)obj).fStatBorderSize = fStatBorderSize;
   ((TStyle&)obj).fStatFont       = fStatFont;
   ((TStyle&)obj).fStatFontSize   = fStatFontSize;
   ((TStyle&)obj).fStatStyle      = fStatStyle;
   ((TStyle&)obj).fStatFormat     = fStatFormat;
   ((TStyle&)obj).fStatW          = fStatW;
   ((TStyle&)obj).fStatH          = fStatH ;
   ((TStyle&)obj).fStatX          = fStatX;
   ((TStyle&)obj).fStatY          = fStatY;
   ((TStyle&)obj).fTitleAlign     = fTitleAlign;
   ((TStyle&)obj).fTitleColor     = fTitleColor;
   ((TStyle&)obj).fTitleTextColor = fTitleTextColor;
   ((TStyle&)obj).fTitleFont      = fTitleFont;
   ((TStyle&)obj).fTitleFontSize  = fTitleFontSize;
   ((TStyle&)obj).fTitleStyle     = fTitleStyle;
   ((TStyle&)obj).fTitleBorderSize= fTitleBorderSize;
   ((TStyle&)obj).fTitleW         = fTitleW;
   ((TStyle&)obj).fTitleH         = fTitleH;
   ((TStyle&)obj).fTitleX         = fTitleX;
   ((TStyle&)obj).fTitleY         = fTitleY;
   ((TStyle&)obj).fDateX          = fDateX;
   ((TStyle&)obj).fDateY          = fDateY;
   ((TStyle&)obj).fFitFormat      = fFitFormat;
   ((TStyle&)obj).fPaintTextFormat= fPaintTextFormat;
   ((TStyle&)obj).fShowEventStatus= fShowEventStatus;
   ((TStyle&)obj).fShowEditor     = fShowEditor;
   ((TStyle&)obj).fShowToolBar    = fShowToolBar;
   ((TStyle&)obj).fLegoInnerR     = fLegoInnerR;
   ((TStyle&)obj).fStripDecimals  = fStripDecimals;
   ((TStyle&)obj).fNumberContours = fNumberContours;
   ((TStyle&)obj).fLegendBorderSize = fLegendBorderSize;
   Int_t i;
   for (i=0;i<30;i++) {
      ((TStyle&)obj).fLineStyle[i]     = fLineStyle[i];
   }
   ((TStyle&)obj).fHeaderPS       = fHeaderPS;
   ((TStyle&)obj).fTitlePS        = fTitlePS;
   ((TStyle&)obj).fLineScalePS    = fLineScalePS;
   ((TStyle&)obj).fColorModelPS   = fColorModelPS;
   ((TStyle&)obj).fTimeOffset     = fTimeOffset;
}


//______________________________________________________________________________
Int_t TStyle::DistancetoPrimitive(Int_t /*px*/, Int_t /*py*/)
{
   // Function used by the TStyle manager when drawing a canvas showing the
   // current style.

   gPad->SetSelected(this);
   return 0;
}


//______________________________________________________________________________
void TStyle::Reset(Option_t *opt)
{
   // Reset.

   fIsReading = kTRUE;
   TAttLine::ResetAttLine();
   TAttFill::ResetAttFill();
   TAttText::ResetAttText();
   TAttMarker::ResetAttMarker();
   SetFillStyle(1001);
   SetFillColor(19);
   fXaxis.ResetAttAxis("X");
   fYaxis.ResetAttAxis("Y");
   fZaxis.ResetAttAxis("Z");
   fCanvasPreferGL = kFALSE;
   fCanvasColor    = 19;
   fCanvasBorderSize= 2;
   fCanvasBorderMode= 1;
   fCanvasDefH     = 500;
   fCanvasDefW     = 700;
   fCanvasDefX     = 10;
   fCanvasDefY     = 10;
   fPadColor       = fCanvasColor;
   fPadBorderSize  = fCanvasBorderSize;
   fPadBorderMode  = fCanvasBorderMode;
   fPadBottomMargin= 0.1;
   fPadTopMargin   = 0.1;
   fPadLeftMargin  = 0.1;
   fPadRightMargin = 0.1;
   fPadGridX       = kFALSE;
   fPadGridY       = kFALSE;
   fPadTickX       = 0;
   fPadTickY       = 0;
   fFuncColor      = 1;
   fFuncStyle      = 1;
   fFuncWidth      = 3;
   fGridColor      = 0;
   fGridStyle      = 3;
   fGridWidth      = 1;
   fHatchesSpacing = 1;
   fHatchesLineWidth = 1;
   fHistLineColor  = 1;
   fHistFillColor  = 0;
   fHistFillStyle  = 1001;
   fHistLineStyle  = 1;
   fHistLineWidth  = 1;
   fHistMinimumZero= kFALSE;
   fHistTopMargin  = 0.05;
   fFrameLineColor = 1;
   fFrameFillColor = 0;
   fFrameFillStyle = 1001;
   fFrameLineStyle = 1;
   fFrameLineWidth = 1;
   fFrameBorderSize= 1;
   fFrameBorderMode= 1;
   fBarWidth       = 1;
   fBarOffset      = 0;
   fDrawBorder     = 0;
   fOptLogx        = 0;
   fOptLogy        = 0;
   fOptLogz        = 0;
   fOptDate        = 0;
   fOptFile        = 0;
   fOptFit         = 0;
   fOptStat        = 1;
   fOptTitle       = 1;
   fEndErrorSize   = 2;
   fErrorX         = 0.5;
   fScreenFactor   = 1;
   fStatColor      = fCanvasColor;
   fStatTextColor  = 1;
   fStatBorderSize = 2;
   fStatFont       = 62;
   fStatFontSize   = 0;
   fStatStyle      = 1001;
   fStatW          = 0.20;
   fStatH          = 0.16;
   fStatX          = 0.98;
   fStatY          = 0.995;
   SetStatFormat();
   SetFitFormat();
   SetPaintTextFormat();
   fTitleAlign     = 13;
   fTitleColor     = fCanvasColor;
   fTitleTextColor = 1;
   fTitleFont      = 62;
   fTitleFontSize  = 0;
   fTitleStyle     = 1001;
   fTitleBorderSize= 2;
   fTitleW         = 0;
   fTitleH         = 0;
   fTitleX         = 0.01;
   fTitleY         = 0.995;
   fShowEventStatus= 0;
   fShowEditor     = 0;
   fShowToolBar    = 0;
   fLegoInnerR     = 0.5;
   fHeaderPS       = "";
   fTitlePS        = "";
   fStripDecimals  = kTRUE;
   fNumberContours = 20;
   fLegendBorderSize= 4;

   SetDateX();
   SetDateY();
   fAttDate.SetTextSize(0.025);
   fAttDate.SetTextAlign(11);
   SetLineScalePS();
   SetColorModelPS();
   SetLineStyleString(1," ");
   SetLineStyleString(2,"12 12");
   SetLineStyleString(3,"4 8");
   SetLineStyleString(4,"12 16 4 16");
   SetLineStyleString(5,"20 12 4 12");
   SetLineStyleString(6,"20 12 4 12 4 12 4 12");
   SetLineStyleString(7,"20 20");
   SetLineStyleString(8,"20 12 4 12 4 12");
   SetLineStyleString(9,"80 20");
   SetLineStyleString(10,"80 40 4 40");
   for (Int_t i=11;i<30;i++) SetLineStyleString(i," ");

   SetPaperSize();

   SetPalette();

   fTimeOffset = 788918400; // UTC time at 01/01/95

   TString style_name = opt;
   style_name.ToLower();

   if (strcmp(style_name,"clean") == 0) {
      // Clean style
      SetFrameBorderMode(0);
      SetFrameFillColor(0);
      SetCanvasBorderMode(0);
      SetCanvasColor(0);
      SetPadBorderMode(0);
      SetPadColor(0);
      SetStatColor(0);
      SetTitleFont(42,"");
      SetLabelFont(42,"x");
      SetTitleFont(42,"x");
      SetLabelFont(42,"y");
      SetTitleFont(42,"y");
      SetLabelFont(42,"z");
      SetTitleFont(42,"z");
      SetStatFont(42);
      SetLabelSize(0.035,"x");
      SetTitleSize(0.035,"x");
      SetLabelSize(0.035,"y");
      SetTitleSize(0.035,"y");
      SetLabelSize(0.035,"z");
      SetTitleSize(0.035,"z");
      SetTitleSize(0.050,"");
      SetTitleAlign(23);
      SetTitleX(0.5);
      SetTitleBorderSize(0);
      SetTitleFillColor(0);
      SetStatBorderSize(1);
      SetOptStat(1110);
      SetOptFit(111);
      SetHistFillColor(38);
      SetHistLineColor(kBlue+2);
      SetLegendBorderSize(1);
      SetLegendFillColor(0);
      SetLegendFont(42);
      SetFuncWidth(2);
      SetFuncColor(2);
   }
   if (strcmp(style_name,"plain") == 0) {
      SetFrameBorderMode(0);
      SetCanvasBorderMode(0);
      SetPadBorderMode(0);
      SetPadColor(0);
      SetCanvasColor(0);
      SetTitleFillColor(0);
      SetTitleBorderSize(1);
      SetStatColor(0);
      SetStatBorderSize(1);
      SetLegendBorderSize(1);
      return;
   }
   if (strcmp(style_name,"bold") == 0) {<commit_msg>- Adjust the Y stats position in the Clean style.<commit_after>// @(#)root/base:$Id$
// Author: <NAME>   12/12/94

/*************************************************************************
 * Copyright (C) 1995-2000, <NAME> and <NAME>.               *
 * All rights reserved.                                                  *
 *                                                                       *
 * For the licensing terms see $ROOTSYS/LICENSE.                         *
 * For the list of contributors see $ROOTSYS/README/CREDITS.             *
 *************************************************************************/

#include <string.h>
#include <stdio.h>
#include <ctype.h>
#include <cmath>

#include "Riostream.h"
#include "TApplication.h"
#include "TColor.h"
#include "TROOT.h"
#include "TStyle.h"
#include "TSystem.h"
#include "TVirtualPad.h"
#include "TVirtualMutex.h"

TStyle  *gStyle;
const UInt_t kTakeStyle = BIT(17);

ClassImp(TStyle)


//______________________________________________________________________________
//
// TStyle objects may be created to define special styles.
// By default ROOT creates a default style that can be accessed via
// the gStyle pointer.
//
// This class includes functions to set some of the following object attributes.
//   - Canvas
//   - Pad
//   - Histogram axis
//   - Lines
//   - Fill areas
//   - Text
//   - Markers
//   - Functions
//   - Histogram Statistics and Titles


//______________________________________________________________________________
TStyle::TStyle() :TNamed()
{
   // Default constructor.

   Reset();
}


//______________________________________________________________________________
TStyle::TStyle(const char *name, const char *title)
{
   // Create a new TStyle.
   // The following names are reserved to create special styles
   //   -Default: the default style set in TStyle::Reset
   //   -Plain: a black&white oriented style
   //   -Bold:
   //   -Video;
   //   -Pub:
   //     (see the definition of these styles below).
   //
   // Note a side-effect of calling gStyle->SetFillColor(0). This is nearly
   // equivalent of selecting the "Plain" style.
   //
   // Many graphics attributes may be set via the TStyle, see in particular
   //  - TStyle::SetNdivisions
   //  - TStyle::SetAxisColor
   //  - TStyle::SetHeaderPS
   //  - TStyle::SetTitlePS
   //  - TStyle::SetLabelColor
   //  - TStyle::SetLabelFont
   //  - TStyle::SetLabelOffset
   //  - TStyle::SetLabelSize
   //  - TStyle::SetOptDate
   //  - TStyle::SetLineStyleString
   //  - TStyle::SetOptFit
   //  - TStyle::SetOptStat
   //  - TStyle::SetPaperSize
   //  - TStyle::SetTickLength
   //  - TStyle::SetTitleOffset
   //  - TStyle::SetTitleSize
   //  - TStyle::SetPalette
   //  - TStyle::SetTimeOffset
   //  - TStyle::SetStripDecimals
   //
   //  The current style is pointed by gStyle.
   //  When calling myStyle->cd(), gStyle is set to myStyle.
   //  One can also use gROOT to change the current style, e.g.
   //    gROOT->SetStyle("Plain") will change the current style gStyle to the
   //    "Plain" style
   //  See also TROOT::ForceStyle and TROOT::UseCurrentStyle

   TString style_name = name;
   style_name.ToLower();

   SetNameTitle(style_name, title);

   // If another style was already created with the same name, it is overwrite.
   delete gROOT->GetStyle(style_name);

   Reset();

   {
      R__LOCKGUARD2(gROOTMutex);
      gROOT->GetListOfStyles()->Add(this);
   }

   if (strcmp(style_name,"clean") == 0) {
      // Clean style
      SetFrameBorderMode(0);
      SetFrameFillColor(0);
      SetCanvasBorderMode(0);
      SetCanvasColor(0);
      SetPadBorderMode(0);
      SetPadColor(0);
      SetStatColor(0);
      SetTitleFont(42,"");
      SetLabelFont(42,"x");
      SetTitleFont(42,"x");
      SetLabelFont(42,"y");
      SetTitleFont(42,"y");
      SetLabelFont(42,"z");
      SetTitleFont(42,"z");
      SetStatFont(42);
      SetLabelSize(0.035,"x");
      SetTitleSize(0.035,"x");
      SetLabelSize(0.035,"y");
      SetTitleSize(0.035,"y");
      SetLabelSize(0.035,"z");
      SetTitleSize(0.035,"z");
      SetTitleSize(0.050,"");
      SetTitleAlign(23);
      SetTitleX(0.5);
      SetTitleBorderSize(0);
      SetTitleFillColor(0);
      SetStatBorderSize(1);
      SetOptStat(1110);
      SetOptFit(111);
      SetStatY(0.935);
      SetHistFillColor(38);
      SetHistLineColor(kBlue+2);
      SetLegendBorderSize(1);
      SetLegendFillColor(0);
      SetLegendFont(42);
      SetFuncWidth(2);
      SetFuncColor(2);
   }
   if (strcmp(style_name,"plain") == 0) {
      // May be a standard style to be initialized
      SetFrameBorderMode(0);
      SetFrameFillColor(0);
      SetCanvasBorderMode(0);
      SetPadBorderMode(0);
      SetPadColor(0);
      SetCanvasColor(0);
      SetTitleFillColor(0);
      SetTitleBorderSize(1);
      SetStatColor(0);
      SetStatBorderSize(1);
      SetLegendBorderSize(1);
      return;
   }
   if (strcmp(style_name,"bold") == 0) {
      // Authors: <NAME> and <NAME>, LBNL, Oct. 2000
      SetPalette(1,0);
      SetCanvasColor(10);
      SetCanvasBorderMode(0);
      SetFrameLineWidth(3);
      SetFrameFillColor(10);
      SetPadColor(10);
      SetPadTickX(1);
      SetPadTickY(1);
      SetPadBottomMargin(0.15);
      SetPadLeftMargin(0.15);
      SetHistLineWidth(3);
      SetHistLineColor(kRed);
      SetFuncWidth(3);
      SetFuncColor(kGreen);
      SetLineWidth(3);
      SetLabelSize(0.05,"xyz");
      SetLabelOffset(0.01,"y");
      SetLabelColor(kBlue,"xy");
      SetTitleSize(0.06,"xyz");
      SetTitleOffset(1.3,"Y");
      SetTitleFillColor(10);
      SetTitleTextColor(kBlue);
      SetStatColor(10);
      return;
   }
   if (strcmp(style_name,"video") == 0) {
      // Author: <NAME>, LBNL, Oct. 1999
      SetPalette(1,0);
      SetCanvasColor(10);
      SetCanvasBorderMode(0);
      SetFrameLineWidth(3);
      SetFrameFillColor(10);
      SetPadColor(10);
      SetPadTickX(1);
      SetPadTickY(1);
      SetPadBottomMargin(0.2);
      SetPadLeftMargin(0.2);
      SetHistLineWidth(8);
      SetHistLineColor(kRed);
      SetLabelSize(0.06,"xyz");
      SetLabelColor(kBlue,"xyz");
      SetTitleSize(0.08,"xyz");
      SetTitleFillColor(10);
      SetTitleTextColor(kBlue);
      SetStatColor(10);
      SetFuncWidth(8);
      SetFuncColor(kGreen);
      SetLineWidth(3);
      return;
   }
   if (strcmp(style_name,"pub") == 0) {
      // Authors: <NAME> and <NAME>, LBNL, Oct. 2000
      SetOptTitle(0);
      SetOptStat(0);
      SetPalette(8,0);
      SetCanvasColor(10);
      SetCanvasBorderMode(0);
      SetFrameLineWidth(3);
      SetFrameFillColor(10);
      SetPadColor(10);
      SetPadTickX(1);
      SetPadTickY(1);
      SetPadBottomMargin(0.15);
      SetPadLeftMargin(0.15);
      SetHistLineWidth(3);
      SetHistLineColor(kRed);
      SetFuncWidth(3);
      SetFuncColor(kGreen);
      SetLineWidth(3);
      SetLabelSize(0.05,"xyz");
      SetLabelOffset(0.01,"y");
      SetLabelColor(kBlack,"xyz");
      SetTitleSize(0.06,"xyz");
      SetTitleOffset(1.3,"y");
      SetTitleFillColor(10);
      SetTitleTextColor(kBlue);
      return;
   }

}


//______________________________________________________________________________
TStyle::~TStyle()
{
   // Destructor.

   R__LOCKGUARD2(gROOTMutex);
   gROOT->GetListOfStyles()->Remove(this);
   if (gStyle == this) gStyle = (TStyle*)gROOT->GetListOfStyles()->Last();
}


//______________________________________________________________________________
TStyle::TStyle(const TStyle &style) : TNamed(style), TAttLine(style), TAttFill(style), TAttMarker(style), TAttText(style)
{
   // Copy constructor.

   ((TStyle&)style).Copy(*this);
}


//______________________________________________________________________________
void TStyle::Browse(TBrowser *)
{
   // Browse the style object.

   cd();
}


//______________________________________________________________________________
void TStyle::BuildStyles()
{
   // Create some standard styles.

   TColor *col = new TColor(); // force the initialisation of fgPalette
   new TStyle("Plain",  "Plain Style (no colors/fill areas)");
   new TStyle("Bold",   "Bold Style");;
   new TStyle("Video",  "Style for video presentation histograms");
   new TStyle("Pub",    "Style for Publications");
   new TStyle("Default","Default Style");
   new TStyle("Clean",  "Clean Style");
   delete col;
}


//______________________________________________________________________________
void TStyle::cd()
{
   // Change current style.

   gStyle = this;
}


//______________________________________________________________________________
void TStyle::Copy(TObject &obj) const
{
   // Copy this style.

   TAttLine::Copy(((TStyle&)obj));
   TAttFill::Copy(((TStyle&)obj));
   TAttMarker::Copy(((TStyle&)obj));
   TAttText::Copy(((TStyle&)obj));
   fXaxis.Copy(((TStyle&)obj).fXaxis);
   fYaxis.Copy(((TStyle&)obj).fYaxis);
   fZaxis.Copy(((TStyle&)obj).fZaxis);
   fAttDate.Copy(((TStyle&)obj).fAttDate);
   ((TStyle&)obj).fIsReading      = fIsReading;
   ((TStyle&)obj).fScreenFactor   = fScreenFactor;
   ((TStyle&)obj).fCanvasPreferGL = fCanvasPreferGL;
   ((TStyle&)obj).fCanvasColor    = fCanvasColor;
   ((TStyle&)obj).fCanvasBorderSize= fCanvasBorderSize;
   ((TStyle&)obj).fCanvasBorderMode= fCanvasBorderMode;
   ((TStyle&)obj).fCanvasDefH     = fCanvasDefH;
   ((TStyle&)obj).fCanvasDefW     = fCanvasDefW;
   ((TStyle&)obj).fCanvasDefX     = fCanvasDefX;
   ((TStyle&)obj).fCanvasDefY     = fCanvasDefY;
   ((TStyle&)obj).fPadColor       = fPadColor;
   ((TStyle&)obj).fPadBorderSize  = fPadBorderSize;
   ((TStyle&)obj).fPadBorderMode  = fPadBorderMode;
   ((TStyle&)obj).fPadBottomMargin= fPadBottomMargin;
   ((TStyle&)obj).fPadTopMargin   = fPadTopMargin;
   ((TStyle&)obj).fPadLeftMargin  = fPadLeftMargin;
   ((TStyle&)obj).fPadRightMargin = fPadRightMargin;
   ((TStyle&)obj).fPadGridX       = fPadGridX;
   ((TStyle&)obj).fPadGridY       = fPadGridY;
   ((TStyle&)obj).fPadTickX       = fPadTickX;
   ((TStyle&)obj).fPadTickY       = fPadTickY;
   ((TStyle&)obj).fPaperSizeX     = fPaperSizeX;
   ((TStyle&)obj).fPaperSizeY     = fPaperSizeY;
   ((TStyle&)obj).fFuncColor      = fFuncColor;
   ((TStyle&)obj).fFuncStyle      = fFuncStyle;
   ((TStyle&)obj).fFuncWidth      = fFuncWidth;
   ((TStyle&)obj).fGridColor      = fGridColor;
   ((TStyle&)obj).fGridStyle      = fGridStyle;
   ((TStyle&)obj).fGridWidth      = fGridWidth;
   ((TStyle&)obj).fHatchesSpacing = fHatchesSpacing;
   ((TStyle&)obj).fHatchesLineWidth= fHatchesLineWidth;
   ((TStyle&)obj).fFrameFillColor = fFrameFillColor;
   ((TStyle&)obj).fFrameFillStyle = fFrameFillStyle;
   ((TStyle&)obj).fFrameLineColor = fFrameLineColor;
   ((TStyle&)obj).fFrameLineStyle = fFrameLineStyle;
   ((TStyle&)obj).fFrameLineWidth = fFrameLineWidth;
   ((TStyle&)obj).fFrameBorderSize= fFrameBorderSize;
   ((TStyle&)obj).fFrameBorderMode= fFrameBorderMode;
   ((TStyle&)obj).fHistFillColor  = fHistFillColor;
   ((TStyle&)obj).fHistFillStyle  = fHistFillStyle;
   ((TStyle&)obj).fHistLineColor  = fHistLineColor;
   ((TStyle&)obj).fHistLineStyle  = fHistLineStyle;
   ((TStyle&)obj).fHistLineWidth  = fHistLineWidth;
   ((TStyle&)obj).fHistMinimumZero= fHistMinimumZero;
   ((TStyle&)obj).fHistTopMargin  = fHistTopMargin;
   ((TStyle&)obj).fBarWidth       = fBarWidth;
   ((TStyle&)obj).fBarOffset      = fBarOffset;
   ((TStyle&)obj).fDrawBorder     = fDrawBorder;
   ((TStyle&)obj).fOptLogx        = fOptLogx;
   ((TStyle&)obj).fOptLogy        = fOptLogy;
   ((TStyle&)obj).fOptLogz        = fOptLogz;
   ((TStyle&)obj).fOptDate        = fOptDate;
   ((TStyle&)obj).fOptFit         = fOptFit;
   ((TStyle&)obj).fOptStat        = fOptStat;
   ((TStyle&)obj).fOptTitle       = fOptTitle;
   ((TStyle&)obj).fEndErrorSize   = fEndErrorSize;
   ((TStyle&)obj).fErrorX         = fErrorX;
   ((TStyle&)obj).fStatColor      = fStatColor;
   ((TStyle&)obj).fStatTextColor  = fStatTextColor;
   ((TStyle&)obj).fStatBorderSize = fStatBorderSize;
   ((TStyle&)obj).fStatFont       = fStatFont;
   ((TStyle&)obj).fStatFontSize   = fStatFontSize;
   ((TStyle&)obj).fStatStyle      = fStatStyle;
   ((TStyle&)obj).fStatFormat     = fStatFormat;
   ((TStyle&)obj).fStatW          = fStatW;
   ((TStyle&)obj).fStatH          = fStatH ;
   ((TStyle&)obj).fStatX          = fStatX;
   ((TStyle&)obj).fStatY          = fStatY;
   ((TStyle&)obj).fTitleAlign     = fTitleAlign;
   ((TStyle&)obj).fTitleColor     = fTitleColor;
   ((TStyle&)obj).fTitleTextColor = fTitleTextColor;
   ((TStyle&)obj).fTitleFont      = fTitleFont;
   ((TStyle&)obj).fTitleFontSize  = fTitleFontSize;
   ((TStyle&)obj).fTitleStyle     = fTitleStyle;
   ((TStyle&)obj).fTitleBorderSize= fTitleBorderSize;
   ((TStyle&)obj).fTitleW         = fTitleW;
   ((TStyle&)obj).fTitleH         = fTitleH;
   ((TStyle&)obj).fTitleX         = fTitleX;
   ((TStyle&)obj).fTitleY         = fTitleY;
   ((TStyle&)obj).fDateX          = fDateX;
   ((TStyle&)obj).fDateY          = fDateY;
   ((TStyle&)obj).fFitFormat      = fFitFormat;
   ((TStyle&)obj).fPaintTextFormat= fPaintTextFormat;
   ((TStyle&)obj).fShowEventStatus= fShowEventStatus;
   ((TStyle&)obj).fShowEditor     = fShowEditor;
   ((TStyle&)obj).fShowToolBar    = fShowToolBar;
   ((TStyle&)obj).fLegoInnerR     = fLegoInnerR;
   ((TStyle&)obj).fStripDecimals  = fStripDecimals;
   ((TStyle&)obj).fNumberContours = fNumberContours;
   ((TStyle&)obj).fLegendBorderSize = fLegendBorderSize;
   Int_t i;
   for (i=0;i<30;i++) {
      ((TStyle&)obj).fLineStyle[i]     = fLineStyle[i];
   }
   ((TStyle&)obj).fHeaderPS       = fHeaderPS;
   ((TStyle&)obj).fTitlePS        = fTitlePS;
   ((TStyle&)obj).fLineScalePS    = fLineScalePS;
   ((TStyle&)obj).fColorModelPS   = fColorModelPS;
   ((TStyle&)obj).fTimeOffset     = fTimeOffset;
}


//______________________________________________________________________________
Int_t TStyle::DistancetoPrimitive(Int_t /*px*/, Int_t /*py*/)
{
   // Function used by the TStyle manager when drawing a canvas showing the
   // current style.

   gPad->SetSelected(this);
   return 0;
}


//______________________________________________________________________________
void TStyle::Reset(Option_t *opt)
{
   // Reset.

   fIsReading = kTRUE;
   TAttLine::ResetAttLine();
   TAttFill::ResetAttFill();
   TAttText::ResetAttText();
   TAttMarker::ResetAttMarker();
   SetFillStyle(1001);
   SetFillColor(19);
   fXaxis.ResetAttAxis("X");
   fYaxis.ResetAttAxis("Y");
   fZaxis.ResetAttAxis("Z");
   fCanvasPreferGL = kFALSE;
   fCanvasColor    = 19;
   fCanvasBorderSize= 2;
   fCanvasBorderMode= 1;
   fCanvasDefH     = 500;
   fCanvasDefW     = 700;
   fCanvasDefX     = 10;
   fCanvasDefY     = 10;
   fPadColor       = fCanvasColor;
   fPadBorderSize  = fCanvasBorderSize;
   fPadBorderMode  = fCanvasBorderMode;
   fPadBottomMargin= 0.1;
   fPadTopMargin   = 0.1;
   fPadLeftMargin  = 0.1;
   fPadRightMargin = 0.1;
   fPadGridX       = kFALSE;
   fPadGridY       = kFALSE;
   fPadTickX       = 0;
   fPadTickY       = 0;
   fFuncColor      = 1;
   fFuncStyle      = 1;
   fFuncWidth      = 3;
   fGridColor      = 0;
   fGridStyle      = 3;
   fGridWidth      = 1;
   fHatchesSpacing = 1;
   fHatchesLineWidth = 1;
   fHistLineColor  = 1;
   fHistFillColor  = 0;
   fHistFillStyle  = 1001;
   fHistLineStyle  = 1;
   fHistLineWidth  = 1;
   fHistMinimumZero= kFALSE;
   fHistTopMargin  = 0.05;
   fFrameLineColor = 1;
   fFrameFillColor = 0;
   fFrameFillStyle = 1001;
   fFrameLineStyle = 1;
   fFrameLineWidth = 1;
   fFrameBorderSize= 1;
   fFrameBorderMode= 1;
   fBarWidth       = 1;
   fBarOffset      = 0;
   fDrawBorder     = 0;
   fOptLogx        = 0;
   fOptLogy        = 0;
   fOptLogz        = 0;
   fOptDate        = 0;
   fOptFile        = 0;
   fOptFit         = 0;
   fOptStat        = 1;
   fOptTitle       = 1;
   fEndErrorSize   = 2;
   fErrorX         = 0.5;
   fScreenFactor   = 1;
   fStatColor      = fCanvasColor;
   fStatTextColor  = 1;
   fStatBorderSize = 2;
   fStatFont       = 62;
   fStatFontSize   = 0;
   fStatStyle      = 1001;
   fStatW          = 0.20;
   fStatH          = 0.16;
   fStatX          = 0.98;
   fStatY          = 0.995;
   SetStatFormat();
   SetFitFormat();
   SetPaintTextFormat();
   fTitleAlign     = 13;
   fTitleColor     = fCanvasColor;
   fTitleTextColor = 1;
   fTitleFont      = 62;
   fTitleFontSize  = 0;
   fTitleStyle     = 1001;
   fTitleBorderSize= 2;
   fTitleW         = 0;
   fTitleH         = 0;
   fTitleX         = 0.01;
   fTitleY         = 0.995;
   fShowEventStatus= 0;
   fShowEditor     = 0;
   fShowToolBar    = 0;
   fLegoInnerR     = 0.5;
   fHeaderPS       = "";
   fTitlePS        = "";
   fStripDecimals  = kTRUE;
   fNumberContours = 20;
   fLegendBorderSize= 4;

   SetDateX();
   SetDateY();
   fAttDate.SetTextSize(0.025);
   fAttDate.SetTextAlign(11);
   SetLineScalePS();
   SetColorModelPS();
   SetLineStyleString(1," ");
   SetLineStyleString(2,"12 12");
   SetLineStyleString(3,"4 8");
   SetLineStyleString(4,"12 16 4 16");
   SetLineStyleString(5,"20 12 4 12");
   SetLineStyleString(6,"20 12 4 12 4 12 4 12");
   SetLineStyleString(7,"20 20");
   SetLineStyleString(8,"20 12 4 12 4 12");
   SetLineStyleString(9,"80 20");
   SetLineStyleString(10,"80 40 4 40");
   for (Int_t i=11;i<30;i++) SetLineStyleString(i," ");

   SetPaperSize();

   SetPalette();

   fTimeOffset = 788918400; // UTC time at 01/01/95

   TString style_name = opt;
   style_name.ToLower();

   if (strcmp(style_name,"clean") == 0) {
      // Clean style
      SetFrameBorderMode(0);
      SetFrameFillColor(0);
      SetCanvasBorderMode(0);
      SetCanvasColor(0);
      SetPadBorderMode(0);
      SetPadColor(0);
      SetStatColor(0);
      SetTitleFont(42,"");
      SetLabelFont(42,"x");
      SetTitleFont(42,"x");
      SetLabelFont(42,"y");
      SetTitleFont(42,"y");
      SetLabelFont(42,"z");
      SetTitleFont(42,"z");
      SetStatFont(42);
      SetLabelSize(0.035,"x");
      SetTitleSize(0.035,"x");
      SetLabelSize(0.035,"y");
      SetTitleSize(0.035,"y");
      SetLabelSize(0.035,"z");
      SetTitleSize(0.035,"z");
      SetTitleSize(0.050,"");
      SetTitleAlign(23);
      SetTitleX(0.5);
      SetTitleBorderSize(0);
      SetTitleFillColor(0);
      SetStatBorderSize(1);
      SetOptStat(1110);
      SetOptFit(111);
      SetStatY(0.935);
      SetHistFillColor(38);
      SetHistLineColor(kBlue+2);
      SetLegendBorderSize(1);
      SetLegendFillColor(0);
      SetLegendFont(42);
      SetFuncWidth(2);
      SetFuncColor(2);
   }
   if (strcmp(style_name,"plain") == 0) {
      SetFrameBorderMode(0);
      SetCanvasBorderMode(0);
      SetPadBorderMode(0);
      SetPadColor(0);
      SetCanvasColor(0);
      SetTitleFillColor(0);
      SetTitleBorderSize(1);
      SetStatColor(0);
      SetStatBorderSize(1);
      SetLegendBorderSize(1);
      return;
   }
   if (strcmp(style_name,"bold") == 0) {
{'fraction_non_alphanumeric': 0.146207188608332, 'fraction_numerical': 0.028320364194590015, 'mean_word_length': 2.953023645114041, 'pattern_counts': {'":': 0, '<': 31, '<?xml version=': 0, '>': 49, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 10, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7024019', 'n_tokens_mistral': 13645, 'n_tokens_neox': 12974, 'n_words': 2099}