Skip to content

Commit

Permalink
Merge pull request #33637 from mseidel42/NanoGen_120
Browse files Browse the repository at this point in the history
Allow for increased mass precision in NanoGen + increase mass precision of SUSY particles in NanoAod
  • Loading branch information
cmsbuild committed May 11, 2021
2 parents 1deecfb + 838d2bf commit 25cb7d9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion PhysicsTools/NanoAOD/python/genparticles_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
pt = Var("pt", float, precision=8),
phi = Var("phi", float,precision=8),
eta = Var("eta", float,precision=8),
mass = Var("?!((abs(pdgId)>=1 && abs(pdgId)<=5) || (abs(pdgId)>=11 && abs(pdgId)<=16) || pdgId==21 || pdgId==111 || abs(pdgId)==211 || abs(pdgId)==421 || abs(pdgId)==411 || (pdgId==22 && mass<1))?mass:0", float,precision="?(abs(pdgId)==6 && statusFlags().isLastCopy())?20:8",doc="Mass stored for all particles with the exception of quarks (except top), leptons/neutrinos, photons with mass < 1 GeV, gluons, pi0(111), pi+(211), D0(421), and D+(411). For these particles, you can lookup the value from PDG."),
mass = Var("?!((abs(pdgId)>=1 && abs(pdgId)<=5) || (abs(pdgId)>=11 && abs(pdgId)<=16) || pdgId==21 || pdgId==111 || abs(pdgId)==211 || abs(pdgId)==421 || abs(pdgId)==411 || (pdgId==22 && mass<1))?mass:0", float,precision="?((abs(pdgId)==6 || abs(pdgId)>1000000) && statusFlags().isLastCopy())?20:8",doc="Mass stored for all particles with the exception of quarks (except top), leptons/neutrinos, photons with mass < 1 GeV, gluons, pi0(111), pi+(211), D0(421), and D+(411). For these particles, you can lookup the value from PDG."),
pdgId = Var("pdgId", int, doc="PDG id"),
status = Var("status", int, doc="Particle status. 1=stable"),
genPartIdxMother = Var("?numberOfMothers>0?motherRef(0).key():-1", int, doc="index of the mother particle"),
Expand Down
14 changes: 11 additions & 3 deletions PhysicsTools/NanoAOD/python/nanogen_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ def nanoGenCommonCustomize(process):
setGenPtPrecision(process, CandVars.pt.precision)
setGenEtaPrecision(process, CandVars.eta.precision)
setGenPhiPrecision(process, CandVars.phi.precision)
setGenMassPrecision(process, CandVars.mass.precision)

def customizeNanoGENFromMini(process):
process.nanogenSequence.insert(0, process.genParticles2HepMCHiggsVtx)
Expand Down Expand Up @@ -126,9 +127,11 @@ def pruneGenParticlesMini(process):
return process

def setGenFullPrecision(process):
setGenPtPrecision(process, 23)
setGenEtaPrecision(process, 23)
setGenPhiPrecision(process, 23)
process = setGenPtPrecision(process, 23)
process = setGenEtaPrecision(process, 23)
process = setGenPhiPrecision(process, 23)
process = setGenMassPrecision(process, 23)
return process

def setGenPtPrecision(process, precision):
process.genParticleTable.variables.pt.precision = precision
Expand All @@ -147,6 +150,11 @@ def setGenPhiPrecision(process, precision):
process.metMCTable.variables.phi.precision = precision
return process

def setGenMassPrecision(process, precision):
process.genParticleTable.variables.mass.precision = precision
process.genJetTable.variables.mass.precision = precision
return process

def setLHEFullPrecision(process):
process.lheInfoTable.precision = 23
return process
Expand Down

0 comments on commit 25cb7d9

Please sign in to comment.