1 import FWCore.ParameterSet.Config
as cms
3 from PhysicsTools.NanoAOD.simpleCandidateFlatTableProducer_cfi
import simpleCandidateFlatTableProducer
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 = simpleCandidateFlatTableProducer.clone(
33 src = cms.InputTag(
"finalGenParticles"),
34 name= cms.string(
"GenPart"),
35 doc = cms.string(
"interesting gen particles "),
37 pt =
Var(
"pt", float, precision=8),
38 phi =
Var(
"phi", float,precision=8),
39 eta =
Var(
"eta", float,precision=8),
40 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."),
41 pdgId =
Var(
"pdgId", int, doc=
"PDG id"),
42 status =
Var(
"status", int, doc=
"Particle status. 1=stable"),
43 genPartIdxMother =
Var(
"?numberOfMothers>0?motherRef(0).key():-1", int, doc=
"index of the mother particle"),
45 "statusFlags().isLastCopyBeforeFSR() * 16384 +" 46 "statusFlags().isLastCopy() * 8192 +" 47 "statusFlags().isFirstCopy() * 4096 +" 48 "statusFlags().fromHardProcessBeforeFSR() * 2048 +" 49 "statusFlags().isDirectHardProcessTauDecayProduct() * 1024 +" 50 "statusFlags().isHardProcessTauDecayProduct() * 512 +" 51 "statusFlags().fromHardProcess() * 256 +" 52 "statusFlags().isHardProcess() * 128 +" 53 "statusFlags().isDirectHadronDecayProduct() * 64 +" 54 "statusFlags().isDirectPromptTauDecayProduct() * 32 +" 55 "statusFlags().isDirectTauDecayProduct() * 16 +" 56 "statusFlags().isPromptTauDecayProduct() * 8 +" 57 "statusFlags().isTauDecayProduct() * 4 +" 58 "statusFlags().isDecayedLeptonHadron() * 2 +" 59 "statusFlags().isPrompt() * 1 ",
60 int, doc=(
"gen status flags stored bitwise, bits are: " 62 "1 : isDecayedLeptonHadron, " 63 "2 : isTauDecayProduct, " 64 "3 : isPromptTauDecayProduct, " 65 "4 : isDirectTauDecayProduct, " 66 "5 : isDirectPromptTauDecayProduct, " 67 "6 : isDirectHadronDecayProduct, " 69 "8 : fromHardProcess, " 70 "9 : isHardProcessTauDecayProduct, " 71 "10 : isDirectHardProcessTauDecayProduct, " 72 "11 : fromHardProcessBeforeFSR, " 75 "14 : isLastCopyBeforeFSR, ")
80 genParticleTask = cms.Task(finalGenParticles)
81 genParticleTablesTask = cms.Task(genParticleTable)
def Var(expr, valtype, doc=None, precision=-1)