def _obtainQCDNormalizationSystHistograms(self, shapeHisto, dsetMgr,
                                           plotName, luminosity,
                                           normDataSrc, normEWKSrc):
     print ShellStyles.HighlightStyle(
     ) + "...Obtaining region transition systematics" + ShellStyles.NormalStyle(
     )
     myPlotSignalRegionShape = dataDrivenQCDCount.DataDrivenQCDShape(
         dsetMgr=dsetMgr,
         dsetLabelData="Data",
         dsetLabelEwk="EWK",
         histoName=plotName,
         dataPath=normDataSrc + "QCDNormalizationSignal",
         ewkPath=normEWKSrc + "QCDNormalizationSignal",
         luminosity=luminosity)
     myPlotControlRegionShape = dataDrivenQCDCount.DataDrivenQCDShape(
         dsetMgr=dsetMgr,
         dsetLabelData="Data",
         dsetLabelEwk="EWK",
         histoName=plotName,
         dataPath=normDataSrc + "QCDNormalizationControl",
         ewkPath=normEWKSrc + "QCDNormalizationControl",
         luminosity=luminosity)
     myPlotRegionTransitionSyst = metSyst.SystematicsForMetShapeDifference(
         myPlotSignalRegionShape,
         myPlotControlRegionShape,
         shapeHisto,
         moduleInfoString=self._moduleInfoString,
         quietMode=True)
     myPlotSignalRegionShape.delete()
     myPlotControlRegionShape.delete()
     # Store up and down variations
     #hUp = aux.Clone(myPlotRegionTransitionSyst.getUpHistogram(), "QCDfactMgrSystQCDSystUp%d"%i)
     #hUp.SetTitle(plotName+"systQCDUp")
     #self._QCDNormalizationSystPlots.append(hUp)
     #self._QCDNormalizationSystPlotLabels.append(hUp.GetTitle())
     #hDown = aux.Clone(myPlotRegionTransitionSyst.getDownHistogram(), "QCDfactMgrSystQCDSystDown%d"%i)
     #hDown.SetTitle(plotName+"systQCDDown")
     #self._QCDNormalizationSystPlots.append(hDown)
     #self._QCDNormalizationSystPlotLabels.append(hDown.GetTitle())
     # Store source histograms
     hNum = aux.Clone(
         myPlotRegionTransitionSyst.getCombinedSignalRegionHistogram(),
         "QCDfactMgrSystQCDSystNumerator")
     hNum.SetTitle(plotName + "systQCDNumerator")
     self._QCDNormalizationSystPlots.append(hNum)
     self._QCDNormalizationSystPlotLabels.append(hNum.GetTitle())
     hDenom = aux.Clone(
         myPlotRegionTransitionSyst.getCombinedCtrlRegionHistogram(),
         "QCDfactMgrSystQCDSystDenominator")
     hDenom.SetTitle(plotName + "systQCDDenominator")
     self._QCDNormalizationSystPlots.append(hDenom)
     self._QCDNormalizationSystPlotLabels.append(hDenom.GetTitle())
     # Free memory
     myPlotRegionTransitionSyst.delete()
Example #2
0
 def _obtainShapeHistograms(self, i, dataPath, ewkPath, dsetMgr, plotName, luminosity, normFactors):
     myShape = dataDrivenQCDCount.DataDrivenQCDShape(dsetMgr=dsetMgr,
                                                     dsetLabelData="Data",
                                                     dsetLabelEwk="EWK",
                                                     histoName=plotName,
                                                     dataPath=dataPath,
                                                     ewkPath=ewkPath,
                                                     luminosity=luminosity)
     myPlot = QCDInvertedShape(myShape,
                               self._moduleInfoString+"_"+plotName,
                               normFactors,
                               optionUseInclusiveNorm=self._useInclusiveNorm)
     myShape.delete()
     myPlotHisto = aux.Clone(myPlot.getResultShape(), "ctrlPlotShapeInManager")
     myPlot.delete()
     myPlotHisto.SetName(plotName+"%d"%i)
     myPlotHisto.SetTitle(plotName)
     self._shapePlots.append(myPlotHisto)
     self._shapePlotLabels.append(plotName)
     # MC EWK and purity
     #myPlotMCEWKHisto = aux.Clone(myPlot.getResultMCEWK(), "ctrlPlotMCEWKInManager")
     #myPlotMCEWKHisto.SetName(plotName+"%d_MCEWK"%i)
     #myPlotMCEWKHisto.SetTitle(plotName+"_MCEWK")
     #self._shapePlots.append(myPlotMCEWKHisto)
     #self._shapePlotLabels.append(myPlotMCEWKHisto.GetTitle())
     #myPlotPurityHisto = aux.Clone(myPlot.getResultPurity(), "ctrlPlotPurityInManager")
     #myPlotPurityHisto.SetName(plotName+"%d_Purity"%i)
     #myPlotPurityHisto.SetTitle(plotName+"_Purity")
     #self._shapePlots.append(myPlotPurityHisto)
     #self._shapePlotLabels.append(myPlotPurityHisto.GetTitle())
     return myPlotHisto
Example #3
0
    def __init__(self,
                 dsetMgr,
                 shapeString,
                 myNormfactors,
                 luminosity,
                 EWKUncertaintyFactor=1.0,
                 UncertAffectsTT=True,
                 dataDrivenFakeTaus=True):
        self.sortedFactors = {}
        self.sortedFactors = self.sortFactors(myNormfactors)
        # get shapes
        self.qcdShape = dataDrivenQCDCount.DataDrivenQCDShape(
            dsetMgr,
            "Data",
            "EWK",
            shapeString,
            luminosity,
            EWKUncertaintyFactor=EWKUncertaintyFactor,
            dataDrivenFakeTaus=False,
            UncertAffectsTT=UncertAffectsTT)
        self.faketauShape = dataDrivenQCDCount.DataDrivenQCDShape(
            dsetMgr,
            "Data",
            "EWK",
            shapeString,
            luminosity,
            EWKUncertaintyFactor=EWKUncertaintyFactor,
            dataDrivenFakeTaus=True,
            UncertAffectsTT=UncertAffectsTT)

        self.weights = []
        self.weightErrors = []
        self.weightsSystVarUp = []
        self.weightsSystVarDown = []

        self.fakerates = {}
        self.fakeratesSystVarUp = {}
        self.fakeratesSystVarDown = {}
        self.sortedfakerates = {}

        self.dataDrivenFakeTaus = dataDrivenFakeTaus

        self.averageWeight = 0

        #        print "DEBUG: **** WRONG ****"

        self.doCalculate()