1 import FWCore.ParameterSet.Config
as cms
4 from PhysicsTools.NanoAOD.simpleCandidateFlatTableProducer_cfi
import simpleCandidateFlatTableProducer
11 finalGenParticles.select +=[
12 "keep (4 <= abs(pdgId) <= 5) && statusFlags().isLastCopy()",
13 "keep (abs(pdgId) == 310 || abs(pdgId) == 3122) && statusFlags().isLastCopy()",
16 btvGenTable = cms.EDProducer(
17 "SimpleGenParticleFlatTableProducer",
18 src=finalGenParticles.src,
19 name= cms.string(
"GenPart"),
20 doc = cms.string(
"interesting gen particles "),
21 singleton=cms.bool(
False),
24 genParticleTable.variables,
25 vx =
Var(
"vx",
"float", doc=
"x coordinate of vertex position"),
26 vy =
Var(
"vy",
"float", doc=
"y coordinate of vertex position"),
27 vz =
Var(
"vz",
"float", doc=
"z coordinate of vertex position"),
28 genPartIdxMother2 =
Var(
"?numberOfMothers>1?motherRef(1).key():-1",
"int", doc=
"index of the second mother particle, if valid")
30 genParticleTablesTask.replace(genParticleTable,btvGenTable)
31 btvMCTable = cms.EDProducer(
"BTVMCFlavourTableProducer",name=jetPuppiTable.name,src=cms.InputTag(
"linkedObjects",
"jets"),genparticles=cms.InputTag(
"prunedGenParticles"))
33 btvAK4JetExtTable = cms.EDProducer(
34 "SimplePATJetFlatTableProducer",
35 src=jetPuppiTable.src,
36 cut=jetPuppiTable.cut,
37 name=jetPuppiTable.name,
38 doc=jetPuppiTable.doc,
39 singleton=cms.bool(
False),
40 extension=cms.bool(
True),
42 nBHadrons=
Var(
"jetFlavourInfo().getbHadrons().size()",
44 doc=
"number of b-hadrons"),
45 nCHadrons=
Var(
"jetFlavourInfo().getcHadrons().size()",
47 doc=
"number of c-hadrons"),
50 btvSubJetMCExtTable = cms.EDProducer(
51 "SimplePATJetFlatTableProducer",
52 src = subJetTable.src,
53 cut = subJetTable.cut,
54 name = subJetTable.name,
56 singleton = cms.bool(
False),
57 extension = cms.bool(
True),
59 subGenJetAK8Idx =
Var(
"?genJetFwdRef().backRef().isNonnull()?genJetFwdRef().backRef().key():-1",
61 doc=
"index of matched gen Sub jet"),
64 genJetsAK8Constituents = cms.EDProducer(
"GenJetPackedConstituentPtrSelector",
65 src = cms.InputTag(
"slimmedGenJetsAK8"),
66 cut = cms.string(
"pt > 100.")
70 genJetsAK4Constituents = cms.EDProducer(
"GenJetPackedConstituentPtrSelector",
71 src = cms.InputTag(
"slimmedGenJets"),
72 cut = cms.string(
"pt > 20")
79 ak4onlygenJetsConstituents = cms.EDProducer(
"PackedGenParticlePtrMerger", src = cms.VInputTag(cms.InputTag(
"genJetsAK4Constituents",
"constituents")), skipNulls = cms.bool(
True), warnOnSkip = cms.bool(
True))
81 ak8onlygenJetsConstituents = cms.EDProducer(
"PackedGenParticlePtrMerger", src = cms.VInputTag(cms.InputTag(
"genJetsAK8Constituents",
"constituents")), skipNulls = cms.bool(
True), warnOnSkip = cms.bool(
True))
82 ak4ak8genJetsConstituents = cms.EDProducer(
"PackedGenParticlePtrMerger", src = cms.VInputTag(cms.InputTag(
"genJetsAK4Constituents",
"constituents"), cms.InputTag(
"genJetsAK8Constituents",
"constituents")), skipNulls = cms.bool(
True), warnOnSkip = cms.bool(
True))
84 allPFParticleTable = cms.EDProducer(
"SimpleCandidateFlatTableProducer",
85 src = cms.InputTag(
"packedGenParticles"),
87 name= cms.string(
"GenCands"),
88 doc = cms.string(
"interesting gen particles from PF candidates"),
89 singleton = cms.bool(
False),
90 extension = cms.bool(
False),
91 variables = cms.PSet(CandVars
94 ak4onlygenJetsParticleTable = cms.EDProducer(
"SimpleCandidateFlatTableProducer",
95 src = cms.InputTag(
"ak4onlygenJetsConstituents"),
97 name= cms.string(
"GenCands"),
98 doc = cms.string(
"interesting gen particles from AK4 jets"),
99 singleton = cms.bool(
False),
100 extension = cms.bool(
False),
101 variables = cms.PSet(CandVars
104 ak8onlygenJetsParticleTable = cms.EDProducer(
"SimpleCandidateFlatTableProducer",
105 src = cms.InputTag(
"ak8onlygenJetsConstituents"),
106 cut = cms.string(
""),
107 name= cms.string(
"GenCands"),
108 doc = cms.string(
"interesting gen particles from AK8 jets"),
109 singleton = cms.bool(
False),
110 extension = cms.bool(
False),
111 variables = cms.PSet(CandVars
114 ak4ak8genJetsParticleTable = cms.EDProducer(
"SimpleCandidateFlatTableProducer",
115 src = cms.InputTag(
"ak4ak8genJetsConstituents"),
116 cut = cms.string(
""),
117 name= cms.string(
"GenCands"),
118 doc = cms.string(
"interesting gen particles from AK4, AK8 jets"),
119 singleton = cms.bool(
False),
120 extension = cms.bool(
False),
121 variables = cms.PSet(CandVars
124 ak8onlygenAK8ConstituentsTable = cms.EDProducer(
"GenJetConstituentTableProducer",
125 candidates = cms.InputTag(
"ak8onlygenJetsConstituents"),
126 jets = cms.InputTag(
"genJetsAK8Constituents"),
127 name = cms.string(
"GenFatJetCands"),
128 nameSV = cms.string(
"GenFatJetSVs"),
129 idx_name = cms.string(
"pFCandsIdx"),
130 idx_nameSV = cms.string(
"sVIdx"),
131 readBtag = cms.bool(
False))
132 ak4onlygenAK4ConstituentsTable = cms.EDProducer(
"GenJetConstituentTableProducer",
133 candidates = cms.InputTag(
"ak4onlygenJetsConstituents"),
134 jets = cms.InputTag(
"genJetsAK4Constituents"),
135 name = cms.string(
"GenJetCands"),
136 nameSV = cms.string(
"GenJetSVs"),
137 idx_name = cms.string(
"pFCandsIdx"),
138 idx_nameSV = cms.string(
"sVIdx"),
139 readBtag = cms.bool(
False))
140 ak4ak8genAK4ConstituentsTable = cms.EDProducer(
"GenJetConstituentTableProducer",
141 candidates = cms.InputTag(
"ak4ak8genJetsConstituents"),
142 jets = cms.InputTag(
"genJetsAK4Constituents"),
143 name = cms.string(
"GenJetCands"),
144 nameSV = cms.string(
"GenJetSVs"),
145 idx_name = cms.string(
"pFCandsIdx"),
146 idx_nameSV = cms.string(
"sVIdx"),
147 readBtag = cms.bool(
False))
149 ak4ak8genAK8ConstituentsTable = cms.EDProducer(
"GenJetConstituentTableProducer",
150 candidates = cms.InputTag(
"ak4ak8genJetsConstituents"),
151 jets = cms.InputTag(
"genJetsAK8Constituents"),
152 name = cms.string(
"GenFatJetCands"),
153 nameSV = cms.string(
"GenFatJetSVs"),
154 idx_name = cms.string(
"pFCandsIdx"),
155 idx_nameSV = cms.string(
"sVIdx"),
156 readBtag = cms.bool(
False))
157 btvAK4MCSequence = cms.Sequence(btvGenTable+btvAK4JetExtTable+btvMCTable)
158 btvAK8MCSequence = cms.Sequence(btvGenTable+btvSubJetMCExtTable)
160 ak4onlyPFCandsMCSequence=cms.Sequence(genJetsAK4Constituents+ak4onlygenJetsConstituents+ak4onlygenJetsParticleTable+ak4onlygenAK4ConstituentsTable)+btvAK4MCSequence
162 ak8onlyPFCandsMCSequence=cms.Sequence(genJetsAK8Constituents+ak8onlygenJetsConstituents+ak8onlygenJetsParticleTable+ak8onlygenAK8ConstituentsTable)+btvAK8MCSequence
164 ak4ak8PFCandsMCSequence=cms.Sequence(genJetsAK4Constituents+genJetsAK8Constituents+ak4ak8genJetsConstituents+ak4ak8genJetsParticleTable+ak4ak8genAK4ConstituentsTable+ak4ak8genAK8ConstituentsTable)+btvAK4MCSequence+btvAK8MCSequence
166 allPFPFCandsMCSequence=cms.Sequence(genJetsAK4Constituents+genJetsAK8Constituents+ak4ak8genJetsConstituents+allPFParticleTable+ak4ak8genAK4ConstituentsTable+ak4ak8genAK8ConstituentsTable)+btvAK4MCSequence+btvAK8MCSequence
def Var(expr, valtype, doc=None, precision=-1, lazyEval=False)