예제 #1
0
def plot_cov_output(args):

    # Covariance, fractional covariance and correlation

    covfile = TFile(args.covfile)

    covcanvas = TCanvas()

    gStyle = TStyle()
    gStyle.SetPadLeftMargin(0.25)
    gStyle.SetPadRightMargin(0.15)
    gStyle.SetPalette(56)

    for matname in ('cov', 'fcov', 'corr'):

        mat = covfile.Get(matname)

        mat.GetYaxis().LabelsOption('v')  # doesn't work...
        mat.GetYaxis().SetLabelSize(0.07)
        mat.GetXaxis().SetLabelSize(0.07)

        mat.SetTitleSize(0.3, 't')  # doesn't work...

        if matname == 'corr':
            mat.GetZaxis().SetRangeUser(-0.4, 1)
            mat.SetTitle("Flux Correlation Matrix")

        mat.Draw("colz")
        mat.SetStats(False)
        covcanvas.SetLeftMargin(0.25)
        covcanvas.Update()
        covcanvas.SaveAs(args.outdir + matname + "_plot.pdf")
예제 #2
0
def looks_atlas2():

    atlasStyle = TStyle("ATLAS","Atlas style");
    icol=0
    atlasStyle.SetFrameBorderMode(icol)
    atlasStyle.SetFrameFillColor(icol)
    atlasStyle.SetCanvasBorderMode(icol)
    atlasStyle.SetCanvasColor(icol)
    atlasStyle.SetPadBorderMode(icol)
    atlasStyle.SetPadColor(icol)
    atlasStyle.SetStatColor(icol)
    atlasStyle.SetPaperSize(20,26)

    atlasStyle.SetPadTopMargin(0.05)
    atlasStyle.SetPadRightMargin(0.05)
    atlasStyle.SetPadBottomMargin(0.16)
    atlasStyle.SetPadLeftMargin(0.16)
    
    atlasStyle.SetTitleXOffset(1.4)
    atlasStyle.SetTitleYOffset(1.4)

    font=42
    tsize=0.05
    atlasStyle.SetTextFont(font)

    atlasStyle.SetTextSize(tsize)
    atlasStyle.SetLabelFont(font,'x')
    atlasStyle.SetTitleFont(font,'x')
    atlasStyle.SetLabelFont(font,'y')
    atlasStyle.SetTitleFont(font,'y')
    atlasStyle.SetLabelFont(font,'z')
    atlasStyle.SetTitleFont(font,'z')

    atlasStyle.SetLabelSize(tsize,'x')
    atlasStyle.SetTitleSize(tsize,'x')
    atlasStyle.SetLabelSize(tsize,'y')
    atlasStyle.SetTitleSize(tsize,'y')
    atlasStyle.SetLabelSize(tsize,'z')
    atlasStyle.SetTitleSize(tsize,'z')

    atlasStyle.SetMarkerStyle(20)
    atlasStyle.SetMarkerSize(1.2)
    atlasStyle.SetHistLineWidth(2)
    atlasStyle.SetLineStyleString(2,'[12 12]')

    atlasStyle.SetEndErrorSize(0.)
    

    atlasStyle.SetOptTitle(0)
    atlasStyle.SetOptStat(0)
    atlasStyle.SetOptFit(0)

    atlasStyle.SetPadTickX(1)
    atlasStyle.SetPadTickY(1)

    atlasStyle.cd()
    gROOT.ForceStyle()
    atlasStyle.ls()
예제 #3
0
파일: looks.py 프로젝트: vgenty/G6080
def looks_minos():
    minosStyle = TStyle("minosStyle", "MINOS Style")

    # Colors
    #set the background color to white
    minosStyle.SetFillColor(10)
    minosStyle.SetFrameFillColor(10)
    minosStyle.SetCanvasColor(10)
    minosStyle.SetPadColor(10)
    minosStyle.SetTitleFillColor(0)
    minosStyle.SetStatColor(10)

    #dont put a colored frame around the plots
    minosStyle.SetFrameBorderMode(0)
    minosStyle.SetCanvasBorderMode(0)
    minosStyle.SetPadBorderMode(0)

    #use the primary color palette
    #minosStyle.SetPalette(1,0);

    #set the default line color for a histogram to be black
    minosStyle.SetHistLineColor(ROOT.kBlack)

    #set the default line color for a fit function to be red
    minosStyle.SetFuncColor(ROOT.kRed)

    #make the axis labels black
    minosStyle.SetLabelColor(ROOT.kBlack, "xyz")

    #set the default title color to be black
    minosStyle.SetTitleColor(ROOT.kBlack)

    # Sizes

    #set the margins
    minosStyle.SetPadBottomMargin(0.2)
    minosStyle.SetPadTopMargin(0.075)
    minosStyle.SetPadLeftMargin(0.15)

    #set axis label and title text sizes
    minosStyle.SetLabelSize(0.05, "xyz")
    minosStyle.SetTitleSize(0.06, "xyz")
    minosStyle.SetTitleOffset(0.9, "x")
    minosStyle.SetTitleOffset(0.8, "yz")
    minosStyle.SetStatFontSize(0.05)
    minosStyle.SetTextSize(0.06)
    minosStyle.SetTitleBorderSize(0)
    minosStyle.SetStatBorderSize(0)

    #set line widths
    minosStyle.SetHistLineWidth(2)
    minosStyle.SetFrameLineWidth(2)
    minosStyle.SetFuncWidth(2)

    # Misc

    #align the titles to be centered
    minosStyle.SetTitleAlign(22)

    #set the number of divisions to show
    minosStyle.SetNdivisions(506, "xy")

    #turn off xy grids
    minosStyle.SetPadGridX(0)
    minosStyle.SetPadGridY(0)

    #set the tick mark style
    #minosStyle.SetPadTickX(1);
    #minosStyle.SetPadTickY(1);

    #show the fit parameters in a box
    minosStyle.SetOptFit(1111)

    #turn off all other stats
    minosStyle.SetOptStat(0000000)

    #marker settings
    minosStyle.SetMarkerStyle(8)
    minosStyle.SetMarkerSize(0.9)

    # Fonts

    kMinosFont = int(42)

    minosStyle.SetStatFont(kMinosFont)
    minosStyle.SetLabelFont(kMinosFont, "xyz")
    minosStyle.SetTitleFont(kMinosFont, "xyz")
    minosStyle.SetTextFont(kMinosFont)

    #done
    minosStyle.cd()

    gROOT.ForceStyle()
    gStyle.ls()
예제 #4
0
파일: looks.py 프로젝트: vgenty/G6080
def looks_atlas2():

    atlasStyle = TStyle("ATLAS", "Atlas style")
    icol = 0
    atlasStyle.SetFrameBorderMode(icol)
    atlasStyle.SetFrameFillColor(icol)
    atlasStyle.SetCanvasBorderMode(icol)
    atlasStyle.SetCanvasColor(icol)
    atlasStyle.SetPadBorderMode(icol)
    atlasStyle.SetPadColor(icol)
    atlasStyle.SetStatColor(icol)
    atlasStyle.SetPaperSize(20, 26)

    atlasStyle.SetPadTopMargin(0.05)
    atlasStyle.SetPadRightMargin(0.05)
    atlasStyle.SetPadBottomMargin(0.16)
    atlasStyle.SetPadLeftMargin(0.16)

    atlasStyle.SetTitleXOffset(1.4)
    atlasStyle.SetTitleYOffset(1.4)

    font = 42
    tsize = 0.05
    atlasStyle.SetTextFont(font)

    atlasStyle.SetTextSize(tsize)
    atlasStyle.SetLabelFont(font, 'x')
    atlasStyle.SetTitleFont(font, 'x')
    atlasStyle.SetLabelFont(font, 'y')
    atlasStyle.SetTitleFont(font, 'y')
    atlasStyle.SetLabelFont(font, 'z')
    atlasStyle.SetTitleFont(font, 'z')

    atlasStyle.SetLabelSize(tsize, 'x')
    atlasStyle.SetTitleSize(tsize, 'x')
    atlasStyle.SetLabelSize(tsize, 'y')
    atlasStyle.SetTitleSize(tsize, 'y')
    atlasStyle.SetLabelSize(tsize, 'z')
    atlasStyle.SetTitleSize(tsize, 'z')

    atlasStyle.SetMarkerStyle(20)
    atlasStyle.SetMarkerSize(1.2)
    atlasStyle.SetHistLineWidth(2)
    atlasStyle.SetLineStyleString(2, '[12 12]')

    atlasStyle.SetEndErrorSize(0.)

    atlasStyle.SetOptTitle(0)
    atlasStyle.SetOptStat(0)
    atlasStyle.SetOptFit(0)

    atlasStyle.SetPadTickX(1)
    atlasStyle.SetPadTickY(1)

    atlasStyle.cd()
    gROOT.ForceStyle()
    atlasStyle.ls()
예제 #5
0
from ROOT import TStyle, TColor, kWhite, kFullCircle, kTRUE

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


def setTDRStyle():

    global tdrStyle

    ## Canvas
    ##----------------------------------------------------------------------------
    tdrStyle.SetCanvasBorderMode(0)
    tdrStyle.SetCanvasColor(kWhite)
    tdrStyle.SetCanvasDefH(500)
    tdrStyle.SetCanvasDefW(700)
    tdrStyle.SetCanvasDefX(0)
    tdrStyle.SetCanvasDefY(0)

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

    ## Frame
    ##----------------------------------------------------------------------------
    tdrStyle.SetFrameBorderMode(0)
예제 #6
0
#coding=utf-8
from __future__ import division
from ROOT import TH1F, TStyle, TSpectrum, TCanvas

style = TStyle("style", "style")
style.SetCanvasColor(0)
style.SetMarkerStyle(5)
style.SetTitleFillColor(0)
style.cd()


class TrovaPicchi:
    def __init__(self, nomefile, sigma):
        n, nstep, step = [int(i) for i in nomefile.split(".")[0].split("_")]
        self.nfenditure = n
        self.canvas = TCanvas("canvas{0}".format(n),
                              "canvas {0} fenditure".format(n))
        self.isto = TH1F("isto{0}".format(n),
                         "{0} fenditure;bin ;-log(intensity)".format(n), nstep,
                         -nstep / 2 * step / 100, (nstep / 2 + 1) * step / 100)
        self.isto.SetStats(0)
        self.file2isto(nomefile)
        self.spectrum = TSpectrum()
        self.spectrum.Search(self.isto, sigma, "nobackground", 0.01)
        self.peaks = [
            self.spectrum.GetPositionX()[i]
            for i in range(self.spectrum.GetNPeaks())
        ]

    def file2isto(self, nomefile):
        file = open(nomefile)
예제 #7
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()
예제 #8
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()
예제 #9
0
#!/usr/bin/python
# -*- coding: utf-8 -*-

from ROOT import TStyle

atlasStyle = TStyle("myStyle", "myStyle")

atlasStyle.SetOptStat(0)
atlasStyle.SetPalette(1)

icol = 0
#WHITE
atlasStyle.SetFrameBorderMode(icol)
atlasStyle.SetFrameFillColor(icol)
atlasStyle.SetCanvasBorderMode(icol)
atlasStyle.SetCanvasColor(icol)
atlasStyle.SetPadBorderMode(icol)
atlasStyle.SetPadColor(icol)
atlasStyle.SetStatColor(icol)
atlasStyle.SetTitleFillColor(icol)

#atlasStyle.SetPaperSize(20,26);
#atlasStyle.SetPadTopMargin(0.02);
#atlasStyle.SetPadRightMargin(0.10);
#atlasStyle.SetPadBottomMargin(0.10);
#atlasStyle.SetPadLeftMargin(0.14);

atlasStyle.SetPaperSize(20, 26)
atlasStyle.SetPadTopMargin(0.05)
atlasStyle.SetPadRightMargin(0.05)
atlasStyle.SetPadBottomMargin(0.16)
예제 #10
0
def compare_w_proposal(args):

    chi2file = TFile(args.chifile)

    gStyle = TStyle()
    gStyle.SetPadLeftMargin(0.15)
    gStyle.SetPadRightMargin(0.15)

    colours = [30, 38, 46]
    contours = [
        chi2file.Get('90pct'),
        chi2file.Get('3sigma'),
        chi2file.Get('5sigma')
    ]

    propcontours = []
    contournames = ['90pct', '3s', '5s']
    contourtitles = [
        '90% Confidence Level', '3#sigma Confidence Level',
        '5#sigma Confidence Level'
    ]

    gr_range = TGraph()
    gr_range.SetPoint(0, 0.001, 0.01)
    gr_range.SetPoint(1, 1, 100)
    gr_range.SetMarkerColor(0)

    bestfit = TGraph()
    bestfit.SetPoint(0, 0.062, 1.7)
    bestfit.SetMarkerStyle(29)
    bestfit.SetMarkerSize(1.6)
    bestfit.SetMarkerColor(40)

    print("contours has length " + str(len(contours)))

    for i in range(len(contours)):

        x = []
        y = []

        with open(args.compdir + 'numu' + contournames[i] + '.txt') as f:
            for l, line in enumerate(f):
                if l == 0: continue
                x.append(float(line.split(', ')[0]))
                y.append(float(line.split(', ')[1].replace("\n", "")))

        propcontours.append(TGraph())
        for j in range(len(x)):
            propcontours[i].SetPoint(j, x[j], y[j])

        tempcanvas = TCanvas('temp_canvas', '', 1020, 990)

        templegend = TLegend()
        templegend.AddEntry(contours[i], 'Our contour', 'l')
        templegend.AddEntry(propcontours[i], 'From proposal', 'l')
        templegend.AddEntry(bestfit, 'Best Fit Point', 'p')

        tempcanvas.SetLogy()
        tempcanvas.SetLogx()

        gr_range.SetTitle(
            contourtitles[i] +
            ' Comparison; sin^{2}(2#theta); #Delta m^{2} (eV^{2})')

        gr_range.Draw('AP')
        gr_range.GetXaxis().SetRangeUser(0.001, 1)
        gr_range.GetYaxis().SetRangeUser(0.01, 100)

        for lst in (contours, propcontours):
            lst[i].SetMarkerStyle(20)
            lst[i].SetMarkerSize(0.25)
            lst[i].SetMarkerColor(colours[i] if lst == contours else 1)
            lst[i].SetLineColor(colours[i] if lst == contours else 1)

        contours[i].Draw('P same')
        propcontours[i].Draw('P same')

        templegend.Draw()
        bestfit.Draw('P same')

        tempcanvas.SaveAs(args.outdir + contournames[i] + '_comparison.pdf')
예제 #11
0
def plot_chi2_output(args):

    # Chi squareds

    chi2file = TFile(args.chifile)

    gStyle = TStyle()

    chi2 = chi2file.Get('chisq')

    chi2canvas = TCanvas()

    chi2.SetTitle(
        '#chi^{2}; log_{10}(sin^{2}(2#theta)); log_{10}(#Delta m^{2}); #chi^{2}'
    )
    gStyle.SetPalette(1)
    chi2.Draw('surf1')
    chi2canvas.SaveAs(args.outdir + "chisq.pdf")

    # Contours
    contcanvas = TCanvas('cont_canvas', '', 1020, 990)
    gStyle.SetPadLeftMargin(0.15)
    gStyle.SetPadRightMargin(0.15)

    colours = [30, 38, 46]
    contours = [
        chi2file.Get('90pct'),
        chi2file.Get('3sigma'),
        chi2file.Get('5sigma')
    ]

    for g in range(len(contours)):

        contours[g].SetMarkerStyle(20)
        contours[g].SetMarkerSize(0.25)
        contours[g].SetMarkerColor(colours[g])
        contours[g].SetLineColor(colours[g])

    gr_range = TGraph()
    gr_range.SetPoint(0, 0.001, 0.01)
    gr_range.SetPoint(1, 1, 100)
    gr_range.SetMarkerColor(0)

    bestfit = TGraph()
    bestfit.SetPoint(0, 0.062, 1.7)
    bestfit.SetMarkerStyle(29)
    bestfit.SetMarkerSize(1.6)
    bestfit.SetMarkerColor(40)

    gr_range.SetTitle(
        'SBN Sensitivity; sin^{2}(2#theta); #Delta m^{2} (eV^{2})')

    legend = TLegend()
    legend.AddEntry(contours[0], '90% CL', 'l')
    legend.AddEntry(contours[1], '3#sigma CL', 'l')
    legend.AddEntry(contours[2], '5#sigma CL', 'l')
    legend.AddEntry(bestfit, 'Best Fit Point', 'p')

    contcanvas.SetLogy()
    contcanvas.SetLogx()

    gr_range.Draw('AP')
    gr_range.GetXaxis().SetRangeUser(0.001, 1)
    gr_range.GetYaxis().SetRangeUser(0.01, 100)

    contours[0].Draw('P same')
    contours[1].Draw('P same')
    contours[2].Draw('P same')

    legend.Draw()
    bestfit.Draw('P same')

    contcanvas.SetLeftMargin(0.15)
    contcanvas.Update()
    contcanvas.SaveAs(args.outdir + 'Sensitivity.pdf')
예제 #12
0
import os
import numpy as np
from collections import OrderedDict
from ROOT import TCanvas, TText, TStyle, kBird, kWhite
from matplotlib import pyplot as plt
import matplotlib.gridspec as gridspec

nthreads = int(os.cpu_count() / 2)

# style
my_style = TStyle("Default", "My Root Style")
my_style.SetOptStat(0)
my_style.SetFrameLineWidth(2)
my_style.SetTitleSize(0.1, 'p')
my_style.SetTitleW(0.35)
my_style.SetTitleX(0.6)
my_style.SetTitleAlign(13)
my_style.SetTitleColor(2, 'xyz')
my_style.SetTitleSize(0.08, 'xyz')
my_style.SetTitleOffset(0.5, 'xyz')
my_style.SetTitleStyle(0)
my_style.SetTitleBorderSize(0)
my_style.SetLabelSize(0.06, 'xyz')
my_style.SetPalette(kBird)
my_style.SetFrameFillColor(kWhite)
my_style.SetPadGridX(0)
my_style.SetPadGridY(0)
my_style.SetPadBorderMode(0)
my_style.SetCanvasColor(0)
my_style.SetPadColor(0)
예제 #13
0
import sys, os, math, argparse
from ROOT import gROOT, gStyle, TStyle

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

kWhite = 0

tdrStyle.SetCanvasBorderMode(0)
tdrStyle.SetCanvasColor(kWhite)
tdrStyle.SetCanvasDefH(600) 
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)
예제 #14
0
#!/usr/bin/python
# -*- coding: utf-8 -*-

from ROOT import TStyle

atlasStyle = TStyle("myStyle","myStyle");

atlasStyle.SetOptStat(0)
atlasStyle.SetPalette(1)

icol=0; #WHITE
atlasStyle.SetFrameBorderMode(icol);
atlasStyle.SetFrameFillColor(icol);
atlasStyle.SetCanvasBorderMode(icol);
atlasStyle.SetCanvasColor(icol);
atlasStyle.SetPadBorderMode(icol);
atlasStyle.SetPadColor(icol);
atlasStyle.SetStatColor(icol);
atlasStyle.SetTitleFillColor(icol);

#atlasStyle.SetPaperSize(20,26);
#atlasStyle.SetPadTopMargin(0.02);
#atlasStyle.SetPadRightMargin(0.10);
#atlasStyle.SetPadBottomMargin(0.10);
#atlasStyle.SetPadLeftMargin(0.14);

atlasStyle.SetPaperSize(20,26);
atlasStyle.SetPadTopMargin(0.05);
atlasStyle.SetPadRightMargin(0.05);
atlasStyle.SetPadBottomMargin(0.16);
atlasStyle.SetPadLeftMargin(0.16);
def setLHCbStyle():
    global lhcbStyle
    global lhcbText
    global lhcbLatex

    lhcbStyle = TStyle("lhcbStyle", "Standard LHCb plots style")

    # use times new roman
    lhcbFont = 132
    # line thickness
    lhcbWidth = 2
    lhcbTSize = 0.06

    #// use plain black on white colors
    lhcbStyle.SetFrameBorderMode(0)
    lhcbStyle.SetCanvasBorderMode(0)
    lhcbStyle.SetPadBorderMode(0)
    lhcbStyle.SetPadColor(0)
    lhcbStyle.SetCanvasColor(0)
    lhcbStyle.SetStatColor(0)
    lhcbStyle.SetPalette(1)

    lhcbStyle.SetLegendBorderSize(0)
    lhcbStyle.SetLegendFont(132)
    lhcbStyle.SetFillColor(1)
    lhcbStyle.SetFillStyle(1001)

    # set the paper & margin sizes
    lhcbStyle.SetPaperSize(20, 26)

    lhcbStyle.SetPadTopMargin(0.1)

    lhcbStyle.SetPadRightMargin(0.05)
    lhcbStyle.SetPadBottomMargin(0.16)
    lhcbStyle.SetPadLeftMargin(0.14)

    # use large fonts
    lhcbStyle.SetTextFont(lhcbFont)
    lhcbStyle.SetTextSize(lhcbTSize)
    #  lhcbStyle.SetTextSize(0.08)
    lhcbStyle.SetLabelFont(lhcbFont, "x")
    lhcbStyle.SetLabelFont(lhcbFont, "y")
    lhcbStyle.SetLabelFont(lhcbFont, "z")
    lhcbStyle.SetLabelSize(lhcbTSize, "x")
    lhcbStyle.SetLabelSize(lhcbTSize, "y")
    lhcbStyle.SetLabelSize(lhcbTSize, "z")
    lhcbStyle.SetTitleFont(lhcbFont)
    lhcbStyle.SetTitleFont(lhcbFont, "x")
    lhcbStyle.SetTitleFont(lhcbFont, "y")
    lhcbStyle.SetTitleFont(lhcbFont, "z")
    lhcbStyle.SetTitleSize(1.2 * lhcbTSize, "x")
    lhcbStyle.SetTitleSize(1.2 * lhcbTSize, "y")
    lhcbStyle.SetTitleSize(1.2 * lhcbTSize, "z")

    # use bold lines and markers
    lhcbStyle.SetLineWidth(lhcbWidth)
    lhcbStyle.SetFrameLineWidth(lhcbWidth)
    lhcbStyle.SetHistLineWidth(lhcbWidth)
    lhcbStyle.SetFuncWidth(lhcbWidth)
    lhcbStyle.SetGridWidth(lhcbWidth)
    lhcbStyle.SetLineStyleString(2, "[12 12]")
    lhcbStyle.SetMarkerStyle(20)
    lhcbStyle.SetMarkerSize(1.0)

    # label offsets
    lhcbStyle.SetLabelOffset(0.010)

    #titles
    lhcbStyle.SetTitleOffset(0.95, "X")
    lhcbStyle.SetTitleOffset(0.95, "Y")
    lhcbStyle.SetTitleOffset(1.2, "Z")
    lhcbStyle.SetTitleFillColor(0)
    lhcbStyle.SetTitleStyle(0)
    lhcbStyle.SetTitleBorderSize(0)
    lhcbStyle.SetTitleFont(lhcbFont, "title")
    lhcbStyle.SetTitleX(0.0)
    lhcbStyle.SetTitleY(1.0)
    lhcbStyle.SetTitleW(1.0)
    lhcbStyle.SetTitleH(0.05)

    # by default, do not display histogram decorations:
    lhcbStyle.SetOptStat(0)
    #lhcbStyle.SetOptStat("emr")     # show only nent -e , mean - m , rms -r
    #lhcbStyle.SetStatFormat("6.3g") # specified as c printf options
    lhcbStyle.SetOptTitle(0)
    lhcbStyle.SetOptFit(0)
    #lhcbStyle.SetOptFit(1011) # order is probability, Chi2, errors, parameters

    # look of the statistics box:
    lhcbStyle.SetStatBorderSize(0)
    lhcbStyle.SetStatFont(lhcbFont)
    lhcbStyle.SetStatFontSize(0.05)
    lhcbStyle.SetStatX(0.93)
    lhcbStyle.SetStatY(0.88)
    lhcbStyle.SetStatW(0.20)
    lhcbStyle.SetStatH(0.15)

    # put tick marks on top and RHS of plots
    lhcbStyle.SetPadTickX(1)
    lhcbStyle.SetPadTickY(1)

    # histogram divisions: only 5 in x to avoid label overlaps
    lhcbStyle.SetNdivisions(505, "x")
    lhcbStyle.SetNdivisions(505, "y")
    lhcbStyle.SetNdivisions(505, "z")

    # define style for text
    lhcbLabel = TText()
    lhcbLabel.SetTextFont(lhcbFont)
    lhcbLabel.SetTextColor(1)
    lhcbLabel.SetTextSize(0.04)
    lhcbLabel.SetTextAlign(12)

    # define style of latex text
    lhcbLatex = TLatex()
    lhcbLatex.SetTextFont(lhcbFont)
    lhcbLatex.SetTextColor(1)
    lhcbLatex.SetTextSize(0.04)
    lhcbLatex.SetTextAlign(12)

    # set this style
    gROOT.SetStyle("lhcbStyle")
    gROOT.ForceStyle()
    return
예제 #16
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()
예제 #17
0
def setTdrStyle():
    myStyle = TStyle('myStyle','a better style for my plot')
    
    # For the canvas:
    myStyle.SetCanvasBorderMode(0);
    myStyle.SetCanvasColor(0);
    myStyle.SetCanvasDefH(600); #Height of canvas
    myStyle.SetCanvasDefW(600); #Width of canvas
    myStyle.SetCanvasDefX(0);   #POsition on screen
    myStyle.SetCanvasDefY(0);
    
    # For the Pad:
    myStyle.SetPadBorderMode(0);
    myStyle.SetPadColor(0);
    myStyle.SetPadGridX(False);
    myStyle.SetPadGridY(False);
    myStyle.SetGridColor(0);
    myStyle.SetGridStyle(3);
    myStyle.SetGridWidth(1);
    
    # For the frame:
    myStyle.SetFrameBorderMode(0);
    myStyle.SetFrameBorderSize(1);
    myStyle.SetFrameFillColor(0);
    myStyle.SetFrameFillStyle(0);
    myStyle.SetFrameLineColor(1);
    myStyle.SetFrameLineStyle(1);
    myStyle.SetFrameLineWidth(1);
    
    # For the histo:
    myStyle.SetHistLineColor(1);
    myStyle.SetHistLineStyle(0);
    myStyle.SetHistLineWidth(1);
    
    myStyle.SetEndErrorSize(2);
    
    #For the fit/function:
    myStyle.SetOptFit(1);
    myStyle.SetFitFormat("5.4g");
    myStyle.SetFuncColor(2);
    myStyle.SetFuncStyle(1);
    myStyle.SetFuncWidth(1);
    
    #For the date:
    myStyle.SetOptDate(0);
    
    # For the statistics box:
    myStyle.SetOptFile(0);
    myStyle.SetOptStat(0); # To display the mean and RMS:   SetOptStat("mr");
    myStyle.SetStatColor(0);
    myStyle.SetStatFont(40);
    myStyle.SetStatFontSize(0.025);
    myStyle.SetStatTextColor(1);
    myStyle.SetStatFormat("6.4g");
    myStyle.SetStatBorderSize(1);
    myStyle.SetStatH(0.1);
    myStyle.SetStatW(0.15);
    
    # Margins:
    myStyle.SetPadTopMargin(0.07);
    myStyle.SetPadBottomMargin(0.15);
    myStyle.SetPadLeftMargin(0.2);
    myStyle.SetPadRightMargin(0.05);
    
    # For the Global title:
    
    myStyle.SetOptTitle(0);
    myStyle.SetTitleColor(1);
    myStyle.SetTitleTextColor(1);
    myStyle.SetTitleFillColor(10);
    myStyle.SetTitleFontSize(0.05);

    # For the axis titles:

    myStyle.SetTitleColor(1, "XYZ");
    #myStyle.SetTitleFont(40, "XYZ");
    myStyle.SetTitleSize(0.055, "XYZ");

    # For the axis labels:

    myStyle.SetLabelColor(1, "XYZ");
    myStyle.SetLabelFont(40, "XYZ");
    myStyle.SetLabelOffset(0.007, "XYZ");
    myStyle.SetLabelSize(0.05, "XYZ");
    
    # For the axis:
    
    myStyle.SetAxisColor(1, "XYZ");
    myStyle.SetStripDecimals(True);
    myStyle.SetTickLength(0.03, "XYZ");
    myStyle.SetNdivisions(510, "XYZ");
    myStyle.SetPadTickX(1);  # To get tick marks on the opposite side of the frame
    myStyle.SetPadTickY(1);
  
    # Change for log plots:
    myStyle.SetOptLogx(0);
    myStyle.SetOptLogy(0);
    myStyle.SetOptLogz(0);
    
    # Postscript options:
    myStyle.SetPaperSize(20.,20.);
    
    myStyle.cd()
예제 #18
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(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.SetHistLineColor(1)
    tdrStyle.SetHistLineStyle(0)
    tdrStyle.SetHistLineWidth(1)
    tdrStyle.SetEndErrorSize(2)
    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)

    # 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.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)

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

    # 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(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.cd()
예제 #19
0
#  SpartyJet is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with SpartyJet; if not, write to the Free Software
#  Foundation, Inc.:
#      59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
#----------------------------------------------------------------------

from ROOT import gROOT, TStyle

print "\nApplying SpartyJet style settings for ROOT...\n"

SpartyStyle = TStyle("SpartyJet", "SpartyJet style")

# whitening
SpartyStyle.SetFrameBorderMode(0)
SpartyStyle.SetFrameFillColor(0)
SpartyStyle.SetCanvasBorderMode(0)
SpartyStyle.SetCanvasColor(0)
SpartyStyle.SetPadBorderMode(0)
SpartyStyle.SetPadColor(0)
SpartyStyle.SetStatColor(0)
SpartyStyle.SetGridColor(0)
# pad margins
SpartyStyle.SetPadTopMargin(0.05)
SpartyStyle.SetPadRightMargin(0.05)
SpartyStyle.SetPadBottomMargin(0.16)
SpartyStyle.SetPadLeftMargin(0.16)
예제 #20
0
def setLHCbStyle():
    # configuring the plot-style
    gROOT.SetStyle("Plain")
    lhcbStyle = TStyle("lhcbstyle", "LHCb plots style")
    GlobalLHCbTSize = 0.06
    lhcbTSize = 0.06
    kLHCbFont = 132
    lhcbWidth = 2

    lhcbStyle.SetFillColor(1)
    lhcbStyle.SetFillStyle(1001)
    lhcbStyle.SetFrameFillColor(0)
    lhcbStyle.SetFrameBorderMode(0)
    lhcbStyle.SetPadBorderMode(0)
    lhcbStyle.SetPadColor(0)
    lhcbStyle.SetCanvasBorderMode(0)
    lhcbStyle.SetCanvasColor(0)
    lhcbStyle.SetStatColor(0)
    lhcbStyle.SetLegendBorderSize(0)
    lhcbStyle.SetPalette(1)
    # colors = [0,5,7,3,6,2,4,1]
    # lhcbStyle.SetPalette(8,colors)
    lhcbStyle.SetPaperSize(20, 26)
    lhcbStyle.SetPadTopMargin(0.05)
    lhcbStyle.SetPadRightMargin(0.05)
    lhcbStyle.SetPadBottomMargin(0.16)
    lhcbStyle.SetPadLeftMargin(0.14)
    lhcbStyle.SetTextFont(kLHCbFont)
    lhcbStyle.SetTextSize(lhcbTSize)
    lhcbStyle.SetLabelFont(kLHCbFont, "x")
    lhcbStyle.SetLabelFont(kLHCbFont, "y")
    lhcbStyle.SetLabelFont(kLHCbFont, "z")
    lhcbStyle.SetLabelSize(lhcbTSize, "x")
    lhcbStyle.SetLabelSize(lhcbTSize, "y")
    lhcbStyle.SetLabelSize(lhcbTSize, "z")
    lhcbStyle.SetTitleFont(kLHCbFont)
    lhcbStyle.SetTitleFont(kLHCbFont, "x")
    lhcbStyle.SetTitleFont(kLHCbFont, "y")
    lhcbStyle.SetTitleFont(kLHCbFont, "z")
    lhcbStyle.SetTitleSize(1.2 * lhcbTSize, "x")
    lhcbStyle.SetTitleSize(1.2 * lhcbTSize, "y")
    lhcbStyle.SetTitleSize(1.2 * lhcbTSize, "z")
    lhcbStyle.SetLineWidth(lhcbWidth)
    lhcbStyle.SetHistLineWidth(lhcbWidth)
    lhcbStyle.SetFuncWidth(lhcbWidth)
    lhcbStyle.SetGridWidth(lhcbWidth)
    lhcbStyle.SetLineStyleString(2, "[12 12]")
    lhcbStyle.SetMarkerStyle(20)
    lhcbStyle.SetMarkerSize(1.0)
    lhcbStyle.SetLabelOffset(0.010, "X")
    lhcbStyle.SetLabelOffset(0.010, "Y")
    lhcbStyle.SetOptStat(0)
    lhcbStyle.SetStatFormat("6.3g")
    lhcbStyle.SetOptTitle(0)
    lhcbStyle.SetOptFit(0)
    lhcbStyle.SetTitleOffset(0.95, "X")
    lhcbStyle.SetTitleOffset(0.95, "Y")
    lhcbStyle.SetTitleOffset(1.2, "Z")
    lhcbStyle.SetTitleFillColor(0)
    lhcbStyle.SetTitleStyle(0)
    lhcbStyle.SetTitleBorderSize(0)
    lhcbStyle.SetTitleFont(kLHCbFont, "title")
    lhcbStyle.SetTitleX(0.0)
    lhcbStyle.SetTitleY(1.0)
    lhcbStyle.SetTitleW(1.0)
    lhcbStyle.SetTitleH(0.05)
    lhcbStyle.SetStatBorderSize(0)
    lhcbStyle.SetStatFont(kLHCbFont)
    lhcbStyle.SetStatFontSize(0.05)
    lhcbStyle.SetStatX(0.9)
    lhcbStyle.SetStatY(0.9)
    lhcbStyle.SetStatW(0.25)
    lhcbStyle.SetStatH(0.15)
    lhcbStyle.SetPadTickX(1)
    lhcbStyle.SetPadTickY(1)
    lhcbStyle.SetNdivisions(505, "x")
    lhcbStyle.SetNdivisions(510, "y")

    gROOT.SetStyle("lhcbstyle")
    gROOT.ForceStyle()
예제 #21
0
#!/usr/bin/env python
#coding=utf-8

from ROOT import TStyle

# style:
ele_style = TStyle("eleStyle", "Style for electron validation")
ele_style.SetCanvasBorderMode(0)
ele_style.SetCanvasColor(0)
#ele_style.SetFillColor(0)
ele_style.SetCanvasDefH(768)
ele_style.SetCanvasDefW(1024)
ele_style.SetCanvasDefX(0)
ele_style.SetCanvasDefY(0)
ele_style.SetPadBorderMode(0)
ele_style.SetPadColor(0)
ele_style.SetPadGridX(False)
ele_style.SetPadGridY(False)
ele_style.SetGridColor(0)
ele_style.SetGridStyle(3)
ele_style.SetGridWidth(1)
ele_style.SetOptStat(1)
ele_style.SetPadTickX(0)
ele_style.SetPadTickY(0)
ele_style.SetHistLineColor(1)
ele_style.SetHistLineStyle(0)
ele_style.SetHistLineWidth(2)
ele_style.SetEndErrorSize(2)
ele_style.SetErrorX(0)
ele_style.SetOptStat(1)
ele_style.SetStatColor(0)
예제 #22
0
#!/usr/bin/env python
from ROOT import  gROOT , TCanvas, TPad, gStyle,TFile, gPad, TLegend, TMath, TH1F, TStyle,TColor
import ROOT as ro
from array import array
#from env import *
from math import sqrt, fabs



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



def xfrange(start, stop, step):
    while start < stop:
        yield start
        start += step

def setTDRStyle(logy):
    global tdrStyle
    #ro.gROOT.Macro( "setTDRStyle.C")
    # For the canvas:
    tdrStyle.SetCanvasBorderMode(0);
    tdrStyle.SetCanvasColor(ro.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);
예제 #23
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()
예제 #24
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()
예제 #25
0
def looks_atlas():
    atlasStyle = TStyle("ATLAS","Atlas style");
    
    # use plain black on white colors
    icol=int(0); # WHITE
    atlasStyle.SetFrameBorderMode(icol);
    atlasStyle.SetFrameFillColor(icol);
    atlasStyle.SetCanvasBorderMode(icol);
    atlasStyle.SetCanvasColor(icol);
    atlasStyle.SetPadBorderMode(icol);
    atlasStyle.SetPadColor(icol);
    atlasStyle.SetStatColor(icol);
    #atlasStyle.SetFillColor(icol); # don't use: white fill color for *all* objects
    
    # set the paper & margin sizes
    atlasStyle.SetPaperSize(20,26);
    
    # set margin sizes
    atlasStyle.SetPadTopMargin(0.05);
    atlasStyle.SetPadRightMargin(0.05);
    atlasStyle.SetPadBottomMargin(0.16);
    atlasStyle.SetPadLeftMargin(0.16);
    
    # set title offsets (for axis label)
    atlasStyle.SetTitleXOffset(1);
    atlasStyle.SetTitleYOffset(1);
    
    # use large fonts
    #Int_t font=72; # Helvetica italics
    font=int(42); # Helvetica
    tsize=int(0.05);
    atlasStyle.SetTextFont(font);
    
    atlasStyle.SetTextSize(tsize);
    atlasStyle.SetLabelFont(font,"x");
    atlasStyle.SetTitleFont(font,"x");
    atlasStyle.SetLabelFont(font,"y");
    atlasStyle.SetTitleFont(font,"y");
    atlasStyle.SetLabelFont(font,"z");
    atlasStyle.SetTitleFont(font,"z");
    
    atlasStyle.SetLabelSize(tsize,"x");
    atlasStyle.SetTitleSize(tsize,"x");
    atlasStyle.SetLabelSize(tsize,"y");
    atlasStyle.SetTitleSize(tsize,"y");
    atlasStyle.SetLabelSize(tsize,"z");
    atlasStyle.SetTitleSize(tsize,"z");
    
    # use bold lines and markers
    atlasStyle.SetMarkerStyle(20);
    atlasStyle.SetMarkerSize(1.2);
    atlasStyle.SetHistLineWidth(2);
    atlasStyle.SetLineStyleString(2,"[12 12]"); # postscript dashes
    
    # get rid of X error bars 
    #atlasStyle.SetErrorX(0.001);
    # get rid of error bar caps
    atlasStyle.SetEndErrorSize(0.);
    
    # do not display any of the standard histogram decorations
    atlasStyle.SetOptTitle(0);
    #atlasStyle.SetOptStat(1111);
    atlasStyle.SetOptStat(0);
    #atlasStyle.SetOptFit(1111)
    atlasStyle.SetOptFit(0);
    
    # put tick marks on top and RHS of plots
    atlasStyle.SetPadTickX(1);
    atlasStyle.SetPadTickY(1);
    atlasStyle.cd();
    gROOT.ForceStyle();
    gStyle.ls();
예제 #26
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
예제 #27
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();
예제 #28
0
파일: looks.py 프로젝트: vgenty/G6080
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()
예제 #29
0
def looks_minos():
    minosStyle = TStyle("minosStyle", "MINOS Style");

    # Colors
    #set the background color to white
    minosStyle.SetFillColor(10);
    minosStyle.SetFrameFillColor(10);
    minosStyle.SetCanvasColor(10);
    minosStyle.SetPadColor(10);
    minosStyle.SetTitleFillColor(0);
    minosStyle.SetStatColor(10);

    #dont put a colored frame around the plots
    minosStyle.SetFrameBorderMode(0);
    minosStyle.SetCanvasBorderMode(0);
    minosStyle.SetPadBorderMode(0);

    #use the primary color palette
    #minosStyle.SetPalette(1,0);

    #set the default line color for a histogram to be black
    minosStyle.SetHistLineColor(ROOT.kBlack);
    
    #set the default line color for a fit function to be red
    minosStyle.SetFuncColor(ROOT.kRed);

    #make the axis labels black
    minosStyle.SetLabelColor(ROOT.kBlack,"xyz");
    
    #set the default title color to be black
    minosStyle.SetTitleColor(ROOT.kBlack);
    
    # Sizes
    
    #set the margins
    minosStyle.SetPadBottomMargin(0.2);
    minosStyle.SetPadTopMargin(0.075);
    minosStyle.SetPadLeftMargin(0.15);
    
    #set axis label and title text sizes
    minosStyle.SetLabelSize(0.05,"xyz");
    minosStyle.SetTitleSize(0.06,"xyz");
    minosStyle.SetTitleOffset(0.9,"x");
    minosStyle.SetTitleOffset(0.8,"yz");
    minosStyle.SetStatFontSize(0.05);
    minosStyle.SetTextSize(0.06);
    minosStyle.SetTitleBorderSize(0);
    minosStyle.SetStatBorderSize(0);
    
    #set line widths
    minosStyle.SetHistLineWidth(2);
    minosStyle.SetFrameLineWidth(2);
    minosStyle.SetFuncWidth(2);
    
    # Misc

    #align the titles to be centered
    minosStyle.SetTitleAlign(22);
    
    #set the number of divisions to show
    minosStyle.SetNdivisions(506, "xy");

    #turn off xy grids
    minosStyle.SetPadGridX(0);
    minosStyle.SetPadGridY(0);
    
    #set the tick mark style
    #minosStyle.SetPadTickX(1);
    #minosStyle.SetPadTickY(1);
    
    #show the fit parameters in a box
    minosStyle.SetOptFit(1111);
    
    #turn off all other stats
    minosStyle.SetOptStat(0000000);
    
    #marker settings
    minosStyle.SetMarkerStyle(8);
    minosStyle.SetMarkerSize(0.9);
    
    # Fonts
    
    kMinosFont = int(42);
    
    minosStyle.SetStatFont(kMinosFont);
    minosStyle.SetLabelFont(kMinosFont,"xyz");
    minosStyle.SetTitleFont(kMinosFont,"xyz");
    minosStyle.SetTextFont(kMinosFont);

    #done
    minosStyle.cd();

    gROOT.ForceStyle();
    gStyle.ls();
예제 #30
0
def setTDRStyle():
    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(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.0, 20.0)
    # 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()
예제 #31
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()
예제 #32
0
def SetAtlasStyle():
  from ROOT import TROOT, gROOT, TStyle, gStyle
  atlasStyle = TStyle("ATLAS","Atlas style")
  icol=0
  atlasStyle.SetFrameBorderMode(icol)
  atlasStyle.SetFrameFillColor(icol)
  atlasStyle.SetCanvasBorderMode(icol)
  atlasStyle.SetCanvasColor(icol)
  atlasStyle.SetPadBorderMode(icol)
  atlasStyle.SetPadColor(icol)
  atlasStyle.SetStatColor(icol)
  atlasStyle.SetPaperSize(20,26)
  atlasStyle.SetPadTopMargin(0.04)
  atlasStyle.SetPadRightMargin(0.04)
  atlasStyle.SetPadBottomMargin(0.13)
  atlasStyle.SetPadLeftMargin(0.13)
  atlasStyle.SetTitleXOffset(1.0)
  atlasStyle.SetTitleYOffset(1.4)
  font=42
  tsize=0.05
  atlasStyle.SetTextFont(font)
  atlasStyle.SetTextSize(tsize)
  atlasStyle.SetLabelFont(font,"x")
  atlasStyle.SetTitleFont(font,"x")
  atlasStyle.SetLabelFont(font,"y")
  atlasStyle.SetTitleFont(font,"y")
  atlasStyle.SetLabelFont(font,"z")
  atlasStyle.SetTitleFont(font,"z")
  atlasStyle.SetLabelSize(tsize,"x")
  atlasStyle.SetTitleSize(tsize,"x")
  atlasStyle.SetLabelSize(tsize,"y")
  atlasStyle.SetTitleSize(tsize,"y")
  atlasStyle.SetLabelSize(tsize,"z")
  atlasStyle.SetTitleSize(tsize,"z")
  atlasStyle.SetMarkerStyle(1)
  atlasStyle.SetMarkerSize(1)
  atlasStyle.SetHistLineWidth(2)
  atlasStyle.SetLineStyleString(2,"[12 12]")
  atlasStyle.SetEndErrorSize(2)
  atlasStyle.SetOptTitle(0)
  atlasStyle.SetOptStat(0)
  atlasStyle.SetOptFit(0)
  atlasStyle.SetPadTickX(0)
  atlasStyle.SetPadTickY(0)
  gROOT.SetStyle("ATLAS")
  gROOT.ForceStyle()
  gStyle.SetPalette(1)
예제 #33
0
#!/usr/bin/env python
#coding=utf-8

from ROOT import TStyle

# style:
style = TStyle("MyStyle", "style for my ROOT graphs and histograms")
style.SetCanvasBorderMode(0)
style.SetCanvasColor(0)
#style.SetFillColor(0)
style.SetCanvasDefH(768)
style.SetCanvasDefW(1024)
style.SetCanvasDefX(0)
style.SetCanvasDefY(0)
style.SetPadBorderMode(0)
style.SetPadColor(0)
style.SetPadGridX(False)
style.SetPadGridY(False)
style.SetGridColor(0)
style.SetGridStyle(3)
style.SetGridWidth(1)
style.SetOptStat(1)
style.SetPadTickX(0)
style.SetPadTickY(0)
style.SetHistLineColor(1)
style.SetHistLineStyle(0)
style.SetHistLineWidth(2)
style.SetEndErrorSize(2)
style.SetErrorX(0)
style.SetOptStat(111111)
style.SetStatColor(0)
예제 #34
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
예제 #35
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()
예제 #36
0
def AtlasStyle():
    atlasStyle = TStyle("ATLAS", "Atlas style")
    # use plain black on white colors
    icol = 0  # WHITE
    atlasStyle.SetFrameBorderMode(icol)
    atlasStyle.SetFrameFillColor(icol)
    atlasStyle.SetCanvasBorderMode(icol)
    atlasStyle.SetCanvasColor(icol)
    atlasStyle.SetPadBorderMode(icol)
    atlasStyle.SetPadColor(icol)
    atlasStyle.SetStatColor(icol)
    #atlasStyle.SetFillColor(icol) # don't use: white fill color for *all* objects
    # set the paper & margin sizes
    atlasStyle.SetPaperSize(20, 26)

    # set margin sizes
    atlasStyle.SetPadTopMargin(0.05)
    atlasStyle.SetPadRightMargin(0.05)
    atlasStyle.SetPadBottomMargin(0.16)
    atlasStyle.SetPadLeftMargin(0.16)

    # set title offsets (for axis label)
    atlasStyle.SetTitleXOffset(1.4)
    atlasStyle.SetTitleYOffset(1.4)

    # use large fonts
    #Int_t font=72 # Helvetica italics
    font = 42  # Helvetica
    tsize = 0.05
    atlasStyle.SetTextFont(font)

    atlasStyle.SetTextSize(tsize)
    atlasStyle.SetLabelFont(font, "x")
    atlasStyle.SetTitleFont(font, "x")
    atlasStyle.SetLabelFont(font, "y")
    atlasStyle.SetTitleFont(font, "y")
    atlasStyle.SetLabelFont(font, "z")
    atlasStyle.SetTitleFont(font, "z")

    atlasStyle.SetLabelSize(tsize, "x")
    atlasStyle.SetTitleSize(tsize, "x")
    atlasStyle.SetLabelSize(tsize, "y")
    atlasStyle.SetTitleSize(tsize, "y")
    atlasStyle.SetLabelSize(tsize, "z")
    atlasStyle.SetTitleSize(tsize, "z")

    # use bold lines and markers
    atlasStyle.SetMarkerStyle(20)
    atlasStyle.SetMarkerSize(1.2)
    atlasStyle.SetHistLineWidth(2)
    atlasStyle.SetLineStyleString(2, "[12 12]")  # postscript dashes

    # get rid of X error bars
    #atlasStyle.SetErrorX(0.001)
    # get rid of error bar caps
    atlasStyle.SetEndErrorSize(0.)

    # do not display any of the standard histogram decorations
    atlasStyle.SetOptTitle(0)
    #atlasStyle.SetOptStat(1111)
    atlasStyle.SetOptStat(0)
    #atlasStyle.SetOptFit(1111)
    atlasStyle.SetOptFit(0)

    # put tick marks on top and RHS of plots
    atlasStyle.SetPadTickX(1)
    atlasStyle.SetPadTickY(1)
    atlasStyle.SetPalette(ROOT.kBird)
    return atlasStyle
예제 #37
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()
예제 #38
0
def chips_style():
    print("\nLet's make it look cheap... \n")

    chips_style = TStyle("chips_style", "CHIPS Style")

    # Center title
    chips_style.SetTitleAlign(22)
    chips_style.SetTitleX(.5)
    chips_style.SetTitleY(.95)
    chips_style.SetTitleBorderSize(0)

    # Remove stats box
    chips_style.SetOptStat(0)

    # Set background color to white
    chips_style.SetFillColor(10)
    chips_style.SetFrameFillColor(10)
    chips_style.SetCanvasColor(10)
    chips_style.SetPadColor(10)
    chips_style.SetTitleFillColor(0)
    chips_style.SetStatColor(10)

    # No colored frames around plots
    chips_style.SetFrameBorderMode(0)
    chips_style.SetCanvasBorderMode(0)
    chips_style.SetPadBorderMode(0)

    # Set the default line color for a fit function to be red
    chips_style.SetFuncColor(2)

    # Marker settings
    chips_style.SetMarkerStyle(20)

    # No border on legends
    chips_style.SetLegendBorderSize(0)

    # Disabled for violating NOvA style guidelines
    # Scientific notation on axes
    TGaxis.SetMaxDigits(3)

    # Axis titles
    chips_style.SetTitleSize(.055, "xyz")
    chips_style.SetTitleOffset(.8, "xyz")
    chips_style.SetTitleOffset(.9, "y")
    chips_style.SetTitleSize(.055, "")
    chips_style.SetTitleOffset(.8, "")

    # Axis labels (numbering)
    chips_style.SetLabelSize(.04, "xyz")
    chips_style.SetLabelOffset(.005, "xyz")

    # Set histogram minimum to exactly zero
    chips_style.SetHistMinimumZero()
예제 #39
0
import ROOT
import os
from array import array

from ROOT import TStyle, TLatex, TH1F, TCanvas, TFile, TLegend

myStyle = TStyle()
myStyle.SetLabelSize(0.05, "xyz")
myStyle.SetTitleSize(0.06, "xyz")
myStyle.SetTitleOffset(1.0, "x")
myStyle.SetTitleOffset(1.2, "y")
myStyle.SetPalette(1)
myStyle.SetPadRightMargin(0.14)
myStyle.SetOptStat(0)

t1 = TLatex()
t1.SetNDC()
t1.SetTextAlign(26)
t1.SetTextSize(0.06)

##f1=TFile.Open("histoTPG_251643_eg12.root")
##f2=TFile.Open("histoTPG_000_eg12.root");
f1 = TFile.Open(
    "~/eos/cms/store/caf/user/taroni/TPG/histoTPG_254833_eg12.root")
#f2=TFile.Open("~/eos/cms/store/caf/user/taroni/TPG/newhistoTPG_251244_notranscorr_eg12.root")
f2 = TFile.Open(
    "~/eos/cms/store/caf/user/taroni/TPG/newhistoTPG_251244_withtranscorr_eg12.root"
)
f3 = TFile.Open("etaphi_ee.root")

scaling = 1.
예제 #40
0
파일: CMSStyle.py 프로젝트: IzaakWN/TauFW
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()
예제 #41
0
def setE5Style():
    style = TStyle("E5Style","Standard E5 plots style")

    font_id = 132
    basic_text_size = 0.06
    basic_fg_colour = 1
    basic_bg_colour= 0
    basic_line_width = 2.00

    style.SetTextFont(font_id)
    style.SetTextSize(basic_text_size)

    style.SetFrameBorderMode(0)
    style.SetFrameFillColor(basic_bg_colour)
    style.SetFrameLineWidth( int(basic_line_width) )    
    
    style.SetPaperSize(20,26)
    
    style.SetCanvasBorderMode(0)
    style.SetCanvasColor(basic_bg_colour)

    style.SetOptStat(0)  
    style.SetOptTitle(0) 
    style.SetOptFit(0)   
    style.SetOptDate(0)  

    style.SetPadBorderMode(0)
    style.SetPadColor(basic_bg_colour)
    style.SetPadTopMargin(0.07)
    style.SetPadRightMargin(0.10101010101010101010) 
    style.SetPadBottomMargin(0.16)
    style.SetPadLeftMargin(0.18)
    
    style.SetPadTickX(1) 
    style.SetPadTickY(1) 

    style.SetTickLength(0.03,"x")
    style.SetTickLength(0.03,"y")
    style.SetTickLength(0.03,"z")
    
    style.SetPadGridX(False) 
    style.SetPadGridY(False) 

    style.SetGridWidth(int(basic_line_width) )
    style.SetGridColor(basic_fg_colour)
    
    style.SetTitleStyle(0)
    style.SetTitleBorderSize(0)
    style.SetTitleTextColor(basic_fg_colour)
    style.SetTitleFillColor(basic_bg_colour)

    style.SetTitleFont(font_id,"title") 
    style.SetTitleFont(font_id,"x")
    style.SetTitleFont(font_id,"y")
    style.SetTitleFont(font_id,"z")

    style.SetTitleSize(1.2*basic_text_size,"x")
    style.SetTitleSize(1.2*basic_text_size,"y")
    style.SetTitleSize(1.2*basic_text_size,"z")

    style.SetTitleOffset(0.95,"x")
    style.SetTitleOffset(1.20,"y")
    style.SetTitleOffset(1.20,"z")

    style.SetTitleX(0.00)
    style.SetTitleY(1.00)

    style.SetTitleW(1.00)
    style.SetTitleH(0.05)    
    
    style.SetLabelFont(font_id,"x")
    style.SetLabelFont(font_id,"y")
    style.SetLabelFont(font_id,"z")

    style.SetLabelSize(basic_text_size,"x")
    style.SetLabelSize(basic_text_size,"y")
    style.SetLabelSize(basic_text_size,"z")

    style.SetLabelOffset(0.010,"X")
    style.SetLabelOffset(0.005,"Y")

    style.SetStatColor(0)
    style.SetStatBorderSize(0)
    style.SetStatFont(font_id)
    style.SetStatFontSize(0.05)
    style.SetStatFormat("6.3g")
    style.SetStatX(0.9)
    style.SetStatY(0.9)
    style.SetStatW(0.25)
    style.SetStatH(0.15)
    
    style.SetLegendBorderSize(0)
    
    style.SetFillColor(1)
    style.SetFillStyle(1001)
    
    style.SetPalette(1)
    
    style.SetHistLineColor(basic_fg_colour)
    style.SetHistLineWidth(int(basic_line_width) )
    style.SetHistLineStyle(0)

    #style.SetHistFillColor(basic_bg_colour)
    #style.SetHistFillStyle(0)

    style.SetHistMinimumZero(False)
    style.SetHistTopMargin(0.05)

    
    style.SetNdivisions(505,"x")
    style.SetNdivisions(510,"y")
        
    style.SetMarkerStyle(20)
    style.SetMarkerSize(1.0)
    style.SetMarkerColor(basic_fg_colour)

    style.SetErrorX(0.)      
    style.SetEndErrorSize(2) 

    style.SetFuncColor(basic_fg_colour)
    style.SetFuncWidth(int(basic_line_width) )
  
    gROOT.SetStyle("E5Style")
    gROOT.ForceStyle()
    return style
예제 #42
0
파일: AtlasStyle.py 프로젝트: zihaoj/ANN
from ROOT import gROOT,gPad,gStyle,TCanvas,TFile,TLine,TLatex,TAxis,TLegend,TPostScript
from ROOT import TH2D,TArrow,TCut,TPad,TPaveText,TGraph,TGraphAsymmErrors
from ROOT import TGraph2D,TStyle,TBranch,gSystem,gDirectory
from ROOT import TPave,TPaveStats


atlasStyle= TStyle("ATLAS","Atlas style")

# use plain black on white colors
icol=0
atlasStyle.SetFrameBorderMode(icol)
atlasStyle.SetCanvasBorderMode(icol)
atlasStyle.SetPadBorderMode(icol)
atlasStyle.SetPadColor(icol)
atlasStyle.SetCanvasColor(icol)
atlasStyle.SetStatColor(icol)
#atlasStyle.SetFillColor(icol)

# set the paper & margin sizes
atlasStyle.SetPaperSize(20,26)
atlasStyle.SetPadTopMargin(0.1)
atlasStyle.SetPadRightMargin(0.05)
atlasStyle.SetPadBottomMargin(0.16)
atlasStyle.SetPadLeftMargin(0.12)

# use large fonts
font=42
tsize=0.05
atlasStyle.SetTextFont(font)

예제 #43
0
def producePlots(filelist_handle,identifier):
    """

    produce plots for filelist

    """

    files = {}
    plots = []
    failures = []

    for line in filelist_handle.readlines():
        array = line.split()
        if len(array) > 3 :
            name = str(array[0])
            size = float(float(array[1])/1000000000000)
            events = int(array[2])
            run = int(array[3])
            lumi = int(array[4])
            if array[-1] != 'GMT' :
                failures.append(line)
            else :
                thetime = int(time.mktime(time.strptime(' '.join(array[5:]),'%a, %d %b %Y %H:%M:%S %Z')))
                if name in files.keys():
                    files[name]['lumi'].append(lumi)
                else :
                    entry = {}
                    entry['size'] = size
                    entry['events'] = events
                    entry['run'] = [run]
                    entry['lumi'] = [lumi]
                    entry['time'] = thetime
                    files[name] = entry

        if debug == 1 :
            for name in files.keys():
                print name,'size:',files[name]['size'],'events:',files[name]['events'],'runs:',','.join(map(str,files[name]['run'])),'lumis:',','.join(map(str,files[name]['lumi'])),'date:',files[name]['time']


    # print failures
    if len(failures) > 0 :
        print ""
        print "failures:"
        for line in failures :
            print line

    # define time axis
    times = [ files[name]['time'] for name in files ]
    times.sort()
    first_day = times[0]-times[0]%86400
    last_day  = times[len(times)-1]+(86400-times[len(times)-1]%86400)
    days = int((last_day - first_day)/86400.)

    # determine x axis division
    if days%10 == 0:
        bigdiv = 10
        smalldiv = days/10
    elif days%9 == 0:
        bigdiv = 9
        smalldiv = days/9
    elif days%8 == 0:
        bigdiv = 8
        smalldiv = days/8
    elif days%7 == 0:
        bigdiv = 7
        smalldiv = days/7
    elif days%6 == 0:
        bigdiv = 6
        smalldiv = days/6
    elif days%5 == 0:
        bigdiv = 5
        smalldiv = days/5
    elif days%4 == 0:
        bigdiv = 4
        smalldiv = days/4
    elif days%3 == 0:
        bigdiv = 3
        smalldiv = days/3
    elif days%2 == 0:
        bigdiv = 2
        smalldiv = days/2
    else :
        bigdiv = 1
        smalldiv = days


    gROOT.SetBatch(1)

    myStyle = TStyle("Default","Default");
    myStyle.cd();
    myStyle.SetFrameBorderMode(0);
    myStyle.SetCanvasBorderMode(0);
    myStyle.SetPadBorderMode(0);
    myStyle.SetPadColor(0);
    myStyle.SetCanvasColor(0);
    myStyle.SetTitleFillColor(0);
    myStyle.SetTitleBorderSize(1);
    myStyle.SetStatColor(0);
    myStyle.SetStatBorderSize(1);
    myStyle.SetOptStat(0);
    myStyle.SetTimeOffset(first_day+86400)

    c = TCanvas()

    c.SetLeftMargin(0.171)
    c.SetRightMargin(0.04)
    c.SetBottomMargin(0.093)
    c.SetTopMargin(0.08)
    c.SetGridx(1)
    c.SetGridy(1)

    # events histogram
    print 'Drawing histograms for average number of events per day'
    h_events = TH1D("NumberOfEvents" + identifier,"",days,0.,days*86400.)

    h_events.GetYaxis().SetTitle("Number of events [1/24h]")
    h_events.GetYaxis().SetTitleSize(0.08)
    h_events.GetYaxis().SetTitleColor(4)
    h_events.GetYaxis().SetTitleOffset(1.14)
    h_events.GetYaxis().SetLabelSize(0.07)
    h_events.GetYaxis().SetLabelOffset(0.01)
    
    h_events.GetXaxis().SetTimeDisplay(1)
    h_events.GetXaxis().SetTimeFormat("%m/%d")
    h_events.GetXaxis().SetLabelSize(0.05)
    h_events.GetXaxis().SetLabelOffset(0.035)
    h_events.GetXaxis().SetNdivisions(smalldiv * 100 + bigdiv,0)

    h_events.SetLineColor(4)
    h_events.SetLineWidth(3)

    total_events = 0

    for name in files.keys():
        total_events += files[name]['events']
        h_events.Fill(files[name]['time']-first_day,files[name]['events'])
    h_events.SetMaximum(h_events.GetMaximum()*1.3)
    h_events.Draw()

    t_events = TPaveText(0.2,0.75,0.9,0.9,'brNDC')
    t_events.AddText('CMS 2010: %s' % identifier)
    t_events.AddText('Total number of events: %.2E' % (total_events))
    t_events.AddText('Last updated on: %s' % (timestring))
    t_events.SetFillColor(0)
    t_events.SetFillStyle(0)
    t_events.SetBorderSize(0)
    t_events.SetTextAlign(12)
    t_events.Draw()

    name = timefilestring + '_events' + identifier.replace('/','_') + '.png'
    plots.append(name)
    c.SaveAs(name)
    c.Clear()

    # rate histogram
    print 'Drawing histograms for average rate per day'
    h_rate = TH1D("Rate" + identifier,"",days,0.,days*86400.)
    h_rate.GetYaxis().SetTitle("Average Rate [Hz/24h]")
    h_rate.GetYaxis().SetTitleSize(0.08)
    h_rate.GetYaxis().SetTitleColor(4)
    h_rate.GetYaxis().SetTitleOffset(1.14)
    h_rate.GetYaxis().SetLabelSize(0.07)
    h_rate.GetYaxis().SetLabelOffset(0.01)
    
    h_rate.GetXaxis().SetTimeDisplay(1)
    h_rate.GetXaxis().SetTimeFormat("%m/%d")
    h_rate.GetXaxis().SetLabelSize(0.05)
    h_rate.GetXaxis().SetLabelOffset(0.035)
    h_rate.GetXaxis().SetNdivisions(smalldiv * 100 + bigdiv,0)

    h_rate.SetLineColor(4)
    h_rate.SetLineWidth(3)

    h_rate_max = 0.

    for bin in range(days):
        rate = h_events.GetBinContent(bin+1)/24./3600.
        if rate > h_rate_max :
            h_rate_max = rate
        h_rate.SetBinContent(bin+1,rate)

    h_rate.SetMaximum(h_rate_max*1.3)
    h_rate.Draw()

    t_rate = TPaveText(0.2,0.75,0.9,0.9,'brNDC')
    t_rate.AddText('CMS 2010: %s' % identifier)
    t_rate.AddText('Average rate: %.2f Hz' % (float(total_events)/float(days)/24./3600.))
    t_rate.AddText('Last updated on: %s' % (timestring))
    t_rate.SetFillColor(0)
    t_rate.SetFillStyle(0)
    t_rate.SetBorderSize(0)
    t_rate.SetTextAlign(12)
    t_rate.Draw()

    name = timefilestring + '_rate' + identifier.replace('/','_') + '.png'
    plots.append(name)
    c.SaveAs(name)
    c.Clear()

    # size histogram
    print 'Drawing histograms for average size per day'
    h_size = TH1D("Size"+identifier,"",days,0.,days*86400.)

    h_size.GetYaxis().SetTitle("Size [TB/24h]")
    h_size.GetYaxis().SetTitleSize(0.08)
    h_size.GetYaxis().SetTitleColor(4)
    h_size.GetYaxis().SetTitleOffset(1.12)
    h_size.GetYaxis().SetLabelSize(0.07)
    h_size.GetYaxis().SetLabelOffset(0.01)

    h_size.GetXaxis().SetTimeDisplay(1)
    h_size.GetXaxis().SetTimeFormat("%m/%d")
    h_size.GetXaxis().SetLabelSize(0.05)
    h_size.GetXaxis().SetLabelOffset(0.035)
    h_size.GetXaxis().SetNdivisions(smalldiv * 100 + bigdiv,0)

    h_size.SetLineColor(4)
    h_size.SetLineWidth(3)

    total_size = 0.
    for name in files.keys():
        total_size += files[name]['size']
        h_size.Fill(files[name]['time']-first_day,files[name]['size'])
    h_size.SetMaximum(h_size.GetMaximum()*1.3)
    h_size.Draw()

    t_size = TPaveText(0.2,0.75,0.9,0.9,'brNDC')
    t_size.AddText('CMS 2010: %s' % identifier)
    t_size.AddText('Total size: %.2f TB' % (total_size))
    t_size.AddText('Last updated on: %s' % (timestring))
    t_size.SetFillColor(0)
    t_size.SetFillStyle(0)
    t_size.SetBorderSize(0)
    t_size.SetTextAlign(12)
    t_size.Draw()

    #raw_input('Press Enter...')
    name = timefilestring + '_size' + identifier.replace('/','_') + '.png'
    plots.append(name)
    c.SaveAs(name)
    c.Clear()
    return plots