#btagEfficiencyFilename="btageff_TTJets.json",
                                    #btagEfficiencyFilename="btageff_WJetsHT.json",
                                    btagEfficiencyFilename="btageff_hybrid.json",
                                    direction="nominal")

#====== MET selection
metSelection = PSet(
           METCutValue = 100.0, #for heavy H+, overriden in signalAnalysis.py for light H+
       METCutDirection = ">", # options: ==, !=, <, <=, >, >=
  METSignificanceCutValue = -1000.0,
  METSignificanceCutDirection = ">", # options: ==, !=, <, <=, >, >=
               METType = "MET_Type1", # options: MET_Type1, MET_Type1_NoHF, MET_Puppi, GenMET, L1MET, HLTMET, CaloMET
   applyPhiCorrections = False  # FIXME: no effect yet
)
# MET trigger SF
scaleFactors.assignMETTriggerSF(metSelection, bjetSelection.bjetDiscrWorkingPoint, "nominal")

#====== Angular cuts / back-to-back
angularCutsBackToBack = PSet(
       nConsideredJets = 3,    # Number of highest-pt jets to consider (excluding jet corresponding to tau)
enableOptimizationPlots = True, # 2D histograms for optimizing angular cuts
        cutValueJet1 = 0.0,   # Cut value in degrees (circular cut)
        cutValueJet2 = 0.0,   # Cut value in degrees (circular cut)
        cutValueJet3 = 0.0,   # Cut value in degrees (circular cut)
        cutValueJet4 = 0.0,   # Cut value in degrees (circular cut)
)
#====== Experimental
jetCorrelations = PSet (

)
Пример #2
0
    def __init__(self, selectorName, moduleName, config, verbose, **kwargs):
        self._selectorName = selectorName
        self._moduleName = moduleName
        self._config  = config.clone()
        self._verbose = verbose

        # Process all keyword arguments to make changes to the config
        keys = kwargs.keys()
        for key in keys:
	    value = kwargs[key]
	    if key == "systematics":
                self._config.histogramAmbientLevel = "Systematics"
          
                # Energy scales
		if value.startswith("TauES"):
		    self._config.TauSelection.systematicVariation = "_"+value.replace("Plus","down").replace("Minus","up").replace("TauES","TES")
		elif value.startswith("JES"):
		    self._config.JetSelection.systematicVariation = "_"+value.replace("Plus","down").replace("Minus","up")
		elif value.startswith("JER"):
		    self._config.JetSelection.systematicVariation = "_"+value.replace("Plus","down").replace("Minus","up")
		elif value.startswith("UES"):
                    # FIXME: should also _y be taken into account?
		    self._config.METSelection.systematicVariation = "_"+value.replace("Plus_x","down_x").replace("Minus_x","up_x").replace("UES","MET_Type1_UnclusteredEn") 
		    self._config.METSelection.systematicVariation = "_"+value.replace("Plus_y","down_y").replace("Minus_y","up_y").replace("UES","MET_Type1_UnclusteredEn")
		# Fake tau 
		elif value.startswith("FakeTau"):
                    partonFakingTau = None
                    if "Electron" in value:
                        partonFakingTau = "eToTau"
                    elif "Muon" in value:
                        partonFakingTau = "muToTau"
                    elif "Jet" in value:
                        partonFakingTau = "jetToTau"
                    scaleFactors.assignTauMisidentificationSF(self._config.TauSelection, 
                                                              partonFakingTau, 
                                                              self._getDirectionString(value))
		# Trigger
		elif value.startswith("TauTrgEff"):
                    variationType = value.replace("TauTrgEff","").replace("Minus","").replace("Plus","")
                    scaleFactors.assignTauTriggerSF(self._config.TauSelection, self._getDirectionString(value), self._config.Trigger.TautriggerEfficiencyJsonName, variationType)
                elif value.startswith("METTrgEff"):
                    variationType = value.replace("METTrgEff","").replace("Minus","").replace("Plus","")
                    scaleFactors.assignMETTriggerSF(self._config.METSelection, self._config.BJetSelection.bjetDiscrWorkingPoint, self._getDirectionString(value), self._config.Trigger.METtriggerEfficiencyJsonName, variationType)

                # tau ID syst
                elif value.startswith("TauIDSyst"):
                    self._config.systematicVariation = "_"+value.replace("Plus","down").replace("Minus","up")

		# b tag SF
		elif value.startswith("BTagSF") or value.startswith("BMistagSF"):
                    variationType = None
                    if value.startswith("BTagSF"):
                        variationType = "tag"
                    elif value.startswith("BMistagSF"):
                        variationType = "mistag"
                    direction = value.replace("BTagSF","").replace("BMistagSF","").replace("Minus","down").replace("Plus","up")
                    scaleFactors.updateBtagSFInformationForVariations(self._config.BJetSelection, direction=direction, variationInfo=variationType)

		# top quarks
		elif value.startswith("TopPt"):
                    self._config.topPtSystematicVariation = value.replace("TopPt","").replace("Plus","plus").replace("Minus","minus")
#		# PU weights
		elif value.startswith("PUWeight"):
                    self._config.PUWeightSystematicVariation = value.replace("PUWeight","").replace("Plus","plus").replace("Minus","minus")
		else:
		    if value != "nominal":
                        raise Exception("Error: unsupported variation item '%s'!"%value)
	    else:
		# Process optimization options
		# First check that key is found in config
		subkeys = key.split(".")
		subconfig = [self._config]
		suffix = ""
		for i in range(len(subkeys)-1):
		    if not hasattr(subconfig[len(subconfig)-1], subkeys[i]):
			raise Exception("Error: Cannot find key %s.%s in the config!"%(suffix, subkeys[i]))
		    subconfig.append(getattr(subconfig[len(subconfig)-1], subkeys[i]))
		    if suffix == "":
			suffix += "%s"%subkeys[i]
		    else:
			suffix += ".%s"%subkeys[i]
		# Set varied value in configuration (treat AngularCuts in a special way)
		if key.startswith("AngularCuts") and subkeys[len(subkeys)-1] == "workingPoint":
                    from HiggsAnalysis.NtupleAnalysis.parameters.signalAnalysisParameters import setAngularCutsWorkingPoint
                    setAngularCutsWorkingPoint(subconfig[len(subconfig)-1], value)
                else: # all other settings than AngularCuts
                    if not hasattr(subconfig[len(subconfig)-1], subkeys[len(subkeys)-1]):
                        raise Exception("Error: Cannot find key %s.%s in the config!"%(suffix, subkeys[len(subkeys)-1]))
                    setattr(subconfig[len(subconfig)-1], subkeys[len(subkeys)-1], value)
                # Additionally, set a new tau ID scale factor if needed
                    from HiggsAnalysis.NtupleAnalysis.parameters.scaleFactors import assignTauIdentificationSF
                    scaleFactors.assignTauIdentificationSF(subconfig[len(subconfig)-1])
Пример #3
0
    def __init__(self, selectorName, moduleName, config, **kwargs):
        self._selectorName = selectorName
        self._moduleName = moduleName
        self._config = config.clone()
        #self.__dict__.update(kwargs)
	#print kwargs
        #===== Process all keyword arguments to make changes to the config
        keys = kwargs.keys()
        for key in keys:
	    value = kwargs[key]
	    if key == "systematics":
                self._config.histogramAmbientLevel = "Systematics"
                # Energy scales
		if value.startswith("tauES"):
		    self._config.TauSelection.systematicVariation = "_"+value.replace("Plus","down").replace("Minus","up").replace("tauES","TES")
		elif value.startswith("JES"):
		    self._config.JetSelection.systematicVariation = "_"+value.replace("Plus","down").replace("Minus","up")
		# Fake tau 
		elif value.startswith("FakeTau"):
                    etaRegion = "full"
                    if "Barrel" in value:
                        etaRegion = "barrel"
                    elif "Endcap" in value:
                        etaRegion = "endcap"
                    partonFakingTau = None
                    if "Electron" in value:
                        partonFakingTau = "eToTau"
                    elif "Muon" in value:
                        partonFakingTau = "muToTau"
                    elif "Jet" in value:
                        partonFakingTau = "jetToTau"
                    scaleFactors.assignTauMisidentificationSF(self._config.TauSelection, 
                                                              partonFakingTau, etaRegion, 
                                                              self._getDirectionString(value))
		# Trigger
		elif value.startswith("TauTrgEff"):
                    variationType = value.replace("TauTrgEff","").replace("Minus","").replace("Plus","")
                    scaleFactors.assignTauTriggerSF(self._config.TauSelection, self._getDirectionString(value), variationType)
                elif value.startswith("METTrgEff"):
                    variationType = value.replace("METTrgEff","").replace("Minus","").replace("Plus","")
                    scaleFactors.assignMETTriggerSF(self._config.METSelection, self._config.BJetSelection.bjetDiscrWorkingPoint, self._getDirectionString(value), variationType)
		# b tag SF
		elif value.startswith("BTagSF") or value.startswith("BMistagSF"):
                    variationType = None
                    if value.startswith("BTagSF"):
                        variationType = "tag"
                    elif value.startswith("BMistagSF"):
                        variationType = "mistag"
                    direction = value.replace("BTagSF","").replace("BMistagSF","").replace("Minus","down").replace("Plus","up")
                    scaleFactors.setupBtagSFInformation(self._config.BJetSelection,
                                                        btagPayloadFilename="CSVv2.csv",
                                                        btagEfficiencyFilename="btageff_TTJets.json",
                                                        direction=direction,
                                                        variationInfo=variationType)
		# top quarks
		elif value.startswith("TopPt"):
                    self._config.topPtSystematicVariation = value.replace("TopPt","").replace("Plus","plus").replace("Minus","minus")
		else:
		    if value != "nominal":
                        raise Exception("Error: unsupported variation item '%s'!"%value)
	    else:
		# Process optimization options
		# First check that key is found in config
		subkeys = key.split(".")
		subconfig = [self._config]
		suffix = ""
		for i in range(len(subkeys)-1):
		    if not hasattr(subconfig[len(subconfig)-1], subkeys[i]):
			raise Exception("Error: Cannot find key %s.%s in the config!"%(suffix, subkeys[i]))
		    subconfig.append(getattr(subconfig[len(subconfig)-1], subkeys[i]))
		    if suffix == "":
			suffix += "%s"%subkeys[i]
		    else:
			suffix += ".%s"%subkeys[i]
		# Set value
		if key.startswith("AngularCuts") and subkeys[len(subkeys)-1] == "workingPoint":
                    from HiggsAnalysis.NtupleAnalysis.parameters.signalAnalysisParameters import setAngularCutsWorkingPoint
                    setAngularCutsWorkingPoint(subconfig[len(subconfig)-1], value)
                else:
                    if not hasattr(subconfig[len(subconfig)-1], subkeys[len(subkeys)-1]):
                        raise Exception("Error: Cannot find key %s.%s in the config!"%(suffix, subkeys[len(subkeys)-1]))
                    setattr(subconfig[len(subconfig)-1], subkeys[len(subkeys)-1], value)
                                    #btagEfficiencyFilename="btageff_hybrid.json",
                                    #btagEfficiencyFilename="btageff_hybrid_HToTB.json",
                                    btagEfficiencyFilename="btageff_Hybrid_TT+WJetsHT.json", # use with taunu analysis and WJetsHT samples
                                    direction="nominal")

#====== MET selection
metSelection = PSet(
           METCutValue = 90.0,
       METCutDirection = ">", # options: ==, !=, <, <=, >, >=
  METSignificanceCutValue = -1000.0,
  METSignificanceCutDirection = ">", # options: ==, !=, <, <=, >, >=
               METType = "MET_Type1", # options: MET_Type1, MET_Type1_NoHF, MET_Puppi, GenMET, L1MET, HLTMET, CaloMET
   applyPhiCorrections = False  # FIXME: no effect yet
)
# MET trigger SF
scaleFactors.assignMETTriggerSF(metSelection, bjetSelection.bjetDiscrWorkingPoint, "nominal", trg.METtriggerEfficiencyJsonName)
#====== Angular cuts / back-to-back
angularCutsBackToBack = PSet(
       nConsideredJets = 3,    # Number of highest-pt jets to consider (excluding jet corresponding to tau)
enableOptimizationPlots = True, # 2D histograms for optimizing angular cuts
        cutValueJet1 = 40.0,   # Cut value in degrees (circular cut)
        cutValueJet2 = 40.0,   # Cut value in degrees (circular cut)
        cutValueJet3 = 40.0,   # Cut value in degrees (circular cut)
        cutValueJet4 = 40.0,   # Cut value in degrees (circular cut)
)
#====== Experimental
jetCorrelations = PSet (

)

    def __init__(self, selectorName, moduleName, config, verbose, **kwargs):
        self._selectorName = selectorName
        self._moduleName = moduleName
        self._config  = config.clone()
        self._verbose = verbose

        # Process all keyword arguments to make changes to the config
        keys = kwargs.keys()
        for key in keys:
	    value = kwargs[key]
	    if key == "systematics":
                self._config.histogramAmbientLevel = "Systematics"
          
                # Energy scales
		if value.startswith("TauES"):
		    self._config.TauSelection.systematicVariation = "_"+value.replace("Plus","down").replace("Minus","up").replace("TauES","TES")
		elif value.startswith("JES"):
		    self._config.JetSelection.systematicVariation = "_"+value.replace("Plus","down").replace("Minus","up")
		elif value.startswith("JER"):
		    self._config.JetSelection.systematicVariation = "_"+value.replace("Plus","down").replace("Minus","up")
		elif value.startswith("UES"):
                    # FIXME: should also _y be taken into account?
		    self._config.METSelection.systematicVariation = "_"+value.replace("Plus_x","down_x").replace("Minus_x","up_x").replace("UES","MET_Type1_UnclusteredEn") 
		    self._config.METSelection.systematicVariation = "_"+value.replace("Plus_y","down_y").replace("Minus_y","up_y").replace("UES","MET_Type1_UnclusteredEn")
		# Fake tau 
		elif value.startswith("FakeTau"):
                    partonFakingTau = None
                    if "Electron" in value:
                        partonFakingTau = "eToTau"
                    elif "Muon" in value:
                        partonFakingTau = "muToTau"
                    elif "Jet" in value:
                        partonFakingTau = "jetToTau"
                    scaleFactors.assignTauMisidentificationSF(self._config.TauSelection, 
                                                              partonFakingTau, 
                                                              self._getDirectionString(value))
		# Trigger
		elif value.startswith("TauTrgEff"):
                    variationType = value.replace("TauTrgEff","").replace("Minus","").replace("Plus","")
                    scaleFactors.assignTauTriggerSF(self._config.TauSelection, self._getDirectionString(value), self._config.Trigger.TautriggerEfficiencyJsonName, variationType)
                elif value.startswith("METTrgEff"):
                    variationType = value.replace("METTrgEff","").replace("Minus","").replace("Plus","")
                    scaleFactors.assignMETTriggerSF(self._config.METSelection, self._config.BJetSelection.bjetDiscrWorkingPoint, self._getDirectionString(value), self._config.Trigger.METtriggerEfficiencyJsonName, variationType)

                # tau ID syst
                elif value.startswith("TauIDSyst"):
                    self._config.systematicVariation = "_"+value.replace("Plus","down").replace("Minus","up")

		# b tag SF
		elif value.startswith("BTagSF") or value.startswith("BMistagSF"):
                    variationType = None
                    if value.startswith("BTagSF"):
                        variationType = "tag"
                    elif value.startswith("BMistagSF"):
                        variationType = "mistag"
                    direction = value.replace("BTagSF","").replace("BMistagSF","").replace("Minus","down").replace("Plus","up")
                    scaleFactors.updateBtagSFInformationForVariations(self._config.BJetSelection, direction=direction, variationInfo=variationType)

		# top-tag SF
		elif value.startswith("TopTagSF") or value.startswith("TopMistagSF"):
                    variationType = None
                    if value.startswith("TopTagSF"):
                        variationType = "tag"
                    elif value.startswith("TopMistagSF"):
                        variationType = "mistag"
                    direction = value.replace("TopTagSF","").replace("TopMistagSF","").replace("Minus","down").replace("Plus","up")
                    scaleFactors.updateTopTagSFInformationForVariations(self._config.TopSelectionBDT, direction=direction, variationInfo=variationType)

		# top quarks
		elif value.startswith("TopPt"):
                    self._config.topPtSystematicVariation = value.replace("TopPt","").replace("Plus","plus").replace("Minus","minus")
#		# PU weights
		elif value.startswith("PUWeight"):
                    self._config.PUWeightSystematicVariation = value.replace("PUWeight","").replace("Plus","plus").replace("Minus","minus")
		else:
		    if value != "nominal":
                        raise Exception("Error: unsupported variation item '%s'!"%value)
	    else:
		# Process optimization options
		# First check that key is found in config
		subkeys = key.split(".")
		subconfig = [self._config]
		suffix = ""
		for i in range(len(subkeys)-1):
		    if not hasattr(subconfig[len(subconfig)-1], subkeys[i]):
			raise Exception("Error: Cannot find key %s.%s in the config!"%(suffix, subkeys[i]))
		    subconfig.append(getattr(subconfig[len(subconfig)-1], subkeys[i]))
		    if suffix == "":
			suffix += "%s"%subkeys[i]
		    else:
			suffix += ".%s"%subkeys[i]
		# Set varied value in configuration (treat AngularCuts in a special way)
		if key.startswith("AngularCuts") and subkeys[len(subkeys)-1] == "workingPoint":
                    from HiggsAnalysis.NtupleAnalysis.parameters.signalAnalysisParameters import setAngularCutsWorkingPoint
                    setAngularCutsWorkingPoint(subconfig[len(subconfig)-1], value)
                else: # all other settings than AngularCuts
                    if not hasattr(subconfig[len(subconfig)-1], subkeys[len(subkeys)-1]):
                        raise Exception("Error: Cannot find key %s.%s in the config!"%(suffix, subkeys[len(subkeys)-1]))
                    setattr(subconfig[len(subconfig)-1], subkeys[len(subkeys)-1], value)
                # Additionally, set a new tau ID scale factor if needed
                    from HiggsAnalysis.NtupleAnalysis.parameters.scaleFactors import assignTauIdentificationSF
                    scaleFactors.assignTauIdentificationSF(subconfig[len(subconfig)-1])