Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:11:17

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