示例#1
0
def addPUWeightVariation(name):
    # Up variation
    module = getattr(process, name).clone()
    module.Tree.fill = False
    param.setPileupWeight(dataVersion,
                          process,
                          process.commonSequence,
                          pset=module.vertexWeight,
                          psetReader=module.pileupWeightReader,
                          era=puweight,
                          suffix="up")
    addAnalysis(process,
                name + "PUWeightPlus",
                module,
                preSequence=process.commonSequence,
                additionalCounters=additionalCounters,
                signalAnalysisCounters=True)
    # Down variation
    module = module.clone()
    param.setPileupWeight(dataVersion,
                          process,
                          process.commonSequence,
                          pset=module.vertexWeight,
                          psetReader=module.pileupWeightReader,
                          era=puweight,
                          suffix="down")
    addAnalysis(process,
                name + "PUWeightMinus",
                module,
                preSequence=process.commonSequence,
                additionalCounters=additionalCounters,
                signalAnalysisCounters=True)
示例#2
0
    def addJetVariation(name, src, metName, metSrc):
        addMetVariation(metName, metSrc)
        for d in ["Up", "Down"]:
            postfix = src % d
            selectedJets = process.selectedJets.clone()
            selectedJets.jetSelection.src = postfix
            param.setJetPUIdSrc(selectedJets.jetSelection,
                                "selectedJets" + postfix)
            setattr(process, "selectedJets" + postfix, selectedJets)
            process.commonSequence += selectedJets

            btagging = process.btagging.clone()
            btagging.jetSrc = selectedJets.jetSelection.src.value()
            setattr(process, "btagging" + postfix, btagging)
            process.commonSequence += btagging

            jets = ntuple.jets.jets.clone()
            jets.detailsEnabled = False
            jets.functions = cms.PSet()
            jets.src.setModuleLabel("selectedJets" + postfix)
            jets.floats.btagScaleFactor.setModuleLabel("btagging" + postfix)
            del jets.floats.btagScaleFactorUncertainty
            jets.bools.btagged.setModuleLabel("btagging" + postfix)

            setattr(ntuple.jets, name % d, jets)
示例#3
0
def addPUWeightVariation(name):
    # Up variation
    module = getattr(process, name).clone()
    module.Tree.fill = False
    param.setPileupWeight(dataVersion, process, process.commonSequence, pset=module.vertexWeight, psetReader=module.pileupWeightReader, era=puweight, suffix="up")
    addAnalysis(process, name+"PUWeightPlus", module,
                preSequence=process.commonSequence,
                additionalCounters=additionalCounters,
                signalAnalysisCounters=True)
    # Down variation
    module = module.clone()
    param.setPileupWeight(dataVersion, process, process.commonSequence, pset=module.vertexWeight, psetReader=module.pileupWeightReader, era=puweight, suffix="down")
    addAnalysis(process, name+"PUWeightMinus", module,
                preSequence=process.commonSequence,
                additionalCounters=additionalCounters,
                signalAnalysisCounters=True)
    def addJetVariation(name, src, metName, metSrc):
        addMetVariation(metName, metSrc)
        for d in ["Up", "Down"]:
            postfix = src%d
            selectedJets = process.selectedJets.clone()
            selectedJets.jetSelection.src = postfix
            param.setJetPUIdSrc(selectedJets.jetSelection, "selectedJets"+postfix)
            setattr(process, "selectedJets"+postfix, selectedJets)
            process.commonSequence += selectedJets

            btagging = process.btagging.clone()
            btagging.jetSrc = selectedJets.jetSelection.src.value()
            setattr(process, "btagging"+postfix, btagging)
            process.commonSequence += btagging

            jets = ntuple.jets.jets.clone()
            jets.detailsEnabled = False
            jets.functions = cms.PSet()
            jets.src.setModuleLabel("selectedJets"+postfix)
            jets.floats.btagScaleFactor.setModuleLabel("btagging"+postfix)
            del jets.floats.btagScaleFactorUncertainty
            jets.bools.btagged.setModuleLabel("btagging"+postfix)

            setattr(ntuple.jets, name%d, jets)
        process.goodPrimaryVertices10
    )

from HiggsAnalysis.HeavyChHiggsToTauNu.HChTools import *
# Pileup weighting
if dataVersion.isMC():
    import HiggsAnalysis.HeavyChHiggsToTauNu.HChSignalAnalysisParameters_cff as param

    # Pileup weighting
    process.pileupWeight = cms.EDProducer("HPlusVertexWeightProducer",
        alias = cms.string("pileupWeight"),
    )
    puweight = "Run2011A"
    if len(options.puWeightEra) > 0:
        puweight = options.puWeightEra
    param.setPileupWeightFor2011(dataVersion, era=puweight)
    insertPSetContentsTo(param.vertexWeight, process.pileupWeight)

    # Vertex weighting
    process.vertexWeight = cms.EDProducer("HPlusVertexWeightProducer",
        alias = cms.string("vertexWeight"),
    )
    param.setVertexWeightFor2011()
    insertPSetContentsTo(param.vertexWeight, process.vertexWeight)

    process.commonSequence *= (process.pileupWeight*process.vertexWeight)

# Add configuration information to histograms.root
process.infoPath = addConfigInfo(process, options, dataVersion)

################################################################################
# Vertex selection
from HiggsAnalysis.HeavyChHiggsToTauNu.HChPrimaryVertex import addPrimaryVertexSelection
addPrimaryVertexSelection(process, process.commonSequence)

# Pileup weights
import HiggsAnalysis.HeavyChHiggsToTauNu.HChSignalAnalysisParameters_cff as param
process.pileupWeightEPS = cms.EDProducer(
    "HPlusVertexWeightProducer",
    alias=cms.string("pileupWeightEPS"),
)
process.pileupWeightRun2011AnoEPS = process.pileupWeightEPS.clone(
    alias="pileupWeightRun2011AnoEPS")
process.pileupWeightRun2011A = process.pileupWeightEPS.clone(
    alias="pileupWeightRun2011A")
param.setPileupWeightFor2011(dataVersion, era="EPS")
insertPSetContentsTo(param.vertexWeight.clone(), process.pileupWeightEPS)
param.setPileupWeightFor2011(dataVersion, era="Run2011A-EPS")
insertPSetContentsTo(param.vertexWeight.clone(),
                     process.pileupWeightRun2011AnoEPS)
param.setPileupWeightFor2011(dataVersion, era="Run2011A")
insertPSetContentsTo(param.vertexWeight.clone(), process.pileupWeightRun2011A)

process.commonSequence *= (process.pileupWeightEPS *
                           process.pileupWeightRun2011AnoEPS *
                           process.pileupWeightRun2011A)

# Embedding-like preselection
import HiggsAnalysis.HeavyChHiggsToTauNu.tauEmbedding.customisations as tauEmbeddingCustomisations
additionalCounters.extend(
    tauEmbeddingCustomisations.addEmbeddingLikePreselection(
示例#7
0
from HiggsAnalysis.HeavyChHiggsToTauNu.HChPatTuple import addPatOnTheFly
process.commonSequence, additionalCounters = addPatOnTheFly(process, options, dataVersion)

# Add configuration information to histograms.root
from HiggsAnalysis.HeavyChHiggsToTauNu.HChTools import addConfigInfo
process.infoPath = addConfigInfo(process, options, dataVersion)

################################################################################
# The "golden" version of the alphat analysis

# Primary vertex selection
from HiggsAnalysis.HeavyChHiggsToTauNu.HChPrimaryVertex import addPrimaryVertexSelection
addPrimaryVertexSelection(process, process.commonSequence)

import HiggsAnalysis.HeavyChHiggsToTauNu.HChSignalAnalysisParameters_cff as param
param.overrideTriggerFromOptions(options)
# Set tau selection mode to 'standard' or 'factorized'
param.setAllTauSelectionOperatingMode('standard')
#param.setAllTauSelectionOperatingMode('factorized')

# Set tau sources to trigger matched tau collections
#param.setAllTauSelectionSrcSelectedPatTaus()

# Set the triggers for trigger efficiency parametrisation
param.trigger.triggerTauSelection = param.tauSelectionHPSVeryLooseTauBased.clone( # VeryLoose
#param.trigger.triggerTauSelection = param.tauSelectionHPSTightTauBased.clone( # Tight
  rtauCut = cms.untracked.double(0.0) # No rtau cut for trigger tau
)
param.trigger.triggerMETSelection = param.MET.clone(
  METCut = cms.untracked.double(0.0) # No MET cut for trigger MET
)
示例#8
0
# Isolation embedding
import HiggsAnalysis.HeavyChHiggsToTauNu.tauEmbedding.customisations as customisations
muons = customisations.addMuonIsolationEmbedding(process, process.commonSequence, muons=muons)

# Pileup weighting
from HiggsAnalysis.HeavyChHiggsToTauNu.HChTools import *
import HiggsAnalysis.HeavyChHiggsToTauNu.HChSignalAnalysisParameters_cff as param

# Pileup weighting
process.pileupWeight = cms.EDProducer("HPlusVertexWeightProducer",
    alias = cms.string("pileupWeight"),
)
puweight = "Run2011A"
if len(options.puWeightEra) > 0:
        puweight = options.puWeightEra
param.setPileupWeightFor2011(dataVersion, era="puweight")
insertPSetContentsTo(param.vertexWeight, process.pileupWeight)

# Vertex weighting
#process.vertexWeight = cms.EDProducer("HPlusVertexWeightProducer",
#    alias = cms.string("vertexWeight"),
#)
#param.setVertexWeightFor2011()
#insertPSetContentsTo(param.vertexWeight, process.vertexWeight)

process.commonSequence *= process.pileupWeight#*process.vertexWeight)

if dataVersion.isData():
    process.pileupWeight.enabled = False
#    process.vertexWeight.enabled = False
# Remove the event pre-selection because the input files contain run
# regions with different triggers, and it's easier to just disable the
# triggering here.
from HiggsAnalysis.HeavyChHiggsToTauNu.HChPatTuple import addPatOnTheFly
process.commonSequence, additionalCounters = addPatOnTheFly(process, options, dataVersion)
process.commonSequence.remove(process.eventPreSelection)

################################################################################
# The "golden" version of the signal analysis
# Primary vertex selection
from HiggsAnalysis.HeavyChHiggsToTauNu.HChPrimaryVertex import addPrimaryVertexSelection
addPrimaryVertexSelection(process, process.commonSequence)

import HiggsAnalysis.HeavyChHiggsToTauNu.HChSignalAnalysisParameters_cff as param
param.overrideTriggerFromOptions(options)
param.trigger.triggerSrc.setProcessName(dataVersion.getTriggerProcess())
# Set tau selection mode to 'standard'
param.setAllTauSelectionOperatingMode('standard')
#param.setAllTauSelectionOperatingMode('tauCandidateSelectionOnly')


# Set tau sources to trigger matched tau collections
#param.setAllTauSelectionSrcSelectedPatTaus()
param.setAllTauSelectionSrcSelectedPatTausTriggerMatched()

# Set the triggers for trigger efficiency parametrisation
#param.trigger.triggerTauSelection = param.tauSelectionHPSVeryLooseTauBased.clone( # VeryLoose
param.trigger.triggerTauSelection = param.tauSelectionHPSTightTauBased.clone( # Tight
  rtauCut = cms.untracked.double(0.0) # No rtau cut for trigger tau
)
process.commonSequence, additionalCounters = addPatOnTheFly(process, options, dataVersion)

# Add configuration information to histograms.root
from HiggsAnalysis.HeavyChHiggsToTauNu.HChTools import addConfigInfo
process.infoPath = addConfigInfo(process, options, dataVersion)


################################################################################
# The "golden" version of the signal analysis

# Primary vertex selection
from HiggsAnalysis.HeavyChHiggsToTauNu.HChPrimaryVertex import addPrimaryVertexSelection
addPrimaryVertexSelection(process, process.commonSequence)

import HiggsAnalysis.HeavyChHiggsToTauNu.HChSignalAnalysisParameters_cff as param
param.overrideTriggerFromOptions(options)
# Set tau selection mode to 'standard'
param.setAllTauSelectionOperatingMode('standard')

# Set tau sources to trigger matched tau collections
#param.setAllTauSelectionSrcSelectedPatTaus()

# Set the triggers for trigger efficiency parametrisation
#param.trigger.triggerTauSelection = param.tauSelectionHPSVeryLooseTauBased.clone( # VeryLoose
param.trigger.triggerTauSelection = param.tauSelectionHPSTightTauBased.clone( # Tight
  rtauCut = cms.untracked.double(0.0) # No rtau cut for trigger tau
)
param.trigger.triggerMETSelection = param.MET.clone(
  METCut = cms.untracked.double(0.0) # No MET cut for trigger MET
)
if (doTriggerParametrisation and not dataVersion.isData()):
process.commonSequence, additionalCounters = addPatOnTheFly(process, options, dataVersion)

# Add configuration information to histograms.root
from HiggsAnalysis.HeavyChHiggsToTauNu.HChTools import addConfigInfo
process.infoPath = addConfigInfo(process, options, dataVersion)

################################################################################
# qcdMeasurementMethod3 module

# Primary vertex selection
from HiggsAnalysis.HeavyChHiggsToTauNu.HChPrimaryVertex import addPrimaryVertexSelection
addPrimaryVertexSelection(process, process.commonSequence)

# Import default parameter set and make necessary tweaks
import HiggsAnalysis.HeavyChHiggsToTauNu.HChSignalAnalysisParameters_cff as param
param.overrideTriggerFromOptions(options)
param.trigger.triggerSrc.setProcessName(dataVersion.getTriggerProcess())
# Set tau selection mode (options: 'tauCandidateSelectionOnly', 'tauCandidateSelectionOnlyReversedRtau')
# other options (use not recommended here): 'standard'
param.setAllTauSelectionOperatingMode('tauCandidateSelectionOnly')

# Set tau sources to trigger matched tau collections
param.setAllTauSelectionSrcSelectedPatTausTriggerMatched()

# Trigger with scale factors (at the moment hard coded)
if applyTriggerScaleFactor and dataVersion.isMC():
    param.triggerEfficiencyScaleFactor.mode = "scaleFactor"


# Set the data scenario for vertex/pileup weighting
param.setPileupWeightFor2011(dataVersion, era="EPS", method="intime") # Reweight by true PU distribution 
示例#12
0
                        src=cms.InputTag(muons),
                        debug=cms.bool(False),
                        identifier=cms.string("Data2012_53X_ReReco"),
                        applySmearing=cms.bool(False),
                        fakeSmearing=cms.bool(False))
setattr(process, muons + "Muscle", muscle)
process.commonSequence += muscle
if dataVersion.isMC():
    muscle.identifier = "Summer12_DR53X_smearReReco"
    muscle.applySmearing = True

# Jet selection
# Cannot do filtering because of jet systematic variations
import HiggsAnalysis.HeavyChHiggsToTauNu.HChSignalAnalysisParameters_cff as param

param.setJERSmearedJets(dataVersion)
import HiggsAnalysis.HeavyChHiggsToTauNu.HChJetFilter_cfi as jetFilter_cfi

process.selectedJets = jetFilter_cfi.hPlusJetPtrSelectorFilter.clone(
    tauSrc="",
    removeTau=False,
    histogramAmbientLevel="Systematics",
    producePt20=True,
    filter=False,
)
#process.selectedJetsCount = cms.EDProducer("EventCountProducer")
process.commonSequence += (
    process.selectedJets  #+
    #    process.selectedJetsCount
)
#additionalCounters.append("selectedJetsCount")
示例#13
0
# Vertex selection
from HiggsAnalysis.HeavyChHiggsToTauNu.HChPrimaryVertex import addPrimaryVertexSelection
addPrimaryVertexSelection(process, process.commonSequence)

# Pileup weights
import HiggsAnalysis.HeavyChHiggsToTauNu.HChSignalAnalysisParameters_cff as param
process.pileupWeightEPS = cms.EDProducer("HPlusVertexWeightProducer",
    alias = cms.string("pileupWeightEPS"),
)
process.pileupWeightRun2011AnoEPS = process.pileupWeightEPS.clone(
    alias = "pileupWeightRun2011AnoEPS"
)
process.pileupWeightRun2011A = process.pileupWeightEPS.clone(
    alias = "pileupWeightRun2011A"
)
param.setPileupWeightFor2011(dataVersion, era="EPS")
insertPSetContentsTo(param.vertexWeight.clone(), process.pileupWeightEPS)
param.setPileupWeightFor2011(dataVersion, era="Run2011A-EPS")
insertPSetContentsTo(param.vertexWeight.clone(), process.pileupWeightRun2011AnoEPS)
param.setPileupWeightFor2011(dataVersion, era="Run2011A")
insertPSetContentsTo(param.vertexWeight.clone(), process.pileupWeightRun2011A)

process.commonSequence *= (
    process.pileupWeightEPS *
    process.pileupWeightRun2011AnoEPS *
    process.pileupWeightRun2011A
)


muons = cms.InputTag("tauEmbeddingMuons")
#taus = cms.InputTag("selectedPatTausShrinkingConePFTau")
# Fragment to run PAT on the fly if requested from command line
from HiggsAnalysis.HeavyChHiggsToTauNu.HChPatTuple import addPatOnTheFly
process.commonSequence, additionalCounters = addPatOnTheFly(process, options, dataVersion)

# Add configuration information to histograms.root
from HiggsAnalysis.HeavyChHiggsToTauNu.HChTools import addConfigInfo
process.infoPath = addConfigInfo(process, options, dataVersion)

################################################################################
# The "golden" version of the signal analysis
# Primary vertex selection
from HiggsAnalysis.HeavyChHiggsToTauNu.HChPrimaryVertex import addPrimaryVertexSelection
addPrimaryVertexSelection(process, process.commonSequence)

import HiggsAnalysis.HeavyChHiggsToTauNu.HChSignalAnalysisParameters_cff as param
param.overrideTriggerFromOptions(options)
param.trigger.triggerSrc.setProcessName(dataVersion.getTriggerProcess())
# Set tau selection mode to 'standard'
#param.setAllTauSelectionOperatingMode('standard')
param.setAllTauSelectionOperatingMode('tauCandidateSelectionOnly')

# Set tau sources to trigger matched tau collections
#param.setAllTauSelectionSrcSelectedPatTaus()
param.setAllTauSelectionSrcSelectedPatTausTriggerMatched()

# Trigger with scale factors (at the moment hard coded)
if applyTriggerScaleFactor and dataVersion.isMC():
    param.triggerEfficiencyScaleFactor.mode = "scaleFactor"

# Set the data scenario for vertex/pileup weighting
puweight = "Run2011A"
# Fragment to run PAT on the fly if requested from command line
from HiggsAnalysis.HeavyChHiggsToTauNu.HChPatTuple import addPatOnTheFly
process.commonSequence, additionalCounters = addPatOnTheFly(process, options, dataVersion)

# Add configuration information to histograms.root
from HiggsAnalysis.HeavyChHiggsToTauNu.HChTools import addConfigInfo
process.infoPath = addConfigInfo(process, options, dataVersion)

################################################################################
# The "golden" version of the signal analysis
# Primary vertex selection
from HiggsAnalysis.HeavyChHiggsToTauNu.HChPrimaryVertex import addPrimaryVertexSelection
addPrimaryVertexSelection(process, process.commonSequence)

import HiggsAnalysis.HeavyChHiggsToTauNu.HChSignalAnalysisParameters_cff as param
param.overrideTriggerFromOptions(options)
param.trigger.triggerSrc.setProcessName(dataVersion.getTriggerProcess())
# Set tau selection mode to 'standard'
param.setAllTauSelectionOperatingMode('standard')
#param.setAllTauSelectionOperatingMode('tauCandidateSelectionOnly')

# Set tau sources to trigger matched tau collections
#param.setAllTauSelectionSrcSelectedPatTaus()
param.setAllTauSelectionSrcSelectedPatTausTriggerMatched()

# Set the data scenario for vertex/pileup weighting
puweight = "Run2011A"
if len(options.puWeightEra) > 0:
    puweight = options.puWeightEra
param.setPileupWeightFor2011(dataVersion, era=puweight) # Reweight by true PU distribution 
param.setDataTriggerEfficiency(dataVersion, era=puweight)
示例#16
0
import FWCore.ParameterSet.Config as cms

import HiggsAnalysis.HeavyChHiggsToTauNu.HChSignalAnalysisParameters_cff as param
hPlusJetPtrSelectorFilter = cms.EDFilter(
    "HPlusJetPtrSelectorFilter",
    jetSelection=param.jetSelection.clone(),
    tauSrc=cms.untracked.InputTag("patTausHpsPFTauTauTriggerMatched"),
    removeTau=cms.bool(True),
    allowEmptyTau=cms.bool(False),
    histogramAmbientLevel=cms.untracked.string("Debug"),
    filter=cms.bool(True),
    throw=cms.bool(True),
    producePt20=cms.bool(False),
    eventCounter=param.eventCounter.clone())
# Set Jet PU ID source
param.setJetPUIdSrc(hPlusJetPtrSelectorFilter.jetSelection,
                    "hPlusJetPtrSelectorFilter")
from HiggsAnalysis.HeavyChHiggsToTauNu.HChPatTuple import addPatOnTheFly
process.commonSequence, additionalCounters = addPatOnTheFly(
    process, options, dataVersion)

# Add configuration information to histograms.root
from HiggsAnalysis.HeavyChHiggsToTauNu.HChTools import addConfigInfo
process.infoPath = addConfigInfo(process, options, dataVersion)

################################################################################
# The "golden" version of the signal analysis
# Primary vertex selection
from HiggsAnalysis.HeavyChHiggsToTauNu.HChPrimaryVertex import addPrimaryVertexSelection
addPrimaryVertexSelection(process, process.commonSequence)

import HiggsAnalysis.HeavyChHiggsToTauNu.HChSignalAnalysisParameters_cff as param
param.overrideTriggerFromOptions(options)
param.trigger.triggerSrc.setProcessName(dataVersion.getTriggerProcess())
# Set tau selection mode to 'standard'
#param.setAllTauSelectionOperatingMode('standard')
param.setAllTauSelectionOperatingMode('tauCandidateSelectionOnly')

# Set tau sources to trigger matched tau collections
#param.setAllTauSelectionSrcSelectedPatTaus()
param.setAllTauSelectionSrcSelectedPatTausTriggerMatched()

# Trigger with scale factors (at the moment hard coded)
if applyTriggerScaleFactor and dataVersion.isMC():
    param.triggerEfficiencyScaleFactor.mode = "scaleFactor"

# Set the data scenario for vertex/pileup weighting
puweight = "Run2011A"
示例#18
0
from HiggsAnalysis.HeavyChHiggsToTauNu.HChTools import addConfigInfo
process.infoPath = addConfigInfo(process, options, dataVersion)

if dataVersion.isData():
    process.HBHENoiseSequence = cms.Sequence()
    process.commonSequence.replace(
        process.HBHENoiseFilter,
        process.HBHENoiseSequence * process.HBHENoiseFilter)
    import HiggsAnalysis.HeavyChHiggsToTauNu.HChDataSelection as DataSelection
    DataSelection.addHBHENoiseFilterResultProducer(process,
                                                   process.HBHENoiseSequence)

################################################################################
# The "golden" version of the signal analysis
import HiggsAnalysis.HeavyChHiggsToTauNu.HChSignalAnalysisParameters_cff as param
param.overrideTriggerFromOptions(options)
param.trigger.triggerSrc.setProcessName(dataVersion.getTriggerProcess())
# Set tau selection mode to 'standard'
param.setAllTauSelectionOperatingMode('standard')
#param.setAllTauSelectionOperatingMode('tauCandidateSelectionOnly')

# Set tau sources to trigger matched tau collections
#param.setAllTauSelectionSrcSelectedPatTaus()
param.setAllTauSelectionSrcSelectedPatTausTriggerMatched()

# Switch to PF2PAT objects
#param.changeCollectionsToPF2PAT()
param.changeCollectionsToPF2PAT(postfix=PF2PATVersion)

# Trigger with scale factors (at the moment hard coded)
if applyTriggerScaleFactor and dataVersion.isMC():
from HiggsAnalysis.HeavyChHiggsToTauNu.HChTools import *

# Vertex selection
from HiggsAnalysis.HeavyChHiggsToTauNu.HChPrimaryVertex import addPrimaryVertexSelection
addPrimaryVertexSelection(process, process.commonSequence)

# Pileup weights
import HiggsAnalysis.HeavyChHiggsToTauNu.HChSignalAnalysisParameters_cff as param
puWeights = [
    "Run2011A",
    "Run2011B",
    "Run2011AB",
    ]
puWeightNames = []
for era in puWeights:
    prodName = param.setPileupWeight(dataVersion, process=process, commonSequence=process.commonSequence, era=era)
    puWeightNames.append(prodName)
    process.commonSequence.remove(getattr(process, prodName))
    process.commonSequence.insert(0, getattr(process, prodName))

# FIXME: this is only a consequence of the swiss-knive effect...
process.commonSequence.remove(process.goodPrimaryVertices)
process.commonSequence.insert(0, process.goodPrimaryVertices)

# Switch to PF2PAT objects
#PF2PATVersion = "PFlow"
#param.changeCollectionsToPF2PAT(postfix=PF2PATVersion)

muons = cms.InputTag("tauEmbeddingMuons")
#taus = cms.InputTag("selectedPatTausShrinkingConePFTau")
taus = cms.InputTag("selectedPatTausHpsPFTau")
示例#20
0
                                                  patArgs=patArgs)
del process.out

# Pileup weighting
from HiggsAnalysis.HeavyChHiggsToTauNu.HChTools import *
import HiggsAnalysis.HeavyChHiggsToTauNu.HChSignalAnalysisParameters_cff as param

process.pileupWeight = cms.EDProducer(
    "HPlusVertexWeightProducer",
    alias=cms.string("pileupWeight"),
)
puweight = "Run2011AB"
if len(options.puWeightEra) > 0:
    puweight = options.puWeightEra
param.setPileupWeight(dataVersion,
                      process=process,
                      commonSequence=process.commonSequence,
                      era=puweight)
insertPSetContentsTo(param.vertexWeight, process.pileupWeight)
process.pileupWeight.vertexSrc = "offlinePrimaryVertices"
if dataVersion.isData():
    process.pileupWeight.enabled = False

process.commonSequence.insert(0, process.pileupWeight)
counterProto = cms.EDProducer("EventCountProducer")

# All events (after trigger)
process.allEventsCount = counterProto.clone()
process.eventPreSelection *= process.allEventsCount
counters.append("allEventsCount")

# Primary vertex
# Vertex selection
from HiggsAnalysis.HeavyChHiggsToTauNu.HChPrimaryVertex import addPrimaryVertexSelection
addPrimaryVertexSelection(process, process.commonSequence)

# Pileup weights
import HiggsAnalysis.HeavyChHiggsToTauNu.HChSignalAnalysisParameters_cff as param
puWeights = [
    "Run2011A",
    "Run2011B",
    "Run2011AB",
]
puWeightNames = []
for era in puWeights:
    prodName = param.setPileupWeight(dataVersion,
                                     process=process,
                                     commonSequence=process.commonSequence,
                                     era=era)
    puWeightNames.append(prodName)
    process.commonSequence.remove(getattr(process, prodName))
    process.commonSequence.insert(0, getattr(process, prodName))

# FIXME: this is only a consequence of the swiss-knive effect...
process.commonSequence.remove(process.goodPrimaryVertices)
process.commonSequence.insert(0, process.goodPrimaryVertices)

# Switch to PF2PAT objects
#PF2PATVersion = "PFlow"
#param.changeCollectionsToPF2PAT(postfix=PF2PATVersion)

muons = cms.InputTag("tauEmbeddingMuons")
#taus = cms.InputTag("selectedPatTausShrinkingConePFTau")
process.commonSequence, additionalCounters = addPatOnTheFly(
    process, options, dataVersion)

# Add configuration information to histograms.root
from HiggsAnalysis.HeavyChHiggsToTauNu.HChTools import addConfigInfo
process.infoPath = addConfigInfo(process, options, dataVersion)

################################################################################
# The "golden" version of the alphat analysis

# Primary vertex selection
from HiggsAnalysis.HeavyChHiggsToTauNu.HChPrimaryVertex import addPrimaryVertexSelection
addPrimaryVertexSelection(process, process.commonSequence)

import HiggsAnalysis.HeavyChHiggsToTauNu.HChSignalAnalysisParameters_cff as param
param.overrideTriggerFromOptions(options)
# Set tau selection mode to 'standard' or 'factorized'
param.setAllTauSelectionOperatingMode('standard')
#param.setAllTauSelectionOperatingMode('factorized')

# Set tau sources to trigger matched tau collections
#param.setAllTauSelectionSrcSelectedPatTaus()

# Set the triggers for trigger efficiency parametrisation
param.trigger.triggerTauSelection = param.tauSelectionHPSVeryLooseTauBased.clone(  # VeryLoose
    #param.trigger.triggerTauSelection = param.tauSelectionHPSTightTauBased.clone( # Tight
    rtauCut=cms.untracked.double(0.0)  # No rtau cut for trigger tau
)
param.trigger.triggerMETSelection = param.MET.clone(
    METCut=cms.untracked.double(0.0)  # No MET cut for trigger MET
)
示例#23
0
process.commonSequence, additionalCounters = addPatOnTheFly(process, options, dataVersion)

# Add configuration information to histograms.root
from HiggsAnalysis.HeavyChHiggsToTauNu.HChTools import addConfigInfo
process.infoPath = addConfigInfo(process, options, dataVersion)

if dataVersion.isData():
    process.HBHENoiseSequence = cms.Sequence()
    process.commonSequence.replace(process.HBHENoiseFilter, process.HBHENoiseSequence*process.HBHENoiseFilter)
    import HiggsAnalysis.HeavyChHiggsToTauNu.HChDataSelection as DataSelection
    DataSelection.addHBHENoiseFilterResultProducer(process, process.HBHENoiseSequence)

################################################################################
# The "golden" version of the signal analysis
import HiggsAnalysis.HeavyChHiggsToTauNu.HChSignalAnalysisParameters_cff as param
param.overrideTriggerFromOptions(options)
param.trigger.triggerSrc.setProcessName(dataVersion.getTriggerProcess())
# Set tau selection mode to 'standard'
param.setAllTauSelectionOperatingMode('standard')
#param.setAllTauSelectionOperatingMode('tauCandidateSelectionOnly')

# Set tau sources to trigger matched tau collections
#param.setAllTauSelectionSrcSelectedPatTaus()
param.setAllTauSelectionSrcSelectedPatTausTriggerMatched()

# Switch to PF2PAT objects
#param.changeCollectionsToPF2PAT()
param.changeCollectionsToPF2PAT(postfix=PF2PATVersion)

# Trigger with scale factors (at the moment hard coded)
if applyTriggerScaleFactor and dataVersion.isMC():
示例#24
0
process.preselectionSequence.insert(0, process.commonSequence)
addAnalysis(process,
            "tauNtuple",
            ntuple,
            preSequence=process.preselectionSequence,
            additionalCounters=preselectionCounters,
            signalAnalysisCounters=True)
process.tauNtuple.eventCounter.printMainCounter = True

addSignalAnalysis = True
if addSignalAnalysis:
    # Run signal analysis module on the same go with the embedding preselection without tau+MET trigger
    import HiggsAnalysis.HeavyChHiggsToTauNu.signalAnalysis as signalAnalysis
    module = signalAnalysis.createEDFilter(param)
    param.setJetPUIdSrc(module.jetSelection, "")
    module.Tree.fill = cms.untracked.bool(False)
    module.histogramAmbientLevel = "Vital"

    # Counters
    if len(preselectionCounters) > 0:
        module.eventCounter.counters = cms.untracked.VInputTag(
            [cms.InputTag(c) for c in preselectionCounters])

    def addModule(mod, postfix="", sequence=None):
        for era, suffix, src in puEraSuffixWeights:
            m = mod.clone()
            m.pileupWeightReader.weightSrc = src
            if era == dataEras[0] and suffix == "":
                m.eventCounter.printMainCounter = cms.untracked.bool(True)
            if suffix != "":
示例#25
0
from HiggsAnalysis.HeavyChHiggsToTauNu.HChPatTuple import addPatOnTheFly
process.commonSequence, additionalCounters = addPatOnTheFly(
    process, options, dataVersion)

# Add configuration information to histograms.root
from HiggsAnalysis.HeavyChHiggsToTauNu.HChTools import addConfigInfo
process.infoPath = addConfigInfo(process, options, dataVersion)

################################################################################
# The "golden" version of the signal analysis
# Primary vertex selection
from HiggsAnalysis.HeavyChHiggsToTauNu.HChPrimaryVertex import addPrimaryVertexSelection
addPrimaryVertexSelection(process, process.commonSequence)

import HiggsAnalysis.HeavyChHiggsToTauNu.HChSignalAnalysisParameters_cff as param
param.overrideTriggerFromOptions(options)
param.trigger.triggerSrc.setProcessName(dataVersion.getTriggerProcess())
# Set tau selection mode to 'standard'
param.setAllTauSelectionOperatingMode('standard')
#param.setAllTauSelectionOperatingMode('tauCandidateSelectionOnly')

# Set tau sources to trigger matched tau collections
#param.setAllTauSelectionSrcSelectedPatTaus()
param.setAllTauSelectionSrcSelectedPatTausTriggerMatched()

# Set the data scenario for vertex/pileup weighting
puweight = "Run2011A"
if len(options.puWeightEra) > 0:
    puweight = options.puWeightEra
param.setPileupWeightFor2011(dataVersion,
                             era=puweight)  # Reweight by true PU distribution
    identifier = cms.string("Data2012_53X_ReReco"),
    applySmearing = cms.bool(False),
    fakeSmearing = cms.bool(False)
)
setattr(process, muons+"Muscle", muscle)
process.commonSequence += muscle
if dataVersion.isMC():
    muscle.identifier = "Summer12_DR53X_smearReReco"
    muscle.applySmearing = True



# Jet selection
# Cannot do filtering because of jet systematic variations
import HiggsAnalysis.HeavyChHiggsToTauNu.HChSignalAnalysisParameters_cff as param
param.setJERSmearedJets(dataVersion)
import HiggsAnalysis.HeavyChHiggsToTauNu.HChJetFilter_cfi as jetFilter_cfi
process.selectedJets = jetFilter_cfi.hPlusJetPtrSelectorFilter.clone(
    tauSrc = "",
    removeTau = False,
    histogramAmbientLevel = "Systematics",
    producePt20 = True,
    filter=False,
)
#process.selectedJetsCount = cms.EDProducer("EventCountProducer")
process.commonSequence += (
    process.selectedJets #+
#    process.selectedJetsCount
)
#additionalCounters.append("selectedJetsCount")
示例#27
0
import FWCore.ParameterSet.Config as cms

import HiggsAnalysis.HeavyChHiggsToTauNu.HChSignalAnalysisParameters_cff as param
hPlusJetPtrSelectorFilter = cms.EDFilter("HPlusJetPtrSelectorFilter",
	jetSelection = param.jetSelection.clone(),
        tauSrc = cms.untracked.InputTag("patTausHpsPFTauTauTriggerMatched"),
        removeTau = cms.bool(True),
        allowEmptyTau = cms.bool(False),
        histogramAmbientLevel = cms.untracked.string("Debug"),
        filter = cms.bool(True),
        throw = cms.bool(True),
        producePt20 = cms.bool(False),
        eventCounter = param.eventCounter.clone()
)
# Set Jet PU ID source
param.setJetPUIdSrc(hPlusJetPtrSelectorFilter.jetSelection,"hPlusJetPtrSelectorFilter")
示例#28
0
                                                 process.commonSequence,
                                                 muons=muons)

# Pileup weighting
from HiggsAnalysis.HeavyChHiggsToTauNu.HChTools import *
import HiggsAnalysis.HeavyChHiggsToTauNu.HChSignalAnalysisParameters_cff as param

# Pileup weighting
process.pileupWeight = cms.EDProducer(
    "HPlusVertexWeightProducer",
    alias=cms.string("pileupWeight"),
)
puweight = "Run2011A"
if len(options.puWeightEra) > 0:
    puweight = options.puWeightEra
param.setPileupWeightFor2011(dataVersion, era="puweight")
insertPSetContentsTo(param.vertexWeight, process.pileupWeight)

# Vertex weighting
#process.vertexWeight = cms.EDProducer("HPlusVertexWeightProducer",
#    alias = cms.string("vertexWeight"),
#)
#param.setVertexWeightFor2011()
#insertPSetContentsTo(param.vertexWeight, process.vertexWeight)

process.commonSequence *= process.pileupWeight  #*process.vertexWeight)

if dataVersion.isData():
    process.pileupWeight.enabled = False
#    process.vertexWeight.enabled = False
# Add configuration information to histograms.root
from HiggsAnalysis.HeavyChHiggsToTauNu.HChTools import addConfigInfo

process.infoPath = addConfigInfo(process, options, dataVersion)

################################################################################
# The "golden" version of the signal analysis

# Primary vertex selection
from HiggsAnalysis.HeavyChHiggsToTauNu.HChPrimaryVertex import addPrimaryVertexSelection

addPrimaryVertexSelection(process, process.commonSequence)

import HiggsAnalysis.HeavyChHiggsToTauNu.HChSignalAnalysisParameters_cff as param

param.overrideTriggerFromOptions(options)
# Set tau selection mode to 'standard'
param.setAllTauSelectionOperatingMode('standard')

# Set tau sources to trigger matched tau collections
#param.setAllTauSelectionSrcSelectedPatTaus()

# Set the triggers for trigger efficiency parametrisation
#param.trigger.triggerTauSelection = param.tauSelectionHPSVeryLooseTauBased.clone( # VeryLoose
param.trigger.triggerTauSelection = param.tauSelectionHPSTightTauBased.clone(  # Tight
    rtauCut=cms.untracked.double(0.0)  # No rtau cut for trigger tau
)
param.trigger.triggerMETSelection = param.MET.clone(
    METCut=cms.untracked.double(0.0)  # No MET cut for trigger MET
)
if (doTriggerParametrisation and not dataVersion.isData()):
    additionalCounters.extend(
        tauEmbeddingCustomisations.addGeneratorTauFilter(
            process,
            process.commonSequence,
            filterInaccessible=filterGenTausInaccessible))

################################################################################
# The "golden" version of the signal analysis

# Primary vertex selection
from HiggsAnalysis.HeavyChHiggsToTauNu.HChPrimaryVertex import addPrimaryVertexSelection
addPrimaryVertexSelection(process, process.commonSequence)

# Import Standard SignalAnalysis Parameters and change accordingly
import HiggsAnalysis.HeavyChHiggsToTauNu.HChSignalAnalysisParameters_cff as param
param.overrideTriggerFromOptions(options)
param.trigger.triggerSrc.setProcessName(dataVersion.getTriggerProcess())

# Set tau selection mode to 'standard'
param.setAllTauSelectionOperatingMode('standard')

# Set tau sources to non-trigger matched tau collections
param.setAllTauSelectionSrcSelectedPatTausTriggerMatched()
#param.setAllTauSelectionSrcSelectedPatTaus()

if options.tauEmbeddingInput != 0:
    tauEmbeddingCustomisations.addMuonIsolationEmbeddingForSignalAnalysis(
        process, process.commonSequence)
    tauEmbeddingCustomisations.setCaloMetSum(process, process.commonSequence,
                                             param, dataVersion)
    tauEmbeddingCustomisations.customiseParamForTauEmbedding(
示例#31
0
    outputCommands = cms.untracked.vstring(),
)
process.commonSequence, counters = addPatOnTheFly(process, options, dataVersion, patArgs=patArgs)
del process.out

# Pileup weighting
from HiggsAnalysis.HeavyChHiggsToTauNu.HChTools import *
import HiggsAnalysis.HeavyChHiggsToTauNu.HChSignalAnalysisParameters_cff as param

process.pileupWeight = cms.EDProducer("HPlusVertexWeightProducer",
    alias = cms.string("pileupWeight"),
)
puweight = "Run2011AB"
if len(options.puWeightEra) > 0:
        puweight = options.puWeightEra
param.setPileupWeight(dataVersion, process=process, commonSequence=process.commonSequence, era=puweight)
insertPSetContentsTo(param.vertexWeight, process.pileupWeight)
process.pileupWeight.vertexSrc = "offlinePrimaryVertices"
if dataVersion.isData():
    process.pileupWeight.enabled = False

process.commonSequence.insert(0, process.pileupWeight)
counterProto = cms.EDProducer( "EventCountProducer")

# All events (after trigger)
process.allEventsCount = counterProto.clone()
process.eventPreSelection *= process.allEventsCount
counters.append("allEventsCount")

# Primary vertex
process.firstPrimaryVertex = cms.EDProducer("HPlusFirstVertexSelector",
示例#32
0
                               process.goodPrimaryVertices10)

from HiggsAnalysis.HeavyChHiggsToTauNu.HChTools import *
# Pileup weighting
if dataVersion.isMC():
    import HiggsAnalysis.HeavyChHiggsToTauNu.HChSignalAnalysisParameters_cff as param

    # Pileup weighting
    process.pileupWeight = cms.EDProducer(
        "HPlusVertexWeightProducer",
        alias=cms.string("pileupWeight"),
    )
    puweight = "Run2011A"
    if len(options.puWeightEra) > 0:
        puweight = options.puWeightEra
    param.setPileupWeightFor2011(dataVersion, era=puweight)
    insertPSetContentsTo(param.vertexWeight, process.pileupWeight)

    # Vertex weighting
    process.vertexWeight = cms.EDProducer(
        "HPlusVertexWeightProducer",
        alias=cms.string("vertexWeight"),
    )
    param.setVertexWeightFor2011()
    insertPSetContentsTo(param.vertexWeight, process.vertexWeight)

    process.commonSequence *= (process.pileupWeight * process.vertexWeight)

# Add configuration information to histograms.root
process.infoPath = addConfigInfo(process, options, dataVersion)
示例#33
0
            process, process.commonSequence, filterInaccessible=filterGenTausInaccessible
        )
    )

################################################################################
# The "golden" version of the signal analysis

# Primary vertex selection
from HiggsAnalysis.HeavyChHiggsToTauNu.HChPrimaryVertex import addPrimaryVertexSelection

addPrimaryVertexSelection(process, process.commonSequence)

# Import Standard SignalAnalysis Parameters and change accordingly
import HiggsAnalysis.HeavyChHiggsToTauNu.HChSignalAnalysisParameters_cff as param

param.overrideTriggerFromOptions(options)
param.trigger.triggerSrc.setProcessName(dataVersion.getTriggerProcess())

# Set tau selection mode to 'standard'
param.setAllTauSelectionOperatingMode("standard")

# Set tau sources to non-trigger matched tau collections
param.setAllTauSelectionSrcSelectedPatTausTriggerMatched()
# param.setAllTauSelectionSrcSelectedPatTaus()

if options.tauEmbeddingInput != 0:
    tauEmbeddingCustomisations.addMuonIsolationEmbeddingForSignalAnalysis(process, process.commonSequence)
    tauEmbeddingCustomisations.setCaloMetSum(process, process.commonSequence, param, dataVersion)
    tauEmbeddingCustomisations.customiseParamForTauEmbedding(param, dataVersion)
    if tauEmbeddingFinalizeMuonSelection:
        applyIsolation = not doTauEmbeddingMuonSelectionScan