Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:22:43

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