# a conversion is needed if objects are not available
# add them upfront of the sequence
ak5PFJetsPtrs = cms.EDProducer("PFJetFwdPtrProducer",
   src = cms.InputTag("ak5PFJets")
)
# this one is needed only if the input file doesn't have it
# solved automatically with unscheduled execution
from RecoParticleFlow.PFProducer.pfLinker_cff import particleFlowPtrs
# particleFlowPtrs = cms.EDProducer("PFCandidateFwdPtrProducer",
#    src = cms.InputTag("particleFlow")
# )
# FIXME: THIS IS A WASTE, BUT NOT CLEAR HOW TO FIX IT CLEANLY: the module
# downstream operates with View<reco::Candidate>, I wish one could read
# it from std::vector<PFCandidateFwdPtr> directly
pfCandsNotInJetPtrs = pfNoJet.clone(
    topCollection = cms.InputTag('ak5PFJetsPtrs'),
    bottomCollection = cms.InputTag('particleFlowPtrs')
)
pfCandsNotInJet = cms.EDProducer("PFCandidateFromFwdPtrProducer",
    src = cms.InputTag("pfCandsNotInJetPtrs")
)

##____________________________________________________________________________||
pfJetMETcorr = cms.EDProducer("PFJetMETcorrInputProducer",
    src = cms.InputTag('ak5PFJets'),
    offsetCorrLabel = cms.string("ak5PFL1Fastjet"),
    jetCorrLabel = cms.string("ak5PFL1FastL2L3"), # NOTE: use "ak5PFL1FastL2L3" for MC / "ak5PFL1FastL2L3Residual" for Data
    jetCorrEtaMax = cms.double(9.9),
    type1JetPtThreshold = cms.double(10.0),
    type2ResidualCorrLabel = cms.string(""),
    type2ResidualCorrEtaMax = cms.double(9.9),
    type2ResidualCorrOffset = cms.double(0.),
Esempio n. 2
0
# select ak5PFJets corresponding to selected pat::Jets
ak5PFJetsNotOverlappingWithLeptonsCorrPtGt20ForNeuralMtautau = cms.EDFilter(
    "PFJetAntiOverlapSelector",
    src=cms.InputTag('ak5PFJets'),
    srcNotToBeFiltered=cms.VInputTag('selectedPatJetsPt20ForNeuralMtautau'),
    dRmin=cms.double(1.e-1),
    invert=cms.bool(True),
    filter=cms.bool(False))
neuralMtautauSequence += ak5PFJetsNotOverlappingWithLeptonsCorrPtGt20ForNeuralMtautau
#--------------------------------------------------------------------------------

#--------------------------------------------------------------------------------
# select PFCandidates ("unclustered energy") not within jets
from CommonTools.ParticleFlow.TopProjectors.pfNoJet_cfi import pfNoJet
pfCandsNotInSelectedJetsForNeuralMtautau = pfNoJet.clone(
    topCollection=cms.InputTag(
        'ak5PFJetsNotOverlappingWithLeptonsCorrPtGt20ForNeuralMtautau'),
    bottomCollection=cms.InputTag('particleFlow'))
neuralMtautauSequence += pfCandsNotInSelectedJetsForNeuralMtautau
#--------------------------------------------------------------------------------

#--------------------------------------------------------------------------------
# produce genMET
from RecoMET.Configuration.GenMETParticles_cff import *
genParticlesForMETAllVisibleForNeuralMtautau = genParticlesForMETAllVisible.clone(
)
neuralMtautauSequence += genParticlesForMETAllVisibleForNeuralMtautau

from RecoMET.METProducers.genMetTrue_cfi import *
genMetFromGenParticlesForNeuralMtautau = genMetTrue.clone(
    src=cms.InputTag('genParticlesForMETAllVisibleForNeuralMtautau'),
    alias=cms.string('genMetFromGenParticles'))
Esempio n. 3
0
# OK, now convert these back to PFJets, so we can figure out which PFCandidates
# aren't part of any jets
metSigGetPFJets = cms.EDFilter(
    "PFJetViewOverlapSubtraction",
    src=cms.InputTag("ak5PFJets"),
    subtractSrc=cms.InputTag("metSigJetsClean"),
    minDeltaR=cms.double(0.4),
    filter=cms.bool(False),
    invert=cms.bool(True),  # select AK5 PF jets that DO overlap
    noSeqChain=cms.bool(True),  # Don't "chain" these sequence and update [src]
)
metSignficanceSequence += metSigGetPFJets

# Get the PFCandidates that aren't in these jets
from CommonTools.ParticleFlow.TopProjectors.pfNoJet_cfi import pfNoJet
pfCandsNotInSelectedJets = pfNoJet.clone(
    topCollection=cms.InputTag('metSigGetPFJets'),
    bottomCollection=cms.InputTag('particleFlow'))
metSignficanceSequence += pfCandsNotInSelectedJets

# produce PFMET significance cov. matrix
from RecoMET.METProducers.METSigParams_cfi import METSignificance_params
pfMEtSignCovMatrix = cms.EDProducer(
    "PFMETSignificanceProducer",
    METSignificance_params,
    noSeqChain=cms.bool(True),  # Don't "chain" these sequence and update [src]
    src=cms.VInputTag('metSigDecentMuons', 'metSigDecentElectrons',
                      'metSigDecentTaus', 'metSigGetPFJets',
                      'pfCandsNotInSelectedJets'))
metSignficanceSequence += pfMEtSignCovMatrix
from CommonTools.ParticleFlow.TopProjectors.pfNoJet_cfi import pfNoJet
# the new TopProjectors now work with Ptrs
# a conversion is needed if objects are not available
# add them upfront of the sequence
pfJetsPtrForMetCorr = cms.EDProducer("PFJetFwdPtrProducer",
                                     src=cms.InputTag("ak4PFJets"))
# this one is needed only if the input file doesn't have it
#from RecoParticleFlow.PFProducer.pfLinker_cff import particleFlowPtrs
# particleFlowPtrs = cms.EDProducer("PFCandidateFwdPtrProducer",
#    src = cms.InputTag("particleFlow")
# )
# FIXME: THIS IS A WASTE, BUT NOT CLEAR HOW TO FIX IT CLEANLY: the module
# downstream operates with View<reco::Candidate>, I wish one could read
# it from std::vector<PFCandidateFwdPtr> directly
pfCandsNotInJetsPtrForMetCorr = pfNoJet.clone(
    topCollection=cms.InputTag('pfJetsPtrForMetCorr'),
    bottomCollection=cms.InputTag('particleFlowPtrs'))
pfCandsNotInJetsForMetCorr = cms.EDProducer(
    "PFCandidateFromFwdPtrProducer",
    src=cms.InputTag("pfCandsNotInJetsPtrForMetCorr"))

##____________________________________________________________________________||
corrPfMetType1 = cms.EDProducer(
    "PFJetMETcorrInputProducer",
    src=cms.InputTag('ak4PFJetsCHS'),
    offsetCorrLabel=cms.InputTag("ak4PFCHSL1FastjetCorrector"),
    jetCorrLabel=cms.InputTag("ak4PFCHSL1FastL2L3Corrector"),  #for MC
    jetCorrLabelRes=cms.InputTag(
        "ak4PFCHSL1FastL2L3ResidualCorrector"),  # for data, automatic switch
    jetCorrEtaMax=cms.double(9.9),
    type1JetPtThreshold=cms.double(15.0),
# aren't part of any jets
metSigGetPFJets = cms.EDFilter(
    "PFJetViewOverlapSubtraction",
    src = cms.InputTag("ak5PFJets"),
    subtractSrc = cms.InputTag("metSigJetsClean"),
    minDeltaR = cms.double(0.4),
    filter = cms.bool(False),
    invert = cms.bool(True),  # select AK5 PF jets that DO overlap
    noSeqChain = cms.bool(True), # Don't "chain" these sequence and update [src]
)
metSignficanceSequence += metSigGetPFJets

# Get the PFCandidates that aren't in these jets
from CommonTools.ParticleFlow.TopProjectors.pfNoJet_cfi import pfNoJet
pfCandsNotInSelectedJets = pfNoJet.clone(
    topCollection = cms.InputTag('metSigGetPFJets'),
    bottomCollection = cms.InputTag('particleFlow')
)
metSignficanceSequence += pfCandsNotInSelectedJets

# produce PFMET significance cov. matrix
from RecoMET.METProducers.METSigParams_cfi import METSignificance_params
pfMEtSignCovMatrix = cms.EDProducer(
    "PFMETSignificanceProducer",
    METSignificance_params,
    noSeqChain = cms.bool(True), # Don't "chain" these sequence and update [src]
    src = cms.VInputTag(
        'metSigDecentMuons',
        'metSigDecentElectrons',
        'metSigDecentTaus',
        'metSigGetPFJets',
        'pfCandsNotInSelectedJets'
Esempio n. 6
0
import FWCore.ParameterSet.Config as cms

# load jet energy correction parameters
from JetMETCorrections.Configuration.JetCorrectionServices_cff import *

# load config file for producing collection of ak5PFJets
# using pfNoPileUp collection of PFCandidates as input
from JetMETCorrections.Type1MET.ak5PFchsJets_cff import ak5PFchsJetsSequence

#--------------------------------------------------------------------------------
# select PFCandidates ("unclustered energy") not within jets
# for Type 2 MET correction
from CommonTools.ParticleFlow.TopProjectors.pfNoJet_cfi import pfNoJet
pfchsCandsNotInJet = pfNoJet.clone(
    topCollection=cms.InputTag('ak5PFchsJets'),
    bottomCollection=cms.InputTag('particleFlow'))
#--------------------------------------------------------------------------------

#--------------------------------------------------------------------------------
# produce Type 1 + 2 MET corrections for PFJets
pfchsJetMETcorr = cms.EDProducer(
    "PFJetMETcorrInputProducer",
    src=cms.InputTag('ak5PFchsJets'),
    offsetCorrLabel=cms.string("ak5PFchsL1Fastjet"),
    jetCorrLabel=cms.string(
        "ak5PFchsL1FastL2L3"
    ),  # NOTE: use "ak5PFL1FastL2L3" for MC / "ak5PFL1FastL2L3Residual" for Data
    jetCorrEtaMax=cms.double(9.9),
    type1JetPtThreshold=cms.double(10.0),
    skipEM=cms.bool(True),
    skipEMfractionThreshold=cms.double(0.90),
Esempio n. 7
0
# the new TopProjectors now work with Ptrs
# a conversion is needed if objects are not available
# add them upfront of the sequence
ak4PFJetsPtrs = cms.EDProducer("PFJetFwdPtrProducer",
                               src=cms.InputTag("ak4PFJets"))
# this one is needed only if the input file doesn't have it
# solved automatically with unscheduled execution
from RecoParticleFlow.PFProducer.pfLinker_cff import particleFlowPtrs
# particleFlowPtrs = cms.EDProducer("PFCandidateFwdPtrProducer",
#    src = cms.InputTag("particleFlow")
# )
# FIXME: THIS IS A WASTE, BUT NOT CLEAR HOW TO FIX IT CLEANLY: the module
# downstream operates with View<reco::Candidate>, I wish one could read
# it from std::vector<PFCandidateFwdPtr> directly
pfCandsNotInJetPtrs = pfNoJet.clone(
    topCollection=cms.InputTag('ak4PFJetsPtrs'),
    bottomCollection=cms.InputTag('particleFlowPtrs'))
pfCandsNotInJet = cms.EDProducer("PFCandidateFromFwdPtrProducer",
                                 src=cms.InputTag("pfCandsNotInJetPtrs"))

#--------------------------------------------------------------------------------

#--------------------------------------------------------------------------------
# produce Type 1 + 2 MET corrections for PFJets
pfJetMETcorr = cms.EDProducer(
    "PFJetMETcorrInputProducer",
    src=cms.InputTag('ak4PFJets'),
    offsetCorrLabel=cms.string("ak4PFL1Fastjet"),
    jetCorrLabel=cms.string(
        "ak4PFL1FastL2L3"
    ),  # NOTE: use "ak4PFL1FastL2L3" for MC / "ak4PFL1FastL2L3Residual" for Data
# a conversion is needed if objects are not available
# add them upfront of the sequence
pfJetsPtrForMetCorr = cms.EDProducer("PFJetFwdPtrProducer",
   src = cms.InputTag("ak4PFJets")
)
# this one is needed only if the input file doesn't have it
# solved automatically with unscheduled execution
from RecoParticleFlow.PFProducer.pfLinker_cff import particleFlowPtrs
# particleFlowPtrs = cms.EDProducer("PFCandidateFwdPtrProducer",
#    src = cms.InputTag("particleFlow")
# )
# FIXME: THIS IS A WASTE, BUT NOT CLEAR HOW TO FIX IT CLEANLY: the module
# downstream operates with View<reco::Candidate>, I wish one could read
# it from std::vector<PFCandidateFwdPtr> directly
pfCandsNotInJetsPtrForMetCorr = pfNoJet.clone(
    topCollection = cms.InputTag('pfJetsPtrForMetCorr'),
    bottomCollection = cms.InputTag('particleFlowPtrs')
)
pfCandsNotInJetsForMetCorr = cms.EDProducer("PFCandidateFromFwdPtrProducer",
    src = cms.InputTag("pfCandsNotInJetsPtrForMetCorr")
)

##____________________________________________________________________________||
corrPfMetType1 = cms.EDProducer(
    "PFJetMETcorrInputProducer",
    src = cms.InputTag('ak4PFJetsCHS'),
    offsetCorrLabel = cms.InputTag("ak4PFCHSL1FastjetCorrector"),
    jetCorrLabel = cms.InputTag("ak4PFCHSL1FastL2L3Corrector"), #for MC
    jetCorrLabelRes = cms.InputTag("ak4PFCHSL1FastL2L3ResidualCorrector"), # for data, automatic switch
    jetCorrEtaMax = cms.double(9.9),
    type1JetPtThreshold = cms.double(10.0),
    skipEM = cms.bool(True),
# select ak5PFJets corresponding to selected pat::Jets
ak5PFJetsNotOverlappingWithLeptonsCorrPtGt20ForNeuralMtautau = cms.EDFilter("PFJetAntiOverlapSelector",
    src = cms.InputTag('ak5PFJets'),
    srcNotToBeFiltered = cms.VInputTag('selectedPatJetsPt20ForNeuralMtautau'),
    dRmin = cms.double(1.e-1),
    invert = cms.bool(True),
    filter = cms.bool(False)                                                          
)
neuralMtautauSequence += ak5PFJetsNotOverlappingWithLeptonsCorrPtGt20ForNeuralMtautau
#--------------------------------------------------------------------------------

#--------------------------------------------------------------------------------
# select PFCandidates ("unclustered energy") not within jets
from CommonTools.ParticleFlow.TopProjectors.pfNoJet_cfi import pfNoJet
pfCandsNotInSelectedJetsForNeuralMtautau = pfNoJet.clone(
    topCollection = cms.InputTag('ak5PFJetsNotOverlappingWithLeptonsCorrPtGt20ForNeuralMtautau'),
    bottomCollection = cms.InputTag('particleFlow')
)
neuralMtautauSequence += pfCandsNotInSelectedJetsForNeuralMtautau
#--------------------------------------------------------------------------------

#--------------------------------------------------------------------------------
# produce genMET
from RecoMET.Configuration.GenMETParticles_cff import *
genParticlesForMETAllVisibleForNeuralMtautau = genParticlesForMETAllVisible.clone()
neuralMtautauSequence += genParticlesForMETAllVisibleForNeuralMtautau

from RecoMET.METProducers.genMetTrue_cfi import *
genMetFromGenParticlesForNeuralMtautau = genMetTrue.clone(
    src = cms.InputTag('genParticlesForMETAllVisibleForNeuralMtautau'),
    alias = cms.string('genMetFromGenParticles')
)
Esempio n. 10
0
#    Rho_EtaMax = cms.double(2.5)
# )
#
## CV: need to rerun 'ak5PFJets' module with jet area computation enabled,
##     since it has not been enabled per default in CMSSW_4_2_x
##    (if the jet area of 'ak5PFJets' is zero, the L1FastjetCorrector::correction function always returns 1.0)
# from RecoJets.JetProducers.ak5PFJets_cfi import ak5PFJets
# ak5PFJets.doAreaFastjet = cms.bool(True)
##--------------------------------------------------------------------------------

# --------------------------------------------------------------------------------
# select PFCandidates for Type 2 MET correction:
#  (1) select PFCandidates ("unclustered energy") not within jets
from CommonTools.ParticleFlow.TopProjectors.pfNoJet_cfi import pfNoJet

pfCandsNotInJet = pfNoJet.clone(topCollection=cms.InputTag("ak5PFJets"), bottomCollection=cms.InputTag("particleFlow"))
#  (2) select subset of PFCandidates corresponding to neutral hadrons or photons
from CommonTools.ParticleFlow.ParticleSelectors.pfAllChargedHadrons_cfi import pfAllChargedHadrons
from CommonTools.ParticleFlow.ParticleSelectors.pfAllElectrons_cfi import pfAllElectrons
from CommonTools.ParticleFlow.ParticleSelectors.pfAllMuons_cfi import pfAllMuons
from CommonTools.ParticleFlow.ParticleSelectors.pfAllNeutralHadrons_cfi import pfAllNeutralHadrons
from CommonTools.ParticleFlow.ParticleSelectors.pfAllPhotons_cfi import pfAllPhotons

pfType2CandPdgIds = []
# pfType2CandPdgIds.extend(pfAllChargedHadrons.pdgId.value())
# pfType2CandPdgIds.extend(pfAllElectrons.pdgId.value())
# pfType2CandPdgIds.extend(pfAllMuons.pdgId.value())
pfType2CandPdgIds.extend(pfAllNeutralHadrons.pdgId.value())
pfType2CandPdgIds.extend(pfAllPhotons.pdgId.value())

pfType2Cands = cms.EDFilter(
import FWCore.ParameterSet.Config as cms

# load jet energy correction parameters
from JetMETCorrections.Configuration.JetCorrectionServices_cff import *

# load config file for producing collection of ak5PFJets
# using pfNoPileUp collection of PFCandidates as input
from JetMETCorrections.Type1MET.ak5PFchsJets_cff import ak5PFchsJetsSequence

#--------------------------------------------------------------------------------
# select PFCandidates ("unclustered energy") not within jets
# for Type 2 MET correction
from CommonTools.ParticleFlow.TopProjectors.pfNoJet_cfi import pfNoJet
pfchsCandsNotInJet = pfNoJet.clone(
    topCollection = cms.InputTag('ak5PFchsJets'),
    bottomCollection = cms.InputTag('particleFlow')
)
#--------------------------------------------------------------------------------

#--------------------------------------------------------------------------------
# produce Type 1 + 2 MET corrections for PFJets
pfchsJetMETcorr = cms.EDProducer("PFJetMETcorrInputProducer",
    src = cms.InputTag('ak5PFchsJets'),
    offsetCorrLabel = cms.string("ak5PFchsL1Fastjet"),
    jetCorrLabel = cms.string("ak5PFchsL1FastL2L3"), # NOTE: use "ak5PFL1FastL2L3" for MC / "ak5PFL1FastL2L3Residual" for Data
    jetCorrEtaMax = cms.double(9.9),
    type1JetPtThreshold = cms.double(10.0),
    skipEM = cms.bool(True),
    skipEMfractionThreshold = cms.double(0.90),
    skipMuons = cms.bool(True),
    skipMuonSelection = cms.string("isGlobalMuon | isStandAloneMuon")
# select ak5PFJets corresponding to selected pat::Jets
process.ak5PFJetsNotOverlappingWithLeptonsCorrPtGt20 = cms.EDFilter("PFJetAntiOverlapSelector",
    src = cms.InputTag('ak5PFJets'),
    srcNotToBeFiltered = cms.VInputTag('selectedPatJetsPt20'),
    dRmin = cms.double(1.e-1),
    invert = cms.bool(True),
    filter = cms.bool(False)                                                          
)
process.svFitPerformanceAnalysisSequence += process.ak5PFJetsNotOverlappingWithLeptonsCorrPtGt20
#--------------------------------------------------------------------------------

#--------------------------------------------------------------------------------
# select PFCandidates ("unclustered energy") not within jets
from CommonTools.ParticleFlow.TopProjectors.pfNoJet_cfi import pfNoJet
process.pfCandsNotInSelectedJets = pfNoJet.clone(
    topCollection = cms.InputTag('ak5PFJetsNotOverlappingWithLeptonsCorrPtGt20'),
    bottomCollection = cms.InputTag('particleFlow')
)
process.svFitPerformanceAnalysisSequence += process.pfCandsNotInSelectedJets
#--------------------------------------------------------------------------------

#--------------------------------------------------------------------------------
# produce PFMET significance cov. matrix
from RecoMET.METProducers.METSigParams_cfi import *
process.pfMEtSignCovMatrix = cms.EDProducer("PFMEtSignCovMatrixProducer",
    METSignificance_params,                     
    src = cms.VInputTag(
        'genMatchedElectrons',
        'genMatchedMuons',
        'genMatchedTauJets',                                   
        'ak5PFJetsNotOverlappingWithLeptonsCorrPtGt20',
        'pfCandsNotInSelectedJets'
Esempio n. 13
0
# select ak5PFJets corresponding to selected pat::Jets
process.ak5PFJetsNotOverlappingWithLeptonsCorrPtGt20 = cms.EDFilter(
    "PFJetAntiOverlapSelector",
    src=cms.InputTag('ak5PFJets'),
    srcNotToBeFiltered=cms.VInputTag('selectedPatJetsPt20'),
    dRmin=cms.double(1.e-1),
    invert=cms.bool(True),
    filter=cms.bool(False))
process.svFitPerformanceAnalysisSequence += process.ak5PFJetsNotOverlappingWithLeptonsCorrPtGt20
#--------------------------------------------------------------------------------

#--------------------------------------------------------------------------------
# select PFCandidates ("unclustered energy") not within jets
from CommonTools.ParticleFlow.TopProjectors.pfNoJet_cfi import pfNoJet
process.pfCandsNotInSelectedJets = pfNoJet.clone(
    topCollection=cms.InputTag('ak5PFJetsNotOverlappingWithLeptonsCorrPtGt20'),
    bottomCollection=cms.InputTag('particleFlow'))
process.svFitPerformanceAnalysisSequence += process.pfCandsNotInSelectedJets
#--------------------------------------------------------------------------------

#--------------------------------------------------------------------------------
# produce PFMET significance cov. matrix
from RecoMET.METProducers.METSigParams_cfi import *
process.pfMEtSignCovMatrix = cms.EDProducer(
    "PFMEtSignCovMatrixProducer",
    METSignificance_params,
    src=cms.VInputTag('genMatchedElectrons', 'genMatchedMuons',
                      'genMatchedTauJets',
                      'ak5PFJetsNotOverlappingWithLeptonsCorrPtGt20',
                      'pfCandsNotInSelectedJets'),
    addJERcorr=cms.PSet(inputFileName=cms.FileInPath(