1 import FWCore.ParameterSet.Config
as cms
4 from PhysicsTools.NanoAOD.simpleCandidateFlatTableProducer_cfi
import simpleCandidateFlatTableProducer
5 from PhysicsTools.NanoAOD.simplePATJetFlatTableProducer_cfi
import simplePATJetFlatTableProducer
9 jetMCTable = simplePATJetFlatTableProducer.clone(
10 src = cms.InputTag(
"linkedObjects",
"jets"),
11 name = cms.string(
"Jet"),
12 extension = cms.bool(
True),
14 partonFlavour =
Var(
"partonFlavour()",
"int16", doc=
"flavour from parton matching"),
15 hadronFlavour =
Var(
"hadronFlavour()",
"uint8", doc=
"flavour from hadron ghost clustering"),
17 genJetIdx =
Var(
"?genJetFwdRef().backRef().isNonnull() && genJetFwdRef().backRef().pt() > 10.?genJetFwdRef().backRef().key():-1",
"int16", doc=
"index of matched gen jet"),
20 genJetTable = simpleCandidateFlatTableProducer.clone(
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 variables = cms.PSet(P4Vars,
30 patJetPartonsNano = cms.EDProducer(
'HadronAndPartonSelector',
31 src = cms.InputTag(
"generator"),
32 particles = cms.InputTag(
"prunedGenParticles"),
33 partonMode = cms.string(
"Auto"),
34 fullChainPhysPartons = cms.bool(
True)
37 genJetFlavourAssociation = cms.EDProducer(
"JetFlavourClustering",
38 jets = genJetTable.src,
39 bHadrons = cms.InputTag(
"patJetPartonsNano",
"bHadrons"),
40 cHadrons = cms.InputTag(
"patJetPartonsNano",
"cHadrons"),
41 partons = cms.InputTag(
"patJetPartonsNano",
"physicsPartons"),
42 leptons = cms.InputTag(
"patJetPartonsNano",
"leptons"),
43 jetAlgorithm = cms.string(
"AntiKt"),
44 rParam = cms.double(0.4),
45 ghostRescaling = cms.double(1e-18),
46 hadronFlavourHasPriority = cms.bool(
False)
49 genJetFlavourTable = cms.EDProducer(
"GenJetFlavourTableProducer",
50 name = genJetTable.name,
51 src = genJetTable.src,
52 cut = genJetTable.cut,
53 deltaR = cms.double(0.1),
54 jetFlavourInfos = cms.InputTag(
"slimmedGenJetsFlavourInfos"),
57 genJetAK8Table = simpleCandidateFlatTableProducer.clone(
58 src = cms.InputTag(
"slimmedGenJetsAK8"),
59 cut = cms.string(
"pt > 100."),
60 name = cms.string(
"GenJetAK8"),
61 doc = cms.string(
"slimmedGenJetsAK8, i.e. ak8 Jets made with visible genparticles"),
62 variables = cms.PSet(P4Vars,
67 genJetAK8FlavourAssociation = cms.EDProducer(
"JetFlavourClustering",
68 jets = genJetAK8Table.src,
69 bHadrons = cms.InputTag(
"patJetPartonsNano",
"bHadrons"),
70 cHadrons = cms.InputTag(
"patJetPartonsNano",
"cHadrons"),
71 partons = cms.InputTag(
"patJetPartonsNano",
"physicsPartons"),
72 leptons = cms.InputTag(
"patJetPartonsNano",
"leptons"),
73 jetAlgorithm = cms.string(
"AntiKt"),
74 rParam = cms.double(0.8),
75 ghostRescaling = cms.double(1e-18),
76 hadronFlavourHasPriority = cms.bool(
False)
79 genJetAK8FlavourTable = cms.EDProducer(
"GenJetFlavourTableProducer",
80 name = genJetAK8Table.name,
81 src = genJetAK8Table.src,
82 cut = genJetAK8Table.cut,
83 deltaR = cms.double(0.1),
84 jetFlavourInfos = cms.InputTag(
"genJetAK8FlavourAssociation"),
86 fatJetMCTable = simplePATJetFlatTableProducer.clone(
87 src = _fatJetTable.src,
88 cut = _fatJetTable.cut,
89 name = _fatJetTable.name,
90 extension = cms.bool(
True),
92 hadronFlavour =
Var(
"hadronFlavour()",
"uint8", doc=
"flavour from hadron ghost clustering"),
94 genJetAK8Idx =
Var(
"?genJetFwdRef().backRef().isNonnull() && genJetFwdRef().backRef().pt() > 100.?genJetFwdRef().backRef().key():-1",
"int16", doc=
"index of matched gen AK8 jet"),
98 genSubJetAK8Table = simpleCandidateFlatTableProducer.clone(
99 src = cms.InputTag(
"slimmedGenJetsAK8SoftDropSubJets"),
100 name = cms.string(
"SubGenJetAK8"),
101 doc = cms.string(
"slimmedGenJetsAK8SoftDropSubJets, i.e. subjets of ak8 Jets made with visible genparticles"),
102 variables = cms.PSet(P4Vars,
106 subjetMCTable = simplePATJetFlatTableProducer.clone(
107 src = _subJetTable.src,
108 cut = _subJetTable.cut,
109 name = _subJetTable.name,
110 extension = cms.bool(
True),
111 variables = cms.PSet(
112 nBHadrons =
Var(
"jetFlavourInfo().getbHadrons().size()",
"uint8", doc=
"number of b-hadrons"),
113 nCHadrons =
Var(
"jetFlavourInfo().getcHadrons().size()",
"uint8", doc=
"number of c-hadrons"),
114 hadronFlavour =
Var(
"hadronFlavour()",
"uint8", doc=
"flavour from hadron ghost clustering"),
119 jetMCTaskak4 = cms.Task(jetMCTable,genJetTable,patJetPartonsNano,genJetFlavourTable)
120 jetMCTaskak8 = cms.Task(genJetAK8Table,genJetAK8FlavourAssociation,genJetAK8FlavourTable,fatJetMCTable,genSubJetAK8Table,subjetMCTable)
121 jetMCTask = jetMCTaskak4.copyAndAdd(jetMCTaskak8)
def Var(expr, valtype, doc=None, precision=-1, lazyEval=False)