Esempio n. 1
0
 def buildQCDQuarkGluonWeightingSystModule(self, dataPath, ewkPath,
                                           normFactorsUp, normFactorsDown,
                                           normalizationPoint):
     # Up variation of fake weighting
     mySystModulePlus = pseudoMultiCrabCreator.PseudoMultiCrabModule(
         self._dsetMgr, self._era, self._searchMode, self._optimizationMode,
         "SystVarFakeWeightingPlus")
     self._fakeWeightingPlusResult = qcdInvertedResult.QCDInvertedResultManager(
         dataPath,
         ewkPath,
         self._dsetMgr,
         self._luminosity,
         self.getModuleInfoString(),
         normFactorsUp,
         optionCalculateQCDNormalizationSyst=False,
         optionUseInclusiveNorm=self._opts.useInclusiveNorm)
     myModule.addPlots(self._fakeWeightingPlusResult.getShapePlots(),
                       self._fakeWeightingPlusResult.getShapePlotLabels())
     self._outputCreator.addModule(mySystModulePlus)
     # Down variation of fake weighting
     mySystModuleMinus = pseudoMultiCrabCreator.PseudoMultiCrabModule(
         dself._dsetMgr, self._era, self._searchMode,
         self._optimizationMode, "SystVarFakeWeightingMinus")
     self._fakeWeightingMinusResult = qcdInvertedResult.QCDInvertedResultManager(
         dataPath,
         ewkPath,
         self._dsetMgr,
         self._myLuminosity,
         self.getModuleInfoString(),
         normFactorsDown,
         optionCalculateQCDNormalizationSyst=False)
     myModule.addPlots(self._fakeWeightingMinusResult.getShapePlots(),
                       self._fakeWeightingMinusResult.getShapePlotLabels())
     self._outputCreator.addModule(mySystModuleMinus)
     return
Esempio n. 2
0
def GetRootHistos(datasetsMgr, histoList, regions, binLabels):
    # Definition
    hPathDict = GetHistoPathDict(histoList, printList=False)
    rhDict = {}

    # For-loop: All Control Regions (CR)
    for region in regions:
        # For-loop: All bins
        for binLabel in binLabels:

            # Define labels
            lIncl = "%s-%s" % (region, binLabel)
            lGenB = "%s-%s-%s" % (region, binLabel, "EWKGenuineB")
            lFakeB = "%s-%s-%s" % (region, binLabel, "EWKFakeB")

            # Get the desired histograms
            pIncl = plots.DataMCPlot(datasetsMgr, hPathDict[lIncl])
            pGenB = plots.DataMCPlot(datasetsMgr, hPathDict[lGenB])
            pFakeB = plots.DataMCPlot(datasetsMgr, hPathDict[lFakeB])

            # Clone and Save the root histograms
            rhDict["Data-" + lIncl] = pIncl.histoMgr.getHisto(
                "Data").getRootHisto().Clone("Data-" + lIncl)
            rhDict["EWK-" + lGenB] = pGenB.histoMgr.getHisto(
                "EWK").getRootHisto().Clone("EWK-" + lGenB)
            rhDict["EWK-" + lFakeB] = pFakeB.histoMgr.getHisto(
                "EWK").getRootHisto().Clone("EWK-" + lFakeB)
            if opts.useMC:
                rhDict["QCD-" + lIncl] = pIncl.histoMgr.getHisto(
                    "QCD").getRootHisto().Clone("QCD-" + lIncl)
                # Add EWKFakeB (MC) to QCD (MC) to get FakeB (= QCD_inclusive + EWK_fakeB)
                rhDict["FakeB-" +
                       lIncl] = rhDict["QCD- " + lIncl].Clone("FakeB-" + lIncl)
                rhDict["FakeB-" + lIncl].Add(rhDict["EWK-" + lFakeB], +1)
            else:
                # Subtract EWKGenuineB (MC) from Data to get FakeB (= Data - EWK_genuineB)
                rhDict["FakeB-" +
                       lIncl] = rhDict["Data-" + lIncl].Clone("FakeB-" + lIncl)
                rhDict["FakeB-" + lIncl].Add(rhDict["EWK-" + lGenB], -1)

    # For debugging:
    if 0:
        for k in rhDict:
            if "FakeB" not in k:
                continue
            fakeBResult.PrintTH1Info(rhDict[k])
    return rhDict
Esempio n. 3
0
    def buildModule(self,
                    dataPath,
                    ewkPath,
                    normFactors,
                    calculateQCDNormalizationSyst,
                    normDataSrc=None,
                    normEWKSrc=None):

        # Create containers for results
        Verbose("Create containers for results", True)
        myModule = pseudoMultiCrabCreator.PseudoMultiCrabModule(
            self._dsetMgr, self._era, self._searchMode, self._optimizationMode,
            self._systematicVariation, opts.analysisNameSaveAs)

        Print("Obtaining results", True)
        self._nominalResult = qcdInvertedResult.QCDInvertedResultManager(
            dataPath, ewkPath, self._dsetMgr, self._luminosity,
            self.getModuleInfoString(), normFactors,
            calculateQCDNormalizationSyst, opts.normDataSrc, opts.normEwkSrc,
            self._opts.useInclusiveNorm, opts.verbose)
        Verbose("Storing results", True)
        myModule.addPlots(self._nominalResult.getShapePlots(),
                          self._nominalResult.getShapePlotLabels())
        self._outputCreator.addModule(myModule)
Esempio n. 4
0
def GetRootHistos(datasetsMgr, histoList):
    hPathDict = GetHistoPathDict(histoList, printList=False)
    rhDict = {}

    # For-loop: All histograms
    for h in histoList:
        inclu, genuB, fakeB = GetHistoLabelTriplet(h)

        pIncl = plots.DataMCPlot(datasetsMgr, hPathDict[inclu])
        pGenB = plots.DataMCPlot(datasetsMgr, hPathDict[genuB])
        pFakeB = plots.DataMCPlot(datasetsMgr, hPathDict[fakeB])

        # Define mapping keys: "Datasets-Region-Bin-Triplet"
        key1 = "Data-%s" % (inclu)
        key2 = "EWKGenuineB-%s" % (genuB)
        key3 = "EWKFakeB-%s" % (fakeB)
        key4 = "FakeB-%s" % (inclu)

        # Clone and Save the root histograms
        rhDict[key1] = pIncl.histoMgr.getHisto("Data").getRootHisto().Clone(
            "Data-" + h)
        rhDict[key2] = pGenB.histoMgr.getHisto("EWK").getRootHisto().Clone(
            "EWKGenuineB-" + h)
        rhDict[key3] = pFakeB.histoMgr.getHisto("EWK").getRootHisto().Clone(
            "EWKFakeB-" + h)
        rhDict[key4] = pIncl.histoMgr.getHisto("Data").getRootHisto().Clone(
            "FakeB-" + h)
        rhDict[key4].Add(rhDict[key2], -1)

    # For debugging:
    if 0:
        for k in rhDict:
            if "FakeB" not in k:
                continue
            fakeBResult.PrintTH1Info(rhDict[k])
    return rhDict
Esempio n. 5
0
    def buildModule(self,
                    dataPath,
                    ewkPath,
                    normFactors,
                    calculateQCDNormalizationSyst,
                    normDataSrc=None,
                    normEWKSrc=None):

        # Create containers for results
        self.Verbose("Create containers for results", True)
        myModule = pseudoMultiCrabCreator.PseudoMultiCrabModule(
            self._dsetMgr, self._era, self._searchMode, self._optimizationMode,
            self._systematicVariation, opts.analysisNameSaveAs, opts.verbose)

        self.Verbose("Obtain results from the results manager", True)
        self._nominalResult = qcdInvertedResult.QCDInvertedResultManager(
            dataPath,
            ewkPath,
            self._dsetMgr,
            self._luminosity,
            self.getModuleInfoString(),
            normFactors,
            calculateQCDNormalizationSyst,
            opts.normDataSrc,
            opts.normEwkSrc,
            self._opts.useInclusiveNorm,
            keyList=["AllSelections"],
            verbose=opts.verbose)

        self.Verbose(
            "Add all plots to be written in the peudo-dataset beind created",
            True)
        myModule.addPlots(self._nominalResult.getShapePlots(),
                          self._nominalResult.getShapePlotLabels())
        self._outputCreator.addModule(myModule)
        return