CMS 3D CMS Logo

jets_cff.py
Go to the documentation of this file.
1 import FWCore.ParameterSet.Config as cms
2 from Configuration.Eras.Modifier_run2_miniAOD_80XLegacy_cff import run2_miniAOD_80XLegacy
3 from Configuration.Eras.Modifier_run2_nanoAOD_92X_cff import run2_nanoAOD_92X
4 
6 
7 
8 
9 ##################### User floats producers, selectors ##########################
10 from RecoJets.JetProducers.ak4PFJets_cfi import ak4PFJets
11 
12 chsForSATkJets = cms.EDFilter("CandPtrSelector", src = cms.InputTag("packedPFCandidates"), cut = cms.string('charge()!=0 && pvAssociationQuality()>=5 && vertexRef().key()==0'))
13 softActivityJets = ak4PFJets.clone(src = 'chsForSATkJets', doAreaFastjet = False, jetPtMin=1)
14 softActivityJets10 = cms.EDFilter("CandPtrSelector", src = cms.InputTag("chsForSATkJets"), cut = cms.string('pt>10'))
15 softActivityJets5 = cms.EDFilter("CandPtrSelector", src = cms.InputTag("chsForSATkJets"), cut = cms.string('pt>5'))
16 softActivityJets2 = cms.EDFilter("CandPtrSelector", src = cms.InputTag("chsForSATkJets"), cut = cms.string('pt>2'))
17 
18 looseJetId = cms.EDProducer("PatJetIDValueMapProducer",
19  filterParams=cms.PSet(
20  version = cms.string('WINTER16'),
21  quality = cms.string('LOOSE'),
22  ),
23  src = cms.InputTag("slimmedJets")
24 )
25 tightJetId = cms.EDProducer("PatJetIDValueMapProducer",
26  filterParams=cms.PSet(
27  version = cms.string('WINTER17'),
28  quality = cms.string('TIGHT'),
29  ),
30  src = cms.InputTag("slimmedJets")
31 )
32 run2_miniAOD_80XLegacy.toModify( tightJetId.filterParams, version = "WINTER16" )
33 
34 tightJetIdLepVeto = cms.EDProducer("PatJetIDValueMapProducer",
35  filterParams=cms.PSet(
36  version = cms.string('WINTER17'),
37  quality = cms.string('TIGHTLEPVETO'),
38  ),
39  src = cms.InputTag("slimmedJets")
40 )
41 
42 looseJetIdAK8 = cms.EDProducer("PatJetIDValueMapProducer",
43  filterParams=cms.PSet(
44  version = cms.string('WINTER16'),
45  quality = cms.string('LOOSE'),
46  ),
47  src = cms.InputTag("slimmedJetsAK8")
48 )
49 tightJetIdAK8 = cms.EDProducer("PatJetIDValueMapProducer",
50  filterParams=cms.PSet(
51  version = cms.string('WINTER17'),
52  quality = cms.string('TIGHT'),
53  ),
54  src = cms.InputTag("slimmedJetsAK8")
55 )
56 run2_miniAOD_80XLegacy.toModify( tightJetIdAK8.filterParams, version = "WINTER16" )
57 
58 tightJetIdLepVetoAK8 = cms.EDProducer("PatJetIDValueMapProducer",
59  filterParams=cms.PSet(
60  version = cms.string('WINTER17'),
61  quality = cms.string('TIGHTLEPVETO'),
62  ),
63  src = cms.InputTag("slimmedJetsAK8")
64 )
65 
66 slimmedJetsWithUserData = cms.EDProducer("PATJetUserDataEmbedder",
67  src = cms.InputTag("slimmedJets"),
68  userFloats = cms.PSet(),
69  userInts = cms.PSet(
70  tightId = cms.InputTag("tightJetId"),
71  tightIdLepVeto = cms.InputTag("tightJetIdLepVeto"),
72  ),
73 )
74 run2_miniAOD_80XLegacy.toModify( slimmedJetsWithUserData.userInts,
75  looseId = cms.InputTag("looseJetId"),
76  tightIdLepVeto = None,
77 )
78 
79 slimmedJetsAK8WithUserData = cms.EDProducer("PATJetUserDataEmbedder",
80  src = cms.InputTag("slimmedJetsAK8"),
81  userFloats = cms.PSet(),
82  userInts = cms.PSet(
83  tightId = cms.InputTag("tightJetIdAK8"),
84  tightIdLepVeto = cms.InputTag("tightJetIdLepVetoAK8"),
85  ),
86 )
87 run2_miniAOD_80XLegacy.toModify( slimmedJetsAK8WithUserData.userInts,
88  looseId = cms.InputTag("looseJetIdAK8"),
89  tightIdLepVeto = None,
90 )
91 
93 # Note: Safe to always add 'L2L3Residual' as MC contains dummy L2L3Residual corrections (always set to 1)
94 # (cf. https://twiki.cern.ch/twiki/bin/view/CMSPublic/WorkBookJetEnergyCorrections#CMSSW_7_6_4_and_above )
95 jetCorrFactors = patJetCorrFactors.clone(src='slimmedJetsWithUserData',
96  levels = cms.vstring('L1FastJet',
97  'L2Relative',
98  'L3Absolute',
99  'L2L3Residual'),
100  primaryVertices = cms.InputTag("offlineSlimmedPrimaryVertices"),
101 )
102 jetCorrFactorsAK8 = patJetCorrFactors.clone(src='slimmedJetsAK8WithUserData',
103  levels = cms.vstring('L1FastJet',
104  'L2Relative',
105  'L3Absolute',
106  'L2L3Residual'),
107  payload = cms.string('AK8PFPuppi'),
108  primaryVertices = cms.InputTag("offlineSlimmedPrimaryVertices"),
109 )
110 
112 updatedJets = updatedPatJets.clone(
113  addBTagInfo=False,
114  jetSource='slimmedJetsWithUserData',
115  jetCorrFactorsSource=cms.VInputTag(cms.InputTag("jetCorrFactors") ),
116 )
117 
118 finalJets = cms.EDFilter("PATJetRefSelector",
119  src = cms.InputTag("updatedJets"),
120  cut = cms.string("pt > 15")
121 )
122 
123 updatedJetsAK8 = updatedPatJets.clone(
124  addBTagInfo=False,
125  jetSource='slimmedJetsAK8WithUserData',
126  jetCorrFactorsSource=cms.VInputTag(cms.InputTag("jetCorrFactorsAK8") ),
127 )
128 
129 finalJetsAK8 = cms.EDFilter("PATJetRefSelector",
130  src = cms.InputTag("updatedJetsAK8"),
131  cut = cms.string("pt > 170")
132 )
133 
134 
135 ##################### Tables for final output and docs ##########################
136 
137 
138 
139 jetTable = cms.EDProducer("SimpleCandidateFlatTableProducer",
140  src = cms.InputTag("linkedObjects","jets"),
141  cut = cms.string(""), #we should not filter on cross linked collections
142  name = cms.string("Jet"),
143  doc = cms.string("slimmedJets, i.e. ak4 PFJets CHS with JECs applied, after basic selection (" + finalJets.cut.value()+")"),
144  singleton = cms.bool(False), # the number of entries is variable
145  extension = cms.bool(False), # this is the main table for the jets
146  externalVariables = cms.PSet(
147  bReg = ExtVar(cms.InputTag("bjetMVA"),float, doc="pt corrected with b-jet regression",precision=14),
148  ),
149  variables = cms.PSet(P4Vars,
150  area = Var("jetArea()", float, doc="jet catchment area, for JECs",precision=10),
151  nMuons = Var("?hasOverlaps('muons')?overlaps('muons').size():0", int, doc="number of muons in the jet"),
152  muonIdx1 = Var("?overlaps('muons').size()>0?overlaps('muons')[0].key():-1", int, doc="index of first matching muon"),
153  muonIdx2 = Var("?overlaps('muons').size()>1?overlaps('muons')[1].key():-1", int, doc="index of second matching muon"),
154  electronIdx1 = Var("?overlaps('electrons').size()>0?overlaps('electrons')[0].key():-1", int, doc="index of first matching electron"),
155  electronIdx2 = Var("?overlaps('electrons').size()>1?overlaps('electrons')[1].key():-1", int, doc="index of second matching electron"),
156  nElectrons = Var("?hasOverlaps('electrons')?overlaps('electrons').size():0", int, doc="number of electrons in the jet"),
157  btagCMVA = Var("bDiscriminator('pfCombinedMVAV2BJetTags')",float,doc="CMVA V2 btag discriminator",precision=10),
158  btagDeepB = Var("bDiscriminator('pfDeepCSVJetTags:probb')+bDiscriminator('pfDeepCSVJetTags:probbb')",float,doc="DeepCSV b+bb tag discriminator",precision=10),
159  btagCSVV2 = Var("bDiscriminator('pfCombinedInclusiveSecondaryVertexV2BJetTags')",float,doc=" pfCombinedInclusiveSecondaryVertexV2 b-tag discriminator (aka CSVV2)",precision=10),
160  btagDeepC = Var("bDiscriminator('pfDeepCSVJetTags:probc')",float,doc="DeepCSV charm btag discriminator",precision=10),
161  #puIdDisc = Var("userFloat('pileupJetId:fullDiscriminant')",float,doc="Pilup ID discriminant",precision=10),
162  puId = Var("userInt('pileupJetId:fullId')",int,doc="Pilup ID flags"),
163  jetId = Var("userInt('tightId')*2+4*userInt('tightIdLepVeto')",int,doc="Jet ID flags bit1 is loose (always false in 2017 since it does not exist), bit2 is tight, bit3 is tightLepVeto"),
164  qgl = Var("userFloat('QGTagger:qgLikelihood')",float,doc="Quark vs Gluon likelihood discriminator",precision=10),
165  nConstituents = Var("numberOfDaughters()",int,doc="Number of particles in the jet"),
166  rawFactor = Var("1.-jecFactor('Uncorrected')",float,doc="1 - Factor to get back to raw pT",precision=6),
167  chHEF = Var("chargedHadronEnergyFraction()", float, doc="charged Hadron Energy Fraction", precision= 6),
168  neHEF = Var("neutralHadronEnergyFraction()", float, doc="neutral Hadron Energy Fraction", precision= 6),
169  chEmEF = Var("chargedEmEnergyFraction()", float, doc="charged Electromagnetic Energy Fraction", precision= 6),
170  neEmEF = Var("neutralEmEnergyFraction()", float, doc="neutral Electromagnetic Energy Fraction", precision= 6)
171  )
172 )
173 
174 #jets are not as precise as muons
175 jetTable.variables.pt.precision=10
176 
177 ### Era dependent customization
178 run2_miniAOD_80XLegacy.toModify( slimmedJetsWithUserData, userFloats=cms.PSet(qgl=cms.InputTag('qgtagger80x:qgLikelihood')))
179 run2_miniAOD_80XLegacy.toModify( jetTable.variables.qgl, expr="userFloat('qgl')" )
180 run2_miniAOD_80XLegacy.toModify( jetTable.variables, jetId = Var("userInt('tightId')*2+userInt('looseId')",int,doc="Jet ID flags bit1 is loose, bit2 is tight"))
181 
182 bjetMVA= cms.EDProducer("BJetEnergyRegressionMVA",
183  src = cms.InputTag("linkedObjects","jets"),
184  pvsrc = cms.InputTag("offlineSlimmedPrimaryVertices"),
185  svsrc = cms.InputTag("slimmedSecondaryVertices"),
186  weightFile = cms.FileInPath("PhysicsTools/NanoAOD/data/bjet-regression.xml"),
187  name = cms.string("JetReg"),
188  isClassifier = cms.bool(False),
189  variablesOrder = cms.vstring(["Jet_pt","nPVs","Jet_eta","Jet_mt","Jet_leadTrackPt","Jet_leptonPtRel","Jet_leptonPt","Jet_leptonDeltaR","Jet_neHEF","Jet_neEmEF","Jet_vtxPt","Jet_vtxMass","Jet_vtx3dL","Jet_vtxNtrk","Jet_vtx3deL"]),
190  variables = cms.PSet(
191  Jet_pt = cms.string("pt"),
192  Jet_eta = cms.string("eta"),
193  Jet_mt = cms.string("mt"),
194  Jet_leptonPt = cms.string("?overlaps('muons').size()>0?overlaps('muons')[0].pt():(?overlaps('electrons').size()>0?overlaps('electrons')[0].pt():0)"),
195  Jet_neHEF = cms.string("neutralHadronEnergy()/energy()"),
196  Jet_neEmEF = cms.string("neutralEmEnergy()/energy()"),
197  Jet_leptonDeltaR = cms.string('''?overlaps('muons').size()>0?deltaR(eta,phi,overlaps('muons')[0].eta,overlaps('muons')[0].phi):
198  (?overlaps('electrons').size()>0?deltaR(eta,phi,overlaps('electrons')[0].eta,overlaps('electrons')[0].phi):
199  0)'''),
200  )
201 
202 )
203 
204 ##### Soft Activity tables
205 saJetTable = cms.EDProducer("SimpleCandidateFlatTableProducer",
206  src = cms.InputTag("softActivityJets"),
207  cut = cms.string(""),
208  maxLen = cms.uint32(6),
209  name = cms.string("SoftActivityJet"),
210  doc = cms.string("jets clustered from charged candidates compatible with primary vertex (" + chsForSATkJets.cut.value()+")"),
211  singleton = cms.bool(False), # the number of entries is variable
212  extension = cms.bool(False), # this is the main table for the jets
213  variables = cms.PSet(P3Vars,
214  )
215 )
216 
217 saJetTable.variables.pt.precision=10
218 saJetTable.variables.eta.precision=8
219 saJetTable.variables.phi.precision=8
220 
221 saTable = cms.EDProducer("GlobalVariablesTableProducer",
222  variables = cms.PSet(
223  SoftActivityJetHT = ExtVar( cms.InputTag("softActivityJets"), "candidatescalarsum", doc = "scalar sum of soft activity jet pt, pt>1" ),
224  SoftActivityJetHT10 = ExtVar( cms.InputTag("softActivityJets10"), "candidatescalarsum", doc = "scalar sum of soft activity jet pt , pt >10" ),
225  SoftActivityJetHT5 = ExtVar( cms.InputTag("softActivityJets5"), "candidatescalarsum", doc = "scalar sum of soft activity jet pt, pt>5" ),
226  SoftActivityJetHT2 = ExtVar( cms.InputTag("softActivityJets2"), "candidatescalarsum", doc = "scalar sum of soft activity jet pt, pt >2" ),
227  SoftActivityJetNjets10 = ExtVar( cms.InputTag("softActivityJets10"), "candidatesize", doc = "number of soft activity jet pt, pt >2" ),
228  SoftActivityJetNjets5 = ExtVar( cms.InputTag("softActivityJets5"), "candidatesize", doc = "number of soft activity jet pt, pt >5" ),
229  SoftActivityJetNjets2 = ExtVar( cms.InputTag("softActivityJets2"), "candidatesize", doc = "number of soft activity jet pt, pt >10" ),
230 
231  )
232 )
233 
234 
235 
236 ## BOOSTED STUFF #################
237 fatJetTable = cms.EDProducer("SimpleCandidateFlatTableProducer",
238  src = cms.InputTag("finalJetsAK8"),
239  cut = cms.string(" pt > 170"), #probably already applied in miniaod
240  name = cms.string("FatJet"),
241  doc = cms.string("slimmedJetsAK8, i.e. ak8 fat jets for boosted analysis"),
242  singleton = cms.bool(False), # the number of entries is variable
243  extension = cms.bool(False), # this is the main table for the jets
244  variables = cms.PSet(P4Vars,
245  jetId = Var("userInt('tightId')*2+4*userInt('tightIdLepVeto')",int,doc="Jet ID flags bit1 is loose (always false in 2017 since it does not exist), bit2 is tight, bit3 is tightLepVeto"),
246  area = Var("jetArea()", float, doc="jet catchment area, for JECs",precision=10),
247  tau1 = Var("userFloat('NjettinessAK8Puppi:tau1')",float, doc="Nsubjettiness (1 axis)",precision=10),
248  tau2 = Var("userFloat('NjettinessAK8Puppi:tau2')",float, doc="Nsubjettiness (2 axis)",precision=10),
249  tau3 = Var("userFloat('NjettinessAK8Puppi:tau3')",float, doc="Nsubjettiness (3 axis)",precision=10),
250  tau4 = Var("userFloat('NjettinessAK8Puppi:tau4')",float, doc="Nsubjettiness (4 axis)",precision=10),
251  n2b1 = Var("userFloat('ak8PFJetsPuppiSoftDropValueMap:nb1AK8PuppiSoftDropN2')", float, doc="N2 with beta=1", precision=10),
252  n3b1 = Var("userFloat('ak8PFJetsPuppiSoftDropValueMap:nb1AK8PuppiSoftDropN3')", float, doc="N3 with beta=1", precision=10),
253  msoftdrop = Var("groomedMass('SoftDropPuppi')",float, doc="Corrected soft drop mass with PUPPI",precision=10),
254  btagCMVA = Var("bDiscriminator('pfCombinedMVAV2BJetTags')",float,doc="CMVA V2 btag discriminator",precision=10),
255  btagDeepB = Var("bDiscriminator('pfDeepCSVJetTags:probb')+bDiscriminator('pfDeepCSVJetTags:probbb')",float,doc="DeepCSV b+bb tag discriminator",precision=10),
256  btagCSVV2 = Var("bDiscriminator('pfCombinedInclusiveSecondaryVertexV2BJetTags')",float,doc=" pfCombinedInclusiveSecondaryVertexV2 b-tag discriminator (aka CSVV2)",precision=10),
257  btagHbb = Var("bDiscriminator('pfBoostedDoubleSecondaryVertexAK8BJetTags')",float,doc="Higgs to BB tagger discriminator",precision=10),
258  subJetIdx1 = Var("?numberOfSourceCandidatePtrs()>0 && sourceCandidatePtr(0).numberOfSourceCandidatePtrs()>0?sourceCandidatePtr(0).key():-1", int,
259  doc="index of first subjet"),
260  subJetIdx2 = Var("?numberOfSourceCandidatePtrs()>1 && sourceCandidatePtr(1).numberOfSourceCandidatePtrs()>0?sourceCandidatePtr(1).key():-1", int,
261  doc="index of second subjet"),
262 
263 # btagDeepC = Var("bDiscriminator('pfDeepCSVJetTags:probc')",float,doc="CMVA V2 btag discriminator",precision=10),
264 #puIdDisc = Var("userFloat('pileupJetId:fullDiscriminant')",float,doc="Pilup ID discriminant",precision=10),
265 # nConstituents = Var("numberOfDaughters()",int,doc="Number of particles in the jet"),
266 # rawFactor = Var("1.-jecFactor('Uncorrected')",float,doc="1 - Factor to get back to raw pT",precision=6),
267  )
268 )
269 ### Era dependent customization
270 run2_miniAOD_80XLegacy.toModify( fatJetTable.variables, msoftdrop_chs = Var("userFloat('ak8PFJetsCHSSoftDropMass')",float, doc="Legacy uncorrected soft drop mass with CHS",precision=10))
271 run2_miniAOD_80XLegacy.toModify( fatJetTable.variables.tau1, expr = cms.string("userFloat(\'ak8PFJetsPuppiValueMap:NjettinessAK8PuppiTau1\')"),)
272 run2_miniAOD_80XLegacy.toModify( fatJetTable.variables.tau2, expr = cms.string("userFloat(\'ak8PFJetsPuppiValueMap:NjettinessAK8PuppiTau2\')"),)
273 run2_miniAOD_80XLegacy.toModify( fatJetTable.variables.tau3, expr = cms.string("userFloat(\'ak8PFJetsPuppiValueMap:NjettinessAK8PuppiTau3\')"),)
274 run2_miniAOD_80XLegacy.toModify( fatJetTable.variables.tau4, expr = cms.string("-1"),)
275 run2_miniAOD_80XLegacy.toModify( fatJetTable.variables.n2b1, expr = cms.string("-1"),)
276 run2_miniAOD_80XLegacy.toModify( fatJetTable.variables.n3b1, expr = cms.string("-1"),)
277 run2_miniAOD_80XLegacy.toModify( fatJetTable.variables, jetId = Var("userInt('tightId')*2+userInt('looseId')",int,doc="Jet ID flags bit1 is loose, bit2 is tight"))
278 
279 run2_nanoAOD_92X.toModify( fatJetTable.variables.tau4, expr = cms.string("-1"),)
280 run2_nanoAOD_92X.toModify( fatJetTable.variables.n2b1, expr = cms.string("-1"),)
281 run2_nanoAOD_92X.toModify( fatJetTable.variables.n3b1, expr = cms.string("-1"),)
282 
283 
284 
285 subJetTable = cms.EDProducer("SimpleCandidateFlatTableProducer",
286  src = cms.InputTag("slimmedJetsAK8PFPuppiSoftDropPacked","SubJets"),
287  cut = cms.string(""), #probably already applied in miniaod
288  name = cms.string("SubJet"),
289  doc = cms.string("slimmedJetsAK8, i.e. ak8 fat jets for boosted analysis"),
290  singleton = cms.bool(False), # the number of entries is variable
291  extension = cms.bool(False), # this is the main table for the jets
292  variables = cms.PSet(P4Vars,
293  btagCMVA = Var("bDiscriminator('pfCombinedMVAV2BJetTags')",float,doc="CMVA V2 btag discriminator",precision=10),
294  btagDeepB = Var("bDiscriminator('pfDeepCSVJetTags:probb')+bDiscriminator('pfDeepCSVJetTags:probbb')",float,doc="DeepCSV b+bb tag discriminator",precision=10),
295  btagCSVV2 = Var("bDiscriminator('pfCombinedInclusiveSecondaryVertexV2BJetTags')",float,doc=" pfCombinedInclusiveSecondaryVertexV2 b-tag discriminator (aka CSVV2)",precision=10),
296  tau1 = Var("userFloat('NjettinessAK8Subjets:tau1')",float, doc="Nsubjettiness (1 axis)",precision=10),
297  tau2 = Var("userFloat('NjettinessAK8Subjets:tau2')",float, doc="Nsubjettiness (2 axis)",precision=10),
298  tau3 = Var("userFloat('NjettinessAK8Subjets:tau3')",float, doc="Nsubjettiness (3 axis)",precision=10),
299  tau4 = Var("userFloat('NjettinessAK8Subjets:tau4')",float, doc="Nsubjettiness (4 axis)",precision=10),
300  n2b1 = Var("userFloat('nb1AK8PuppiSoftDropSubjets:ecfN2')", float, doc="N2 with beta=1", precision=10),
301  n3b1 = Var("userFloat('nb1AK8PuppiSoftDropSubjets:ecfN3')", float, doc="N3 with beta=1", precision=10),
302  )
303 )
304 
305 #jets are not as precise as muons
306 fatJetTable.variables.pt.precision=10
307 subJetTable.variables.pt.precision=10
308 
309 run2_miniAOD_80XLegacy.toModify( subJetTable.variables.tau1, expr = cms.string("-1"),)
310 run2_miniAOD_80XLegacy.toModify( subJetTable.variables.tau2, expr = cms.string("-1"),)
311 run2_miniAOD_80XLegacy.toModify( subJetTable.variables.tau3, expr = cms.string("-1"),)
312 run2_miniAOD_80XLegacy.toModify( subJetTable.variables.tau4, expr = cms.string("-1"),)
313 run2_miniAOD_80XLegacy.toModify( subJetTable.variables.n2b1, expr = cms.string("-1"),)
314 run2_miniAOD_80XLegacy.toModify( subJetTable.variables.n3b1, expr = cms.string("-1"),)
315 
316 run2_nanoAOD_92X.toModify( subJetTable.variables.tau4, expr = cms.string("-1"),)
317 run2_nanoAOD_92X.toModify( subJetTable.variables.n2b1, expr = cms.string("-1"),)
318 run2_nanoAOD_92X.toModify( subJetTable.variables.n3b1, expr = cms.string("-1"),)
319 
320 
321 
322 
323 
324 ## MC STUFF ######################
325 jetMCTable = cms.EDProducer("SimpleCandidateFlatTableProducer",
326  src = cms.InputTag("linkedObjects","jets"),
327  cut = cms.string(""), #we should not filter on cross linked collections
328  name = cms.string("Jet"),
329  singleton = cms.bool(False), # the number of entries is variable
330  extension = cms.bool(True), # this is an extension table for the jets
331  variables = cms.PSet(
332  partonFlavour = Var("partonFlavour()", int, doc="flavour from parton matching"),
333  hadronFlavour = Var("hadronFlavour()", int, doc="flavour from hadron ghost clustering"),
334  genJetIdx = Var("?genJetFwdRef().backRef().isNonnull()?genJetFwdRef().backRef().key():-1", int, doc="index of matched gen jet"),
335  )
336 )
337 genJetTable = cms.EDProducer("SimpleCandidateFlatTableProducer",
338  src = cms.InputTag("slimmedGenJets"),
339  cut = cms.string("pt > 10"),
340  name = cms.string("GenJet"),
341  doc = cms.string("slimmedGenJets, i.e. ak4 Jets made with visible genparticles"),
342  singleton = cms.bool(False), # the number of entries is variable
343  extension = cms.bool(False), # this is the main table for the genjets
344  variables = cms.PSet(P4Vars,
345  #anything else?
346  )
347 )
348 patJetPartons = cms.EDProducer('HadronAndPartonSelector',
349  src = cms.InputTag("generator"),
350  particles = cms.InputTag("prunedGenParticles"),
351  partonMode = cms.string("Auto"),
352  fullChainPhysPartons = cms.bool(True)
353 )
354 genJetFlavourAssociation = cms.EDProducer("JetFlavourClustering",
355  jets = genJetTable.src,
356  bHadrons = cms.InputTag("patJetPartons","bHadrons"),
357  cHadrons = cms.InputTag("patJetPartons","cHadrons"),
358  partons = cms.InputTag("patJetPartons","physicsPartons"),
359  leptons = cms.InputTag("patJetPartons","leptons"),
360  jetAlgorithm = cms.string("AntiKt"),
361  rParam = cms.double(0.4),
362  ghostRescaling = cms.double(1e-18),
363  hadronFlavourHasPriority = cms.bool(False)
364 )
365 genJetFlavourTable = cms.EDProducer("GenJetFlavourTableProducer",
366  name = genJetTable.name,
367  src = genJetTable.src,
368  cut = genJetTable.cut,
369  deltaR = cms.double(0.1),
370  jetFlavourInfos = cms.InputTag("slimmedGenJetsFlavourInfos"),
371 )
372 
373 genJetAK8Table = cms.EDProducer("SimpleCandidateFlatTableProducer",
374  src = cms.InputTag("slimmedGenJetsAK8"),
375  cut = cms.string("pt > 100."),
376  name = cms.string("GenJetAK8"),
377  doc = cms.string("slimmedGenJetsAK8SoftDropSubJets, i.e. subjets of ak8 Jets made with visible genparticles"),
378  singleton = cms.bool(False), # the number of entries is variable
379  extension = cms.bool(False), # this is the main table for the genjets
380  variables = cms.PSet(P4Vars,
381  #anything else?
382  )
383 )
384 genJetAK8FlavourAssociation = cms.EDProducer("JetFlavourClustering",
385  jets = genJetAK8Table.src,
386  bHadrons = cms.InputTag("patJetPartons","bHadrons"),
387  cHadrons = cms.InputTag("patJetPartons","cHadrons"),
388  partons = cms.InputTag("patJetPartons","physicsPartons"),
389  leptons = cms.InputTag("patJetPartons","leptons"),
390  jetAlgorithm = cms.string("AntiKt"),
391  rParam = cms.double(0.8),
392  ghostRescaling = cms.double(1e-18),
393  hadronFlavourHasPriority = cms.bool(False)
394 )
395 genJetAK8FlavourTable = cms.EDProducer("GenJetFlavourTableProducer",
396  name = genJetAK8Table.name,
397  src = genJetAK8Table.src,
398  cut = genJetAK8Table.cut,
399  deltaR = cms.double(0.1),
400  jetFlavourInfos = cms.InputTag("genJetAK8FlavourAssociation"),
401 )
402 genSubJetAK8Table = cms.EDProducer("SimpleCandidateFlatTableProducer",
403  src = cms.InputTag("slimmedGenJetsAK8SoftDropSubJets"),
404  cut = cms.string(""), ## These don't get a pt cut, but in miniAOD only subjets from fat jets with pt > 100 are kept
405  name = cms.string("SubGenJetAK8"),
406  doc = cms.string("slimmedGenJetsAK8SoftDropSubJets, i.e. subjets of ak8 Jets made with visible genparticles"),
407  singleton = cms.bool(False), # the number of entries is variable
408  extension = cms.bool(False), # this is the main table for the genjets
409  variables = cms.PSet(P4Vars,
410  #anything else?
411  )
412 )
413 ### Era dependent customization
414 run2_miniAOD_80XLegacy.toModify( genJetFlavourTable, jetFlavourInfos = cms.InputTag("genJetFlavourAssociation"),)
415 run2_nanoAOD_92X.toModify( genJetFlavourTable, jetFlavourInfos = cms.InputTag("genJetFlavourAssociation"),)
416 
417 #before cross linking
418 jetSequence = cms.Sequence(tightJetId+tightJetIdLepVeto+slimmedJetsWithUserData+jetCorrFactors+updatedJets+tightJetIdAK8+tightJetIdLepVetoAK8+slimmedJetsAK8WithUserData+jetCorrFactorsAK8+updatedJetsAK8+chsForSATkJets+softActivityJets+softActivityJets2+softActivityJets5+softActivityJets10+finalJets+finalJetsAK8)
419 
420 from RecoJets.JetProducers.QGTagger_cfi import QGTagger
421 qgtagger80x=QGTagger.clone(srcJets="slimmedJets",srcVertexCollection="offlineSlimmedPrimaryVertices")
422 
423 _jetSequence_80X = jetSequence.copy()
424 _jetSequence_80X.replace(tightJetIdLepVeto, looseJetId)
425 _jetSequence_80X.replace(tightJetIdLepVetoAK8, looseJetIdAK8)
426 _jetSequence_80X.insert(1,qgtagger80x)
427 run2_miniAOD_80XLegacy.toReplaceWith(jetSequence, _jetSequence_80X)
428 
429 #after cross linkining
430 jetTables = cms.Sequence(bjetMVA+ jetTable+fatJetTable+subJetTable+saJetTable+saTable)
431 
432 #MC only producers and tables
433 jetMC = cms.Sequence(jetMCTable+genJetTable+patJetPartons+genJetFlavourTable+genJetAK8Table+genJetAK8FlavourAssociation+genJetAK8FlavourTable+genSubJetAK8Table)
434 _jetMC_pre94X = jetMC.copy()
435 _jetMC_pre94X.insert(_jetMC_pre94X.index(genJetFlavourTable),genJetFlavourAssociation)
436 _jetMC_pre94X.remove(genSubJetAK8Table)
437 run2_miniAOD_80XLegacy.toReplaceWith(jetMC, _jetMC_pre94X)
438 run2_nanoAOD_92X.toReplaceWith(jetMC, _jetMC_pre94X)
439 
440 
def ExtVar(tag, valtype, compression=None, doc=None, mcOnly=False, precision=-1)
Definition: common_cff.py:31
def Var(expr, valtype, compression=None, doc=None, mcOnly=False, precision=-1)
Definition: common_cff.py:20