CMS 3D CMS Logo

jetMC_cff.py
Go to the documentation of this file.
1 import FWCore.ParameterSet.Config as cms
2 
5 from PhysicsTools.NanoAOD.V10.jetsAK8_cff import fatJetTable as _fatJetTable
6 from PhysicsTools.NanoAOD.V10.jetsAK8_cff import subJetTable as _subJetTable
7 
8 jetMCTable = cms.EDProducer("SimpleCandidateFlatTableProducer",
9  src = cms.InputTag("linkedObjects","jets"),
10  cut = cms.string(""), #we should not filter on cross linked collections
11  name = cms.string("Jet"),
12  singleton = cms.bool(False), # the number of entries is variable
13  extension = cms.bool(True), # this is an extension table for the jets
14  variables = cms.PSet(
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"),
18  )
19 )
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), # the number of entries is variable
26  extension = cms.bool(False), # this is the main table for the genjets
27  variables = cms.PSet(P4Vars,
28  #anything else?
29  )
30 )
31 
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)
37 )
38 
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)
49 )
50 
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"),
57 )
58 
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), # the number of entries is variable
65  extension = cms.bool(False), # this is the main table for the genjets
66  variables = cms.PSet(P4Vars,
67  #anything else?
68  )
69 )
70 
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)
81 )
82 
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"),
89 )
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),
96  variables = cms.PSet(
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"),
101  )
102 )
103 
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), # the number of entries is variable
110  extension = cms.bool(False), # this is the main table for the genjets
111  variables = cms.PSet(P4Vars,
112  #anything else?
113  )
114 )
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"),
125  )
126 )
127 
128 
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)
133 
134 
def Var(expr, valtype, doc=None, precision=-1)
Definition: common_cff.py:16