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_jme_2016_cff import run2_jme_2016
3 from Configuration.Eras.Modifier_run2_jme_2017_cff import run2_jme_2017
4 from Configuration.Eras.Modifier_run2_miniAOD_80XLegacy_cff import run2_miniAOD_80XLegacy
5 
8 
9 
10 
11 from RecoJets.JetProducers.ak4PFJets_cfi import ak4PFJets
12 
13 chsForSATkJets = cms.EDFilter("CandPtrSelector", src = cms.InputTag("packedPFCandidates"), cut = cms.string('charge()!=0 && pvAssociationQuality()>=5 && vertexRef().key()==0'))
14 softActivityJets = ak4PFJets.clone(src = 'chsForSATkJets', doAreaFastjet = False, jetPtMin=1)
15 softActivityJets10 = cms.EDFilter("CandPtrSelector", src = cms.InputTag("softActivityJets"), cut = cms.string('pt>10'))
16 softActivityJets5 = cms.EDFilter("CandPtrSelector", src = cms.InputTag("softActivityJets"), cut = cms.string('pt>5'))
17 softActivityJets2 = cms.EDFilter("CandPtrSelector", src = cms.InputTag("softActivityJets"), cut = cms.string('pt>2'))
18 
20 # Note: Safe to always add 'L2L3Residual' as MC contains dummy L2L3Residual corrections (always set to 1)
21 # (cf. https://twiki.cern.ch/twiki/bin/view/CMSPublic/WorkBookJetEnergyCorrections#CMSSW_7_6_4_and_above )
22 jetCorrFactorsNano = patJetCorrFactors.clone(src='slimmedJets',
23  levels = cms.vstring('L1FastJet',
24  'L2Relative',
25  'L3Absolute',
26  'L2L3Residual'),
27  primaryVertices = cms.InputTag("offlineSlimmedPrimaryVertices"),
28 )
29 jetCorrFactorsAK8 = patJetCorrFactors.clone(src='slimmedJetsAK8',
30  levels = cms.vstring('L1FastJet',
31  'L2Relative',
32  'L3Absolute',
33  'L2L3Residual'),
34  payload = cms.string('AK8PFPuppi'),
35  primaryVertices = cms.InputTag("offlineSlimmedPrimaryVertices"),
36 )
37 run2_miniAOD_80XLegacy.toModify(jetCorrFactorsAK8, payload = cms.string('AK8PFchs')) # ak8PFJetsCHS in 2016 80X miniAOD
38 
40 
41 updatedJets = updatedPatJets.clone(
42  addBTagInfo=False,
43  jetSource='slimmedJets',
44  jetCorrFactorsSource=cms.VInputTag(cms.InputTag("jetCorrFactorsNano") ),
45 )
46 
47 updatedJetsAK8 = updatedPatJets.clone(
48  addBTagInfo=False,
49  jetSource='slimmedJetsAK8',
50  jetCorrFactorsSource=cms.VInputTag(cms.InputTag("jetCorrFactorsAK8") ),
51 )
52 
53 
54 looseJetId = cms.EDProducer("PatJetIDValueMapProducer",
55  filterParams=cms.PSet(
56  version = cms.string('WINTER16'),
57  quality = cms.string('LOOSE'),
58  ),
59  src = cms.InputTag("updatedJets")
60 )
61 tightJetId = cms.EDProducer("PatJetIDValueMapProducer",
62  filterParams=cms.PSet(
63  version = cms.string('SUMMER18'),
64  quality = cms.string('TIGHT'),
65  ),
66  src = cms.InputTag("updatedJets")
67 )
68 tightJetIdLepVeto = cms.EDProducer("PatJetIDValueMapProducer",
69  filterParams=cms.PSet(
70  version = cms.string('SUMMER18'),
71  quality = cms.string('TIGHTLEPVETO'),
72  ),
73  src = cms.InputTag("updatedJets")
74 )
75 run2_jme_2016.toModify( tightJetId.filterParams, version = "WINTER16" )
76 run2_jme_2016.toModify( tightJetIdLepVeto.filterParams, version = "WINTER16" )
77 run2_jme_2017.toModify( tightJetId.filterParams, version = "WINTER17" )
78 run2_jme_2017.toModify( tightJetIdLepVeto.filterParams, version = "WINTER17" )
79 
80 
81 looseJetIdAK8 = cms.EDProducer("PatJetIDValueMapProducer",
82  filterParams=cms.PSet(
83  version = cms.string('WINTER16'),
84  quality = cms.string('LOOSE'),
85  ),
86  src = cms.InputTag("updatedJetsAK8")
87 )
88 tightJetIdAK8 = cms.EDProducer("PatJetIDValueMapProducer",
89  filterParams=cms.PSet(
90  version = cms.string('SUMMER18PUPPI'),
91  quality = cms.string('TIGHT'),
92  ),
93  src = cms.InputTag("updatedJetsAK8")
94 )
95 tightJetIdLepVetoAK8 = cms.EDProducer("PatJetIDValueMapProducer",
96  filterParams=cms.PSet(
97  version = cms.string('SUMMER18PUPPI'),
98  quality = cms.string('TIGHTLEPVETO'),
99  ),
100  src = cms.InputTag("updatedJetsAK8")
101 )
102 run2_jme_2016.toModify( tightJetIdAK8.filterParams, version = "WINTER16" )
103 run2_jme_2016.toModify( tightJetIdLepVetoAK8.filterParams, version = "WINTER16" )
104 run2_jme_2017.toModify( tightJetIdAK8.filterParams, version = "WINTER17PUPPI" )
105 run2_jme_2017.toModify( tightJetIdLepVetoAK8.filterParams, version = "WINTER17PUPPI" )
106 
107 
108 bJetVars = cms.EDProducer("JetRegressionVarProducer",
109  pvsrc = cms.InputTag("offlineSlimmedPrimaryVertices"),
110  src = cms.InputTag("updatedJets"),
111  svsrc = cms.InputTag("slimmedSecondaryVertices"),
112  gpsrc = cms.InputTag("prunedGenParticles"),
113  #musrc = cms.InputTag("slimmedMuons"),
114  #elesrc = cms.InputTag("slimmedElectrons")
115 )
116 
117 jercVars = cms.EDProducer("BetaStarPackedCandidateVarProducer",
118  srcJet = cms.InputTag("updatedJets"),
119  srcPF = cms.InputTag("packedPFCandidates"),
120  maxDR = cms.double(0.4)
121 )
122 
123 updatedJetsWithUserData = cms.EDProducer("PATJetUserDataEmbedder",
124  src = cms.InputTag("updatedJets"),
125  userFloats = cms.PSet(
126  leadTrackPt = cms.InputTag("bJetVars:leadTrackPt"),
127  leptonPtRel = cms.InputTag("bJetVars:leptonPtRel"),
128  leptonPtRatio = cms.InputTag("bJetVars:leptonPtRatio"),
129  leptonPtRelInv = cms.InputTag("bJetVars:leptonPtRelInv"),
130  leptonPtRelv0 = cms.InputTag("bJetVars:leptonPtRelv0"),
131  leptonPtRatiov0 = cms.InputTag("bJetVars:leptonPtRatiov0"),
132  leptonPtRelInvv0 = cms.InputTag("bJetVars:leptonPtRelInvv0"),
133  leptonDeltaR = cms.InputTag("bJetVars:leptonDeltaR"),
134  leptonPt = cms.InputTag("bJetVars:leptonPt"),
135  vtxPt = cms.InputTag("bJetVars:vtxPt"),
136  vtxMass = cms.InputTag("bJetVars:vtxMass"),
137  vtx3dL = cms.InputTag("bJetVars:vtx3dL"),
138  vtx3deL = cms.InputTag("bJetVars:vtx3deL"),
139  ptD = cms.InputTag("bJetVars:ptD"),
140  genPtwNu = cms.InputTag("bJetVars:genPtwNu"),
141  qgl = cms.InputTag('qgtagger:qgLikelihood'),
142  puId94XDisc = cms.InputTag('pileupJetId94X:fullDiscriminant'),
143  puId102XDisc = cms.InputTag('pileupJetId102X:fullDiscriminant'),
144  chFPV0EF = cms.InputTag("jercVars:chargedFromPV0EnergyFraction"),
145  chFPV1EF = cms.InputTag("jercVars:chargedFromPV1EnergyFraction"),
146  chFPV2EF = cms.InputTag("jercVars:chargedFromPV2EnergyFraction"),
147  chFPV3EF = cms.InputTag("jercVars:chargedFromPV3EnergyFraction"),
148  ),
149  userInts = cms.PSet(
150  tightId = cms.InputTag("tightJetId"),
151  tightIdLepVeto = cms.InputTag("tightJetIdLepVeto"),
152  vtxNtrk = cms.InputTag("bJetVars:vtxNtrk"),
153  leptonPdgId = cms.InputTag("bJetVars:leptonPdgId"),
154  ),
155 )
156 run2_jme_2016.toModify(updatedJetsWithUserData.userInts,
157  looseId = cms.InputTag("looseJetId"),
158 )
159 
160 updatedJetsAK8WithUserData = cms.EDProducer("PATJetUserDataEmbedder",
161  src = cms.InputTag("updatedJetsAK8"),
162  userInts = cms.PSet(
163  tightId = cms.InputTag("tightJetIdAK8"),
164  tightIdLepVeto = cms.InputTag("tightJetIdLepVetoAK8"),
165  ),
166 )
167 run2_jme_2016.toModify(updatedJetsAK8WithUserData.userInts,
168  looseId = cms.InputTag("looseJetIdAK8"),
169 )
170 
171 
172 finalJets = cms.EDFilter("PATJetRefSelector",
173  src = cms.InputTag("updatedJetsWithUserData"),
174  cut = cms.string("pt > 15")
175 )
176 
177 finalJetsAK8 = cms.EDFilter("PATJetRefSelector",
178  src = cms.InputTag("updatedJetsAK8WithUserData"),
179  cut = cms.string("pt > 170")
180 )
181 
182 lepInJetVars = cms.EDProducer("LepInJetProducer",
183  src = cms.InputTag("updatedJetsAK8WithUserData"),
184  srcEle = cms.InputTag("finalElectrons"),
185  srcMu = cms.InputTag("finalMuons")
186 )
187 
188 
189 
190 
191 
192 
193 
194 jetTable = cms.EDProducer("SimpleCandidateFlatTableProducer",
195  src = cms.InputTag("linkedObjects","jets"),
196  cut = cms.string(""), #we should not filter on cross linked collections
197  name = cms.string("Jet"),
198  doc = cms.string("slimmedJets, i.e. ak4 PFJets CHS with JECs applied, after basic selection (" + finalJets.cut.value()+")"),
199  singleton = cms.bool(False), # the number of entries is variable
200  extension = cms.bool(False), # this is the main table for the jets
201  externalVariables = cms.PSet(
202  bRegCorr = ExtVar(cms.InputTag("bjetNN:corr"),float, doc="pt correction for b-jet energy regression",precision=10),
203  bRegRes = ExtVar(cms.InputTag("bjetNN:res"),float, doc="res on pt corrected with b-jet regression",precision=6),
204  cRegCorr = ExtVar(cms.InputTag("cjetNN:corr"),float, doc="pt correction for c-jet energy regression",precision=10),
205  cRegRes = ExtVar(cms.InputTag("cjetNN:res"),float, doc="res on pt corrected with c-jet regression",precision=6),
206  ),
207  variables = cms.PSet(P4Vars,
208  area = Var("jetArea()", float, doc="jet catchment area, for JECs",precision=10),
209  nMuons = Var("?hasOverlaps('muons')?overlaps('muons').size():0", int, doc="number of muons in the jet"),
210  muonIdx1 = Var("?overlaps('muons').size()>0?overlaps('muons')[0].key():-1", int, doc="index of first matching muon"),
211  muonIdx2 = Var("?overlaps('muons').size()>1?overlaps('muons')[1].key():-1", int, doc="index of second matching muon"),
212  electronIdx1 = Var("?overlaps('electrons').size()>0?overlaps('electrons')[0].key():-1", int, doc="index of first matching electron"),
213  electronIdx2 = Var("?overlaps('electrons').size()>1?overlaps('electrons')[1].key():-1", int, doc="index of second matching electron"),
214  nElectrons = Var("?hasOverlaps('electrons')?overlaps('electrons').size():0", int, doc="number of electrons in the jet"),
215  btagCMVA = Var("bDiscriminator('pfCombinedMVAV2BJetTags')",float,doc="CMVA V2 btag discriminator",precision=10),
216  btagDeepB = Var("bDiscriminator('pfDeepCSVJetTags:probb')+bDiscriminator('pfDeepCSVJetTags:probbb')",float,doc="DeepCSV b+bb tag discriminator",precision=10),
217  btagDeepFlavB = Var("bDiscriminator('pfDeepFlavourJetTags:probb')+bDiscriminator('pfDeepFlavourJetTags:probbb')+bDiscriminator('pfDeepFlavourJetTags:problepb')",float,doc="DeepFlavour b+bb+lepb tag discriminator",precision=10),
218  btagCSVV2 = Var("bDiscriminator('pfCombinedInclusiveSecondaryVertexV2BJetTags')",float,doc=" pfCombinedInclusiveSecondaryVertexV2 b-tag discriminator (aka CSVV2)",precision=10),
219  btagDeepC = Var("bDiscriminator('pfDeepCSVJetTags:probc')",float,doc="DeepCSV charm btag discriminator",precision=10),
220  btagDeepFlavC = Var("bDiscriminator('pfDeepFlavourJetTags:probc')",float,doc="DeepFlavour charm tag discriminator",precision=10),
221  puIdDisc = Var("userFloat('puId102XDisc')",float,doc="Pilup ID discriminant with 102X (2018) training",precision=10),
222  puId = Var("userInt('pileupJetId:fullId')",int,doc="Pilup ID flags with 80X (2016) training"),
223  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"),
224  qgl = Var("userFloat('qgl')",float,doc="Quark vs Gluon likelihood discriminator",precision=10),
225  nConstituents = Var("numberOfDaughters()",int,doc="Number of particles in the jet"),
226  rawFactor = Var("1.-jecFactor('Uncorrected')",float,doc="1 - Factor to get back to raw pT",precision=6),
227  chHEF = Var("chargedHadronEnergyFraction()", float, doc="charged Hadron Energy Fraction", precision= 6),
228  neHEF = Var("neutralHadronEnergyFraction()", float, doc="neutral Hadron Energy Fraction", precision= 6),
229  chEmEF = Var("chargedEmEnergyFraction()", float, doc="charged Electromagnetic Energy Fraction", precision= 6),
230  neEmEF = Var("neutralEmEnergyFraction()", float, doc="neutral Electromagnetic Energy Fraction", precision= 6),
231  muEF = Var("muonEnergyFraction()", float, doc="muon Energy Fraction", precision= 6),
232  chFPV0EF = Var("userFloat('chFPV0EF')", float, doc="charged fromPV==0 Energy Fraction (energy excluded from CHS jets). Previously called betastar.", precision= 6),
233  chFPV1EF = Var("userFloat('chFPV1EF')", float, doc="charged fromPV==1 Energy Fraction (component of the total charged Energy Fraction).", precision= 6),
234  chFPV2EF = Var("userFloat('chFPV2EF')", float, doc="charged fromPV==2 Energy Fraction (component of the total charged Energy Fraction).", precision= 6),
235  chFPV3EF = Var("userFloat('chFPV3EF')", float, doc="charged fromPV==3 Energy Fraction (component of the total charged Energy Fraction).", precision= 6),
236  )
237 )
238 
239 #jets are not as precise as muons
240 jetTable.variables.pt.precision=10
241 
242 
243 run2_jme_2016.toModify( jetTable.variables, jetId = Var("userInt('tightIdLepVeto')*4+userInt('tightId')*2+userInt('looseId')",int,doc="Jet ID flags bit1 is loose, bit2 is tight, bit3 is tightLepVeto"))
244 run2_jme_2016.toModify( jetTable.variables, puIdDisc = Var("userFloat('pileupJetId:fullDiscriminant')",float,doc="Pilup ID discriminant with 80X (2016) training",precision=10))
245 run2_jme_2017.toModify( jetTable.variables, puIdDisc = Var("userFloat('puId94XDisc')", float,doc="Pilup ID discriminant with 94X (2017) training",precision=10))
246 
247 bjetNN= cms.EDProducer("BJetEnergyRegressionMVA",
248  backend = cms.string("TF"),
249  src = cms.InputTag("linkedObjects","jets"),
250  pvsrc = cms.InputTag("offlineSlimmedPrimaryVertices"),
251  svsrc = cms.InputTag("slimmedSecondaryVertices"),
252  rhosrc = cms.InputTag("fixedGridRhoFastjetAll"),
253 
254  weightFile = cms.FileInPath("PhysicsTools/NanoAOD/data/breg_training_2018.pb"),
255  name = cms.string("JetRegNN"),
256  isClassifier = cms.bool(False),
257  variablesOrder = cms.vstring(["Jet_pt","Jet_eta","rho","Jet_mt","Jet_leadTrackPt","Jet_leptonPtRel","Jet_leptonDeltaR","Jet_neHEF",
258  "Jet_neEmEF","Jet_vtxPt","Jet_vtxMass","Jet_vtx3dL","Jet_vtxNtrk","Jet_vtx3deL",
259  "Jet_numDaughters_pt03","Jet_energyRing_dR0_em_Jet_rawEnergy","Jet_energyRing_dR1_em_Jet_rawEnergy",
260  "Jet_energyRing_dR2_em_Jet_rawEnergy","Jet_energyRing_dR3_em_Jet_rawEnergy","Jet_energyRing_dR4_em_Jet_rawEnergy",
261  "Jet_energyRing_dR0_neut_Jet_rawEnergy","Jet_energyRing_dR1_neut_Jet_rawEnergy","Jet_energyRing_dR2_neut_Jet_rawEnergy",
262  "Jet_energyRing_dR3_neut_Jet_rawEnergy","Jet_energyRing_dR4_neut_Jet_rawEnergy","Jet_energyRing_dR0_ch_Jet_rawEnergy",
263  "Jet_energyRing_dR1_ch_Jet_rawEnergy","Jet_energyRing_dR2_ch_Jet_rawEnergy","Jet_energyRing_dR3_ch_Jet_rawEnergy",
264  "Jet_energyRing_dR4_ch_Jet_rawEnergy","Jet_energyRing_dR0_mu_Jet_rawEnergy","Jet_energyRing_dR1_mu_Jet_rawEnergy",
265  "Jet_energyRing_dR2_mu_Jet_rawEnergy","Jet_energyRing_dR3_mu_Jet_rawEnergy","Jet_energyRing_dR4_mu_Jet_rawEnergy",
266  "Jet_chHEF","Jet_chEmEF","Jet_leptonPtRelInv","isEle","isMu","isOther","Jet_mass","Jet_ptd"]),
267  variables = cms.PSet(
268  Jet_pt = cms.string("pt*jecFactor('Uncorrected')"),
269  Jet_mt = cms.string("mt*jecFactor('Uncorrected')"),
270  Jet_eta = cms.string("eta"),
271  Jet_mass = cms.string("mass*jecFactor('Uncorrected')"),
272  Jet_ptd = cms.string("userFloat('ptD')"),
273  Jet_leadTrackPt = cms.string("userFloat('leadTrackPt')"),
274  Jet_vtxNtrk = cms.string("userInt('vtxNtrk')"),
275  Jet_vtxMass = cms.string("userFloat('vtxMass')"),
276  Jet_vtx3dL = cms.string("userFloat('vtx3dL')"),
277  Jet_vtx3deL = cms.string("userFloat('vtx3deL')"),
278  Jet_vtxPt = cms.string("userFloat('vtxPt')"),
279  #Jet_leptonPt = cms.string("userFloat('leptonPt')"),
280  Jet_leptonPtRel = cms.string("userFloat('leptonPtRelv0')"),
281  Jet_leptonPtRelInv = cms.string("userFloat('leptonPtRelInvv0')*jecFactor('Uncorrected')"),
282  Jet_leptonDeltaR = cms.string("userFloat('leptonDeltaR')"),
283  #Jet_leptonPdgId = cms.string("userInt('leptonPdgId')"),
284  Jet_neHEF = cms.string("neutralHadronEnergyFraction()"),
285  Jet_neEmEF = cms.string("neutralEmEnergyFraction()"),
286  Jet_chHEF = cms.string("chargedHadronEnergyFraction()"),
287  Jet_chEmEF = cms.string("chargedEmEnergyFraction()"),
288  isMu = cms.string("?abs(userInt('leptonPdgId'))==13?1:0"),
289  isEle = cms.string("?abs(userInt('leptonPdgId'))==11?1:0"),
290  isOther = cms.string("?userInt('leptonPdgId')==0?1:0"),
291  ),
292  inputTensorName = cms.string("ffwd_inp"),
293  outputTensorName = cms.string("ffwd_out/BiasAdd"),
294  outputNames = cms.vstring(["corr","res"]),
295  outputFormulas = cms.vstring(["at(0)*0.27912887930870056+1.0545977354049683","0.5*(at(2)-at(1))*0.27912887930870056"]),
296  nThreads = cms.uint32(1),
297  singleThreadPool = cms.string("no_threads"),
298 )
299 
300 cjetNN= cms.EDProducer("BJetEnergyRegressionMVA",
301  backend = cms.string("TF"),
302  src = cms.InputTag("linkedObjects","jets"),
303  pvsrc = cms.InputTag("offlineSlimmedPrimaryVertices"),
304  svsrc = cms.InputTag("slimmedSecondaryVertices"),
305  rhosrc = cms.InputTag("fixedGridRhoFastjetAll"),
306 
307  weightFile = cms.FileInPath("PhysicsTools/NanoAOD/data/creg_training_2018.pb"),
308  name = cms.string("JetRegNN"),
309  isClassifier = cms.bool(False),
310  variablesOrder = cms.vstring(["Jet_pt","Jet_eta","rho","Jet_mt","Jet_leadTrackPt","Jet_leptonPtRel","Jet_leptonDeltaR",
311  "Jet_neHEF","Jet_neEmEF","Jet_vtxPt","Jet_vtxMass","Jet_vtx3dL","Jet_vtxNtrk","Jet_vtx3deL",
312  "Jet_numDaughters_pt03","Jet_chEmEF","Jet_chHEF", "Jet_ptd","Jet_mass",
313  "Jet_energyRing_dR0_em_Jet_rawEnergy","Jet_energyRing_dR1_em_Jet_rawEnergy",
314  "Jet_energyRing_dR2_em_Jet_rawEnergy","Jet_energyRing_dR3_em_Jet_rawEnergy","Jet_energyRing_dR4_em_Jet_rawEnergy",
315  "Jet_energyRing_dR0_neut_Jet_rawEnergy","Jet_energyRing_dR1_neut_Jet_rawEnergy","Jet_energyRing_dR2_neut_Jet_rawEnergy",
316  "Jet_energyRing_dR3_neut_Jet_rawEnergy","Jet_energyRing_dR4_neut_Jet_rawEnergy","Jet_energyRing_dR0_ch_Jet_rawEnergy",
317  "Jet_energyRing_dR1_ch_Jet_rawEnergy","Jet_energyRing_dR2_ch_Jet_rawEnergy","Jet_energyRing_dR3_ch_Jet_rawEnergy",
318  "Jet_energyRing_dR4_ch_Jet_rawEnergy","Jet_energyRing_dR0_mu_Jet_rawEnergy","Jet_energyRing_dR1_mu_Jet_rawEnergy",
319  "Jet_energyRing_dR2_mu_Jet_rawEnergy","Jet_energyRing_dR3_mu_Jet_rawEnergy","Jet_energyRing_dR4_mu_Jet_rawEnergy"]),
320  variables = cms.PSet(
321  Jet_pt = cms.string("pt*jecFactor('Uncorrected')"),
322  Jet_mt = cms.string("mt*jecFactor('Uncorrected')"),
323  Jet_eta = cms.string("eta"),
324  Jet_mass = cms.string("mass*jecFactor('Uncorrected')"),
325  Jet_ptd = cms.string("userFloat('ptD')"),
326  Jet_leadTrackPt = cms.string("userFloat('leadTrackPt')"),
327  Jet_vtxNtrk = cms.string("userInt('vtxNtrk')"),
328  Jet_vtxMass = cms.string("userFloat('vtxMass')"),
329  Jet_vtx3dL = cms.string("userFloat('vtx3dL')"),
330  Jet_vtx3deL = cms.string("userFloat('vtx3deL')"),
331  Jet_vtxPt = cms.string("userFloat('vtxPt')"),
332  #Jet_leptonPt = cms.string("userFloat('leptonPt')"),
333  Jet_leptonPtRel = cms.string("userFloat('leptonPtRelv0')"),
334  Jet_leptonPtRelInv = cms.string("userFloat('leptonPtRelInvv0')*jecFactor('Uncorrected')"),
335  Jet_leptonDeltaR = cms.string("userFloat('leptonDeltaR')"),
336  #Jet_leptonPdgId = cms.string("userInt('leptonPdgId')"),
337  Jet_neHEF = cms.string("neutralHadronEnergyFraction()"),
338  Jet_neEmEF = cms.string("neutralEmEnergyFraction()"),
339  Jet_chHEF = cms.string("chargedHadronEnergyFraction()"),
340  Jet_chEmEF = cms.string("chargedEmEnergyFraction()"),
341  isMu = cms.string("?abs(userInt('leptonPdgId'))==13?1:0"),
342  isEle = cms.string("?abs(userInt('leptonPdgId'))==11?1:0"),
343  isOther = cms.string("?userInt('leptonPdgId')==0?1:0"),
344  ),
345  inputTensorName = cms.string("ffwd_inp"),
346  outputTensorName = cms.string("ffwd_out/BiasAdd"),
347  outputNames = cms.vstring(["corr","res"]),
348  outputFormulas = cms.vstring(["at(0)*0.24325256049633026+0.993854820728302","0.5*(at(2)-at(1))*0.24325256049633026"]),
349  nThreads = cms.uint32(1),
350  singleThreadPool = cms.string("no_threads"),
351 )
352 
353 
354 
355 saJetTable = cms.EDProducer("SimpleCandidateFlatTableProducer",
356  src = cms.InputTag("softActivityJets"),
357  cut = cms.string(""),
358  maxLen = cms.uint32(6),
359  name = cms.string("SoftActivityJet"),
360  doc = cms.string("jets clustered from charged candidates compatible with primary vertex (" + chsForSATkJets.cut.value()+")"),
361  singleton = cms.bool(False), # the number of entries is variable
362  extension = cms.bool(False), # this is the main table for the jets
363  variables = cms.PSet(P3Vars,
364  )
365 )
366 
367 saJetTable.variables.pt.precision=10
368 saJetTable.variables.eta.precision=8
369 saJetTable.variables.phi.precision=8
370 
371 saTable = cms.EDProducer("GlobalVariablesTableProducer",
372  variables = cms.PSet(
373  SoftActivityJetHT = ExtVar( cms.InputTag("softActivityJets"), "candidatescalarsum", doc = "scalar sum of soft activity jet pt, pt>1" ),
374  SoftActivityJetHT10 = ExtVar( cms.InputTag("softActivityJets10"), "candidatescalarsum", doc = "scalar sum of soft activity jet pt , pt >10" ),
375  SoftActivityJetHT5 = ExtVar( cms.InputTag("softActivityJets5"), "candidatescalarsum", doc = "scalar sum of soft activity jet pt, pt>5" ),
376  SoftActivityJetHT2 = ExtVar( cms.InputTag("softActivityJets2"), "candidatescalarsum", doc = "scalar sum of soft activity jet pt, pt >2" ),
377  SoftActivityJetNjets10 = ExtVar( cms.InputTag("softActivityJets10"), "candidatesize", doc = "number of soft activity jet pt, pt >2" ),
378  SoftActivityJetNjets5 = ExtVar( cms.InputTag("softActivityJets5"), "candidatesize", doc = "number of soft activity jet pt, pt >5" ),
379  SoftActivityJetNjets2 = ExtVar( cms.InputTag("softActivityJets2"), "candidatesize", doc = "number of soft activity jet pt, pt >10" ),
380 
381  )
382 )
383 
384 
385 
386 
387 fatJetTable = cms.EDProducer("SimpleCandidateFlatTableProducer",
388  src = cms.InputTag("finalJetsAK8"),
389  cut = cms.string(" pt > 170"), #probably already applied in miniaod
390  name = cms.string("FatJet"),
391  doc = cms.string("slimmedJetsAK8, i.e. ak8 fat jets for boosted analysis"),
392  singleton = cms.bool(False), # the number of entries is variable
393  extension = cms.bool(False), # this is the main table for the jets
394  variables = cms.PSet(P4Vars,
395  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"),
396  area = Var("jetArea()", float, doc="jet catchment area, for JECs",precision=10),
397  rawFactor = Var("1.-jecFactor('Uncorrected')",float,doc="1 - Factor to get back to raw pT",precision=6),
398  tau1 = Var("userFloat('NjettinessAK8Puppi:tau1')",float, doc="Nsubjettiness (1 axis)",precision=10),
399  tau2 = Var("userFloat('NjettinessAK8Puppi:tau2')",float, doc="Nsubjettiness (2 axis)",precision=10),
400  tau3 = Var("userFloat('NjettinessAK8Puppi:tau3')",float, doc="Nsubjettiness (3 axis)",precision=10),
401  tau4 = Var("userFloat('NjettinessAK8Puppi:tau4')",float, doc="Nsubjettiness (4 axis)",precision=10),
402  n2b1 = Var("userFloat('ak8PFJetsPuppiSoftDropValueMap:nb1AK8PuppiSoftDropN2')", float, doc="N2 with beta=1", precision=10),
403  n3b1 = Var("userFloat('ak8PFJetsPuppiSoftDropValueMap:nb1AK8PuppiSoftDropN3')", float, doc="N3 with beta=1", precision=10),
404  msoftdrop = Var("groomedMass('SoftDropPuppi')",float, doc="Corrected soft drop mass with PUPPI",precision=10),
405  btagCMVA = Var("bDiscriminator('pfCombinedMVAV2BJetTags')",float,doc="CMVA V2 btag discriminator",precision=10),
406  btagDeepB = Var("bDiscriminator('pfDeepCSVJetTags:probb')+bDiscriminator('pfDeepCSVJetTags:probbb')",float,doc="DeepCSV b+bb tag discriminator",precision=10),
407  btagCSVV2 = Var("bDiscriminator('pfCombinedInclusiveSecondaryVertexV2BJetTags')",float,doc=" pfCombinedInclusiveSecondaryVertexV2 b-tag discriminator (aka CSVV2)",precision=10),
408  btagHbb = Var("bDiscriminator('pfBoostedDoubleSecondaryVertexAK8BJetTags')",float,doc="Higgs to BB tagger discriminator",precision=10),
409  btagDDBvL_noMD = Var("bDiscriminator('pfDeepDoubleBvLJetTags:probHbb')",float,doc="DeepDoubleX discriminator (no mass-decorrelation) for H(Z)->bb vs QCD",precision=10),
410  btagDDCvL_noMD = Var("bDiscriminator('pfDeepDoubleCvLJetTags:probHcc')",float,doc="DeepDoubleX discriminator (no mass-decorrelation) for H(Z)->cc vs QCD",precision=10),
411  btagDDCvB_noMD = Var("bDiscriminator('pfDeepDoubleCvBJetTags:probHcc')",float,doc="DeepDoubleX discriminator (no mass-decorrelation) for H(Z)->cc vs H(Z)->bb",precision=10),
412  btagDDBvL = Var("bDiscriminator('pfMassIndependentDeepDoubleBvLJetTags:probHbb')",float,doc="DeepDoubleX (mass-decorrelated) discriminator for H(Z)->bb vs QCD",precision=10),
413  btagDDCvL = Var("bDiscriminator('pfMassIndependentDeepDoubleCvLJetTags:probHcc')",float,doc="DeepDoubleX (mass-decorrelated) discriminator for H(Z)->cc vs QCD",precision=10),
414  btagDDCvB = Var("bDiscriminator('pfMassIndependentDeepDoubleCvBJetTags:probHcc')",float,doc="DeepDoubleX (mass-decorrelated) discriminator for H(Z)->cc vs H(Z)->bb",precision=10),
415  deepTag_TvsQCD = Var("bDiscriminator('pfDeepBoostedDiscriminatorsJetTags:TvsQCD')",float,doc="DeepBoostedJet tagger top vs QCD discriminator",precision=10),
416  deepTag_WvsQCD = Var("bDiscriminator('pfDeepBoostedDiscriminatorsJetTags:WvsQCD')",float,doc="DeepBoostedJet tagger W vs QCD discriminator",precision=10),
417  deepTag_ZvsQCD = Var("bDiscriminator('pfDeepBoostedDiscriminatorsJetTags:ZvsQCD')",float,doc="DeepBoostedJet tagger Z vs QCD discriminator",precision=10),
418  deepTag_H = Var("bDiscriminator('pfDeepBoostedJetTags:probHbb')+bDiscriminator('pfDeepBoostedJetTags:probHcc')+bDiscriminator('pfDeepBoostedJetTags:probHqqqq')",float,doc="DeepBoostedJet tagger H(bb,cc,4q) sum",precision=10),
419  deepTag_QCD = Var("bDiscriminator('pfDeepBoostedJetTags:probQCDbb')+bDiscriminator('pfDeepBoostedJetTags:probQCDcc')+bDiscriminator('pfDeepBoostedJetTags:probQCDb')+bDiscriminator('pfDeepBoostedJetTags:probQCDc')+bDiscriminator('pfDeepBoostedJetTags:probQCDothers')",float,doc="DeepBoostedJet tagger QCD(bb,cc,b,c,others) sum",precision=10),
420  deepTag_QCDothers = Var("bDiscriminator('pfDeepBoostedJetTags:probQCDothers')",float,doc="DeepBoostedJet tagger QCDothers value",precision=10),
421  deepTagMD_TvsQCD = Var("bDiscriminator('pfMassDecorrelatedDeepBoostedDiscriminatorsJetTags:TvsQCD')",float,doc="Mass-decorrelated DeepBoostedJet tagger top vs QCD discriminator",precision=10),
422  deepTagMD_WvsQCD = Var("bDiscriminator('pfMassDecorrelatedDeepBoostedDiscriminatorsJetTags:WvsQCD')",float,doc="Mass-decorrelated DeepBoostedJet tagger W vs QCD discriminator",precision=10),
423  deepTagMD_ZvsQCD = Var("bDiscriminator('pfMassDecorrelatedDeepBoostedDiscriminatorsJetTags:ZvsQCD')",float,doc="Mass-decorrelated DeepBoostedJet tagger Z vs QCD discriminator",precision=10),
424  deepTagMD_ZHbbvsQCD = Var("bDiscriminator('pfMassDecorrelatedDeepBoostedDiscriminatorsJetTags:ZHbbvsQCD')",float,doc="Mass-decorrelated DeepBoostedJet tagger Z/H->bb vs QCD discriminator",precision=10),
425  deepTagMD_ZbbvsQCD = Var("bDiscriminator('pfMassDecorrelatedDeepBoostedDiscriminatorsJetTags:ZbbvsQCD')",float,doc="Mass-decorrelated DeepBoostedJet tagger Z->bb vs QCD discriminator",precision=10),
426  deepTagMD_HbbvsQCD = Var("bDiscriminator('pfMassDecorrelatedDeepBoostedDiscriminatorsJetTags:HbbvsQCD')",float,doc="Mass-decorrelated DeepBoostedJet tagger H->bb vs QCD discriminator",precision=10),
427  deepTagMD_ZHccvsQCD = Var("bDiscriminator('pfMassDecorrelatedDeepBoostedDiscriminatorsJetTags:ZHccvsQCD')",float,doc="Mass-decorrelated DeepBoostedJet tagger Z/H->cc vs QCD discriminator",precision=10),
428  deepTagMD_H4qvsQCD = Var("bDiscriminator('pfMassDecorrelatedDeepBoostedDiscriminatorsJetTags:H4qvsQCD')",float,doc="Mass-decorrelated DeepBoostedJet tagger H->4q vs QCD discriminator",precision=10),
429  deepTagMD_bbvsLight = Var("bDiscriminator('pfMassDecorrelatedDeepBoostedDiscriminatorsJetTags:bbvsLight')",float,doc="Mass-decorrelated DeepBoostedJet tagger Z/H/gluon->bb vs light flavour discriminator",precision=10),
430  deepTagMD_ccvsLight = Var("bDiscriminator('pfMassDecorrelatedDeepBoostedDiscriminatorsJetTags:ccvsLight')",float,doc="Mass-decorrelated DeepBoostedJet tagger Z/H/gluon->cc vs light flavour discriminator",precision=10),
431  subJetIdx1 = Var("?nSubjetCollections()>0 && subjets('SoftDropPuppi').size()>0?subjets('SoftDropPuppi')[0].key():-1", int,
432  doc="index of first subjet"),
433  subJetIdx2 = Var("?nSubjetCollections()>0 && subjets('SoftDropPuppi').size()>1?subjets('SoftDropPuppi')[1].key():-1", int,
434  doc="index of second subjet"),
435 
436 # btagDeepC = Var("bDiscriminator('pfDeepCSVJetTags:probc')",float,doc="CMVA V2 btag discriminator",precision=10),
437 #puIdDisc = Var("userFloat('pileupJetId:fullDiscriminant')",float,doc="Pilup ID discriminant",precision=10),
438 # nConstituents = Var("numberOfDaughters()",int,doc="Number of particles in the jet"),
439 # rawFactor = Var("1.-jecFactor('Uncorrected')",float,doc="1 - Factor to get back to raw pT",precision=6),
440  ),
441  externalVariables = cms.PSet(
442  lsf3 = ExtVar(cms.InputTag("lepInJetVars:lsf3"),float, doc="Lepton Subjet Fraction (3 subjets)",precision=10),
443  muonIdx3SJ = ExtVar(cms.InputTag("lepInJetVars:muIdx3SJ"),int, doc="index of muon matched to jet"),
444  electronIdx3SJ = ExtVar(cms.InputTag("lepInJetVars:eleIdx3SJ"),int,doc="index of electron matched to jet"),
445  )
446 )
447 
448 run2_miniAOD_80XLegacy.toModify( fatJetTable.variables, msoftdrop_chs = Var("userFloat('ak8PFJetsCHSSoftDropMass')",float, doc="Legacy uncorrected soft drop mass with CHS",precision=10))
449 run2_miniAOD_80XLegacy.toModify( fatJetTable.variables.tau1, expr = cms.string("userFloat(\'ak8PFJetsPuppiValueMap:NjettinessAK8PuppiTau1\')"),)
450 run2_miniAOD_80XLegacy.toModify( fatJetTable.variables.tau2, expr = cms.string("userFloat(\'ak8PFJetsPuppiValueMap:NjettinessAK8PuppiTau2\')"),)
451 run2_miniAOD_80XLegacy.toModify( fatJetTable.variables.tau3, expr = cms.string("userFloat(\'ak8PFJetsPuppiValueMap:NjettinessAK8PuppiTau3\')"),)
452 run2_miniAOD_80XLegacy.toModify( fatJetTable.variables, tau4 = None)
453 run2_miniAOD_80XLegacy.toModify( fatJetTable.variables, n2b1 = None)
454 run2_miniAOD_80XLegacy.toModify( fatJetTable.variables, n3b1 = None)
455 run2_jme_2016.toModify( fatJetTable.variables, jetId = Var("userInt('tightId')*2+userInt('looseId')",int,doc="Jet ID flags bit1 is loose, bit2 is tight"))
456 
457 run2_jme_2016.toModify( bjetNN, weightFile = cms.FileInPath("PhysicsTools/NanoAOD/data/breg_training_2016.pb") )
458 run2_jme_2016.toModify( bjetNN,outputFormulas = cms.vstring(["at(0)*0.31976690888404846+1.047176718711853","0.5*(at(2)-at(1))*0.31976690888404846"]))
459 
460 run2_jme_2017.toModify( bjetNN, weightFile = cms.FileInPath("PhysicsTools/NanoAOD/data/breg_training_2017.pb") )
461 run2_jme_2017.toModify( bjetNN,outputFormulas = cms.vstring(["at(0)*0.28225210309028625+1.055067777633667","0.5*(at(2)-at(1))*0.28225210309028625"]))
462 
463 run2_jme_2016.toModify( cjetNN, weightFile = cms.FileInPath("PhysicsTools/NanoAOD/data/creg_training_2016.pb") )
464 run2_jme_2016.toModify( cjetNN,outputFormulas = cms.vstring(["at(0)*0.28862622380256653+0.9908722639083862","0.5*(at(2)-at(1))*0.28862622380256653"]))
465 
466 run2_jme_2017.toModify( cjetNN, weightFile = cms.FileInPath("PhysicsTools/NanoAOD/data/creg_training_2017.pb") )
467 run2_jme_2017.toModify( cjetNN,outputFormulas = cms.vstring(["at(0)*0.24718524515628815+0.9927206635475159","0.5*(at(2)-at(1))*0.24718524515628815"]))
468 
469 
470 
471 subJetTable = cms.EDProducer("SimpleCandidateFlatTableProducer",
472  src = cms.InputTag("slimmedJetsAK8PFPuppiSoftDropPacked","SubJets"),
473  cut = cms.string(""), #probably already applied in miniaod
474  name = cms.string("SubJet"),
475  doc = cms.string("slimmedJetsAK8, i.e. ak8 fat jets for boosted analysis"),
476  singleton = cms.bool(False), # the number of entries is variable
477  extension = cms.bool(False), # this is the main table for the jets
478  variables = cms.PSet(P4Vars,
479  btagCMVA = Var("bDiscriminator('pfCombinedMVAV2BJetTags')",float,doc="CMVA V2 btag discriminator",precision=10),
480  btagDeepB = Var("bDiscriminator('pfDeepCSVJetTags:probb')+bDiscriminator('pfDeepCSVJetTags:probbb')",float,doc="DeepCSV b+bb tag discriminator",precision=10),
481  btagCSVV2 = Var("bDiscriminator('pfCombinedInclusiveSecondaryVertexV2BJetTags')",float,doc=" pfCombinedInclusiveSecondaryVertexV2 b-tag discriminator (aka CSVV2)",precision=10),
482  rawFactor = Var("1.-jecFactor('Uncorrected')",float,doc="1 - Factor to get back to raw pT",precision=6),
483  tau1 = Var("userFloat('NjettinessAK8Subjets:tau1')",float, doc="Nsubjettiness (1 axis)",precision=10),
484  tau2 = Var("userFloat('NjettinessAK8Subjets:tau2')",float, doc="Nsubjettiness (2 axis)",precision=10),
485  tau3 = Var("userFloat('NjettinessAK8Subjets:tau3')",float, doc="Nsubjettiness (3 axis)",precision=10),
486  tau4 = Var("userFloat('NjettinessAK8Subjets:tau4')",float, doc="Nsubjettiness (4 axis)",precision=10),
487  n2b1 = Var("userFloat('nb1AK8PuppiSoftDropSubjets:ecfN2')", float, doc="N2 with beta=1", precision=10),
488  n3b1 = Var("userFloat('nb1AK8PuppiSoftDropSubjets:ecfN3')", float, doc="N3 with beta=1", precision=10),
489  )
490 )
491 
492 #jets are not as precise as muons
493 fatJetTable.variables.pt.precision=10
494 subJetTable.variables.pt.precision=10
495 
496 run2_miniAOD_80XLegacy.toModify( subJetTable.variables, tau1 = None)
497 run2_miniAOD_80XLegacy.toModify( subJetTable.variables, tau2 = None)
498 run2_miniAOD_80XLegacy.toModify( subJetTable.variables, tau3 = None)
499 run2_miniAOD_80XLegacy.toModify( subJetTable.variables, tau4 = None)
500 run2_miniAOD_80XLegacy.toModify( subJetTable.variables, n2b1 = None)
501 run2_miniAOD_80XLegacy.toModify( subJetTable.variables, n3b1 = None)
502 run2_miniAOD_80XLegacy.toModify( subJetTable.variables, btagCMVA = None, btagDeepB = None)
503 
504 
505 corrT1METJetTable = cms.EDProducer("SimpleCandidateFlatTableProducer",
506  src = cms.InputTag("corrT1METJets"),
507  cut = cms.string(""),
508  name = cms.string("CorrT1METJet"),
509  doc = cms.string("Additional low-pt jets for Type-1 MET re-correction"),
510  singleton = cms.bool(False), # the number of entries is variable
511  extension = cms.bool(False), # this is the main table for the jets
512  variables = cms.PSet(
513  rawPt = Var("pt()*jecFactor('Uncorrected')",float,precision=10),
514  eta = Var("eta", float,precision=12),
515  phi = Var("phi", float, precision=12),
516  area = Var("jetArea()", float, doc="jet catchment area, for JECs",precision=10),
517  )
518 )
519 
520 
521 
522 
523 jetMCTable = cms.EDProducer("SimpleCandidateFlatTableProducer",
524  src = cms.InputTag("linkedObjects","jets"),
525  cut = cms.string(""), #we should not filter on cross linked collections
526  name = cms.string("Jet"),
527  singleton = cms.bool(False), # the number of entries is variable
528  extension = cms.bool(True), # this is an extension table for the jets
529  variables = cms.PSet(
530  partonFlavour = Var("partonFlavour()", int, doc="flavour from parton matching"),
531  hadronFlavour = Var("hadronFlavour()", int, doc="flavour from hadron ghost clustering"),
532  genJetIdx = Var("?genJetFwdRef().backRef().isNonnull()?genJetFwdRef().backRef().key():-1", int, doc="index of matched gen jet"),
533  )
534 )
535 genJetTable = cms.EDProducer("SimpleCandidateFlatTableProducer",
536  src = cms.InputTag("slimmedGenJets"),
537  cut = cms.string("pt > 10"),
538  name = cms.string("GenJet"),
539  doc = cms.string("slimmedGenJets, i.e. ak4 Jets made with visible genparticles"),
540  singleton = cms.bool(False), # the number of entries is variable
541  extension = cms.bool(False), # this is the main table for the genjets
542  variables = cms.PSet(P4Vars,
543  #anything else?
544  )
545 )
546 patJetPartons = cms.EDProducer('HadronAndPartonSelector',
547  src = cms.InputTag("generator"),
548  particles = cms.InputTag("prunedGenParticles"),
549  partonMode = cms.string("Auto"),
550  fullChainPhysPartons = cms.bool(True)
551 )
552 genJetFlavourAssociation = cms.EDProducer("JetFlavourClustering",
553  jets = genJetTable.src,
554  bHadrons = cms.InputTag("patJetPartons","bHadrons"),
555  cHadrons = cms.InputTag("patJetPartons","cHadrons"),
556  partons = cms.InputTag("patJetPartons","physicsPartons"),
557  leptons = cms.InputTag("patJetPartons","leptons"),
558  jetAlgorithm = cms.string("AntiKt"),
559  rParam = cms.double(0.4),
560  ghostRescaling = cms.double(1e-18),
561  hadronFlavourHasPriority = cms.bool(False)
562 )
563 genJetFlavourTable = cms.EDProducer("GenJetFlavourTableProducer",
564  name = genJetTable.name,
565  src = genJetTable.src,
566  cut = genJetTable.cut,
567  deltaR = cms.double(0.1),
568  jetFlavourInfos = cms.InputTag("slimmedGenJetsFlavourInfos"),
569 )
570 
571 genJetAK8Table = cms.EDProducer("SimpleCandidateFlatTableProducer",
572  src = cms.InputTag("slimmedGenJetsAK8"),
573  cut = cms.string("pt > 100."),
574  name = cms.string("GenJetAK8"),
575  doc = cms.string("slimmedGenJetsAK8, i.e. ak8 Jets made with visible genparticles"),
576  singleton = cms.bool(False), # the number of entries is variable
577  extension = cms.bool(False), # this is the main table for the genjets
578  variables = cms.PSet(P4Vars,
579  #anything else?
580  )
581 )
582 genJetAK8FlavourAssociation = cms.EDProducer("JetFlavourClustering",
583  jets = genJetAK8Table.src,
584  bHadrons = cms.InputTag("patJetPartons","bHadrons"),
585  cHadrons = cms.InputTag("patJetPartons","cHadrons"),
586  partons = cms.InputTag("patJetPartons","physicsPartons"),
587  leptons = cms.InputTag("patJetPartons","leptons"),
588  jetAlgorithm = cms.string("AntiKt"),
589  rParam = cms.double(0.8),
590  ghostRescaling = cms.double(1e-18),
591  hadronFlavourHasPriority = cms.bool(False)
592 )
593 genJetAK8FlavourTable = cms.EDProducer("GenJetFlavourTableProducer",
594  name = genJetAK8Table.name,
595  src = genJetAK8Table.src,
596  cut = genJetAK8Table.cut,
597  deltaR = cms.double(0.1),
598  jetFlavourInfos = cms.InputTag("genJetAK8FlavourAssociation"),
599 )
600 fatJetMCTable = cms.EDProducer("SimpleCandidateFlatTableProducer",
601  src = fatJetTable.src,
602  cut = fatJetTable.cut,
603  name = fatJetTable.name,
604  singleton = cms.bool(False),
605  extension = cms.bool(True),
606  variables = cms.PSet(
607  nBHadrons = Var("jetFlavourInfo().getbHadrons().size()", "uint8", doc="number of b-hadrons"),
608  nCHadrons = Var("jetFlavourInfo().getcHadrons().size()", "uint8", doc="number of c-hadrons"),
609  hadronFlavour = Var("hadronFlavour()", int, doc="flavour from hadron ghost clustering"),
610  genJetAK8Idx = Var("?genJetFwdRef().backRef().isNonnull()?genJetFwdRef().backRef().key():-1", int, doc="index of matched gen AK8 jet"),
611  )
612 )
613 
614 genSubJetAK8Table = cms.EDProducer("SimpleCandidateFlatTableProducer",
615  src = cms.InputTag("slimmedGenJetsAK8SoftDropSubJets"),
616  cut = cms.string(""),
617  name = cms.string("SubGenJetAK8"),
618  doc = cms.string("slimmedGenJetsAK8SoftDropSubJets, i.e. subjets of ak8 Jets made with visible genparticles"),
619  singleton = cms.bool(False), # the number of entries is variable
620  extension = cms.bool(False), # this is the main table for the genjets
621  variables = cms.PSet(P4Vars,
622  #anything else?
623  )
624 )
625 subjetMCTable = cms.EDProducer("SimpleCandidateFlatTableProducer",
626  src = subJetTable.src,
627  cut = subJetTable.cut,
628  name = subJetTable.name,
629  singleton = cms.bool(False),
630  extension = cms.bool(True),
631  variables = cms.PSet(
632  nBHadrons = Var("jetFlavourInfo().getbHadrons().size()", "uint8", doc="number of b-hadrons"),
633  nCHadrons = Var("jetFlavourInfo().getcHadrons().size()", "uint8", doc="number of c-hadrons"),
634  )
635 )
636 
637 
638 run2_miniAOD_80XLegacy.toModify( genJetFlavourTable, jetFlavourInfos = cms.InputTag("genJetFlavourAssociation"),)
639 
640 from RecoJets.JetProducers.QGTagger_cfi import QGTagger
641 qgtagger=QGTagger.clone(srcJets="updatedJets",srcVertexCollection="offlineSlimmedPrimaryVertices")
642 
643 from RecoJets.JetProducers.PileupJetID_cfi import pileupJetId, _chsalgos_94x, _chsalgos_102x
644 pileupJetId94X=pileupJetId.clone(jets="updatedJets",algos = cms.VPSet(_chsalgos_94x),inputIsCorrected=True,applyJec=False,vertexes="offlineSlimmedPrimaryVertices")
645 pileupJetId102X=pileupJetId.clone(jets="updatedJets",algos = cms.VPSet(_chsalgos_102x),inputIsCorrected=True,applyJec=False,vertexes="offlineSlimmedPrimaryVertices")
646 
647 #before cross linking
648 jetSequence = cms.Sequence(jetCorrFactorsNano+updatedJets+tightJetId+tightJetIdLepVeto+bJetVars+qgtagger+jercVars+pileupJetId94X+pileupJetId102X+updatedJetsWithUserData+jetCorrFactorsAK8+updatedJetsAK8+tightJetIdAK8+tightJetIdLepVetoAK8+updatedJetsAK8WithUserData+chsForSATkJets+softActivityJets+softActivityJets2+softActivityJets5+softActivityJets10+finalJets+finalJetsAK8)
649 
650 
651 _jetSequence_2016 = jetSequence.copy()
652 _jetSequence_2016.insert(_jetSequence_2016.index(tightJetId), looseJetId)
653 _jetSequence_2016.insert(_jetSequence_2016.index(tightJetIdAK8), looseJetIdAK8)
654 run2_jme_2016.toReplaceWith(jetSequence, _jetSequence_2016)
655 
656 #after lepton collections have been run
657 jetLepSequence = cms.Sequence(lepInJetVars)
658 
659 #after cross linkining
660 jetTables = cms.Sequence(bjetNN+cjetNN+jetTable+fatJetTable+subJetTable+saJetTable+saTable)
661 
662 #MC only producers and tables
663 jetMC = cms.Sequence(jetMCTable+genJetTable+patJetPartons+genJetFlavourTable+genJetAK8Table+genJetAK8FlavourAssociation+genJetAK8FlavourTable+fatJetMCTable+genSubJetAK8Table+subjetMCTable)
664 _jetMC_pre94X = jetMC.copy()
665 _jetMC_pre94X.insert(_jetMC_pre94X.index(genJetFlavourTable),genJetFlavourAssociation)
666 _jetMC_pre94X.remove(genSubJetAK8Table)
667 run2_miniAOD_80XLegacy.toReplaceWith(jetMC, _jetMC_pre94X)
668 
669 
ak4PFJetsBetaStar_cfi
common_cff
common_cff.Var
def Var(expr, valtype, compression=None, doc=None, mcOnly=False, precision=-1)
Definition: common_cff.py:20
jetCorrFactors_cfi
ak4PFJets_cfi
QGTagger_cfi
common_cff.ExtVar
def ExtVar(tag, valtype, compression=None, doc=None, mcOnly=False, precision=-1)
Definition: common_cff.py:31
jetUpdater_cfi
PileupJetID_cfi