def addFlashggPF(process): print "JET PRODUCER :: Flashgg PF producer ::" from RecoJets.JetProducers.ak4PFJets_cfi import ak4PFJets from RecoJets.JetProducers.ak4GenJets_cfi import ak4GenJets process.ak4PFJets = ak4PFJets.clone (src = 'packedPFCandidates', doAreaFastjet = True) process.ak4GenJets = ak4GenJets.clone(src = 'packedGenParticles') ## cluster the jets addJetCollection( process, labelName = 'AK4PF', jetSource = cms.InputTag('ak4PFJets'), pvSource = cms.InputTag('offlineSlimmedPrimaryVertices'), pfCandidates = cms.InputTag('packedPFCandidates'), svSource = cms.InputTag('slimmedSecondaryVertices'), btagDiscriminators = [ flashggBTag ], jetCorrections = ('AK4PFchs', ['L1FastJet', 'L2Relative', 'L3Absolute'], 'None'), genJetCollection = cms.InputTag('ak4GenJets'), genParticles = cms.InputTag('prunedGenParticles'), # jet param algo = 'AK', rParam = 0.4 ) ## adjust MC matching process.patJetGenJetMatchAK4PF.matched = "ak4GenJets" process.patJetPartonMatchAK4PF.matched = "prunedGenParticles" #process.patJetPartons.particles = "prunedGenParticles" #adjust PV used for Jet Corrections process.patJetCorrFactorsAK4PF.primaryVertices = "offlineSlimmedPrimaryVertices"
def addFlashggPFCHSLegJets(process): #process.load("Configuration.StandardSequences.Geometry_cff") #process.myPrefer = cms.ESPrefer("CaloSubdetectorGeometry" [,"ZDC" # [,ZdcGeometryFromDBEP = cms.vstring("<C++ data type>[/<data label>]"[,...])] # ) # load various necessary plugins. process.load("PhysicsTools.PatAlgos.producersLayer1.patCandidates_cff") process.load('PhysicsTools.PatAlgos.slimming.unpackedTracksAndVertices_cfi') # leptons to remove as per default CHS workflow process.selectedMuons = cms.EDFilter("CandPtrSelector", src = cms.InputTag("slimmedMuons"), cut = cms.string('''abs(eta)<2.5 && pt>10. && (pfIsolationR04().sumChargedHadronPt+ max(0.,pfIsolationR04().sumNeutralHadronEt+ pfIsolationR04().sumPhotonEt- 0.50*pfIsolationR04().sumPUPt))/pt < 0.20 && (isPFMuon && (isGlobalMuon || isTrackerMuon) )''')) process.selectedElectrons = cms.EDFilter("CandPtrSelector", src = cms.InputTag("slimmedElectrons"), cut = cms.string('''abs(eta)<2.5 && pt>20. && gsfTrack.isAvailable() && gsfTrack.hitPattern().numberOfLostHits(\'MISSING_INNER_HITS\') < 2 && (pfIsolationVariables().sumChargedHadronPt+ max(0.,pfIsolationVariables().sumNeutralHadronEt+ pfIsolationVariables().sumPhotonEt- 0.5*pfIsolationVariables().sumPUPt))/pt < 0.15''')) # Simple producer which just removes the Candidates which don't come from the legacy vertex according to the Flashgg Vertex Map process.flashggCHSLegacyVertexCandidates = cms.EDProducer('FlashggCHSLegacyVertexCandidateProducer', PFCandidatesTag=cms.untracked.InputTag('packedPFCandidates'), DiPhotonTag=cms.untracked.InputTag('flashggDiPhotons'), VertexCandidateMapTag = cms.InputTag("flashggVertexMapForCHS"), VertexTag=cms.untracked.InputTag('offlineSlimmedPrimaryVertices') ) process.pfCHSLeg = cms.EDFilter("CandPtrSelector", src = cms.InputTag("flashggCHSLegacyVertexCandidates"), cut = cms.string("")) # then remove the previously selected muons process.pfNoMuonCHSLeg = cms.EDProducer("CandPtrProjector", src = cms.InputTag("pfCHSLeg"), veto = cms.InputTag("selectedMuons")) # then remove the previously selected electrons process.pfNoElectronsCHSLeg = cms.EDProducer("CandPtrProjector", src = cms.InputTag("pfNoMuonCHSLeg"), veto = cms.InputTag("selectedElectrons")) #Import RECO jet producer for ak4 PF and GEN jet from RecoJets.JetProducers.ak4PFJets_cfi import ak4PFJets from RecoJets.JetProducers.ak4GenJets_cfi import ak4GenJets process.ak4PFJetsCHSLeg = ak4PFJets.clone(src = 'pfNoElectronsCHSLeg', doAreaFastjet = True) process.ak4GenJetsLeg = ak4GenJets.clone(src = 'packedGenParticles') # cluster the jets addJetCollection( process, postfix = "", labelName = 'AK4PFCHSLeg', pfCandidates = cms.InputTag('packedPFCandidates'), jetSource = cms.InputTag('ak4PFJetsCHSLeg'), #trackSource = cms.InputTag('unpackedTracksAndVertices'), pvSource = cms.InputTag('unpackedTracksAndVertices'), jetCorrections = ('AK4PFchs', cms.vstring(['L1FastJet', 'L2Relative', 'L3Absolute']), 'None'), #btagDiscriminators = [ 'combinedSecondaryVertexBJetTags' ] btagDiscriminators = [ 'pfJetProbabilityBJetTags' ] ,algo= 'AK', rParam = 0.4 ) # adjust MC matching process.patJetGenJetMatchAK4PFCHSLeg.matched = "ak4GenJetsLeg" process.patJetPartonMatchAK4PFCHSLeg.matched = "prunedGenParticles" process.patJetPartons.particles = "prunedGenParticles" # adjust PV collection used for Jet Corrections process.patJetCorrFactorsAK4PFCHSLeg.primaryVertices = "offlineSlimmedPrimaryVertices"
def addGenJetCollection(self, proc, jet, inputCollection = "", minPtFastjet = None, ): print("jetCollectionTools::GenJetAdder::addGenJetCollection: Adding Gen Jet Collection: {}".format(jet)) # # Decide which genJet collection we are dealing with # genJetInfo = GenJetInfo(jet,inputCollection) jetLower = genJetInfo.jetLower jetUpper = genJetInfo.jetUpper #======================================================= # # If genJet collection in MiniAOD is not # specified, build the genjet collection. # #======================================================== if not inputCollection: print("jetCollectionTools::GenJetAdder::addGenJetCollection: inputCollection not specified. Building genjet collection now") # # Setup GenParticles # packedGenPartNoNu = "packedGenParticlesForJetsNoNu" if packedGenPartNoNu not in self.prerequisites: self.addProcessAndTask(proc, packedGenPartNoNu, cms.EDFilter("CandPtrSelector", src = cms.InputTag("packedGenParticles"), cut = cms.string("abs(pdgId) != 12 && abs(pdgId) != 14 && abs(pdgId) != 16"), ) ) self.prerequisites.append(packedGenPartNoNu) # # Create the GenJet collection # genJetsCollection = "{}{}{}".format(genJetInfo.jetAlgo.upper(), genJetInfo.jetSize, 'GenJetsNoNu') self.addProcessAndTask(proc, genJetsCollection, ak4GenJets.clone( src = packedGenPartNoNu, jetAlgorithm = cms.string(supportedJetAlgos[genJetInfo.jetAlgo]), rParam = cms.double(genJetInfo.jetSizeNr), ) ) # # Set minimum pt threshold of gen jets to be saved after fastjet clustering # if minPtFastjet != None: getattr(proc, genJetsCollection).jetPtMin = minPtFastjet self.prerequisites.append(genJetsCollection) return genJetInfo
def defineGenTtbarCategorizerSequence(process): process.ak4GenJetsCustom = ak4GenJets.clone( src='packedGenParticles', rParam=cms.double(0.4), jetAlgorithm=cms.string("AntiKt")) process.genJetFlavourPlusLeptonInfos = genJetFlavourPlusLeptonInfos.clone( jets='ak4GenJetsCustom', rParam=cms.double(0.4), jetAlgorithm=cms.string("AntiKt")) process.matchGenBHadron = matchGenBHadron.clone( genParticles='prunedGenParticles') process.matchGenCHadron = matchGenCHadron.clone( genParticles='prunedGenParticles') process.selectedHadronsAndPartons = selectedHadronsAndPartons.clone( particles='prunedGenParticles') process.categorizeGenTtbar = cms.EDProducer( "GenTtbarCategorizer", # Phase space of additional jets genJetPtMin=cms.double(20.), genJetAbsEtaMax=cms.double(2.4), # Input tags holding information about b/c hadron matching genJets=cms.InputTag("ak4GenJetsCustom"), genBHadJetIndex=cms.InputTag("matchGenBHadron", "genBHadJetIndex"), genBHadFlavour=cms.InputTag("matchGenBHadron", "genBHadFlavour"), genBHadFromTopWeakDecay=cms.InputTag("matchGenBHadron", "genBHadFromTopWeakDecay"), genBHadPlusMothers=cms.InputTag("matchGenBHadron", "genBHadPlusMothers"), genBHadPlusMothersIndices=cms.InputTag("matchGenBHadron", "genBHadPlusMothersIndices"), genBHadIndex=cms.InputTag("matchGenBHadron", "genBHadIndex"), genBHadLeptonHadronIndex=cms.InputTag("matchGenBHadron", "genBHadLeptonHadronIndex"), genBHadLeptonViaTau=cms.InputTag("matchGenBHadron", "genBHadLeptonViaTau"), genCHadJetIndex=cms.InputTag("matchGenCHadron", "genCHadJetIndex"), genCHadFlavour=cms.InputTag("matchGenCHadron", "genCHadFlavour"), genCHadFromTopWeakDecay=cms.InputTag("matchGenCHadron", "genCHadFromTopWeakDecay"), genCHadBHadronId=cms.InputTag("matchGenCHadron", "genCHadBHadronId"), ) process.genTtbarCategorizerSequence = cms.Sequence( process.ak4GenJetsCustom * process.genJetFlavourPlusLeptonInfos * process.matchGenBHadron * process.matchGenCHadron * process.categorizeGenTtbar)
def defineGenTtbarCategorizerSequence(process): process.ak4GenJetsCustom = ak4GenJets.clone(src = 'packedGenParticles', rParam = cms.double(0.4), jetAlgorithm = cms.string("AntiKt") ) process.genJetFlavourPlusLeptonInfos = genJetFlavourPlusLeptonInfos.clone( jets = 'ak4GenJetsCustom', rParam = cms.double(0.4), jetAlgorithm = cms.string("AntiKt") ) process.matchGenBHadron = matchGenBHadron.clone(genParticles = 'prunedGenParticles') process.matchGenCHadron = matchGenCHadron.clone(genParticles = 'prunedGenParticles') process.selectedHadronsAndPartons = selectedHadronsAndPartons.clone(particles = 'prunedGenParticles') process.categorizeGenTtbar = cms.EDProducer("GenTtbarCategorizer", # Phase space of additional jets genJetPtMin = cms.double(20.), genJetAbsEtaMax = cms.double(2.4), # Input tags holding information about b/c hadron matching genJets = cms.InputTag("ak4GenJetsCustom"), genBHadJetIndex = cms.InputTag("matchGenBHadron", "genBHadJetIndex"), genBHadFlavour = cms.InputTag("matchGenBHadron", "genBHadFlavour"), genBHadFromTopWeakDecay = cms.InputTag("matchGenBHadron", "genBHadFromTopWeakDecay"), genBHadPlusMothers = cms.InputTag("matchGenBHadron", "genBHadPlusMothers"), genBHadPlusMothersIndices = cms.InputTag("matchGenBHadron", "genBHadPlusMothersIndices"), genBHadIndex = cms.InputTag("matchGenBHadron", "genBHadIndex"), genBHadLeptonHadronIndex = cms.InputTag("matchGenBHadron", "genBHadLeptonHadronIndex"), genBHadLeptonViaTau = cms.InputTag("matchGenBHadron", "genBHadLeptonViaTau"), genCHadJetIndex = cms.InputTag("matchGenCHadron", "genCHadJetIndex"), genCHadFlavour = cms.InputTag("matchGenCHadron", "genCHadFlavour"), genCHadFromTopWeakDecay = cms.InputTag("matchGenCHadron", "genCHadFromTopWeakDecay"), genCHadBHadronId = cms.InputTag("matchGenCHadron", "genCHadBHadronId"), ) process.genTtbarCategorizerSequence=cms.Sequence(process.ak4GenJetsCustom *process.genJetFlavourPlusLeptonInfos *process.matchGenBHadron *process.matchGenCHadron *process.categorizeGenTtbar)
import FWCore.ParameterSet.Config as cms from RecoJets.JetProducers.ak4GenJets_cfi import ak4GenJets from RecoJets.JetProducers.ak8GenJets_cfi import ak8GenJets from RecoHI.HiJetAlgos.HiGenJets_cff import * ak4GenJetsNoNu = ak4GenJets.clone(src=cms.InputTag("genParticlesForJetsNoNu")) ak8GenJetsNoNu = ak8GenJets.clone(src=cms.InputTag("genParticlesForJetsNoNu")) ak4GenJetsNoMuNoNu = ak4GenJets.clone( src=cms.InputTag("genParticlesForJetsNoMuNoNu")) ak8GenJetsNoMuNoNu = ak8GenJets.clone( src=cms.InputTag("genParticlesForJetsNoMuNoNu")) recoGenJetsTask = cms.Task(ak4GenJets, ak8GenJets, ak4GenJetsNoNu, ak8GenJetsNoNu) recoGenJets = cms.Sequence(recoGenJetsTask) recoAllGenJets = cms.Sequence(ak4GenJets + ak8GenJets) recoAllGenJetsNoNu = cms.Sequence(ak4GenJetsNoNu + ak8GenJetsNoNu) recoAllGenJetsNoMuNoNu = cms.Sequence(ak4GenJetsNoMuNoNu + ak8GenJetsNoMuNoNu)
import FWCore.ParameterSet.Config as cms from RecoJets.JetProducers.ak4GenJets_cfi import ak4GenJets ak8GenJets = ak4GenJets.clone( rParam = 0.8 ) ak8GenJetsSoftDrop = ak8GenJets.clone( useSoftDrop = cms.bool(True), zcut = cms.double(0.1), beta = cms.double(0.0), R0 = cms.double(0.8), useExplicitGhosts = cms.bool(True), writeCompound = cms.bool(True), jetCollInstanceName = cms.string("SubJets"), jetPtMin = 100.0 ) ak8GenJetsConstituents = cms.EDProducer("GenJetConstituentSelector", src = cms.InputTag("ak8GenJets"), cut = cms.string("pt > 100.0") )
veto=cms.InputTag("selectedElectrons")) process.pfNoMuon = cms.EDProducer("CandPtrProjector", src=cms.InputTag("packedPFCandidates"), veto=cms.InputTag("selectedMuons")) process.pfNoElectrons = cms.EDProducer( "CandPtrProjector", src=cms.InputTag("pfNoMuon"), veto=cms.InputTag("selectedElectrons")) process.packedGenParticlesForJetsNoNu = cms.EDFilter( "CandPtrSelector", src=cms.InputTag("packedGenParticles"), cut=cms.string( "abs(pdgId) != 12 && abs(pdgId) != 14 && abs(pdgId) != 16")) process.ak4GenJetsNoNu = ak4GenJets.clone( src='packedGenParticlesForJetsNoNu') if options.usePFchs: if options.useTopProjections: process.ak4PFJets = ak4PFJets.clone(src='pfNoElectronsCHS', doAreaFastjet=True) else: process.ak4PFJets = ak4PFJets.clone(src='pfCHS', doAreaFastjet=True) else: if options.useTopProjections: process.ak4PFJets = ak4PFJets.clone(src='pfNoElectrons', doAreaFastjet=True) else: process.ak4PFJets = ak4PFJets.clone(src='packedPFCandidates', doAreaFastjet=True)
genParticleCollection = 'prunedGenParticles' genJetInputParticleCollection = 'packedGenParticles' ## producing a subset of particles to be used for jet clustering from RecoJets.Configuration.GenJetParticles_cff import genParticlesForJetsNoNu process.genParticlesForJetsNoNu = genParticlesForJetsNoNu.clone( src=genJetInputParticleCollection) # Supplies PDG ID to real name resolution of MC particles process.load("SimGeneral.HepPDTESSource.pythiapdt_cfi") # Producing own jets for testing purposes from RecoJets.JetProducers.ak4GenJets_cfi import ak4GenJets process.ak4GenJetsCustom = ak4GenJets.clone( src='genParticlesForJetsNoNu', # src = genJetInputParticleCollection, rParam=cms.double(0.4), jetAlgorithm=cms.string("AntiKt")) # Ghost particle collection used for Hadron-Jet association # MUST use proper input particle collection from PhysicsTools.JetMCAlgos.HadronAndPartonSelector_cfi import selectedHadronsAndPartons process.selectedHadronsAndPartons = selectedHadronsAndPartons.clone( particles=genParticleCollection) # Input particle collection for matching to gen jets (partons + leptons) # MUST use use proper input jet collection: the jets to which hadrons should be associated # rParam and jetAlgorithm MUST match those used for jets to be associated with hadrons # More details on the tool: https://twiki.cern.ch/twiki/bin/view/CMSPublic/SWGuideBTagMCTools#New_jet_flavour_definition from PhysicsTools.JetMCAlgos.sequences.GenHFHadronMatching_cff import genJetFlavourPlusLeptonInfos process.genJetFlavourPlusLeptonInfos = genJetFlavourPlusLeptonInfos.clone(
process.load('RecoJets.JetProducers.QGTagger_cfi') process.QGTagger.srcJets = cms.InputTag("selectedUpdatedPatJetsDeepFlavour") process.QGTagger.jetsLabel = cms.string('QGL_AK4PFchs') process.QGTaggerSubJet = process.QGTagger.clone( srcJets=cms.InputTag("selectedUpdatedPatJetsSoftDropSubjetsDeepFlavour"), jetsLabel=cms.string('QGL_AK4PFchs'), ) process.QGTaggerAK8 = process.QGTagger.clone( srcJets=cms.InputTag("selectedUpdatedPatJetsAK8DeepFlavour"), jetsLabel=cms.string('QGL_AK4PFchs'), ) from RecoJets.JetProducers.ak4GenJets_cfi import ak4GenJets process.ak4GenJetsWithNu = ak4GenJets.clone(src='packedGenParticles') ## Filter out neutrinos from packed GenParticles process.packedGenParticlesForJetsNoNu = cms.EDFilter( "CandPtrSelector", src=cms.InputTag("packedGenParticles"), cut=cms.string("abs(pdgId) != 12 && abs(pdgId) != 14 && abs(pdgId) != 16")) ## Define GenJets process.ak4GenJetsRecluster = ak4GenJets.clone( src='packedGenParticlesForJetsNoNu') process.patGenJetMatchWithNu = cms.EDProducer( "GenJetMatcher", # cut on deltaR; pick best by deltaR src=cms.InputTag("selectedUpdatedPatJetsDeepFlavour" ), # RECO jets (any View<Jet> is ok)
def addFlashggPFCHS0(process): print "JET PRODUCER :: Flashgg PFCHS producer ::" # leptons to remove as per default CHS workflow # select the isolated leptons : electrons + muons process.selectedMuons = cms.EDFilter("CandPtrSelector", src = cms.InputTag("slimmedMuons"), cut = cms.string('''abs(eta)<2.5 && pt>10. && (pfIsolationR04().sumChargedHadronPt+ max(0.,pfIsolationR04().sumNeutralHadronEt+ pfIsolationR04().sumPhotonEt- 0.50*pfIsolationR04().sumPUPt))/pt < 0.20 && (isPFMuon && (isGlobalMuon || isTrackerMuon) )''')) process.selectedElectrons = cms.EDFilter("CandPtrSelector", src = cms.InputTag("slimmedElectrons"), cut = cms.string('''abs(eta)<2.5 && pt>20. && gsfTrack.isAvailable() && gsfTrack.hitPattern().numberOfLostHits(\'MISSING_INNER_HITS\') < 2 && (pfIsolationVariables().sumChargedHadronPt+ max(0.,pfIsolationVariables().sumNeutralHadronEt+ pfIsolationVariables().sumPhotonEt- 0.5*pfIsolationVariables().sumPUPt))/pt < 0.15''')) # Simple producer which just removes the Candidates which # don't come from the legacy vertex according to the Flashgg Vertex Map process.flashggCHSLegacyVertexCandidates = cms.EDProducer('FlashggCHSLegacyVertexCandidateProducer', PFCandidatesTag = cms.untracked.InputTag('packedPFCandidates'), DiPhotonTag = cms.untracked.InputTag('flashggDiPhotons'), VertexCandidateMapTag = cms.InputTag("flashggVertexMapForCHS"), VertexTag = cms.untracked.InputTag('offlineSlimmedPrimaryVertices') ) process.pfCHS0 = cms.EDFilter("CandPtrSelector", src = cms.InputTag("flashggCHSLegacyVertexCandidates"), cut = cms.string("")) # then remove the previously selected muons process.pfNoMuonCHS0 = cms.EDProducer("CandPtrProjector", src = cms.InputTag("pfCHS0"), veto = cms.InputTag("selectedMuons")) # then remove the previously selected electrons process.pfNoElectronsCHS0 = cms.EDProducer("CandPtrProjector", src = cms.InputTag("pfNoMuonCHS0"), veto = cms.InputTag("selectedElectrons")) #Import RECO jet producer for ak4 PF and GEN jet from RecoJets.JetProducers.ak4PFJets_cfi import ak4PFJets from RecoJets.JetProducers.ak4GenJets_cfi import ak4GenJets process.ak4PFJetsCHS0 = ak4PFJets.clone ( src = 'pfNoElectronsCHS0', doAreaFastjet = True) process.ak4GenJets = ak4GenJets.clone( src = 'packedGenParticles') # NOTE : these line are from the new Jet recipe # The following is make patJets, but EI is done with the above process.load("Configuration.StandardSequences.MagneticField_cff") process.load("Configuration.Geometry.GeometryRecoDB_cff") process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff") # cluster the jets # NOTE: this is the 74X recipe for the jet clustering addJetCollection( process, labelName = 'AK4PFCHS0', jetSource = cms.InputTag('ak4PFJetsCHS0'), pvSource = cms.InputTag('offlineSlimmedPrimaryVertices'), pfCandidates = cms.InputTag('packedPFCandidates'), svSource = cms.InputTag('slimmedSecondaryVertices'), btagDiscriminators = [ flashggBTag ], jetCorrections = ('AK4PFchs', ['L1FastJet', 'L2Relative', 'L3Absolute'], 'None'), genJetCollection = cms.InputTag('ak4GenJets0'), genParticles = cms.InputTag('prunedGenParticles'), # jet param algo = 'AK', rParam = 0.4 ) # adjust MC matching process.patJetGenJetMatchAK4PFCHS0.matched = "ak4GenJetsLeg" process.patJetPartonMatchAK4PFCHS0.matched = "prunedGenParticles" #process.patJetPartons.particles = "prunedGenParticles" #adjust PV used for Jet Corrections process.patJetCorrFactorsAK4PFCHS0.primaryVertices = "offlineSlimmedPrimaryVertices"
def initialize(isMC=True): process = cms.Process("EX") process.source = cms.Source( "PoolSource", #fileNames = cms.untracked.vstring('root://xrootd.unl.edu//store/mc/RunIISpring15MiniAODv2/WprimeToWhToWlephbb_narrow_M-1200_13TeV-madgraph/MINIAODSIM/Asympt50ns_74X_mcRun2_asymptotic50ns_v0-v1/30000/6248D38C-8D76-E511-B243-20CF305B058C.root') #fileNames = cms.untracked.vstring('root://xrootd.unl.edu//store/mc/RunIISpring15MiniAODv2/WprimeToWhToWlephbb_narrow_M-4000_13TeV-madgraph/MINIAODSIM/74X_mcRun2_asymptotic_v2-v1/60000/E4EB03F2-4170-E511-B5C4-00259073E466.root') fileNames=cms.untracked.vstring( 'root://xrootd.unl.edu//store/mc/RunIISpring15MiniAODv2/WprimeToMuNu_M-3000_TuneCUETP8M1_13TeV-pythia8/MINIAODSIM/74X_mcRun2_asymptotic_v2-v1/60000/10EFFE5D-4374-E511-905E-003048F0113E.root' )) process.maxEvents = cms.untracked.PSet(input=cms.untracked.int32(100)) # process.met = cms.EDFilter("PtMinCandViewSelector", # src = cms.InputTag("slimmedMETs"), # ptMin = cms.double(150), # ) # process.metFilter = cms.EDFilter("CandViewCountFilter", # src = cms.InputTag("met"), # minNumber = cms.uint32(1), # filter = cms.bool(True) # ) # process.metPath = cms.Path( # process.met # *process.metFilter # ) # process.EventSelection = cms.PSet( # SelectEvents = cms.untracked.PSet( # SelectEvents = cms.vstring( # 'metPath') # ) # ) process.OUT = cms.OutputModule( "PoolOutputModule", # process.EventSelection, fileName=cms.untracked.string('test.root'), outputCommands=cms.untracked.vstring(['drop *'])) process.endpath = cms.EndPath(process.OUT) # Let CMSSW take care of scheduling process.options = cms.untracked.PSet( wantSummary=cms.untracked.bool(True), allowUnscheduled=cms.untracked.bool(True)) skip_ca15 = False ######################################## # Boosted Substructure ######################################## # Select candidates that would pass CHS requirements process.chs = cms.EDFilter("CandPtrSelector", src=cms.InputTag("packedPFCandidates"), cut=cms.string("fromPV")) # Apply pruning to AK R=0.8 jets process.ak08PFPrunedJetsCHS = cms.EDProducer( "FastjetJetProducer", PFJetParameters, AnomalousCellParameters, jetAlgorithm=cms.string("AntiKt"), rParam=cms.double(0.8), usePruning=cms.bool(True), nFilt=cms.int32(2), zcut=cms.double(0.1), rcut_factor=cms.double(0.5), useExplicitGhosts=cms.bool(True), writeCompound=cms.bool(True), # Also write subjets for pruned fj jetCollInstanceName=cms.string("SubJets")) process.ak08PFPrunedJetsCHS.src = cms.InputTag("chs") process.ak08PFPrunedJetsCHS.jetPtMin = cms.double(200.) if isMC: process.OUT.outputCommands.append("keep *_slimmedJetsAK8_*_PAT") else: process.OUT.outputCommands.append("keep *_slimmedJetsAK8_*_RECO") process.OUT.outputCommands.append("keep *_ak08PFPrunedJetsCHS_*_EX") if not skip_ca15: # CA, R=1.5, pT > 200 GeV process.ca15PFJetsCHS = cms.EDProducer( "FastjetJetProducer", PFJetParameters, AnomalousCellParameters, jetAlgorithm=cms.string("CambridgeAachen"), rParam=cms.double(1.5)) process.ca15PFJetsCHS.src = cms.InputTag("chs") process.ca15PFJetsCHS.jetPtMin = cms.double(200.) # Calculate tau1, tau2 and tau3 for ungroomed CA R=1.5 jets process.ca15PFJetsCHSNSubjettiness = cms.EDProducer( "NjettinessAdder", src=cms.InputTag("ca15PFJetsCHS"), cone=cms.double(1.5), Njets=cms.vuint32(1, 2, 3), # variables for measure definition : measureDefinition=cms.uint32( 0), # CMS default is normalized measure beta=cms.double(1.0), # CMS default is 1 R0=cms.double(1.5), # CMS default is jet cone size Rcutoff=cms.double(-999.0), # not used by default # variables for axes definition : axesDefinition=cms.uint32(6), # CMS default is 1-pass KT axes nPass=cms.int32(-999), # not used by default akAxesR0=cms.double(-999.0) # not used by default ) # Apply pruning to CA R=1.5 jets process.ca15PFPrunedJetsCHS = process.ca15PFJetsCHS.clone( usePruning=cms.bool(True), nFilt=cms.int32(2), zcut=cms.double(0.1), rcut_factor=cms.double(0.5), useExplicitGhosts=cms.bool(True), writeCompound=cms.bool(True), # Also write subjets for pruned fj jetCollInstanceName=cms.string("SubJets"), ) # Apply softdrop to CA R=1.5 jets process.ca15PFSoftdropJetsCHS = process.ca15PFJetsCHS.clone( useSoftDrop=cms.bool(True), zcut=cms.double(0.1), beta=cms.double(0.0), R0=cms.double(1.5), useExplicitGhosts=cms.bool(True)) # Apply softdrop z=0.2, beta=1 to CA R=1.5 jets process.ca15PFSoftdropZ2B1JetsCHS = process.ca15PFJetsCHS.clone( useSoftDrop=cms.bool(True), zcut=cms.double(0.2), beta=cms.double(1.), R0=cms.double(1.5), useExplicitGhosts=cms.bool(True)) # Apply trimming to CA R=1.5 jets process.ca15PFTrimmedJetsCHS = process.ca15PFJetsCHS.clone( useTrimming=cms.bool(True), rFilt=cms.double(0.2), trimPtFracMin=cms.double(0.06), useExplicitGhosts=cms.bool(True)) # Calculate tau1, tau2 and tau3 for softdrop (z=0.2, beta=1) CA R=1.5 jets process.ca15PFSoftdropZ2B1JetsCHSNSubjettiness = cms.EDProducer( "NjettinessAdder", src=cms.InputTag("ca15PFSoftdropZ2B1JetsCHS"), cone=cms.double(1.5), Njets=cms.vuint32(1, 2, 3), # variables for measure definition : measureDefinition=cms.uint32( 0), # CMS default is normalized measure beta=cms.double(1.0), # CMS default is 1 R0=cms.double(1.5), # CMS default is jet cone size Rcutoff=cms.double(-999.0), # not used by default # variables for axes definition : axesDefinition=cms.uint32(6), # CMS default is 1-pass KT axes nPass=cms.int32(-999), # not used by default akAxesR0=cms.double(-999.0) # not used by default ) # HEPTopTagger (MultiR) process.looseOptRHTT = cms.EDProducer( "HTTTopJetProducer", PFJetParameters, AnomalousCellParameters, jetCollInstanceName=cms.string("SubJets"), useExplicitGhosts=cms.bool(True), writeCompound=cms.bool(True), optimalR=cms.bool(True), algorithm=cms.int32(1), jetAlgorithm=cms.string("CambridgeAachen"), rParam=cms.double(1.5), mode=cms.int32(4), minFatjetPt=cms.double(200.), minCandPt=cms.double(200.), minSubjetPt=cms.double(30.), minCandMass=cms.double(0.), maxCandMass=cms.double(1000), massRatioWidth=cms.double(100.), minM23Cut=cms.double(0.), minM13Cut=cms.double(0.), maxM13Cut=cms.double(2.)) process.looseOptRHTT.src = cms.InputTag("chs") process.looseOptRHTT.jetPtMin = cms.double(200.) process.OUT.outputCommands.append("keep *_ca15PFJetsCHS_*_EX") process.OUT.outputCommands.append("keep *_ca15PFPrunedJetsCHS_*_EX") process.OUT.outputCommands.append("keep *_ca15PFSoftdropJetsCHS_*_EX") process.OUT.outputCommands.append( "keep *_ca15PFSoftdropZ2B1JetsCHS_*_EX") process.OUT.outputCommands.append("keep *_ca15PFTrimmedJetsCHS_*_EX") process.OUT.outputCommands.append( "keep *_ca15PFJetsCHSNSubjettiness_*_EX") process.OUT.outputCommands.append( "keep *_ca15PFSoftdropZ2B1JetsCHSNSubjettiness_*_EX") process.OUT.outputCommands.append("keep *_looseOptRHTT_*_EX") ######################################## # Hbb Tagging ######################################## process.load("Configuration.StandardSequences.MagneticField_cff") process.load('Configuration.Geometry.GeometryRecoDB_cff') process.load("RecoBTag.Configuration.RecoBTag_cff" ) # this loads all available b-taggers process.load( "Configuration.StandardSequences.FrontierConditions_GlobalTag_cff") from Configuration.AlCa.GlobalTag import GlobalTag process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:run2_mc') for fatjet_name in ["slimmedJetsAK8", "ca15PFJetsCHS"]: if skip_ca15 and (fatjet_name in ["ca15PFJetsCHS"]): continue if fatjet_name == "slimmedJetsAK8": delta_r = 0.8 maxSVDeltaRToJet = 0.7 weightFile = 'RecoBTag/SecondaryVertex/data/BoostedDoubleSV_AK8_BDT_v2.weights.xml.gz' jetAlgo = "AntiKt" elif fatjet_name == "ca15PFJetsCHS": delta_r = 1.5 maxSVDeltaRToJet = 1.3 weightFile = 'RecoBTag/SecondaryVertex/data/BoostedDoubleSV_CA15_BDT_v2.weights.xml.gz' jetAlgo = "CambridgeAachen" else: print "Invalid fatjet for b-tagging: ", fatjet_name sys.exit() # Define the module names impact_info_name = fatjet_name + "ImpactParameterTagInfos" isv_info_name = fatjet_name + "pfInclusiveSecondaryVertexFinderTagInfos" sm_info_name = fatjet_name + "softPFMuonsTagInfos" se_info_name = fatjet_name + "softPFElectronsTagInfos" bb_comp_name = fatjet_name + "candidateBoostedDoubleSecondaryVertexComputer" tag_name = fatjet_name + "pfBoostedDoubleSecondaryVertexBJetTags" # Setup the modules # IMPACT PARAMETER setattr( process, impact_info_name, process.pfImpactParameterTagInfos.clone( primaryVertex=cms.InputTag("offlineSlimmedPrimaryVertices"), candidates=cms.InputTag("packedPFCandidates"), computeProbabilities=cms.bool(False), computeGhostTrack=cms.bool(False), maxDeltaR=cms.double(delta_r), jets=cms.InputTag(fatjet_name), )) getattr(process, impact_info_name).explicitJTA = cms.bool(False) # ISV setattr( process, isv_info_name, process.pfInclusiveSecondaryVertexFinderTagInfos.clone( extSVCollection=cms.InputTag('slimmedSecondaryVertices'), trackIPTagInfos=cms.InputTag(impact_info_name), )) getattr(process, isv_info_name).useSVClustering = cms.bool(False) getattr(process, isv_info_name).rParam = cms.double(delta_r) getattr(process, isv_info_name).extSVDeltaRToJet = cms.double(delta_r) getattr( process, isv_info_name).trackSelection.jetDeltaRMax = cms.double(delta_r) getattr( process, isv_info_name).vertexCuts.maxDeltaRToJetAxis = cms.double(delta_r) getattr(process, isv_info_name).jetAlgorithm = cms.string(jetAlgo) # DOUBLE B COMPUTER setattr( process, bb_comp_name, cms.ESProducer( "CandidateBoostedDoubleSecondaryVertexESProducer", trackSelectionBlock, beta=cms.double(1.0), R0=cms.double(delta_r), maxSVDeltaRToJet=cms.double(maxSVDeltaRToJet), useCondDB=cms.bool(False), weightFile=cms.FileInPath(weightFile), useGBRForest=cms.bool(True), useAdaBoost=cms.bool(False), trackPairV0Filter=cms.PSet(k0sMassWindow=cms.double(0.03)))) getattr(process, bb_comp_name).trackSelection.jetDeltaRMax = cms.double(delta_r) # TAGS setattr( process, tag_name, cms.EDProducer("JetTagProducer", jetTagComputer=cms.string(bb_comp_name), tagInfos=cms.VInputTag( cms.InputTag(impact_info_name), cms.InputTag(isv_info_name)))) # SOFT MUON setattr( process, sm_info_name, softPFMuonsTagInfos.clone( jets=cms.InputTag(fatjet_name), muons=cms.InputTag("slimmedMuons"), primaryVertex=cms.InputTag("offlineSlimmedPrimaryVertices"))) # SOFT ELECTRON setattr( process, se_info_name, softPFElectronsTagInfos.clone( jets=cms.InputTag(fatjet_name), electrons=cms.InputTag("slimmedElectrons"), primaryVertex=cms.InputTag("offlineSlimmedPrimaryVertices"), DeltaRElectronJet=cms.double(delta_r), )) # Produce the output for object_name in [ impact_info_name, isv_info_name, sm_info_name, se_info_name, bb_comp_name, tag_name ]: process.OUT.outputCommands.append( "keep *_{0}_*_EX".format(object_name)) ######################################## # Subjet b-tagging ######################################## for fatjet_name in [ "ak08PFPrunedJetsCHS", "ca15PFPrunedJetsCHS", "looseOptRHTT" ]: if skip_ca15 and (fatjet_name in ["ca15PFPrunedJetsCHS", "looseOptRHTT"]): continue if fatjet_name == "ak08PFPrunedJetsCHS": delta_r = 0.8 jetAlgo = "AntiKt" elif fatjet_name == "ca15PFPrunedJetsCHS": delta_r = 1.5 jetAlgo = "CambridgeAachen" elif fatjet_name == "looseOptRHTT": delta_r = 1.5 jetAlgo = "CambridgeAachen" else: print "Invalid fatjet for subjet b-tagging: ", fatjet_name sys.exit() # Define the module names impact_info_name = fatjet_name + "ImpactParameterTagInfos" isv_info_name = fatjet_name + "pfInclusiveSecondaryVertexFinderTagInfos" csvv2_computer_name = fatjet_name + "combinedSecondaryVertexV2Computer" csvv2ivf_name = fatjet_name + "pfCombinedInclusiveSecondaryVertexV2BJetTags" # Setup the modules # IMPACT PARAMETER setattr( process, impact_info_name, process.pfImpactParameterTagInfos.clone( primaryVertex=cms.InputTag("offlineSlimmedPrimaryVertices"), candidates=cms.InputTag("packedPFCandidates"), computeProbabilities=cms.bool(False), computeGhostTrack=cms.bool(False), maxDeltaR=cms.double(delta_r), jets=cms.InputTag(fatjet_name, "SubJets"), )) getattr(process, impact_info_name).explicitJTA = cms.bool(True) # ISV setattr( process, isv_info_name, process.pfInclusiveSecondaryVertexFinderTagInfos.clone( extSVCollection=cms.InputTag('slimmedSecondaryVertices'), trackIPTagInfos=cms.InputTag(impact_info_name), )) getattr(process, isv_info_name).useSVClustering = cms.bool(True) getattr(process, isv_info_name).rParam = cms.double(delta_r) getattr(process, isv_info_name).extSVDeltaRToJet = cms.double(delta_r) getattr( process, isv_info_name).trackSelection.jetDeltaRMax = cms.double(delta_r) getattr( process, isv_info_name).vertexCuts.maxDeltaRToJetAxis = cms.double(delta_r) getattr(process, isv_info_name).jetAlgorithm = cms.string(jetAlgo) getattr(process, isv_info_name).fatJets = cms.InputTag( fatjet_name.replace("ak08PFPrunedJetsCHS", "slimmedJetsAK8").replace( "looseOptRHTT", "ca15PFJetsCHS")) getattr(process, isv_info_name).groomedFatJets = cms.InputTag(fatjet_name) # CSV V2 COMPUTER setattr(process, csvv2_computer_name, process.candidateCombinedSecondaryVertexV2Computer.clone()) # CSV IVF V2 setattr( process, csvv2ivf_name, process.pfCombinedInclusiveSecondaryVertexV2BJetTags.clone( tagInfos=cms.VInputTag(cms.InputTag(impact_info_name), cms.InputTag(isv_info_name)), jetTagComputer=cms.string(csvv2_computer_name, ))) # Produce the output process.OUT.outputCommands.append( "keep *_{0}_*_EX".format(csvv2ivf_name)) ### ### GenHFHadronMatcher ### if isMC: process.load("SimGeneral.HepPDTESSource.pythiapdt_cfi") genParticleCollection = 'prunedGenParticles' genJetCollection = "slimmedGenJets" genJetInputParticleCollection = 'packedGenParticles' from RecoJets.JetProducers.ak4GenJets_cfi import ak4GenJets process.ak8GenJetsCustom = ak4GenJets.clone( src=genJetInputParticleCollection, rParam=cms.double(0.8), jetAlgorithm=cms.string("AntiKt")) # genJetAK08Collection = "ak8GenJetsCustom" # Ghost particle collection used for Hadron-Jet association # MUST use proper input particle collection from PhysicsTools.JetMCAlgos.HadronAndPartonSelector_cfi import selectedHadronsAndPartons process.selectedHadronsAndPartons = selectedHadronsAndPartons.clone( particles=genParticleCollection) # Input particle collection for matching to gen jets (partons + leptons) # MUST use use proper input jet collection: the jets to which hadrons should be associated # rParam and jetAlgorithm MUST match those used for jets to be associated with hadrons # More details on the tool: https://twiki.cern.ch/twiki/bin/view/CMSPublic/SWGuideBTagMCTools#New_jet_flavour_definition from PhysicsTools.JetMCAlgos.sequences.GenHFHadronMatching_cff import genJetFlavourPlusLeptonInfos process.genJetFlavourPlusLeptonInfos = genJetFlavourPlusLeptonInfos.clone( jets=genJetCollection, rParam=cms.double(0.4), jetAlgorithm=cms.string("AntiKt")) # Plugin for analysing B hadrons # MUST use the same particle collection as in selectedHadronsAndPartons from PhysicsTools.JetMCAlgos.sequences.GenHFHadronMatching_cff import matchGenBHadron process.matchGenBHadron = matchGenBHadron.clone( genParticles=genParticleCollection) # Plugin for analysing C hadrons # MUST use the same particle collection as in selectedHadronsAndPartons from PhysicsTools.JetMCAlgos.sequences.GenHFHadronMatching_cff import matchGenCHadron process.matchGenCHadron = matchGenCHadron.clone( genParticles=genParticleCollection) process.OUT.outputCommands.append("keep *_matchGenBHadron__EX") process.OUT.outputCommands.append("keep *_matchGenCHadron__EX") process.OUT.outputCommands.append("keep *_matchGenBHadron_*_EX") process.OUT.outputCommands.append("keep *_matchGenCHadron_*_EX") process.OUT.outputCommands.append("keep *_ak8GenJetsCustom_*_EX") #Schedule to run soft muon and electron taggers on miniAOD process.softPFElectronsTagInfos.jets = cms.InputTag("slimmedJets") process.softPFElectronsTagInfos.electrons = cms.InputTag( "slimmedElectrons") process.softPFElectronsTagInfos.primaryVertex = cms.InputTag( "offlineSlimmedPrimaryVertices") process.softPFMuonsTagInfos.jets = cms.InputTag("slimmedJets") process.softPFMuonsTagInfos.muons = cms.InputTag("slimmedMuons") process.softPFMuonsTagInfos.primaryVertex = cms.InputTag( "offlineSlimmedPrimaryVertices") process.OUT.outputCommands.append("keep *_softPFElectronsTagInfos_*_*") process.OUT.outputCommands.append("keep *_softPFMuonsTagInfos_*_*") process.OUT.outputCommands.append("keep *_softPFElectronBJetTags_*_EX") process.OUT.outputCommands.append("keep *_softPFMuonBJetTags_*_EX") ######################################## # Generator level hadronic tau decays ######################################## if isMC: process.load("PhysicsTools.JetMCAlgos.TauGenJets_cfi") process.tauGenJets.GenParticles = cms.InputTag('prunedGenParticles') process.load( "PhysicsTools.JetMCAlgos.TauGenJetsDecayModeSelectorAllHadrons_cfi" ) process.OUT.outputCommands.append( "keep *_tauGenJetsSelectorAllHadrons_*_EX") return process
def load_PUPPIJet_sequence(proc, seq_name, rParam): puppi_seq = cms.Sequence() for r in rParam: if r==0.4: ak4GenJets.src = 'packedGenParticles' setattr(proc,"ak4GenJets",ak4GenJets) # Select candidates that would pass CHS requirements #AK4PFchs = cms.EDFilter("CandPtrSelector", src = cms.InputTag("packedPFCandidates"), cut = cms.string("fromPV")) #setattr(proc,"ak4PFchsJets",AK4PFchs) #AK4PUPPI = ak4PFJets.clone(src = 'packedPFCandidates') ak4PUPPI = ak4PFJets.clone(src = 'particleFlowPUPPI') setattr(proc,"ak4PUPPI",ak4PUPPI) puppi_seq = cms.Sequence(puppi_seq*ak4GenJets*ak4PUPPI) addJetCollection( proc, labelName = 'AK4PUPPIJets', jetSource = cms.InputTag('ak4PUPPI'), algo = 'ak4', rParam = 0.4, jetCorrections = None, trackSource = cms.InputTag('unpackedTracksAndVertices'), pvSource = cms.InputTag('unpackedTracksAndVertices'), #btagDiscriminators = ['combinedSecondaryVertexBJetTags'], ) for module in [proc.patJetsAK4PUPPIJets]: module.addJetCharge = False module.addBTagInfo = False module.getJetMCFlavour = False module.addAssociatedTracks = False for module in [proc.patJetPartonMatchAK4PUPPIJets]: module.matched='prunedGenParticles' elif r==0.8: ak8GenJets = ak4GenJets.clone(rParam=0.8) ak8GenJets.src = 'packedGenParticles' setattr(proc,"ak8GenJets",ak8GenJets) # Select candidates that would pass CHS requirements #AK8PFchs = cms.EDFilter("CandPtrSelector", src = cms.InputTag("packedPFCandidates"), cut = cms.string("fromPV")) #setattr(proc,"ak8PFchsJets",AK8PFchs) #AK8PUPPI = ak4PFJets.clone(src = 'packedPFCandidates', rParam = 0.8) ak8PUPPI = ak4PFJets.clone(src = 'particleFlowPUPPI', rParam = 0.8) setattr(proc,"ak8PUPPI",ak8PUPPI) puppi_seq = cms.Sequence(puppi_seq*ak8GenJets*ak8PUPPI) addJetCollection( proc, labelName = 'AK8PUPPIJets', jetSource = cms.InputTag('ak8PUPPI'), algo = 'ak8', rParam = 0.8, jetCorrections = None, trackSource = cms.InputTag('unpackedTracksAndVertices'), pvSource = cms.InputTag('unpackedTracksAndVertices'), #btagDiscriminators = ['combinedSecondaryVertexBJetTags'], ) for module in [proc.patJetsAK8PUPPIJets]: module.addJetCharge = False module.addBTagInfo = False module.getJetMCFlavour = False module.addAssociatedTracks = False for module in [proc.patJetPartonMatchAK8PUPPIJets]: module.matched='prunedGenParticles' setattr(proc, seq_name, puppi_seq)
ignoreParticleIDs=cms.vuint32(1000022, 1000012, 1000014, 1000016, 2000012, 2000014, 2000016, 1000039, 5100039, 4000012, 4000014, 4000016, 9900012, 9900014, 9900016, 39, 12, 14, 16), partonicFinalState=cms.bool(False), excludeResonances=cms.bool(False), excludeFromResonancePids=cms.vuint32(12, 13, 14, 16), tausAsJets=cms.bool(False))) genJetInputParticleCollection = 'myGenParticlesForJets' from RecoJets.JetProducers.ak4GenJets_cfi import ak4GenJets process.ak4GenJetsReproduced = ak4GenJets.clone( src=genJetInputParticleCollection, rParam=cms.double(0.4), jetAlgorithm=cms.string("AntiKt")) process.GenParticleWithoutChargedLeptonFromTop = cms.EDProducer( 'GenParticleTopOriginChargedleptonFilter', PackedGenParticle=cms.InputTag("packedGenParticles"), PrunedGenParticle=cms.InputTag("prunedGenParticles")) process.myGenParticlesWithChargedLeptonFromTopForJet = process.myGenParticlesForJets.clone( src=cms.InputTag("GenParticleWithoutChargedLeptonFromTop", "TopOriginChargedleptonFilteredGenParticle", "")) process.ak4GenJetsWithChargedLepFromTop = ak4GenJets.clone( src=cms.InputTag('myGenParticlesWithChargedLeptonFromTopForJet'), rParam=cms.double(0.4), jetAlgorithm=cms.string("AntiKt"))
# Setting input particle collections to be used by the tools genJetCollection = 'ak4GenJetsCustom' genParticleCollection = 'prunedGenParticles' genJetInputParticleCollection = 'packedGenParticles' ## producing a subset of particles to be used for jet clustering from RecoJets.Configuration.GenJetParticles_cff import genParticlesForJetsNoNu genParticlesForJetsNoNu = genParticlesForJetsNoNu.clone( src = genJetInputParticleCollection ) # Producing own jets for testing purposes from RecoJets.JetProducers.ak4GenJets_cfi import ak4GenJets ak4GenJetsCustom = ak4GenJets.clone( src = 'genParticlesForJetsNoNu', rParam = cms.double(0.4), jetAlgorithm = cms.string("AntiKt"), # jetPtMin = 20. ) # Ghost particle collection used for Hadron-Jet association # MUST use proper input particle collection from PhysicsTools.JetMCAlgos.HadronAndPartonSelector_cfi import selectedHadronsAndPartons selectedHadronsAndPartons = selectedHadronsAndPartons.clone( particles = genParticleCollection ) # Input particle collection for matching to gen jets (partons + leptons) # MUST use use proper input jet collection: the jets to which hadrons should be associated # rParam and jetAlgorithm MUST match those used for jets to be associated with hadrons # More details on the tool: https://twiki.cern.ch/twiki/bin/view/CMSPublic/SWGuideBTagMCTools#New_jet_flavour_definition from PhysicsTools.JetMCAlgos.sequences.GenHFHadronMatching_cff import genJetFlavourPlusLeptonInfos
jetCollInstanceName = cms.string("SubJets") ) akSoftDrop4HIGenJets = cms.EDProducer( "SoftDropJetProducer", GenJetParameters, AnomalousCellParameters, jetAlgorithm = cms.string("AntiKt"), rParam = cms.double(0.4), zcut = cms.double(0.1), beta = cms.double(0.0), R0 = cms.double(0.4), useOnlyCharged = cms.bool(False), useExplicitGhosts = cms.bool(True), writeCompound = cms.bool(True), jetCollInstanceName = cms.string("SubJets") ) akSoftDropZ05B154GenJets = akSoftDrop4GenJets.clone( zcut = cms.double(0.5), beta = cms.double(1.5)) akSoftDropZ05B154HIGenJets = akSoftDrop4HIGenJets.clone( zcut = cms.double(0.5), beta = cms.double(1.5)) # cloning jets for other radii ak1GenJets = ak4GenJets.clone(rParam = 0.1) ak2GenJets = ak4GenJets.clone(rParam = 0.2) ak3GenJets = ak4GenJets.clone(rParam = 0.3) ak5GenJets = ak4GenJets.clone(rParam = 0.5) ak6GenJets = ak4GenJets.clone(rParam = 0.6)
genParticlesMerged = cms.EDProducer( "MergedGenParticleProducer", inputPruned=cms.InputTag("prunedGenParticles"), inputPacked=cms.InputTag("packedGenParticles")) #select only stable particles (status=1) for reclustering GenJets for the matching; exclude neutrinos from RecoJets.JetProducers.ak4GenJets_cfi import ak4GenJets genParticlesForGenJets = cms.EDFilter( "CandPtrSelector", src=cms.InputTag("genParticlesMerged"), cut=cms.string( "status==1 && abs(pdgId) != 12 && abs(pdgId) != 14 && abs(pdgId) != 16 && abs(pdgId) < 1000000" )) #recluster GenJets genJetsReclustered = ak4GenJets.clone( src=cms.InputTag('genParticlesForGenJets')) ''' genXJetsReclustered = cms.EDProducer( 'XJetProducer', src = cms.InputTag('genParticlesForGenJets'), genJets = cms.InputTag("genJetsReclustered") ) ''' #TFileService = cms.Service("TFileService", fileName = cms.string("histoZ.root") ) #produce DisplacedGenVertices and match to GenJets displacedGenVertices = cms.EDProducer( "DisplacedGenVertexProducer", srcGenParticles=cms.InputTag("genParticlesMerged"), srcGenJets=cms.InputTag("genJetsReclustered"))
process.pfClusterRefsForJets_step += process.ak4PFCaloJets # ----------------------- Jet Tool Box ----------------- # ----- giulia test: do not recluster ak4 and ca8 jets to save time -------- # ##Load the toolBoxMiniHelper # #from RecoJets.JetProducers.jettoolboxMiniHelper_cff import * # ##for some reason doesn't work ?__? # ## just copy&paste the cff here process.chs = cms.EDFilter('CandPtrSelector', src = cms.InputTag('packedPFCandidates'), cut = cms.string('fromPV')) from RecoJets.JetProducers.ak4GenJets_cfi import ak4GenJets process.slimmedGenJetsAK8 = ak4GenJets.clone(src = 'packedGenParticles', rParam = 0.8) # process.ak4PFJets.src = 'packedPFCandidates' # process.ak4PFJets.doAreaFastjet = True # process.ak4PFJetsCHS = process.ak4PFJetsCHS.clone(src = 'chs', doAreaFastjet = True) #boh ? # process.ak8PFJetsCHS = process.ak4PFJetsCHS.clone(src = 'chs', doAreaFastjet = True, rParam = 0.8) # process.ca8PFJetsCHS = process.ca4PFJets.clone(src = 'chs', doAreaFastjet = True, rParam = 0.8) # process.ak4GenJets.src = 'packedGenParticles' # process.ak8GenJets = process.ak4GenJets.clone(src = 'packedGenParticles', rParam = 0.8) # process.ca8GenJets = process.ca4GenJets.clone(src = 'packedGenParticles', rParam = 0.8) # process.fixedGridRhoFastjetAll.pfCandidatesTag = 'packedPFCandidates' # process.ak4PFJetsCHSPruned = ak5PFJetsCHSPruned.clone(
## Set input particle collections to be used by the tools genParticleCollection = '' genJetCollection = '' if options.runOnAOD: genParticleCollection = 'genParticles' genJetCollection = 'ak4GenJetsCustom' ## producing a subset of genParticles to be used for jet clustering in AOD from RecoJets.Configuration.GenJetParticles_cff import genParticlesForJetsNoNu process.genParticlesForJetsCustom = genParticlesForJetsNoNu.clone() process.task.add(process.genParticlesForJetsCustom) ## Produce own jets (re-clustering in miniAOD needed at present to avoid crash) from RecoJets.JetProducers.ak4GenJets_cfi import ak4GenJets process.ak4GenJetsCustom = ak4GenJets.clone( src = 'genParticlesForJetsCustom', rParam = cms.double(0.4), jetAlgorithm = cms.string("AntiKt") ) process.task.add(process.ak4GenJetsCustom) else: genParticleCollection = 'prunedGenParticles' genJetCollection = 'slimmedGenJets' ## Supplies PDG ID to real name resolution of MC particles process.load("SimGeneral.HepPDTESSource.pythiapdt_cfi") ## Ghost particle collection used for Hadron-Jet association # MUST use proper input particle collection from PhysicsTools.JetMCAlgos.HadronAndPartonSelector_cfi import selectedHadronsAndPartons process.selectedHadronsAndPartons = selectedHadronsAndPartons.clone(
################################################# ## After 7.4.0, only need to make AK8 gen jets. ## The rest are stored by default in MiniAOD directly. ################################################# ## Filter out neutrinos from packed GenParticles process.packedGenParticlesForJetsNoNu = cms.EDFilter("CandPtrSelector", src = cms.InputTag("packedGenParticles"), cut = cms.string("abs(pdgId) != 12 && abs(pdgId) != 14 && abs(pdgId) != 16") ) ## Fat GenJets if "MC" in options.DataProcessing: from RecoJets.JetProducers.ak4GenJets_cfi import ak4GenJets process.ak8GenJetsNoNu = ak4GenJets.clone( rParam = cms.double(0.8), src = cms.InputTag("packedGenParticlesForJetsNoNu") ) ## SoftDrop fat GenJets (two jet collections are produced, fat jets and subjets) from RecoJets.JetProducers.SubJetParameters_cfi import SubJetParameters from RecoJets.JetProducers.ak4GenJets_cfi import ak4GenJets process.ak8GenJetsNoNuSoftDrop = ak4GenJets.clone( rParam = cms.double(0.8), src = cms.InputTag("packedGenParticlesForJetsNoNu"), useSoftDrop = cms.bool(True), zcut = cms.double(0.1), beta = cms.double(0.0), R0 = cms.double(0.8), useExplicitGhosts = cms.bool(True), writeCompound = cms.bool(True), jetCollInstanceName=cms.string("SubJets")
genParticleCollection = 'prunedGenParticles' genJetInputParticleCollection = 'packedGenParticles' ## producing a subset of particles to be used for jet clustering from RecoJets.Configuration.GenJetParticles_cff import genParticlesForJetsNoNu process.genParticlesForJetsNoNu = genParticlesForJetsNoNu.clone( src = cms.InputTag(genJetInputParticleCollection) ) seq += process.genParticlesForJetsNoNu # Producing own jets for testing purposes from RecoJets.JetProducers.ak4GenJets_cfi import ak4GenJets process.ak4GenJetsCustom = ak4GenJets.clone( src = cms.InputTag("genParticlesForJetsNoNu"), # src = genJetInputParticleCollection, jetAlgorithm = cms.string("AntiKt"), rParam = cms.double(0.4) ) seq += process.ak4GenJetsCustom # Ghost particle collection used for Hadron-Jet association # MUST use proper input particle collection from PhysicsTools.JetMCAlgos.HadronAndPartonSelector_cfi import selectedHadronsAndPartons process.selectedHadronsAndPartons = selectedHadronsAndPartons.clone( particles = cms.InputTag(genParticleCollection) ) seq += process.selectedHadronsAndPartons from PhysicsTools.JetMCAlgos.AK4PFJetsMCFlavourInfos_cfi import ak4JetFlavourInfos process.genJetFlavourInfos = ak4JetFlavourInfos.clone(
### ### AK8 jets with subjet b-tagging ### ################################################# ## Make jets ################################################# ## Filter out neutrinos from packed GenParticles process.packedGenParticlesForJetsNoNu = cms.EDFilter("CandPtrSelector", src = cms.InputTag("packedGenParticles"), cut = cms.string("abs(pdgId) != 12 && abs(pdgId) != 14 && abs(pdgId) != 16")) ## Fat GenJets from RecoJets.JetProducers.ak4GenJets_cfi import ak4GenJets process.ak8GenJetsNoNu = ak4GenJets.clone( rParam = cms.double(0.8), src = cms.InputTag("packedGenParticlesForJetsNoNu") ) ## Pruned fat GenJets (two jet collections are produced, fat jets and subjets) from RecoJets.JetProducers.SubJetParameters_cfi import SubJetParameters from RecoJets.JetProducers.ak4GenJets_cfi import ak4GenJets process.ak8GenJetsNoNuPruned = ak4GenJets.clone( SubJetParameters, rParam = cms.double(0.8), src = cms.InputTag("packedGenParticlesForJetsNoNu"), usePruning = cms.bool(True), writeCompound = cms.bool(True), jetCollInstanceName=cms.string("SubJets") ) ## Select charged hadron subtracted packed PF candidates
import FWCore.ParameterSet.Config as cms from RecoJets.JetProducers.ak4GenJets_cfi import ak4GenJets ak8GenJets = ak4GenJets.clone( rParam = cms.double(0.8) ) ak8GenJetsSoftDrop = ak8GenJets.clone( useSoftDrop = cms.bool(True), zcut = cms.double(0.1), beta = cms.double(0.0), R0 = cms.double(0.8), useExplicitGhosts = cms.bool(True), writeCompound = cms.bool(True), jetCollInstanceName=cms.string("SubJets"), jetPtMin = 100.0 )
# reverseDecision = cms.bool(False) #) ##### ## For tt+X ##### # Setting input particle collections to be used by the tools genJetCollection = 'ak4GenJetsCustom' genParticleCollection = 'prunedGenParticles' genJetInputParticleCollection = 'packedGenParticles' # Supplies PDG ID to real name resolution of MC particles process.load("SimGeneral.HepPDTESSource.pythiapdt_cfi") # Producing own jets for testing purposes from RecoJets.JetProducers.ak4GenJets_cfi import ak4GenJets process.ak4GenJetsCustom = ak4GenJets.clone( src = genJetInputParticleCollection, rParam = cms.double(0.4), jetAlgorithm = cms.string("AntiKt") ) # Ghost particle collection used for Hadron-Jet association # MUST use proper input particle collection from PhysicsTools.JetMCAlgos.HadronAndPartonSelector_cfi import selectedHadronsAndPartons process.selectedHadronsAndPartons = selectedHadronsAndPartons.clone( particles = genParticleCollection ) # Input particle collection for matching to gen jets (partons + leptons) # MUST use use proper input jet collection: the jets to which hadrons should be associated # rParam and jetAlgorithm MUST match those used for jets to be associated with hadrons # More details on the tool: https://twiki.cern.ch/twiki/bin/view/CMSPublic/SWGuideBTagMCTools#New_jet_flavour_definition from PhysicsTools.JetMCAlgos.sequences.GenHFHadronMatching_cff import genJetFlavourPlusLeptonInfos process.genJetFlavourPlusLeptonInfos = genJetFlavourPlusLeptonInfos.clone( jets = genJetCollection,
#merge GenParticles for easy matching of GenJets to vertices genParticlesMerged = cms.EDProducer( "MergedGenParticleProducer", inputPruned=cms.InputTag("prunedGenParticles"), inputPacked=cms.InputTag("packedGenParticles")) #select only stable particles (status=1) for reclustering GenJets for the matching; exclude neutrinos from RecoJets.JetProducers.ak4GenJets_cfi import ak4GenJets genParticlesForGenJets = cms.EDFilter( "CandPtrSelector", src=cms.InputTag("genParticlesMerged"), cut=cms.string( "status==1 && abs(pdgId) != 12 && abs(pdgId) != 14 && abs(pdgId) != 16" )) #recluster GenJets genJetsReclustered = ak4GenJets.clone(src='genParticlesForGenJets') #produce DisplacedGenVertices and match to GenJets displacedGenVertices = cms.EDProducer( "DisplacedGenVertexProducer", srcGenParticles=cms.InputTag("genParticlesMerged"), srcGenJets=cms.InputTag("genJetsReclustered")) DisplacedGenVertexSequence = cms.Sequence(genParticlesMerged + genParticlesForGenJets + genJetsReclustered + displacedGenVertices)
veto=cms.InputTag("selectedMuons")) process.pfNoElectronsCHS = cms.EDProducer( "CandPtrProjector", src=cms.InputTag("pfNoMuonCHS"), veto=cms.InputTag("selectedElectrons")) #Import RECO jet producer for ak4 PF and GEN jet from RecoJets.JetProducers.ak4PFJets_cfi import ak4PFJets from RecoJets.JetProducers.ak4GenJets_cfi import ak4GenJets process.ak4PFJetsCHS = ak4PFJets.clone(src='pfNoElectronsCHS', doAreaFastjet=True) process.packedGenParticlesForJetsNoNu = cms.EDFilter( "CandPtrSelector", src=cms.InputTag("packedGenParticles"), cut=cms.string("abs(pdgId) != 12 && abs(pdgId) != 14 && abs(pdgId) != 16")) process.ak4GenJetsNoNu = ak4GenJets.clone(src='packedGenParticlesForJetsNoNu') # The following is make patJets, but EI is done with the above process.load("Configuration.StandardSequences.MagneticField_cff") process.load("Configuration.Geometry.GeometryRecoDB_cff") process.load( "Configuration.StandardSequences.FrontierConditions_GlobalTag_cff") from Configuration.AlCa.GlobalTag import GlobalTag process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:run2_mc') bTagDiscriminators = ['pfCombinedInclusiveSecondaryVertexV2BJetTags'] from PhysicsTools.PatAlgos.tools.jetTools import addJetCollection addJetCollection(process, labelName='AK4PFCHS', jetSource=cms.InputTag('ak4PFJetsCHS'),
def initialize(isMC=True): process = cms.Process("EX") process.source = cms.Source("PoolSource", #fileNames = cms.untracked.vstring('root://xrootd.unl.edu//store/mc/RunIISpring15MiniAODv2/WprimeToWhToWlephbb_narrow_M-1200_13TeV-madgraph/MINIAODSIM/Asympt50ns_74X_mcRun2_asymptotic50ns_v0-v1/30000/6248D38C-8D76-E511-B243-20CF305B058C.root') #fileNames = cms.untracked.vstring('root://xrootd.unl.edu//store/mc/RunIISpring15MiniAODv2/WprimeToWhToWlephbb_narrow_M-4000_13TeV-madgraph/MINIAODSIM/74X_mcRun2_asymptotic_v2-v1/60000/E4EB03F2-4170-E511-B5C4-00259073E466.root') fileNames = cms.untracked.vstring('root://xrootd.unl.edu//store/mc/RunIISpring15MiniAODv2/WprimeToMuNu_M-3000_TuneCUETP8M1_13TeV-pythia8/MINIAODSIM/74X_mcRun2_asymptotic_v2-v1/60000/10EFFE5D-4374-E511-905E-003048F0113E.root') ) process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(100) ) # process.met = cms.EDFilter("PtMinCandViewSelector", # src = cms.InputTag("slimmedMETs"), # ptMin = cms.double(150), # ) # process.metFilter = cms.EDFilter("CandViewCountFilter", # src = cms.InputTag("met"), # minNumber = cms.uint32(1), # filter = cms.bool(True) # ) # process.metPath = cms.Path( # process.met # *process.metFilter # ) # process.EventSelection = cms.PSet( # SelectEvents = cms.untracked.PSet( # SelectEvents = cms.vstring( # 'metPath') # ) # ) process.OUT = cms.OutputModule("PoolOutputModule", # process.EventSelection, fileName = cms.untracked.string('test.root'), outputCommands = cms.untracked.vstring(['drop *']) ) process.endpath= cms.EndPath(process.OUT) # Let CMSSW take care of scheduling process.options = cms.untracked.PSet( wantSummary = cms.untracked.bool(True), allowUnscheduled = cms.untracked.bool(True) ) skip_ca15 = False ######################################## # Boosted Substructure ######################################## # Select candidates that would pass CHS requirements process.chs = cms.EDFilter("CandPtrSelector", src = cms.InputTag("packedPFCandidates"), cut = cms.string("fromPV")) # Apply pruning to AK R=0.8 jets process.ak08PFPrunedJetsCHS = cms.EDProducer( "FastjetJetProducer", PFJetParameters, AnomalousCellParameters, jetAlgorithm = cms.string("AntiKt"), rParam = cms.double(0.8), usePruning = cms.bool(True), nFilt = cms.int32(2), zcut = cms.double(0.1), rcut_factor = cms.double(0.5), useExplicitGhosts = cms.bool(True), writeCompound = cms.bool(True), # Also write subjets for pruned fj jetCollInstanceName=cms.string("SubJets") ) process.ak08PFPrunedJetsCHS.src = cms.InputTag("chs") process.ak08PFPrunedJetsCHS.jetPtMin = cms.double(200.) if isMC: process.OUT.outputCommands.append("keep *_slimmedJetsAK8_*_PAT") else: process.OUT.outputCommands.append("keep *_slimmedJetsAK8_*_RECO") process.OUT.outputCommands.append("keep *_ak08PFPrunedJetsCHS_*_EX") if not skip_ca15: # CA, R=1.5, pT > 200 GeV process.ca15PFJetsCHS = cms.EDProducer( "FastjetJetProducer", PFJetParameters, AnomalousCellParameters, jetAlgorithm = cms.string("CambridgeAachen"), rParam = cms.double(1.5)) process.ca15PFJetsCHS.src = cms.InputTag("chs") process.ca15PFJetsCHS.jetPtMin = cms.double(200.) # Calculate tau1, tau2 and tau3 for ungroomed CA R=1.5 jets process.ca15PFJetsCHSNSubjettiness = cms.EDProducer("NjettinessAdder", src=cms.InputTag("ca15PFJetsCHS"), cone=cms.double(1.5), Njets = cms.vuint32(1,2,3), # variables for measure definition : measureDefinition = cms.uint32( 0 ), # CMS default is normalized measure beta = cms.double(1.0), # CMS default is 1 R0 = cms.double(1.5), # CMS default is jet cone size Rcutoff = cms.double( -999.0), # not used by default # variables for axes definition : axesDefinition = cms.uint32( 6 ), # CMS default is 1-pass KT axes nPass = cms.int32(-999), # not used by default akAxesR0 = cms.double(-999.0) # not used by default ) # Apply pruning to CA R=1.5 jets process.ca15PFPrunedJetsCHS = process.ca15PFJetsCHS.clone( usePruning = cms.bool(True), nFilt = cms.int32(2), zcut = cms.double(0.1), rcut_factor = cms.double(0.5), useExplicitGhosts = cms.bool(True), writeCompound = cms.bool(True), # Also write subjets for pruned fj jetCollInstanceName=cms.string("SubJets"), ) # Apply softdrop to CA R=1.5 jets process.ca15PFSoftdropJetsCHS = process.ca15PFJetsCHS.clone( useSoftDrop = cms.bool(True), zcut = cms.double(0.1), beta = cms.double(0.0), R0 = cms.double(1.5), useExplicitGhosts = cms.bool(True)) # Apply softdrop z=0.2, beta=1 to CA R=1.5 jets process.ca15PFSoftdropZ2B1JetsCHS = process.ca15PFJetsCHS.clone( useSoftDrop = cms.bool(True), zcut = cms.double(0.2), beta = cms.double(1.), R0 = cms.double(1.5), useExplicitGhosts = cms.bool(True)) # Apply trimming to CA R=1.5 jets process.ca15PFTrimmedJetsCHS = process.ca15PFJetsCHS.clone( useTrimming = cms.bool(True), rFilt = cms.double(0.2), trimPtFracMin = cms.double(0.06), useExplicitGhosts = cms.bool(True)) # Calculate tau1, tau2 and tau3 for softdrop (z=0.2, beta=1) CA R=1.5 jets process.ca15PFSoftdropZ2B1JetsCHSNSubjettiness = cms.EDProducer("NjettinessAdder", src=cms.InputTag("ca15PFSoftdropZ2B1JetsCHS"), cone=cms.double(1.5), Njets = cms.vuint32(1,2,3), # variables for measure definition : measureDefinition = cms.uint32( 0 ), # CMS default is normalized measure beta = cms.double(1.0), # CMS default is 1 R0 = cms.double(1.5), # CMS default is jet cone size Rcutoff = cms.double( -999.0), # not used by default # variables for axes definition : axesDefinition = cms.uint32( 6 ), # CMS default is 1-pass KT axes nPass = cms.int32(-999), # not used by default akAxesR0 = cms.double(-999.0) # not used by default ) # HEPTopTagger (MultiR) process.looseOptRHTT = cms.EDProducer( "HTTTopJetProducer", PFJetParameters, AnomalousCellParameters, jetCollInstanceName=cms.string("SubJets"), useExplicitGhosts = cms.bool(True), writeCompound = cms.bool(True), optimalR = cms.bool(True), algorithm = cms.int32(1), jetAlgorithm = cms.string("CambridgeAachen"), rParam = cms.double(1.5), mode = cms.int32(4), minFatjetPt = cms.double(200.), minCandPt = cms.double(200.), minSubjetPt = cms.double(30.), minCandMass = cms.double(0.), maxCandMass = cms.double(1000), massRatioWidth = cms.double(100.), minM23Cut = cms.double(0.), minM13Cut = cms.double(0.), maxM13Cut = cms.double(2.)) process.looseOptRHTT.src = cms.InputTag("chs") process.looseOptRHTT.jetPtMin = cms.double(200.) process.OUT.outputCommands.append("keep *_ca15PFJetsCHS_*_EX") process.OUT.outputCommands.append("keep *_ca15PFPrunedJetsCHS_*_EX") process.OUT.outputCommands.append("keep *_ca15PFSoftdropJetsCHS_*_EX") process.OUT.outputCommands.append("keep *_ca15PFSoftdropZ2B1JetsCHS_*_EX") process.OUT.outputCommands.append("keep *_ca15PFTrimmedJetsCHS_*_EX") process.OUT.outputCommands.append("keep *_ca15PFJetsCHSNSubjettiness_*_EX") process.OUT.outputCommands.append("keep *_ca15PFSoftdropZ2B1JetsCHSNSubjettiness_*_EX") process.OUT.outputCommands.append("keep *_looseOptRHTT_*_EX") ######################################## # Hbb Tagging ######################################## process.load("Configuration.StandardSequences.MagneticField_cff") process.load('Configuration.Geometry.GeometryRecoDB_cff') process.load("RecoBTag.Configuration.RecoBTag_cff") # this loads all available b-taggers process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff") from Configuration.AlCa.GlobalTag import GlobalTag process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:run2_mc') for fatjet_name in ["slimmedJetsAK8", "ca15PFJetsCHS"]: if skip_ca15 and (fatjet_name in ["ca15PFJetsCHS"]): continue if fatjet_name == "slimmedJetsAK8": delta_r = 0.8 maxSVDeltaRToJet = 0.7 weightFile = 'RecoBTag/SecondaryVertex/data/BoostedDoubleSV_AK8_BDT_v2.weights.xml.gz' jetAlgo = "AntiKt" elif fatjet_name == "ca15PFJetsCHS": delta_r = 1.5 maxSVDeltaRToJet = 1.3 weightFile = 'RecoBTag/SecondaryVertex/data/BoostedDoubleSV_CA15_BDT_v2.weights.xml.gz' jetAlgo = "CambridgeAachen" else: print "Invalid fatjet for b-tagging: ", fatjet_name sys.exit() # Define the module names impact_info_name = fatjet_name + "ImpactParameterTagInfos" isv_info_name = fatjet_name + "pfInclusiveSecondaryVertexFinderTagInfos" sm_info_name = fatjet_name + "softPFMuonsTagInfos" se_info_name = fatjet_name + "softPFElectronsTagInfos" bb_comp_name = fatjet_name + "candidateBoostedDoubleSecondaryVertexComputer" tag_name = fatjet_name + "pfBoostedDoubleSecondaryVertexBJetTags" # Setup the modules # IMPACT PARAMETER setattr(process, impact_info_name, process.pfImpactParameterTagInfos.clone( primaryVertex = cms.InputTag("offlineSlimmedPrimaryVertices"), candidates = cms.InputTag("packedPFCandidates"), computeProbabilities = cms.bool(False), computeGhostTrack = cms.bool(False), maxDeltaR = cms.double(delta_r), jets = cms.InputTag(fatjet_name), )) getattr(process, impact_info_name).explicitJTA = cms.bool(False) # ISV setattr(process, isv_info_name, process.pfInclusiveSecondaryVertexFinderTagInfos.clone( extSVCollection = cms.InputTag('slimmedSecondaryVertices'), trackIPTagInfos = cms.InputTag(impact_info_name), )) getattr(process, isv_info_name).useSVClustering = cms.bool(False) getattr(process, isv_info_name).rParam = cms.double(delta_r) getattr(process, isv_info_name).extSVDeltaRToJet = cms.double(delta_r) getattr(process, isv_info_name).trackSelection.jetDeltaRMax = cms.double(delta_r) getattr(process, isv_info_name).vertexCuts.maxDeltaRToJetAxis = cms.double(delta_r) getattr(process, isv_info_name).jetAlgorithm = cms.string(jetAlgo) # DOUBLE B COMPUTER setattr(process, bb_comp_name, cms.ESProducer("CandidateBoostedDoubleSecondaryVertexESProducer", trackSelectionBlock, beta = cms.double(1.0), R0 = cms.double(delta_r), maxSVDeltaRToJet = cms.double(maxSVDeltaRToJet), useCondDB = cms.bool(False), weightFile = cms.FileInPath(weightFile), useGBRForest = cms.bool(True), useAdaBoost = cms.bool(False), trackPairV0Filter = cms.PSet(k0sMassWindow = cms.double(0.03)) )) getattr(process, bb_comp_name).trackSelection.jetDeltaRMax = cms.double(delta_r) # TAGS setattr(process, tag_name, cms.EDProducer("JetTagProducer", jetTagComputer = cms.string(bb_comp_name), tagInfos = cms.VInputTag(cms.InputTag(impact_info_name), cms.InputTag(isv_info_name) ))) # SOFT MUON setattr(process, sm_info_name, softPFMuonsTagInfos.clone( jets = cms.InputTag(fatjet_name), muons = cms.InputTag("slimmedMuons"), primaryVertex = cms.InputTag("offlineSlimmedPrimaryVertices") )) # SOFT ELECTRON setattr(process, se_info_name, softPFElectronsTagInfos.clone( jets = cms.InputTag(fatjet_name), electrons = cms.InputTag("slimmedElectrons"), primaryVertex = cms.InputTag("offlineSlimmedPrimaryVertices"), DeltaRElectronJet=cms.double(delta_r), )) # Produce the output for object_name in [impact_info_name, isv_info_name, sm_info_name, se_info_name, bb_comp_name, tag_name]: process.OUT.outputCommands.append("keep *_{0}_*_EX".format(object_name)) ######################################## # Subjet b-tagging ######################################## for fatjet_name in ["ak08PFPrunedJetsCHS", "ca15PFPrunedJetsCHS", "looseOptRHTT"]: if skip_ca15 and (fatjet_name in ["ca15PFPrunedJetsCHS", "looseOptRHTT"]): continue if fatjet_name == "ak08PFPrunedJetsCHS": delta_r = 0.8 jetAlgo = "AntiKt" elif fatjet_name == "ca15PFPrunedJetsCHS": delta_r = 1.5 jetAlgo = "CambridgeAachen" elif fatjet_name == "looseOptRHTT": delta_r = 1.5 jetAlgo = "CambridgeAachen" else: print "Invalid fatjet for subjet b-tagging: ", fatjet_name sys.exit() # Define the module names impact_info_name = fatjet_name + "ImpactParameterTagInfos" isv_info_name = fatjet_name + "pfInclusiveSecondaryVertexFinderTagInfos" csvv2_computer_name = fatjet_name + "combinedSecondaryVertexV2Computer" csvv2ivf_name = fatjet_name + "pfCombinedInclusiveSecondaryVertexV2BJetTags" # Setup the modules # IMPACT PARAMETER setattr(process, impact_info_name, process.pfImpactParameterTagInfos.clone( primaryVertex = cms.InputTag("offlineSlimmedPrimaryVertices"), candidates = cms.InputTag("packedPFCandidates"), computeProbabilities = cms.bool(False), computeGhostTrack = cms.bool(False), maxDeltaR = cms.double(delta_r), jets = cms.InputTag(fatjet_name, "SubJets"), )) getattr(process, impact_info_name).explicitJTA = cms.bool(True) # ISV setattr(process, isv_info_name, process.pfInclusiveSecondaryVertexFinderTagInfos.clone( extSVCollection = cms.InputTag('slimmedSecondaryVertices'), trackIPTagInfos = cms.InputTag(impact_info_name), )) getattr(process, isv_info_name).useSVClustering = cms.bool(True) getattr(process, isv_info_name).rParam = cms.double(delta_r) getattr(process, isv_info_name).extSVDeltaRToJet = cms.double(delta_r) getattr(process, isv_info_name).trackSelection.jetDeltaRMax = cms.double(delta_r) getattr(process, isv_info_name).vertexCuts.maxDeltaRToJetAxis = cms.double(delta_r) getattr(process, isv_info_name).jetAlgorithm = cms.string(jetAlgo) getattr(process, isv_info_name).fatJets = cms.InputTag(fatjet_name.replace("ak08PFPrunedJetsCHS","slimmedJetsAK8").replace("looseOptRHTT","ca15PFJetsCHS")) getattr(process, isv_info_name).groomedFatJets = cms.InputTag(fatjet_name) # CSV V2 COMPUTER setattr(process, csvv2_computer_name, process.candidateCombinedSecondaryVertexV2Computer.clone()) # CSV IVF V2 setattr(process, csvv2ivf_name, process.pfCombinedInclusiveSecondaryVertexV2BJetTags.clone( tagInfos = cms.VInputTag(cms.InputTag(impact_info_name), cms.InputTag(isv_info_name)), jetTagComputer = cms.string(csvv2_computer_name,) )) # Produce the output process.OUT.outputCommands.append("keep *_{0}_*_EX".format(csvv2ivf_name)) ### ### GenHFHadronMatcher ### if isMC: process.load("SimGeneral.HepPDTESSource.pythiapdt_cfi") genParticleCollection = 'prunedGenParticles' genJetCollection = "slimmedGenJets" genJetInputParticleCollection = 'packedGenParticles' from RecoJets.JetProducers.ak4GenJets_cfi import ak4GenJets process.ak8GenJetsCustom = ak4GenJets.clone( src = genJetInputParticleCollection, rParam = cms.double(0.8), jetAlgorithm = cms.string("AntiKt") ) # genJetAK08Collection = "ak8GenJetsCustom" # Ghost particle collection used for Hadron-Jet association # MUST use proper input particle collection from PhysicsTools.JetMCAlgos.HadronAndPartonSelector_cfi import selectedHadronsAndPartons process.selectedHadronsAndPartons = selectedHadronsAndPartons.clone( particles = genParticleCollection ) # Input particle collection for matching to gen jets (partons + leptons) # MUST use use proper input jet collection: the jets to which hadrons should be associated # rParam and jetAlgorithm MUST match those used for jets to be associated with hadrons # More details on the tool: https://twiki.cern.ch/twiki/bin/view/CMSPublic/SWGuideBTagMCTools#New_jet_flavour_definition from PhysicsTools.JetMCAlgos.sequences.GenHFHadronMatching_cff import genJetFlavourPlusLeptonInfos process.genJetFlavourPlusLeptonInfos = genJetFlavourPlusLeptonInfos.clone( jets = genJetCollection, rParam = cms.double(0.4), jetAlgorithm = cms.string("AntiKt") ) # Plugin for analysing B hadrons # MUST use the same particle collection as in selectedHadronsAndPartons from PhysicsTools.JetMCAlgos.sequences.GenHFHadronMatching_cff import matchGenBHadron process.matchGenBHadron = matchGenBHadron.clone( genParticles = genParticleCollection ) # Plugin for analysing C hadrons # MUST use the same particle collection as in selectedHadronsAndPartons from PhysicsTools.JetMCAlgos.sequences.GenHFHadronMatching_cff import matchGenCHadron process.matchGenCHadron = matchGenCHadron.clone( genParticles = genParticleCollection ) process.OUT.outputCommands.append("keep *_matchGenBHadron__EX") process.OUT.outputCommands.append("keep *_matchGenCHadron__EX") process.OUT.outputCommands.append("keep *_matchGenBHadron_*_EX") process.OUT.outputCommands.append("keep *_matchGenCHadron_*_EX") process.OUT.outputCommands.append("keep *_ak8GenJetsCustom_*_EX") #Schedule to run soft muon and electron taggers on miniAOD process.softPFElectronsTagInfos.jets = cms.InputTag("slimmedJets") process.softPFElectronsTagInfos.electrons = cms.InputTag("slimmedElectrons") process.softPFElectronsTagInfos.primaryVertex = cms.InputTag("offlineSlimmedPrimaryVertices") process.softPFMuonsTagInfos.jets = cms.InputTag("slimmedJets") process.softPFMuonsTagInfos.muons = cms.InputTag("slimmedMuons") process.softPFMuonsTagInfos.primaryVertex = cms.InputTag("offlineSlimmedPrimaryVertices") process.OUT.outputCommands.append("keep *_softPFElectronsTagInfos_*_*") process.OUT.outputCommands.append("keep *_softPFMuonsTagInfos_*_*") process.OUT.outputCommands.append("keep *_softPFElectronBJetTags_*_EX") process.OUT.outputCommands.append("keep *_softPFMuonBJetTags_*_EX") ######################################## # Generator level hadronic tau decays ######################################## if isMC: process.load("PhysicsTools.JetMCAlgos.TauGenJets_cfi") process.tauGenJets.GenParticles = cms.InputTag('prunedGenParticles') process.load("PhysicsTools.JetMCAlgos.TauGenJetsDecayModeSelectorAllHadrons_cfi") process.OUT.outputCommands.append("keep *_tauGenJetsSelectorAllHadrons_*_EX") return process
import FWCore.ParameterSet.Config as cms from RecoJets.JetProducers.ak4GenJets_cfi import ak4GenJets from RecoJets.JetProducers.ak4PFJetsPuppi_cfi import ak4PFJetsPuppi from RecoJets.JetProducers.ak4PFJets_cfi import ak4PFJets #PFCHS pfCHS = cms.EDFilter("CandPtrSelector", src = cms.InputTag("packedPFCandidates"), cut = cms.string("fromPV")) # make GEN jets AK4GenJets = ak4GenJets.clone( rParam = 0.4 ) AK4GenJets.src = cms.InputTag('packedGenParticles'); AK8GenJets = ak4GenJets.clone( rParam = 0.8 ) AK8GenJets.src = cms.InputTag('packedGenParticles'); AK4PFchsJets = ak4PFJets.clone(); AK4PFchsJets.src = cms.InputTag('pfCHS','','JRA'); AK8PFchsJets = ak4PFJets.clone( rParam = 0.8 ); AK8PFchsJets.src = cms.InputTag('pfCHS','','JRA'); AK4PFJetsPuppi = ak4PFJetsPuppi.clone( ) AK4PFJetsPuppi.src = cms.InputTag('puppi','','JRA') #PFJetParameters AK8PFJetsPuppi = ak4PFJetsPuppi.clone( rParam = 0.8 ) AK8PFJetsPuppi.src = cms.InputTag('puppi','','JRA') #PFJetParameters
import FWCore.ParameterSet.Config as cms from RecoJets.JetProducers.ak4GenJets_cfi import ak4GenJets from RecoJets.JetProducers.ak8GenJets_cfi import ak8GenJets from RecoHI.HiJetAlgos.HiGenJets_cff import * ak4GenJetsNoNu = ak4GenJets.clone(src="genParticlesForJetsNoNu") ak8GenJetsNoNu = ak8GenJets.clone(src="genParticlesForJetsNoNu") ak4GenJetsNoMuNoNu = ak4GenJets.clone(src="genParticlesForJetsNoMuNoNu") ak8GenJetsNoMuNoNu = ak8GenJets.clone(src="genParticlesForJetsNoMuNoNu") recoGenJetsTask = cms.Task(ak4GenJets, ak8GenJets, ak4GenJetsNoNu, ak8GenJetsNoNu) recoGenJets = cms.Sequence(recoGenJetsTask) recoAllGenJetsTask = cms.Task(ak4GenJets, ak8GenJets) recoAllGenJets = cms.Sequence(recoAllGenJetsTask) recoAllGenJetsNoNuTask = cms.Task(ak4GenJetsNoNu, ak8GenJetsNoNu) recoAllGenJetsNoNu = cms.Sequence(recoAllGenJetsNoNuTask) recoAllGenJetsNoMuNoNuTask = cms.Task(ak4GenJetsNoMuNoNu, ak8GenJetsNoMuNoNu) recoAllGenJetsNoMuNoNu = cms.Sequence(recoAllGenJetsNoMuNoNuTask)
"MergedGenParticleProducer", inputPruned=cms.InputTag("prunedGenParticles"), inputPacked=cms.InputTag("packedGenParticles")) #select only stable particles (status=1) for reclustering GenJets for the matching; exclude neutrinos & SUSY particles from RecoJets.JetProducers.ak4GenJets_cfi import ak4GenJets genParticlesForGenJets = cms.EDFilter( "CandPtrSelector", src=cms.InputTag("genParticlesMerged"), cut=cms.string( "status==1 && abs(pdgId) != 12 && abs(pdgId) != 14 && abs(pdgId) != 16 && abs(pdgId) < 1000000" ), ) #recluster GenJets genJetsReclustered = ak4GenJets.clone( src=cms.InputTag('genParticlesForGenJets'), jetPtMin=cms.double(1.0) #default: 3 GeV ) #produce DisplacedGenVertices and match to GenJets displacedGenVertices = cms.EDProducer( "DisplacedGenVertexProducer", srcGenParticles=cms.InputTag("genParticlesMerged"), srcGenJets=cms.InputTag("genJetsReclustered")) displacedGenVertexSequence = cms.Sequence(genParticlesMerged + genParticlesForGenJets + genJetsReclustered + displacedGenVertices)
## Filter out neutrinos from packed GenParticles #for miniaod process.packedGenParticlesForJetsNoNu = cms.EDFilter( "CandPtrSelector", src=cms.InputTag("packedGenParticles"), cut=cms.string("abs(pdgId) != 12 && abs(pdgId) != 14 && abs(pdgId) != 16")) task.add(process.packedGenParticlesForJetsNoNu) #for aod process.load('RecoJets.Configuration.GenJetParticles_cff') task.add(process.genParticlesForJetsNoNu) ## Define GenJets from RecoJets.JetProducers.ak4GenJets_cfi import ak4GenJets process.ak4GenJetsNoNu = ak4GenJets.clone( src='genParticlesForJetsNoNu', srcPVs=cms.InputTag("offlinePrimaryVertices"), ) #different in miniaod!!!#'packedGenParticlesForJetsNoNu') task.add(process.ak4GenJetsNoNu) process.ak4GenJetsNoNuFakeRejected = ak4GenJets.clone( src='genParticlesForJetsNoNu', srcPVs=cms.InputTag('selectedPrimaryVerticesFakeRejected', '', 'ReclusterAOD'), ) #different in miniaod!!!#'packedGenParticlesForJetsNoNu') task.add(process.ak4GenJetsNoNuFakeRejected) #---------------------# # Reco Jets # #---------------------# ## recluster reco jets
def initFatJets(process, isData, labels): """ @labels: ['AK8', 'CA15', ...] """ ######################################## ## INITIAL SETUP ## ######################################## sequence = cms.Sequence() addattr = AddAttr(process, sequence) if not isData and not hasattr(process, 'packedGenParticlesForJetsNoNu'): genParticlesNoNu = addattr( 'packedGenParticlesForJetsNoNu', cms.EDFilter( "CandPtrSelector", src=cms.InputTag(finalStateGenParticles), cut=cms.string( "abs(pdgId) != 12 && abs(pdgId) != 14 && abs(pdgId) != 16") )) for label in labels: matches = re.match('(AK|CA)([0-9]+)$', label) if not matches: raise RuntimeError('Unknown algo label ' + label) # set up radius and algoName from the input label radius = float(matches.group(2)) * 0.1 if matches.group(1) == 'CA': algoName = 'CambridgeAachen' elif matches.group(1) == 'AK': algoName = 'AntiKt' # gen jets addattr( 'genJetsNoNu' + label, ak4GenJets.clone( doAreaFastjet=cms.bool( False ), # This flag is turned on by default in CMSSW and makes things much slower, do not turn this on jetAlgorithm=cms.string(algoName), rParam=cms.double(radius), src=genParticlesNoNu)) genJetsMod = addattr.last sdZcut, sdBeta = sdParams(radius) # gen jets soft drop for subjet gen matching addattr( 'genJetsNoNuSoftDrop' + label, genJetsMod.clone(R0=cms.double(radius), useSoftDrop=cms.bool(True), zcut=cms.double(sdZcut), beta=cms.double(sdBeta), writeCompound=cms.bool(True), useExplicitGhosts=cms.bool(True), jetCollInstanceName=cms.string("SubJets"))) # Charged hadron subtraction if not hasattr(process, 'pfCHS'): addattr( 'pfCHS', cms.EDFilter("CandPtrSelector", src=cms.InputTag(pfSource), cut=cms.string("fromPV"))) return sequence
def initFatJets(process,isData): adaptPVs(process, pvCollection=cms.InputTag('offlineSlimmedPrimaryVertices')) isMC = not isData ######################################## ## INITIAL SETUP ## ######################################## jetCorrectionsAK4 = ('AK4PFchs', ['L1FastJet', 'L2Relative', 'L3Absolute'], 'None') jetCorrectionsAK8 = ('AK8PFchs', ['L1FastJet', 'L2Relative', 'L3Absolute'], 'None') if isData: jetCorrectionsAK4[1].append('L2L3Residual') jetCorrectionsAK8[1].append('L2L3Residual') ## Various collection names genParticles = 'prunedGenParticles' jetSource = 'ak4PFJets' genJetCollection = 'ak4GenJetsNoNu' pfCandidates = 'packedPFCandidates' pvSource = 'offlineSlimmedPrimaryVertices' svSource = 'slimmedSecondaryVertices' muSource = 'slimmedMuons' elSource = 'slimmedElectrons' PFjetAlgo="AK4" ## Load standard PAT objects process.load("PhysicsTools.PatAlgos.producersLayer1.patCandidates_cff") process.load("PhysicsTools.PatAlgos.selectionLayer1.selectedPatCandidates_cff") bTagInfos = [ 'pfImpactParameterTagInfos' ,'pfSecondaryVertexTagInfos' ,'pfInclusiveSecondaryVertexFinderTagInfos' ,'softPFMuonsTagInfos' ,'softPFElectronsTagInfos' ] ## b-tag discriminators bTagDiscriminators = [ 'pfCombinedSecondaryVertexV2BJetTags' ,'pfCombinedInclusiveSecondaryVertexV2BJetTags' ] process.pfCHS = cms.EDFilter("CandPtrSelector", src = cms.InputTag("packedPFCandidates"), cut = cms.string("fromPV")) if isMC: process.packedGenParticlesForJetsNoNu = cms.EDFilter("CandPtrSelector", src = cms.InputTag("packedGenParticles"), cut = cms.string("abs(pdgId) != 12 && abs(pdgId) != 14 && abs(pdgId) != 16")) process.ak4GenJetsNoNu = ak4GenJets.clone(src = 'packedGenParticlesForJetsNoNu') process.ak4PFJets = ak4PFJets.clone(src='pfCHS',doAreaFastjet=True) postfix='PFlow' ## Switch the default jet collection (done in order to use the above specified b-tag infos and discriminators) switchJetCollection( process, jetSource = cms.InputTag(jetSource), pfCandidates = cms.InputTag(pfCandidates), pvSource = cms.InputTag(pvSource), svSource = cms.InputTag(svSource), muSource = cms.InputTag(muSource), elSource = cms.InputTag(elSource), btagInfos = bTagInfos, btagDiscriminators = bTagDiscriminators, jetCorrections = jetCorrectionsAK4, genJetCollection = cms.InputTag(genJetCollection), genParticles = cms.InputTag(genParticles), postfix = postfix ) if isMC: process.fatjetInitSequence = cms.Sequence( process.packedGenParticlesForJetsNoNu+ process.ak4GenJetsNoNu ) else: process.fatjetInitSequence = cms.Sequence() process.fatjetInitSequence += process.pfCHS process.fatjetInitSequence += process.ak4PFJets return process.fatjetInitSequence
process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff") from Configuration.AlCa.GlobalTag import GlobalTag process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:run2_mc') process.load("Configuration.StandardSequences.MagneticField_cff") ###################### # load low-pt charged GenJet configuration here # get charged genParticles process.load('QCDAnalysis.UEAnalysis.UEAnalysisParticles_cfi') process.chargeParticles.cut = cms.string('charge != 0 & pt > 0.3 & status = 1') # get genjet definitions from RecoJets.JetProducers.ak4GenJets_cfi import ak4GenJets from RecoJets.JetProducers.ak5GenJets_cfi import ak5GenJets # clone normal ak4 genjets process.ak4ChgGenJets = ak4GenJets.clone( src = cms.InputTag("chargeParticles"), jetPtMin = cms.double(0.3) ) # clone normal ak5 genjets process.ak5ChgGenJets = ak5GenJets.clone( src = cms.InputTag("chargeParticles"), jetPtMin = cms.double(0.3) ) # add the processes process.chargedgenjets = cms.Path(process.UEAnalysisParticles*process.ak4ChgGenJets*process.ak5ChgGenJets) ###################### # Here starts the CFF specific part import CommonFSQFramework.Core.customizePAT process = CommonFSQFramework.Core.customizePAT.customize(process) # GT customization
def makeFatJets(process,isData,pfCandidates,algoLabel,jetRadius): isMC = not isData postfix='PFlow' if pfCandidates=='particleFlow': # mini aod needs a different config pfCandidates = 'pfCHS' if pfCandidates=='pfCHS': puMethod='CHS' else: puMethod='Puppi' rLabel = algoLabel+str(int(jetRadius*10)) neroLabel = rLabel+puMethod if algoLabel=='CA': jetAlgo = 'CambridgeAachen' else: jetAlgo = 'AntiKt' if jetRadius<1: sdZcut = 0.1 sdBeta = 0.0 else: sdZcut = 0.2 sdBeta = 1.0 setattr(process,neroLabel+'Sequence',cms.Sequence()) newSeq = getattr(process,neroLabel+'Sequence') ## Various collection names genParticles = 'prunedGenParticles' pvSource = 'offlineSlimmedPrimaryVertices' svSource = 'slimmedSecondaryVertices' muSource = 'slimmedMuons' elSource = 'slimmedElectrons' bTagInfos = [ 'pfImpactParameterTagInfos' ,'pfSecondaryVertexTagInfos' ,'pfInclusiveSecondaryVertexFinderTagInfos' ,'softPFMuonsTagInfos' ,'softPFElectronsTagInfos' ] ## b-tag discriminators bTagDiscriminators = [ 'pfCombinedSecondaryVertexV2BJetTags' ,'pfCombinedInclusiveSecondaryVertexV2BJetTags' ] bTagInfosSubjets = [ 'pfImpactParameterTagInfos' ,'pfSecondaryVertexTagInfos' ,'pfInclusiveSecondaryVertexFinderTagInfos' ,'softPFMuonsTagInfos' ,'softPFElectronsTagInfos' ] ## b-tag discriminators bTagDiscriminatorsSubjets = [ 'pfCombinedSecondaryVertexV2BJetTags' ,'pfCombinedInclusiveSecondaryVertexV2BJetTags' ] bTagInfosSubjets=['None'] bTagDiscriminatorsSubjets=['None'] ### jet clustering ### ######################################## ## REMAKE JETS ## ######################################## addingGenJets = False if not(hasattr(process,"genJetsNoNu"+rLabel)) and isMC: addingGenJets = True setattr(process,"genJetsNoNu"+rLabel, ak4GenJets.clone( jetAlgorithm = cms.string(jetAlgo), rParam = cms.double(jetRadius), src = cms.InputTag("packedGenParticlesForJetsNoNu") ) ) setattr(process,"PFJets"+neroLabel, ak4PFJets.clone( jetAlgorithm = cms.string(jetAlgo), rParam = cms.double(jetRadius), src = cms.InputTag(pfCandidates), srcPVs = cms.InputTag(pvSource), doAreaFastjet = cms.bool(True), jetPtMin = cms.double(150) ) ) if not(hasattr(process,"genJetsNoNuSoftDrop"+rLabel)) and isMC: addingGenJets = True setattr(process,"genJetsNoNuSoftDrop"+rLabel, getattr(process,'genJetsNoNu'+rLabel).clone( R0 = cms.double(jetRadius), useSoftDrop = cms.bool(True), zcut = cms.double(sdZcut), beta = cms.double(sdBeta), writeCompound = cms.bool(True), jetCollInstanceName=cms.string("SubJets") ) ) setattr(process,"PFJets"+"SoftDrop"+neroLabel, getattr(process,'PFJets'+neroLabel).clone( useSoftDrop = cms.bool(True), R0 = cms.double(jetRadius), zcut = cms.double(sdZcut), beta = cms.double(sdBeta), writeCompound = cms.bool(True), useExplicitGhosts = cms.bool(True), jetCollInstanceName=cms.string("SubJets"), jetPtMin = cms.double(150) ) ) if addingGenJets and not(isData): newSeq += getattr(process,'genJetsNoNu'+rLabel) newSeq += getattr(process,'genJetsNoNuSoftDrop'+rLabel) newSeq += getattr(process,'PFJets'+neroLabel) newSeq += getattr(process,'PFJets'+"SoftDrop"+neroLabel) ######################################## ## SUBSTRUCTURE ## ####################################### setattr(process,neroLabel+'Njettiness', Njettiness.clone( src = cms.InputTag('PFJets'+neroLabel), R0 = cms.double(jetRadius), Njets = cms.vuint32(1,2,3,4) ) ) setattr(process,neroLabel+'SDKinematics', cms.EDProducer('RecoJetDeltaRValueMapProducer', src = cms.InputTag('PFJets'+neroLabel), matched = cms.InputTag('PFJets'+"SoftDrop"+neroLabel), distMax = cms.double(1.5), values = cms.vstring('mass'), valueLabels = cms.vstring('Mass'), ) ) newSeq += getattr(process,neroLabel+'SDKinematics') newSeq += getattr(process,neroLabel+'Njettiness') ### subjet b-tagging ### setattr(process,neroLabel+'PFImpactParameterTagInfos', pfImpactParameterTagInfos.clone( jets = cms.InputTag('PFJets'+"SoftDrop"+neroLabel,'SubJets'), maxDeltaR = cms.double(jetRadius), primaryVertex = cms.InputTag('offlineSlimmedPrimaryVertices'), candidates = cms.InputTag('packedPFCandidates') ) ) setattr(process,neroLabel+'PFInclusiveSecondaryVertexFinderTagInfos', pfInclusiveSecondaryVertexFinderTagInfos.clone( trackIPTagInfos = cms.InputTag(neroLabel+'PFImpactParameterTagInfos'), extSVCollection = cms.InputTag('slimmedSecondaryVertices') ) ) setattr(process,neroLabel+'PFCombinedInclusiveSecondaryVertexV2BJetTags', pfCombinedInclusiveSecondaryVertexV2BJetTags.clone( tagInfos = cms.VInputTag( cms.InputTag(neroLabel+"PFImpactParameterTagInfos"), cms.InputTag(neroLabel+"PFInclusiveSecondaryVertexFinderTagInfos") ) ) ) newSeq += getattr(process,neroLabel+'PFImpactParameterTagInfos') newSeq += getattr(process,neroLabel+'PFInclusiveSecondaryVertexFinderTagInfos') newSeq += getattr(process,neroLabel+'PFCombinedInclusiveSecondaryVertexV2BJetTags') bTagInfos = ['None'] bTagDiscriminators = ['None'] ######################################## ## MAKE PAT JETS ## ######################################## addJetCollection( process, labelName='PF'+neroLabel, jetSource=cms.InputTag('PFJets'+neroLabel), algo=algoLabel, # needed for jet flavor clustering rParam=jetRadius, # needed for jet flavor clustering pfCandidates = cms.InputTag('packedPFCandidates'), pvSource = cms.InputTag(pvSource), svSource = cms.InputTag(svSource), muSource = cms.InputTag(muSource), elSource = cms.InputTag(elSource), btagInfos = bTagInfos, btagDiscriminators = bTagDiscriminators, genJetCollection = cms.InputTag('genJetsNoNu'+rLabel), genParticles = cms.InputTag(genParticles), getJetMCFlavour = False, # jet flavor disabled ) getattr(process,'selectedPatJetsPF'+neroLabel).cut = cms.string("abs(eta) < " + str(2.5)) ## SOFT DROP ## addJetCollection( process, labelName='SoftDropPF'+neroLabel, jetSource=cms.InputTag('PFJets'+"SoftDrop"+neroLabel), pfCandidates = cms.InputTag('packedPFCandidates'), algo=algoLabel, rParam=jetRadius, btagInfos = ['None'], btagDiscriminators = ['None'], genJetCollection = cms.InputTag('genJetsNoNu'+rLabel), genParticles = cms.InputTag(genParticles), getJetMCFlavour = False, # jet flavor disabled ) addJetCollection( process, labelName='SoftDropSubjetsPF'+neroLabel, jetSource=cms.InputTag('PFJets'+"SoftDrop"+neroLabel,'SubJets'), algo=algoLabel, rParam=jetRadius, pfCandidates = cms.InputTag('packedPFCandidates'), pvSource = cms.InputTag(pvSource), svSource = cms.InputTag(svSource), muSource = cms.InputTag(muSource), elSource = cms.InputTag(elSource), btagInfos = bTagInfosSubjets, btagDiscriminators = bTagDiscriminatorsSubjets, genJetCollection = cms.InputTag('genJetsNoNuSoftDrop'+rLabel,'SubJets'), genParticles = cms.InputTag(genParticles), explicitJTA = True, # needed for subjet b tagging svClustering = True, # needed for subjet b tagging fatJets = cms.InputTag('PFJets'+neroLabel), # needed for subjet flavor clustering groomedFatJets = cms.InputTag('PFJets'+"SoftDrop"+neroLabel), # needed for subjet flavor clustering runIVF = False, getJetMCFlavour = False, # jet flavor disabled ) isMC = not(isData) if isMC: newSeq += getattr(process,'patJetPartonMatchPF'+neroLabel) newSeq += getattr(process,'patJetGenJetMatchPF'+neroLabel) newSeq += getattr(process,'patJetsPF'+neroLabel) newSeq += getattr(process,'selectedPatJetsPF'+neroLabel) if isMC: newSeq += getattr(process,'patJetPartonMatchSoftDropPF'+neroLabel) newSeq += getattr(process,'patJetGenJetMatchSoftDropPF'+neroLabel) newSeq += getattr(process,'patJetsSoftDropPF'+neroLabel) newSeq += getattr(process,'selectedPatJetsSoftDropPF'+neroLabel) if isMC: newSeq += getattr(process,'patJetPartonMatchSoftDropSubjetsPF'+neroLabel) newSeq += getattr(process,'patJetGenJetMatchSoftDropSubjetsPF'+neroLabel) newSeq += getattr(process,'patJetsSoftDropSubjetsPF'+neroLabel) newSeq += getattr(process,'selectedPatJetsSoftDropSubjetsPF'+neroLabel) setattr(process,"selectedPatJetsSoftDropPF"+"Packed"+neroLabel, cms.EDProducer("BoostedJetMerger", jetSrc=cms.InputTag("selectedPatJetsSoftDropPF"+neroLabel), subjetSrc=cms.InputTag("selectedPatJetsSoftDropSubjetsPF"+neroLabel) ) ) ## PACK ## setattr(process,"packedPatJetsPF"+neroLabel, cms.EDProducer("JetSubstructurePacker", jetSrc = cms.InputTag('selectedPatJetsPF'+neroLabel), distMax = cms.double(jetRadius), algoTags = cms.VInputTag(), algoLabels = cms.vstring(), fixDaughters = cms.bool(False) ) ) getattr(process,"packedPatJetsPF"+neroLabel).algoTags.append( cms.InputTag('selectedPatJetsSoftDropPF'+"Packed"+neroLabel) ) getattr(process,"packedPatJetsPF"+neroLabel).algoLabels.append( 'SoftDrop' ) getattr(process,'patJetsPF'+neroLabel).userData.userFloats.src += [neroLabel+'Njettiness:tau1'] getattr(process,'patJetsPF'+neroLabel).userData.userFloats.src += [neroLabel+'Njettiness:tau2'] getattr(process,'patJetsPF'+neroLabel).userData.userFloats.src += [neroLabel+'Njettiness:tau3'] getattr(process,'patJetsPF'+neroLabel).userData.userFloats.src += [neroLabel+'Njettiness:tau4'] getattr(process,'patJetsPF'+neroLabel).userData.userFloats.src += [neroLabel+'SDKinematics:Mass'] for m in ['patJetsPF'+neroLabel,'patJetsSoftDropSubjetsPF'+neroLabel]: if hasattr(process,m) and getattr( getattr(process,m),'addBTagInfo'): setattr( getattr(process,m), 'addTagInfos', cms.bool(True)) #if hasattr(process,m): # setattr( getattr(process,m), 'addJetFlavourInfo', cms.bool(True)) newSeq += cms.Sequence( getattr(process,'selectedPatJetsSoftDropPF'+"Packed"+neroLabel)+ getattr(process,'packedPatJetsPF'+neroLabel) ) if isData: removeMCMatching(process, ['All'], outputModules = []) return newSeq
def addGenJetCollection( self, proc, jet, inputCollection="", genName="", minPt=5., ): print( "jetCollectionTools::GenJetAdder::addGenJetCollection: Adding Gen Jet Collection: {}" .format(jet)) currentTasks = [] # # Decide which jet collection we're dealing with # jetLower = jet.lower() jetUpper = jet.upper() tagName = jetUpper genJetInfo = GenJetInfo(jet, inputCollection) #======================================================= # # If gen jet collection in MiniAOD is not # specified, build the genjet collection. # #======================================================== if not inputCollection: print( "jetCollectionTools::GenJetAdder::addGenJetCollection: inputCollection not specified. Building genjet collection now" ) # # Setup GenParticles # packedGenPartNoNu = "packedGenParticlesForJetsNoNu" if packedGenPartNoNu not in self.prerequisites: setattr( proc, packedGenPartNoNu, cms.EDFilter( "CandPtrSelector", src=cms.InputTag("packedGenParticles"), cut=cms.string( "abs(pdgId) != 12 && abs(pdgId) != 14 && abs(pdgId) != 16" ), )) self.prerequisites.append(packedGenPartNoNu) # # Create the GenJet collection # genJetsCollection = "{}{}{}".format(genJetInfo.jetAlgo.upper(), genJetInfo.jetSize, 'GenJetsNoNu') setattr( proc, genJetsCollection, ak4GenJets.clone( src=packedGenPartNoNu, jetAlgorithm=cms.string( supportedJetAlgos[genJetInfo.jetAlgo]), rParam=cms.double(genJetInfo.jetSizeNr), )) self.prerequisites.append(genJetsCollection) # # GenJet Flavour Labelling # genFlavour = "{}Flavour".format(genJetInfo.jetTagName) setattr( proc, genFlavour, patJetFlavourAssociation.clone( jets=cms.InputTag(genJetsCollection), jetAlgorithm=cms.string(supportedJetAlgos[genJetInfo.jetAlgo]), rParam=cms.double(genJetInfo.jetSizeNr), )) currentTasks.append(genFlavour) self.main.extend(currentTasks) return genJetInfo
## Details in: PhysicsTools/JetExamples/test/printJetFlavourInfo.cc, PhysicsTools/JetExamples/test/printJetFlavourInfo.py ## and in: https://twiki.cern.ch/twiki/bin/view/CMSPublic/SWGuideBTagMCTools#New_jet_flavour_definition ## Supply PDG ID to real name resolution of MC particles process.load("SimGeneral.HepPDTESSource.pythiapdt_cfi") ## Input particles for gen jets (stable gen particles to be used in clustering, excluding electrons, muons and neutrinos from hard interaction) from RecoJets.Configuration.GenJetParticles_cff import genParticlesForJets process.genParticlesForJetsNoNuNoLepton = genParticlesForJets.clone( src = genJetInputParticleCollection, excludeResonances = True, excludeFromResonancePids = [11, 12, 13, 14, 16], ) from RecoJets.JetProducers.ak4GenJets_cfi import ak4GenJets process.ak4GenJetsNoNuNoLepton = ak4GenJets.clone(src = "genParticlesForJetsNoNuNoLepton") # Ghost particle collection for matching to gen jets (b/c hadrons + leptons) from PhysicsTools.JetMCAlgos.HadronAndPartonSelector_cfi import selectedHadronsAndPartons process.selectedHadronsAndPartons = selectedHadronsAndPartons.clone(particles = genParticleCollection) # Flavour info: jet collection with all associated ghosts # For the moment leptons need to be specified explicitely here, until lepton access can be made more generic in miniAOD # This is only needed as long as the jetConstituents are not accessible directly in miniAOD, then it should be fixed # by using the leptons from the constituents, instead of feeding them as ghosts into the jets from PhysicsTools.JetMCAlgos.AK4PFJetsMCFlavourInfos_cfi import ak4JetFlavourInfos process.ak4GenJetFlavourPlusLeptonInfos = ak4JetFlavourInfos.clone( jets = genJetCollection, leptons = cms.InputTag("selectedHadronsAndPartons", "leptons") )
# the cofigurations # process.load("flashgg/MicroAOD/flashggVertexMaps_cfi") # flashggTkVtxMap_cfi.py process.load("flashgg/MicroAOD/flashggTkVtxMap_cfi") process.load("flashgg/MicroAOD/flashggPhotons_cfi") process.load("flashgg/MicroAOD/flashggDiPhotons_cfi") process.load("flashgg/MicroAOD/flashggPreselectedDiPhotons_cfi") process.load("flashgg/MicroAOD/flashggElectrons_cfi") # Import RECO jet producer for ak4 PF and GEN jet from RecoJets.JetProducers.ak4PFJets_cfi import ak4PFJets from RecoJets.JetProducers.ak4GenJets_cfi import ak4GenJets process.ak4PFJets = ak4PFJets.clone(src = 'packedPFCandidates', doAreaFastjet = True) process.ak4GenJets = ak4GenJets.clone(src = 'packedGenParticles') # The following is make patJets, but EI is done with the above process.load("PhysicsTools.PatAlgos.producersLayer1.patCandidates_cff") process.load("Configuration.EventContent.EventContent_cff") process.load('Configuration.StandardSequences.Geometry_cff') process.load('Configuration.StandardSequences.MagneticField_38T_cff') process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff') process.GlobalTag.globaltag = 'PLS170_V7AN1::All' from PhysicsTools.PatAlgos.tools.jetTools import addJetCollection addJetCollection( process, postfix = "", labelName = 'AK4PF', jetSource = cms.InputTag('ak4PFJets'),
def makeTreeTreeFromMiniAOD(process, outFileName, NJetsMin=2, HTMin=350., MHTMin=0., reportEveryEvt=10, testFileName="", Global_Tag="", METFiltersProcess="", MC=False, debug = False, QCD=False, LostLepton=False, numProcessedEvt=1000, doAK8Reclustering=False, doJECCorrection=False, doPuppi=False, leptonFilter=True, genJetsAK8Reclustering=True, customizeHBHENoiseForEarlyData=False, customizeHBHENoiseForRun2015D=True, jsonFileName="", reDoPruningAndSoftdrop=False, isCrab=False): process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_condDBv2_cff") if (MC): customizeHBHENoiseForRun2015D=False process.GlobalTag.globaltag = Global_Tag ## Added Geometry cfi files ### ## Not in current EXO-WW configuration ## process.load("Geometry.CMSCommonData.cmsIdealGeometryXML_cfi"); process.load("Geometry.CaloEventSetup.CaloGeometry_cfi"); process.load("Geometry.CaloEventSetup.CaloTopology_cfi"); ## --- Log output ------------------------------------------------------ process.load("FWCore.MessageService.MessageLogger_cfi") process.MessageLogger.cerr = cms.untracked.PSet( placeholder = cms.untracked.bool(True) ) process.MessageLogger.cout = cms.untracked.PSet( INFO = cms.untracked.PSet(reportEvery = cms.untracked.int32(reportEveryEvt)) ) process.options = cms.untracked.PSet( wantSummary = cms.untracked.bool(True) ) ## --- Files to process ------------------------------------------------ process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(numProcessedEvt) ) process.source = cms.Source("PoolSource", fileNames = cms.untracked.vstring(testFileName) ) ## ---------------------------------------------------------------------------------------------- ## Triggers ## ---------------------------------------------------------------------------------------------- # The trigger results are saved to the tree as a vector # Three vectors are saved: # 1) names of the triggers # 2) trigger results # 3) trigger prescales # the indexing of these vectors must match # If the version number of the input trigger name is omitted, # any matching trigger will be included (default behavior) from SemiLeptonicWVA.Utils.triggerproducer_cfi import triggerProducer process.TriggerProducer = triggerProducer.clone( trigTagArg1 = cms.string('TriggerResults'), trigTagArg2 = cms.string(''), trigTagArg3 = cms.string('HLT'), prescaleTagArg1 = cms.string('patTrigger'), prescaleTagArg2 = cms.string(''), prescaleTagArg3 = cms.string(''), triggerNameList = cms.vstring( # list of trigger names 'HLT_Ele22_eta2p1_WPTight_Gsf_v', 'HLT_IsoMu20_v', 'HLT_IsoTkMu20_v', 'HLT_Ele27_WP85_Gsf_v' ) ) ## --- Output file ----------------------------------------------------- process.TFileService = cms.Service( "TFileService", fileName = cms.string(outFileName+".root") ) ############### JSON Filter import FWCore.PythonUtilities.LumiList as LumiList import sys if not MC: if(len(jsonFileName)>0): import FWCore.PythonUtilities.LumiList as LumiList process.source.lumisToProcess = LumiList.LumiList(filename = jsonFileName).getVLuminosityBlockRange() else: print "ERROR!! running on data with no json file applied!" sys.exit() ####### some gen infos from SemiLeptonicWVA.Utils.geneventinfo_cfi import geneventinfo process.GenEventInfo = geneventinfo.clone() ###Lepton Filter process.filterSeq = cms.Sequence () process.load('SemiLeptonicWVA.Utils.leptonfilter_cfi') process.leptonFilter.electronsInputTag = cms.InputTag("slimmedElectrons") process.leptonFilter.muonsInputTag = cms.InputTag("slimmedMuons") process.leptonFilter.eleFilterPtCut = cms.double(20.0) process.leptonFilter.muFilterPtCut = cms.double(20.0) if (leptonFilter): process.filterSeq = cms.Sequence (process.leptonFilter) ## --- Setup of TreeMaker ---------------------------------------------- FilterNames = cms.VInputTag() FilterNames.append(cms.InputTag("HBHENoiseFilterRA2","HBHENoiseFilterResult","PAT")) FilterNames.append(cms.InputTag("beamHaloFilter")) FilterNames.append(cms.InputTag("eeNoiseFilter")) FilterNames.append(cms.InputTag("trackingFailureFilter")) FilterNames.append(cms.InputTag("inconsistentMuons")) FilterNames.append(cms.InputTag("greedyMuons")) FilterNames.append(cms.InputTag("ra2EcalTPFilter")) FilterNames.append(cms.InputTag("ra2EcalBEFilter")) FilterNames.append(cms.InputTag("hcalLaserEventFilter")) FilterNames.append(cms.InputTag("ecalLaserCorrFilter")) FilterNames.append(cms.InputTag("eeBadScFilter")) FilterNames.append(cms.InputTag("PBNRFilter")) FilterNames.append(cms.InputTag("HCALLaserEvtFilterList2012")) FilterNames.append(cms.InputTag("manystripclus53X")) FilterNames.append(cms.InputTag("toomanystripclus53X")) FilterNames.append(cms.InputTag("logErrorTooManyClusters")) FilterNames.append(cms.InputTag("RA2HONoiseFilter")) ## --- Setup WeightProducer ------------------------------------------- from SemiLeptonicWVA.WeightProducer.getWeightProducer_cff import getWeightProducer process.WeightProducer = getWeightProducer(testFileName) process.WeightProducer.Lumi = cms.double(5000) process.WeightProducer.PU = cms.int32(0) # PU S10 3 for S10 2 for S7 process.WeightProducer.FileNamePUDataDistribution = cms.string("NONE") print process.WeightProducer.PU from RecoBTag.Configuration.RecoBTag_cff import * from RecoJets.JetAssociationProducers.j2tParametersVX_cfi import * process.slimmedJetsPFJetTracksAssociatorAtVertex = cms.EDProducer("JetTracksAssociatorAtVertex", j2tParametersVX, jets = cms.InputTag("iterativeCone5PFJets") ) process.slimmedJetsPFJetTracksAssociatorAtVertex.jets = "slimmedJets" process.slimmedJetsPFJetTracksAssociatorAtVertex.tracks = "generalTracks" process.slimmedJetsPFImpactParameterTagInfos = impactParameterTagInfos.clone() process.slimmedJetsPFImpactParameterTagInfos.jetTracks = "slimmedJetsPFJetTracksAssociatorAtVertex" process.slimmedJetsPFSecondaryVertexTagInfos = secondaryVertexTagInfos.clone() process.slimmedJetsPFSecondaryVertexTagInfos.trackIPTagInfos = "slimmedJetsPFImpactParameterTagInfos" process.slimmedJetsPFJetBtaggingSV = cms.Sequence( process.slimmedJetsPFImpactParameterTagInfos * process.slimmedJetsPFSecondaryVertexTagInfos ) process.slimmedJetsPFJetsBtag = cms.Sequence( process.slimmedJetsPFJetTracksAssociatorAtVertex * process.slimmedJetsPFJetBtaggingSV ) ## isotrack producer from SemiLeptonicWVA.Utils.trackIsolationMaker_cfi import trackIsolationFilter from SemiLeptonicWVA.Utils.trackIsolationMaker_cfi import trackIsolationCounter ## default process.IsolatedTracks = trackIsolationFilter.clone( doTrkIsoVeto= False, vertexInputTag = cms.InputTag("offlineSlimmedPrimaryVertices"), pfCandidatesTag = cms.InputTag("packedPFCandidates"), dR_ConeSize = cms.double(0.3), dz_CutValue = cms.double(0.05), minPt_PFCandidate = cms.double(15.0), isoCut = cms.double(0.1), ) process.CountIsoTracks = trackIsolationCounter.clone( src = cms.InputTag("IsolatedTracks"), minNumber = 1, ) process.substructureSequence = cms.Sequence() process.softdrop_onMiniAOD = cms.Sequence() process.pruning_onMiniAOD = cms.Sequence() process.redoPatJets = cms.Sequence() process.puppi_onMiniAOD = cms.Sequence() process.redoPuppiJets = cms.Sequence() if (doAK8Reclustering): from RecoJets.Configuration.RecoPFJets_cff import ak4PFJetsCHS, ak8PFJetsCHS, ak8PFJetsCHSPruned, ak8PFJetsCHSSoftDrop, ak8PFJetsCHSPrunedMass, ak8PFJetsCHSSoftDropMass process.chs = cms.EDFilter("CandPtrSelector", src = cms.InputTag('packedPFCandidates'), cut = cms.string('fromPV') ) process.NjettinessAK8 = cms.EDProducer("NjettinessAdder", src=cms.InputTag("ak8PFJetsCHS"), Njets=cms.vuint32(1,2,3,4), # compute 1-, 2-, 3-, 4- subjettiness # variables for measure definition : measureDefinition = cms.uint32( 0 ), # CMS default is normalized measure beta = cms.double(1.0), # CMS default is 1 R0 = cms.double( 0.8 ), # CMS default is jet cone size Rcutoff = cms.double( -999.0), # not used by default # variables for axes definition : axesDefinition = cms.uint32( 6 ), # CMS default is 1-pass KT axes nPass = cms.int32(-999), # not used by default akAxesR0 = cms.double(-999.0) # not used by default ) process.ak4PFJetsCHS = ak4PFJetsCHS.clone(src = 'chs') process.ak8PFJetsCHS = ak8PFJetsCHS.clone( src = 'chs', jetPtMin = 100.0 ) process.ak8PFJetsCHSPruned = ak8PFJetsCHSPruned.clone( src = 'chs', jetPtMin = 100.0 ) process.ak8PFJetsCHSPrunedMass = ak8PFJetsCHSPrunedMass.clone() process.ak8PFJetsCHSSoftDrop = ak8PFJetsCHSSoftDrop.clone( src = 'chs', jetPtMin = 100.0 ) process.ak8PFJetsCHSSoftDropMass = ak8PFJetsCHSSoftDropMass.clone() process.substructureSequence+=process.chs process.substructureSequence+=process.ak8PFJetsCHS process.substructureSequence+=process.NjettinessAK8 process.softdrop_onMiniAOD += process.ak8PFJetsCHSSoftDrop + process.ak8PFJetsCHSSoftDropMass process.pruning_onMiniAOD += process.ak8PFJetsCHSPruned + process.ak8PFJetsCHSPrunedMass ####### Redo pat jets sequence ########## from ExoDiBosonResonances.EDBRJets.redoPatJets_cff import patJetCorrFactorsAK8, patJetsAK8, selectedPatJetsAK8 # Redo pat jets from ak8PFJetsCHS process.patJetCorrFactorsAK8 = patJetCorrFactorsAK8.clone( src = 'ak8PFJetsCHS' ) process.patJetsAK8 = patJetsAK8.clone( jetSource = 'ak8PFJetsCHS' ) process.patJetsAK8.userData.userFloats.src = [ cms.InputTag("ak8PFJetsCHSPrunedMass"), cms.InputTag("ak8PFJetsCHSSoftDropMass"), cms.InputTag("NjettinessAK8:tau1"), cms.InputTag("NjettinessAK8:tau2"), cms.InputTag("NjettinessAK8:tau3")] process.patJetsAK8.jetCorrFactorsSource = cms.VInputTag( cms.InputTag("patJetCorrFactorsAK8") ) process.selectedPatJetsAK8 = selectedPatJetsAK8.clone( cut = cms.string('pt > 20') ) process.redoPatJets+=process.patJetCorrFactorsAK8 process.redoPatJets+=process.patJetsAK8 process.redoPatJets+=process.selectedPatJetsAK8 if (reDoPruningAndSoftdrop): process.patJetCorrFactorsAK8Pruned = patJetCorrFactorsAK8.clone( src = 'ak8PFJetsCHSPruned' ) process.patJetsAK8Pruned = patJetsAK8.clone( jetSource = 'ak8PFJetsCHSPruned' ) process.patJetsAK8Pruned.userData.userFloats.src = [ "" ] process.patJetsAK8Pruned.jetCorrFactorsSource = cms.VInputTag( cms.InputTag("patJetCorrFactorsAK8Pruned") ) process.selectedPatJetsAK8Pruned = selectedPatJetsAK8.clone( src = cms.InputTag('patJetsAK8Pruned'), cut = cms.string('pt > 20') ) process.redoPatJets+=process.patJetCorrFactorsAK8Pruned process.redoPatJets+=process.patJetsAK8Pruned process.redoPatJets+=process.selectedPatJetsAK8Pruned process.patJetCorrFactorsAK8Softdrop = patJetCorrFactorsAK8.clone( src = 'ak8PFJetsCHSSoftDrop' ) process.patJetsAK8Softdrop = patJetsAK8.clone( jetSource = 'ak8PFJetsCHSSoftDrop' ) process.patJetsAK8Softdrop.userData.userFloats.src = [ "" ] process.patJetsAK8Softdrop.jetCorrFactorsSource = cms.VInputTag( cms.InputTag("patJetCorrFactorsAK8Softdrop") ) process.selectedPatJetsAK8Softdrop = selectedPatJetsAK8.clone( src = cms.InputTag('patJetsAK8Softdrop'), cut = cms.string('pt > 20') ) process.redoPatJets+=process.patJetCorrFactorsAK8Softdrop process.redoPatJets+=process.patJetsAK8Softdrop process.redoPatJets+=process.selectedPatJetsAK8Softdrop if (doPuppi): from CommonTools.PileupAlgos.Puppi_cff import puppi from RecoJets.JetProducers.ak4PFJetsPuppi_cfi import ak4PFJetsPuppi process.ak8PFJetsPuppi = ak4PFJetsPuppi.clone( rParam = 0.8 ) process.puppi = puppi.clone( candName = cms.InputTag('packedPFCandidates'), vertexName = cms.InputTag('offlineSlimmedPrimaryVertices')) process.puppi_onMiniAOD = cms.Sequence(process.puppi + process.ak8PFJetsPuppi) from RecoJets.Configuration.RecoPFJets_cff import ak4PFJetsCHS, ak8PFJetsCHS, ak8PFJetsCHSPruned, ak8PFJetsCHSSoftDrop, ak8PFJetsCHSPrunedMass, ak8PFJetsCHSSoftDropMass process.NjettinessAK8 = cms.EDProducer("NjettinessAdder", src=cms.InputTag("ak8PFJetsPuppi"), Njets=cms.vuint32(1,2,3,4), # compute 1-, 2-, 3-, 4- subjettiness # variables for measure definition : measureDefinition = cms.uint32( 0 ), # CMS default is normalized measure beta = cms.double(1.0), # CMS default is 1 R0 = cms.double( 0.8 ), # CMS default is jet cone size Rcutoff = cms.double( -999.0), # not used by default # variables for axes definition : axesDefinition = cms.uint32( 6 ), # CMS default is 1-pass KT axes nPass = cms.int32(-999), # not used by default akAxesR0 = cms.double(-999.0) # not used by default ) process.ak4PFJetsPuppi = ak4PFJetsPuppi.clone(src = 'puppi') process.ak8PFJetsPuppi = process.ak8PFJetsPuppi.clone( src = 'puppi', jetPtMin = 100.0 ) process.ak8PFJetsCHSPruned = ak8PFJetsCHSPruned.clone( src = 'puppi', jetPtMin = 100.0 ) process.ak8PFJetsCHSPrunedMass = ak8PFJetsCHSPrunedMass.clone( matched = cms.InputTag("ak8PFJetsCHSPruned"), src = cms.InputTag("ak8PFJetsPuppi") ) process.ak8PFJetsCHSSoftDrop = ak8PFJetsCHSSoftDrop.clone( src = 'puppi', jetPtMin = 100.0 ) process.ak8PFJetsCHSSoftDropMass = ak8PFJetsCHSSoftDropMass.clone( matched = cms.InputTag("ak8PFJetsCHSSoftDrop"), src = cms.InputTag("ak8PFJetsPuppi") ) process.substructureSequence+=process.puppi process.substructureSequence+=process.ak8PFJetsPuppi process.substructureSequence+=process.NjettinessAK8 process.softdrop_onMiniAOD += process.ak8PFJetsCHSSoftDrop + process.ak8PFJetsCHSSoftDropMass process.pruning_onMiniAOD += process.ak8PFJetsCHSPruned + process.ak8PFJetsCHSPrunedMass ####### Redo pat jets sequence ########## from ExoDiBosonResonances.EDBRJets.redoPatJets_cff import patJetCorrFactorsAK8, patJetsAK8, selectedPatJetsAK8 # Redo pat jets from puppi AK8 process.puppiJetCorrFactorsAK8 = patJetCorrFactorsAK8.clone( src = 'ak8PFJetsPuppi', levels = cms.vstring('L2Relative', 'L3Absolute') ) process.puppiJetsAK8 = patJetsAK8.clone( jetSource = 'ak8PFJetsPuppi' ) process.puppiJetsAK8.userData.userFloats.src = [ cms.InputTag("ak8PFJetsCHSPrunedMass"), cms.InputTag("ak8PFJetsCHSSoftDropMass"), cms.InputTag("NjettinessAK8:tau1"), cms.InputTag("NjettinessAK8:tau2"), cms.InputTag("NjettinessAK8:tau3")] process.puppiJetsAK8.jetCorrFactorsSource = cms.VInputTag( cms.InputTag("puppiJetCorrFactorsAK8") ) process.selectedPuppiJetsAK8 = selectedPatJetsAK8.clone( src = 'puppiJetsAK8', cut = cms.string('pt > 20') ) process.redoPuppiJets+=process.puppiJetCorrFactorsAK8 process.redoPuppiJets+=process.puppiJetsAK8 process.redoPuppiJets+=process.selectedPuppiJetsAK8 #######AK8 GEN JETS################ process.substructureSequenceGen = cms.Sequence() process.softdropGen_onMiniAOD = cms.Sequence() process.pruningGen_onMiniAOD = cms.Sequence() process.redoGenJets = cms.Sequence() # process.puppi_onMiniAOD = cms.Sequence() if (genJetsAK8Reclustering and MC): from RecoJets.JetProducers.ak4GenJets_cfi import ak4GenJets process.ak8GenJets = ak4GenJets.clone(src = cms.InputTag('packedGenParticles'), rParam = cms.double(0.8) ) from RecoJets.Configuration.RecoPFJets_cff import ak4PFJetsCHS, ak8PFJetsCHS, ak8PFJetsCHSPruned, ak8PFJetsCHSSoftDrop, ak8PFJetsCHSPrunedMass, ak8PFJetsCHSSoftDropMass process.NjettinessGenAK8 = cms.EDProducer("NjettinessAdder", src=cms.InputTag("ak8GenJets"), Njets=cms.vuint32(1,2,3,4), # compute 1-, 2-, 3-, 4- subjettiness # variables for measure definition : measureDefinition = cms.uint32( 0 ), # CMS default is normalized measure beta = cms.double(1.0), # CMS default is 1 R0 = cms.double( 0.8 ), # CMS default is jet cone size Rcutoff = cms.double( -999.0), # not used by default # variables for axes definition : axesDefinition = cms.uint32( 6 ), # CMS default is 1-pass KT axes nPass = cms.int32(-999), # not used by default akAxesR0 = cms.double(-999.0) # not used by default ) process.genParticlesForJets = cms.EDProducer("InputGenJetsParticleSelector", src = cms.InputTag("packedGenParticles"), ignoreParticleIDs = cms.vuint32( 1000022, 1000012, 1000014, 1000016, 2000012, 2000014, 2000016, 1000039, 5100039, 4000012, 4000014, 4000016, 9900012, 9900014, 9900016, 39), partonicFinalState = cms.bool(False), excludeResonances = cms.bool(False), excludeFromResonancePids = cms.vuint32(12, 13, 14, 16), tausAsJets = cms.bool(False) ) from RecoJets.JetProducers.SubJetParameters_cfi import SubJetParameters process.ak8GenJetsPruned = ak4GenJets.clone( SubJetParameters, rParam = cms.double(0.8), src = cms.InputTag("genParticlesForJets"), usePruning = cms.bool(True), writeCompound = cms.bool(True), jetCollInstanceName=cms.string("SubJets") ) # process.ak8GenJetsPruned = ak8PFJetsCHSPruned.clone( src = 'packedGenParticles', jetPtMin = 100.0 ) process.ak8GenJetsPrunedMass = ak8PFJetsCHSPrunedMass.clone( matched = cms.InputTag("ak8GenJetsPruned"), src = cms.InputTag("ak8GenJets") ) process.ak8GenJetsSoftDrop = ak4GenJets.clone( SubJetParameters, rParam = cms.double(0.8), src = cms.InputTag("genParticlesForJets"), useSoftDrop = cms.bool(True), R0 = cms.double(0.8), beta = cms.double(0.0), writeCompound = cms.bool(True), jetCollInstanceName=cms.string("SubJets") ) process.ak8GenJetsSoftDropMass = ak8PFJetsCHSSoftDropMass.clone( matched = cms.InputTag("ak8GenJetsSoftDrop"), src = cms.InputTag("ak8GenJets") ) process.substructureSequenceGen+=process.genParticlesForJets process.substructureSequenceGen+=process.ak8GenJets process.substructureSequenceGen+=process.NjettinessGenAK8 process.softdropGen_onMiniAOD += process.ak8GenJetsSoftDrop + process.ak8GenJetsSoftDropMass process.pruningGen_onMiniAOD += process.ak8GenJetsPruned + process.ak8GenJetsPrunedMass ####### Redo pat jets sequence ########## from ExoDiBosonResonances.EDBRJets.redoPatJets_cff import patJetCorrFactorsAK8, patJetsAK8, selectedPatJetsAK8 # Redo pat jets from gen AK8 process.genJetsAK8 = patJetsAK8.clone( jetSource = 'ak8GenJets' ) process.genJetsAK8.userData.userFloats.src = [ cms.InputTag("ak8GenJetsPrunedMass"), cms.InputTag("ak8GenJetsSoftDropMass"), cms.InputTag("NjettinessGenAK8:tau1"), cms.InputTag("NjettinessGenAK8:tau2"), cms.InputTag("NjettinessGenAK8:tau3")] process.genJetsAK8.addJetCorrFactors = cms.bool(False) process.genJetsAK8.jetCorrFactorsSource = cms.VInputTag( cms.InputTag("") ) process.selectedGenJetsAK8 = selectedPatJetsAK8.clone( src = 'genJetsAK8', cut = cms.string('pt > 20') ) process.redoGenJets+=process.genJetsAK8 process.redoGenJets+=process.selectedGenJetsAK8 ######### A4PF-nonCHS jets ########### from RecoJets.JetProducers.ak4PFJets_cfi import ak4PFJets process.ak4PFJets = ak4PFJets.clone(src = "packedPFCandidates") from SemiLeptonicWVA.Utils.ak4pfjets_cfi import patJetCorrFactorsAK4, patJetsAK4 process.patJetCorrFactorsAK4 = patJetCorrFactorsAK4.clone( src = 'ak4PFJets' ) process.patJetsAK4 = patJetsAK4.clone( jetSource = 'ak4PFJets' ) # # Set up electron ID (VID framework) # from PhysicsTools.SelectorUtils.tools.vid_id_tools import * # turn on VID producer, indicate data format to be # DataFormat.AOD or DataFormat.MiniAOD, as appropriate dataFormat=DataFormat.MiniAOD switchOnVIDElectronIdProducer(process,dataFormat) process.egmGsfElectronIDSequence = cms.Sequence(process.egmGsfElectronIDs) # define which IDs we want to produce my_id_modules = ['RecoEgamma.ElectronIdentification.Identification.cutBasedElectronID_Spring15_25ns_V1_cff', 'RecoEgamma.ElectronIdentification.Identification.heepElectronID_HEEPV60_cff'] #add them to the VID producer for idmod in my_id_modules: setupAllVIDIdsInModule(process,idmod,setupVIDElectronSelection) # Producers from SemiLeptonicWVA.Utils.electron_cfi import electron process.Electrons = electron.clone( VertexTag = cms.InputTag("offlineSlimmedPrimaryVertices"), EleTag = cms.InputTag("slimmedElectrons"), MinPt = cms.double(-1), RhoTag = cms.InputTag("fixedGridRhoFastjetAll"), eleVetoIdMap = cms.InputTag("egmGsfElectronIDs:cutBasedElectronID-Spring15-25ns-V1-standalone-veto"), eleLooseIdMap = cms.InputTag("egmGsfElectronIDs:cutBasedElectronID-Spring15-25ns-V1-standalone-loose"), eleMediumIdMap = cms.InputTag("egmGsfElectronIDs:cutBasedElectronID-Spring15-25ns-V1-standalone-medium"), eleTightIdMap = cms.InputTag("egmGsfElectronIDs:cutBasedElectronID-Spring15-25ns-V1-standalone-tight"), eleHEEPIdMap = cms.InputTag("egmGsfElectronIDs:heepElectronID-HEEPV60") ) # Add in Photons: switchOnVIDPhotonIdProducer(process, dataFormat) my_id_modules = ['RecoEgamma.PhotonIdentification.Identification.cutBasedPhotonID_Spring15_25ns_V1_cff'] for idmod in my_id_modules: setupAllVIDIdsInModule(process,idmod,setupVIDPhotonSelection) from SemiLeptonicWVA.Utils.photon_cfi import photon process.Photons = photon.clone( PhoTag = cms.InputTag("slimmedPhotons"), phoLooseIdMap = cms.InputTag("egmPhotonIDs:cutBasedPhotonID-Spring15-25ns-V1-standalone-loose"), phoMediumIdMap = cms.InputTag("egmPhotonIDs:cutBasedPhotonID-Spring15-25ns-V1-standalone-medium"), phoTightIdMap = cms.InputTag("egmPhotonIDs:cutBasedPhotonID-Spring15-25ns-V1-standalone-tight"), phoTightIdFullInfoMap = cms.InputTag("egmPhotonIDs:cutBasedPhotonID-Spring15-25ns-V1-standalone-tight") ) from SemiLeptonicWVA.Utils.muon_cfi import muon process.Muons = muon.clone( VertexTag = cms.InputTag("offlineSlimmedPrimaryVertices"), MuTag = cms.InputTag("slimmedMuons"), MinPt = cms.double(-1), RhoTag = cms.InputTag("fixedGridRhoFastjetAll") ) from SemiLeptonicWVA.Utils.subJetSelection_cfi import SubJetSelection process.HTJets = SubJetSelection.clone( JetTag = cms.InputTag('slimmedJets'), MinPt = cms.double(50), MaxEta = cms.double(2.5), ) from SemiLeptonicWVA.Utils.htdouble_cfi import htdouble process.HT = htdouble.clone( JetTag = cms.InputTag('HTJets'), ) from SemiLeptonicWVA.Utils.njetint_cfi import njetint process.NJets = njetint.clone( JetTag = cms.InputTag('HTJets'), ) from SemiLeptonicWVA.Utils.btagint_cfi import btagint process.BTags = btagint.clone( JetTag = cms.InputTag('HTJets'), BTagInputTag = cms.string('combinedInclusiveSecondaryVertexV2BJetTags'), BTagCutValue = cms.double(0.679) ) from SemiLeptonicWVA.Utils.subJetSelection_cfi import SubJetSelection process.MHTJets = SubJetSelection.clone( JetTag = cms.InputTag('slimmedJets'), MinPt = cms.double(30), MaxEta = cms.double(5.0), ) process.MHTJetsAK8 = SubJetSelection.clone( JetTag = cms.InputTag('slimmedJetsAK8'), MinPt = cms.double(30), MaxEta = cms.double(5.0), ) from SemiLeptonicWVA.Utils.jetproperties_cfi import jetproperties process.MHTJetsProperties = jetproperties.clone( JetTag = cms.InputTag('MHTJets'), doJEC = cms.bool(doJECCorrection), L1File = cms.string("Summer15_25nsV7_DATA_L1FastJet_AK4PFchs.txt"), L2File = cms.string("Summer15_25nsV7_DATA_L2Relative_AK4PFchs.txt"), L3File = cms.string("Summer15_25nsV7_DATA_L3Absolute_AK4PFchs.txt"), L2L3File = cms.string("Summer15_25nsV7_DATA_L2L3Residual_AK4PFchs.txt"), ) from SemiLeptonicWVA.Utils.jetpropertiesAK8_cfi import jetpropertiesAK8 process.MHTJetsPropertiesAK8 = jetpropertiesAK8.clone( JetTag = cms.InputTag('MHTJetsAK8'), puppiJetTag = cms.InputTag('selectedPuppiJetsAK8'), doJEC = cms.bool(doJECCorrection), doReclusteringForPrunedAndSoftdrop = cms.bool(reDoPruningAndSoftdrop), L1File = cms.string("Summer15_25nsV7_DATA_L1FastJet_AK8PFchs.txt"), L2File = cms.string("Summer15_25nsV7_DATA_L2Relative_AK8PFchs.txt"), L3File = cms.string("Summer15_25nsV7_DATA_L3Absolute_AK8PFchs.txt"), L2L3File = cms.string("Summer15_25nsV7_DATA_L2L3Residual_AK8PFchs.txt"), ) if (reDoPruningAndSoftdrop): process.MHTJetsPropertiesAK8.prunedJetTag = cms.InputTag('selectedPatJetsAK8Pruned') process.MHTJetsPropertiesAK8.softdropJetTag = cms.InputTag('selectedPatJetsAK8Softdrop') else: process.MHTJetsPropertiesAK8.prunedJetTag = cms.InputTag('slimmedJetsAK8') process.MHTJetsPropertiesAK8.softdropJetTag = cms.InputTag('slimmedJetsAK8') if (MC): process.MHTJetsProperties.L1File = cms.string("Summer15_25nsV7_MC_L1FastJet_AK4PFchs.txt") process.MHTJetsProperties.L2File = cms.string("Summer15_25nsV7_MC_L2Relative_AK4PFchs.txt") process.MHTJetsProperties.L3File = cms.string("Summer15_25nsV7_MC_L3Absolute_AK4PFchs.txt") process.MHTJetsProperties.L2L3File = cms.string("NONE") process.MHTJetsPropertiesAK8.L1File = cms.string("Summer15_25nsV7_MC_L1FastJet_AK8PFchs.txt") process.MHTJetsPropertiesAK8.L2File = cms.string("Summer15_25nsV7_MC_L2Relative_AK8PFchs.txt") process.MHTJetsPropertiesAK8.L3File = cms.string("Summer15_25nsV7_MC_L3Absolute_AK8PFchs.txt") process.MHTJetsPropertiesAK8.L2L3File = cms.string("NONE") from SemiLeptonicWVA.Utils.jetproperties_cfi import jetproperties process.JetsProperties = jetproperties.clone( JetTag = cms.InputTag('slimmedJets'), MinPt = cms.double(-1), doJEC = cms.bool(doJECCorrection), L1File = cms.string("Summer15_25nsV7_DATA_L1FastJet_AK4PFchs.txt"), L2File = cms.string("Summer15_25nsV7_DATA_L2Relative_AK4PFchs.txt"), L3File = cms.string("Summer15_25nsV7_DATA_L3Absolute_AK4PFchs.txt"), L2L3File = cms.string("Summer15_25nsV7_DATA_L2L3Residual_AK4PFchs.txt"), ) from SemiLeptonicWVA.Utils.jetpropertiesAK8_cfi import jetpropertiesAK8 process.JetsPropertiesAK8 = jetpropertiesAK8.clone( JetTag = cms.InputTag('slimmedJetsAK8'), MinPt = cms.double(-1), doJEC = cms.bool(doJECCorrection), doReclusteringForPrunedAndSoftdrop = cms.bool(reDoPruningAndSoftdrop), L1File = cms.string("Summer15_25nsV7_DATA_L1FastJet_AK8PFchs.txt"), L2File = cms.string("Summer15_25nsV7_DATA_L2Relative_AK8PFchs.txt"), L3File = cms.string("Summer15_25nsV7_DATA_L3Absolute_AK8PFchs.txt"), L2L3File = cms.string("Summer15_25nsV7_DATA_L2L3Residual_AK8PFchs.txt"), ) if (reDoPruningAndSoftdrop): process.JetsPropertiesAK8.prunedJetTag = cms.InputTag('selectedPatJetsAK8Pruned') process.JetsPropertiesAK8.softdropJetTag = cms.InputTag('selectedPatJetsAK8Softdrop') else: process.JetsPropertiesAK8.prunedJetTag = cms.InputTag('slimmedJetsAK8') process.JetsPropertiesAK8.softdropJetTag = cms.InputTag('slimmedJetsAK8') if (MC): process.JetsProperties.L1File = cms.string("Summer15_25nsV7_MC_L1FastJet_AK4PFchs.txt") process.JetsProperties.L2File = cms.string("Summer15_25nsV7_MC_L2Relative_AK4PFchs.txt") process.JetsProperties.L3File = cms.string("Summer15_25nsV7_MC_L3Absolute_AK4PFchs.txt") process.JetsProperties.L2L3File = cms.string("NONE") process.JetsPropertiesAK8.L1File = cms.string("Summer15_25nsV7_MC_L1FastJet_AK8PFchs.txt") process.JetsPropertiesAK8.L2File = cms.string("Summer15_25nsV7_MC_L2Relative_AK8PFchs.txt") process.JetsPropertiesAK8.L3File = cms.string("Summer15_25nsV7_MC_L3Absolute_AK8PFchs.txt") process.JetsPropertiesAK8.L2L3File = cms.string("NONE") if doAK8Reclustering: process.JetsPropertiesAK8.JetTag = cms.InputTag('selectedPatJetsAK8') if doPuppi: process.JetsPropertiesAK8.JetTag = cms.InputTag('selectedPuppiJetsAK8') from SemiLeptonicWVA.Utils.mhtdouble_cfi import mhtdouble process.MHT = mhtdouble.clone( JetTag = cms.InputTag('MHTJets'), ) from SemiLeptonicWVA.Utils.deltaphidouble_cfi import deltaphidouble process.DeltaPhi = deltaphidouble.clone( DeltaPhiJets = cms.InputTag('HTJets'), MHTJets = cms.InputTag("MHTJets"), ) from SemiLeptonicWVA.Utils.metdouble_cfi import metdouble process.MET = metdouble.clone( METTag = cms.InputTag("slimmedMETs"), JetTag = cms.InputTag('slimmedJets'), doJEC = cms.bool(doJECCorrection), L1File = cms.string("Summer15_25nsV7_DATA_L1FastJet_AK4PFchs.txt"), L2File = cms.string("Summer15_25nsV7_DATA_L2Relative_AK4PFchs.txt"), L3File = cms.string("Summer15_25nsV7_DATA_L3Absolute_AK4PFchs.txt"), L2L3File = cms.string("Summer15_25nsV7_DATA_L2L3Residual_AK4PFchs.txt"), MuTag = cms.InputTag("slimmedMuons"), RhoTag = cms.InputTag("fixedGridRhoFastjetAll"), corrMet = cms.bool(doJECCorrection), ) if (MC): process.MET.L1File = cms.string("Summer15_25nsV7_MC_L1FastJet_AK4PFchs.txt") process.MET.L2File = cms.string("Summer15_25nsV7_MC_L2Relative_AK4PFchs.txt") process.MET.L3File = cms.string("Summer15_25nsV7_MC_L3Absolute_AK4PFchs.txt") process.MET.L2L3File = cms.string("NONE") from SemiLeptonicWVA.Utils.primaryverticies_cfi import primaryverticies process.NVtx = primaryverticies.clone( VertexCollection = cms.InputTag('offlineSlimmedPrimaryVertices'), ) from SemiLeptonicWVA.Utils.genLeptonRecoCand_cfi import genLeptonRecoCand process.GenLeptons = genLeptonRecoCand.clone( PrunedGenParticleTag = cms.InputTag("prunedGenParticles"), ) from SemiLeptonicWVA.Utils.genJet_cfi import genJet process.GenJets = genJet.clone( GenJetCollTag = cms.InputTag("slimmedGenJets"), ) from SemiLeptonicWVA.Utils.genJetAK8_cfi import genJetAK8 process.GenJetsAK8 = genJetAK8.clone( GenJetCollTag = cms.InputTag("selectedGenJetsAK8"), ) if not MC: process.GenLeptons = cms.Sequence() process.GenJets = cms.Sequence() process.GenJetsAK8 = cms.Sequence() ##### MET filters ##### #### -----> MET Filter Flags from MiniAOD/TWiki <----- #### import HLTrigger.HLTfilters.triggerResultsFilter_cfi as hlt process.metBits_miniAOD = hlt.triggerResultsFilter.clone() # default is to use the latest process (but can set different process through Commandline Args) process.metBits_miniAOD.hltResults = cms.InputTag('TriggerResults::%s'%METFiltersProcess) process.metBits_miniAOD.l1tResults = cms.InputTag('') #currently configured for CSCTightHaloFilter + GoodVertices met_bits = ['(Flag_CSCTightHaloFilter)','(Flag_goodVertices)','(Flag_eeBadScFilter)'] bitsexpr = ' AND '.join(met_bits) process.metBits_miniAOD.triggerConditions = cms.vstring(bitsexpr) #### -----> HBHE noise filter <----- #### process.load('CommonTools.RecoAlgos.HBHENoiseFilterResultProducer_cfi') process.HBHENoiseFilterResultProducer.minZeros = cms.int32(99999) process.HBHENoiseFilterResultProducer.IgnoreTS4TS5ifJetInLowBVRegion=cms.bool(False) process.HBHENoiseFilterResultProducer.defaultDecision = cms.string("HBHENoiseFilterResultRun2Loose") ########## save flags for filters from SemiLeptonicWVA.Utils.filterproducer_cfi import filterProducer process.FilterProducer = filterProducer.clone( noiseFilterTag = cms.InputTag("TriggerResults"), HBHENoiseFilter_Selector_ = cms.string("Flag_HBHENoiseFilter"), HBHENoiseIsoFilter_Selector_ = cms.string("Flag_HBHENoiseIsoFilter"), CSCHaloNoiseFilter_Selector_ = cms.string("Flag_CSCTightHaloFilter"), GoodVtxNoiseFilter_Selector_ = cms.string("Flag_goodVertices"), EEBadScNoiseFilter_Selector_ = cms.string("Flag_eeBadScFilter"), HBHENoiseFilterLoose = cms.InputTag("HBHENoiseFilterResultProducer", "HBHENoiseFilterResultRun2Loose"), HBHENoiseFilterTight = cms.InputTag("HBHENoiseFilterResultProducer", "HBHENoiseFilterResultRun2Tight"), HBHENoiseIsoFilter = cms.InputTag("HBHENoiseFilterResultProducer", "HBHEIsoNoiseFilterResult") ) RecoCandVector = cms.vstring() RecoCandVector.extend(['IsolatedTracks']) # basic muons electrons and isoalted tracks RecoCandVector.extend(['GenLeptons:Boson(GenBoson)|GenLeptons:BosonPDGId(I_GenBosonPDGId)','GenLeptons:Muon(GenMu)|GenLeptons:MuonTauDecay(I_GenMuFromTau)' ,'GenLeptons:Electron(GenElec)|GenLeptons:ElectronTauDecay(I_GenElecFromTau)','GenLeptons:Tau(GenTau)|GenLeptons:TauHadronic(I_GenTauHad)','GenLeptons:Neutrino(GenNu)'] ) # gen information on leptons RecoCandVector.extend(['GenJets:GenJet(GenJets)'] ) # gen information on jets RecoCandVector.extend(['GenJetsAK8:GenJetAK8(GenJetsAK8)|GenJetsAK8:GenAK8prunedMass(F_prunedMass)|GenJetsAK8:GenAK8softdropMass(F_softdropMass)|GenJetsAK8:GenAK8tau1(F_tau1)|GenJetsAK8:GenAK8tau2(F_tau2)|GenJetsAK8:GenAK8tau3(F_tau3)'] ) # gen information on AK8 jets RecoCandVector.extend(['JetsProperties(Jets)|JetsProperties:bDiscriminatorCSV(F_bDiscriminatorCSV)|JetsProperties:bDiscriminatorICSV(F_bDiscriminatorICSV)|JetsProperties:chargedEmEnergyFraction(F_chargedEmEnergyFraction)|JetsProperties:chargedHadronEnergyFraction(F_chargedHadronEnergyFraction)|JetsProperties:chargedHadronMultiplicity(I_chargedHadronMultiplicity)|JetsProperties:electronMultiplicity(I_electronMultiplicity)|JetsProperties:jetArea(F_jetArea)|JetsProperties:muonEnergyFraction(F_muonEnergyFraction)|JetsProperties:muonMultiplicity(I_muonMultiplicity)|JetsProperties:neutralEmEnergyFraction(F_neutralEmEnergyFraction)|JetsProperties:neutralHadronMultiplicity(I_neutralHadronMultiplicity)|JetsProperties:photonEnergyFraction(F_photonEnergyFraction)|JetsProperties:photonMultiplicity(I_photonMultiplicity)|JetsProperties:isLooseJetId(b_isLooseJetId)|JetsProperties:isTightJetId(b_isTightJetId)|JetsProperties:isTightLepVetoJetId(b_isTightLepVetoJetId)|JetsProperties:PtCorr(F_PtCorr)|JetsProperties:EtaCorr(F_EtaCorr)|JetsProperties:PhiCorr(F_PhiCorr)|JetsProperties:ECorr(F_ECorr)'] ) # jet information on various variables RecoCandVector.extend(['JetsPropertiesAK8(AK8Jets)|JetsPropertiesAK8:AK8bDiscriminatorCSV(F_bDiscriminatorCSV)|JetsPropertiesAK8:AK8bDiscriminatorICSV(F_bDiscriminatorICSV)|JetsPropertiesAK8:AK8chargedEmEnergyFraction(F_chargedEmEnergyFraction)|JetsPropertiesAK8:AK8chargedHadronEnergyFraction(F_chargedHadronEnergyFraction)|JetsPropertiesAK8:AK8chargedHadronMultiplicity(I_chargedHadronMultiplicity)|JetsPropertiesAK8:AK8electronMultiplicity(I_electronMultiplicity)|JetsPropertiesAK8:AK8jetArea(F_jetArea)|JetsPropertiesAK8:AK8muonEnergyFraction(F_muonEnergyFraction)|JetsPropertiesAK8:AK8muonMultiplicity(I_muonMultiplicity)|JetsPropertiesAK8:AK8neutralEmEnergyFraction(F_neutralEmEnergyFraction)|JetsPropertiesAK8:AK8neutralHadronMultiplicity(I_neutralHadronMultiplicity)|JetsPropertiesAK8:AK8photonEnergyFraction(F_photonEnergyFraction)|JetsPropertiesAK8:AK8photonMultiplicity(I_photonMultiplicity)|JetsPropertiesAK8:AK8prunedMass(F_prunedMass)|JetsPropertiesAK8:AK8softDropMass(F_softDropMass)|JetsPropertiesAK8:AK8trimmedMass(F_trimmedMass)|JetsPropertiesAK8:AK8filteredMass(F_filteredMass)|JetsPropertiesAK8:AK8tau1(F_tau1)|JetsPropertiesAK8:AK8tau2(F_tau2)|JetsPropertiesAK8:AK8tau3(F_tau3)|JetsPropertiesAK8:AK8isLooseJetId(b_AK8isLooseJetId)|JetsPropertiesAK8:AK8isTightJetId(b_AK8isTightJetId)|JetsPropertiesAK8:AK8isTightLepVetoJetId(b_AK8isTightLepVetoJetId)|JetsPropertiesAK8:PtCorr(F_PtCorr)|JetsPropertiesAK8:EtaCorr(F_EtaCorr)|JetsPropertiesAK8:PhiCorr(F_PhiCorr)|JetsPropertiesAK8:ECorr(F_ECorr)'] ) # AK8 jet information on various variables # RecoCandVector.extend(['Electrons(Electrons)|Electrons:charge(I_charge)|Electrons:isHEEP(b_isHEEP)|Electrons:type(I_type)|Electrons:mass(F_mass)|Electrons:pfDeltaCorrRelIso(F_pfDeltaCorrRelIso)|Electrons:pfRhoCorrRelIso04(F_pfRhoCorrRelIso04)|Electrons:pfRhoCorrRelIso03(F_pfRhoCorrRelIso03)|Electrons:pfRelIso(F_pfRelIso)|Electrons:photonIso(F_photonIso)|Electrons:neutralHadIso(F_neutralHadIso)|Electrons:chargedHadIso(F_chargedHadIso)|Electrons:trackIso(F_trackIso)|Electrons:isLoose(b_isLoose)|Electrons:isMedium(b_isMedium)|Electrons:isTight(b_isTight)|Electrons:SCEnergy(F_SCEnergy)|Electrons:deltaEtaSCTracker(F_deltaEtaSCTracker)|Electrons:deltaPhiSCTracker(F_deltaPhiSCTracker)|Electrons:sigmaIetaIeta(F_sigmaIetaIeta)|Electrons:sigmaIphiIphi(F_sigmaIphiIphi)'] ) # electron information on various variables RecoCandVector.extend(['Muons(Muons)|Muons:charge(I_charge)|Muons:isHighPt(b_isHighPt)|Muons:type(I_type)|Muons:mass(F_mass)|Muons:pfDeltaCorrRelIso(F_pfDeltaCorrRelIso)|Muons:pfRelIso(F_pfRelIso)|Muons:photonIso(F_photonIso)|Muons:neutralHadIso(F_neutralHadIso)|Muons:chargedHadIso(F_chargedHadIso)|Muons:trackIso(F_trackIso)|Muons:isLoose(b_isLoose)|Muons:isMedium(b_isMedium)|Muons:isTight(b_isTight)|Muons:isPFMuon(b_isPFMuon)'] ) # muon information on various variables RecoCandVector.extend(['Photons(Photons)|Photons:isLoose(b_isLoose)|Photons:isMedium(b_isMedium)|Photons:isTight(b_isTight)|Photons:minPt(F_minPt)|Photons:phoSCEtaMultiRange(F_phoSCEtaMultiRange)|Photons:phoSingleTowerHadOverEm(F_phoSingleTowerHadOverEm)|Photons:phoFull5x5SigmaIEtaIEta(F_phoFull5x5SigmaIEtaIEta)|Photons:phoAnyPFIsoWithEA(F_phoAnyPFIsoWithEA)|Photons:phoAnyPFIsoWithEAAndExpoScaling(F_phoAnyPFIsoWithEAAndExpoScaling)|Photons:phoAnyPFIsoWithEA1(F_phoAnyPFIsoWithEA1)|Photons:hasPixelSeed(b_hasPixelSeed)|Photons:passElectronVeto(b_passElectronVeto)|Photons:photonIso(F_photonIso)|Photons:neutralHadIso(F_neutralHadIso)|Photons:chargedHadIso(F_chargedHadIso)|Photons:puChargedHadIso(F_puChargedHadIso)|Photons:sigmaIetaIeta(F_sigmaIetaIeta)'] ) # photon information on various variables from SemiLeptonicWVA.TreeMaker.treeMaker import TreeMaker process.TreeMaker2 = TreeMaker.clone( TreeName = cms.string("PreSelection"), VarsRecoCand = RecoCandVector, VarsDouble = cms.vstring('WeightProducer:weight(Weight)','MHT','MET:Pt(METPt)','MET:Phi(METPhi)','MET:PtRaw(METPtRaw)','MET:PhiRaw(METPhiRaw)','MET:CaloMetPt(CaloMetPt)','MET:CaloMetPhi(CaloMetPhi)','HT','DeltaPhi:DeltaPhi1(DeltaPhi1)','DeltaPhi:DeltaPhi2(DeltaPhi2)','DeltaPhi:DeltaPhi3(DeltaPhi3)','GenEventInfo:genEventWeight(genEventWeight)','GenEventInfo:PUWeight(PUWeight)','GenEventInfo:originalWeight(originalWeight)'), VarsInt = cms.vstring('NJets','BTags','NVtx','GenEventInfo:npT(npT)','FilterProducer:passFilterHBHE(passFilterHBHE)','FilterProducer:passFilterHBHEIso(passFilterHBHEIso)','FilterProducer:passFilterCSCHalo(passFilterCSCHalo)','FilterProducer:passFilterGoodVtx(passFilterGoodVtx)','FilterProducer:passFilterEEBadSC(passFilterEEBadSC)','FilterProducer:passFilterHBHELooseRerun(passFilterHBHELooseRerun)','FilterProducer:passFilterHBHETightRerun(passFilterHBHETightRerun)','FilterProducer:passFilterHBHEIsoRerun(passFilterHBHEIsoRerun)'), debug = debug, ) process.TreeMaker2.VarsDouble.extend(['MET:PtDefault(METPtDefault)','MET:PhiDefault(METPhiDefault)','MET:PtType1(METPtType1)','MET:PhiType1(METPhiType1)','MET:PtType1XYSmear(METPtType1XYSmear)','MET:PhiType1XYSmear(METPhiType1XYSmear)','MET:PtType1Smear(METPtType1Smear)','MET:PhiType1Smear(METPhiType1Smear)','MET:PtType1XY(METPtType1XY)','MET:PhiType1XY(METPhiType1XY)']) process.TreeMaker2.VectorBool.extend(['TriggerProducer:TriggerPass']) process.TreeMaker2.VectorInt.extend(['TriggerProducer:TriggerPrescales']) process.TreeMaker2.VectorDouble.extend(['GenEventInfo:AQGCweights']) process.TreeMaker2.VectorString.extend(['TriggerProducer:TriggerNames']) ## --- Final paths ---------------------------------------------------- process.out = cms.OutputModule("PoolOutputModule", fileName = cms.untracked.string("output.root"), ) process.dump = cms.EDAnalyzer("EventContentAnalyzer") process.WriteTree = cms.Path( process.TriggerProducer* ### MET Filter Bits process.HBHENoiseFilterResultProducer* process.FilterProducer* #this now contains all the met filters ### rest of ntupling starts after here process.filterSeq * process.GenEventInfo * process.Muons * process.egmGsfElectronIDSequence* process.Electrons * process.egmPhotonIDSequence * process.Photons * process.WeightProducer * process.IsolatedTracks * process.substructureSequenceGen * process.softdropGen_onMiniAOD * process.pruningGen_onMiniAOD * process.redoGenJets* process.GenJetsAK8 * process.puppi_onMiniAOD * process.substructureSequence * process.softdrop_onMiniAOD * process.pruning_onMiniAOD * process.redoPatJets* process.redoPuppiJets* process.HTJets * process.HT * process.NJets * process.BTags * process.MHTJets * process.MHTJetsProperties * process.JetsProperties * process.MHTJetsAK8 * process.MHTJetsPropertiesAK8 * process.JetsPropertiesAK8 * process.MHT * process.MET * process.DeltaPhi * process.NVtx * process.GenLeptons * process.GenJets * process.TreeMaker2 )
import FWCore.ParameterSet.Config as cms from RecoJets.JetProducers.ak4GenJets_cfi import ak4GenJets from RecoJets.JetProducers.ak8GenJets_cfi import ak8GenJets from RecoHI.HiJetAlgos.HiGenJets_cff import * ak4GenJetsNoNu = ak4GenJets.clone( src = cms.InputTag("genParticlesForJetsNoNu") ) ak8GenJetsNoNu = ak8GenJets.clone( src = cms.InputTag("genParticlesForJetsNoNu") ) ak4GenJetsNoMuNoNu = ak4GenJets.clone( src = cms.InputTag("genParticlesForJetsNoMuNoNu") ) ak8GenJetsNoMuNoNu = ak8GenJets.clone( src = cms.InputTag("genParticlesForJetsNoMuNoNu") ) recoGenJetsTask = cms.Task(ak4GenJets, ak8GenJets, ak4GenJetsNoNu, ak8GenJetsNoNu ) recoGenJets = cms.Sequence(recoGenJetsTask) recoAllGenJets=cms.Sequence(ak4GenJets+ ak8GenJets) recoAllGenJetsNoNu=cms.Sequence(ak4GenJetsNoNu+ ak8GenJetsNoNu) recoAllGenJetsNoMuNoNu=cms.Sequence(ak4GenJetsNoMuNoNu+ ak8GenJetsNoMuNoNu)
import FWCore.ParameterSet.Config as cms from RecoJets.JetProducers.ak4GenJets_cfi import ak4GenJets from RecoJets.JetProducers.ak4PFJetsPuppi_cfi import ak4PFJetsPuppi from RecoJets.JetProducers.ak4PFJets_cfi import ak4PFJets #PFCHS pfCHS = cms.EDFilter("CandPtrSelector", src=cms.InputTag("packedPFCandidates"), cut=cms.string("fromPV")) # make GEN jets AK4GenJets = ak4GenJets.clone(rParam=0.4) AK4GenJets.src = cms.InputTag('packedGenParticles') AK8GenJets = ak4GenJets.clone(rParam=0.8) AK8GenJets.src = cms.InputTag('packedGenParticles') AK4PFchsJets = ak4PFJets.clone() AK4PFchsJets.src = cms.InputTag('pfCHS', '', 'JRA') AK8PFchsJets = ak4PFJets.clone(rParam=0.8) AK8PFchsJets.src = cms.InputTag('pfCHS', '', 'JRA') AK4PFJetsPuppi = ak4PFJetsPuppi.clone() AK4PFJetsPuppi.src = cms.InputTag('puppi', '', 'JRA') #PFJetParameters AK8PFJetsPuppi = ak4PFJetsPuppi.clone(rParam=0.8) AK8PFJetsPuppi.src = cms.InputTag('puppi', '', 'JRA') #PFJetParameters
def genHFTool(process, useMiniAOD=True): # Setting input particle collections to be used by the tools genParticleCollection = '' genJetCollection = 'ak4GenJetsCustom' if useMiniAOD: genParticleCollection = 'prunedGenParticles' genJetCollection = 'slimmedGenJets' else: genParticleCollection = 'genParticles' ## producing a subset of genParticles to be used for jet reclustering from RecoJets.Configuration.GenJetParticles_cff import genParticlesForJetsNoNu process.genParticlesForJetsCustom = genParticlesForJetsNoNu.clone( src=genParticleCollection) # Producing own jets for testing purposes from RecoJets.JetProducers.ak4GenJets_cfi import ak4GenJets process.ak4GenJetsCustom = ak4GenJets.clone( src='genParticlesForJetsCustom', rParam=cms.double(0.4), jetAlgorithm=cms.string("AntiKt")) # Supplies PDG ID to real name resolution of MC particles process.load("SimGeneral.HepPDTESSource.pythiapdt_cfi") # Ghost particle collection used for Hadron-Jet association # MUST use proper input particle collection process.load("PhysicsTools.JetMCAlgos.HadronAndPartonSelector_cfi") process.selectedHadronsAndPartons.particles = genParticleCollection ## Input particle collection for matching to gen jets (partons + leptons) # MUST use use proper input jet collection: the jets to which hadrons should be associated # rParam and jetAlgorithm MUST match those used for jets to be associated with hadrons # More details on the tool: https://twiki.cern.ch/twiki/bin/view/CMSPublic/SWGuideBTagMCTools#New_jet_flavour_definition from PhysicsTools.JetMCAlgos.AK4PFJetsMCFlavourInfos_cfi import ak4JetFlavourInfos process.genJetFlavourInfos = ak4JetFlavourInfos.clone( jets=genJetCollection) #for cmssw_7_6_X, not ready for 74x #process.load("PhysicsTools.JetMCAlgos.GenHFHadronMatcher_cff") #added the 3-lines instead of GenHFHadronMatcher_cff from PhysicsTools.JetMCAlgos.GenHFHadronMatcher_cfi import matchGenHFHadron process.matchGenBHadron = matchGenHFHadron.clone(flavour=5) process.matchGenCHadron = matchGenHFHadron.clone(flavour=4) ## Plugin for analysing B hadrons # MUST use the same particle collection as in selectedHadronsAndPartons process.matchGenBHadron.genParticles = genParticleCollection process.matchGenBHadron.jetFlavourInfos = "genJetFlavourInfos" ## Plugin for analysing C hadrons # MUST use the same particle collection as in selectedHadronsAndPartons process.matchGenCHadron.genParticles = genParticleCollection process.matchGenCHadron.jetFlavourInfos = "genJetFlavourInfos" process.load("TopQuarkAnalysis.TopTools.GenTtbarCategorizer_cfi") process.GenTtbarCategories = process.categorizeGenTtbar.clone( genJets=cms.InputTag(genJetCollection), genJetPtMin=cms.double(20.)) process.GenTtbarCategories30 = process.categorizeGenTtbar.clone( genJets=cms.InputTag(genJetCollection), genJetPtMin=cms.double(30.)) process.GenTtbarCategories40 = process.categorizeGenTtbar.clone( genJets=cms.InputTag(genJetCollection), genJetPtMin=cms.double(40.)) process.catGenTops.genJetLabel = genJetCollection process.catGenTops.mcParticleLabel = genParticleCollection
process.updatedPatJetsTransientCorrectedDeepFlavour.addTagInfos = cms.bool(True) process.updatedPatJetsTransientCorrectedDeepFlavour.addBTagInfo = cms.bool(True) else: raise ValueError('I could not find updatedPatJetsTransientCorrectedDeepFlavour to embed the tagInfos, please check the cfg') # QGLikelihood process.load("DeepNTuples.DeepNtuplizer.QGLikelihood_cfi") process.es_prefer_jec = cms.ESPrefer("PoolDBESSource", "QGPoolDBESSource") process.load('RecoJets.JetProducers.QGTagger_cfi') process.QGTagger.srcJets = cms.InputTag("selectedUpdatedPatJetsDeepFlavour") process.QGTagger.jetsLabel = cms.string('QGL_AK4PFchs') from RecoJets.JetProducers.ak4GenJets_cfi import ak4GenJets process.ak4GenJetsWithNu = ak4GenJets.clone(src = 'packedGenParticles') ## Filter out neutrinos from packed GenParticles process.packedGenParticlesForJetsNoNu = cms.EDFilter("CandPtrSelector", src = cms.InputTag("packedGenParticles"), cut = cms.string("abs(pdgId) != 12 && abs(pdgId) != 14 && abs(pdgId) != 16")) ## Define GenJets process.ak4GenJetsRecluster = ak4GenJets.clone(src = 'packedGenParticlesForJetsNoNu') process.patGenJetMatchWithNu = cms.EDProducer("GenJetMatcher", # cut on deltaR; pick best by deltaR src = cms.InputTag("selectedUpdatedPatJetsDeepFlavour"), # RECO jets (any View<Jet> is ok) matched = cms.InputTag("ak4GenJetsWithNu"), # GEN jets (must be GenJetCollection) mcPdgId = cms.vint32(), # n/a mcStatus = cms.vint32(), # n/a checkCharge = cms.bool(False), # n/a maxDeltaR = cms.double(0.4), # Minimum deltaR for the match #maxDPtRel = cms.double(3.0), # Minimum deltaPt/Pt for the match (not used in GenJetMatcher)
veto=cms.InputTag("selectedElectrons")) process.pfNoMuon = cms.EDProducer("CandPtrProjector", src=cms.InputTag("packedPFCandidates"), veto=cms.InputTag("selectedMuons")) process.pfNoElectrons = cms.EDProducer("CandPtrProjector", src=cms.InputTag("pfNoMuon"), veto=cms.InputTag("selectedElectrons")) process.ak4PFJets = ak4PFJets.clone( src='pfNoElectrons', doAreaFastjet=True ) # no idea while doArea is false by default, but it's True in RECO so we have to set it process.ak4PFJetsCHS = ak4PFJets.clone( src='pfNoElectronsCHS', doAreaFastjet=True ) # no idea while doArea is false by default, but it's True in RECO so we have to set it process.ak4GenJets = ak4GenJets.clone(src='packedGenParticles') # The following is make patJets, but EI is done with the above process.load("PhysicsTools.PatAlgos.producersLayer1.patCandidates_cff") process.load("Configuration.EventContent.EventContent_cff") process.load('Configuration.StandardSequences.Geometry_cff') process.load('Configuration.StandardSequences.MagneticField_38T_cff') process.load( 'Configuration.StandardSequences.FrontierConditions_GlobalTag_cff') process.GlobalTag.globaltag = 'POSTLS172_V3::All' from PhysicsTools.PatAlgos.tools.jetTools import addJetCollection addJetCollection(process, postfix="", labelName='AK4PFCHS', jetSource=cms.InputTag('ak4PFJetsCHS'),
from RecoJets.JetProducers.ak4GenJets_cfi import ak4GenJets from RecoMET.METProducers.PFMET_cfi import pfMet ## --- Selection sequences --------------------------------------------- # leptons process.load("PhysicsTools.PatAlgos.selectionLayer1.muonCountFilter_cfi") process.load("PhysicsTools.PatAlgos.selectionLayer1.electronCountFilter_cfi") ## Filter out neutrinos from packed GenParticles process.packedGenParticlesForJetsNoNu = cms.EDFilter( "CandPtrSelector", src=cms.InputTag("packedGenParticles"), cut=cms.string("abs(pdgId) != 12 && abs(pdgId) != 14 && abs(pdgId) != 16")) ## Define GenJets from RecoJets.JetProducers.ak5GenJets_cfi import ak5GenJets process.ak4GenJetsNoNu = ak4GenJets.clone(src='packedGenParticlesForJetsNoNu') #do projections process.pfCHS = cms.EDFilter("CandPtrSelector", src=cms.InputTag("packedPFCandidates"), cut=cms.string("fromPV")) process.ak4PFJetsCHS = ak4PFJets.clone( src='pfCHS', doAreaFastjet=True ) # no idea while doArea is false by default, but it's True in RECO so we have to set it process.ak4GenJets = ak4GenJets.clone(src='packedGenParticles', rParam=0.4) process.pfMet = pfMet.clone(src="packedPFCandidates") process.pfMet.calculateSignificance = False # this can't be easily implemented on packed PF candidates at the moment process.load("SusyAnaTools.SkimsAUX.prodMuons_cfi")
#process.GlobalTag.ReconnectEachRun = cms.untracked.bool( False ) ### ### AK8 jets with subjet b-tagging ### ## Filter out neutrinos from packed GenParticles process.packedGenParticlesForJetsNoNu = cms.EDFilter("CandPtrSelector", src = cms.InputTag("packedGenParticles"), cut = cms.string("abs(pdgId) != 12 && abs(pdgId) != 14 && abs(pdgId) != 16") ) ## Fat GenJets from RecoJets.JetProducers.ak4GenJets_cfi import ak4GenJets process.ak8GenJetsNoNu = ak4GenJets.clone( rParam = cms.double(0.8), src = cms.InputTag("packedGenParticlesForJetsNoNu") ) ## Pruned fat GenJets (two jet collections are produced, fat jets and subjets) from RecoJets.JetProducers.SubJetParameters_cfi import SubJetParameters process.ak8GenJetsNoNuPruned = ak4GenJets.clone( SubJetParameters, rParam = cms.double(0.8), src = cms.InputTag("packedGenParticlesForJetsNoNu"), usePruning = cms.bool(True), writeCompound = cms.bool(True), jetCollInstanceName=cms.string("SubJets") ) ## Select charged hadron subtracted packed PF candidates process.pfCHS = cms.EDFilter("CandPtrSelector",
process.task = cms.Task() ## Set input particle collections to be used by the tools genParticleCollection = '' genJetCollection = '' if options.runOnAOD: genParticleCollection = 'genParticles' genJetCollection = 'ak4GenJetsCustom' ## producing a subset of genParticles to be used for jet clustering in AOD from RecoJets.Configuration.GenJetParticles_cff import genParticlesForJetsNoNu process.genParticlesForJetsCustom = genParticlesForJetsNoNu.clone() process.task.add(process.genParticlesForJetsCustom) ## Produce own jets (re-clustering in miniAOD needed at present to avoid crash) from RecoJets.JetProducers.ak4GenJets_cfi import ak4GenJets process.ak4GenJetsCustom = ak4GenJets.clone( src='genParticlesForJetsCustom', rParam=cms.double(0.4), jetAlgorithm=cms.string("AntiKt")) process.task.add(process.ak4GenJetsCustom) else: genParticleCollection = 'prunedGenParticles' genJetCollection = 'slimmedGenJets' ## Supplies PDG ID to real name resolution of MC particles process.load("SimGeneral.HepPDTESSource.pythiapdt_cfi") ## Ghost particle collection used for Hadron-Jet association # MUST use proper input particle collection from PhysicsTools.JetMCAlgos.HadronAndPartonSelector_cfi import selectedHadronsAndPartons process.selectedHadronsAndPartons = selectedHadronsAndPartons.clone( particles=genParticleCollection)
import FWCore.ParameterSet.Config as cms from RecoJets.JetProducers.ak4GenJets_cfi import ak4GenJets ak8GenJets = ak4GenJets.clone(rParam=cms.double(0.8)) ak8GenJetsSoftDrop = ak8GenJets.clone( useSoftDrop=cms.bool(True), zcut=cms.double(0.1), beta=cms.double(0.0), R0=cms.double(0.8), useExplicitGhosts=cms.bool(True), writeCompound=cms.bool(True), jetCollInstanceName=cms.string("SubJets"), jetPtMin=100.0) ak8GenJetsConstituents = cms.EDProducer("GenJetConstituentSelector", src=cms.InputTag("ak8GenJets"), cut=cms.string("pt > 100.0"))
max(0.,pfIsolationVariables().sumNeutralHadronEt+ pfIsolationVariables().sumPhotonEt- 0.5*pfIsolationVariables().sumPUPt))/pt < 0.20''')) process.selectedIDElectrons = cms.EDFilter("CandPtrSelector", src = cms.InputTag("slimmedElectrons"), cut = cms.string('''abs(eta)<2.5 && pt>5. && gsfTrack.isAvailable() && gsfTrack.hitPattern().numberOfLostHits('MISSING_INNER_HITS')<2''')) #do projections process.pfCHS = cms.EDFilter("CandPtrSelector", src = cms.InputTag("packedPFCandidates"), cut = cms.string("fromPV")) process.pfNoMuonCHS = cms.EDProducer("CandPtrProjector", src = cms.InputTag("pfCHS"), veto = cms.InputTag("selectedMuons")) process.pfNoElectronsCHS = cms.EDProducer("CandPtrProjector", src = cms.InputTag("pfNoMuonCHS"), veto = cms.InputTag("selectedElectrons")) process.pfNoMuon = cms.EDProducer("CandPtrProjector", src = cms.InputTag("packedPFCandidates"), veto = cms.InputTag("selectedMuons")) process.pfNoElectrons = cms.EDProducer("CandPtrProjector", src = cms.InputTag("pfNoMuon"), veto = cms.InputTag("selectedElectrons")) process.ak4GenJets = ak4GenJets.clone(src = 'packedGenParticles', rParam = 0.4) process.pfMet = pfMet.clone(src = "packedPFCandidates") process.pfMet.calculateSignificance = False # this can't be easily implemented on packed PF candidates at the moment #from PhysicsTools.PatAlgos.producersLayer1.metProducer_cfi import patMETs process.load('PhysicsTools.PatAlgos.producersLayer1.metProducer_cfi') #from JetMETCorrections.Type1MET.pfMETCorrections_cff import * from JetMETCorrections.Type1MET.correctionTermsPfMetType1Type2_cff import * from PhysicsTools.PatUtils.patPFMETCorrections_cff import patPFJetMETtype1p2Corr process.patMETs.addGenMET = cms.bool(False) #process.patpfType1CorrectedMet = pfType1CorrectedMet.clone( # #)
## Details in: PhysicsTools/JetExamples/test/printJetFlavourInfo.cc, PhysicsTools/JetExamples/test/printJetFlavourInfo.py ## and in: https://twiki.cern.ch/twiki/bin/view/CMSPublic/SWGuideBTagMCTools#New_jet_flavour_definition ## Supply PDG ID to real name resolution of MC particles process.load("SimGeneral.HepPDTESSource.pythiapdt_cfi") ## Input particles for gen jets (stable gen particles to be used in clustering, excluding electrons, muons and neutrinos from hard interaction) from RecoJets.Configuration.GenJetParticles_cff import genParticlesForJets process.genParticlesForJetsNoNuNoLepton = genParticlesForJets.clone( src=genJetInputParticleCollection, excludeResonances=True, excludeFromResonancePids=[11, 12, 13, 14, 16], ) from RecoJets.JetProducers.ak4GenJets_cfi import ak4GenJets process.ak4GenJetsNoNuNoLepton = ak4GenJets.clone( src="genParticlesForJetsNoNuNoLepton") # Ghost particle collection for matching to gen jets (b/c hadrons + leptons) from PhysicsTools.JetMCAlgos.HadronAndPartonSelector_cfi import selectedHadronsAndPartons process.selectedHadronsAndPartons = selectedHadronsAndPartons.clone( particles=genParticleCollection) # Flavour info: jet collection with all associated ghosts # For the moment leptons need to be specified explicitely here, until lepton access can be made more generic in miniAOD # This is only needed as long as the jetConstituents are not accessible directly in miniAOD, then it should be fixed # by using the leptons from the constituents, instead of feeding them as ghosts into the jets from PhysicsTools.JetMCAlgos.AK4PFJetsMCFlavourInfos_cfi import ak4JetFlavourInfos process.ak4GenJetFlavourPlusLeptonInfos = ak4JetFlavourInfos.clone( jets=genJetCollection, leptons=cms.InputTag("selectedHadronsAndPartons", "leptons"))
process.GlobalTag.globaltag = options.globalTag ################################################# ## After 7.4.0, only need to make AK8 gen jets. ## The rest are stored by default in MiniAOD directly. ################################################# ## Filter out neutrinos from packed GenParticles process.packedGenParticlesForJetsNoNu = cms.EDFilter( "CandPtrSelector", src=cms.InputTag("packedGenParticles"), cut=cms.string("abs(pdgId) != 12 && abs(pdgId) != 14 && abs(pdgId) != 16")) ## Fat GenJets from RecoJets.JetProducers.ak4GenJets_cfi import ak4GenJets process.ak8GenJetsNoNu = ak4GenJets.clone( rParam=cms.double(0.8), src=cms.InputTag("packedGenParticlesForJetsNoNu")) ## SoftDrop fat GenJets (two jet collections are produced, fat jets and subjets) from RecoJets.JetProducers.SubJetParameters_cfi import SubJetParameters from RecoJets.JetProducers.ak4GenJets_cfi import ak4GenJets process.ak8GenJetsNoNuSoftDrop = ak4GenJets.clone( rParam=cms.double(0.8), src=cms.InputTag("packedGenParticlesForJetsNoNu"), useSoftDrop=cms.bool(True), zcut=cms.double(0.1), beta=cms.double(0.0), R0=cms.double(0.8), useExplicitGhosts=cms.bool(True), writeCompound=cms.bool(True), jetCollInstanceName=cms.string("SubJets"))
############## output edm format ############### process.out = cms.OutputModule( 'PoolOutputModule', fileName=cms.untracked.string('jettoolbox.root'), outputCommands=cms.untracked.vstring([ 'keep *_slimmedJets_*_*', 'keep *_slimmedJetsAK8_*_*', ])) # Added 'vertexRef().isNonnull() &&' check for 80X data compatibility. Juska process.chs = cms.EDFilter('CandPtrSelector', src=cms.InputTag('packedPFCandidates'), cut=cms.string(' fromPV')) from RecoJets.JetProducers.ak4GenJets_cfi import ak4GenJets process.slimmedGenJetsAK8 = ak4GenJets.clone(src='packedGenParticles', rParam=0.8) #------------------------------------------------------- # Gen Particles Pruner process.load("SimGeneral.HepPDTESSource.pythiapdt_cfi") process.prunedGenParticlesDijet = cms.EDProducer( 'GenParticlePruner', src=cms.InputTag("prunedGenParticles"), select=cms.vstring( "drop * ", # by default "keep ( status = 3 || (status>=21 && status<=29) )", # keep hard process particles )) #------------- Recluster Gen Jets to access the constituents ------- #already in toolbox, just add keep statements
process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff") from Configuration.AlCa.GlobalTag import GlobalTag process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:run2_mc') # + ('data' if options.runOnData else 'mc')) process.load("Configuration.StandardSequences.MagneticField_cff") process.load("Configuration.Geometry.GeometryRecoDB_cff") from RecoJets.JetProducers.ak4PFJets_cfi import ak4PFJets from RecoJets.JetProducers.ak4GenJets_cfi import ak4GenJets ## Do projections #process.pfCHS = cms.EDFilter("CandPtrSelector", src = cms.InputTag("packedPFCandidates"), cut = cms.string("fromPV")) process.packedGenParticlesForJetsNoNu = cms.EDFilter("CandPtrSelector", src = cms.InputTag("packedGenParticles"), cut = cms.string("abs(pdgId) != 12 && abs(pdgId) != 14 && abs(pdgId) != 16")) process.ak4GenJetsNoNu = ak4GenJets.clone(src = 'packedGenParticlesForJetsNoNu') from PhysicsTools.PatAlgos.tools.jetTools import * ## Switch the default jet collection (done in order to use the above specified b-tag infos and discriminators) switchJetCollection( process, jetSource = cms.InputTag(jetSource), pfCandidates = cms.InputTag(pfCandidates), pvSource = cms.InputTag(pvSource), svSource = cms.InputTag(svSource), #muSource = cms.InputTag(muSource), #elSource = cms.InputTag(elSource), btagInfos = bTagInfos, btagDiscriminators = bTagDiscriminators, jetCorrections = jetCorrectionsAK4,
def makeFatJets(process, isData, pfCandidates, algoLabel, jetRadius): isMC = not isData postfix = 'PFlow' if pfCandidates == 'particleFlow': # mini aod needs a different config pfCandidates = 'pfCHS' if pfCandidates == 'pfCHS': puMethod = 'chs' else: puMethod = 'puppi' rLabel = algoLabel + str(int(jetRadius * 10)) #customLabel = rLabel+puMethod customLabel = puMethod + rLabel if algoLabel == 'CA': jetAlgo = 'CambridgeAachen' else: jetAlgo = 'AntiKt' if jetRadius < 1: sdZcut = 0.1 sdBeta = 0.0 else: sdZcut = 0.15 sdBeta = 1.0 setattr(process, customLabel + 'Sequence', cms.Sequence()) newSeq = getattr(process, customLabel + 'Sequence') ## Various collection names genParticles = 'prunedGenParticles' pvSource = 'offlineSlimmedPrimaryVertices' svSource = 'slimmedSecondaryVertices' muSource = 'slimmedMuons' elSource = 'slimmedElectrons' bTagInfos = [ 'pfImpactParameterTagInfos', 'pfSecondaryVertexTagInfos', 'pfInclusiveSecondaryVertexFinderTagInfos', 'softPFMuonsTagInfos', 'softPFElectronsTagInfos' ] ## b-tag discriminators bTagDiscriminators = [ 'pfCombinedSecondaryVertexV2BJetTags', 'pfCombinedInclusiveSecondaryVertexV2BJetTags' ] bTagInfosSubjets = [ 'pfImpactParameterTagInfos', 'pfSecondaryVertexTagInfos', 'pfInclusiveSecondaryVertexFinderTagInfos', 'softPFMuonsTagInfos', 'softPFElectronsTagInfos' ] ## b-tag discriminators bTagDiscriminatorsSubjets = [ 'pfCombinedSecondaryVertexV2BJetTags', 'pfCombinedInclusiveSecondaryVertexV2BJetTags' ] bTagInfosSubjets = ['None'] bTagDiscriminatorsSubjets = ['None'] ### jet clustering ### ######################################## ## REMAKE JETS ## ######################################## addingGenJets = False if not (hasattr(process, "genJetsNoNu" + rLabel)) and isMC: addingGenJets = True setattr( process, "genJetsNoNu" + rLabel, ak4GenJets.clone( jetAlgorithm=cms.string(jetAlgo), rParam=cms.double(jetRadius), src=cms.InputTag("packedGenParticlesForJetsNoNu"))) setattr( process, "PFJets" + customLabel, ak4PFJets.clone(jetAlgorithm=cms.string(jetAlgo), rParam=cms.double(jetRadius), src=cms.InputTag(pfCandidates), jetPtMin=cms.double(180))) if not (hasattr(process, "genJetsNoNuSoftDrop" + rLabel)) and isMC: addingGenJets = True setattr( process, "genJetsNoNuSoftDrop" + rLabel, getattr(process, 'genJetsNoNu' + rLabel).clone( R0=cms.double(jetRadius), useSoftDrop=cms.bool(True), zcut=cms.double(sdZcut), beta=cms.double(sdBeta), writeCompound=cms.bool(True), useExplicitGhosts=cms.bool(True), jetCollInstanceName=cms.string("SubJets"))) setattr( process, "PFJets" + "SoftDrop" + customLabel, getattr(process, 'PFJets' + customLabel).clone( useSoftDrop=cms.bool(True), R0=cms.double(jetRadius), zcut=cms.double(sdZcut), beta=cms.double(sdBeta), writeCompound=cms.bool(True), useExplicitGhosts=cms.bool(True), jetCollInstanceName=cms.string("SubJets"), jetPtMin=cms.double(180))) process.dump = cms.EDAnalyzer("EventContentAnalyzer") if addingGenJets and not (isData): print 'addingGenJets', 'genJetsNoNu' + rLabel newSeq += getattr(process, 'genJetsNoNu' + rLabel) newSeq += getattr(process, 'genJetsNoNuSoftDrop' + rLabel) newSeq += getattr(process, 'PFJets' + customLabel) newSeq += getattr(process, 'PFJets' + "SoftDrop" + customLabel) ######################################## ## SUBSTRUCTURE ## ####################################### setattr( process, customLabel + 'Njettiness', Njettiness.clone(src=cms.InputTag('PFJets' + customLabel), R0=cms.double(jetRadius), Njets=cms.vuint32(1, 2, 3, 4))) setattr( process, customLabel + 'SDKinematics', cms.EDProducer( 'RecoJetDeltaRValueMapProducer', src=cms.InputTag('PFJets' + customLabel), matched=cms.InputTag('PFJets' + "SoftDrop" + customLabel), distMax=cms.double(1.5), values=cms.vstring('mass'), valueLabels=cms.vstring('Mass'), )) newSeq += getattr(process, customLabel + 'SDKinematics') newSeq += getattr(process, customLabel + 'Njettiness') ### subjet qg-tagging ### setattr( process, customLabel + 'SubQGTag', QGTagger.clone(srcJets=cms.InputTag( 'PFJets' + "SoftDrop" + customLabel, 'SubJets'), jetsLabel=cms.string('QGL_AK4PFchs'))) newSeq += getattr(process, customLabel + 'SubQGTag') ### subjet b-tagging ### setattr( process, customLabel + 'PFImpactParameterTagInfos', pfImpactParameterTagInfos.clone( jets=cms.InputTag('PFJets' + "SoftDrop" + customLabel, 'SubJets'), maxDeltaR=cms.double(0.4), primaryVertex=cms.InputTag('offlineSlimmedPrimaryVertices'), candidates=cms.InputTag('packedPFCandidates'))) setattr( process, customLabel + 'PFInclusiveSecondaryVertexFinderTagInfos', pfInclusiveSecondaryVertexFinderTagInfos.clone( trackIPTagInfos=cms.InputTag(customLabel + 'PFImpactParameterTagInfos'), extSVCollection=cms.InputTag('slimmedSecondaryVertices'))) setattr( process, customLabel + 'PFCombinedInclusiveSecondaryVertexV2BJetTags', pfCombinedInclusiveSecondaryVertexV2BJetTags.clone( tagInfos=cms.VInputTag( cms.InputTag(customLabel + "PFImpactParameterTagInfos"), cms.InputTag(customLabel + "PFInclusiveSecondaryVertexFinderTagInfos")))) newSeq += getattr(process, customLabel + 'PFImpactParameterTagInfos') newSeq += getattr(process, customLabel + 'PFInclusiveSecondaryVertexFinderTagInfos') newSeq += getattr( process, customLabel + 'PFCombinedInclusiveSecondaryVertexV2BJetTags') bTagInfos = ['None'] bTagDiscriminators = ['None'] ######################################## ## MAKE PAT JETS ## ######################################## addJetCollection( process, labelName='PF' + customLabel, jetSource=cms.InputTag('PFJets' + customLabel), algo=algoLabel, # needed for jet flavor clustering rParam=jetRadius, # needed for jet flavor clustering pfCandidates=cms.InputTag('packedPFCandidates'), pvSource=cms.InputTag(pvSource), svSource=cms.InputTag(svSource), muSource=cms.InputTag(muSource), elSource=cms.InputTag(elSource), btagInfos=bTagInfos, btagDiscriminators=bTagDiscriminators, genJetCollection=cms.InputTag('genJetsNoNu' + rLabel), genParticles=cms.InputTag(genParticles), getJetMCFlavour=False, # jet flavor disabled ) getattr(process, 'selectedPatJetsPF' + customLabel).cut = cms.string("abs(eta) < " + str(2.5)) ## SOFT DROP ## addJetCollection( process, labelName='SoftDropPF' + customLabel, jetSource=cms.InputTag('PFJets' + "SoftDrop" + customLabel), pfCandidates=cms.InputTag('packedPFCandidates'), algo=algoLabel, rParam=jetRadius, btagInfos=['None'], btagDiscriminators=['None'], genJetCollection=cms.InputTag('genJetsNoNu' + rLabel), genParticles=cms.InputTag(genParticles), getJetMCFlavour=False, # jet flavor disabled ) addJetCollection( process, labelName='SoftDropSubjetsPF' + customLabel, jetSource=cms.InputTag('PFJets' + "SoftDrop" + customLabel, 'SubJets'), algo=algoLabel, rParam=jetRadius, pfCandidates=cms.InputTag('packedPFCandidates'), pvSource=cms.InputTag(pvSource), svSource=cms.InputTag(svSource), muSource=cms.InputTag(muSource), elSource=cms.InputTag(elSource), btagInfos=bTagInfosSubjets, btagDiscriminators=bTagDiscriminatorsSubjets, genJetCollection=cms.InputTag('genJetsNoNuSoftDrop' + rLabel, 'SubJets'), genParticles=cms.InputTag(genParticles), explicitJTA=True, # needed for subjet b tagging svClustering=True, # needed for subjet b tagging fatJets=cms.InputTag( 'PFJets' + customLabel), # needed for subjet flavor clustering groomedFatJets=cms.InputTag( 'PFJets' + "SoftDrop" + customLabel), # needed for subjet flavor clustering runIVF=False, getJetMCFlavour=False, # jet flavor disabled ) isMC = not (isData) if isMC: newSeq += getattr(process, 'patJetPartonMatchPF' + customLabel) newSeq += getattr(process, 'patJetGenJetMatchPF' + customLabel) newSeq += getattr(process, 'patJetsPF' + customLabel) newSeq += getattr(process, 'selectedPatJetsPF' + customLabel) if isMC: newSeq += getattr(process, 'patJetPartonMatchSoftDropPF' + customLabel) newSeq += getattr(process, 'patJetGenJetMatchSoftDropPF' + customLabel) newSeq += getattr(process, 'patJetsSoftDropPF' + customLabel) newSeq += getattr(process, 'selectedPatJetsSoftDropPF' + customLabel) if isMC: newSeq += getattr(process, 'patJetPartonMatchSoftDropSubjetsPF' + customLabel) newSeq += getattr(process, 'patJetGenJetMatchSoftDropSubjetsPF' + customLabel) newSeq += getattr(process, 'patJetsSoftDropSubjetsPF' + customLabel) newSeq += getattr(process, 'selectedPatJetsSoftDropSubjetsPF' + customLabel) setattr( process, "selectedPatJetsSoftDropPF" + "Packed" + customLabel, cms.EDProducer( "BoostedJetMerger", jetSrc=cms.InputTag("selectedPatJetsSoftDropPF" + customLabel), subjetSrc=cms.InputTag("selectedPatJetsSoftDropSubjetsPF" + customLabel))) ## PACK ## setattr( process, "packedPatJetsPF" + customLabel, cms.EDProducer("JetSubstructurePacker", jetSrc=cms.InputTag('selectedPatJetsPF' + customLabel), distMax=cms.double(jetRadius), algoTags=cms.VInputTag(), algoLabels=cms.vstring(), fixDaughters=cms.bool(False))) getattr(process, "packedPatJetsPF" + customLabel).algoTags.append( cms.InputTag('selectedPatJetsSoftDropPF' + "Packed" + customLabel)) getattr(process, "packedPatJetsPF" + customLabel).algoLabels.append('SoftDrop') getattr(process, 'patJetsPF' + customLabel).userData.userFloats.src += [ customLabel + 'Njettiness:tau1' ] getattr(process, 'patJetsPF' + customLabel).userData.userFloats.src += [ customLabel + 'Njettiness:tau2' ] getattr(process, 'patJetsPF' + customLabel).userData.userFloats.src += [ customLabel + 'Njettiness:tau3' ] getattr(process, 'patJetsPF' + customLabel).userData.userFloats.src += [ customLabel + 'Njettiness:tau4' ] getattr(process, 'patJetsPF' + customLabel).userData.userFloats.src += [ customLabel + 'SDKinematics:Mass' ] for m in [ 'patJetsPF' + customLabel, 'patJetsSoftDropSubjetsPF' + customLabel ]: if hasattr(process, m) and getattr(getattr(process, m), 'addBTagInfo'): setattr(getattr(process, m), 'addTagInfos', cms.bool(True)) #if hasattr(process,m): # setattr( getattr(process,m), 'addJetFlavourInfo', cms.bool(True)) newSeq += cms.Sequence( getattr(process, 'selectedPatJetsSoftDropPF' + "Packed" + customLabel) + getattr(process, 'packedPatJetsPF' + customLabel)) # if isData: # toRemove = ['Photons', 'Electrons','Muons', 'Taus', 'Jets', 'METs', 'PFElectrons','PFTaus','PFMuons'] # removeMCMatching(process, toRemove, outputModules = []) return newSeq
gsfTrack.hitPattern().numberOfLostHits(\'MISSING_INNER_HITS\') < 2 && (pfIsolationVariables().sumChargedHadronPt+ max(0.,pfIsolationVariables().sumNeutralHadronEt+ pfIsolationVariables().sumPhotonEt- 0.5*pfIsolationVariables().sumPUPt))/pt < 0.15''')) ## Do projections process.pfCHS = cms.EDFilter("CandPtrSelector", src = cms.InputTag("packedPFCandidates"), cut = cms.string("fromPV")) process.pfNoMuonCHS = cms.EDProducer("CandPtrProjector", src = cms.InputTag("pfCHS"), veto = cms.InputTag("selectedMuons")) process.pfNoElectronsCHS = cms.EDProducer("CandPtrProjector", src = cms.InputTag("pfNoMuonCHS"), veto = cms.InputTag("selectedElectrons")) process.pfNoMuon = cms.EDProducer("CandPtrProjector", src = cms.InputTag("packedPFCandidates"), veto = cms.InputTag("selectedMuons")) process.pfNoElectrons = cms.EDProducer("CandPtrProjector", src = cms.InputTag("pfNoMuon"), veto = cms.InputTag("selectedElectrons")) process.packedGenParticlesForJetsNoNu = cms.EDFilter("CandPtrSelector", src = cms.InputTag("packedGenParticles"), cut = cms.string("abs(pdgId) != 12 && abs(pdgId) != 14 && abs(pdgId) != 16")) process.ak4GenJetsNoNu = ak4GenJets.clone(src = 'packedGenParticlesForJetsNoNu') if options.useTTbarFilter: if options.usePFchs: process.ak4PFJets = ak4PFJets.clone(src = 'pfCHS', doAreaFastjet = True) else: process.ak4PFJets = ak4PFJets.clone(src = 'packedPFCandidates', doAreaFastjet = True) else: if options.usePFchs: if options.useTopProjections: process.ak4PFJets = ak4PFJets.clone(src = 'pfNoElectronsCHS', doAreaFastjet = True) else: process.ak4PFJets = ak4PFJets.clone(src = 'pfCHS', doAreaFastjet = True) else: if options.useTopProjections: process.ak4PFJets = ak4PFJets.clone(src = 'pfNoElectrons', doAreaFastjet = True)