Пример #1
0
def setTDRStyle(drawGrid):
    tdrStyle = TStyle("tdrStyle", "Style for P-TDR")

    # For the canvas:
    tdrStyle.SetCanvasBorderMode(0)
    tdrStyle.SetCanvasColor(0)
    tdrStyle.SetCanvasDefH(600)  #Height of canvas
    tdrStyle.SetCanvasDefW(600)  #Width of canvas
    tdrStyle.SetCanvasDefX(0)  #POsition on screen
    tdrStyle.SetCanvasDefY(0)

    # For the Pad:
    tdrStyle.SetPadBorderMode(0)
    tdrStyle.SetPadColor(0)
    tdrStyle.SetPadGridX(drawGrid)
    tdrStyle.SetPadGridY(drawGrid)
    tdrStyle.SetGridColor(0)
    tdrStyle.SetGridStyle(3)  #3
    tdrStyle.SetGridWidth(1)

    # For the frame:
    tdrStyle.SetFrameBorderMode(0)
    tdrStyle.SetFrameBorderSize(1)
    tdrStyle.SetFrameFillColor(0)
    tdrStyle.SetFrameFillStyle(0)
    tdrStyle.SetFrameLineColor(1)
    tdrStyle.SetFrameLineStyle(1)
    tdrStyle.SetFrameLineWidth(1)

    # For the histo:
    # tdrStyle.SetHistFillColor(1)
    # tdrStyle.SetHistFillStyle(0)
    tdrStyle.SetHistLineColor(1)
    tdrStyle.SetHistLineStyle(0)
    tdrStyle.SetHistLineWidth(1)

    tdrStyle.SetEndErrorSize(2)
    #tdrStyle.SetErrorMarker(20)
    tdrStyle.SetErrorX(0.)

    tdrStyle.SetMarkerStyle(20)

    #For the fit/function:
    tdrStyle.SetOptFit(0)
    tdrStyle.SetFitFormat("5.4g")
    tdrStyle.SetFuncColor(2)
    tdrStyle.SetFuncStyle(1)
    tdrStyle.SetFuncWidth(1)

    #For the date:
    tdrStyle.SetOptDate(0)

    # For the statistics box:
    tdrStyle.SetOptFile(0)
    tdrStyle.SetOptStat(0)  # To display the mean and RMS:   SetOptStat("mr")
    tdrStyle.SetStatColor(0)
    tdrStyle.SetStatFont(42)
    tdrStyle.SetStatFontSize(0.025)
    tdrStyle.SetStatTextColor(1)
    tdrStyle.SetStatFormat("6.4g")
    tdrStyle.SetStatBorderSize(1)
    tdrStyle.SetStatH(0.1)
    tdrStyle.SetStatW(0.15)

    tdrStyle.SetPadTopMargin(0.05)
    tdrStyle.SetPadBottomMargin(0.13)
    tdrStyle.SetPadLeftMargin(0.13)
    tdrStyle.SetPadRightMargin(0.05)

    tdrStyle.SetTitleFont(42)
    tdrStyle.SetTitleColor(1)
    tdrStyle.SetTitleTextColor(1)
    tdrStyle.SetTitleFillColor(10)
    tdrStyle.SetTitleFontSize(0.05)

    tdrStyle.SetTitleColor(1, "XYZ")
    tdrStyle.SetTitleFont(42, "XYZ")
    tdrStyle.SetTitleSize(0.06, "XYZ")
    tdrStyle.SetTitleXOffset(0.9)
    tdrStyle.SetTitleYOffset(1.05)

    tdrStyle.SetLabelColor(1, "XYZ")
    tdrStyle.SetLabelFont(42, "XYZ")
    tdrStyle.SetLabelOffset(0.007, "XYZ")
    tdrStyle.SetLabelSize(0.05, "XYZ")

    tdrStyle.SetAxisColor(1, "XYZ")
    tdrStyle.SetStripDecimals(True)
    tdrStyle.SetTickLength(0.03, "XYZ")
    tdrStyle.SetNdivisions(510, "XYZ")  #510
    tdrStyle.SetPadTickX(
        1)  # To get tick marks on the opposite side of the frame
    tdrStyle.SetPadTickY(1)

    # Change for log plots:
    tdrStyle.SetOptLogx(0)
    tdrStyle.SetOptLogy(0)
    tdrStyle.SetOptLogz(0)

    # Postscript options:
    tdrStyle.SetPaperSize(15., 15.)
    # tdrStyle.SetLineScalePS(Float_t scale = 3)
    # tdrStyle.SetLineStyleString(Int_t i, const char* text)
    # tdrStyle.SetHeaderPS(const char* header)
    # tdrStyle.SetTitlePS(const char* pstitle)

    # tdrStyle.SetBarOffset(Float_t baroff = 0.5)
    # tdrStyle.SetBarWidth(Float_t barwidth = 0.5)
    # tdrStyle.SetPaintTextFormat(const char* format = "g")
    # tdrStyle.SetPalette(Int_t ncolors = 0, Int_t* colors = 0)
    # tdrStyle.SetTimeOffset(Double_t toffset)
    # tdrStyle.SetHistMinimumZero(kTRUE)

    tdrStyle.cd()
Пример #2
0
def setTDRStyle():

    tdrStyle = TStyle("tdrStyle", "Style for P-TDR")

    # For the canvas:
    tdrStyle.SetCanvasBorderMode(0)
    tdrStyle.SetCanvasColor(kWhite)
    tdrStyle.SetCanvasDefH(600)  # height of canvas
    tdrStyle.SetCanvasDefW(600)  # width of canvas
    tdrStyle.SetCanvasDefX(0)  # position on screen
    tdrStyle.SetCanvasDefY(0)

    tdrStyle.SetPadBorderMode(0)
    #tdrStyle.SetPadBorderSize(Width_t size = 1)
    tdrStyle.SetPadColor(kWhite)
    tdrStyle.SetPadGridX(False)
    tdrStyle.SetPadGridY(False)
    tdrStyle.SetGridColor(0)
    tdrStyle.SetGridStyle(3)
    tdrStyle.SetGridWidth(1)

    # For the frame:
    tdrStyle.SetFrameBorderMode(0)
    tdrStyle.SetFrameBorderSize(1)
    tdrStyle.SetFrameFillColor(0)
    tdrStyle.SetFrameFillStyle(0)
    tdrStyle.SetFrameLineColor(1)
    tdrStyle.SetFrameLineStyle(1)
    tdrStyle.SetFrameLineWidth(1)

    # For the histo:
    #tdrStyle.SetHistFillColor(1)
    #tdrStyle.SetHistFillStyle(0)
    tdrStyle.SetHistLineColor(1)
    tdrStyle.SetHistLineStyle(1)
    tdrStyle.SetHistLineWidth(1)
    #tdrStyle.SetLegoInnerR(Float_t rad = 0.5)
    #tdrStyle.SetNumberContours(Int_t number = 20)

    tdrStyle.SetEndErrorSize(2)
    #tdrStyle.SetErrorMarker(20)
    tdrStyle.SetErrorX(0)
    tdrStyle.SetMarkerStyle(20)

    # For the fit/function:
    tdrStyle.SetOptFit(1)
    tdrStyle.SetFitFormat("5.4g")
    tdrStyle.SetFuncColor(2)
    tdrStyle.SetFuncStyle(1)
    tdrStyle.SetFuncWidth(1)

    # For the date:
    tdrStyle.SetOptDate(0)
    #tdrStyle.SetDateX(Float_t x = 0.01)
    #tdrStyle.SetDateY(Float_t y = 0.01)

    # For the statistics box:
    tdrStyle.SetOptFile(0)
    tdrStyle.SetOptStat(0)  # to display the mean and RMS:   SetOptStat("mr")
    tdrStyle.SetStatColor(kWhite)
    tdrStyle.SetStatFont(42)
    tdrStyle.SetStatFontSize(0.025)
    tdrStyle.SetStatTextColor(1)
    tdrStyle.SetStatFormat("6.4g")
    tdrStyle.SetStatBorderSize(1)
    tdrStyle.SetStatH(0.1)
    tdrStyle.SetStatW(0.15)
    #tdrStyle.SetStatStyle(Style_t style = 1001)
    #tdrStyle.SetStatX(Float_t x = 0)
    #tdrStyle.SetStatY(Float_t y = 0)

    # For pad margins:
    tdrStyle.SetPadTopMargin(0.05)
    tdrStyle.SetPadBottomMargin(0.13)
    tdrStyle.SetPadLeftMargin(0.16)
    tdrStyle.SetPadRightMargin(0.02)

    # For the Global title:
    tdrStyle.SetOptTitle(0)
    tdrStyle.SetTitleFont(42)
    tdrStyle.SetTitleColor(1)
    tdrStyle.SetTitleTextColor(1)
    tdrStyle.SetTitleFillColor(10)
    tdrStyle.SetTitleFontSize(0.05)
    #tdrStyle.SetTitleH(0) # set the height of the title box
    #tdrStyle.SetTitleW(0) # set the width of the title box
    #tdrStyle.SetTitleX(0) # set the position of the title box
    #tdrStyle.SetTitleY(0.985) # set the position of the title box
    #tdrStyle.SetTitleStyle(Style_t style = 1001)
    #tdrStyle.SetTitleBorderSize(2)

    # For the axis titles:
    tdrStyle.SetTitleColor(1, 'XYZ')
    tdrStyle.SetTitleFont(42, 'XYZ')
    tdrStyle.SetTitleSize(0.06, 'XYZ')
    # tdrStyle.SetTitleXSize(Float_t size = 0.02) # another way to set the size?
    # tdrStyle.SetTitleYSize(Float_t size = 0.02)
    tdrStyle.SetTitleXOffset(0.9)
    tdrStyle.SetTitleYOffset(1.25)
    # tdrStyle.SetTitleOffset(1.1, 'Y') # another way to set the Offset

    # For the axis labels:
    tdrStyle.SetLabelColor(1, 'XYZ')
    tdrStyle.SetLabelFont(42, 'XYZ')
    tdrStyle.SetLabelOffset(0.007, 'XYZ')
    tdrStyle.SetLabelSize(0.05, 'XYZ')

    # For the axis:
    tdrStyle.SetAxisColor(1, 'XYZ')
    tdrStyle.SetStripDecimals(True)
    tdrStyle.SetTickLength(0.03, 'XYZ')
    tdrStyle.SetNdivisions(510, 'XYZ')
    tdrStyle.SetPadTickX(
        1)  # to get tick marks on the opposite side of the frame
    tdrStyle.SetPadTickY(1)

    # Change for log plots:
    tdrStyle.SetOptLogx(0)
    tdrStyle.SetOptLogy(0)
    tdrStyle.SetOptLogz(0)

    # Postscript options:
    tdrStyle.SetPaperSize(20., 20.)
    #tdrStyle.SetLineScalePS(Float_t scale = 3)
    #tdrStyle.SetLineStyleString(Int_t i, const char* text)
    #tdrStyle.SetHeaderPS(const char* header)
    #tdrStyle.SetTitlePS(const char* pstitle)

    #tdrStyle.SetBarOffset(Float_t baroff = 0.5)
    #tdrStyle.SetBarWidth(Float_t barwidth = 0.5)
    #tdrStyle.SetPaintTextFormat(const char* format = "g")
    #tdrStyle.SetPalette(Int_t ncolors = 0, Int_t* colors = 0)
    #tdrStyle.SetTimeOffset(Double_t toffset)
    #tdrStyle.SetHistMinimumZero(True)

    tdrStyle.SetHatchesLineWidth(5)
    tdrStyle.SetHatchesSpacing(0.05)

    tdrStyle.cd()
Пример #3
0
def setTDRStyle():
    """Function to setup a TDR-like style"""

    tdrStyle = TStyle("tdrStyle", "Style for P-TDR")

    # For the canvas:
    tdrStyle.SetCanvasBorderMode(0)
    tdrStyle.SetCanvasColor(kWhite)
    tdrStyle.SetCanvasDefH(600)  #Height of canvas
    tdrStyle.SetCanvasDefW(600)  #Width of canvas
    tdrStyle.SetCanvasDefX(0)  #Position on screen
    tdrStyle.SetCanvasDefY(0)

    # For the Pad:
    tdrStyle.SetPadBorderMode(0)
    tdrStyle.SetPadColor(kWhite)
    tdrStyle.SetPadGridX(False)
    tdrStyle.SetPadGridY(False)
    tdrStyle.SetGridColor(kWhite)
    tdrStyle.SetGridStyle(3)
    tdrStyle.SetGridWidth(1)
    tdrStyle.SetPadTickX(True)
    tdrStyle.SetPadTickY(True)

    # For the frame:
    tdrStyle.SetFrameBorderMode(0)
    tdrStyle.SetFrameBorderSize(1)
    tdrStyle.SetFrameFillColor(0)
    tdrStyle.SetFrameFillStyle(0)
    tdrStyle.SetFrameLineColor(1)
    tdrStyle.SetFrameLineStyle(1)
    tdrStyle.SetFrameLineWidth(0)

    # For the histo:
    tdrStyle.SetHistLineColor(1)
    tdrStyle.SetHistLineStyle(0)
    tdrStyle.SetHistLineWidth(1)
    tdrStyle.SetEndErrorSize(1)
    #tdrStyle.SetErrorX(0.)
    tdrStyle.SetMarkerStyle(20)

    #For the fit/function:
    tdrStyle.SetOptFit(0)
    tdrStyle.SetFitFormat("5.4g")
    tdrStyle.SetFuncColor(2)
    tdrStyle.SetFuncStyle(1)
    tdrStyle.SetFuncWidth(1)

    #For the date:
    tdrStyle.SetOptDate(0)

    # For the statistics box:
    tdrStyle.SetOptFile(0)
    tdrStyle.SetOptStat(0)
    # To display the mean and RMS:   SetOptStat("mr")
    tdrStyle.SetStatColor(kWhite)
    tdrStyle.SetStatFont(42)
    tdrStyle.SetStatFontSize(0.025)
    tdrStyle.SetStatTextColor(1)
    tdrStyle.SetStatFormat("6.4g")
    tdrStyle.SetStatBorderSize(1)
    tdrStyle.SetStatH(0.1)
    tdrStyle.SetStatW(0.15)

    # Margins:
    tdrStyle.SetPadTopMargin(0.05)
    tdrStyle.SetPadBottomMargin(0.1)
    tdrStyle.SetPadLeftMargin(0.12)
    tdrStyle.SetPadRightMargin(0.05)

    # For the Global title:
    tdrStyle.SetOptTitle(1)
    tdrStyle.SetTitleFont(42)
    tdrStyle.SetTitleColor(1)
    tdrStyle.SetTitleTextColor(1)
    tdrStyle.SetTitleFillColor(10)
    tdrStyle.SetTitleFontSize(0.0525)
    tdrStyle.SetTitleH(0)
    # Set the height of the title box
    tdrStyle.SetTitleW(0)
    # Set the width of the title box
    tdrStyle.SetTitleX(0.5)
    # Set the position of the title box
    tdrStyle.SetTitleY(1.0)
    # Set the position of the title box
    tdrStyle.SetTitleStyle(1001)
    tdrStyle.SetTitleBorderSize(0)
    tdrStyle.SetTitleAlign(23)

    # For the axis titles:
    tdrStyle.SetTitleColor(1, "XYZ")
    tdrStyle.SetTitleFont(42, "XYZ")
    tdrStyle.SetTitleSize(0.05, "XY")
    tdrStyle.SetTitleSize(0.035, "Z")
    tdrStyle.SetTitleXOffset(1.0)
    tdrStyle.SetTitleYOffset(1.0)

    # For the axis labels:
    tdrStyle.SetLabelColor(1, "XYZ")
    tdrStyle.SetLabelFont(42, "XYZ")
    tdrStyle.SetLabelOffset(5e-3, "XYZ")
    tdrStyle.SetLabelSize(0.03, "XYZ")

    # For the axis:
    tdrStyle.SetAxisColor(1, "XYZ")
    tdrStyle.SetStripDecimals(kTRUE)
    tdrStyle.SetTickLength(0.03, "XYZ")
    tdrStyle.SetNdivisions(510, "XYZ")
    tdrStyle.SetPadTickX(
        1)  # To get tick marks on the opposite side of the frame
    tdrStyle.SetPadTickY(1)

    # Change for log plots:
    tdrStyle.SetOptLogx(0)
    tdrStyle.SetOptLogy(0)
    tdrStyle.SetOptLogz(0)

    # Miscellaneous
    tdrStyle.SetLegendBorderSize(0)

    # Postscript options:
    tdrStyle.SetPaperSize(20., 20.)

    tdrStyle.cd()
Пример #4
0
def setStyle():

    style = TStyle('style', 'style')

    style.SetCanvasBorderMode(0)
    style.SetCanvasColor(ROOT.kWhite)
    style.SetCanvasDefH(600)
    style.SetCanvasDefW(600)
    style.SetCanvasDefX(0)
    style.SetCanvasDefY(0)

    style.SetPadBorderMode(0)
    style.SetPadColor(ROOT.kWhite)
    style.SetPadGridX(False)
    style.SetPadGridY(False)
    style.SetGridColor(0)
    style.SetGridStyle(3)
    style.SetGridWidth(1)

    style.SetFrameBorderMode(0)
    style.SetFrameBorderSize(1)
    style.SetFrameFillColor(0)
    style.SetFrameFillStyle(0)
    style.SetFrameLineColor(1)
    style.SetFrameLineStyle(1)
    style.SetFrameLineWidth(1)

    style.SetHistLineColor(1)
    style.SetHistLineStyle(0)
    style.SetHistLineWidth(1)

    style.SetEndErrorSize(2)
    style.SetMarkerStyle(20)

    #//For the fit/function:
    #gStyle->SetOptFit(1);
    #gStyle->SetFitFormat("5.4g");
    #gStyle->SetFuncColor(2);
    #gStyle->SetFuncStyle(1);
    #gStyle->SetFuncWidth(1);

    #//For the date:
    #gStyle->SetOptDate(0);
    #// gStyle->SetDateX(Float_t x = 0.01);
    #// gStyle->SetDateY(Float_t y = 0.01);

    #// For the statistics box:
    style.SetOptFile(0)
    style.SetOptStat(0)
    style.SetStatColor(ROOT.kWhite)
    style.SetStatFont(42)
    style.SetLegendFont(42)
    style.SetStatFontSize(0.08)
    style.SetStatTextColor(1)
    style.SetStatFormat("6.4g")
    style.SetStatBorderSize(1)
    style.SetStatH(0.7)
    style.SetStatW(0.15)
    #//gStyle->SetStatTextSize(2.5);

    #gStyle->SetStatX(0.96);
    #//gStyle->SetStatY(0.35);
    #// gStyle->SetStatStyle(Style_t style = 1001);
    #// gStyle->SetStatX(Float_t x = 0);
    #// gStyle->SetStatY(Float_t y = 0);

    #Margins:
    style.SetPadTopMargin(0.05)
    style.SetPadBottomMargin(0.13)
    style.SetPadLeftMargin(0.16)
    style.SetPadRightMargin(0.04)

    # For the Global title:
    style.SetOptTitle(0)
    style.SetTitleFont(42)
    style.SetTitleColor(1)
    style.SetTitleTextColor(1)
    style.SetTitleFillColor(10)
    style.SetTitleFontSize(0.05)

    #For the axis titles:
    style.SetTitleColor(1, "XYZ")
    style.SetTitleFont(42, "XYZ")
    style.SetTitleSize(0.06, "XYZ")
    style.SetTitleXOffset(0.9)
    style.SetTitleYOffset(1.25)

    #For the axis labels:
    style.SetLabelColor(1, "XYZ")
    style.SetLabelFont(42, "XYZ")
    style.SetLabelOffset(0.007, "XYZ")
    style.SetLabelSize(0.05, "XYZ")

    #For the axis:
    style.SetAxisColor(1, "XYZ")
    style.SetStripDecimals(ROOT.kTRUE)
    style.SetTickLength(0.03, "XYZ")
    style.SetNdivisions(505, "XYZ")
    style.SetPadTickX(1)
    style.SetPadTickY(1)

    style.SetEndErrorSize(0.)

    ##Change for log plots:
    #gStyle->SetOptLogx(0);
    #gStyle->SetOptLogy(0);
    #gStyle->SetOptLogz(0);

    #// Postscript options:
    #gStyle->SetPaperSize(20.,20.);
    #// gStyle->SetLineScalePS(Float_t scale = 3);
    #// gStyle->SetLineStyleString(Int_t i, const char* text);
    #// gStyle->SetHeaderPS(const char* header);
    #// gStyle->SetTitlePS(const char* pstitle);

    #// gStyle->SetBarOffset(Float_t baroff = 0.5);
    #// gStyle->SetBarWidth(Float_t barwidth = 0.5);
    #// gStyle->SetPaintTextFormat(const char* format = "g");
    #// gStyle->SetPalette(Int_t ncolors = 0, Int_t* colors = 0);
    #// gStyle->SetTimeOffset(Double_t toffset);
    #// gStyle->SetHistMinimumZero(kTRUE);

    #//For error in SF maps
    #gStyle->SetMarkerSize(0.9); //TEMPORARY SIZE FOR DILEPTON PLOTS. SET BACK TO DEFAULT FOR TRILEPTON
    #gStyle->SetPaintTextFormat("4.2f");  //4.2
    #//gStyle->SetHatchesLineWidth(5);
    #//gStyle->SetHatchesSpacing(0.05);

    style.SetLegendBorderSize(0)
    gROOT.SetStyle('style')
    gROOT.ForceStyle()

    return style
Пример #5
0
def setTDRStyle():
    import ROOT
    from ROOT import TStyle
    from ROOT import kWhite
    from ROOT import kTRUE
    
    
    
    
    tdrStyle =  TStyle("tdrStyle","Style for P-TDR")
    
    # For the canvas:
    tdrStyle.SetCanvasBorderMode(0)
    tdrStyle.SetCanvasColor(kWhite)
    # For the canvas:
    tdrStyle.SetCanvasBorderMode(0)
    tdrStyle.SetCanvasColor(kWhite)
    tdrStyle.SetCanvasDefH(600) #Height of canvas
    tdrStyle.SetCanvasDefW(600)#Width of canvas
    tdrStyle.SetCanvasDefX(0)  #POsition on screen
    tdrStyle.SetCanvasDefY(0)
    
    # For the Pad:
    tdrStyle.SetPadBorderMode(0)
    # tdrStyle->SetPadBorderSize(Width_t size = 1);
    tdrStyle.SetPadColor(kWhite)
    tdrStyle.SetPadGridX(0)
    tdrStyle.SetPadGridY(0)
    tdrStyle.SetGridColor(0)
    tdrStyle.SetGridStyle(3)
    tdrStyle.SetGridWidth(1)
    
    # For the frame:
    tdrStyle.SetFrameBorderMode(0)
    tdrStyle.SetFrameBorderSize(1)
    tdrStyle.SetFrameFillColor(0)
    tdrStyle.SetFrameFillStyle(0)
    tdrStyle.SetFrameLineColor(1)
    tdrStyle.SetFrameLineStyle(1)
    tdrStyle.SetFrameLineWidth(1)
    
    # For the histo:
    # tdrStyle->SetHistFillColor(1);
    # tdrStyle->SetHistFillStyle(0);
    tdrStyle.SetHistLineColor(1)
    tdrStyle.SetHistLineStyle(0)
    tdrStyle.SetHistLineWidth(1)
    # tdrStyle->SetLegoInnerR(Float_t rad = 0.5);
    
    # define the palette for z axis
    palette = []
    NRGBs = 5
    NCont = 255
    stops = array("d",[0.00,0.34,0.61,0.84,1.00])
    red = array("d",[0.50,0.50,1.00,1.00,1.00])
    green = array("d",[0.50,1.00,1.00,0.60,0.50])
    blue = array("d",[1.00,1.00,0.50,0.40,0.50])
    FI = ROOT.TColor.CreateGradientColorTable(NRGBs,stops,red,green,blue,NCont)
    for i in range(0,NCont):
        palette.append(FI+i)
    tdrStyle.SetPalette(NCont,array("i",palette));
    tdrStyle.SetNumberContours(NCont);
    
    tdrStyle.SetEndErrorSize(2)
    #  tdrStyle->SetErrorMarker(20);
    tdrStyle.SetErrorX(0.)
    
    tdrStyle.SetMarkerStyle(20)
    
    #For the fit/function:
    tdrStyle.SetOptFit(0)
    tdrStyle.SetFitFormat("5.4g")
    tdrStyle.SetFuncColor(2)
    tdrStyle.SetFuncStyle(1)
    tdrStyle.SetFuncWidth(1)
    
    #For the date:
    tdrStyle.SetOptDate(0)
    # tdrStyle->SetDateX(Float_t x = 0.01);
    # tdrStyle->SetDateY(Float_t y = 0.01);
    
    # For the statistics box:
    tdrStyle.SetOptFile(0)
    tdrStyle.SetOptStat(0) # To display the mean and RMS:   SetOptStat("mr");
    tdrStyle.SetStatColor(kWhite)
    tdrStyle.SetStatFont(42)
    tdrStyle.SetStatFontSize(0.025)
    tdrStyle.SetStatTextColor(1)
    tdrStyle.SetStatFormat("6.4g")
    tdrStyle.SetStatBorderSize(1)
    tdrStyle.SetStatH(0.1)
    tdrStyle.SetStatW(0.15)
    # tdrStyle->SetStatStyle(Style_t style = 100.1);
    # tdrStyle->SetStatX(Float_t x = 0);
    # tdrStyle->SetStatY(Float_t y = 0);
    
    # Margins:
    tdrStyle.SetPadTopMargin(0.05)
    tdrStyle.SetPadBottomMargin(0.14)
    tdrStyle.SetPadLeftMargin(0.16)
    tdrStyle.SetPadRightMargin(0.05)
    
    # For the Global title:
    tdrStyle.SetOptTitle(0)
    tdrStyle.SetTitleFont(42)
    tdrStyle.SetTitleColor(1)
    tdrStyle.SetTitleTextColor(1)
    tdrStyle.SetTitleFillColor(10)
    tdrStyle.SetTitleFontSize(0.05)
    # tdrStyle->SetTitleH(0); # Set the height of the title box
    # tdrStyle->SetTitleW(0); # Set the width of the title box
    # tdrStyle->SetTitleX(0); # Set the position of the title box
    # tdrStyle->SetTitleY(0.985); # Set the position of the title box
    # tdrStyle->SetTitleStyle(Style_t style = 100.1);
    # tdrStyle->SetTitleBorderSize(2);
    
    # For the axis titles:
    tdrStyle.SetTitleColor(1, "XYZ")
    tdrStyle.SetTitleFont(42, "XYZ")
    tdrStyle.SetTitleSize(0.06, "XYZ")
    # tdrStyle->SetTitleXSize(Float_t size = 0.02); # Another way to set the size?
    # tdrStyle->SetTitleYSize(Float_t size = 0.02);
    tdrStyle.SetTitleXOffset(0.95)
    tdrStyle.SetTitleYOffset(1.3)
    # tdrStyle->SetTitleOffset(1.1, "Y"); # Another way to set the Offset
    
    # For the axis labels:
    tdrStyle.SetLabelColor(1, "XYZ")
    tdrStyle.SetLabelFont(42, "XYZ")
    tdrStyle.SetLabelOffset(0.007, "XYZ")
    tdrStyle.SetLabelSize(0.05, "XYZ")
    
    # For the axis:
    tdrStyle.SetAxisColor(1, "XYZ")
    tdrStyle.SetStripDecimals(kTRUE)
    tdrStyle.SetTickLength(0.03, "XYZ")
    tdrStyle.SetNdivisions(408, "XYZ")
    
    #~ tdrStyle->SetNdivisions(510, "XYZ");
    tdrStyle.SetPadTickX(1)  # To get tick marks on the opposite side of the frame
    tdrStyle.SetPadTickY(1)
    
    # Change for log plots:
    tdrStyle.SetOptLogx(0)
    tdrStyle.SetOptLogy(0)
    tdrStyle.SetOptLogz(0)
    
    # Postscript options:
    tdrStyle.SetPaperSize(20.,20.);
    # tdrStyle->SetLineScalePS(Float_t scale = 3);
    # tdrStyle->SetLineStyleString(Int_t i, const char* text);
    # tdrStyle->SetHeaderPS(const char* header);
    # tdrStyle->SetTitlePS(const char* pstitle);
    
    #tdrStyle->SetBarOffset(Float_t baroff = 0.5);
    #tdrStyle->SetBarWidth(Float_t barwidth = 0.5);
    #tdrStyle->SetPaintTextFormat(const char* format = "g");
    #~ tdrStyle.SetPalette(1)
    #tdrStyle->SetTimeOffset(Double_t toffset);
    #tdrStyle->SetHistMinimumZero(kTRUE);
    
    
    
        
    ROOT.gROOT.ForceStyle()
    
    tdrStyle.cd()
    return tdrStyle
Пример #6
0
def looks_CmsTDR():
    tdrStyle = TStyle("tdrStyle", "Style for P-TDR")

    # For the canvas:
    tdrStyle.SetCanvasBorderMode(0)
    tdrStyle.SetCanvasColor(ROOT.kWhite)
    tdrStyle.SetCanvasDefH(600)
    #Height of canvas
    tdrStyle.SetCanvasDefW(600)
    #Width of canvas
    tdrStyle.SetCanvasDefX(0)
    #POsition on screen
    tdrStyle.SetCanvasDefY(0)

    # For the Pad:
    tdrStyle.SetPadBorderMode(0)
    # tdrStyle.SetPadBorderSize(Width_t size = 1);
    tdrStyle.SetPadColor(ROOT.kWhite)
    #tdrStyle.SetPadGridX(false);
    #tdrStyle.SetPadGridY(false);
    tdrStyle.SetGridColor(0)
    tdrStyle.SetGridStyle(3)
    tdrStyle.SetGridWidth(1)

    # For the frame:
    tdrStyle.SetFrameBorderMode(0)
    tdrStyle.SetFrameBorderSize(1)
    tdrStyle.SetFrameFillColor(0)
    tdrStyle.SetFrameFillStyle(0)
    tdrStyle.SetFrameLineColor(1)
    tdrStyle.SetFrameLineStyle(1)
    tdrStyle.SetFrameLineWidth(1)

    # For the histo:
    # tdrStyle.SetHistFillColor(1);
    # tdrStyle.SetHistFillStyle(0);
    tdrStyle.SetHistLineColor(1)
    tdrStyle.SetHistLineStyle(0)
    tdrStyle.SetHistLineWidth(1)
    # tdrStyle.SetLegoInnerR(Float_t rad = 0.5);
    # tdrStyle.SetNumberContours(Int_t number = 20);

    tdrStyle.SetEndErrorSize(2)
    #tdrStyle.SetErrorMarker(20);  # Seems to give an error
    tdrStyle.SetErrorX(0.)

    tdrStyle.SetMarkerStyle(20)

    #For the fit/function:
    tdrStyle.SetOptFit(1)
    tdrStyle.SetFitFormat("5.4g")
    tdrStyle.SetFuncColor(2)
    tdrStyle.SetFuncStyle(1)
    tdrStyle.SetFuncWidth(1)

    #For the date:
    tdrStyle.SetOptDate(0)
    # tdrStyle.SetDateX(Float_t x = 0.01);
    # tdrStyle.SetDateY(Float_t y = 0.01);

    # For the statistics box:
    tdrStyle.SetOptFile(0)
    tdrStyle.SetOptStat(0)
    # To display the mean and RMS:   SetOptStat("mr");
    tdrStyle.SetStatColor(ROOT.kWhite)
    tdrStyle.SetStatFont(42)
    tdrStyle.SetStatFontSize(0.025)
    tdrStyle.SetStatTextColor(1)
    tdrStyle.SetStatFormat("6.4g")
    tdrStyle.SetStatBorderSize(1)
    tdrStyle.SetStatH(0.1)
    tdrStyle.SetStatW(0.15)
    # tdrStyle.SetStatStyle(Style_t style = 1001);
    # tdrStyle.SetStatX(Float_t x = 0);
    # tdrStyle.SetStatY(Float_t y = 0);

    # Margins:
    tdrStyle.SetPadTopMargin(0.05)
    tdrStyle.SetPadBottomMargin(0.13)
    tdrStyle.SetPadLeftMargin(0.16)
    tdrStyle.SetPadRightMargin(0.02)

    # For the Global title:
    tdrStyle.SetOptTitle(1)
    # 0=No Title
    tdrStyle.SetTitleFont(42)
    tdrStyle.SetTitleColor(1)
    tdrStyle.SetTitleTextColor(1)
    tdrStyle.SetTitleFillColor(10)
    tdrStyle.SetTitleFontSize(0.05)
    # tdrStyle.SetTitleH(0); # Set the height of the title box
    # tdrStyle.SetTitleW(0); # Set the width of the title box
    # tdrStyle.SetTitleX(0); # Set the position of the title box
    # tdrStyle.SetTitleY(0.985); # Set the position of the title box
    # tdrStyle.SetTitleStyle(Style_t style = 1001);
    # tdrStyle.SetTitleBorderSize(2);

    # For the axis titles:
    tdrStyle.SetTitleColor(1, "XYZ")
    tdrStyle.SetTitleFont(42, "XYZ")
    tdrStyle.SetTitleSize(0.06, "XYZ")
    # tdrStyle.SetTitleXSize(Float_t size = 0.02); # Another way to set the size?
    # tdrStyle.SetTitleYSize(Float_t size = 0.02);
    tdrStyle.SetTitleXOffset(0.9)
    tdrStyle.SetTitleYOffset(1.25)
    # tdrStyle.SetTitleOffset(1.1, "Y"); # Another way to set the Offset

    # For the axis labels:
    tdrStyle.SetLabelColor(1, "XYZ")
    tdrStyle.SetLabelFont(42, "XYZ")
    tdrStyle.SetLabelOffset(0.007, "XYZ")
    tdrStyle.SetLabelSize(0.05, "XYZ")

    # For the axis:
    tdrStyle.SetAxisColor(1, "XYZ")
    tdrStyle.SetStripDecimals(ROOT.kTRUE)
    tdrStyle.SetTickLength(0.03, "XYZ")
    tdrStyle.SetNdivisions(510, "XYZ")
    tdrStyle.SetPadTickX(0)
    # 0=Text labels (and tics) only on bottom, 1=Text labels on top and bottom
    tdrStyle.SetPadTickY(1)

    # Change for log plots:
    tdrStyle.SetOptLogx(0)
    tdrStyle.SetOptLogy(0)
    tdrStyle.SetOptLogz(0)

    # Postscript options:
    tdrStyle.SetPaperSize(20., 20.)
    # tdrStyle.SetLineScalePS(Float_t scale = 3);
    # tdrStyle.SetLineStyleString(Int_t i, const char* text);
    # tdrStyle.SetHeaderPS(const char* header);
    # tdrStyle.SetTitlePS(const char* pstitle);

    # tdrStyle.SetBarOffset(Float_t baroff = 0.5);
    # tdrStyle.SetBarWidth(Float_t barwidth = 0.5);
    # tdrStyle.SetPaintTextFormat(const char* format = "g");
    # tdrStyle.SetPalette(Int_t ncolors = 0, Int_t* colors = 0);
    # tdrStyle.SetTimeOffset(Double_t toffset);
    # tdrStyle.SetHistMinimumZero(kTRUE);

    tdrStyle.cd()
    gROOT.ForceStyle()
    # Try this if stuff doesn't work right
    gStyle.ls()
Пример #7
0
def officialStyle(style):
    style =  TStyle("tdrStyle","Style for P-TDR")

    style.SetCanvasColor (0)
    style.SetCanvasBorderSize(10)
    style.SetCanvasBorderMode(0)
    style.SetCanvasDefH (700)
    style.SetCanvasDefW (700)
    style.SetCanvasDefX (100)
    style.SetCanvasDefY (100)
    # color palette for 2D temperature plots
    # style.SetPalette(1,0)
    # Pads
    style.SetPadColor (0)
    style.SetPadBorderSize (10)
    style.SetPadBorderMode (0)
    
    style.SetPadBottomMargin(0.15)
    style.SetPadTopMargin (0.05)
    style.SetPadLeftMargin (0.17)
    # style.SetPadRightMargin (0.03566265)
    style.SetPadRightMargin (0.065)
    style.SetPadGridX (0)
    style.SetPadGridY (0)
    style.SetPadTickX (1)
    style.SetPadTickY (1)
    # Frames
    style.SetLineWidth(3)
    style.SetFrameFillStyle ( 0)
    style.SetFrameFillColor ( 0)
    style.SetFrameLineColor ( 1)
    style.SetFrameLineStyle ( 0)
    style.SetFrameLineWidth ( 2)
    style.SetFrameBorderSize(10)
    style.SetFrameBorderMode( 0)
    # Histograms
    style.SetHistFillColor(2)
    style.SetHistFillStyle(0)
    style.SetHistLineColor(1)
    style.SetHistLineStyle(0)
    style.SetHistLineWidth(3)
    style.SetNdivisions(505)
    # Functions
    style.SetFuncColor(1)
    style.SetFuncStyle(0)
    style.SetFuncWidth(2)
    # Various
    style.SetMarkerStyle(20)
    style.SetMarkerColor(kBlack)
    style.SetMarkerSize (1.4)
    style.SetTitleBorderSize(0)
    style.SetTitleFillColor (0)
    style.SetTitleX (0.2)
    style.SetTitleSize (0.055,"X")
    style.SetTitleOffset(1.100,"X")
    style.SetLabelOffset(0.005,"X")
    style.SetLabelSize (0.050,"X")
    style.SetLabelFont (42 ,"X")
    style.SetStripDecimals(False)
    style.SetLineStyleString(11,"20 10")
    style.SetTitleSize (0.055,"Y")
    style.SetTitleOffset(1.5,"Y")
    style.SetLabelOffset(0.010,"Y")
    style.SetLabelSize (0.050,"Y")
    style.SetLabelFont (42 ,"Y")
    style.SetTextSize (0.055)
    style.SetTextFont (42)
    style.SetStatFont (42)
    style.SetTitleFont (42)
    style.SetTitleFont (42,"X")
    style.SetTitleFont (42,"Y")
    style.SetOptStat (0)

    style.SetLegendBorderSize(0)
    style.cd()
Пример #8
0
def setStyle():
    print "setting TDR style"

    tdrStyle = TStyle("tdrStyle","Style for P-TDR")

    kWhite = 0

    tdrStyle.SetPalette(1)

    tdrStyle.SetCanvasBorderMode(0)
    tdrStyle.SetCanvasColor(kWhite)
    tdrStyle.SetCanvasDefH(800) 
    tdrStyle.SetCanvasDefW(1000) 
    tdrStyle.SetCanvasDefX(0)   
    tdrStyle.SetCanvasDefY(0)

    tdrStyle.SetPadBorderMode(0)
    tdrStyle.SetPadColor(kWhite)
    tdrStyle.SetPadGridX(False)
    tdrStyle.SetPadGridY(False)
    tdrStyle.SetGridColor(0)
    tdrStyle.SetGridStyle(3)
    tdrStyle.SetGridWidth(1)

    tdrStyle.SetFrameBorderMode(0)
    tdrStyle.SetFrameBorderSize(1)
    tdrStyle.SetFrameFillColor(0)
    tdrStyle.SetFrameFillStyle(0)
    tdrStyle.SetFrameLineColor(1)
    tdrStyle.SetFrameLineStyle(1)
    tdrStyle.SetFrameLineWidth(1)

    tdrStyle.SetHistFillColor(0)
    tdrStyle.SetHistLineColor(1)
    tdrStyle.SetHistLineStyle(0)
    tdrStyle.SetHistLineWidth(1)

    tdrStyle.SetErrorX(0.)

    tdrStyle.SetMarkerStyle(20)

    tdrStyle.SetOptFit(1)
    tdrStyle.SetFitFormat("5.4g")
    tdrStyle.SetFuncColor(2)
    tdrStyle.SetFuncStyle(1)
    tdrStyle.SetFuncWidth(1)

    tdrStyle.SetOptDate(0)

    tdrStyle.SetOptFile(0)
    #tdrStyle.SetOptStat(0111) 
    tdrStyle.SetOptStat(0) 
    tdrStyle.SetStatColor(kWhite)
    tdrStyle.SetStatFont(42)
    tdrStyle.SetStatFontSize(0.025)
    tdrStyle.SetStatTextColor(1)
    tdrStyle.SetStatFormat("6.4g")
    tdrStyle.SetStatBorderSize(0)
    tdrStyle.SetStatH(0.1)
    tdrStyle.SetStatW(0.15)

    tdrStyle.SetPadTopMargin(0.05)
    tdrStyle.SetPadBottomMargin(0.1)
    tdrStyle.SetPadLeftMargin(0.1)
    tdrStyle.SetPadRightMargin(0.05)


    tdrStyle.SetTitleFont(42)
    tdrStyle.SetTitleColor(1)
    tdrStyle.SetTitleTextColor(1)
    tdrStyle.SetTitleFillColor(10)
    tdrStyle.SetTitleFontSize(0.05)

    tdrStyle.SetTitleColor(1, "XYZ")
    tdrStyle.SetTitleFont(42, "XYZ")
    tdrStyle.SetTitleSize(0.06, "XYZ")
    tdrStyle.SetTitleXOffset(0.9)
    tdrStyle.SetTitleYOffset(1.05)

    tdrStyle.SetLabelColor(1, "XYZ")
    tdrStyle.SetLabelFont(42, "XYZ")
    tdrStyle.SetLabelOffset(0.007, "XYZ")
    tdrStyle.SetLabelSize(0.05, "XYZ")

    tdrStyle.SetAxisColor(1, "XYZ")
    tdrStyle.SetStripDecimals(1)
    tdrStyle.SetTickLength(0.03, "XYZ")
    tdrStyle.SetNdivisions(505, "XYZ")
    tdrStyle.SetPadTickX(1)
    tdrStyle.SetPadTickY(1)

    tdrStyle.SetOptLogx(0)
    tdrStyle.SetOptLogy(0)
    tdrStyle.SetOptLogz(0)
    tdrStyle.cd()
Пример #9
0
def setTDRStyle():
    tdrStyle = TStyle("tdrStyle", "Style for P-TDR")
    tdrStyle.SetCanvasBorderMode(0)
    #    tdrStyle.SetCanvasColor(kWhite)
    tdrStyle.SetCanvasColor(0)
    tdrStyle.SetCanvasDefH(600)
    tdrStyle.SetCanvasDefW(600)
    tdrStyle.SetCanvasDefX(0)
    tdrStyle.SetCanvasDefY(0)

    tdrStyle.SetPadBorderMode(0)
    #    tdrStyle.SetPadColor(kWhite)
    tdrStyle.SetPadColor(0)
    #    tdrStyle.SetPadGridX(kFALSE)
    tdrStyle.SetPadGridX(0)
    #    tdrStyle.SetPadGridY(false)
    tdrStyle.SetPadGridY(0)
    tdrStyle.SetGridColor(0)
    tdrStyle.SetGridStyle(3)
    tdrStyle.SetGridWidth(1)

    tdrStyle.SetFrameBorderMode(0)
    tdrStyle.SetFrameBorderSize(1)
    tdrStyle.SetFrameFillColor(0)
    tdrStyle.SetFrameFillStyle(0)
    tdrStyle.SetFrameLineColor(1)
    tdrStyle.SetFrameLineStyle(1)
    tdrStyle.SetFrameLineWidth(1)

    tdrStyle.SetHistLineColor(1)
    tdrStyle.SetHistLineStyle(0)
    tdrStyle.SetHistLineWidth(1)

    tdrStyle.SetEndErrorSize(2)
    tdrStyle.SetErrorX(0.)

    tdrStyle.SetMarkerStyle(20)

    tdrStyle.SetOptFit(0)
    tdrStyle.SetFitFormat("5.4g")
    tdrStyle.SetFuncColor(2)
    tdrStyle.SetFuncStyle(1)
    tdrStyle.SetFuncWidth(1)

    tdrStyle.SetOptDate(0)

    tdrStyle.SetOptFile(0)
    tdrStyle.SetOptStat(0000000)
    tdrStyle.SetStatColor(0)
    tdrStyle.SetStatFont(42)
    tdrStyle.SetStatFontSize(0.025)
    tdrStyle.SetStatTextColor(1)
    tdrStyle.SetStatFormat("6.4g")
    tdrStyle.SetStatBorderSize(1)
    tdrStyle.SetStatH(0.1)
    tdrStyle.SetStatW(0.15)

    tdrStyle.SetPadTopMargin(0.07)
    #    tdrStyle.SetPadBottomMargin(0.13)
    tdrStyle.SetPadBottomMargin(0.16)
    tdrStyle.SetPadLeftMargin(0.16)
    #    tdrStyle.SetPadRightMargin(0.02)
    tdrStyle.SetPadRightMargin(0.06)

    tdrStyle.SetOptTitle(0)
    tdrStyle.SetTitleFont(42)
    tdrStyle.SetTitleColor(1)
    tdrStyle.SetTitleTextColor(1)
    tdrStyle.SetTitleFillColor(10)
    tdrStyle.SetTitleFontSize(0.05)

    tdrStyle.SetTitleColor(1, "XYZ")
    tdrStyle.SetTitleFont(42, "XYZ")
    tdrStyle.SetTitleSize(0.06, "XYZ")

    #    tdrStyle.SetTitleXOffset(0.9)
    tdrStyle.SetTitleXOffset(1.1)
    #    tdrStyle.SetTitleYOffset(1.25)
    #    tdrStyle.SetTitleYOffset(1.2)
    tdrStyle.SetTitleYOffset(1.1)

    tdrStyle.SetTitleColor(1, "XYZ")
    tdrStyle.SetTitleFont(42, "XYZ")
    tdrStyle.SetTitleSize(0.06, "XYZ")
    tdrStyle.SetTitleXOffset(1.1)
    #    tdrStyle.SetTitleYOffset(1.25)
    tdrStyle.SetTitleYOffset(1.23)

    tdrStyle.SetLabelColor(1, "XYZ")
    tdrStyle.SetLabelFont(42, "XYZ")
    tdrStyle.SetLabelOffset(0.007, "XYZ")
    #    tdrStyle.SetLabelSize(0.05, "XYZ")
    tdrStyle.SetLabelSize(0.045, "XYZ")

    tdrStyle.SetAxisColor(1, "XYZ")
    #    tdrStyle.SetStripDecimals(kTRUE)
    tdrStyle.SetStripDecimals(1)
    tdrStyle.SetTickLength(0.03, "XYZ")
    #    tdrStyle.SetNdivisions(510, "XYZ")
    tdrStyle.SetNdivisions(509, "XYZ")
    tdrStyle.SetPadTickX(1)
    tdrStyle.SetPadTickY(1)

    tdrStyle.SetOptLogx(0)
    tdrStyle.SetOptLogy(0)
    tdrStyle.SetOptLogz(0)

    tdrStyle.SetPaperSize(20., 20.)

    tdrStyle.cd()
Пример #10
0
def setStyle():

    style = TStyle( 'style', 'style' ) 
    
    style.SetCanvasBorderMode(0)
    style.SetCanvasColor(ROOT.kWhite)
    style.SetCanvasDefH(600)
    style.SetCanvasDefW(600)
    style.SetCanvasDefX(0)
    style.SetCanvasDefY(0)
    
    style.SetPadBorderMode(0)
    style.SetPadColor(ROOT.kWhite)
    style.SetPadGridX(False)
    style.SetPadGridY(False)
    style.SetGridColor(0)
    style.SetGridStyle(3)
    style.SetGridWidth(1)
    
    style.SetFrameBorderMode(0)
    style.SetFrameBorderSize(1)
    style.SetFrameFillColor(0)
    style.SetFrameFillStyle(0)
    style.SetFrameLineColor(1)
    style.SetFrameLineStyle(1)
    style.SetFrameLineWidth(1)
    
    style.SetHistLineColor(1)
    style.SetHistLineStyle(0)
    style.SetHistLineWidth(1)
    
    style.SetEndErrorSize(2)
    style.SetMarkerStyle(20)
    
    style.SetOptFile(0)
    style.SetOptStat(0)
    style.SetStatColor(ROOT.kWhite)
    style.SetStatFont(42)
    style.SetLegendFont(63) #43 to have the non-bold font
    style.SetStatFontSize(0.08)
    style.SetStatTextColor(1)
    style.SetStatFormat("6.4g")
    style.SetStatBorderSize(1)
    style.SetStatH(0.7)
    style.SetStatW(0.15)
    
    #Margins
    style.SetPadTopMargin(0.05)
    style.SetPadBottomMargin(0.13)
    style.SetPadLeftMargin(0.16)
    style.SetPadRightMargin(0.04)
    
    # For the Global title
    style.SetOptTitle(0)
    
    #For the axis titles:
    style.SetTitleColor(1, "XYZ")
    style.SetTitleFont(42, "XYZ")
    style.SetTitleSize(0.06, "XYZ")
    style.SetTitleXOffset(0.9)
    style.SetTitleYOffset(1.25)
    
    #For the axis labels:
    style.SetLabelColor(1, "XYZ")
    style.SetLabelFont(42, "XYZ")
    style.SetLabelOffset(0.007, "XYZ")
    style.SetLabelSize(0.05, "XYZ")
    
    #For the axis:
    style.SetAxisColor(1, "XYZ")
    style.SetStripDecimals(ROOT.kTRUE)
    style.SetTickLength(0.03, "XYZ")
    style.SetNdivisions(505, "XYZ")
    style.SetPadTickX(1)
    style.SetPadTickY(1)
    
    style.SetLegendBorderSize(0)
    gROOT.SetStyle('style')

    #important to force the style for histograms made before this style was set
    gROOT.ForceStyle()

    return style
Пример #11
0
def setTDRStyle():
    tdrStyle = TStyle("tdrStyle", "Style for P-TDR")

    # For the canvas:
    tdrStyle.SetCanvasBorderMode(0)
    tdrStyle.SetCanvasColor(TStyle.kWhite)
    tdrStyle.SetCanvasDefH(600)  #Height of canvas
    tdrStyle.SetCanvasDefW(600)  #Width of canvas
    tdrStyle.SetCanvasDefX(0)  #POsition on screen
    tdrStyle.SetCanvasDefY(0)

    # For the Pad:
    tdrStyle.SetPadBorderMode(0)
    # tdrStyle.SetPadBorderSize(Width_t size = 1)
    tdrStyle.SetPadColor(TStyle.kWhite)
    tdrStyle.SetPadGridX(False)
    tdrStyle.SetPadGridY(False)
    tdrStyle.SetGridColor(0)
    tdrStyle.SetGridStyle(3)
    tdrStyle.SetGridWidth(1)

    # For the frame:
    tdrStyle.SetFrameBorderMode(0)
    tdrStyle.SetFrameBorderSize(1)
    tdrStyle.SetFrameFillColor(0)
    tdrStyle.SetFrameFillStyle(0)
    tdrStyle.SetFrameLineColor(1)
    tdrStyle.SetFrameLineStyle(1)
    tdrStyle.SetFrameLineWidth(1)

    # For the histo:
    # tdrStyle.SetHistFillColor(1)
    # tdrStyle.SetHistFillStyle(0)
    tdrStyle.SetHistLineColor(1)
    tdrStyle.SetHistLineStyle(0)
    tdrStyle.SetHistLineWidth(1)
    # tdrStyle.SetLegoInnerR(Float_t rad = 0.5)
    # tdrStyle.SetNumberContours(Int_t number = 20)

    tdrStyle.SetEndErrorSize(2)
    # tdrStyle.SetErrorMarker(20)
    #tdrStyle.SetErrorX(0.)

    tdrStyle.SetMarkerStyle(20)

    #For the fit/function:
    tdrStyle.SetOptFit(1)
    tdrStyle.SetFitFormat("5.4g")
    tdrStyle.SetFuncColor(2)
    tdrStyle.SetFuncStyle(1)
    tdrStyle.SetFuncWidth(1)

    #For the date:
    tdrStyle.SetOptDate(0)
    # tdrStyle.SetDateX(Float_t x = 0.01)
    # tdrStyle.SetDateY(Float_t y = 0.01)

    # For the statistics box:
    tdrStyle.SetOptFile(0)
    tdrStyle.SetOptStat(0)  # To display the mean and RMS:   SetOptStat("mr")
    tdrStyle.SetStatColor(TStyle.kWhite)
    tdrStyle.SetStatFont(42)
    tdrStyle.SetStatFontSize(0.025)
    tdrStyle.SetStatTextColor(1)
    tdrStyle.SetStatFormat("6.4g")
    tdrStyle.SetStatBorderSize(1)
    tdrStyle.SetStatH(0.1)
    tdrStyle.SetStatW(0.15)
    # tdrStyle.SetStatStyle(Style_t style = 1001)
    # tdrStyle.SetStatX(Float_t x = 0)
    # tdrStyle.SetStatY(Float_t y = 0)

    # Margins:
    tdrStyle.SetPadTopMargin(0.05)
    tdrStyle.SetPadBottomMargin(0.13)
    tdrStyle.SetPadLeftMargin(0.16)
    tdrStyle.SetPadRightMargin(0.02)

    # For the Global title:

    tdrStyle.SetOptTitle(0)
    tdrStyle.SetTitleFont(42)
    tdrStyle.SetTitleColor(1)
    tdrStyle.SetTitleTextColor(1)
    tdrStyle.SetTitleFillColor(10)
    tdrStyle.SetTitleFontSize(0.05)
    # tdrStyle.SetTitleH(0) # Set the height of the title box
    # tdrStyle.SetTitleW(0) # Set the width of the title box
    # tdrStyle.SetTitleX(0) # Set the position of the title box
    # tdrStyle.SetTitleY(0.985) # Set the position of the title box
    # tdrStyle.SetTitleStyle(Style_t style = 1001)
    # tdrStyle.SetTitleBorderSize(2)

    # For the axis titles:

    tdrStyle.SetTitleColor(1, "XYZ")
    tdrStyle.SetTitleFont(42, "XYZ")
    tdrStyle.SetTitleSize(0.06, "XYZ")
    # tdrStyle.SetTitleXSize(Float_t size = 0.02) # Another way to set the size?
    # tdrStyle.SetTitleYSize(Float_t size = 0.02)
    tdrStyle.SetTitleXOffset(0.9)
    tdrStyle.SetTitleYOffset(1.)
    # tdrStyle.SetTitleOffset(1.1, "Y") # Another way to set the Offset

    # For the axis labels:

    tdrStyle.SetLabelColor(1, "XYZ")
    tdrStyle.SetLabelFont(42, "XYZ")
    tdrStyle.SetLabelOffset(0.007, "XYZ")
    tdrStyle.SetLabelSize(0.05, "XYZ")

    # For the axis:

    tdrStyle.SetAxisColor(1, "XYZ")
    tdrStyle.SetStripDecimals(True)
    tdrStyle.SetTickLength(0.03, "XYZ")
    tdrStyle.SetNdivisions(510, "XYZ")
    tdrStyle.SetPadTickX(
        1)  # To get tick marks on the opposite side of the frame
    tdrStyle.SetPadTickY(1)

    # Change for log plots:
    tdrStyle.SetOptLogx(0)
    tdrStyle.SetOptLogy(0)
    tdrStyle.SetOptLogz(0)

    # Postscript options:
    tdrStyle.SetPaperSize(20., 20.)

    tdrStyle.SetHatchesLineWidth(5)
    tdrStyle.SetHatchesSpacing(0.05)

    tdrStyle.cd()
Пример #12
0
tdrStyle.SetCanvasDefW(600)
tdrStyle.SetCanvasDefX(0)
tdrStyle.SetCanvasDefY(0)

tdrStyle.SetPadBorderMode(0)
tdrStyle.SetPadColor(kWhite)
tdrStyle.SetPadGridX(False)
tdrStyle.SetPadGridY(False)
tdrStyle.SetGridColor(0)
tdrStyle.SetGridStyle(3)
tdrStyle.SetGridWidth(1)

tdrStyle.SetFrameBorderMode(0)
tdrStyle.SetFrameBorderSize(1)
tdrStyle.SetFrameFillColor(0)
tdrStyle.SetFrameFillStyle(0)
tdrStyle.SetFrameLineColor(1)
tdrStyle.SetFrameLineStyle(1)
tdrStyle.SetFrameLineWidth(1)

tdrStyle.SetHistFillColor(63)
tdrStyle.SetHistLineColor(1)
tdrStyle.SetHistLineStyle(0)
tdrStyle.SetHistLineWidth(1)

tdrStyle.SetErrorX(0.)

tdrStyle.SetMarkerStyle(20)

tdrStyle.SetOptFit(1)
tdrStyle.SetFitFormat("5.4g")
Пример #13
0
def setTDRStyle():
  print("Using TDR Style")
  tdrStyle = TStyle("tdrStyle","Style for P-TDR")
  tdrStyle.SetPalette(1)
  # For the canvas:
  tdrStyle.SetCanvasBorderMode(0)
  tdrStyle.SetCanvasColor(0)
  tdrStyle.SetCanvasDefH(900) #Height of canvas
  tdrStyle.SetCanvasDefW(600) #Width of canvas
  tdrStyle.SetCanvasDefX(0)   #POsition on screen
  tdrStyle.SetCanvasDefY(0)

  # For the Pad:
  tdrStyle.SetPadBorderMode(0)
  tdrStyle.SetPadColor(0)
  #tdrStyle.SetPadGridX(false)
  #tdrStyle.SetPadGridY(false)
  tdrStyle.SetGridColor(0)
  tdrStyle.SetGridStyle(3)
  tdrStyle.SetGridWidth(1)

  # For the frame:
  tdrStyle.SetFrameBorderMode(0)
  tdrStyle.SetFrameBorderSize(1)
  tdrStyle.SetFrameFillColor(0)
  tdrStyle.SetFrameFillStyle(0)
  tdrStyle.SetFrameLineColor(1)
  tdrStyle.SetFrameLineStyle(1)
  tdrStyle.SetFrameLineWidth(1)

  # For the histo:
  #tdrStyle.SetHistFillColor(0)
  #tdrStyle.SetHistFillStyle(0)
  #tdrStyle.SetHistLineColor(1)
  #tdrStyle.SetHistLineStyle(0)
  #tdrStyle.SetHistLineWidth(1)
  
  tdrStyle.SetEndErrorSize(2)
  #tdrStyle.SetErrorMarker(20)
  #tdrStyle.SetErrorX(0.)
  
  tdrStyle.SetMarkerStyle(20)

  #For the fit/function:
  #tdrStyle.SetOptFit(0010) # display fit parameters values only
  tdrStyle.SetOptFit(0000)
  tdrStyle.SetFitFormat("5.4g")
  tdrStyle.SetFuncColor(2)
  tdrStyle.SetFuncStyle(1)
  tdrStyle.SetFuncWidth(2)

  # for the legends
  tdrStyle.SetLegendBorderSize(0)
  tdrStyle.SetLegendFillColor(0)
  tdrStyle.SetLegendFont(42)
  
  #For the date:
  tdrStyle.SetOptDate(0)
  # tdrStyle.SetDateX(Float_t x = 0.01)
  # tdrStyle.SetDateY(Float_t y = 0.01)

  # For the statistics box:
  tdrStyle.SetOptFile(0)
  tdrStyle.SetOptStat(0) # To display the mean and RMS:   SetOptStat("mr")
  tdrStyle.SetStatColor(0)
  tdrStyle.SetStatFont(42)
  tdrStyle.SetStatFontSize(0.025)
  tdrStyle.SetStatTextColor(1)
  tdrStyle.SetStatFormat("6.4g")
  tdrStyle.SetStatBorderSize(1)
  tdrStyle.SetStatH(0.1)
  tdrStyle.SetStatW(0.15)
  # tdrStyle.SetStatStyle(Style_t style = 1001)
  # tdrStyle.SetStatX(Float_t x = 0)
  # tdrStyle.SetStatY(Float_t y = 0)

  # Margins:
  tdrStyle.SetPadTopMargin(0.06)
  tdrStyle.SetPadBottomMargin(0.13)
  tdrStyle.SetPadLeftMargin(0.16)
  tdrStyle.SetPadRightMargin(0.05)

  # For the Global title:

  tdrStyle.SetOptTitle(0)
  tdrStyle.SetTitleFont(42)
  tdrStyle.SetTitleColor(1)
  tdrStyle.SetTitleTextColor(1)
  tdrStyle.SetTitleFillColor(10)
  tdrStyle.SetTitleFontSize(0.05)
  # tdrStyle.SetTitleH(0) # Set the height of the title box
  # tdrStyle.SetTitleW(0) # Set the width of the title box
  # tdrStyle.SetTitleX(0) # Set the position of the title box
  # tdrStyle.SetTitleY(0.985) # Set the position of the title box
  # tdrStyle.SetTitleStyle(Style_t style = 1001)
  # tdrStyle.SetTitleBorderSize(2)

  # For the axis titles:

  tdrStyle.SetTitleColor(1, "XYZ")
  tdrStyle.SetTitleFont(42, "XYZ")
  tdrStyle.SetTitleSize(0.06, "XYZ")
  # tdrStyle.SetTitleXSize(Float_t size = 0.02) # Another way to set the size?
  # tdrStyle.SetTitleYSize(Float_t size = 0.02)
  tdrStyle.SetTitleXOffset(0.9)
  tdrStyle.SetTitleYOffset(1.25)
  # tdrStyle.SetTitleOffset(1.1, "Y") # Another way to set the Offset

  # For the axis labels:

  tdrStyle.SetLabelColor(1, "XYZ")
  tdrStyle.SetLabelFont(42, "XYZ")
  tdrStyle.SetLabelOffset(0.007, "XYZ")
  tdrStyle.SetLabelSize(0.05, "XYZ")

  # For the axis:

  tdrStyle.SetAxisColor(1, "XYZ")
  tdrStyle.SetStripDecimals(True)
  tdrStyle.SetTickLength(0.03, "XYZ")
  tdrStyle.SetNdivisions(508, "XYZ")
  tdrStyle.SetPadTickX(1)  # To get tick marks on the opposite side of the frame
  tdrStyle.SetPadTickY(1)

  # Change for log plots:
  tdrStyle.SetOptLogx(0)
  tdrStyle.SetOptLogy(0)
  tdrStyle.SetOptLogz(0)

  # Postscript options:
  tdrStyle.SetPaperSize(20.,20.)
  # tdrStyle.SetLineScalePS(Float_t scale = 3)
  # tdrStyle.SetLineStyleString(Int_t i, const char* text)
  # tdrStyle.SetHeaderPS(const char* header)
  # tdrStyle.SetTitlePS(const char* pstitle)

  # tdrStyle.SetBarOffset(Float_t baroff = 0.5)
  # tdrStyle.SetBarWidth(Float_t barwidth = 0.5)
  # tdrStyle.SetPaintTextFormat(const char* format = "g")
  # tdrStyle.SetPalette(Int_t ncolors = 0, Int_t* colors = 0)
  # tdrStyle.SetTimeOffset(Double_t toffset)
  # tdrStyle.SetHistMinimumZero(kTRUE)

  tdrStyle.cd()