diff --git a/PhysicsTools/NanoAOD/python/genparticles_cff.py b/PhysicsTools/NanoAOD/python/genparticles_cff.py index 086ca196288fb..552912c12b230 100644 --- a/PhysicsTools/NanoAOD/python/genparticles_cff.py +++ b/PhysicsTools/NanoAOD/python/genparticles_cff.py @@ -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"), diff --git a/PhysicsTools/NanoAOD/python/nanogen_cff.py b/PhysicsTools/NanoAOD/python/nanogen_cff.py index 92cba74a9478c..bcbb2431faa13 100644 --- a/PhysicsTools/NanoAOD/python/nanogen_cff.py +++ b/PhysicsTools/NanoAOD/python/nanogen_cff.py @@ -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) @@ -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 @@ -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