Skip to content

Commit

Permalink
Merge pull request #12 from cms-l1-dpg/upd_genparts
Browse files Browse the repository at this point in the history
Add pruned GenParts collection and displacement for GenParts
  • Loading branch information
artlbv authored Feb 5, 2024
2 parents 0cac5eb + 7b76967 commit ae7e0ba
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions python/l1tPh2Nano_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@ def addPh2L1Objects(process):
from PhysicsTools.NanoAOD.taus_cff import * ## for Gen taus
def addGenObjects(process):

## add more GenVariables
# from L1Ntuple Gen: https://github.com/artlbv/cmssw/blob/94a5ec13b8ce76afb8ea4f157bb92fb547fadee2/L1Trigger/L1TNtuples/plugins/L1GenTreeProducer.cc#L203
genParticleTable.variables.vertX = Var("vertex.x", float, "vertex X")
genParticleTable.variables.vertY = Var("vertex.y", float, "vertex Y")
genParticleTable.variables.lXY = Var("sqrt(vertex().x() * vertex().x() + vertex().y() * vertex().y())", float, "lXY")
genParticleTable.variables.dXY = Var("-vertex().x() * sin(phi()) + vertex().y() * cos(phi())", float, "dXY")

## add pruned gen particles a la Mini
if True:
## Gen all
Expand All @@ -39,14 +46,6 @@ def addGenObjects(process):
process.prunedGenParticleTable.name = "prunedGenPart"
process.l1tPh2NanoTask.add(process.prunedGenParticleTable)


## add more GenVariables
# from L1Ntuple Gen: https://github.com/artlbv/cmssw/blob/94a5ec13b8ce76afb8ea4f157bb92fb547fadee2/L1Trigger/L1TNtuples/plugins/L1GenTreeProducer.cc#L203
genParticleTable.variables.vertX = Var("vertex.x", float, "vertex X")
genParticleTable.variables.vertY = Var("vertex.y", float, "vertex Y")
genParticleTable.variables.lXY = Var("sqrt(vertex().x() * vertex().x() + vertex().y() * vertex().y())", float, "lXY")
genParticleTable.variables.dXY = Var("-vertex().x() * sin(phi()) + vertex().y() * cos(phi())", float, "dXY")

process.l1tPh2NanoTask.add(
puTable, metMCTable,
genParticleTask, genParticleTablesTask,
Expand Down

0 comments on commit ae7e0ba

Please sign in to comment.