Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:32:14

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