Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:21:06

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