1 import FWCore.ParameterSet.Config
as cms
4 from PhysicsTools.NanoAOD.simpleCandidateFlatTableProducer_cfi
import simpleCandidateFlatTableProducer
8 jetMCTable = simpleCandidateFlatTableProducer.clone(
9 src = cms.InputTag(
"linkedObjects",
"jets"),
10 name = cms.string(
"Jet"),
11 extension = cms.bool(
True),
13 partonFlavour =
Var(
"partonFlavour()", int, doc=
"flavour from parton matching"),
14 hadronFlavour =
Var(
"hadronFlavour()", int, doc=
"flavour from hadron ghost clustering"),
15 genJetIdx =
Var(
"?genJetFwdRef().backRef().isNonnull()?genJetFwdRef().backRef().key():-1", int, doc=
"index of matched gen jet"),
18 genJetTable = simpleCandidateFlatTableProducer.clone(
19 src = cms.InputTag(
"slimmedGenJets"),
20 cut = cms.string(
"pt > 10"),
21 name = cms.string(
"GenJet"),
22 doc = cms.string(
"slimmedGenJets, i.e. ak4 Jets made with visible genparticles"),
23 variables = cms.PSet(P4Vars,
28 patJetPartonsNano = cms.EDProducer(
'HadronAndPartonSelector',
29 src = cms.InputTag(
"generator"),
30 particles = cms.InputTag(
"prunedGenParticles"),
31 partonMode = cms.string(
"Auto"),
32 fullChainPhysPartons = cms.bool(
True)
35 genJetFlavourAssociation = cms.EDProducer(
"JetFlavourClustering",
36 jets = genJetTable.src,
37 bHadrons = cms.InputTag(
"patJetPartonsNano",
"bHadrons"),
38 cHadrons = cms.InputTag(
"patJetPartonsNano",
"cHadrons"),
39 partons = cms.InputTag(
"patJetPartonsNano",
"physicsPartons"),
40 leptons = cms.InputTag(
"patJetPartonsNano",
"leptons"),
41 jetAlgorithm = cms.string(
"AntiKt"),
42 rParam = cms.double(0.4),
43 ghostRescaling = cms.double(1e-18),
44 hadronFlavourHasPriority = cms.bool(
False)
47 genJetFlavourTable = cms.EDProducer(
"GenJetFlavourTableProducer",
48 name = genJetTable.name,
49 src = genJetTable.src,
50 cut = genJetTable.cut,
51 deltaR = cms.double(0.1),
52 jetFlavourInfos = cms.InputTag(
"slimmedGenJetsFlavourInfos"),
55 genJetAK8Table = simpleCandidateFlatTableProducer.clone(
56 src = cms.InputTag(
"slimmedGenJetsAK8"),
57 cut = cms.string(
"pt > 100."),
58 name = cms.string(
"GenJetAK8"),
59 doc = cms.string(
"slimmedGenJetsAK8, i.e. ak8 Jets made with visible genparticles"),
60 variables = cms.PSet(P4Vars,
65 genJetAK8FlavourAssociation = cms.EDProducer(
"JetFlavourClustering",
66 jets = genJetAK8Table.src,
67 bHadrons = cms.InputTag(
"patJetPartonsNano",
"bHadrons"),
68 cHadrons = cms.InputTag(
"patJetPartonsNano",
"cHadrons"),
69 partons = cms.InputTag(
"patJetPartonsNano",
"physicsPartons"),
70 leptons = cms.InputTag(
"patJetPartonsNano",
"leptons"),
71 jetAlgorithm = cms.string(
"AntiKt"),
72 rParam = cms.double(0.8),
73 ghostRescaling = cms.double(1e-18),
74 hadronFlavourHasPriority = cms.bool(
False)
77 genJetAK8FlavourTable = cms.EDProducer(
"GenJetFlavourTableProducer",
78 name = genJetAK8Table.name,
79 src = genJetAK8Table.src,
80 cut = genJetAK8Table.cut,
81 deltaR = cms.double(0.1),
82 jetFlavourInfos = cms.InputTag(
"genJetAK8FlavourAssociation"),
84 fatJetMCTable = simpleCandidateFlatTableProducer.clone(
85 src = _fatJetTable.src,
86 cut = _fatJetTable.cut,
87 name = _fatJetTable.name,
88 extension = cms.bool(
True),
90 nBHadrons =
Var(
"jetFlavourInfo().getbHadrons().size()",
"uint8", doc=
"number of b-hadrons"),
91 nCHadrons =
Var(
"jetFlavourInfo().getcHadrons().size()",
"uint8", doc=
"number of c-hadrons"),
92 hadronFlavour =
Var(
"hadronFlavour()", int, doc=
"flavour from hadron ghost clustering"),
93 genJetAK8Idx =
Var(
"?genJetFwdRef().backRef().isNonnull() && genJetFwdRef().backRef().pt() > 100.?genJetFwdRef().backRef().key():-1", int, doc=
"index of matched gen AK8 jet"),
97 genSubJetAK8Table = simpleCandidateFlatTableProducer.clone(
98 src = cms.InputTag(
"slimmedGenJetsAK8SoftDropSubJets"),
99 name = cms.string(
"SubGenJetAK8"),
100 doc = cms.string(
"slimmedGenJetsAK8SoftDropSubJets, i.e. subjets of ak8 Jets made with visible genparticles"),
101 variables = cms.PSet(P4Vars,
105 subjetMCTable = simpleCandidateFlatTableProducer.clone(
106 src = _subJetTable.src,
107 cut = _subJetTable.cut,
108 name = _subJetTable.name,
109 extension = cms.bool(
True),
110 variables = cms.PSet(
111 nBHadrons =
Var(
"jetFlavourInfo().getbHadrons().size()",
"uint8", doc=
"number of b-hadrons"),
112 nCHadrons =
Var(
"jetFlavourInfo().getcHadrons().size()",
"uint8", doc=
"number of c-hadrons"),
113 hadronFlavour =
Var(
"hadronFlavour()", int, doc=
"flavour from hadron ghost clustering"),
118 jetMCTaskak4 = cms.Task(jetMCTable,genJetTable,patJetPartonsNano,genJetFlavourTable)
119 jetMCTaskak8 = cms.Task(genJetAK8Table,genJetAK8FlavourAssociation,genJetAK8FlavourTable,fatJetMCTable,genSubJetAK8Table,subjetMCTable)
120 jetMCTask = jetMCTaskak4.copyAndAdd(jetMCTaskak8)
def Var(expr, valtype, doc=None, precision=-1)