Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 11:55:57

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