-
Notifications
You must be signed in to change notification settings - Fork 4.6k
[JME,Nano] Refactor constituents table, add GloParT WvsQCD score #47206
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 5 commits
f1bf112
2f1e918
9cabbf1
fc5f1da
8bb27f0
8ef461d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,194 @@ | ||||||||||
| import FWCore.ParameterSet.Config as cms | ||||||||||
|
|
||||||||||
| from PhysicsTools.NanoAOD.common_cff import * | ||||||||||
| from PhysicsTools.NanoAOD.jetsAK8_cff import fatJetTable as _fatJetTable | ||||||||||
|
|
||||||||||
| ############################################################## | ||||||||||
| # Take AK8 jets and collect their PF constituents | ||||||||||
| ############################################################### | ||||||||||
| finalJetsAK8PFConstituents = cms.EDProducer("PatJetConstituentPtrSelector", | ||||||||||
| src = _fatJetTable.src, | ||||||||||
| cut = cms.string("abs(eta) <= 2.5") | ||||||||||
| ) | ||||||||||
|
|
||||||||||
| selectedFinalJetsAK8PFConstituents = cms.EDFilter("PATPackedCandidatePtrSelector", | ||||||||||
| src = cms.InputTag("finalJetsAK8PFConstituents", "constituents"), | ||||||||||
| cut = cms.string("") | ||||||||||
| ) | ||||||||||
|
|
||||||||||
| ############################################################## | ||||||||||
| # Setup PF candidates table | ||||||||||
| ############################################################## | ||||||||||
| finalPFCandidates = cms.EDProducer("PackedCandidatePtrMerger", | ||||||||||
| src = cms.VInputTag(cms.InputTag("selectedFinalJetsAK8PFConstituents")), | ||||||||||
| skipNulls = cms.bool(True), | ||||||||||
| warnOnSkip = cms.bool(True) | ||||||||||
| ) | ||||||||||
|
|
||||||||||
| pfCandidatesTable = cms.EDProducer("SimplePATCandidateFlatTableProducer", | ||||||||||
| src = cms.InputTag("finalPFCandidates"), | ||||||||||
| cut = cms.string(""), | ||||||||||
| name = cms.string("PFCand"), | ||||||||||
| doc = cms.string("PF candidate constituents of AK8 puppi jets (FatJet) with |eta| <= 2.5"), | ||||||||||
| singleton = cms.bool(False), | ||||||||||
| extension = cms.bool(False), | ||||||||||
| variables = cms.PSet( | ||||||||||
| pt = Var("pt * puppiWeight()", float, doc="Puppi-weighted pt", precision=10), | ||||||||||
| mass = Var("mass * puppiWeight()", float, doc="Puppi-weighted mass", precision=10), | ||||||||||
| eta = Var("eta", float, precision=12), | ||||||||||
| phi = Var("phi", float, precision=12), | ||||||||||
| pdgId = Var("pdgId", int, doc="PF candidate type (+/-211 = ChgHad, 130 = NeuHad, 22 = Photon, +/-11 = Electron, +/-13 = Muon, 1 = HFHad, 2 = HFEM)") | ||||||||||
| ) | ||||||||||
| ) | ||||||||||
|
|
||||||||||
| ############################################################## | ||||||||||
| # Setup AK8 jet constituents table | ||||||||||
| ############################################################## | ||||||||||
| finalJetsAK8ConstituentsTable = cms.EDProducer("SimplePatJetConstituentTableProducer", | ||||||||||
| name = cms.string(_fatJetTable.name.value()+"PFCand"), | ||||||||||
| candIdxName = cms.string("pfCandIdx"), | ||||||||||
| candIdxDoc = cms.string("Index in the PFCand table"), | ||||||||||
| candidates = pfCandidatesTable.src, | ||||||||||
| jets = _fatJetTable.src, | ||||||||||
| jetCut = _fatJetTable.cut, | ||||||||||
| jetConstCut = selectedFinalJetsAK8PFConstituents.cut | ||||||||||
| ) | ||||||||||
|
|
||||||||||
| jetConstituentsTask = cms.Task(finalJetsAK8PFConstituents,selectedFinalJetsAK8PFConstituents) | ||||||||||
| jetConstituentsTablesTask = cms.Task(finalPFCandidates,pfCandidatesTable,finalJetsAK8ConstituentsTable) | ||||||||||
|
|
||||||||||
|
|
||||||||||
| def SaveAK4JetConstituents(process, jetCut="", jetConstCut=""): | ||||||||||
| """ | ||||||||||
| This function can be used as a cmsDriver customization | ||||||||||
| function to add AK4 jet constituents, on top of the AK8 | ||||||||||
| jet constituents. | ||||||||||
| """ | ||||||||||
| process.finalJetsPuppiPFConstituents = process.finalJetsAK8PFConstituents.clone( | ||||||||||
| src = process.jetPuppiTable.src, | ||||||||||
| cut = jetCut | ||||||||||
| ) | ||||||||||
| process.jetConstituentsTask.add(process.finalJetsPuppiPFConstituents) | ||||||||||
|
|
||||||||||
| process.selectedFinalJetsPuppiPFConstituents = process.selectedFinalJetsAK8PFConstituents.clone( | ||||||||||
| src = cms.InputTag("finalJetsPuppiPFConstituents", "constituents"), | ||||||||||
| cut = jetConstCut | ||||||||||
| ) | ||||||||||
| process.jetConstituentsTask.add(process.selectedFinalJetsPuppiPFConstituents) | ||||||||||
|
|
||||||||||
| process.finalPFCandidates.src += ["selectedFinalJetsPuppiPFConstituents"] | ||||||||||
| process.pfCandidatesTable.doc = pfCandidatesTable.doc.value()+" and AK4 puppi jets (Jet)" | ||||||||||
|
|
||||||||||
| process.finalJetsPuppiConstituentsTable = process.finalJetsAK8ConstituentsTable.clone( | ||||||||||
| name = process.jetPuppiTable.name.value()+"PFCand", | ||||||||||
| jets = process.jetPuppiTable.src, | ||||||||||
| jetCut = process.jetPuppiTable.cut, | ||||||||||
| jetConstCut = process.selectedFinalJetsPuppiPFConstituents.cut | ||||||||||
| ) | ||||||||||
| process.jetConstituentsTablesTask.add(process.finalJetsPuppiConstituentsTable) | ||||||||||
|
|
||||||||||
| return process | ||||||||||
|
|
||||||||||
| def SaveGenJetConstituents(process, addGenJetConst, addGenJetAK8Const, genJetConstCut="",genJetAK8ConstCut=""): | ||||||||||
| """ | ||||||||||
| This function can be used as a cmsDriver | ||||||||||
| customization function to add gen jet | ||||||||||
| constituents. | ||||||||||
| """ | ||||||||||
| process.genjetConstituentsTask = cms.Task() | ||||||||||
| process.genjetConstituentsTableTask = cms.Task() | ||||||||||
|
|
||||||||||
| if addGenJetConst: | ||||||||||
| process.genJetConstituents = cms.EDProducer("GenJetPackedConstituentPtrSelector", | ||||||||||
| src = process.genJetTable.src, | ||||||||||
| cut = process.genJetTable.cut, | ||||||||||
| ) | ||||||||||
| process.genjetConstituentsTask.add(process.genJetConstituents) | ||||||||||
|
|
||||||||||
| process.selectedGenJetConstituents = cms.EDFilter("PATPackedGenParticlePtrSelector", | ||||||||||
| src = cms.InputTag("genJetConstituents", "constituents"), | ||||||||||
| cut = cms.string(genJetConstCut) | ||||||||||
| ) | ||||||||||
| process.genjetConstituentsTask.add(process.selectedGenJetConstituents) | ||||||||||
|
|
||||||||||
| if addGenJetAK8Const: | ||||||||||
| process.genJetAK8Constituents = cms.EDProducer("GenJetPackedConstituentPtrSelector", | ||||||||||
| src = process.genJetAK8Table.src, | ||||||||||
| cut = process.genJetAK8Table.cut, | ||||||||||
| ) | ||||||||||
| process.genjetConstituentsTask.add(process.genJetAK8Constituents) | ||||||||||
|
|
||||||||||
| process.selectedGenJetAK8Constituents = cms.EDFilter("PATPackedGenParticlePtrSelector", | ||||||||||
| src = cms.InputTag("genJetAK8Constituents", "constituents"), | ||||||||||
| cut = cms.string(genJetConstCut) | ||||||||||
| ) | ||||||||||
| process.genjetConstituentsTask.add(process.selectedGenJetAK8Constituents) | ||||||||||
|
|
||||||||||
| if addGenJetConst or addGenJetConst: | ||||||||||
|
||||||||||
| if addGenJetConst or addGenJetConst: | |
| if addGenJetConst or addGenJetAK8Const: |
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| candidates = pfCandidatesTable.src, | |
| candidates = process.genPartCandidatesTable.src, |
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| candidates = pfCandidatesTable.src, | |
| candidates = process.genPartCandidatesTable.src, |
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| jetConstCut = process.selectedGenJetConstituents.cut | |
| jetConstCut = process.selectedGenJetAK8Constituents.cut |
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| process = SaveGenJetConstituents(process,True,False) | |
| process = SaveGenJetConstituents(process,False,True) |
Or better:
| process = SaveGenJetConstituents(process,True,False) | |
| process = SaveGenJetConstituents(process, addGenJetConst=False, addGenJetAK8Const=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will fix