def setTDRStyle():

    gStyle.SetCanvasBorderMode(0)
    gStyle.SetCanvasColor(kWhite)
    gStyle.SetCanvasDefH(600)
    # Height of canvas
    gStyle.SetCanvasDefW(600)
    # Width of canvas
    gStyle.SetCanvasDefX(0)
    # POsition on screen
    gStyle.SetCanvasDefY(0)

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

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

    # For the histo:
    gStyle.SetHistLineColor(1)
    gStyle.SetHistLineStyle(0)
    gStyle.SetHistLineWidth(1)
    gStyle.SetEndErrorSize(2)
    gStyle.SetErrorX(0.0)
    gStyle.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)

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

    # Margins:
    gStyle.SetPadTopMargin(0.05)
    gStyle.SetPadBottomMargin(0.13)
    gStyle.SetPadLeftMargin(0.18)
    gStyle.SetPadRightMargin(0.06)

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

    # For the axis titles:
    gStyle.SetTitleColor(1, "XYZ")
    gStyle.SetTitleFont(42, "XYZ")
    gStyle.SetTitleSize(0.03, "XYZ")
    gStyle.SetTitleXOffset(0.9)
    gStyle.SetTitleYOffset(1.5)

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

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

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

    # Postscript options:
    gStyle.SetPaperSize(20.0, 20.0)
    gStyle.cd()
                for bit in bitnames:
        
                        hname    = type + '.eta.phi' + '.All.'
                        h1 = gDirectory.FindObjectAny( hname )
                        hname    = type + '.eta.phi' + '.' + bit
                        h2 = gDirectory.FindObjectAny( hname )
                        
                        cname = 'Rough-Efficiencies-' + type + '-' + 'eta.phi' + '-' + bit
                        
                        c1 = TCanvas( cname, 'L1Tree-Analysis', 100,30,750,500)
                        c1.SetFillColor(10)
                        
                        #setTDRStyle()
                        #tdrStyle.SetPalette(1)
                        
                        gStyle.cd()
                        gStyle.SetPalette(1)
                        setCanvasStyle(c1)
                        c1.SetRightMargin(0.13);
                        
                        if h1 != None:
                                c1.cd()
                                h2.Divide(h2,h1,1,1,"B")
                                h2.Draw('COLZ')
                                h2.GetXaxis().SetTitle(ax1)
                                h2.GetYaxis().SetTitle(ax2)
                                c1.Modified()
                                outname = outpath + cname + '.png'
                                c1.Print( outname )
                                
#.........................................................................................
def set_root_env():
    #//TStyle* genieStyle = new TStyle("genieStyle", "GENIE Style")
    #//set the background color to white
    gStyle.SetFillColor(10)
    gStyle.SetFrameFillColor(10)
    gStyle.SetCanvasColor(10)
    gStyle.SetPadColor(10)
    gStyle.SetTitleFillColor(0)
    gStyle.SetStatColor(10)

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

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

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

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

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

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

    #set the margins
    gStyle.SetPadBottomMargin(0.18)
    gStyle.SetPadTopMargin(0.08)
    gStyle.SetPadRightMargin(0.08)
    gStyle.SetPadLeftMargin(0.17)

    #set axis label and title text sizes
    gStyle.SetLabelFont(42, "xyz")
    gStyle.SetLabelSize(0.04, "xyz")
    gStyle.SetLabelOffset(0.015, "xyz")
    gStyle.SetTitleFont(42, "xyz")
    gStyle.SetTitleSize(0.04, "xyz")
    gStyle.SetTitleOffset(1.4, "y")
    gStyle.SetTitleOffset(1.3, "x")
    gStyle.SetStatFont(42)
    gStyle.SetStatFontSize(0.07)
    gStyle.SetTitleBorderSize(1)
    gStyle.SetStatBorderSize(0)
    gStyle.SetTextFont(42)
    gStyle.SetTitleW(0.5)
    gStyle.SetTitleH(0.1)

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

    #set the number of divisions to show
    gStyle.SetNdivisions(506, "xy")
    #gStyle.SetPadTickX(-50202)

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

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

    #turn off stats
    gStyle.SetOptStat(0)
    gStyle.SetOptFit(0)

    #marker/line settings
    #gStyle.SetMarkerStyle(20)
    gStyle.SetMarkerSize(.95)  #0.7
    gStyle.SetLineWidth(2)
    gStyle.SetErrorX(0)
    gStyle.SetHistLineStyle(0)  #It was 3 for a dotted line

    #done
    gStyle.cd()
    gROOT.ForceStyle()
def setStyle():
    """Copy and paste from Chris's macro"""
    
    from ROOT import gStyle
    
    # For the canvas:
    gStyle.SetCanvasBorderMode(0);
    gStyle.SetCanvasColor(rt.kWhite);
    gStyle.SetCanvasDefH(300); #Height of canvas
    gStyle.SetCanvasDefW(600); #Width of canvas
    gStyle.SetCanvasDefX(0);   #POsition on screen
    gStyle.SetCanvasDefY(0);
    
    # For the Pad:
    gStyle.SetPadBorderMode(0);
    # gStyle.SetPadBorderSize(Width_t size = 1);
    gStyle.SetPadColor(rt.kWhite);
    gStyle.SetPadGridX(False);
    gStyle.SetPadGridY(False);
    gStyle.SetGridColor(0);
    gStyle.SetGridStyle(3);
    gStyle.SetGridWidth(1);
    
    # For the frame:
    gStyle.SetFrameBorderMode(0);
    gStyle.SetFrameBorderSize(1);
    gStyle.SetFrameFillColor(0);
    gStyle.SetFrameFillStyle(0);
    gStyle.SetFrameLineColor(1);
    gStyle.SetFrameLineStyle(1);
    gStyle.SetFrameLineWidth(1);
    
    # set the paper & margin sizes
    gStyle.SetPaperSize(20,26);
    gStyle.SetPadTopMargin(0.065);
    gStyle.SetPadRightMargin(0.065);
    gStyle.SetPadBottomMargin(0.15);
    gStyle.SetPadLeftMargin(0.17);
    
    # use large Times-Roman fonts
    gStyle.SetTitleFont(132,"xyz");  # set the all 3 axes title font
    gStyle.SetTitleFont(132," ");    # set the pad title font
    gStyle.SetTitleSize(0.06,"xyz"); # set the 3 axes title size
    gStyle.SetTitleSize(0.06," ");   # set the pad title size
    gStyle.SetLabelFont(132,"xyz");
    gStyle.SetLabelSize(0.05,"xyz");
    gStyle.SetLabelColor(1,"xyz");
    gStyle.SetTextFont(132);
    gStyle.SetTextSize(0.08);
    gStyle.SetStatFont(132);
    
    # use bold lines and markers
    gStyle.SetMarkerStyle(8);
    gStyle.SetHistLineWidth(2);
    gStyle.SetLineStyleString(2,"[12 12]"); # postscript dashes
    
    #..Get rid of X error bars
    gStyle.SetErrorX(0.001);
    
    # do not display any of the standard histogram decorations
    gStyle.SetOptTitle(0);
    gStyle.SetOptStat(0);
    gStyle.SetOptFit(11111111);
    
    # put tick marks on top and RHS of plots
    gStyle.SetPadTickX(1);
    gStyle.SetPadTickY(1);
    
    # set a decent palette
    gStyle.SetPalette(1);
    
    gStyle.cd();