Example #1
0
void hggPaperStyle()
{

    // Hgg Paper style for plots
    TStyle *hggStyle = new TStyle("hggStyle","Hgg Paper Style");

    //hggStyle->SetCanvasColor(0);
    //hggStyle->SetPadColor(0);
    hggStyle->SetPadTickX(0);
    hggStyle->SetPadTickY(0);

    hggStyle->SetFrameFillColor(0);
    hggStyle->SetStatColor(0);
    hggStyle->SetOptStat(0);
    hggStyle->SetTitleFillColor(0);
    hggStyle->SetCanvasBorderMode(0);
    hggStyle->SetPadBorderMode(0);
    hggStyle->SetFrameBorderMode(0);
    hggStyle->SetFrameBorderSize(1);
    hggStyle->SetPadColor(kWhite);
    hggStyle->SetCanvasColor(kWhite);

    hggStyle->SetCanvasDefH(600); //Height of canvas
    hggStyle->SetCanvasDefW(800); //Width of canvas
    hggStyle->SetCanvasDefX(0);   //POsition on screen
    hggStyle->SetCanvasDefY(0);

    hggStyle->SetPadLeftMargin(0.16);//0.16);
    hggStyle->SetPadRightMargin(0.1);//0.02);
    hggStyle->SetPadTopMargin(0.085);//0.02);
    hggStyle->SetPadBottomMargin(0.12);//0.02);

    // For hgg axis titles:
    hggStyle->SetTitleColor(1, "XYZ");
    hggStyle->SetTitleFont(42, "XYZ");
    hggStyle->SetTitleSize(0.05, "XYZ");
    hggStyle->SetTitleYOffset(1.5); // => 1.15 if exponents
    hggStyle->SetTitleXOffset(1.);//0.9);

    // For hgg axis labels:
    hggStyle->SetLabelColor(1, "XYZ");
    hggStyle->SetLabelFont(42, "XYZ");
    hggStyle->SetLabelOffset(0.007, "XYZ");
    hggStyle->SetLabelSize(0.045, "XYZ");

    // Legends
    hggStyle->SetLegendBorderSize(0);
    hggStyle->SetLegendFillColor(kWhite);
    hggStyle->SetLegendFont(42);

    hggStyle->SetFillColor(10);
    // Nothing for now
    hggStyle->SetTextFont(42);
    hggStyle->SetTextSize(0.03);

    hggStyle->SetOptTitle(0);
    hggStyle->SetOptStat(0);
    hggStyle->cd();
}
Example #2
0
/////////
// the Style Section
/////////
void setHLTStyle() {
  setTDRStyle();
  //  TStyle *hltStyle = new TStyle(*tdrStyle);
  TStyle *hltStyle  = new TStyle("hltStyle","My HLT Styles");
  gStyle->Copy(*hltStyle);

  hltStyle->SetCanvasColor(-1);

  hltStyle->SetCanvasDefH(600);
  hltStyle->SetCanvasDefW(600);
  hltStyle->SetPadColor(-1);  
  hltStyle->SetPadGridX(false);
  hltStyle->SetPadGridY(false);
  hltStyle->SetGridWidth(0.25);
  
  hltStyle->SetFrameFillColor(-1); // Transparent

  hltStyle->SetHistFillColor(-1); // Transparent
  hltStyle->SetHistFillStyle(0);  // None
  hltStyle->SetHistLineWidth(3);

  hltStyle->SetPadTopMargin(0.08);
  hltStyle->SetPadBottomMargin(0.12);
  hltStyle->SetPadLeftMargin(0.15);
  hltStyle->SetPadRightMargin(0.04);

  hltStyle->SetTitleSize(0.05);
  hltStyle->SetTitleFillColor(-1); // Transparent
  hltStyle->SetTitleH(0.05); // Set the height of the title box
  hltStyle->SetTitleW(0.); // Set the width of the title box

  hltStyle->SetTitleSize(0.04, "XYZ");     
  hltStyle->SetTitleOffset(1.2, "X"); // Another way to set the Offset
  hltStyle->SetTitleOffset(1.8, "Y"); // Another way to set the Offset

  hltStyle->SetLabelSize(0.035, "XYZ");

  hltStyle->SetPalette(1,0);
  hltStyle->SetFillColor(0);    // White
  hltStyle->SetFillStyle(4000); // Transparent

  hltStyle->SetStatStyle(0);
  hltStyle->SetTitleStyle(0);
  hltStyle->SetCanvasBorderSize(0);
  hltStyle->SetFrameBorderSize(0);
  hltStyle->SetLegendBorderSize(0);
  hltStyle->SetStatBorderSize(0);
  hltStyle->SetTitleBorderSize(0);

  hltStyle->cd();
}
Example #3
0
// Lauri's Style (LAuri Wendland)
//********************************************************************//
void LAWStyle() {
    TStyle *LAWStyle = new TStyle("LAWStyle", "Neat style");
    LAWStyle->SetCanvasBorderMode(0);
    LAWStyle->SetCanvasColor(kWhite);
    LAWStyle->SetPadBorderMode(0);
    LAWStyle->SetPadColor(kWhite);
    LAWStyle->SetTitleFillColor(kWhite);
    LAWStyle->SetGridColor(0);
    LAWStyle->SetFrameBorderMode(0);
    LAWStyle->SetFrameBorderSize(1);
    LAWStyle->SetFrameFillColor(0);
    LAWStyle->SetFrameFillStyle(0);
    LAWStyle->SetFrameLineColor(1);
    LAWStyle->SetFrameLineStyle(1);
    LAWStyle->SetFrameLineWidth(1);
    LAWStyle->SetFillColor(kWhite);
    LAWStyle->SetFillColor(kWhite);
    LAWStyle->SetOptTitle(0);
    LAWStyle->SetTitleFont(42, "XYZ");
    LAWStyle->SetTitleFontSize(0.05);
    LAWStyle->SetTitleSize(0.06, "XYZ");
    LAWStyle->SetTextFont(42);
    LAWStyle->SetTitleXOffset(0.9);
    LAWStyle->SetTitleYOffset(1.25);

    LAWStyle->SetLabelColor(1, "XYZ");
    LAWStyle->SetLabelFont(42, "XYZ");
    LAWStyle->SetLabelOffset(0.007, "XYZ");
    LAWStyle->SetLabelSize(0.05, "XYZ");
    LAWStyle->SetPadTickX(1);  // To get tick marks on the opposite side of the frame
    LAWStyle->SetPadTickY(1);  // To get tick marks on the opposite side of the frame
    LAWStyle->SetNdivisions(508,"XYZ");

    LAWStyle->SetPadTopMargin(0.05);
    LAWStyle->SetPadBottomMargin(0.12);
    LAWStyle->SetPadLeftMargin(0.16);
    LAWStyle->SetPadRightMargin(0.04);//0.02
    LAWStyle->SetCanvasDefH(600); //Height of canvas
    LAWStyle->SetCanvasDefW(600); //Width of canvas
    LAWStyle->SetCanvasDefX(0);   //POsition on screen
    LAWStyle->SetCanvasDefY(0);
    LAWStyle->SetOptTitle(0);
    LAWStyle->SetOptStat(0);
    LAWStyle->cd();
} //end of: void LAWStyle(){
void setTDRStyle() {

  TStyle *tdrStyle = new TStyle("tdrStyle","Style for P-DR");

  gROOT->SetStyle("Plain");
  gROOT->ForceStyle();

  tdrStyle->SetFrameBorderMode(0);
  tdrStyle->SetCanvasBorderMode(0);
  tdrStyle->SetPadBorderMode(0);
  tdrStyle->SetPadBorderMode(0);

  //	tdrStyle->SetFrameColor(0);
  tdrStyle->SetPadColor(0);
  tdrStyle->SetCanvasColor(0);
  tdrStyle->SetStatColor(0);
  tdrStyle->SetFillColor(0);

  tdrStyle->SetPaperSize(20,26);
  //	tdrStyle->SetPadTopMargin(0.08);
  //	tdrStyle->SetPadBottomMargin(0.14);
  tdrStyle->SetPadRightMargin(0.04);
  tdrStyle->SetPadLeftMargin(0.05);
  //	tdrStyle->SetCanvasDefH(800);
  //	tdrStyle->SetCanvasDefW(800);
  //	tdrStyle->SetPadGridX(1);
  //	tdrStyle->SetPadGridY(1);
  tdrStyle->SetPadTickX(1);
  tdrStyle->SetPadTickY(1);

  tdrStyle->SetTextFont(42); //132
  tdrStyle->SetTextSize(0.09);
  tdrStyle->SetLabelFont(42,"xyz");
  tdrStyle->SetTitleFont(42,"xyz");
  tdrStyle->SetLabelSize(0.045,"xyz"); //0.035
  tdrStyle->SetTitleSize(0.045,"xyz");
  tdrStyle->SetTitleOffset(1.5,"y");
    
  tdrStyle->SetTitleX(0.16);
  tdrStyle->SetTitleY(0.93);
  tdrStyle->SetTitleColor(1);
  tdrStyle->SetTitleTextColor(1);
  tdrStyle->SetTitleFillColor(0);
  tdrStyle->SetTitleBorderSize(1);
  tdrStyle->SetTitleFontSize(0.04);
  //	tdrStyle->SetPadTopMargin(0.05);
  //	tdrStyle->SetPadBottomMargin(0.13);
  //	tdrStyle->SetPadLeftMargin(0.14);
  //	tdrStyle->SetPadRightMargin(0.02);

  // use bold lines and markers
  tdrStyle->SetMarkerStyle(8);
  tdrStyle->SetHistLineWidth(3);
  tdrStyle->SetLineWidth(1);
  
  tdrStyle->SetOptTitle(kFALSE);
  tdrStyle->SetOptStat(0);

  tdrStyle->cd();

}
Example #5
0
void Style_Toby_2()
{
   // Add the saved style to the current ROOT session.

   delete gROOT->GetStyle("Toby_2");

   TStyle *tmpStyle = new TStyle("Toby_2", "Style for posters and talks");
   tmpStyle->SetNdivisions(510, "x");
   tmpStyle->SetNdivisions(510, "y");
   tmpStyle->SetNdivisions(510, "z");
   tmpStyle->SetAxisColor(1, "x");
   tmpStyle->SetAxisColor(1, "y");
   tmpStyle->SetAxisColor(1, "z");
   tmpStyle->SetLabelColor(1, "x");
   tmpStyle->SetLabelColor(1, "y");
   tmpStyle->SetLabelColor(1, "z");
   tmpStyle->SetLabelFont(42, "x");
   tmpStyle->SetLabelFont(42, "y");
   tmpStyle->SetLabelFont(42, "z");
   tmpStyle->SetLabelOffset(0.005, "x");
   tmpStyle->SetLabelOffset(0.005, "y");
   tmpStyle->SetLabelOffset(0.005, "z");
   tmpStyle->SetLabelSize(0.035, "x");
   tmpStyle->SetLabelSize(0.035, "y");
   tmpStyle->SetLabelSize(0.035, "z");
   tmpStyle->SetTickLength(0.03, "x");
   tmpStyle->SetTickLength(0.03, "y");
   tmpStyle->SetTickLength(0.03, "z");
   tmpStyle->SetTitleOffset(1, "x");
   tmpStyle->SetTitleOffset(1, "y");
   tmpStyle->SetTitleOffset(1, "z");
   tmpStyle->SetTitleSize(0.035, "x");
   tmpStyle->SetTitleSize(0.035, "y");
   tmpStyle->SetTitleSize(0.035, "z");
   tmpStyle->SetTitleColor(1, "x");
   tmpStyle->SetTitleColor(1, "y");
   tmpStyle->SetTitleColor(1, "z");
   tmpStyle->SetTitleFont(42, "x");
   tmpStyle->SetTitleFont(42, "y");
   tmpStyle->SetTitleFont(42, "z");
   tmpStyle->SetBarWidth(1);
   tmpStyle->SetBarOffset(0);
   tmpStyle->SetDrawBorder(0);
   tmpStyle->SetOptLogx(0);
   tmpStyle->SetOptLogy(0);
   tmpStyle->SetOptLogz(0);
   tmpStyle->SetOptDate(0);
   tmpStyle->SetOptStat(111);
   tmpStyle->SetOptTitle(kTRUE);
   tmpStyle->SetOptFit(0);
   tmpStyle->SetNumberContours(20);
   tmpStyle->GetAttDate()->SetTextFont(62);
   tmpStyle->GetAttDate()->SetTextSize(0.025);
   tmpStyle->GetAttDate()->SetTextAngle(0);
   tmpStyle->GetAttDate()->SetTextAlign(11);
   tmpStyle->GetAttDate()->SetTextColor(1);
   tmpStyle->SetDateX(0.01);
   tmpStyle->SetDateY(0.01);
   tmpStyle->SetEndErrorSize(2);
   tmpStyle->SetErrorX(0.5);
   tmpStyle->SetFuncColor(2);
   tmpStyle->SetFuncStyle(1);
   tmpStyle->SetFuncWidth(2);
   tmpStyle->SetGridColor(0);
   tmpStyle->SetGridStyle(3);
   tmpStyle->SetGridWidth(1);
   tmpStyle->SetLegendBorderSize(1);
   tmpStyle->SetLegendFillColor(0);
   tmpStyle->SetLegendFont(42);
   tmpStyle->SetHatchesLineWidth(1);
   tmpStyle->SetHatchesSpacing(1);
   tmpStyle->SetFrameFillColor(0);
   tmpStyle->SetFrameLineColor(1);
   tmpStyle->SetFrameFillStyle(1001);
   tmpStyle->SetFrameLineStyle(1);
   tmpStyle->SetFrameLineWidth(1);
   tmpStyle->SetFrameBorderSize(1);
   tmpStyle->SetFrameBorderMode(0);
   tmpStyle->SetHistFillColor(0);
   tmpStyle->SetHistLineColor(602);
   tmpStyle->SetHistFillStyle(1001);
   tmpStyle->SetHistLineStyle(1);
   tmpStyle->SetHistLineWidth(1);
   tmpStyle->SetHistMinimumZero(kFALSE);
   tmpStyle->SetCanvasPreferGL(kFALSE);
   tmpStyle->SetCanvasColor(0);
   tmpStyle->SetCanvasBorderSize(2);
   tmpStyle->SetCanvasBorderMode(0);
   tmpStyle->SetCanvasDefH(500);
   tmpStyle->SetCanvasDefW(700);
   tmpStyle->SetCanvasDefX(10);
   tmpStyle->SetCanvasDefY(10);
   tmpStyle->SetPadColor(0);
   tmpStyle->SetPadBorderSize(2);
   tmpStyle->SetPadBorderMode(0);
   tmpStyle->SetPadBottomMargin(0.1);
   tmpStyle->SetPadTopMargin(0.1);
   tmpStyle->SetPadLeftMargin(0.1);
   tmpStyle->SetPadRightMargin(0.1);
   tmpStyle->SetPadGridX(kFALSE);
   tmpStyle->SetPadGridY(kFALSE);
   tmpStyle->SetPadTickX(0);
   tmpStyle->SetPadTickY(0);
   tmpStyle->SetPaperSize(20, 26);
   tmpStyle->SetScreenFactor(1);
   tmpStyle->SetStatColor(0);
   tmpStyle->SetStatTextColor(1);
   tmpStyle->SetStatBorderSize(1);
   tmpStyle->SetStatFont(42);
   tmpStyle->SetStatFontSize(0);
   tmpStyle->SetStatStyle(1001);
   tmpStyle->SetStatFormat("6.4g");
   tmpStyle->SetStatX(0.9);
   tmpStyle->SetStatY(0.97);
   tmpStyle->SetStatW(0.15);
   tmpStyle->SetStatH(0.16);
   tmpStyle->SetStripDecimals(kTRUE);
   tmpStyle->SetTitleAlign(23);
   tmpStyle->SetTitleFillColor(0);
   tmpStyle->SetTitleTextColor(1);
   tmpStyle->SetTitleBorderSize(0);
   tmpStyle->SetTitleFont(42);
   tmpStyle->SetTitleFontSize(0.05);
   tmpStyle->SetTitleStyle(0);
   tmpStyle->SetTitleX(0.5);
   tmpStyle->SetTitleY(0.995);
   tmpStyle->SetTitleW(0);
   tmpStyle->SetTitleH(0);
   tmpStyle->SetLegoInnerR(0.5);

   Int_t fPaletteColor[50] = {51, 52, 53, 54, 55, 56, 57, 58, 59, 
                             60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 
                             70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 
                             80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 
                             90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100};
   tmpStyle->SetPalette(50, fPaletteColor);

   TString fLineStyleArrayTmp[30] = {"", "   ", "  12 12", "  4 8", 
                             "  12 16 4 16", "  20 12 4 12", "  20 12 4 12 4 12 4 12", "  20 20", "  20 12 4 12 4 12", 
                             "  80 20", "  80 40 4 40", "   ", "   ", "   ", 
                             "   ", "   ", "   ", "   ", "   ", 
                             "   ", "   ", "   ", "   ", "   ", 
                             "   ", "   ", "   ", "   ", "   ", "   "};
   for (Int_t i=0; i<30; i++)
      tmpStyle->SetLineStyleString(i, fLineStyleArrayTmp[i]);

   tmpStyle->SetHeaderPS("");
   tmpStyle->SetTitlePS("");
   tmpStyle->SetFitFormat("5.4g");
   tmpStyle->SetPaintTextFormat("g");
   tmpStyle->SetLineScalePS(3);
   tmpStyle->SetColorModelPS(0);
   tmpStyle->SetTimeOffset(788918400);

   tmpStyle->SetLineColor(1);
   tmpStyle->SetLineStyle(1);
   tmpStyle->SetLineWidth(1);
   tmpStyle->SetFillColor(19);
   tmpStyle->SetFillStyle(1001);
   tmpStyle->SetMarkerColor(1);
   tmpStyle->SetMarkerSize(1);
   tmpStyle->SetMarkerStyle(1);
   tmpStyle->SetTextAlign(11);
   tmpStyle->SetTextAngle(0);
   tmpStyle->SetTextColor(1);
   tmpStyle->SetTextFont(62);
   tmpStyle->SetTextSize(0.05);
}
void setTDRStyle() {
  TStyle *tdrStyle = new TStyle("tdrStyle","Style for P-TDR");

  //NL
  tdrStyle->SetLegendBorderSize(0); 
  tdrStyle->SetFillColor(0);
  tdrStyle->SetPadBorderSize(0);

  // For the canvas:
  tdrStyle->SetCanvasBorderMode(0);
  tdrStyle->SetCanvasColor(kWhite);
  tdrStyle->SetCanvasDefH(600); //Height of canvas
  tdrStyle->SetCanvasDefW(600); //Width of canvas
  tdrStyle->SetCanvasDefX(0);   //POsition on screen
  tdrStyle->SetCanvasDefY(0);

  // For the Pad:
  tdrStyle->SetPadBorderMode(0);
  // tdrStyle->SetPadBorderSize(Width_t size = 1);
  tdrStyle->SetPadColor(kWhite);
  tdrStyle->SetPadGridX(false);
  tdrStyle->SetPadGridY(false);
  tdrStyle->SetGridColor(0);
  tdrStyle->SetGridStyle(3);
  tdrStyle->SetGridWidth(1);

  // For the frame:
  tdrStyle->SetFrameBorderMode(0);
  tdrStyle->SetFrameBorderSize(0);//was 1
  tdrStyle->SetFrameFillColor(0);
  tdrStyle->SetFrameFillStyle(0);
  tdrStyle->SetFrameLineColor(1);
  tdrStyle->SetFrameLineStyle(1);
  tdrStyle->SetFrameLineWidth(1);

  // For the histo:
  //tdrStyle->SetHistFillColor(63);
  tdrStyle->SetHistFillStyle(0);
  tdrStyle->SetHistLineColor(1);
  tdrStyle->SetHistLineStyle(0);
  tdrStyle->SetHistLineWidth(1);
  // tdrStyle->SetLegoInnerR(Float_t rad = 0.5);
  // tdrStyle->SetNumberContours(Int_t number = 20);

//  tdrStyle->SetEndErrorSize(0); //was 2
  tdrStyle->SetErrorX(0.);
//  tdrStyle->SetErrorMarker(20);
  
  tdrStyle->SetMarkerStyle(20);

  //For the fit/function:
  tdrStyle->SetOptFit(1);
  tdrStyle->SetFitFormat("5.4g");
  tdrStyle->SetFuncColor(2);
  tdrStyle->SetFuncStyle(1);
  tdrStyle->SetFuncWidth(1);

  //For the date:
  tdrStyle->SetOptDate(0);
  // tdrStyle->SetDateX(Float_t x = 0.01);
  // tdrStyle->SetDateY(Float_t y = 0.01);

  // For the statistics box:
  tdrStyle->SetOptFile(0);
  tdrStyle->SetOptStat(0); // To display the mean and RMS:   SetOptStat("mr");
  tdrStyle->SetStatColor(kWhite);
  tdrStyle->SetStatFont(42);
  tdrStyle->SetStatFontSize(0.025);
  tdrStyle->SetStatTextColor(1);
  tdrStyle->SetStatFormat("6.4g");
  tdrStyle->SetStatBorderSize(1);
  tdrStyle->SetStatH(0.1);
  tdrStyle->SetStatW(0.15);
  // tdrStyle->SetStatStyle(Style_t style = 1001);
  // tdrStyle->SetStatX(Float_t x = 0);
  // tdrStyle->SetStatY(Float_t y = 0);

  // Margins:
  tdrStyle->SetPadTopMargin(0.05);
  tdrStyle->SetPadBottomMargin(0.13);
  tdrStyle->SetPadLeftMargin(0.13); //was 0.16
  tdrStyle->SetPadRightMargin(0.05);//was 0.02

  // For the Global title:

  //  tdrStyle->SetOptTitle(0); // 0-notitle
  tdrStyle->SetTitleFont(42);
  tdrStyle->SetTitleColor(1);
  tdrStyle->SetTitleTextColor(1);
  tdrStyle->SetTitleFillColor(10);
  tdrStyle->SetTitleFontSize(0.05);
  // tdrStyle->SetTitleH(0); // Set the height of the title box
  // tdrStyle->SetTitleW(0); // Set the width of the title box
  // tdrStyle->SetTitleX(0); // Set the position of the title box
  // tdrStyle->SetTitleY(0.985); // Set the position of the title box
  // tdrStyle->SetTitleStyle(Style_t style = 1001);
  // tdrStyle->SetTitleBorderSize(2);

  // For the axis titles:

  tdrStyle->SetTitleColor(1, "XYZ");
  tdrStyle->SetTitleFont(42, "XYZ");
  tdrStyle->SetTitleSize(0.06, "XYZ");
  // tdrStyle->SetTitleXSize(Float_t size = 0.02); // Another way to set the size?
  // tdrStyle->SetTitleYSize(Float_t size = 0.02);
  tdrStyle->SetTitleXOffset(0.9);
  tdrStyle->SetTitleYOffset(1.05); //was 1.25
  // tdrStyle->SetTitleOffset(1.1, "Y"); // Another way to set the Offset

  // For the axis labels:
  tdrStyle->SetLabelColor(1, "XYZ");
  tdrStyle->SetLabelFont(42, "XYZ");
  tdrStyle->SetLabelOffset(0.007, "XYZ");
  tdrStyle->SetLabelSize(0.05, "XYZ");

  // For the axis:

  tdrStyle->SetAxisColor(1, "XYZ");
  tdrStyle->SetStripDecimals(kTRUE);
  tdrStyle->SetTickLength(0.03, "XYZ");
  tdrStyle->SetNdivisions(510, "XYZ");
  tdrStyle->SetPadTickX(1);  // was 1; To get tick marks on the opposite side of the frame
  tdrStyle->SetPadTickY(1);  //was 1

  // Change for log plots:
  tdrStyle->SetOptLogx(0);
  tdrStyle->SetOptLogy(0);
  tdrStyle->SetOptLogz(0);

  // Postscript options:
  // tdrStyle->SetPaperSize(15.,15.); //was 20,20
  // tdrStyle->SetLineScalePS(Float_t scale = 3);
  // tdrStyle->SetLineStyleString(Int_t i, const char* text);
  // tdrStyle->SetHeaderPS(const char* header);
  // tdrStyle->SetTitlePS(const char* pstitle);

  // tdrStyle->SetBarOffset(Float_t baroff = 0.5);
  // tdrStyle->SetBarWidth(Float_t barwidth = 0.5);
  // tdrStyle->SetPaintTextFormat(const char* format = "g");
  // tdrStyle->SetPalette(Int_t ncolors = 0, Int_t* colors = 0);
  // tdrStyle->SetTimeOffset(Double_t toffset);
  // tdrStyle->SetHistMinimumZero(kTRUE);

  tdrStyle->cd();
}
Example #7
0
bool                                          // returns true if success
processStyleSection(FILE *fp,string& theline, bool& new_section)
{
  vector<string> v_tokens;

  string *sid      = NULL;
  TStyle *thestyle = NULL;

  if (gl_verbose)
    cout << "Processing style section" << endl;

  new_section=false;

  while (getLine(fp,theline,"style")) {
    if (!theline.size()) continue;
    if (theline[0] == '#') continue; // comments are welcome

    if (theline[0] == '[') {
      new_section=true;
      return true;
    }

    string key, value;
    if (!getKeyValue(theline,key,value)) continue;

    if (key == "id") {
      if (sid != NULL) {
	cerr << "no more than one id per style section allowed " << value << endl;
	break;
      }

      sid = new string(value);
      thestyle = new TStyle(*gStyle); // Assume current attributes, let user override specifics
      thestyle->SetNameTitle(sid->c_str(),sid->c_str());
      glmap_id2style.insert(pair<string,TStyle*>(*sid,thestyle));
      continue;
    }
    else if (!sid) {
      // assume the style is the global style
      thestyle = gStyle;
      sid = new string("using global"); // so as to pass this check the next time
      cerr << "No style ID defined, assuming global style" << endl;
      continue;
    }

    if (key == "style") {
      if (value == "TDR")
	setTDRStyle();
      else if (value == "Plain")
	gROOT->SetStyle("Plain");
      else 
	cerr << "unknown style name " << value << endl;
    }
    else if (key == "optstat")  {
      if (gl_verbose) cout << "OptStat = " << thestyle->GetOptStat() << endl;
      thestyle->SetOptStat(value.c_str());
      if (gl_verbose) cout << "OptStat = " << thestyle->GetOptStat() << endl;
    }
    else if (key == "opttitle")  thestyle->SetOptTitle(str2int(value));

    else if (key == "padrightmargin")  thestyle->SetPadRightMargin (str2flt(value));
    else if (key == "padleftmargin")   thestyle->SetPadLeftMargin  (str2flt(value));
    else if (key == "padtopmargin")    thestyle->SetPadTopMargin   (str2flt(value));
    else if (key == "padbottommargin") thestyle->SetPadBottomMargin(str2flt(value));
    else if (key == "padgridx")        thestyle->SetPadGridX       (str2int(value));
    else if (key == "padgridy")        thestyle->SetPadGridY       (str2int(value));

    // Set the position/size of the title box

    else if (key == "titlexndc")    thestyle->SetTitleX(str2flt(value));
    else if (key == "titleyndc")    thestyle->SetTitleY(str2flt(value));
    else if (key == "titlewndc")    thestyle->SetTitleW(str2flt(value));
    else if (key == "titlehndc")    thestyle->SetTitleH(str2flt(value));
    else if (key == "titlefont")    thestyle->SetTitleFont(str2int(value));
    else if (key == "titlebordersize") thestyle->SetTitleBorderSize(str2int(value));

    else if (key == "markercolor")  thestyle->SetMarkerColor(str2int(value));
    else if (key == "markerstyle")  thestyle->SetMarkerStyle(str2int(value));
    else if (key == "markersize")   thestyle->SetMarkerSize(str2int(value));
    else if (key == "linecolor")    thestyle->SetLineColor(str2int(value));
    else if (key == "linestyle")    thestyle->SetLineStyle(str2int(value));
    else if (key == "linewidth")    thestyle->SetLineWidth(str2int(value));
    else if (key == "fillcolor")    thestyle->SetFillColor(str2int(value));
    else if (key == "fillstyle")    thestyle->SetFillStyle(str2int(value));

    // axes
    else if (key == "xtitlesize")   thestyle->SetTitleSize(str2flt(value),"X");
    else if (key == "ytitlesize")   thestyle->SetTitleSize(str2flt(value),"Y");
    else if (key == "ztitlesize")   thestyle->SetTitleSize(str2flt(value),"Z");
    else if (key == "xtitleoffset") thestyle->SetTitleOffset(str2flt(value),"X");
    else if (key == "ytitleoffset") thestyle->SetTitleOffset(str2flt(value),"Y");
    else if (key == "ztitleoffset") thestyle->SetTitleOffset(str2flt(value),"Z");
    else if (key == "xlabeloffset") thestyle->SetLabelOffset(str2flt(value),"X");
    else if (key == "ylabeloffset") thestyle->SetLabelOffset(str2flt(value),"Y");
    else if (key == "zlabeloffset") thestyle->SetLabelOffset(str2flt(value),"Z");
    else if (key == "xtitlefont")   thestyle->SetTitleFont(str2int(value),"X");
    else if (key == "ytitlefont")   thestyle->SetTitleFont(str2int(value),"Y");
    else if (key == "ztitlefont")   thestyle->SetTitleFont(str2int(value),"Z");
    else if (key == "xlabelsize")   thestyle->SetLabelSize(str2flt(value),"X");
    else if (key == "ylabelsize")   thestyle->SetLabelSize(str2flt(value),"Y");
    else if (key == "zlabelsize")   thestyle->SetLabelSize(str2flt(value),"Z");
    else if (key == "xlabelfont")   thestyle->SetLabelFont(str2int(value),"X");
    else if (key == "ylabelfont")   thestyle->SetLabelFont(str2int(value),"Y");
    else if (key == "zlabelfont")   thestyle->SetLabelFont(str2int(value),"Z");
    else if (key == "xndiv")        thestyle->SetNdivisions(str2int(value),"X");
    else if (key == "yndiv")        thestyle->SetNdivisions(str2int(value),"Y");
    else if (key == "zndiv")        thestyle->SetNdivisions(str2int(value),"Z");

    // Set the position of the statbox
    else if (key == "statx2ndc")    thestyle->SetStatX(str2flt(value));
    else if (key == "staty2ndc")    thestyle->SetStatY(str2flt(value));
    else if (key == "statwndc")     thestyle->SetStatW(str2flt(value));
    else if (key == "stathndc")     thestyle->SetStatH(str2flt(value));

    else if (key == "statfont")     thestyle->SetStatFont    (str2int(value));
    else if (key == "statfontsize") thestyle->SetStatFontSize(str2flt(value));
    else if (key == "statformat")   thestyle->SetStatFormat  (value.c_str());
    else if (key == "statstyle")    thestyle->SetStatStyle   (str2int(value.c_str()));

    else if (key == "fitformat")    thestyle->SetFitFormat   (value.c_str());

    else if (key == "painttextfmt") thestyle->SetPaintTextFormat(value.c_str());
    else if (key == "markersize")   thestyle->SetMarkerSize(str2flt(value));

    else if (key == "palette")      thestyle->SetPalette(str2int(value));

    else {
      cerr << "Unknown key " << key << endl;
    }

  } // while loop

  return true;
}                                                 // processStyleSection
Example #8
0
void
SetOKStyle()
{
  TStyle* OKStyle = new TStyle("OKStyle", "OK Default Style");

  // Colors

  //set the background color to white
  OKStyle->SetFillColor(10);
  OKStyle->SetFrameFillColor(kWhite);
  OKStyle->SetFrameFillStyle(0);
  OKStyle->SetFillStyle(0);
  OKStyle->SetCanvasColor(kWhite);
  OKStyle->SetPadColor(kWhite);
  OKStyle->SetTitleFillColor(0);
  OKStyle->SetStatColor(kWhite);

  // Get rid of drop shadow on legends
  // This doesn't seem to work.  Call SetBorderSize(1) directly on your TLegends
  OKStyle->SetLegendBorderSize(1);

  //don't put a colored frame around the plots
  OKStyle->SetFrameBorderMode(0);
  OKStyle->SetCanvasBorderMode(0);
  OKStyle->SetPadBorderMode(0);

  //use the primary color palette
  OKStyle->SetPalette(1, 0);

  //set the default line color for a histogram to be black
  OKStyle->SetHistLineColor(kBlack);

  //set the default line color for a fit function to be red
  OKStyle->SetFuncColor(kBlue);

  //make the axis labels black
  OKStyle->SetLabelColor(kBlack, "xyz");

  //set the default title color to be black
  OKStyle->SetTitleColor(kBlack);

  //set the margins
  OKStyle->SetPadBottomMargin(0.15);
  OKStyle->SetPadLeftMargin(0.1);
  OKStyle->SetPadTopMargin(0.075);
  OKStyle->SetPadRightMargin(0.1);

  //set axis label and title text sizes
  OKStyle->SetLabelSize(0.035, "xyz");
  OKStyle->SetTitleSize(0.05, "xyz");
  OKStyle->SetTitleOffset(0.9, "xyz");
  OKStyle->SetStatFontSize(0.035);
  OKStyle->SetTextSize(0.05);
  OKStyle->SetTitleBorderSize(0);
  OKStyle->SetTitleStyle(0);

  OKStyle->SetLegendBorderSize(0);

  //set line widths
  OKStyle->SetHistLineWidth(1);
  OKStyle->SetFrameLineWidth(2);
  OKStyle->SetFuncWidth(2);

  // Misc

  //align the titles to be centered
  //OKStyle->SetTextAlign(22);

  //turn off xy grids
  OKStyle->SetPadGridX(1);
  OKStyle->SetPadGridY(1);

  //set the tick mark style
  OKStyle->SetPadTickX(1);
  OKStyle->SetPadTickY(1);

  //don't show the fit parameters in a box
  OKStyle->SetOptFit(0);

  //set the default stats shown
  OKStyle->SetOptStat(1);

  //marker settings
// 	OKStyle->SetMarkerStyle(8);
// 	OKStyle->SetMarkerSize(0.7);

  // Fonts
  OKStyle->SetStatFont(42);
  OKStyle->SetLabelFont(42, "xyz");
  OKStyle->SetTitleFont(42, "xyz");
  OKStyle->SetTextFont(42);

  // Set the paper size for output
  OKStyle->SetPaperSize(TStyle::kUSLetter);

  //done
  OKStyle->cd();

  cout << "Using Jin's Style" << endl;
}