def switchToPFJets(process, input=cms.InputTag('pfNoTau'), algo='AK5', postfix = "", jetCorrections=('AK5PFchs', ['L1FastJet','L2Relative', 'L3Absolute']), type1=False, outputModules=['out']): print "Switching to PFJets, ", algo print "************************ " print "input collection: ", input if( algo == 'IC5' ): genJetCollection = cms.InputTag('iterativeCone5GenJetsNoNu') elif algo == 'AK5': genJetCollection = cms.InputTag('ak5GenJetsNoNu') elif algo == 'AK7': genJetCollection = cms.InputTag('ak7GenJetsNoNu') else: print 'bad jet algorithm:', algo, '! for now, only IC5, AK5 and AK7 are allowed. If you need other algorithms, please contact Colin' sys.exit(1) # changing the jet collection in PF2PAT: from CommonTools.ParticleFlow.Tools.jetTools import jetAlgo inputCollection = getattr(process,"pfJets"+postfix).src setattr(process,"pfJets"+postfix,jetAlgo(algo)) # problem for cfgBrowser getattr(process,"pfJets"+postfix).src = inputCollection inputJetCorrLabel=jetCorrections switchJetCollection(process, input, jetIdLabel = algo, doJTA=True, doBTagging=True, jetCorrLabel=inputJetCorrLabel, doType1MET=type1, genJetCollection = genJetCollection, doJetID = True, postfix = postfix, outputModules = outputModules ) # check whether L1FastJet is in the list of correction levels or not applyPostfix(process, "patJetCorrFactors", postfix).useRho = False for corr in inputJetCorrLabel[1]: if corr == 'L1FastJet': applyPostfix(process, "patJetCorrFactors", postfix).useRho = True applyPostfix(process, "pfJets", postfix).doAreaFastjet = True # do correct treatment for TypeI MET corrections if type1: for mod in getattr(process,'patPF2PATSequence'+postfix).moduleNames(): if mod.startswith("kt6"): prefix = mod.replace(postfix,'') prefix = prefix.replace('kt6PFJets','') prefix = prefix.replace('kt6CaloJets','') prefix = getattr(process,'patJetCorrFactors'+prefix+postfix).payload.pythonValue().replace("'","") for essource in process.es_sources_().keys(): if essource == prefix+'L1FastJet': setattr(process,essource+postfix,getattr(process,essource).clone(srcRho=cms.InputTag(mod,'rho'))) setattr(process,prefix+'CombinedCorrector'+postfix,getattr(process,prefix+'CombinedCorrector').clone()) getattr(process,prefix+'CorMet'+postfix).corrector = prefix+'CombinedCorrector'+postfix for cor in getattr(process,prefix+'CombinedCorrector'+postfix).correctors: if cor == essource: idx = getattr(process,prefix+'CombinedCorrector'+postfix).correctors.index(essource); getattr(process,prefix+'CombinedCorrector'+postfix).correctors[idx] = essource+postfix applyPostfix(process, "patJets", postfix).embedCaloTowers = False applyPostfix(process, "patJets", postfix).embedPFCandidates = True
def switchToPFJets(process, input=cms.InputTag('pfNoTau'), algo='AK5', postfix="", jetCorrections=('AK5PFchs', ['L1FastJet', 'L2Relative', 'L3Absolute']), outputModules=['out']): print "Switching to PFJets, ", algo print "************************ " print "input collection: ", input if (algo == 'IC5'): genJetCollection = cms.InputTag('iterativeCone5GenJetsNoNu') elif algo == 'AK5': genJetCollection = cms.InputTag('ak5GenJetsNoNu') elif algo == 'AK7': genJetCollection = cms.InputTag('ak7GenJetsNoNu') else: print 'bad jet algorithm:', algo, '! for now, only IC5, AK5 and AK7 are allowed. If you need other algorithms, please contact Colin' sys.exit(1) # changing the jet collection in PF2PAT: from CommonTools.ParticleFlow.Tools.jetTools import jetAlgo inputCollection = getattr(process, "pfJets" + postfix).src setattr(process, "pfJets" + postfix, jetAlgo(algo)) # problem for cfgBrowser getattr(process, "pfJets" + postfix).src = inputCollection inputJetCorrLabel = jetCorrections switchJetCollection( process, input, jetIdLabel=algo, doJTA=True, doBTagging=True, jetCorrLabel=inputJetCorrLabel, #doType1MET=False, doType1MET=True, genJetCollection=genJetCollection, doJetID=True, postfix=postfix, outputModules=outputModules) # check whether L1FastJet is in the list of correction levels or not applyPostfix(process, "patJetCorrFactors", postfix).useRho = False for corr in inputJetCorrLabel[1]: if corr == 'L1FastJet': applyPostfix(process, "patJetCorrFactors", postfix).useRho = True applyPostfix(process, "pfJets", postfix).doAreaFastjet = True applyPostfix(process, "kt6PFJets", postfix).src = inputCollection applyPostfix(process, "patJets", postfix).embedCaloTowers = False applyPostfix(process, "patJets", postfix).embedPFCandidates = True
def switchToPFJets(process, input=cms.InputTag('pfNoTau'), algo='AK5', postfix = "", jetCorrections=('AK5PFchs', ['L1FastJet','L2Relative', 'L3Absolute']), outputModules=['out']): print "Switching to PFJets, ", algo print "************************ " print "input collection: ", input if( algo == 'IC5' ): genJetCollection = cms.InputTag('iterativeCone5GenJetsNoNu') elif algo == 'AK5': genJetCollection = cms.InputTag('ak5GenJetsNoNu') elif algo == 'AK7': genJetCollection = cms.InputTag('ak7GenJetsNoNu') else: print 'bad jet algorithm:', algo, '! for now, only IC5, AK5 and AK7 are allowed. If you need other algorithms, please contact Colin' sys.exit(1) # changing the jet collection in PF2PAT: from CommonTools.ParticleFlow.Tools.jetTools import jetAlgo inputCollection = getattr(process,"pfJets"+postfix).src setattr(process,"pfJets"+postfix,jetAlgo(algo)) # problem for cfgBrowser getattr(process,"pfJets"+postfix).src = inputCollection inputJetCorrLabel=jetCorrections switchJetCollection(process, input, jetIdLabel = algo, doJTA=True, doBTagging=True, jetCorrLabel=inputJetCorrLabel, #doType1MET=False, doType1MET=True, genJetCollection = genJetCollection, doJetID = True, postfix = postfix, outputModules = outputModules ) # check whether L1FastJet is in the list of correction levels or not applyPostfix(process, "patJetCorrFactors", postfix).useRho = False for corr in inputJetCorrLabel[1]: if corr == 'L1FastJet': applyPostfix(process, "patJetCorrFactors", postfix).useRho = True applyPostfix(process, "pfJets", postfix).doAreaFastjet = True applyPostfix(process, "kt6PFJets", postfix).src = inputCollection applyPostfix(process, "patJets", postfix).embedCaloTowers = False applyPostfix(process, "patJets", postfix).embedPFCandidates = True
src='pfAllElectronsPFBRECO') from CommonTools.ParticleFlow.Isolation.pfIsolatedElectrons_cfi import * pfIsolatedElectronsPFBRECO = pfIsolatedElectrons.clone( src='pfElectronsFromVertexPFBRECO') pfElectronsPFBRECO = pfIsolatedElectronsPFBRECO.clone( cut= " pt > 5 & gsfElectronRef.isAvailable() & gsfTrackRef.hitPattern().numberOfLostHits('MISSING_INNER_HITS')<2" ) pfElectronPFBRECOTask = cms.Task(pfAllElectronsPFBRECO, pfElectronsFromVertexPFBRECO, pfIsolatedElectronsPFBRECO, pfElectronsPFBRECO) pfElectronPFBRECOSequence = cms.Sequence(pfElectronPFBRECOTask) from CommonTools.ParticleFlow.Tools.jetTools import jetAlgo pfJetsPFBRECO = jetAlgo('AK4') pfJetsPFBRECO.src = 'pfNoElectronJMEPFBRECO' pfJetsPtrsPFBRECO = cms.EDProducer("PFJetFwdPtrProducer", src=cms.InputTag("pfJetsPFBRECO")) pfJetPFBRECOTask = cms.Task(pfJetsPFBRECO, pfJetsPtrsPFBRECO) pfJetPFBRECOSequence = cms.Sequence(pfJetPFBRECOTask) from CommonTools.ParticleFlow.pfTaus_cff import * from CommonTools.ParticleFlow.pfMET_cfi import * pfMETPFBRECO = pfMET.clone(srcJets='pfJetsPFBRECO') ##delta beta weighting #from CommonTools.ParticleFlow.deltaBetaWeights_cfi import * #pfWeightedPhotonsPFBRECO = pfWeightedPhotons.clone( src = 'pfAllPhotonsPFBRECO', #chargedFromPV = 'pfAllChargedParticlesPFBRECO',
def switchToPFJets(process, input=cms.InputTag('pfNoTauClones'), algo='AK4', postfix = "", jetCorrections=('AK4PFchs', ['L1FastJet','L2Relative', 'L3Absolute']), type1=False, outputModules=['out']): print "Switching to PFJets, ", algo print "************************ " print "input collection: ", input if algo == 'AK4': genJetCollection = cms.InputTag('ak4GenJetsNoNu'+postfix) rParam=0.4 elif algo == 'AK7': genJetCollection = cms.InputTag('ak7GenJetsNoNu'+postfix) rParam=0.7 else: print 'bad jet algorithm:', algo, '! for now, only AK4 and AK7 are allowed. If you need other algorithms, please contact Colin' sys.exit(1) # changing the jet collection in PF2PAT: from CommonTools.ParticleFlow.Tools.jetTools import jetAlgo inputCollection = getattr(process,"pfJets"+postfix).src setattr(process,"pfJets"+postfix,jetAlgo(algo)) # problem for cfgBrowser getattr(process,"pfJets"+postfix).src = inputCollection inputJetCorrLabel=jetCorrections switchJetCollection(process, jetSource = input, algo=algo, rParam=rParam, genJetCollection=genJetCollection, postfix=postfix, jetTrackAssociation=True, jetCorrections=inputJetCorrLabel, outputModules = outputModules, ) # check whether L1FastJet is in the list of correction levels or not applyPostfix(process, "patJetCorrFactors", postfix).useRho = False for corr in inputJetCorrLabel[1]: if corr == 'L1FastJet': applyPostfix(process, "patJetCorrFactors", postfix).useRho = True applyPostfix(process, "pfJets", postfix).doAreaFastjet = True # do correct treatment for TypeI MET corrections #type1=True if type1: for mod in process.producerNames().split(' '): if mod.startswith("kt6") and mod.endswith("Jets"+postfix) and not 'GenJets' in mod: prefix = mod.replace(postfix,'') prefix = prefix.replace('kt6PFJets','') prefix = prefix.replace('kt6CaloJets','') prefix = getattr(process,'patJetCorrFactors'+prefix+postfix).payload.pythonValue().replace("'","") for essource in process.es_sources_().keys(): if essource == prefix+'L1FastJet': setattr(process,essource+postfix,getattr(process,essource).clone(srcRho=cms.InputTag(mod,'rho'))) setattr(process,prefix+'CombinedCorrector'+postfix,getattr(process,prefix+'CombinedCorrector').clone()) getattr(process,prefix+'CorMet'+postfix).corrector = prefix+'CombinedCorrector'+postfix for cor in getattr(process,prefix+'CombinedCorrector'+postfix).correctors: if cor == essource: idx = getattr(process,prefix+'CombinedCorrector'+postfix).correctors.index(essource); getattr(process,prefix+'CombinedCorrector'+postfix).correctors[idx] = essource+postfix if hasattr( getattr( process, "patJets" + postfix), 'embedCaloTowers' ): # optional parameter, which defaults to 'False' anyway applyPostfix(process, "patJets", postfix).embedCaloTowers = False applyPostfix(process, "patJets", postfix).embedPFCandidates = True
def switchToPFJets(process, input=cms.InputTag('pfNoTauClones'), algo='AK4', postfix="", jetCorrections=('AK4PFchs', ['L1FastJet', 'L2Relative', 'L3Absolute']), type1=False, outputModules=['out']): print "Switching to PFJets, ", algo print "************************ " print "input collection: ", input if algo == 'AK4': genJetCollection = cms.InputTag('ak4GenJetsNoNu' + postfix) rParam = 0.4 elif algo == 'AK7': genJetCollection = cms.InputTag('ak7GenJetsNoNu' + postfix) rParam = 0.7 else: print 'bad jet algorithm:', algo, '! for now, only AK4 and AK7 are allowed. If you need other algorithms, please contact Colin' sys.exit(1) # changing the jet collection in PF2PAT: from CommonTools.ParticleFlow.Tools.jetTools import jetAlgo inputCollection = getattr(process, "pfJetsPFBRECO" + postfix).src setattr(process, "pfJetsPFBRECO" + postfix, jetAlgo(algo)) # problem for cfgBrowser getattr(process, "pfJetsPFBRECO" + postfix).src = inputCollection inputJetCorrLabel = jetCorrections switchJetCollection( process, jetSource=input, algo=algo, rParam=rParam, genJetCollection=genJetCollection, postfix=postfix, jetTrackAssociation=True, jetCorrections=inputJetCorrLabel, outputModules=outputModules, ) # check whether L1FastJet is in the list of correction levels or not applyPostfix(process, "patJetCorrFactors", postfix).useRho = False task = getPatAlgosToolsTask(process) for corr in inputJetCorrLabel[1]: if corr == 'L1FastJet': applyPostfix(process, "patJetCorrFactors", postfix).useRho = True applyPostfix(process, "pfJetsPFBRECO", postfix).doAreaFastjet = True # do correct treatment for TypeI MET corrections #type1=True if type1: for mod in process.producerNames().split(' '): if mod.startswith("kt6") and mod.endswith( "Jets" + postfix) and not 'GenJets' in mod: prefix = mod.replace(postfix, '') prefix = prefix.replace('kt6PFJets', '') prefix = prefix.replace('kt6CaloJets', '') prefix = getattr( process, 'patJetCorrFactors' + prefix + postfix).payload.pythonValue().replace("'", "") for essource in process.es_sources_().keys(): if essource == prefix + 'L1FastJet': setattr( process, essource + postfix, getattr(process, essource).clone( srcRho=cms.InputTag(mod, 'rho'))) addToProcessAndTask( prefix + 'CombinedCorrector' + postfix, getattr(process, prefix + 'CombinedCorrector').clone(), process, task) getattr( process, prefix + 'CorMet' + postfix ).corrector = prefix + 'CombinedCorrector' + postfix for cor in getattr( process, prefix + 'CombinedCorrector' + postfix).correctors: if cor == essource: idx = getattr( process, prefix + 'CombinedCorrector' + postfix).correctors.index(essource) getattr( process, prefix + 'CombinedCorrector' + postfix ).correctors[idx] = essource + postfix if hasattr(getattr(process, "patJets" + postfix), 'embedCaloTowers' ): # optional parameter, which defaults to 'False' anyway applyPostfix(process, "patJets", postfix).embedCaloTowers = False applyPostfix(process, "patJets", postfix).embedPFCandidates = True
import FWCore.ParameterSet.Config as cms from CommonTools.ParticleFlow.ParticleSelectors.ptMinPFJetSelector_cfi import ptMinPFJets as pfJets from CommonTools.ParticleFlow.Tools.jetTools import jetAlgo #allPfJets = RecoJets.JetProducers.ic5PFJets_cfi.iterativeCone5PFJets.clone() pfJets = jetAlgo('AK4') pfJetsPtrs = cms.EDProducer("PFJetFwdPtrProducer", src=cms.InputTag("pfJets") ) #pfJets.src = 'allPfJets' #pfJets.ptMin = 10 pfJetSequence = cms.Sequence( # allPfJets * pfJets + pfJetsPtrs )
def switchToPFJets(process, input=cms.InputTag('pfNoTau'), algo='AK5', postfix="", jetCorrections=('AK5PFchs', ['L1FastJet', 'L2Relative', 'L3Absolute']), type1=False, outputModules=['out']): print "Switching to PFJets, ", algo print "************************ " print "input collection: ", input if (algo == 'IC5'): genJetCollection = cms.InputTag('iterativeCone5GenJetsNoNu') elif algo == 'AK5': genJetCollection = cms.InputTag('ak5GenJetsNoNu') elif algo == 'AK7': genJetCollection = cms.InputTag('ak7GenJetsNoNu') else: print 'bad jet algorithm:', algo, '! for now, only IC5, AK5 and AK7 are allowed. If you need other algorithms, please contact Colin' sys.exit(1) # changing the jet collection in PF2PAT: from CommonTools.ParticleFlow.Tools.jetTools import jetAlgo inputCollection = getattr(process, "pfJets" + postfix).src setattr(process, "pfJets" + postfix, jetAlgo(algo)) # problem for cfgBrowser getattr(process, "pfJets" + postfix).src = inputCollection inputJetCorrLabel = jetCorrections switchJetCollection(process, input, jetIdLabel=algo, doJTA=True, doBTagging=True, jetCorrLabel=inputJetCorrLabel, doType1MET=type1, genJetCollection=genJetCollection, doJetID=True, postfix=postfix, outputModules=outputModules) # check whether L1FastJet is in the list of correction levels or not applyPostfix(process, "patJetCorrFactors", postfix).useRho = False for corr in inputJetCorrLabel[1]: if corr == 'L1FastJet': applyPostfix(process, "patJetCorrFactors", postfix).useRho = True applyPostfix(process, "pfJets", postfix).doAreaFastjet = True # do correct treatment for TypeI MET corrections if type1: for mod in getattr(process, 'patPF2PATSequence' + postfix).moduleNames(): if mod.startswith("kt6") and mod.endswith("Jets" + postfix): prefix = mod.replace(postfix, '') prefix = prefix.replace('kt6PFJets', '') prefix = prefix.replace('kt6CaloJets', '') prefix = getattr( process, 'patJetCorrFactors' + prefix + postfix).payload.pythonValue().replace("'", "") for essource in process.es_sources_().keys(): if essource == prefix + 'L1FastJet': setattr( process, essource + postfix, getattr(process, essource).clone( srcRho=cms.InputTag(mod, 'rho'))) setattr( process, prefix + 'CombinedCorrector' + postfix, getattr(process, prefix + 'CombinedCorrector').clone()) getattr( process, prefix + 'CorMet' + postfix ).corrector = prefix + 'CombinedCorrector' + postfix for cor in getattr( process, prefix + 'CombinedCorrector' + postfix).correctors: if cor == essource: idx = getattr( process, prefix + 'CombinedCorrector' + postfix).correctors.index(essource) getattr( process, prefix + 'CombinedCorrector' + postfix ).correctors[idx] = essource + postfix applyPostfix(process, "patJets", postfix).embedCaloTowers = False applyPostfix(process, "patJets", postfix).embedPFCandidates = True
import FWCore.ParameterSet.Config as cms from CommonTools.ParticleFlow.ParticleSelectors.ptMinPFJetSelector_cfi import ptMinPFJets as pfJets from CommonTools.ParticleFlow.Tools.jetTools import jetAlgo #allPfJets = RecoJets.JetProducers.ic5PFJets_cfi.iterativeCone5PFJets.clone() pfJets = jetAlgo('AK5') #pfJets.src = 'allPfJets' #pfJets.ptMin = 10 pfJetSequence = cms.Sequence( # allPfJets * pfJets )
) from CommonTools.ParticleFlow.ParticleSelectors.pfElectronsFromVertex_cfi import * pfElectronsFromVertexPFBRECO = pfElectronsFromVertex.clone( src = 'pfAllElectronsPFBRECO' ) from CommonTools.ParticleFlow.Isolation.pfIsolatedElectrons_cfi import * pfIsolatedElectronsPFBRECO = pfIsolatedElectrons.clone( src = 'pfElectronsFromVertexPFBRECO' ) pfElectronsPFBRECO = pfIsolatedElectronsPFBRECO.clone( cut = cms.string(" pt > 5 & gsfElectronRef.isAvailable() & gsfTrackRef.hitPattern().numberOfLostHits('MISSING_INNER_HITS')<2")) pfElectronPFBRECOSequence = cms.Sequence( pfAllElectronsPFBRECO + pfElectronsFromVertexPFBRECO + pfIsolatedElectronsPFBRECO + pfElectronsPFBRECO ) from CommonTools.ParticleFlow.Tools.jetTools import jetAlgo pfJetsPFBRECO = jetAlgo('AK4') pfJetsPFBRECO.src = 'pfNoElectronJMEPFBRECO' pfJetsPtrsPFBRECO = cms.EDProducer("PFJetFwdPtrProducer", src=cms.InputTag("pfJetsPFBRECO") ) pfJetPFBRECOSequence = cms.Sequence( pfJetsPFBRECO + pfJetsPtrsPFBRECO ) from CommonTools.ParticleFlow.pfTaus_cff import * from CommonTools.ParticleFlow.pfMET_cfi import * pfMETPFBRECO = pfMET.clone( jets = 'pfJetsPFBRECO' ) ##delta beta weighting
import FWCore.ParameterSet.Config as cms from CommonTools.ParticleFlow.ParticleSelectors.ptMinPFJetSelector_cfi import ptMinPFJets as pfJets from CommonTools.ParticleFlow.Tools.jetTools import jetAlgo #allPfJets = RecoJets.JetProducers.ic5PFJets_cfi.iterativeCone5PFJets.clone() pfJets = jetAlgo('AK4') pfJetsPtrs = cms.EDProducer("PFJetFwdPtrProducer", src=cms.InputTag("pfJets")) #pfJets.src = 'allPfJets' #pfJets.ptMin = 10 pfJetTask = cms.Task( # allPfJets , pfJets, pfJetsPtrs) pfJetSequence = cms.Sequence(pfJetTask)