1 import FWCore.ParameterSet.Config
as cms
3 from PhysicsTools.NanoAOD.simpleGenParticleFlatTableProducer_cfi
import simpleGenParticleFlatTableProducer
8 finalGenParticles = cms.EDProducer(
"GenParticlePruner",
9 src = cms.InputTag(
"prunedGenParticles"),
12 "keep++ abs(pdgId) == 15 & (pt > 15 || isPromptDecayed() )",
14 "keep+ abs(pdgId) == 15 ",
15 "+keep pdgId == 22 && status == 1 && (pt > 10 || isPromptFinalState())",
16 "+keep abs(pdgId) == 11 || abs(pdgId) == 13 || abs(pdgId) == 15",
17 "drop abs(pdgId)= 2212 && abs(pz) > 1000",
18 "keep (400 < abs(pdgId) < 600) || (4000 < abs(pdgId) < 6000)",
19 "keep abs(pdgId) == 12 || abs(pdgId) == 14 || abs(pdgId) == 16",
20 "keep status == 3 || (status > 20 && status < 30)",
21 "keep isHardProcess() || fromHardProcessDecayed() || fromHardProcessFinalState() || (statusFlags().fromHardProcess() && statusFlags().isLastCopy())",
22 "keep (status > 70 && status < 80 && pt > 15) ",
23 "keep abs(pdgId) == 23 || abs(pdgId) == 24 || abs(pdgId) == 25 || abs(pdgId) == 37 ",
25 "keep (1000001 <= abs(pdgId) <= 1000039 ) || ( 2000001 <= abs(pdgId) <= 2000015)",
32 genParticleTable = simpleGenParticleFlatTableProducer.clone(
33 src = cms.InputTag(
"finalGenParticles"),
34 name= cms.string(
"GenPart"),
35 doc = cms.string(
"interesting gen particles "),
36 externalVariables = cms.PSet(
37 iso =
ExtVar(cms.InputTag(
"genIso"), float, precision=8, doc=
"Isolation for leptons"),
40 pt =
Var(
"pt", float, precision=8),
41 phi =
Var(
"phi", float,precision=8),
42 eta =
Var(
"eta", float,precision=8),
43 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."),
44 pdgId =
Var(
"pdgId", int, doc=
"PDG id"),
45 status =
Var(
"status", int, doc=
"Particle status. 1=stable"),
46 genPartIdxMother =
Var(
"?numberOfMothers>0?motherRef(0).key():-1",
"int16", doc=
"index of the mother particle"),
48 "statusFlags().isLastCopyBeforeFSR() * 16384 +" 49 "statusFlags().isLastCopy() * 8192 +" 50 "statusFlags().isFirstCopy() * 4096 +" 51 "statusFlags().fromHardProcessBeforeFSR() * 2048 +" 52 "statusFlags().isDirectHardProcessTauDecayProduct() * 1024 +" 53 "statusFlags().isHardProcessTauDecayProduct() * 512 +" 54 "statusFlags().fromHardProcess() * 256 +" 55 "statusFlags().isHardProcess() * 128 +" 56 "statusFlags().isDirectHadronDecayProduct() * 64 +" 57 "statusFlags().isDirectPromptTauDecayProduct() * 32 +" 58 "statusFlags().isDirectTauDecayProduct() * 16 +" 59 "statusFlags().isPromptTauDecayProduct() * 8 +" 60 "statusFlags().isTauDecayProduct() * 4 +" 61 "statusFlags().isDecayedLeptonHadron() * 2 +" 62 "statusFlags().isPrompt() * 1 ",
63 "uint16", doc=(
"gen status flags stored bitwise, bits are: " 65 "1 : isDecayedLeptonHadron, " 66 "2 : isTauDecayProduct, " 67 "3 : isPromptTauDecayProduct, " 68 "4 : isDirectTauDecayProduct, " 69 "5 : isDirectPromptTauDecayProduct, " 70 "6 : isDirectHadronDecayProduct, " 72 "8 : fromHardProcess, " 73 "9 : isHardProcessTauDecayProduct, " 74 "10 : isDirectHardProcessTauDecayProduct, " 75 "11 : fromHardProcessBeforeFSR, " 78 "14 : isLastCopyBeforeFSR, ")
83 genIso = cms.EDProducer(
"GenPartIsoProducer",
84 genPart=cms.InputTag(
"finalGenParticles"),
85 packedGenPart=cms.InputTag(
"packedGenParticles"),
86 additionalPdgId=cms.int32(22),
89 genParticleTask = cms.Task(finalGenParticles, genIso)
90 genParticleTablesTask = cms.Task(genParticleTable)
def Var(expr, valtype, doc=None, precision=-1, lazyEval=False)
def ExtVar(tag, valtype, doc=None, precision=-1)