1 import FWCore.ParameterSet.Config
as cms
4 from Configuration.Eras.Modifier_run2_nanoAOD_106Xv1_cff
import run2_nanoAOD_106Xv1
5 from Configuration.Eras.Modifier_run2_nanoAOD_devel_cff
import run2_nanoAOD_devel
9 finalGenParticles = cms.EDProducer(
"GenParticlePruner",
10 src = cms.InputTag(
"prunedGenParticles"),
13 "keep++ abs(pdgId) == 15 & (pt > 15 || isPromptDecayed() )",
15 "keep+ abs(pdgId) == 15 ",
16 "+keep pdgId == 22 && status == 1 && (pt > 10 || isPromptFinalState())",
17 "+keep abs(pdgId) == 11 || abs(pdgId) == 13 || abs(pdgId) == 15",
18 "drop abs(pdgId)= 2212 && abs(pz) > 1000",
19 "keep (400 < abs(pdgId) < 600) || (4000 < abs(pdgId) < 6000)",
20 "keep abs(pdgId) == 12 || abs(pdgId) == 14 || abs(pdgId) == 16",
21 "keep status == 3 || (status > 20 && status < 30)",
22 "keep isHardProcess() || fromHardProcessDecayed() || fromHardProcessFinalState() || (statusFlags().fromHardProcess() && statusFlags().isLastCopy())",
23 "keep (status > 70 && status < 80 && pt > 15) ",
24 "keep abs(pdgId) == 23 || abs(pdgId) == 24 || abs(pdgId) == 25 || abs(pdgId) == 37 ",
26 "keep (1000001 <= abs(pdgId) <= 1000039 ) || ( 2000001 <= abs(pdgId) <= 2000015)",
34 genParticleTable = cms.EDProducer(
"SimpleCandidateFlatTableProducer",
35 src = cms.InputTag(
"finalGenParticles"),
37 name= cms.string(
"GenPart"),
38 doc = cms.string(
"interesting gen particles "),
39 singleton = cms.bool(
False),
40 extension = cms.bool(
False),
42 pt =
Var(
"pt", float, precision=8),
43 phi =
Var(
"phi", float,precision=8),
44 eta =
Var(
"eta", float,precision=8),
45 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."),
46 pdgId =
Var(
"pdgId", int, doc=
"PDG id"),
47 status =
Var(
"status", int, doc=
"Particle status. 1=stable"),
48 genPartIdxMother =
Var(
"?numberOfMothers>0?motherRef(0).key():-1", int, doc=
"index of the mother particle"),
50 "statusFlags().isLastCopyBeforeFSR() * 16384 +" 51 "statusFlags().isLastCopy() * 8192 +" 52 "statusFlags().isFirstCopy() * 4096 +" 53 "statusFlags().fromHardProcessBeforeFSR() * 2048 +" 54 "statusFlags().isDirectHardProcessTauDecayProduct() * 1024 +" 55 "statusFlags().isHardProcessTauDecayProduct() * 512 +" 56 "statusFlags().fromHardProcess() * 256 +" 57 "statusFlags().isHardProcess() * 128 +" 58 "statusFlags().isDirectHadronDecayProduct() * 64 +" 59 "statusFlags().isDirectPromptTauDecayProduct() * 32 +" 60 "statusFlags().isDirectTauDecayProduct() * 16 +" 61 "statusFlags().isPromptTauDecayProduct() * 8 +" 62 "statusFlags().isTauDecayProduct() * 4 +" 63 "statusFlags().isDecayedLeptonHadron() * 2 +" 64 "statusFlags().isPrompt() * 1 ",
65 int, doc=(
"gen status flags stored bitwise, bits are: " 67 "1 : isDecayedLeptonHadron, " 68 "2 : isTauDecayProduct, " 69 "3 : isPromptTauDecayProduct, " 70 "4 : isDirectTauDecayProduct, " 71 "5 : isDirectPromptTauDecayProduct, " 72 "6 : isDirectHadronDecayProduct, " 74 "8 : fromHardProcess, " 75 "9 : isHardProcessTauDecayProduct, " 76 "10 : isDirectHardProcessTauDecayProduct, " 77 "11 : fromHardProcessBeforeFSR, " 80 "14 : isLastCopyBeforeFSR, ")
85 (run2_nanoAOD_106Xv1 & ~run2_nanoAOD_devel).toModify( genParticleTable.variables, 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."))
87 genParticleSequence = cms.Sequence(finalGenParticles)
88 genParticleTables = cms.Sequence(genParticleTable)
def Var(expr, valtype, compression=None, doc=None, mcOnly=False, precision=-1)