Пример #1
0
def configure_draw():
    gROOT.SetStyle('Plain')

    gStyle.SetEndErrorSize(0.)
    gStyle.SetOptStat(0)
    gStyle.SetPalette(1)
    gStyle.SetTitleBorderSize(0)
    gStyle.SetTitleFont(22, '')
    gStyle.SetTitleSize(0.06, '')
    gStyle.SetTitleX(0.1)
    gStyle.SetTitleW(0.8)
Пример #2
0
def setStyle():
    TColor.InitializeColors()
    stops = array('d', [
        0.0000, 0.1250, 0.2500, 0.3750, 0.5000, 0.6250, 0.7500, 0.8750, 1.0000
    ])
    red = array('d', [
        0.9764, 0.9956, 0.8186, 0.5301, 0.1802, 0.0232, 0.0780, 0.0592, 0.2082
    ])
    green = array('d', [
        0.9832, 0.7862, 0.7328, 0.7492, 0.7178, 0.6419, 0.5041, 0.3599, 0.1664
    ])
    blue = array('d', [
        0.0539, 0.1968, 0.3499, 0.4662, 0.6425, 0.7914, 0.8385, 0.8684, 0.5293
    ])
    TColor.CreateGradientColorTable(9, stops, red, green, blue, 255, 1.0)
    gStyle.SetHatchesLineWidth(1)
    gStyle.SetNumberContours(255)
    gStyle.SetNdivisions(505, "xyz")
    gStyle.SetTitleBorderSize(0)
    gStyle.SetTitleColor(1)
    gStyle.SetTitleStyle(3013)
    gStyle.SetTitleFillColor(0)
    gStyle.SetTitleX(0.05)
    gStyle.SetTitleW(0.4)
    gStyle.SetTitleY(0.965)
    gStyle.SetTitleH(0.065)
    gStyle.SetCanvasBorderMode(0)
    gStyle.SetCanvasBorderSize(3)
    gStyle.SetCanvasColor(0)
    gStyle.SetPadColor(0)
    gStyle.SetPadBorderMode(0)
    gStyle.SetFuncWidth(3)
    gStyle.SetPadGridY(False)
    gStyle.SetPadGridX(False)
    gStyle.SetFrameLineWidth(1)
    gStyle.SetMarkerSize(5)
    gStyle.SetPadTickX(True)
    gStyle.SetPadTickY(True)
    #gStyle.SetPalette(1)
    gStyle.SetHistLineWidth(3)
    gStyle.SetHistLineColor(1)
    gStyle.SetOptStat(0)
    gStyle.SetOptFit(0)
    gStyle.SetStatW(0.25)
    gStyle.SetStatH(0.25)
    gStyle.SetStatX(0.9)
    gStyle.SetStatY(0.9)
    gStyle.SetStatColor(0)
    gStyle.SetStatFormat("6.4g")
    gStyle.SetPadTopMargin(0.05)
    gStyle.SetPadRightMargin(0.05)
    gStyle.SetPadBottomMargin(0.16)
    gStyle.SetPadLeftMargin(0.12)
    font = 42
    gStyle.SetTextSize(.055)

    gStyle.SetTextFont(font)
    gStyle.SetLabelFont(font, "x")
    gStyle.SetTitleFont(font, "x")
    gStyle.SetLabelFont(font, "y")
    gStyle.SetTitleFont(font, "y")
    gStyle.SetLabelFont(font, "z")
    gStyle.SetTitleFont(font, "z")

    gStyle.SetTitleSize(.055, "x")
    gStyle.SetTitleSize(.055, "y")
    gStyle.SetTitleSize(.05, "z")
    gStyle.SetLabelSize(.05, "x")
    gStyle.SetLabelSize(.05, "y")
    gStyle.SetLabelSize(.05, "z")
    gStyle.SetLabelOffset(0.014, "x")
    gStyle.SetLabelOffset(0.006, "y")
    gStyle.SetLabelOffset(0.008, "z")
    gStyle.SetTitleOffset(1, "y")
    gStyle.SetTitleXOffset(1.2)

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

    gStyle.SetPadTickX(1)
    gStyle.SetPadTickY(1)
Пример #3
0
# old mva > 0.795, 0.884, 0.921
# mva2    > 0.85 , 0.90 , 0.94
# 3hit    < 2    , 1    , 0.8

### style parameters
gROOT.SetStyle("Plain")
gROOT.SetBatch(True)
gStyle.SetLegendFillColor(0)
gStyle.SetLegendBorderSize(0)
gStyle.SetStatBorderSize(0)
gStyle.SetTitleBorderSize(0)
gStyle.SetPadTickX(1)
gStyle.SetPadTickY(1)
gStyle.SetTitleX(0.125)
gStyle.SetTitleY(0.96)
gStyle.SetTitleW(0.8)
gStyle.SetTextFont(42)
gStyle.SetLegendFont(42)
#gStyle.SetLabelFont(42, 'xy')
#gStyle.SetTitleFont(42, 'xy')

tauScale = '0.03'
shiftedMet = 'sqrt(pow(mex+' + tauScale + '*l1Px+' + tauScale + '*l2Px,2)+pow(mey+' + tauScale + '*l1Py+' + tauScale + '*l2Py,2))'

baseline = ' l1Pt>35 && l2Pt>35 && abs(l1Eta)<2.1 && abs(l2Eta)<2.1 && diTauCharge==0 '

#### should be redundant once skimmed
baseline += ' && l2againstElectronLooseMVA3>0.5 '
baseline += ' && l1LooseEle>0.5 && l2LooseEle>0.5'
baseline += ' && l1againstMuonLoose2>0.5 && l2againstMuonLoose2>0.5'
######################################
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()
Пример #5
0
def initialization(batch=True, font=default_font):
    '''-- ROOT initialization --'''

    print "Initializing ROOT ..."

    # general
    gROOT.Reset()
    gROOT.SetBatch(batch)
    gROOT.SetStyle("Plain")

    # gStyle
    gStyle.SetFillColor(0)
    gStyle.SetCanvasColor(10)
    gStyle.SetLineWidth(1)
    gStyle.SetPalette(8)
    gStyle.SetTextFont(font)
    #gStyle.SetTextSize(30)

    # Frame
    gStyle.SetFrameBorderMode(0)
    gStyle.SetFrameFillColor(0)

    # Pad
    gStyle.SetPadBorderMode(0)
    gStyle.SetPadColor(0)
    gStyle.SetPadBottomMargin(0.1)
    gStyle.SetPadTopMargin(0.01)
    gStyle.SetPadLeftMargin(0.1)
    gStyle.SetPadRightMargin(0.01)
    gStyle.SetPadTickX(1)  # make ticks be on all 4 sides.
    gStyle.SetPadTickY(1)
    gStyle.SetPadGridX(0)
    gStyle.SetPadGridY(0)

    # histogram
    gStyle.SetHistFillStyle(0)
    gStyle.SetOptTitle(0)
    gStyle.SetTitleSize(0.22)
    gStyle.SetTitleFontSize(10)
    gStyle.SetTitleFont(font)
    gStyle.SetTitleFont(font, "xyz")
    gStyle.SetTitleYOffset(1.0)
    gStyle.SetTitleXOffset(1.0)
    gStyle.SetTitleXSize(0.04)
    gStyle.SetTitleYSize(0.04)
    gStyle.SetTitleX(.15)
    gStyle.SetTitleY(.98)
    gStyle.SetTitleW(.70)
    gStyle.SetTitleH(.05)

    # statistics box
    gStyle.SetOptStat(0)
    gStyle.SetStatFont(font)
    gStyle.SetStatFontSize(10)
    gStyle.SetStatX(.91)
    gStyle.SetStatY(.90)
    gStyle.SetStatW(.15)
    gStyle.SetStatH(.15)

    # axis labels
    gStyle.SetLabelFont(font)
    gStyle.SetLabelFont(font, "xyz")
    gStyle.SetLabelSize(10, "xyz")
    # gStyle.SetGridColor(1)
    gStyle.SetLegendBorderSize(1)
Пример #6
0
def plot(chan, plot_expected, plot_data, report_lumi=True):
    #c1.SetGrid();

    #c1 = TCanvas("c1","Expected Bias Band Graph",200,10,800,800);
    c1 = TCanvas("c1", "Expected Bias Band Graph", 200, 10, args.canvas_size,
                 args.canvas_size)
    c1.DrawFrame(0.85, 0.75, 1.15, 1.25)

    gStyle.SetTitleW(0.7)  # //per cent of the pad width
    gStyle.SetTitleH(0.5)  # //per cent of the pad height
    # none of these work

    # prepare data files
    if plot_data:
        fn_full, fn_notau, fn_stat = the_files[chan]

        file_full = TFile(fn_full)
        file_notau = TFile(fn_notau)
        file_stat = TFile(fn_stat)

        ttree_full = file_full.Get("limit")
        n = ttree_full.Draw(draw_command,
                            "2*deltaNLL>0 && 2*deltaNLL< %f" % args.nll_limit,
                            "L")
        g_full = TGraph(n, ttree_full.GetV2(), ttree_full.GetV1())

        ttree_notau = file_notau.Get("limit")
        n = ttree_notau.Draw(draw_command,
                             "2*deltaNLL>0 && 2*deltaNLL< %f" % args.nll_limit,
                             "L")
        g_notau = TGraph(n, ttree_notau.GetV2(), ttree_notau.GetV1())

        ttree_stat = file_stat.Get("limit")
        n = ttree_stat.Draw(draw_command,
                            "2*deltaNLL>0 && 2*deltaNLL< %f" % args.nll_limit,
                            "L")
        g_stat = TGraph(n, ttree_stat.GetV2(), ttree_stat.GetV1())

        g_full.SetLineWidth(4)
        g_notau.SetLineWidth(2)
        g_stat.SetLineWidth(2)
        g_stat.SetLineStyle(7)

        # removing the title
        #g_full .SetTitle(";\\text{fitted } #hat{r};") # ROOT latex cannot put a hat on a letter
        #g_full .SetTitle(";\\text{fitted } r;-2\\Delta log L")
        #g_full .SetTitle(";\\text{fitted signal strength};-2\\Delta log L")

        #g_full .SetTitle(";%s;-2#Delta log (L)" % args.title_x)
        g_full.SetTitle(";;")
        g_notau.SetTitle(";;")
        g_stat.SetTitle(";;")

        #g_full .GetXaxis().SetRange(0.75, 1.35)
        #g_notau.GetXaxis().SetRange(0.75, 1.35)
        #g_stat .GetXaxis().SetRange(0.75, 1.35)
        g_full.GetXaxis().SetRangeUser(0.75, 1.35)
        g_notau.GetXaxis().SetRangeUser(0.75, 1.35)
        g_stat.GetXaxis().SetRangeUser(0.75, 1.35)

        # font
        #set_trace()
        g_full.GetXaxis().SetTitleFont(133)
        g_notau.GetXaxis().SetTitleFont(133)
        g_stat.GetXaxis().SetTitleFont(133)

        g_full.GetXaxis().SetTitleSize(args.font_size)
        g_notau.GetXaxis().SetTitleSize(args.font_size)
        g_stat.GetXaxis().SetTitleSize(args.font_size)

        g_full.GetYaxis().SetTitleFont(133)
        g_notau.GetYaxis().SetTitleFont(133)
        g_stat.GetYaxis().SetTitleFont(133)

        g_full.GetYaxis().SetTitleSize(args.font_size)
        g_notau.GetYaxis().SetTitleSize(args.font_size)
        g_stat.GetYaxis().SetTitleSize(args.font_size)

        print "set up data plots", g_full

    # prepare expected files
    if plot_expected:
        fn_full, fn_notau, fn_stat = the_files_expected[chan]

        exp_file_full = TFile(fn_full)
        exp_file_notau = TFile(fn_notau)
        exp_file_stat = TFile(fn_stat)

        print fn_full, fn_notau, fn_stat

        exp_ttree_full = exp_file_full.Get("limit")
        n = exp_ttree_full.Draw(
            draw_command, "2*deltaNLL>0 && 2*deltaNLL< %f" % args.nll_limit,
            "L")
        exp_g_full = TGraph(n, exp_ttree_full.GetV2(), exp_ttree_full.GetV1())

        exp_ttree_notau = exp_file_notau.Get("limit")
        n = exp_ttree_notau.Draw(
            draw_command, "2*deltaNLL>0 && 2*deltaNLL< %f" % args.nll_limit,
            "L")
        exp_g_notau = TGraph(n, exp_ttree_notau.GetV2(),
                             exp_ttree_notau.GetV1())

        exp_ttree_stat = exp_file_stat.Get("limit")
        n = exp_ttree_stat.Draw(
            draw_command, "2*deltaNLL>0 && 2*deltaNLL< %f" % args.nll_limit,
            "L")
        exp_g_stat = TGraph(n, exp_ttree_stat.GetV2(), exp_ttree_stat.GetV1())

        exp_g_full.SetLineWidth(2)
        exp_g_notau.SetLineWidth(2)
        exp_g_stat.SetLineWidth(2)
        exp_g_stat.SetLineStyle(7)

        # removing the title
        #g_full .SetTitle(";\\text{fitted } #hat{r};") # ROOT latex cannot put a hat on a letter
        #exp_g_full .SetTitle(";\\text{fitted } r;-2\\Delta log L")
        #exp_g_full .SetTitle(";\\text{fitted signal strength};-2\\Delta log L")
        exp_g_full.SetTitle(";%s;-2 #Delta log (L)" % args.title_x)
        exp_g_notau.SetTitle(";;")
        exp_g_stat.SetTitle(";;")

        #exp_g_full .GetXaxis().SetRange(0.75, 1.35)
        #exp_g_notau.GetXaxis().SetRange(0.75, 1.35)
        #exp_g_stat .GetXaxis().SetRange(0.75, 1.35)
        exp_g_full.GetXaxis().SetRangeUser(0.75, 1.35)
        exp_g_notau.GetXaxis().SetRangeUser(0.75, 1.35)
        exp_g_stat.GetXaxis().SetRangeUser(0.75, 1.35)

        # fonts
        exp_g_full.GetXaxis().SetTitleFont(133)
        exp_g_notau.GetXaxis().SetTitleFont(133)
        exp_g_stat.GetXaxis().SetTitleFont(133)

        exp_g_full.GetXaxis().SetTitleSize(args.font_size)
        exp_g_notau.GetXaxis().SetTitleSize(args.font_size)
        exp_g_stat.GetXaxis().SetTitleSize(args.font_size)

        exp_g_full.GetYaxis().SetTitleFont(133)
        exp_g_notau.GetYaxis().SetTitleFont(133)
        exp_g_stat.GetYaxis().SetTitleFont(133)

        exp_g_full.GetYaxis().SetTitleSize(args.font_size)
        exp_g_notau.GetYaxis().SetTitleSize(args.font_size)
        exp_g_stat.GetYaxis().SetTitleSize(args.font_size)

        exp_g_full.GetXaxis().SetTitleOffset(args.offset_x)
        exp_g_notau.GetXaxis().SetTitleOffset(args.offset_x)
        exp_g_stat.GetXaxis().SetTitleOffset(args.offset_x)

        exp_g_full.GetYaxis().SetTitleOffset(args.offset_y)
        exp_g_notau.GetYaxis().SetTitleOffset(args.offset_y)
        exp_g_stat.GetYaxis().SetTitleOffset(args.offset_y)

        print "set up expectation plots", exp_g_full

    ## add X axis title
    #g_full .SetXTitle("fitted \\mu")
    #g_notau.SetXTitle("fitted \\mu")
    #g_stat .SetXTitle("fitted \\mu")
    leg = TLegend(0.6, 0.7, 0.89, 0.89)
    leg.SetTextFont(133)
    leg.SetTextSize(args.font_size)

    # draw horizontal lines first
    drawn = False
    if args.horizontal_lines:
        for y in [float(s) for s in args.horizontal_lines.split(',')]:
            l = TLine(100, y, 1000, y)
            l.SetLineColor(kGray)
            if not drawn:  # root is awesome, isn't it?
                drawn = True
                l.Draw()
            else:
                l.Draw('same')
            print "drew line", y

    if plot_expected and plot_data:
        print "plotting both"
        exp_g_full.SetLineStyle(7)

        if not drawn:
            exp_g_full.Draw("ap")  # this cast makes the following work
            exp_g_full.Draw("L")
        else:
            exp_g_full.Draw("same ap")
            exp_g_full.Draw("same L")

        if args.horizontal_lines:
            for y in [float(s) for s in args.horizontal_lines.split(',')]:
                l = TLine(0, y, 1000, y)
                l.SetLineColor(kGray)
                l.Draw('same L')
                print "drew line", y

        exp_g_full.Draw("same ap")
        exp_g_full.Draw("same L")

        #exp_g_full .Draw("ap") # this cast makes the following work
        #exp_g_full .Draw("L")
        #exp_g_notau.Draw("L same")
        #exp_g_stat .Draw("L same")

        leg.AddEntry(exp_g_full, "expected", "L")
        #leg.AddEntry(exp_g_full, "exp. full unc.", "L")
        #leg.AddEntry(exp_g_stat, "exp. stat unc.", "L")

        g_full.Draw("L same")
        #g_notau.Draw("L same")
        #g_stat .Draw("L same")

        leg.AddEntry(g_full, "observed", "L")
        #leg.AddEntry(g_full, "fitted full unc.", "L")
        #leg.AddEntry(g_stat, "fitted stat unc.", "L")

    elif plot_data:
        print "plotting data"
        g_full.Draw("ap")  # this cast makes the following work
        g_full.Draw("L")
        g_notau.Draw("L same")
        g_stat.Draw("L same")

        leg.AddEntry(g_full, "fitted full unc.", "L")
        leg.AddEntry(g_notau, "#splitline{fitted unc.}{w.o. tau ID}", "L")
        leg.AddEntry(g_stat, "fitted stat unc.", "L")

    elif plot_expected:
        print "plotting expected"

        exp_g_full.SetLineColor(43)
        exp_g_notau.SetLineColor(43)
        exp_g_stat.SetLineColor(43)

        exp_g_full.Draw("ap")
        exp_g_full.Draw("L")
        exp_g_notau.Draw("L same")
        exp_g_stat.Draw("L same")

        leg.AddEntry(exp_g_full, "exp. full unc.", "L")
        leg.AddEntry(exp_g_notau, "#splitline{exp. unc.}{w.o. tau ID}", "L")
        leg.AddEntry(exp_g_stat, "exp. stat unc.", "L")

    #left_title = TPaveText(0.1, 0.9, 0.4, 0.94, "brNDC")
    #left_title.AddText("CMS preliminary at 13 TeV")
    #left_title.SetTextFont(1)

    #left_title = TPaveText(0.15, 0.82, 0.3, 0.88, "brNDC")
    #left_title.AddText("CMS")
    #left_title.SetTextFont(1)
    #left_title.SetFillColor(0)

    if args.left_title_below:
        left_title = TPaveText(0.12, 0.82, 0.72, 0.89, "brNDC")
    else:
        left_title = TPaveText(0.1, 0.92, 0.7, 0.99, "brNDC")
    left_title.SetTextAlign(13)
    left_title.SetMargin(0)
    left_title.AddText(args.left_title)
    left_title.SetFillColor(0)

    left_title.Draw("same")

    #right_title = TPaveText(0.75, 0.9, 0.9, 0.94, "brNDC")
    #right_title.AddText("L = %s fb^{-1}" % (31.3 if chan == 'el' else 35.8))
    #right_title.SetTextFont(132)
    #right_title.SetFillColor(0)

    #right_title = TPaveText(0.5, 0.9, 0.9, 0.95, "brNDC")
    right_title = TPaveText(0.5, 0.92, 0.9, 0.99, "brNDC")
    both = True
    if report_lumi:
        right_title.AddText("%s fb^{-1} (13 TeV)" % 35.8)
    elif both:
        right_title.AddText("%s fb^{-1} (13 TeV)" % '35.8')
    else:
        right_title.AddText("(13 TeV)")

    right_title.SetMargin(0)
    right_title.SetTextAlign(33)
    right_title.SetTextFont(132)
    right_title.SetFillColor(0)
    right_title.Draw("same")

    leg.SetBorderSize(0)
    leg.Draw("same")

    plotted = ''
    plotted += '_exp' if plot_expected else ''
    plotted += '_obs' if plot_data else ''
    c1.SaveAs("uncertainty_scans_%s_%s%s.%s" %
              (args.fit_release, chan, plotted, args.output_type))
Пример #7
0
    logging.basicConfig(level=logging.DEBUG)
else:
    logging.basicConfig(level=logging.INFO)

logging.info("importing ROOT")
import ROOT
from ROOT import TCanvas, TGraph, TLine, gStyle, gROOT, gPad, TFile, TTree, TPaveText, TLegend, kBlack, TColor, kGray
#include "TGraph.h"
#include "TAxis.h"
#include "TH1.h"
logging.info("done")

gStyle.SetTitleFontSize(args.font_size)
gROOT.ForceStyle()

gStyle.SetTitleW(0.7)  # //per cent of the pad width
gStyle.SetTitleH(0.5)  # //per cent of the pad height
# none of these work


def rgb(r, g, b):
    '''rgb(r, g, b):

    from:
    http://webhome.phy.duke.edu/~dmb60/the-guide/
    TColor* color = gROOT->GetColor(TColor::GetColor(red,green,blue));//Use ints from 0 to 255 
    color->SetAlpha(0.5);//0 is fully transparent, 1 fully opaque
    hist->SetFillColor(color->GetNumber());
    '''
    return TColor.GetColor(r, g, b)
Пример #8
0
def drawHist(hist, confL, name, colz=True, contour=False, dec=False):

    can = TCanvas()
    can.cd()

    if (dec):
        gStyle.SetPaintTextFormat("3.2f")
    else:
        gStyle.SetPaintTextFormat("3.0f")

    if "metOmeff" in hist.GetName():
        gStyle.SetPaintTextFormat("3.2f")

    gStyle.SetStatX(50)
    #colors = array("i",[3,30, 40, 20, 46, 5, 6, 7, 8, 9,11,4]) #colors >= #levels - 1
    #gStyle.SetPalette(len(colors), colors)
    #levels = array("d",[.01, .20, 0.50, 1, 2, 3, 4, 7,9,10])
    #hist.SetContour(len(levels), levels)
    hist.SetMarkerSize(1.5)
    if colz:
        hist.Draw("colz,same")

    hist.Draw("text30, same")

    if SigSample == "GG_ttn1":
        xlabel = 850
        ylabel = 1400
    elif SigSample == "GG_2stepWZ":
        xlabel = 600
        ylabel = 1400
    elif SigSample == "GG_SLN1":
        xlabel = 400
        ylabel = 1000
    elif SigSample == "BB_onestepC1":
        xlabel = 350
        ylabel = 300

    xlabel = 650
    ylabel = 1500

    if contour:
        g = TGraph2D()
        TH2toTGraph2D(hist, g)
        Ghisto = g.GetHistogram()
        level = array('d', [1.64, 3])
        Ghisto.SetLineWidth(4)
        Ghisto.SetContour(2, level)
        Ghisto.Draw("cont1,list ,same")
        #        confL.SetLineColor(1)
        #        confL.Draw("colz,same")
        tex1 = TLatex()
        if SigSample == "BB_onestepC1":
            tex1.DrawLatex(xlabel, ylabel + 50, "#color[3]{1.64#sigma}")
        else:
            tex1.DrawLatex(xlabel, ylabel + 100, "#color[3]{1.64#sigma}")
        tex1.DrawLatex(xlabel, ylabel, "#color[2]{3#sigma}")

        #sprintf(&title[0],"MET>%d GeV",met);
        #myText(.2,.84,kBlue,title);

        #sprintf(&title[0],"MEFF>%d GeV",meff);
        #myText(.2,.79,kBlue,title);

        #sprintf(&title[0],"Bkg: %3.1f evts",_bkg);
        #myText(.2,.74,kBlue,title);

        #        myLineText(.26, .8 , 0.05, kGreen,"1.64#sigma")
        #        myLineText(.26, .75, 0.05, kRed,  "3#sigma")

    hist.GetYaxis().SetTitleOffset(1.3)
    hist.GetXaxis().SetTitle("Gluino Mass (GeV)")
    hist.GetYaxis().SetTitle("Neutralino Mass (GeV)")
    gStyle.SetTitleX(100.0)  # move title off plot
    gStyle.SetTitleW(0.0)  # title width =0

    tex2 = TLatex()
    if SigSample == "BB_onestepC1":
        tex2.DrawLatex(
            xlabel, ylabel + 100,
            name + " " + str(luminosity) + " fb^{-1}: " + hist.GetName())
    else:
        tex2.DrawLatex(
            xlabel, ylabel + 200,
            name + " " + str(luminosity) + " fb^{-1}: " + hist.GetName())

    # Draw m_gl - m_N1 = 2 (m_W+m_b)
    line = TLine(600, 429.6, 1800, 1629.6)
    line.SetLineColor(16)
    line.SetLineStyle(7)
    line.Draw("same")
    th1 = TLatex(
        1450, 1340,
        "m_{#tilde{g}} - m_{#tilde{#chi}_{1}^{0}} = 2 #left(m_{W}+m_{b}#right)"
    )
    th1.SetTextAngle(30)
    th1.SetTextColor(16)
    th1.SetTextSize(0.03)
    th1.Draw("same")

    # Draw m_gl - m_N1 = 2 m_t
    line2 = TLine(600, 255, 2050, 1680)
    line2.SetLineColor(16)
    line2.SetLineStyle(7)
    line2.Draw("same")
    th2 = TLatex(1550, 1240,
                 "m_{#tilde{g}} - m_{#tilde{#chi}_{1}^{0}} = 2 m_{t}")
    th2.SetTextAngle(30)
    th2.SetTextColor(16)
    th2.SetTextSize(0.03)
    #    th2.Draw("same")

    if "Dm" in hist.GetName():
        line3 = TLine(600, 25, 2100, 25)
        line3.SetLineColor(16)
        line3.SetLineStyle(7)
        line3.Draw("same")
        th3 = TLatex(
            1600, 40,
            "#Delta m = m_{#tilde{#chi}_{1}^{0}} - #left(m_{#tilde{g}} -2 m_{t} #right)"
        )
        #        th3.SetTextAngle(32)
        th3.SetTextColor(16)
        th3.SetTextSize(0.03)
        th3.Draw("same")
        hist.GetYaxis().SetTitle(
            "#Delta m_{#tilde{#chi}_{1}^{0}} (above diagonal) (GeV)")
    can.Update()
    directory = "/afs/cern.ch/user/o/othrif/workarea/results/v48/Plots/" + Dirbase  #+"/Lumi"+str(luminosity)
    if not os.path.exists(directory):
        os.makedirs(directory)
    can.SaveAs(directory + "/" + name + "_" + hist.GetName() + ".pdf")