Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:14:56

0001 /***********************
0002   To use this, type
0003   in root:
0004 
0005   root[0] .L tdrstyle.C 
0006   root[1] setTDRStyle()
0007 ***********************/
0008 #include "TStyle.h"
0009 
0010 // tdrGrid: Turns the grid lines on (true) or off (false)
0011 
0012 // fixOverlay: Redraws the axis
0013 
0014 void setTDRStyle() {
0015   TStyle *tdrStyle = new TStyle("tdrStyle","Style for P-TDR");
0016 
0017 // For the canvas:
0018   tdrStyle->SetCanvasBorderMode(0);
0019   tdrStyle->SetCanvasColor(kWhite);
0020   tdrStyle->SetCanvasDefH(600); //Height of canvas
0021   tdrStyle->SetCanvasDefW(600); //Width of canvas
0022   tdrStyle->SetCanvasDefX(0);   //POsition on screen
0023   tdrStyle->SetCanvasDefY(0);
0024 
0025 // For the Pad:
0026   tdrStyle->SetPadBorderMode(0);
0027   // tdrStyle->SetPadBorderSize(Width_t size = 1);
0028   tdrStyle->SetPadColor(kWhite);
0029   tdrStyle->SetPadGridX(false);
0030   tdrStyle->SetPadGridY(false);
0031   tdrStyle->SetGridColor(0);
0032   tdrStyle->SetGridStyle(3);
0033   tdrStyle->SetGridWidth(1);
0034 
0035 // For the frame:
0036   tdrStyle->SetFrameBorderMode(0);
0037   tdrStyle->SetFrameBorderSize(1);
0038   tdrStyle->SetFrameFillColor(0);
0039   tdrStyle->SetFrameFillStyle(0);
0040   tdrStyle->SetFrameLineColor(1);
0041   tdrStyle->SetFrameLineStyle(1);
0042   tdrStyle->SetFrameLineWidth(1);
0043 
0044 // For the histo:
0045   // tdrStyle->SetHistFillColor(1);
0046   // tdrStyle->SetHistFillStyle(0);
0047   tdrStyle->SetHistLineColor(1);
0048   tdrStyle->SetHistLineStyle(0);
0049   tdrStyle->SetHistLineWidth(1);
0050   // tdrStyle->SetLegoInnerR(Float_t rad = 0.5);
0051   // tdrStyle->SetNumberContours(Int_t number = 20);
0052 
0053   tdrStyle->SetEndErrorSize(2);
0054   //tdrStyle->SetErrorMarker(20);  // Seems to give an error
0055   tdrStyle->SetErrorX(0.);
0056   
0057   tdrStyle->SetMarkerStyle(20);
0058 
0059 //For the fit/function:
0060   tdrStyle->SetOptFit(1);
0061   tdrStyle->SetFitFormat("5.4g");
0062   tdrStyle->SetFuncColor(2);
0063   tdrStyle->SetFuncStyle(1);
0064   tdrStyle->SetFuncWidth(1);
0065 
0066 //For the date:
0067   tdrStyle->SetOptDate(0);
0068   // tdrStyle->SetDateX(Float_t x = 0.01);
0069   // tdrStyle->SetDateY(Float_t y = 0.01);
0070 
0071 // For the statistics box:
0072   tdrStyle->SetOptFile(0);
0073   //tdrStyle->SetOptStat(0); // To display the mean and RMS:   SetOptStat("mr");
0074   tdrStyle->SetOptStat("i");
0075   tdrStyle->SetStatColor(kWhite);
0076   tdrStyle->SetStatFont(42);
0077   tdrStyle->SetStatFontSize(0.025);
0078   //tdrStyle->SetStatFontSize(0.04);
0079   tdrStyle->SetStatTextColor(1);
0080   tdrStyle->SetStatFormat("6.4g");
0081   tdrStyle->SetStatBorderSize(1);
0082   tdrStyle->SetStatH(0.3);
0083   tdrStyle->SetStatW(0.15);
0084   //tdrStyle->SetStatX(0.96);
0085   tdrStyle->SetStatY(0.95);
0086   // tdrStyle->SetStatStyle(Style_t style = 1001);
0087   // tdrStyle->SetStatX(Float_t x = 0);
0088   // tdrStyle->SetStatY(Float_t y = 0);
0089 
0090 // Margins:
0091   tdrStyle->SetPadTopMargin(0.05);
0092   tdrStyle->SetPadBottomMargin(0.13);
0093   tdrStyle->SetPadLeftMargin(0.16);
0094   tdrStyle->SetPadRightMargin(0.02);
0095 
0096 // For the Global title:
0097   tdrStyle->SetOptTitle(0);    // 0=No Title
0098   tdrStyle->SetTitleFont(42);
0099   tdrStyle->SetTitleColor(1);
0100   tdrStyle->SetTitleTextColor(1);
0101   tdrStyle->SetTitleFillColor(10);
0102   tdrStyle->SetTitleFontSize(0.05);
0103   // tdrStyle->SetTitleH(0); // Set the height of the title box
0104   // tdrStyle->SetTitleW(0); // Set the width of the title box
0105   // tdrStyle->SetTitleX(0); // Set the position of the title box
0106   // tdrStyle->SetTitleY(0.985); // Set the position of the title box
0107   // tdrStyle->SetTitleStyle(Style_t style = 1001);
0108   // tdrStyle->SetTitleBorderSize(2);
0109 
0110 // For the axis titles:
0111   tdrStyle->SetTitleColor(1, "XYZ");
0112   tdrStyle->SetTitleFont(42, "XYZ");
0113   tdrStyle->SetTitleSize(0.06, "XYZ");
0114   // tdrStyle->SetTitleXSize(Float_t size = 0.02); // Another way to set the size?
0115   // tdrStyle->SetTitleYSize(Float_t size = 0.02);
0116   tdrStyle->SetTitleXOffset(0.9);
0117   tdrStyle->SetTitleYOffset(1.25);
0118   // tdrStyle->SetTitleOffset(1.1, "Y"); // Another way to set the Offset
0119 
0120 // For the axis labels:
0121   tdrStyle->SetLabelColor(1, "XYZ");
0122   tdrStyle->SetLabelFont(42, "XYZ");
0123   tdrStyle->SetLabelOffset(0.007, "XYZ");
0124   tdrStyle->SetLabelSize(0.05, "XYZ");
0125 
0126 // For the axis:
0127   tdrStyle->SetAxisColor(1, "XYZ");
0128   tdrStyle->SetStripDecimals(kTRUE);
0129   tdrStyle->SetTickLength(0.03, "XYZ");
0130   tdrStyle->SetNdivisions(510, "XYZ");
0131   tdrStyle->SetPadTickX(0);  // 0=Text labels (and tics) only on bottom, 1=Text labels on top and bottom
0132   tdrStyle->SetPadTickY(1);
0133 
0134 // Change for log plots:
0135   tdrStyle->SetOptLogx(0);
0136   tdrStyle->SetOptLogy(0);
0137   tdrStyle->SetOptLogz(0);
0138 
0139 // Postscript options:
0140   tdrStyle->SetPaperSize(20.,20.);
0141   // tdrStyle->SetLineScalePS(Float_t scale = 3);
0142   // tdrStyle->SetLineStyleString(Int_t i, const char* text);
0143   // tdrStyle->SetHeaderPS(const char* header);
0144   // tdrStyle->SetTitlePS(const char* pstitle);
0145 
0146   // tdrStyle->SetBarOffset(Float_t baroff = 0.5);
0147   // tdrStyle->SetBarWidth(Float_t barwidth = 0.5);
0148   // tdrStyle->SetPaintTextFormat(const char* format = "g");
0149   // tdrStyle->SetPalette(Int_t ncolors = 0, Int_t* colors = 0);
0150   // tdrStyle->SetTimeOffset(Double_t toffset);
0151   // tdrStyle->SetHistMinimumZero(kTRUE);
0152 
0153 
0154   tdrStyle->cd();
0155 
0156 }
0157