Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:44:20

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