1 import FWCore.ParameterSet.Config
as cms
8 jetMCTable = cms.EDProducer(
"SimpleCandidateFlatTableProducer",
9 src = cms.InputTag(
"linkedObjects",
"jets"),
11 name = cms.string(
"Jet"),
12 singleton = cms.bool(
False),
13 extension = cms.bool(
True),
15 partonFlavour =
Var(
"partonFlavour()", int, doc=
"flavour from parton matching"),
16 hadronFlavour =
Var(
"hadronFlavour()", int, doc=
"flavour from hadron ghost clustering"),
17 genJetIdx =
Var(
"?genJetFwdRef().backRef().isNonnull()?genJetFwdRef().backRef().key():-1", int, doc=
"index of matched gen jet"),
20 genJetTable = cms.EDProducer(
"SimpleCandidateFlatTableProducer",
21 src = cms.InputTag(
"slimmedGenJets"),
22 cut = cms.string(
"pt > 10"),
23 name = cms.string(
"GenJet"),
24 doc = cms.string(
"slimmedGenJets, i.e. ak4 Jets made with visible genparticles"),
25 singleton = cms.bool(
False),
26 extension = cms.bool(
False),
27 variables = cms.PSet(P4Vars,
32 patJetPartonsNano = cms.EDProducer(
'HadronAndPartonSelector',
33 src = cms.InputTag(
"generator"),
34 particles = cms.InputTag(
"prunedGenParticles"),
35 partonMode = cms.string(
"Auto"),
36 fullChainPhysPartons = cms.bool(
True)
39 genJetFlavourAssociation = cms.EDProducer(
"JetFlavourClustering",
40 jets = genJetTable.src,
41 bHadrons = cms.InputTag(
"patJetPartonsNano",
"bHadrons"),
42 cHadrons = cms.InputTag(
"patJetPartonsNano",
"cHadrons"),
43 partons = cms.InputTag(
"patJetPartonsNano",
"physicsPartons"),
44 leptons = cms.InputTag(
"patJetPartonsNano",
"leptons"),
45 jetAlgorithm = cms.string(
"AntiKt"),
46 rParam = cms.double(0.4),
47 ghostRescaling = cms.double(1e-18),
48 hadronFlavourHasPriority = cms.bool(
False)
51 genJetFlavourTable = cms.EDProducer(
"GenJetFlavourTableProducer",
52 name = genJetTable.name,
53 src = genJetTable.src,
54 cut = genJetTable.cut,
55 deltaR = cms.double(0.1),
56 jetFlavourInfos = cms.InputTag(
"slimmedGenJetsFlavourInfos"),
59 genJetAK8Table = cms.EDProducer(
"SimpleCandidateFlatTableProducer",
60 src = cms.InputTag(
"slimmedGenJetsAK8"),
61 cut = cms.string(
"pt > 100."),
62 name = cms.string(
"GenJetAK8"),
63 doc = cms.string(
"slimmedGenJetsAK8, i.e. ak8 Jets made with visible genparticles"),
64 singleton = cms.bool(
False),
65 extension = cms.bool(
False),
66 variables = cms.PSet(P4Vars,
71 genJetAK8FlavourAssociation = cms.EDProducer(
"JetFlavourClustering",
72 jets = genJetAK8Table.src,
73 bHadrons = cms.InputTag(
"patJetPartonsNano",
"bHadrons"),
74 cHadrons = cms.InputTag(
"patJetPartonsNano",
"cHadrons"),
75 partons = cms.InputTag(
"patJetPartonsNano",
"physicsPartons"),
76 leptons = cms.InputTag(
"patJetPartonsNano",
"leptons"),
77 jetAlgorithm = cms.string(
"AntiKt"),
78 rParam = cms.double(0.8),
79 ghostRescaling = cms.double(1e-18),
80 hadronFlavourHasPriority = cms.bool(
False)
83 genJetAK8FlavourTable = cms.EDProducer(
"GenJetFlavourTableProducer",
84 name = genJetAK8Table.name,
85 src = genJetAK8Table.src,
86 cut = genJetAK8Table.cut,
87 deltaR = cms.double(0.1),
88 jetFlavourInfos = cms.InputTag(
"genJetAK8FlavourAssociation"),
90 fatJetMCTable = cms.EDProducer(
"SimpleCandidateFlatTableProducer",
91 src = _fatJetTable.src,
92 cut = _fatJetTable.cut,
93 name = _fatJetTable.name,
94 singleton = cms.bool(
False),
95 extension = cms.bool(
True),
97 nBHadrons =
Var(
"jetFlavourInfo().getbHadrons().size()",
"uint8", doc=
"number of b-hadrons"),
98 nCHadrons =
Var(
"jetFlavourInfo().getcHadrons().size()",
"uint8", doc=
"number of c-hadrons"),
99 hadronFlavour =
Var(
"hadronFlavour()", int, doc=
"flavour from hadron ghost clustering"),
100 genJetAK8Idx =
Var(
"?genJetFwdRef().backRef().isNonnull() && genJetFwdRef().backRef().pt() > 100.?genJetFwdRef().backRef().key():-1", int, doc=
"index of matched gen AK8 jet"),
104 genSubJetAK8Table = cms.EDProducer(
"SimpleCandidateFlatTableProducer",
105 src = cms.InputTag(
"slimmedGenJetsAK8SoftDropSubJets"),
106 cut = cms.string(
""),
107 name = cms.string(
"SubGenJetAK8"),
108 doc = cms.string(
"slimmedGenJetsAK8SoftDropSubJets, i.e. subjets of ak8 Jets made with visible genparticles"),
109 singleton = cms.bool(
False),
110 extension = cms.bool(
False),
111 variables = cms.PSet(P4Vars,
115 subjetMCTable = cms.EDProducer(
"SimpleCandidateFlatTableProducer",
116 src = _subJetTable.src,
117 cut = _subJetTable.cut,
118 name = _subJetTable.name,
119 singleton = cms.bool(
False),
120 extension = cms.bool(
True),
121 variables = cms.PSet(
122 nBHadrons =
Var(
"jetFlavourInfo().getbHadrons().size()",
"uint8", doc=
"number of b-hadrons"),
123 nCHadrons =
Var(
"jetFlavourInfo().getcHadrons().size()",
"uint8", doc=
"number of c-hadrons"),
124 hadronFlavour =
Var(
"hadronFlavour()", int, doc=
"flavour from hadron ghost clustering"),
129 jetMCTaskak4 = cms.Task(jetMCTable,genJetTable,patJetPartonsNano,genJetFlavourTable)
130 jetMCTaskak8 = cms.Task(genJetAK8Table,genJetAK8FlavourAssociation,genJetAK8FlavourTable,fatJetMCTable,genSubJetAK8Table,subjetMCTable)
131 jetMCTask = jetMCTaskak4.copy()
132 jetMCTask.add(jetMCTaskak8)
136 run2_miniAOD_80XLegacy.toModify( genJetFlavourTable, jetFlavourInfos = cms.InputTag(
"genJetFlavourAssociation"),)
138 _jetMCTaskak8 = jetMCTaskak8.copyAndExclude([genSubJetAK8Table])
140 _jetMC_pre94XTask = jetMCTaskak4.copy()
141 _jetMC_pre94XTask.add(genJetFlavourAssociation)
142 _jetMC_pre94XTask.add(_jetMCTaskak8)
143 run2_miniAOD_80XLegacy.toReplaceWith(jetMCTask, _jetMC_pre94XTask)
def Var(expr, valtype, compression=None, doc=None, mcOnly=False, precision=-1)