示例#1
0
 def rebin(h, name):
     myBinning = []
     if name.startswith("MT"):
         myBinning = systematics.getBinningForPlot("shapeTransverseMass")
         #myBinning = [0,20,40,60,80,100,120,140,160,200,400]
     elif name.startswith("INVMASS"):
         myBinning = systematics.getBinningForPlot("shapeInvariantMass")
     else:
         raise Exception("Unknown binning information")
     myArray = array.array("d", myBinning)
     # Rebin and move under/overflow bins to visible bins
     h = h.Rebin(len(myBinning) - 1, "", myArray)
     h.SetBinContent(1, h.GetBinContent(0) + h.GetBinContent(1))
     h.SetBinError(1,
                   math.sqrt(h.GetBinContent(0)**2 + h.GetBinContent(1)**2))
     h.SetBinContent(
         h.GetNbinsX() + 1,
         h.GetBinContent(h.GetNbinsX() + 1) +
         h.GetBinContent(h.GetNbinsX() + 2))
     h.SetBinError(
         h.GetNbinsX() + 1,
         math.sqrt(
             h.GetBinError(h.GetNbinsX() + 1)**2 +
             h.GetBinError(h.GetNbinsX() + 2)**2))
     h.SetBinContent(0, 0.0)
     h.SetBinError(0, 0.0)
     h.SetBinContent(h.GetNbinsX() + 2, 0.0)
     h.SetBinError(h.GetNbinsX() + 2, 0.0)
     return h
 def rebin(h, name):
     myBinning = []
     if name.startswith("MT"):
         myBinning = systematics.getBinningForPlot("shapeTransverseMass")
     elif name.startswith("INVMASS"):
         myBinning = systematics.getBinningForPlot("shapeInvariantMass")
     else:
         raise Exception("Unknown binning information")
     maxBin = h.GetXaxis().GetBinUpEdge(h.GetNbinsX())
     if maxBin < myBinning[-1]:
         print WarningLabel()+"Adjust rebinning last bin from %.0f to %.0f because that is the up edge of last bin in the historam" % (myBinning[-1], maxBin)
         myBinning[-1] = 500
     myArray = array.array("d",myBinning)
     # Rebin and move under/overflow bins to visible bins
     h = h.Rebin(len(myBinning)-1,"",myArray)
     histogramsExtras.makeFlowBinsVisible(h)
     return h
示例#3
0
def doPurityPlots(opts, histoName, dsetMgr, moduleInfoString, myDir, luminosity, myShapePurityHistograms):
    def handleOverflow(h):
        h.SetBinContent(1, h.GetBinContent(0)+h.GetBinContent(1))
        h.SetBinError(1, math.sqrt(h.GetBinContent(0)**2 + h.GetBinContent(1)**2))
        h.SetBinContent(h.GetNbinsX()+1, h.GetBinContent(h.GetNbinsX()+1)+h.GetBinContent(h.GetNbinsX()+2))
        h.SetBinError(h.GetNbinsX()+1, math.sqrt(h.GetBinError(h.GetNbinsX()+1)**2 + h.GetBinError(h.GetNbinsX()+2)**2))
        h.SetBinContent(0, 0.0)
        h.SetBinError(0, 0.0)
        h.SetBinContent(h.GetNbinsX()+2, 0.0)
        h.SetBinError(h.GetNbinsX()+2, 0.0)

    myQCDShape = DataDrivenQCDShape(dsetMgr, "Data", "EWK", histoName, luminosity)
    mySplit = histoName.split("/")
    histoName = mySplit[len(mySplit)-1]
    # Get data and EWK histograms
    hData = myQCDShape.getIntegratedDataHisto()
    hEWK = myQCDShape.getIntegratedEwkHisto()
    # Rebin and handle overflow
    myBinning = systematics.getBinningForPlot(histoName)
    myArray = array.array("d",myBinning)
    hData = hData.Rebin(len(myBinning)-1,"",myArray)
    hEWK = hEWK.Rebin(len(myBinning)-1,"",myArray)
    handleOverflow(hData)
    handleOverflow(hEWK)
    # Create purity histo
    hPurity = aux.Clone(hData)
    hPurity.Reset()
    # Calculate purity
    for i in xrange(1, hPurity.GetNbinsX()+1):
        myPurity = 0.0
        myUncert = 0.0
        nData = hData.GetBinContent(i)
        nEWK = hEWK.GetBinContent(i)
        if (nData > 0.0):
            myPurity = (nData - nEWK) / nData
            if myPurity < 0.0:
                myPurity = 0.0
                myUncert = 0.0
            else:
                myUncert = sqrt(myPurity * (1.0-myPurity) / nData) # Assume binomial error
        hPurity.SetBinContent(i, myPurity)
        hPurity.SetBinError(i, myUncert)
    # Find out tail killer scenario
    myScenario = ""
    if "QCDTailKillerLoose" in moduleInfoString:
        myScenario = "Loose"
    elif "QCDTailKillerMedium" in moduleInfoString:
        myScenario = "Medium"
    if "QCDTailKillerTight" in moduleInfoString:
        myScenario = "Tight"
    myScenario += " R_{bb}^{min.}"
    # Make histogram
    hPurity.SetLineColor(styles.styles[len(myShapePurityHistograms)].color)
    hPurity.SetMarkerColor(styles.styles[len(myShapePurityHistograms)].color)
    hPurity.SetMarkerStyle(styles.styles[len(myShapePurityHistograms)].marker)
    # Plot
    histo = histograms.Histo(hPurity, myScenario, drawStyle="", legendStyle="lp")
    myShapePurityHistograms.append(histo)
示例#4
0
 def rebin(h, name):
     myBinning = []
     if name.startswith("MT"):
         myBinning = systematics.getBinningForPlot("shapeTransverseMass")
     elif name.startswith("INVMASS"):
         myBinning = systematics.getBinningForPlot("shapeInvariantMass")
     else:
         raise Exception("Unknown binning information")
     maxBin = h.GetXaxis().GetBinUpEdge(h.GetNbinsX())
     if maxBin < myBinning[-1]:
         print WarningLabel(
         ) + "Adjust rebinning last bin from %.0f to %.0f because that is the up edge of last bin in the historam" % (
             myBinning[-1], maxBin)
         myBinning[-1] = 500
     myArray = array.array("d", myBinning)
     # Rebin and move under/overflow bins to visible bins
     h = h.Rebin(len(myBinning) - 1, "", myArray)
     histogramsExtras.makeFlowBinsVisible(h)
     return h
 def rebin(h, name):
     myBinning = []
     if name.startswith("MT"):
         myBinning = systematics.getBinningForPlot("shapeTransverseMass")
         #myBinning = [0,20,40,60,80,100,120,140,160,200,400]
     elif name.startswith("INVMASS"):
         myBinning = systematics.getBinningForPlot("shapeInvariantMass")
     else:
         raise Exception("Unknown binning information")
     myArray = array.array("d",myBinning)
     # Rebin and move under/overflow bins to visible bins
     h = h.Rebin(len(myBinning)-1,"",myArray)
     h.SetBinContent(1, h.GetBinContent(0)+h.GetBinContent(1))
     h.SetBinError(1, math.sqrt(h.GetBinContent(0)**2 + h.GetBinContent(1)**2))
     h.SetBinContent(h.GetNbinsX()+1, h.GetBinContent(h.GetNbinsX()+1)+h.GetBinContent(h.GetNbinsX()+2))
     h.SetBinError(h.GetNbinsX()+1, math.sqrt(h.GetBinError(h.GetNbinsX()+1)**2 + h.GetBinError(h.GetNbinsX()+2)**2))
     h.SetBinContent(0, 0.0)
     h.SetBinError(0, 0.0)
     h.SetBinContent(h.GetNbinsX()+2, 0.0)
     h.SetBinError(h.GetNbinsX()+2, 0.0)
     return h
示例#6
0
import cProfile

import HiggsAnalysis.HeavyChHiggsToTauNu.tools.dataset as dataset
import HiggsAnalysis.HeavyChHiggsToTauNu.tools.plots as plots
import HiggsAnalysis.HeavyChHiggsToTauNu.tools.systematics as systematics
from HiggsAnalysis.HeavyChHiggsToTauNu.tools.analysisModuleSelector import *
from HiggsAnalysis.HeavyChHiggsToTauNu.qcdCommon.dataDrivenQCDCount import *
from HiggsAnalysis.HeavyChHiggsToTauNu.qcdFactorised.qcdFactorisedResult import *
from HiggsAnalysis.HeavyChHiggsToTauNu.tools.ShellStyles import *
from HiggsAnalysis.HeavyChHiggsToTauNu.tools.pseudoMultiCrabCreator import *

myMtSpecs = {
    "basicName": "QCDfactorised/MtAfterStandardSelections",
    "leg1Name": "QCDfactorised/MtAfterLeg1",
    "leg2Name": "QCDfactorised/MtAfterLeg2",
    "binList": systematics.getBinningForPlot("shapeTransverseMass"),
}

myFullMassSpecs = {
    "basicName": "QCDfactorised/MassAfterStandardSelections",
    "leg1Name": "QCDfactorised/MassAfterLeg1",
    "leg2Name": "QCDfactorised/MassAfterLeg2",
    "binList": systematics.getBinningForPlot("shapeInvariantMass"),
}


def doNominalModule(myMulticrabDir, era, searchMode, optimizationMode,
                    myOutputCreator, myShapeString, myDisplayStatus):
    # Construct info string of module
    myModuleInfoString = "%s_%s_%s" % (era, searchMode, optimizationMode)
    # Obtain dataset manager
示例#7
0
def doPurityPlots(opts, histoName, dsetMgr, moduleInfoString, myDir,
                  luminosity, myShapePurityHistograms):
    def handleOverflow(h):
        h.SetBinContent(1, h.GetBinContent(0) + h.GetBinContent(1))
        h.SetBinError(1,
                      math.sqrt(h.GetBinContent(0)**2 + h.GetBinContent(1)**2))
        h.SetBinContent(
            h.GetNbinsX() + 1,
            h.GetBinContent(h.GetNbinsX() + 1) +
            h.GetBinContent(h.GetNbinsX() + 2))
        h.SetBinError(
            h.GetNbinsX() + 1,
            math.sqrt(
                h.GetBinError(h.GetNbinsX() + 1)**2 +
                h.GetBinError(h.GetNbinsX() + 2)**2))
        h.SetBinContent(0, 0.0)
        h.SetBinError(0, 0.0)
        h.SetBinContent(h.GetNbinsX() + 2, 0.0)
        h.SetBinError(h.GetNbinsX() + 2, 0.0)

    myQCDShape = DataDrivenQCDShape(dsetMgr, "Data", "EWK", histoName,
                                    luminosity)
    mySplit = histoName.split("/")
    histoName = mySplit[len(mySplit) - 1]
    # Get data and EWK histograms
    hData = myQCDShape.getIntegratedDataHisto()
    hEWK = myQCDShape.getIntegratedEwkHisto()
    # Rebin and handle overflow
    if "EWKGenuineTaus" in histoName:
        myBinning = [0, 20, 40, 60, 80, 100, 120, 140, 160, 200, 300, 700]
    else:
        myBinning = systematics.getBinningForPlot(
            histoName)  #(histoName.replace("EWKGenuineTaus",""))
    myArray = array.array("d", myBinning)
    hData = hData.Rebin(len(myBinning) - 1, "", myArray)
    hEWK = hEWK.Rebin(len(myBinning) - 1, "", myArray)
    handleOverflow(hData)
    handleOverflow(hEWK)
    # Create purity histo
    hPurity = aux.Clone(hData)
    hPurity.Reset()
    # Calculate purity
    for i in xrange(1, hPurity.GetNbinsX() + 1):
        myPurity = 0.0
        myUncert = 0.0
        nData = hData.GetBinContent(i)
        nEWK = hEWK.GetBinContent(i)
        if (nData > 0.0):
            myPurity = (nData - nEWK) / nData
            if myPurity < 0.0:
                myPurity = 0.0
                myUncert = 0.0
            else:
                myUncert = sqrt(myPurity * (1.0 - myPurity) /
                                nData)  # Assume binomial error
        hPurity.SetBinContent(i, myPurity)
        hPurity.SetBinError(i, myUncert)
    # Find out tail killer scenario
    myScenario = ""
    if "QCDTailKillerLoose" in moduleInfoString:
        myScenario = "Loose"
    elif "QCDTailKillerMedium" in moduleInfoString:
        myScenario = "Medium"
    if "QCDTailKillerTight" in moduleInfoString:
        myScenario = "Tight"
    myScenario += " R_{bb}^{min.}"
    # Make histogram
    hPurity.SetLineColor(styles.styles[len(myShapePurityHistograms)].color)
    hPurity.SetMarkerColor(styles.styles[len(myShapePurityHistograms)].color)
    hPurity.SetMarkerStyle(styles.styles[len(myShapePurityHistograms)].marker)
    # Plot
    histo = histograms.Histo(hPurity,
                             myScenario,
                             drawStyle="",
                             legendStyle="lp")
    myShapePurityHistograms.append(histo)
    def createPlot(name):
        if mtOnly and "shapeTransverseMass" not in name:
            return None

        drhEmb = getDRH(dsetEmb, name, systematicsEmbMC)
        drhSig = getDRH(dsetSig, name, systematicsSigMC)
        drhEmb.normalizeToLuminosity(lumi)
        drhSig.normalizeToLuminosity(lumi)
        drhEmb.setName("Embedded")
        drhSig.setName("Normal")
        if addData:
            drhEmbData = getDRH(dsetEmbData, name, None)
            drhEmbData.setName("Embedded data")

        if "shapeTransverseMass" in name and "TTJets" in datasetName:
            doScaleFactors(drhSig.getHistogramWithUncertainties(),
                           drhEmb.getHistogramWithUncertainties(), outputDir,
                           opts)

        if addData:
            p = plots.ComparisonManyPlot(drhSig, [drhEmb, drhEmbData])
        else:
            p = plots.ComparisonManyPlot(drhSig, [drhEmb])
        p.setLuminosity(lumi)
        legLabel = plots._legendLabels.get(datasetName, datasetName)
        legEmb = "Embedded " + legLabel
        #legSig = "Normal "+legLabel
        #legSig = legLabel
        legSig = "Non-emb. %s with ^{}#tau_{h}" % legLabel
        if addEventCounts:
            legEmb += " (" + strIntegral(drhEmb.getHistogram()) + ")"
            legSig += " (" + strIntegral(drhSig.getHistogram()) + ")"
        p.histoMgr.setHistoLegendLabelMany({
            "Embedded": legEmb,
            "Normal": legSig,
        })
        #p.histoMgr.forEachHisto(styles.generator())
        hemb = p.histoMgr.getHisto("Embedded")
        hemb.setDrawStyle("HIST E")
        hemb.setLegendStyle("L")
        themb = hemb.getRootHisto()
        #styles.ttStyle.apply(themb)
        themb.SetLineColor(ROOT.kBlue)
        themb.SetLineWidth(2)
        themb.SetMarkerColor(themb.GetLineColor())
        themb.SetMarkerSize(0)
        hsig = p.histoMgr.getHisto("Normal")
        hsig.setLegendStyle("F")
        thsig = hsig.getRootHisto()
        thsig.SetFillColor(ROOT.kGray)
        thsig.SetLineColor(thsig.GetFillColor())
        histoOrder = ["Embedded", "Normal"]
        if addData:
            legData = "Embedded data"
            histoOrder.append("Embedded data")
            if addEventCounts:
                legData += " (" + strIntegral(drhEmbData.getHistogram()) + ")"
            p.histoMgr.setHistoLegendLabelMany({"Embedded data": legData})
            p.histoMgr.forHisto("Embedded data", styles.dataStyle)
            p.histoMgr.setHistoDrawStyle("Embedded data", "EP")
            p.histoMgr.setHistoLegendStyle("Embedded data", "P")
            p.histoMgr.reorderDraw(["Embedded data", "Embedded", "Normal"])
        if opts.dofit:
            p.setDrawOptions(ratioYlabel="Norm./Emb.",
                             ratioInvert=True,
                             ratioType="errorPropagation")
            if "shapeTransverseMass" in name and "TTJets" in datasetName:
                binning = systematics.getBinningForPlot("shapeTransverseMass")
                p.setDrawOptions(
                    customizeBeforeSave=lambda p: doScaleFactorFit(
                        p, outputDir),
                    rebin=range(0, 160, 20) + binning[binning.index(160):])
        else:
            #            p.setDrawOptions(ratioYlabel="Emb./Norm.")
            p.setDrawOptions(ratioYlabel="Emb./Non-emb.")
        p.histoMgr.reorder(histoOrder)
        return p
    def compare(step):
        if step is None:
            path = "shapeTransverseMass"
        else:
            path = "CommonPlots/AtEveryStep/%s/MET_MET" % step

        #bins = range(0, 200, 20) + [200, 250, 300, 500]
        bins = systematics.getBinningForPlot("shapeTransverseMass")

        def getTH1(ds):
            drh = ds.getDatasetRootHisto(path)
            drh.normalizeToLuminosity(lumi)
            th1 = drh.getHistogram()
            #th1.Rebin(2)
            #return th1
            return th1.Rebin(len(bins)-1, th1.GetName(), array.array("d", bins))

        th1NormalNum = getTH1(dsetNormalNum)
        th1NormalDenom = getTH1(dsetNormalDenom)

        #print th1NormalNum.Integral(0, th1NormalNum.GetNbinsX()+1), th1NormalDenom.Integral(0, th1NormalDenom.GetNbinsX()+1)

        th1EmbNum = getTH1(dsetEmbNum)
        th1EmbDenom = getTH1(dsetEmbDenom)

        #print th1EmbNum.Integral(0, th1EmbNum.GetNbinsX()+1), th1EmbDenom.Integral(0, th1EmbDenom.GetNbinsX()+1)

        effNormal = ROOT.TGraphAsymmErrors(th1NormalNum, th1NormalDenom, "n")
        effEmb = ROOT.TGraphAsymmErrors(th1EmbNum, th1EmbDenom, "n")

        effNormal.SetName("Normal ttbar")
        effEmb.SetName("Embedded ttbar")

        p = plots.ComparisonManyPlot(effNormal, [effEmb])
        p.setLuminosity(lumi)
        p.histoMgr.forEachHisto(styles.generator())
        #p.histoMgr.forHisto("Normal ttbar", lambda h: doStyle(h, ROOT.kBlack, ROOT.kFullCircle))
        #p.histoMgr.forHisto("Embedded ttbar", lambda h: doStyle(h, ROOT.kRed, ROOT.kFullSquare))
        p.histoMgr.setHistoDrawStyleAll("EP")
        p.histoMgr.setHistoLegendStyleAll("EPL")

        unc1 = 1.12
        unc2 = 0.88
        p.prependPlotObjectToRatio(doLineStyle(ROOT.TLine(0, unc1, bins[-1], unc1)))
        p.prependPlotObjectToRatio(doLineStyle(ROOT.TLine(0, unc2, bins[-1], unc2)))
        p.appendPlotObject(histograms.PlotText(x=0.6, y=0.6, text="CaloMET > 70 GeV", size=20))

        global ind
        ind += 1
        # plots.drawPlot(p, "calometComparison/eff_%02d_calomet_%s"%(ind, step), xlabel="Type I PF MET (GeV)", ylabel="CaloMET cut efficiency",
        #                ratio=True, ratioYlabel="Norm./emb.", ratioType="errorScale",
        #                opts={"xmin": 0, "xmax": 500},
        #                opts2={"ymin": 0.8, "ymax": 1.2},
        #                addLuminosityText=True, moveLegend={"dx": -0.2, "dy": -0.5})


        plots.drawPlot(p, "calometComparison/eff_%d_calomet_shapeTransverseMass"%ind, xlabel="Transverse mass (GeV)", ylabel="CaloMET cut efficiency",
                       ratio=True, ratioYlabel="Emb./Norm.", ratioCreateLegend=True, ratioType="errorScale",
                       opts={"ymax": 1.2},
                       opts2={"ymin": 0.8, "ymax": 1.2},
                       addLuminosityText=True, moveLegend={"dx": -0.2, "dy": -0.5})
import cProfile

import HiggsAnalysis.HeavyChHiggsToTauNu.tools.dataset as dataset
import HiggsAnalysis.HeavyChHiggsToTauNu.tools.plots as plots
import HiggsAnalysis.HeavyChHiggsToTauNu.tools.systematics as systematics
from HiggsAnalysis.HeavyChHiggsToTauNu.tools.analysisModuleSelector import *
from HiggsAnalysis.HeavyChHiggsToTauNu.qcdCommon.dataDrivenQCDCount import *
from HiggsAnalysis.HeavyChHiggsToTauNu.qcdFactorised.qcdFactorisedResult import *
from HiggsAnalysis.HeavyChHiggsToTauNu.tools.ShellStyles import *
from HiggsAnalysis.HeavyChHiggsToTauNu.tools.pseudoMultiCrabCreator import *

myMtSpecs = {
    "basicName": "QCDfactorised/MtAfterStandardSelections",
    "leg1Name": "QCDfactorised/MtAfterLeg1",
    "leg2Name": "QCDfactorised/MtAfterLeg2",
    "binList": systematics.getBinningForPlot("shapeTransverseMass"),
}

myFullMassSpecs = {
    "basicName": "QCDfactorised/MassAfterStandardSelections",
    "leg1Name": "QCDfactorised/MassAfterLeg1",
    "leg2Name": "QCDfactorised/MassAfterLeg2",
    "binList": systematics.getBinningForPlot("shapeInvariantMass"),
}

def doNominalModule(myMulticrabDir,era,searchMode,optimizationMode,myOutputCreator,myShapeString,myDisplayStatus):
    # Construct info string of module
    myModuleInfoString = "%s_%s_%s"%(era, searchMode, optimizationMode)
    # Obtain dataset manager
    dsetMgrCreator = dataset.readFromMulticrabCfg(directory=myMulticrabDir)
    dsetMgr = dsetMgrCreator.createDatasetManager(dataEra=era,searchMode=searchMode,optimizationMode=optimizationMode)
示例#11
0
    def compare(step):
        if step is None:
            path = "shapeTransverseMass"
        else:
            path = "CommonPlots/AtEveryStep/%s/MET_MET" % step

        #bins = range(0, 200, 20) + [200, 250, 300, 500]
        bins = systematics.getBinningForPlot("shapeTransverseMass")

        def getTH1(ds):
            drh = ds.getDatasetRootHisto(path)
            drh.normalizeToLuminosity(lumi)
            th1 = drh.getHistogram()
            #th1.Rebin(2)
            #return th1
            return th1.Rebin(
                len(bins) - 1, th1.GetName(), array.array("d", bins))

        th1NormalNum = getTH1(dsetNormalNum)
        th1NormalDenom = getTH1(dsetNormalDenom)

        #print th1NormalNum.Integral(0, th1NormalNum.GetNbinsX()+1), th1NormalDenom.Integral(0, th1NormalDenom.GetNbinsX()+1)

        th1EmbNum = getTH1(dsetEmbNum)
        th1EmbDenom = getTH1(dsetEmbDenom)

        #print th1EmbNum.Integral(0, th1EmbNum.GetNbinsX()+1), th1EmbDenom.Integral(0, th1EmbDenom.GetNbinsX()+1)

        effNormal = ROOT.TGraphAsymmErrors(th1NormalNum, th1NormalDenom, "n")
        effEmb = ROOT.TGraphAsymmErrors(th1EmbNum, th1EmbDenom, "n")

        effNormal.SetName("Normal ttbar")
        effEmb.SetName("Embedded ttbar")

        p = plots.ComparisonManyPlot(effNormal, [effEmb])
        p.setLuminosity(lumi)
        p.histoMgr.forEachHisto(styles.generator())
        #p.histoMgr.forHisto("Normal ttbar", lambda h: doStyle(h, ROOT.kBlack, ROOT.kFullCircle))
        #p.histoMgr.forHisto("Embedded ttbar", lambda h: doStyle(h, ROOT.kRed, ROOT.kFullSquare))
        p.histoMgr.setHistoDrawStyleAll("EP")
        p.histoMgr.setHistoLegendStyleAll("EPL")

        unc1 = 1.12
        unc2 = 0.88
        p.prependPlotObjectToRatio(
            doLineStyle(ROOT.TLine(0, unc1, bins[-1], unc1)))
        p.prependPlotObjectToRatio(
            doLineStyle(ROOT.TLine(0, unc2, bins[-1], unc2)))
        p.appendPlotObject(
            histograms.PlotText(x=0.6, y=0.6, text="CaloMET > 70 GeV",
                                size=20))

        global ind
        ind += 1
        # plots.drawPlot(p, "calometComparison/eff_%02d_calomet_%s"%(ind, step), xlabel="Type I PF MET (GeV)", ylabel="CaloMET cut efficiency",
        #                ratio=True, ratioYlabel="Norm./emb.", ratioType="errorScale",
        #                opts={"xmin": 0, "xmax": 500},
        #                opts2={"ymin": 0.8, "ymax": 1.2},
        #                addLuminosityText=True, moveLegend={"dx": -0.2, "dy": -0.5})

        plots.drawPlot(p,
                       "calometComparison/eff_%d_calomet_shapeTransverseMass" %
                       ind,
                       xlabel="Transverse mass (GeV)",
                       ylabel="CaloMET cut efficiency",
                       ratio=True,
                       ratioYlabel="Emb./Norm.",
                       ratioCreateLegend=True,
                       ratioType="errorScale",
                       opts={"ymax": 1.2},
                       opts2={
                           "ymin": 0.8,
                           "ymax": 1.2
                       },
                       addLuminosityText=True,
                       moveLegend={
                           "dx": -0.2,
                           "dy": -0.5
                       })