Exemplo n.º 1
0
def getHistograms(path, plot, runRange, isMC, backgrounds, region=""):

    treesEE = readTrees(path, "EE")
    treesEM = readTrees(path, "EMu")
    treesMM = readTrees(path, "MuMu")

    if isMC:

        eventCounts = totalNumberOfGeneratedEvents(path)
        processes = []
        for background in backgrounds:
            processes.append(
                Process(getattr(Backgrounds, background), eventCounts))
        histoEE = TheStack(processes, runRange.lumi, plot, treesEE, "None",
                           1.0, 1.0, 1.0).theHistogram
        histoMM = TheStack(processes, runRange.lumi, plot, treesMM, "None",
                           1.0, 1.0, 1.0).theHistogram
        histoEM = TheStack(processes, runRange.lumi, plot, treesEM, "None",
                           1.0, 1.0, 1.0).theHistogram
        histoEE.Scale(getattr(triggerEffs, region).effEE.val)
        histoEE.Scale(getattr(triggerEffs, region).effMM.val)
        histoEM.Scale(getattr(triggerEffs, region).effEM.val)

    else:
        histoEE = getDataHist(plot, treesEE)
        histoMM = getDataHist(plot, treesMM)
        histoEM = getDataHist(plot, treesEM)

    return histoEE, histoMM, histoEM
Exemplo n.º 2
0
def getHistograms(path,
                  source,
                  modifier,
                  plot,
                  runRange,
                  isMC,
                  nonNormalized,
                  backgrounds,
                  region=""):

    treesEE = readTrees(path, "EE", source=source, modifier=modifier)
    treesEM = readTrees(path, "EMu", source=source, modifier=modifier)
    treesMM = readTrees(path, "MuMu", source=source, modifier=modifier)

    if isMC:
        #~ print path, source, modifier
        eventCounts = totalNumberOfGeneratedEvents(path, source, modifier)
        processes = []
        for background in backgrounds:
            if nonNormalized:
                processes.append(
                    Process(getattr(Backgrounds, background),
                            eventCounts,
                            normalized=False))
            else:
                processes.append(
                    Process(getattr(Backgrounds, background), eventCounts))

        histoEE = TheStack(processes, runRange.lumi, plot, treesEE, "None",
                           1.0, 1.0, 1.0).theHistogram
        histoMM = TheStack(processes, runRange.lumi, plot, treesMM, "None",
                           1.0, 1.0, 1.0).theHistogram
        histoEM = TheStack(processes, runRange.lumi, plot, treesEM, "None",
                           1.0, 1.0, 1.0).theHistogram

        histoEE.Scale(getattr(triggerEffs, region).effEE.val)
        histoEE.Scale(getattr(triggerEffs, region).effMM.val)
        histoEM.Scale(getattr(triggerEffs, region).effEM.val)

    else:
        histoEE = getDataHist(plot, treesEE)
        histoMM = getDataHist(plot, treesMM)
        histoEM = getDataHist(plot, treesEM)

    return histoEE, histoMM, histoEM
def getCounts(trees,
              cut,
              isMC,
              backgrounds,
              plot,
              runRange,
              path,
              blind=False):

    rMuEPars = corrections[runRange.era].rMuELeptonPt.inclusive

    corrMap = {}
    corrMapUp = {}
    corrMapDn = {}
    if isMC:
        corrMap["offset"] = rMuEPars.ptOffsetMC
        corrMap["falling"] = rMuEPars.ptFallingMC
        corrMap["etaParabolaBase"] = rMuEPars.etaParabolaBaseMC
        corrMap["etaParabolaMinus"] = rMuEPars.etaParabolaMinusMC
        corrMap["etaParabolaPlus"] = rMuEPars.etaParabolaPlusMC
        corrMap["norm"] = rMuEPars.normMC
    else:
        corrMap["offset"] = rMuEPars.ptOffset
        corrMap["falling"] = rMuEPars.ptFalling
        corrMap["etaParabolaBase"] = rMuEPars.etaParabolaBase
        corrMap["etaParabolaMinus"] = rMuEPars.etaParabolaMinus
        corrMap["etaParabolaPlus"] = rMuEPars.etaParabolaPlus
        corrMap["norm"] = rMuEPars.norm

    rMuEDummy = "({norm:.3f}*( ({offset:.3f} + {falling:.3f}/{pt})*({etaParabolaBase} + ({eta}<-1.6)*{etaParabolaMinus:.3f}*pow({eta}+1.6, 2)+({eta}>1.6)*{etaParabolaPlus:.3f}*pow({eta}-1.6,2) )))"
    rMuE_El = rMuEDummy.format(pt="pt1", eta="eta1", **corrMap)
    rMuE_Mu = rMuEDummy.format(pt="pt2", eta="eta2", **corrMap)
    rMuEWeight = "(0.5*(%s + pow(%s, -1)))" % (rMuE_El, rMuE_Mu)

    rMuEWeight_EE = "(0.5*pow(%s, -1))" % (rMuE_Mu)
    rMuEWeight_MM = "(0.5*(%s))" % (rMuE_El)

    variationUpFlat = "(1 + 0.05)"  #
    variationDnFlat = "(1 - 0.05)"  #
    variationUpPt = "(1 + 0.05*max(110.0 - {pt},0)/90.0)"  #
    variationDnPt = "(1 - 0.05*max(110.0 - {pt},0)/90.0)"  #
    variationUpEta = "(1 + 0.05*abs(max({eta}-1.2,0))/1.2 )"  #
    variationDnEta = "(1 - 0.05*abs(max({eta}-1.2,0))/1.2 )"  #

    # Flat uncertainty
    rMuE_ElUpFlat = "(%s*%s)" % (rMuE_El, variationUpFlat)
    rMuE_MuUpFlat = "(%s*%s)" % (rMuE_Mu, variationUpFlat)
    rMuEWeightUpFlat = "(0.5*(%s + pow(%s, -1)))" % (rMuE_ElUpFlat,
                                                     rMuE_MuUpFlat)
    rMuEWeightUpFlat_MM = "(0.5*(%s))" % (rMuE_ElUpFlat)
    rMuEWeightUpFlat_EE = "(0.5*pow(%s, -1))" % (rMuE_MuUpFlat)

    rMuE_ElDnFlat = "(%s*%s)" % (rMuE_El, variationDnFlat)
    rMuE_MuDnFlat = "(%s*%s)" % (rMuE_Mu, variationDnFlat)
    rMuEWeightDnFlat = "(0.5*(%s + pow(%s, -1)))" % (rMuE_ElDnFlat,
                                                     rMuE_MuDnFlat)
    rMuEWeightDnFlat_MM = "(0.5*(%s))" % (rMuE_ElDnFlat)
    rMuEWeightDnFlat_EE = "(0.5*pow(%s, -1))" % (rMuE_MuDnFlat)

    # Pt uncertainty
    rMuE_ElUpPt = "(%s*%s)" % (rMuE_El, variationUpPt.format(pt="pt1"))
    rMuE_MuUpPt = "(%s*%s)" % (rMuE_Mu, variationUpPt.format(pt="pt2"))
    rMuEWeightUpPt = "(0.5*(%s + pow(%s, -1)))" % (rMuE_ElUpPt, rMuE_MuUpPt)
    rMuEWeightUpPt_MM = "(0.5*(%s))" % (rMuE_ElUpPt)
    rMuEWeightUpPt_EE = "(0.5*pow(%s, -1))" % (rMuE_MuUpPt)

    rMuE_ElDnPt = "(%s*%s)" % (rMuE_El, variationDnPt.format(pt="pt1"))
    rMuE_MuDnPt = "(%s*%s)" % (rMuE_Mu, variationDnPt.format(pt="pt2"))
    rMuEWeightDnPt = "(0.5*(%s + pow(%s, -1)))" % (rMuE_ElDnPt, rMuE_MuDnPt)
    rMuEWeightDnPt_MM = "(0.5*(%s))" % (rMuE_ElDnPt)
    rMuEWeightDnPt_EE = "(0.5*pow(%s, -1))" % (rMuE_MuDnPt)

    # Pt uncertainty
    rMuE_ElUpEta = "(%s*%s)" % (rMuE_El, variationUpEta.format(eta="eta1"))
    rMuE_MuUpEta = "(%s*%s)" % (rMuE_Mu, variationUpEta.format(eta="eta2"))
    rMuEWeightUpEta = "(0.5*(%s + pow(%s, -1)))" % (rMuE_ElUpEta, rMuE_MuUpEta)
    rMuEWeightUpEta_MM = "(0.5*(%s))" % (rMuE_ElUpEta)
    rMuEWeightUpEta_EE = "(0.5*pow(%s, -1))" % (rMuE_MuUpEta)

    rMuE_ElDnEta = "(%s*%s)" % (rMuE_El, variationDnEta.format(eta="eta1"))
    rMuE_MuDnEta = "(%s*%s)" % (rMuE_Mu, variationDnEta.format(eta="eta2"))
    rMuEWeightDnEta = "(0.5*(%s + pow(%s, -1)))" % (rMuE_ElDnEta, rMuE_MuDnEta)
    rMuEWeightDnEta_MM = "(0.5*(%s))" % (rMuE_ElDnEta)
    rMuEWeightDnEta_EE = "(0.5*pow(%s, -1))" % (rMuE_MuDnEta)

    plot.cuts = cut.replace(
        "prefireWeight*leptonFullSimScaleFactor1*leptonFullSimScaleFactor2*genWeight*weight*",
        "")

    cutRMuEScaled = "%s*%s" % (rMuEWeight, plot.cuts)
    cutRMuEScaledUpFlat = "%s*%s" % (rMuEWeightUpFlat, plot.cuts)
    cutRMuEScaledDnFlat = "%s*%s" % (rMuEWeightDnFlat, plot.cuts)
    cutRMuEScaledUpPt = "%s*%s" % (rMuEWeightUpPt, plot.cuts)
    cutRMuEScaledDnPt = "%s*%s" % (rMuEWeightDnPt, plot.cuts)
    cutRMuEScaledUpEta = "%s*%s" % (rMuEWeightUpEta, plot.cuts)
    cutRMuEScaledDnEta = "%s*%s" % (rMuEWeightDnEta, plot.cuts)

    cutRMuEScaled_EE = "%s*%s" % (rMuEWeight_EE, plot.cuts)
    cutRMuEScaledUpFlat_EE = "%s*%s" % (rMuEWeightUpFlat_EE, plot.cuts)
    cutRMuEScaledDnFlat_EE = "%s*%s" % (rMuEWeightDnFlat_EE, plot.cuts)
    cutRMuEScaledUpPt_EE = "%s*%s" % (rMuEWeightUpPt_EE, plot.cuts)
    cutRMuEScaledDnPt_EE = "%s*%s" % (rMuEWeightDnPt_EE, plot.cuts)
    cutRMuEScaledUpEta_EE = "%s*%s" % (rMuEWeightUpEta_EE, plot.cuts)
    cutRMuEScaledDnEta_EE = "%s*%s" % (rMuEWeightDnEta_EE, plot.cuts)

    cutRMuEScaled_MM = "%s*%s" % (rMuEWeight_MM, plot.cuts)
    cutRMuEScaledUpFlat_MM = "%s*%s" % (rMuEWeightUpFlat_MM, plot.cuts)
    cutRMuEScaledDnFlat_MM = "%s*%s" % (rMuEWeightDnFlat_MM, plot.cuts)
    cutRMuEScaledUpPt_MM = "%s*%s" % (rMuEWeightUpPt_MM, plot.cuts)
    cutRMuEScaledDnPt_MM = "%s*%s" % (rMuEWeightDnPt_MM, plot.cuts)
    cutRMuEScaledUpEta_MM = "%s*%s" % (rMuEWeightUpEta_MM, plot.cuts)
    cutRMuEScaledDnEta_MM = "%s*%s" % (rMuEWeightDnEta_MM, plot.cuts)

    if isMC:
        RT = corrections[runRange.era].rSFOFTrig.inclusive.valMC
        RTErr = corrections[runRange.era].rSFOFTrig.inclusive.errMC
    else:
        RT = corrections[runRange.era].rSFOFTrig.inclusive.val
        RTErr = corrections[runRange.era].rSFOFTrig.inclusive.err

    if isMC:
        source = ""
        modifier = ""
        eventCounts = totalNumberOfGeneratedEvents(path, source, modifier)
        processes = []
        for background in backgrounds:
            processes.append(
                Process(getattr(Backgrounds[runRange.era], background),
                        eventCounts))

        n = {}
        for region in [
                "inclusive",
        ]:
            histEE = TheStack(processes, runRange.lumi, plot, trees["EE"],
                              "None", 1.0,
                              getTriggerScaleFactor("EE", region, runRange),
                              1.0).theHistogram
            histMM = TheStack(processes, runRange.lumi, plot, trees["MM"],
                              "None", 1.0,
                              getTriggerScaleFactor("MM", region, runRange),
                              1.0).theHistogram
            histEM = TheStack(processes, runRange.lumi, plot, trees["EM"],
                              "None", 1.0,
                              getTriggerScaleFactor("EM", region, runRange),
                              1.0).theHistogram

            triggerEffs = corrections[runRange.era]
            histEE.Scale(getattr(triggerEffs, region).effEE.val)
            histMM.Scale(getattr(triggerEffs, region).effMM.val)
            histEM.Scale(getattr(triggerEffs, region).effEM.val)

            # central value
            plot.cuts = cutRMuEScaled
            histEMRMuEScaled = TheStack(processes, runRange.lumi, plot,
                                        trees["EM"], "None", 1.0, 1.0,
                                        1.0).theHistogram
            histEMRMuEScaled.Scale(getattr(triggerEffs, region).effEM.val)

            # flat uncertainty
            plot.cuts = cutRMuEScaledUpFlat
            histEMRMuEScaledUpFlat = TheStack(processes, runRange.lumi, plot,
                                              trees["EM"], "None", 1.0, 1.0,
                                              1.0).theHistogram
            histEMRMuEScaledUpFlat.Scale(
                getattr(triggerEffs, region).effEM.val)

            plot.cuts = cutRMuEScaledDnFlat
            histEMRMuEScaledDownFlat = TheStack(processes, runRange.lumi, plot,
                                                trees["EM"], "None", 1.0, 1.0,
                                                1.0).theHistogram
            histEMRMuEScaledDownFlat.Scale(
                getattr(triggerEffs, region).effEM.val)

            # pt uncertainty
            plot.cuts = cutRMuEScaledUpPt
            histEMRMuEScaledUpPt = TheStack(processes, runRange.lumi, plot,
                                            trees["EM"], "None", 1.0, 1.0,
                                            1.0).theHistogram
            histEMRMuEScaledUpPt.Scale(getattr(triggerEffs, region).effEM.val)

            plot.cuts = cutRMuEScaledDnPt
            histEMRMuEScaledDownPt = TheStack(processes, runRange.lumi, plot,
                                              trees["EM"], "None", 1.0, 1.0,
                                              1.0).theHistogram
            histEMRMuEScaledDownPt.Scale(
                getattr(triggerEffs, region).effEM.val)

            # eta uncertainty
            plot.cuts = cutRMuEScaledUpEta
            histEMRMuEScaledUpEta = TheStack(processes, runRange.lumi, plot,
                                             trees["EM"], "None", 1.0, 1.0,
                                             1.0).theHistogram
            histEMRMuEScaledUpEta.Scale(getattr(triggerEffs, region).effEM.val)

            plot.cuts = cutRMuEScaledDnEta
            histEMRMuEScaledDownEta = TheStack(processes, runRange.lumi, plot,
                                               trees["EM"], "None", 1.0, 1.0,
                                               1.0).theHistogram
            histEMRMuEScaledDownEta.Scale(
                getattr(triggerEffs, region).effEM.val)

            eeErr = ROOT.Double()
            ee = histEE.IntegralAndError(0, -1, eeErr)
            mmErr = ROOT.Double()
            mm = histMM.IntegralAndError(0, -1, mmErr)
            emErr = ROOT.Double()
            em = histEM.IntegralAndError(0, -1, emErr)

            #central value
            emRMuEScaledErr = ROOT.Double()
            emRMuEScaled = histEMRMuEScaled.IntegralAndError(
                0, -1, emRMuEScaledErr)

            # flat uncertainty
            emRMuEScaledUpFlatErr = ROOT.Double()
            emRMuEScaledUpFlat = histEMRMuEScaledUpFlat.IntegralAndError(
                0, -1, emRMuEScaledUpFlatErr)
            emRMuEScaledDownFlatErr = ROOT.Double()
            emRMuEScaledDownFlat = histEMRMuEScaledDownFlat.IntegralAndError(
                0, -1, emRMuEScaledDownFlatErr)

            # pt uncertainty
            emRMuEScaledUpPtErr = ROOT.Double()
            emRMuEScaledUpPt = histEMRMuEScaledUpPt.IntegralAndError(
                0, -1, emRMuEScaledUpPtErr)
            emRMuEScaledDownPtErr = ROOT.Double()
            emRMuEScaledDownPt = histEMRMuEScaledDownPt.IntegralAndError(
                0, -1, emRMuEScaledDownPtErr)

            # eta uncertainty
            emRMuEScaledUpEtaErr = ROOT.Double()
            emRMuEScaledUpEta = histEMRMuEScaledUpEta.IntegralAndError(
                0, -1, emRMuEScaledUpEtaErr)
            emRMuEScaledDownEtaErr = ROOT.Double()
            emRMuEScaledDownEta = histEMRMuEScaledDownEta.IntegralAndError(
                0, -1, emRMuEScaledDownEtaErr)

            n["EMRMuEScaled"] = emRMuEScaled * RT
            n["EMRMuEScaledUpFlat"] = emRMuEScaledUpFlat * RT
            n["EMRMuEScaledDownFlat"] = emRMuEScaledDownFlat * RT
            n["EMRMuEScaledUpPt"] = emRMuEScaledUpPt * RT
            n["EMRMuEScaledDownPt"] = emRMuEScaledDownPt * RT
            n["EMRMuEScaledUpEta"] = emRMuEScaledUpEta * RT
            n["EMRMuEScaledDownEta"] = emRMuEScaledDownEta * RT

            n["MM"] = mm
            n["EE"] = ee
            n["EM"] = em
            n["MMStatErr"] = float(mmErr)
            n["EEStatErr"] = float(eeErr)
            n["EMStatErr"] = float(emErr)

    else:
        n = {}
        for region in [
                "inclusive",
        ]:
            if blind:
                n["MM"] = createHistoFromTree(trees["EM"], "mll",
                                              cutRMuEScaled_MM, 100, 0,
                                              10000).Integral(0, -1) * RT
                n["EE"] = createHistoFromTree(trees["EM"], "mll",
                                              cutRMuEScaled_EE, 100, 0,
                                              10000).Integral(0, -1) * RT
            else:
                n["MM"] = trees["MM"].GetEntries(plot.cuts)
                n["EE"] = trees["EE"].GetEntries(plot.cuts)
            n["EM"] = trees["EM"].GetEntries(plot.cuts)

            n["EMRMuEScaled"] = createHistoFromTree(
                trees["EM"], "mll", cutRMuEScaled, 100, 0, 10000).Integral(
                    0, -1) * RT
            n["EMRMuEScaled_EE"] = createHistoFromTree(
                trees["EM"], "mll", cutRMuEScaled_EE, 100, 0, 10000).Integral(
                    0, -1) * RT
            n["EMRMuEScaled_MM"] = createHistoFromTree(
                trees["EM"], "mll", cutRMuEScaled_MM, 100, 0, 10000).Integral(
                    0, -1) * RT

            n["EMRMuEScaledUpRT"] = createHistoFromTree(
                trees["EM"], "mll", cutRMuEScaled, 10, 0, 10000).Integral(
                    0, -1) * (RT + RTErr)
            n["EMRMuEScaledDownRT"] = createHistoFromTree(
                trees["EM"], "mll", cutRMuEScaled, 10, 0, 10000).Integral(
                    0, -1) * (RT - RTErr)
            n["EMRMuEScaledUpFlat"] = createHistoFromTree(
                trees["EM"], "mll", cutRMuEScaledUpFlat, 10, 0,
                10000).Integral(0, -1) * RT
            n["EMRMuEScaledDownFlat"] = createHistoFromTree(
                trees["EM"], "mll", cutRMuEScaledDnFlat, 10, 0,
                10000).Integral(0, -1) * RT
            n["EMRMuEScaledUpPt"] = createHistoFromTree(
                trees["EM"], "mll", cutRMuEScaledUpPt, 10, 0, 10000).Integral(
                    0, -1) * RT
            n["EMRMuEScaledDownPt"] = createHistoFromTree(
                trees["EM"], "mll", cutRMuEScaledDnPt, 10, 0, 10000).Integral(
                    0, -1) * RT
            n["EMRMuEScaledUpEta"] = createHistoFromTree(
                trees["EM"], "mll", cutRMuEScaledUpEta, 10, 0, 10000).Integral(
                    0, -1) * RT
            n["EMRMuEScaledDownEta"] = createHistoFromTree(
                trees["EM"], "mll", cutRMuEScaledDnEta, 10, 0, 10000).Integral(
                    0, -1) * RT

            n["EMRMuEScaledUpRT_EE"] = createHistoFromTree(
                trees["EM"], "mll", cutRMuEScaled_EE, 10, 0, 10000).Integral(
                    0, -1) * (RT + RTErr)
            n["EMRMuEScaledDownRT_EE"] = createHistoFromTree(
                trees["EM"], "mll", cutRMuEScaled_EE, 10, 0, 10000).Integral(
                    0, -1) * (RT - RTErr)
            n["EMRMuEScaledUpFlat_EE"] = createHistoFromTree(
                trees["EM"], "mll", cutRMuEScaledUpFlat_EE, 10, 0,
                10000).Integral(0, -1) * RT
            n["EMRMuEScaledDownFlat_EE"] = createHistoFromTree(
                trees["EM"], "mll", cutRMuEScaledDnFlat_EE, 10, 0,
                10000).Integral(0, -1) * RT
            n["EMRMuEScaledUpPt_EE"] = createHistoFromTree(
                trees["EM"], "mll", cutRMuEScaledUpPt_EE, 10, 0,
                10000).Integral(0, -1) * RT
            n["EMRMuEScaledDownPt_EE"] = createHistoFromTree(
                trees["EM"], "mll", cutRMuEScaledDnPt_EE, 10, 0,
                10000).Integral(0, -1) * RT
            n["EMRMuEScaledUpEta_EE"] = createHistoFromTree(
                trees["EM"], "mll", cutRMuEScaledUpEta_EE, 10, 0,
                10000).Integral(0, -1) * RT
            n["EMRMuEScaledDownEta_EE"] = createHistoFromTree(
                trees["EM"], "mll", cutRMuEScaledDnEta_EE, 10, 0,
                10000).Integral(0, -1) * RT

            n["EMRMuEScaledUpRT_MM"] = createHistoFromTree(
                trees["EM"], "mll", cutRMuEScaled_MM, 10, 0, 10000).Integral(
                    0, -1) * (RT + RTErr)
            n["EMRMuEScaledDownRT_MM"] = createHistoFromTree(
                trees["EM"], "mll", cutRMuEScaled_MM, 10, 0, 10000).Integral(
                    0, -1) * (RT - RTErr)
            n["EMRMuEScaledUpFlat_MM"] = createHistoFromTree(
                trees["EM"], "mll", cutRMuEScaledUpFlat_MM, 10, 0,
                10000).Integral(0, -1) * RT
            n["EMRMuEScaledDownFlat_MM"] = createHistoFromTree(
                trees["EM"], "mll", cutRMuEScaledDnFlat_MM, 10, 0,
                10000).Integral(0, -1) * RT
            n["EMRMuEScaledUpPt_MM"] = createHistoFromTree(
                trees["EM"], "mll", cutRMuEScaledUpPt_MM, 10, 0,
                10000).Integral(0, -1) * RT
            n["EMRMuEScaledDownPt_MM"] = createHistoFromTree(
                trees["EM"], "mll", cutRMuEScaledDnPt_MM, 10, 0,
                10000).Integral(0, -1) * RT
            n["EMRMuEScaledUpEta_MM"] = createHistoFromTree(
                trees["EM"], "mll", cutRMuEScaledUpEta_MM, 10, 0,
                10000).Integral(0, -1) * RT
            n["EMRMuEScaledDownEta_MM"] = createHistoFromTree(
                trees["EM"], "mll", cutRMuEScaledDnEta_MM, 10, 0,
                10000).Integral(0, -1) * RT

            n["MMStatErr"] = n["MM"]**0.5
            n["EEStatErr"] = n["EE"]**0.5
            n["EMStatErr"] = n["EM"]**0.5

    n["cut"] = cut
    return n
Exemplo n.º 4
0
	yMin=0
	yMax = 19
	plotPad.DrawFrame(20,yMin,300,yMax,"; %s ; %s" %("m_{ll}","N_{events} / 5 GeV"))
	ROOT.gStyle.SetOptStat(0)
	
	histoSF.SetFillColor(ROOT.kBlue+1)
	histoEM.SetLineColor(ROOT.kBlack)
	histoEM.SetLineWidth(3)
	histoSF.SetLineColor(ROOT.kBlue+1)
	fakeHist = ROOT.TH1F()
	fakeHist.SetLineColor(ROOT.kWhite)
	legend.SetHeader("t#bar{t} Simulation")
	legend.AddEntry(histoSF,"SF","f")
	legend.AddEntry(histoEM,"OF","l")
	
	histoEM.Scale(1.034)
	
	
	histoSF.Draw("samehist")
	histoEM.Draw("samehist")
	legend.Draw("same")
	

	#~ line2.Draw("same")

	
	latex = ROOT.TLatex()
	latex.SetTextFont(42)
	latex.SetTextAlign(31)
	latex.SetTextSize(0.04)
	latex.SetNDC(True)