1 import FWCore.ParameterSet.Config
as cms
8 from PhysicsTools.NanoAOD.simpleCandidateFlatTableProducer_cfi
import simpleCandidateFlatTableProducer
9 from PhysicsTools.NanoAOD.btvMC_cff
import allPFPFCandsMCSequence,ak4ak8PFCandsMCSequence,ak8onlyPFCandsMCSequence,ak4onlyPFCandsMCSequence
20 from RecoBTag.ONNXRuntime.pfParticleNetFromMiniAODAK4_cff
import _pfParticleNetFromMiniAODAK4PuppiCentralJetTagsAll
as pfParticleNetFromMiniAODAK4PuppiCentralJetTagsAll
22 from RecoBTag.ONNXRuntime.pfParticleNetFromMiniAODAK4_cff
import _pfNegativeParticleNetFromMiniAODAK4PuppiCentralJetTagsProbs
as pfNegativeParticleNetFromMiniAODAK4PuppiCentralJetTagsProbs
24 _btagDiscriminators = [
25 'pfJetProbabilityBJetTags',
26 'pfJetBProbabilityBJetTags',
27 'pfNegativeOnlyJetProbabilityBJetTags',
28 'pfNegativeOnlyJetBProbabilityBJetTags',
29 'pfDeepFlavourJetTags:probb',
30 'pfDeepFlavourJetTags:probbb',
31 'pfDeepFlavourJetTags:problepb',
32 'pfDeepFlavourJetTags:probc',
33 'pfDeepFlavourJetTags:probuds',
34 'pfDeepFlavourJetTags:probg',
35 'pfNegativeDeepFlavourJetTags:probb',
36 'pfNegativeDeepFlavourJetTags:probbb',
37 'pfNegativeDeepFlavourJetTags:problepb',
38 'pfNegativeDeepFlavourJetTags:probc',
39 'pfNegativeDeepFlavourJetTags:probuds',
40 'pfNegativeDeepFlavourJetTags:probg',
41 ] + pfParticleNetFromMiniAODAK4PuppiCentralJetTagsAll + pfNegativeParticleNetFromMiniAODAK4PuppiCentralJetTagsProbs
45 jetSource=cms.InputTag(
'slimmedJetsPuppi'),
46 jetCorrections=(
'AK4PFPuppi',
48 [
'L1FastJet',
'L2Relative',
'L3Absolute',
49 'L2L3Residual']),
'None'),
50 btagDiscriminators=_btagDiscriminators,
51 postfix=
'PuppiWithDeepInfo',
53 process.load(
"Configuration.StandardSequences.MagneticField_cff")
54 process.jetPuppiCorrFactorsNano.src =
"selectedUpdatedPatJetsPuppiWithDeepInfo" 55 process.updatedJetsPuppi.jetSource =
"selectedUpdatedPatJetsPuppiWithDeepInfo" 58 process.updatedPatJetsTransientCorrectedPuppiWithDeepInfo.tagInfoSources.append(cms.InputTag(
"pfDeepFlavourTagInfosPuppiWithDeepInfo"))
59 process.updatedPatJetsTransientCorrectedPuppiWithDeepInfo.addTagInfos = cms.bool(
True)
69 _btagDiscriminators = [
70 'pfMassIndependentDeepDoubleBvLV2JetTags:probHbb',
71 'pfMassIndependentDeepDoubleCvLV2JetTags:probHcc',
72 'pfMassIndependentDeepDoubleCvBV2JetTags:probHcc',
75 _btagDiscriminators += pfParticleNetJetTagsAll
78 jetSource=cms.InputTag(
'slimmedJetsAK8'),
79 pvSource=cms.InputTag(
'offlineSlimmedPrimaryVertices'),
80 svSource=cms.InputTag(
'slimmedSecondaryVertices'),
82 jetCorrections=(
'AK8PFPuppi',
84 'L1FastJet',
'L2Relative',
'L3Absolute',
87 btagDiscriminators=_btagDiscriminators,
88 postfix=
'AK8WithDeepInfo',
92 process.jetCorrFactorsAK8.src =
"selectedUpdatedPatJetsAK8WithDeepInfo" 93 process.updatedJetsAK8.jetSource =
"selectedUpdatedPatJetsAK8WithDeepInfo" 95 process.updatedPatJetsTransientCorrectedAK8WithDeepInfo.tagInfoSources.append(cms.InputTag(
"pfDeepDoubleXTagInfosAK8WithDeepInfo"))
96 process.updatedPatJetsTransientCorrectedAK8WithDeepInfo.addTagInfos = cms.bool(
True)
103 _btagDiscriminators = [
104 'pfJetProbabilityBJetTags',
105 'pfDeepCSVJetTags:probb',
106 'pfDeepCSVJetTags:probc',
107 'pfDeepCSVJetTags:probbb',
108 'pfDeepCSVJetTags:probudsg',
112 labelName=
'SoftDropSubjetsPF',
113 jetSource=cms.InputTag(
"slimmedJetsAK8PFPuppiSoftDropPacked",
"SubJets"),
114 jetCorrections=(
'AK4PFPuppi',
115 [
'L2Relative',
'L3Absolute'],
'None'),
116 btagDiscriminators=list(_btagDiscriminators),
119 fatJets=cms.InputTag(
'slimmedJetsAK8'),
122 postfix=
'AK8SubjetsWithDeepInfo')
124 process.subJetTable.src =
'selectedUpdatedPatJetsSoftDropSubjetsPFAK8SubjetsWithDeepInfo' 133 DDX_jetNTracks =
Var(
"tagInfo(\'pfDeepDoubleX\').features().tag_info_features.jetNTracks", int, doc=
"number of tracks associated with the jet"),
134 DDX_jetNSecondaryVertices =
Var(
"tagInfo(\'pfDeepDoubleX\').features().tag_info_features.jetNSecondaryVertices", int, doc=
"number of SVs associated with the jet"),
135 DDX_tau1_trackEtaRel_0 =
Var(
"tagInfo(\'pfDeepDoubleX\').features().tag_info_features.tau1_trackEtaRel_0", float, doc=
"1st smallest track pseudorapidity, relative to the jet axis, associated to the 1st N-subjettiness axis", precision=10),
136 DDX_tau1_trackEtaRel_1 =
Var(
"tagInfo(\'pfDeepDoubleX\').features().tag_info_features.tau1_trackEtaRel_1", float, doc=
"2nd smallest track pseudorapidity, relative to the jet axis, associated to the 1st N-subjettiness axis", precision=10),
137 DDX_tau1_trackEtaRel_2 =
Var(
"tagInfo(\'pfDeepDoubleX\').features().tag_info_features.tau1_trackEtaRel_2", float, doc=
"3rd smallest track pseudorapidity, relative to the jet axis, associated to the 1st N-subjettiness axis", precision=10),
138 DDX_tau2_trackEtaRel_0 =
Var(
"tagInfo(\'pfDeepDoubleX\').features().tag_info_features.tau2_trackEtaRel_0", float, doc=
"1st smallest track pseudorapidity, relative to the jet axis, associated to the 2nd N-subjettiness axis", precision=10),
139 DDX_tau2_trackEtaRel_1 =
Var(
"tagInfo(\'pfDeepDoubleX\').features().tag_info_features.tau2_trackEtaRel_1", float, doc=
"2nd smallest track pseudorapidity, relative to the jet axis, associated to the 2nd N-subjettiness axis", precision=10),
140 DDX_tau2_trackEtaRel_3 =
Var(
"tagInfo(\'pfDeepDoubleX\').features().tag_info_features.tau2_trackEtaRel_2", float, doc=
"3rd smallest track pseudorapidity, relative to the jet axis, associated to the 2nd N-subjettiness axis", precision=10),
141 DDX_tau1_flightDistance2dSig =
Var(
"tagInfo(\'pfDeepDoubleX\').features().tag_info_features.tau1_flightDistance2dSig", float, doc=
"transverse distance significance between primary and secondary vertex associated to the 1st N-subjettiness axis", precision=10),
142 DDX_tau2_flightDistance2dSig =
Var(
"tagInfo(\'pfDeepDoubleX\').features().tag_info_features.tau2_flightDistance2dSig", float, doc=
"transverse distance significance between primary and secondary vertex associated to the 2nd N-subjettiness axis", precision=10),
143 DDX_tau1_vertexDeltaR =
Var(
"tagInfo(\'pfDeepDoubleX\').features().tag_info_features.tau1_vertexDeltaR", float, doc=
"deltaR between the 1st N-subjettiness axis and secondary vertex direction", precision=10),
144 DDX_tau1_vertexEnergyRatio =
Var(
"tagInfo(\'pfDeepDoubleX\').features().tag_info_features.tau1_vertexEnergyRatio", float, doc=
"ratio of energy at secondary vertex over total energy associated to the 1st N-subjettiness axis", precision=10),
145 DDX_tau2_vertexEnergyRatio =
Var(
"tagInfo(\'pfDeepDoubleX\').features().tag_info_features.tau2_vertexEnergyRatio", float, doc=
"ratio of energy at secondary vertex over total energy associated to the 2nd N-subjettiness axis", precision=10),
146 DDX_tau1_vertexMass =
Var(
"tagInfo(\'pfDeepDoubleX\').features().tag_info_features.tau1_vertexMass", float, doc=
"mass of track sum at secondary vertex associated to the 1st N-subjettiness axis", precision=10),
147 DDX_tau2_vertexMass =
Var(
"tagInfo(\'pfDeepDoubleX\').features().tag_info_features.tau2_vertexMass", float, doc=
"mass of track sum at secondary vertex associated to the 2nd N-subjettiness axis", precision=10),
148 DDX_trackSip2dSigAboveBottom_0 =
Var(
"tagInfo(\'pfDeepDoubleX\').features().tag_info_features.trackSip2dSigAboveBottom_0", float, doc=
"track 2D signed impact parameter significance of 1st track lifting mass above bottom", precision=10),
149 DDX_trackSip2dSigAboveBottom_1 =
Var(
"tagInfo(\'pfDeepDoubleX\').features().tag_info_features.trackSip2dSigAboveBottom_1", float, doc=
"track 2D signed impact parameter significance of 2nd track lifting mass above bottom", precision=10),
150 DDX_trackSip2dSigAboveCharm =
Var(
"tagInfo(\'pfDeepDoubleX\').features().tag_info_features.trackSip2dSigAboveCharm", float, doc=
"track 2D signed impact parameter significance of 1st track lifting mass above charm", precision=10),
151 DDX_trackSip3dSig_0 =
Var(
"tagInfo(\'pfDeepDoubleX\').features().tag_info_features.trackSip3dSig_0", float, doc=
"1st largest track 3D signed impact parameter significance", precision=10),
152 DDX_tau1_trackSip3dSig_0 =
Var(
"tagInfo(\'pfDeepDoubleX\').features().tag_info_features.tau1_trackSip3dSig_0", float, doc=
"1st largest track 3D signed impact parameter significance associated to the 1st N-subjettiness axis", precision=10),
153 DDX_tau1_trackSip3dSig_1 =
Var(
"tagInfo(\'pfDeepDoubleX\').features().tag_info_features.tau1_trackSip3dSig_1", float, doc=
"2nd largest track 3D signed impact parameter significance associated to the 1st N-subjettiness axis", precision=10),
154 DDX_trackSip3dSig_1 =
Var(
"tagInfo(\'pfDeepDoubleX\').features().tag_info_features.trackSip3dSig_1", float, doc=
"2nd largest track 3D signed impact parameter significance", precision=10),
155 DDX_tau2_trackSip3dSig_0 =
Var(
"tagInfo(\'pfDeepDoubleX\').features().tag_info_features.tau2_trackSip3dSig_0", float, doc=
"1st largest track 3D signed impact parameter significance associated to the 2nd N-subjettiness axis", precision=10),
156 DDX_tau2_trackSip3dSig_1 =
Var(
"tagInfo(\'pfDeepDoubleX\').features().tag_info_features.tau2_trackSip3dSig_1", float, doc=
"2nd largest track 3D signed impact parameter significance associated to the 2nd N-subjettiness axis", precision=10),
157 DDX_trackSip3dSig_2 =
Var(
"tagInfo(\'pfDeepDoubleX\').features().tag_info_features.trackSip3dSig_2", float, doc=
"3rd largest track 3D signed impact parameter significance", precision=10),
158 DDX_trackSip3dSig_3 =
Var(
"tagInfo(\'pfDeepDoubleX\').features().tag_info_features.trackSip3dSig_3", float, doc=
"4th largest track 3D signed impact parameter significance", precision=10),
159 DDX_z_ratio =
Var(
"tagInfo(\'pfDeepDoubleX\').features().tag_info_features.z_ratio", float, doc=
"z = deltaR(SV0,SV1)*pT(SV1)/m(SV0,SV1), defined in Eq. 7 of arXiv:1712.07158", precision=10)
164 DeepCSVVars = cms.PSet(
214 DeepCSV_trackJetPt =
Var(
"tagInfo(\'pfDeepCSV\').taggingVariables.get(\'trackJetPt\', -999)", float, doc=
"track-based jet transverse momentum", precision=10),
215 DeepCSV_vertexCategory =
Var(
"tagInfo(\'pfDeepCSV\').taggingVariables.get(\'vertexCategory\', -999)", float, doc=
"category of secondary vertex (Reco, Pseudo, No)", precision=10),
216 DeepCSV_jetNSecondaryVertices =
Var(
"tagInfo(\'pfDeepCSV\').taggingVariables.get(\'jetNSecondaryVertices\', -999)", int, doc=
"number of reconstructed possible secondary vertices in jet"),
217 DeepCSV_jetNSelectedTracks =
Var(
"tagInfo(\'pfDeepCSV\').taggingVariables.get(\'jetNSelectedTracks\', -999)", int, doc=
"selected tracks in the jet"),
218 DeepCSV_jetNTracksEtaRel =
Var(
"tagInfo(\'pfDeepCSV\').taggingVariables.get(\'jetNTracksEtaRel\', -999)", int, doc=
"number of tracks for which etaRel is computed"),
219 DeepCSV_trackSumJetEtRatio =
Var(
"tagInfo(\'pfDeepCSV\').taggingVariables.get(\'trackSumJetEtRatio\', -999)", float, doc=
"ratio of track sum transverse energy over jet energy", precision=10),
220 DeepCSV_trackSumJetDeltaR =
Var(
"tagInfo(\'pfDeepCSV\').taggingVariables.get(\'trackSumJetDeltaR\', -999)", float, doc=
"pseudoangular distance between jet axis and track fourvector sum", precision=10),
221 DeepCSV_trackSip2dValAboveCharm =
Var(
"tagInfo(\'pfDeepCSV\').taggingVariables.get(\'trackSip2dValAboveCharm\', -999)", float, doc=
"track 2D signed impact parameter of first track lifting mass above charm", precision=10),
222 DeepCSV_trackSip2dSigAboveCharm =
Var(
"tagInfo(\'pfDeepCSV\').taggingVariables.get(\'trackSip2dSigAboveCharm\', -999)", float, doc=
"track 2D signed impact parameter significance of first track lifting mass above charm", precision=10),
223 DeepCSV_trackSip3dValAboveCharm =
Var(
"tagInfo(\'pfDeepCSV\').taggingVariables.get(\'trackSip3dValAboveCharm\', -999)", float, doc=
"track 3D signed impact parameter of first track lifting mass above charm", precision=10),
224 DeepCSV_trackSip3dSigAboveCharm =
Var(
"tagInfo(\'pfDeepCSV\').taggingVariables.get(\'trackSip3dSigAboveCharm\', -999)", float, doc=
"track 3D signed impact parameter significance of first track lifting mass above charm", precision=10),
225 DeepCSV_vertexMass =
Var(
"tagInfo(\'pfDeepCSV\').taggingVariables.get(\'vertexMass\', -999)", float, doc=
"mass of track sum at secondary vertex", precision=10),
226 DeepCSV_vertexNTracks =
Var(
"tagInfo(\'pfDeepCSV\').taggingVariables.get(\'vertexNTracks\', -999)", int, doc=
"number of tracks at secondary vertex"),
227 DeepCSV_vertexEnergyRatio =
Var(
"tagInfo(\'pfDeepCSV\').taggingVariables.get(\'vertexEnergyRatio\', -999)", float, doc=
"ratio of energy at secondary vertex over total energy", precision=10),
228 DeepCSV_vertexJetDeltaR =
Var(
"tagInfo(\'pfDeepCSV\').taggingVariables.get(\'vertexJetDeltaR\', -999)", float, doc=
"pseudoangular distance between jet axis and secondary vertex direction", precision=10),
229 DeepCSV_flightDistance2dVal =
Var(
"tagInfo(\'pfDeepCSV\').taggingVariables.get(\'flightDistance2dVal\', -999)", float, doc=
"transverse distance between primary and secondary vertex", precision=10),
230 DeepCSV_flightDistance2dSig =
Var(
"tagInfo(\'pfDeepCSV\').taggingVariables.get(\'flightDistance2dSig\', -999)", float, doc=
"transverse distance significance between primary and secondary vertex", precision=10),
231 DeepCSV_flightDistance3dVal =
Var(
"tagInfo(\'pfDeepCSV\').taggingVariables.get(\'flightDistance3dVal\', -999)", float, doc=
"distance between primary and secondary vertex", precision=10),
232 DeepCSV_flightDistance3dSig =
Var(
"tagInfo(\'pfDeepCSV\').taggingVariables.get(\'flightDistance3dSig\', -999)", float, doc=
"distance significance between primary and secondary vertex", precision=10),
238 DeepJetOutputVars = cms.PSet(
239 btagDeepFlavB_b=
Var(
"bDiscriminator('pfDeepFlavourJetTags:probb')",
241 doc=
"DeepJet b tag probability",
243 btagDeepFlavB_bb=
Var(
"bDiscriminator('pfDeepFlavourJetTags:probbb')",
245 doc=
"DeepJet bb tag probability",
247 btagDeepFlavB_lepb=
Var(
"bDiscriminator('pfDeepFlavourJetTags:problepb')",
249 doc=
"DeepJet lepb tag probability",
251 btagDeepFlavC=
Var(
"bDiscriminator('pfDeepFlavourJetTags:probc')",
253 doc=
"DeepJet c tag probability",
255 btagDeepFlavUDS=
Var(
"bDiscriminator('pfDeepFlavourJetTags:probuds')",
257 doc=
"DeepJet uds tag probability",
259 btagDeepFlavG=
Var(
"bDiscriminator('pfDeepFlavourJetTags:probg')",
261 doc=
"DeepJet gluon tag probability",
266 btagNegDeepFlavB =
Var(
"bDiscriminator('pfNegativeDeepFlavourJetTags:probb')+bDiscriminator('pfNegativeDeepFlavourJetTags:probbb')+bDiscriminator('pfNegativeDeepFlavourJetTags:problepb')",
268 doc=
"Negative DeepJet b+bb+lepb tag discriminator",
270 btagNegDeepFlavCvL =
Var(
"?(bDiscriminator('pfNegativeDeepFlavourJetTags:probc')+bDiscriminator('pfNegativeDeepFlavourJetTags:probuds')+bDiscriminator('pfNegativeDeepFlavourJetTags:probg'))>0?bDiscriminator('pfNegativeDeepFlavourJetTags:probc')/(bDiscriminator('pfNegativeDeepFlavourJetTags:probc')+bDiscriminator('pfNegativeDeepFlavourJetTags:probuds')+bDiscriminator('pfNegativeDeepFlavourJetTags:probg')):-1",
272 doc=
"Negative DeepJet c vs uds+g discriminator",
274 btagNegDeepFlavCvB =
Var(
"?(bDiscriminator('pfNegativeDeepFlavourJetTags:probc')+bDiscriminator('pfNegativeDeepFlavourJetTags:probb')+bDiscriminator('pfNegativeDeepFlavourJetTags:probbb')+bDiscriminator('pfNegativeDeepFlavourJetTags:problepb'))>0?bDiscriminator('pfNegativeDeepFlavourJetTags:probc')/(bDiscriminator('pfNegativeDeepFlavourJetTags:probc')+bDiscriminator('pfNegativeDeepFlavourJetTags:probb')+bDiscriminator('pfNegativeDeepFlavourJetTags:probbb')+bDiscriminator('pfNegativeDeepFlavourJetTags:problepb')):-1",
276 doc=
"Negative DeepJet c vs b+bb+lepb discriminator",
278 btagNegDeepFlavQG =
Var(
"?(bDiscriminator('pfNegativeDeepFlavourJetTags:probg')+bDiscriminator('pfNegativeDeepFlavourJetTags:probuds'))>0?bDiscriminator('pfNegativeDeepFlavourJetTags:probg')/(bDiscriminator('pfNegativeDeepFlavourJetTags:probg')+bDiscriminator('pfNegativeDeepFlavourJetTags:probuds')):-1",
280 doc=
"Negative DeepJet g vs uds discriminator",
282 btagNegDeepFlavB_b =
Var(
"bDiscriminator('pfNegativeDeepFlavourJetTags:probb')",
284 doc=
"Negative DeepJet b tag probability",
286 btagNegDeepFlavB_bb =
Var(
"bDiscriminator('pfNegativeDeepFlavourJetTags:probbb')",
288 doc=
"Negative DeepJet bb tag probability",
290 btagNegDeepFlavB_lepb =
Var(
"bDiscriminator('pfNegativeDeepFlavourJetTags:problepb')",
292 doc=
"Negative DeepJet lepb tag probability",
294 btagNegDeepFlavC =
Var(
"bDiscriminator('pfNegativeDeepFlavourJetTags:probc')",
296 doc=
"Negative DeepJet c tag probability",
298 btagNegDeepFlavUDS =
Var(
"bDiscriminator('pfNegativeDeepFlavourJetTags:probuds')",
300 doc=
"Negative DeepJet uds tag probability",
302 btagNegDeepFlavG =
Var(
"bDiscriminator('pfNegativeDeepFlavourJetTags:probg')",
304 doc=
"Negative DeepJet gluon tag probability",
307 return DeepJetOutputVars
311 ParticleNetAK4OutputVars = cms.PSet(
313 btagPNetProbB =
Var(
"?bDiscriminator('pfParticleNetFromMiniAODAK4PuppiCentralJetTags:probb')>0?bDiscriminator('pfParticleNetFromMiniAODAK4PuppiCentralJetTags:probb'):-1",
315 doc=
"ParticleNet b tag probability",
317 btagPNetProbC =
Var(
"?bDiscriminator('pfParticleNetFromMiniAODAK4PuppiCentralJetTags:probc')>0?bDiscriminator('pfParticleNetFromMiniAODAK4PuppiCentralJetTags:probc'):-1",
319 doc=
"ParticleNet c tag probability",
321 btagPNetProbUDS =
Var(
"?bDiscriminator('pfParticleNetFromMiniAODAK4PuppiCentralJetTags:probuds')>0?bDiscriminator('pfParticleNetFromMiniAODAK4PuppiCentralJetTags:probuds'):-1",
323 doc=
"ParticleNet uds tag probability",
325 btagPNetProbG =
Var(
"?bDiscriminator('pfParticleNetFromMiniAODAK4PuppiCentralJetTags:probg')>0?bDiscriminator('pfParticleNetFromMiniAODAK4PuppiCentralJetTags:probg'):-1",
327 doc=
"ParticleNet gluon tag probability",
331 btagNegPNetB =
Var(
"?(bDiscriminator('pfNegativeParticleNetFromMiniAODAK4PuppiCentralJetTags:probb')+bDiscriminator('pfNegativeParticleNetFromMiniAODAK4PuppiCentralJetTags:probc')+bDiscriminator('pfNegativeParticleNetFromMiniAODAK4PuppiCentralJetTags:probuds')+bDiscriminator('pfNegativeParticleNetFromMiniAODAK4PuppiCentralJetTags:probg'))>0?(bDiscriminator('pfNegativeParticleNetFromMiniAODAK4PuppiCentralJetTags:probb'))/(bDiscriminator('pfNegativeParticleNetFromMiniAODAK4PuppiCentralJetTags:probb')+bDiscriminator('pfNegativeParticleNetFromMiniAODAK4PuppiCentralJetTags:probc')+bDiscriminator('pfNegativeParticleNetFromMiniAODAK4PuppiCentralJetTags:probuds')+bDiscriminator('pfNegativeParticleNetFromMiniAODAK4PuppiCentralJetTags:probg')):-1",
333 doc=
"Negative ParticleNet b vs. udscg",
335 btagNegPNetCvL =
Var(
"?(bDiscriminator('pfNegativeParticleNetFromMiniAODAK4PuppiCentralJetTags:probc')+bDiscriminator('pfNegativeParticleNetFromMiniAODAK4PuppiCentralJetTags:probuds')+bDiscriminator('pfNegativeParticleNetFromMiniAODAK4PuppiCentralJetTags:probg'))>0?(bDiscriminator('pfNegativeParticleNetFromMiniAODAK4PuppiCentralJetTags:probc'))/(bDiscriminator('pfNegativeParticleNetFromMiniAODAK4PuppiCentralJetTags:probc')+bDiscriminator('pfNegativeParticleNetFromMiniAODAK4PuppiCentralJetTags:probuds')+bDiscriminator('pfNegativeParticleNetFromMiniAODAK4PuppiCentralJetTags:probg')):-1",
337 doc=
"Negative ParticleNet c vs. udsg",
339 btagNegPNetCvB =
Var(
"?(bDiscriminator('pfNegativeParticleNetFromMiniAODAK4PuppiCentralJetTags:probc')+bDiscriminator('pfNegativeParticleNetFromMiniAODAK4PuppiCentralJetTags:probb'))>0?(bDiscriminator('pfNegativeParticleNetFromMiniAODAK4PuppiCentralJetTags:probc'))/(bDiscriminator('pfNegativeParticleNetFromMiniAODAK4PuppiCentralJetTags:probc')+bDiscriminator('pfNegativeParticleNetFromMiniAODAK4PuppiCentralJetTags:probb')):-1",
341 doc=
"Negative ParticleNet c vs. b",
343 btagNegPNetProbB =
Var(
"?bDiscriminator('pfNegativeParticleNetFromMiniAODAK4PuppiCentralJetTags:probb')>0?bDiscriminator('pfNegativeParticleNetFromMiniAODAK4PuppiCentralJetTags:probb'):-1",
345 doc=
"Negative ParticleNet b tag probability",
347 btagNegPNetProbC =
Var(
"?bDiscriminator('pfNegativeParticleNetFromMiniAODAK4PuppiCentralJetTags:probc')>0?bDiscriminator('pfNegativeParticleNetFromMiniAODAK4PuppiCentralJetTags:probc'):-1",
349 doc=
"Negative ParticleNet c tag probability",
351 btagNegPNetProbUDS =
Var(
"?bDiscriminator('pfNegativeParticleNetFromMiniAODAK4PuppiCentralJetTags:probuds')>0?bDiscriminator('pfNegativeParticleNetFromMiniAODAK4PuppiCentralJetTags:probuds'):-1",
353 doc=
"Negative ParticleNet uds tag probability",
355 btagNegPNetProbG =
Var(
"?bDiscriminator('pfNegativeParticleNetFromMiniAODAK4PuppiCentralJetTags:probg')>0?bDiscriminator('pfNegativeParticleNetFromMiniAODAK4PuppiCentralJetTags:probg'):-1",
357 doc=
"Negative ParticleNet gluon tag probability",
361 return ParticleNetAK4OutputVars
364 ParticleTransformerAK4OutputVars = cms.PSet(
365 btagRobustParTAK4B_b=
Var(
"bDiscriminator('pfParticleTransformerAK4JetTags:probb')",
367 doc=
"RobustParTAK4 b tag probability",
369 btagRobustParTAK4B_bb=
Var(
"bDiscriminator('pfParticleTransformerAK4JetTags:probbb')",
371 doc=
"RobustParTAK4 bb tag probability",
373 btagRobustParTAK4B_lepb=
Var(
"bDiscriminator('pfParticleTransformerAK4JetTags:problepb')",
375 doc=
"RobustParTAK4 lepb tag probability",
377 btagRobustParTAK4C=
Var(
"bDiscriminator('pfParticleTransformerAK4JetTags:probc')",
379 doc=
"RobustParTAK4 c tag probability",
381 btagRobustParTAK4UDS=
Var(
"bDiscriminator('pfParticleTransformerAK4JetTags:probuds')",
383 doc=
"RobustParTAK4 uds tag probability",
385 btagRobustParTAK4G=
Var(
"bDiscriminator('pfParticleTransformerAK4JetTags:probg')",
387 doc=
"RobustParTAK4 gluon tag probability",
391 btagNegRobustParTAK4B =
Var(
"bDiscriminator('pfNegativeParticleTransformerAK4JetTags:probb')+bDiscriminator('pfNegativeParticleTransformerAK4JetTags:probbb')+bDiscriminator('pfNegativeParticleTransformerAK4JetTags:problepb')",
393 doc=
"Negative RobustParTAK4 b+bb+lepb tag discriminator",
395 btagNegRobustParTAK4CvL =
Var(
"?(bDiscriminator('pfNegativeParticleTransformerAK4JetTags:probc')+bDiscriminator('pfNegativeParticleTransformerAK4JetTags:probuds')+bDiscriminator('pfNegativeParticleTransformerAK4JetTags:probg'))>0?bDiscriminator('pfNegativeParticleTransformerAK4JetTags:probc')/(bDiscriminator('pfNegativeParticleTransformerAK4JetTags:probc')+bDiscriminator('pfNegativeParticleTransformerAK4JetTags:probuds')+bDiscriminator('pfNegativeParticleTransformerAK4JetTags:probg')):-1",
397 doc=
"Negative RobustParTAK4 c vs uds+g discriminator",
399 btagNegRobustParTAK4CvB =
Var(
"?(bDiscriminator('pfNegativeParticleTransformerAK4JetTags:probc')+bDiscriminator('pfNegativeParticleTransformerAK4JetTags:probb')+bDiscriminator('pfNegativeParticleTransformerAK4JetTags:probbb')+bDiscriminator('pfNegativeParticleTransformerAK4JetTags:problepb'))>0?bDiscriminator('pfNegativeParticleTransformerAK4JetTags:probc')/(bDiscriminator('pfNegativeParticleTransformerAK4JetTags:probc')+bDiscriminator('pfNegativeParticleTransformerAK4JetTags:probb')+bDiscriminator('pfNegativeParticleTransformerAK4JetTags:probbb')+bDiscriminator('pfNegativeParticleTransformerAK4JetTags:problepb')):-1",
401 doc=
"Negative RobustParTAK4 c vs b+bb+lepb discriminator",
403 btagNegRobustParTAK4QG =
Var(
"?(bDiscriminator('pfNegativeParticleTransformerAK4JetTags:probg')+bDiscriminator('pfNegativeParticleTransformerAK4JetTags:probuds'))>0?bDiscriminator('pfNegativeParticleTransformerAK4JetTags:probg')/(bDiscriminator('pfNegativeParticleTransformerAK4JetTags:probg')+bDiscriminator('pfNegativeParticleTransformerAK4JetTags:probuds')):-1",
405 doc=
"Negative RobustParTAK4 g vs uds discriminator",
407 btagNegRobustParTAK4B_b =
Var(
"bDiscriminator('pfNegativeParticleTransformerAK4JetTags:probb')",
409 doc=
"Negative RobustParTAK4 b tag probability",
411 btagNegRobustParTAK4B_bb =
Var(
"bDiscriminator('pfNegativeParticleTransformerAK4JetTags:probbb')",
413 doc=
"Negative RobustParTAK4 bb tag probability",
415 btagNegRobustParTAK4B_lepb =
Var(
"bDiscriminator('pfNegativeParticleTransformerAK4JetTags:problepb')",
417 doc=
"Negative RobustParTAK4 lepb tag probability",
419 btagNegRobustParTAK4C =
Var(
"bDiscriminator('pfNegativeParticleTransformerAK4JetTags:probc')",
421 doc=
"Negative RobustParTAK4 c tag probability",
423 btagNegRobustParTAK4UDS =
Var(
"bDiscriminator('pfNegativeParticleTransformerAK4JetTags:probuds')",
425 doc=
"Negative RobustParTAK4 uds tag probability",
427 btagNegRobustParTAK4G =
Var(
"bDiscriminator('pfNegativeParticleTransformerAK4JetTags:probg')",
429 doc=
"Negative RobustParTAK4 gluon tag probability",
433 return ParticleTransformerAK4OutputVars
435 def add_BTV(process, addAK4=False, addAK8=False, scheme="btvSF"):
436 process.customizeJetTask = cms.Task()
437 process.schedule.associate(process.customizeJetTask)
439 CommonVars = cms.PSet(
440 Proba=
Var(
"bDiscriminator('pfJetProbabilityBJetTags')",
442 doc=
"Jet Probability (Usage:BTV)",
444 ProbaN=
Var(
"bDiscriminator('pfNegativeOnlyJetProbabilityBJetTags')",
446 doc=
"Negative-only Jet Probability (Usage:BTV)",
448 Bprob=
Var(
"bDiscriminator('pfJetBProbabilityBJetTags')",
450 doc=
"Jet B Probability (Usage:BTV)",
452 BprobN=
Var(
"bDiscriminator('pfNegativeOnlyJetBProbabilityBJetTags')",
454 doc=
"Negative-only Jet B Probability (Usage:BTV)",
459 HadronCountingVars = cms.PSet(
460 nBHadrons=
Var(
"jetFlavourInfo().getbHadrons().size()",
462 doc=
"number of b-hadrons"),
463 nCHadrons=
Var(
"jetFlavourInfo().getcHadrons().size()",
465 doc=
"number of c-hadrons")
470 if scheme ==
"btvSF":
474 elif scheme ==
"DeepJet":
478 elif scheme ==
"RobustParTAK4":
484 process.customJetExtTable = cms.EDProducer(
485 "SimplePATJetFlatTableProducer",
486 src=jetPuppiTable.src,
487 cut=jetPuppiTable.cut,
488 name=jetPuppiTable.name,
489 doc=jetPuppiTable.doc,
490 singleton=cms.bool(
False),
491 extension=cms.bool(
True),
502 (run3_nanoAOD_122 | run3_nanoAOD_124).toModify(
503 process.jetPuppiTable.variables,
504 btagRobustParTAK4B =
None,
505 btagRobustParTAK4CvL =
None,
506 btagRobustParTAK4CvB =
None,
507 btagRobustParTAK4QG =
None,
512 process.customAK4ConstituentsForDeepJetTable = cms.EDProducer(
"PatJetDeepJetTableProducer",
513 jets = cms.InputTag(
"linkedObjects",
"jets"),
514 n_cpf=cms.uint32(_n_cpf),
515 n_npf=cms.uint32(_n_npf),
516 n_sv=cms.uint32(_n_sv)
518 process.customizeJetTask.add(process.customJetExtTable)
519 process.customizeJetTask.add(process.customAK4ConstituentsForDeepJetTable)
524 process.customFatJetExtTable = cms.EDProducer(
525 "SimplePATJetFlatTableProducer",
528 name=fatJetTable.name,
530 singleton=cms.bool(
False),
531 extension=cms.bool(
True),
540 process.customSubJetExtTable = cms.EDProducer(
541 "SimplePATJetFlatTableProducer",
544 name=subJetTable.name,
546 singleton=cms.bool(
False),
547 extension=cms.bool(
True),
553 process.customizeJetTask.add(process.customFatJetExtTable)
554 process.customizeJetTask.add(process.customSubJetExtTable)
559 def addPFCands(process, allPF = False, addAK4=False, addAK8=False):
560 process.customizedPFCandsTask = cms.Task()
561 process.schedule.associate(process.customizedPFCandsTask)
563 process.finalJetsAK8Constituents = cms.EDProducer(
"PatJetConstituentPtrSelector",
564 src = cms.InputTag(
"finalJetsAK8"),
567 process.finalJetsAK4Constituents = cms.EDProducer(
"PatJetConstituentPtrSelector",
568 src = cms.InputTag(
"finalJetsPuppi"),
572 candInput = cms.InputTag(
"packedPFCandidates")
574 candList = cms.VInputTag(cms.InputTag(
"finalJetsAK4Constituents",
"constituents"))
575 process.customizedPFCandsTask.add(process.finalJetsAK4Constituents)
576 process.finalJetsConstituentsTable = cms.EDProducer(
"PackedCandidatePtrMerger", src = candList, skipNulls = cms.bool(
True), warnOnSkip = cms.bool(
True))
577 candInput = cms.InputTag(
"finalJetsConstituentsTable")
579 candList = cms.VInputTag(cms.InputTag(
"finalJetsAK8Constituents",
"constituents"))
580 process.customizedPFCandsTask.add(process.finalJetsAK8Constituents)
581 process.finalJetsConstituentsTable = cms.EDProducer(
"PackedCandidatePtrMerger", src = candList, skipNulls = cms.bool(
True), warnOnSkip = cms.bool(
True))
582 candInput = cms.InputTag(
"finalJetsConstituentsTable")
584 candList = cms.VInputTag(cms.InputTag(
"finalJetsAK4Constituents",
"constituents"), cms.InputTag(
"finalJetsAK8Constituents",
"constituents"))
585 process.customizedPFCandsTask.add(process.finalJetsAK4Constituents)
586 process.customizedPFCandsTask.add(process.finalJetsAK8Constituents)
587 process.finalJetsConstituentsTable = cms.EDProducer(
"PackedCandidatePtrMerger", src = candList, skipNulls = cms.bool(
True), warnOnSkip = cms.bool(
True))
588 candInput = cms.InputTag(
"finalJetsConstituentsTable")
590 process.customConstituentsExtTable = cms.EDProducer(
"SimplePATCandidateFlatTableProducer",
592 cut = cms.string(
""),
593 name = cms.string(
"PFCands"),
594 doc = cms.string(
"interesting particles from AK4 and AK8 jets"),
595 singleton = cms.bool(
False),
596 extension = cms.bool(
False),
597 variables = cms.PSet(CandVars,
598 puppiWeight =
Var(
"puppiWeight()", float, doc=
"Puppi weight",precision=10),
599 puppiWeightNoLep =
Var(
"puppiWeightNoLep()", float, doc=
"Puppi weight removing leptons",precision=10),
600 vtxChi2 =
Var(
"?hasTrackDetails()?vertexChi2():-1", float, doc=
"vertex chi2",precision=10),
601 trkChi2 =
Var(
"?hasTrackDetails()?pseudoTrack().normalizedChi2():-1", float, doc=
"normalized trk chi2", precision=10),
602 dz =
Var(
"?hasTrackDetails()?dz():-1", float, doc=
"pf dz", precision=10),
603 dzErr =
Var(
"?hasTrackDetails()?dzError():-1", float, doc=
"pf dz err", precision=10),
604 d0 =
Var(
"?hasTrackDetails()?dxy():-1", float, doc=
"pf d0", precision=10),
605 d0Err =
Var(
"?hasTrackDetails()?dxyError():-1", float, doc=
"pf d0 err", precision=10),
606 pvAssocQuality =
Var(
"pvAssociationQuality()", int, doc=
"primary vertex association quality. 0: NotReconstructedPrimary, 1: OtherDeltaZ, 4: CompatibilityBTag, 5: CompatibilityDz, 6: UsedInFitLoose, 7: UsedInFitTight"),
607 lostInnerHits =
Var(
"lostInnerHits()", int, doc=
"lost inner hits. -1: validHitInFirstPixelBarrelLayer, 0: noLostInnerHits, 1: oneLostInnerHit, 2: moreLostInnerHits"),
608 lostOuterHits =
Var(
"?hasTrackDetails()?pseudoTrack().hitPattern().numberOfLostHits('MISSING_OUTER_HITS'):0", int, doc=
"lost outer hits"),
609 numberOfHits =
Var(
"numberOfHits()", int, doc=
"number of hits"),
610 numberOfPixelHits =
Var(
"numberOfPixelHits()", int, doc=
"number of pixel hits"),
611 trkQuality =
Var(
"?hasTrackDetails()?pseudoTrack().qualityMask():0", int, doc=
"track quality mask"),
612 trkHighPurity =
Var(
"?hasTrackDetails()?pseudoTrack().quality('highPurity'):0", bool, doc=
"track is high purity"),
613 trkAlgo =
Var(
"?hasTrackDetails()?pseudoTrack().algo():-1", int, doc=
"track algorithm"),
614 trkP =
Var(
"?hasTrackDetails()?pseudoTrack().p():-1", float, doc=
"track momemtum", precision=-1),
615 trkPt =
Var(
"?hasTrackDetails()?pseudoTrack().pt():-1", float, doc=
"track pt", precision=-1),
616 trkEta =
Var(
"?hasTrackDetails()?pseudoTrack().eta():-1", float, doc=
"track pt", precision=12),
617 trkPhi =
Var(
"?hasTrackDetails()?pseudoTrack().phi():-1", float, doc=
"track phi", precision=12),
620 process.customAK8ConstituentsTable = cms.EDProducer(
"PatJetConstituentTableProducer",
621 candidates = candInput,
622 jets = cms.InputTag(
"finalJetsAK8"),
623 jet_radius = cms.double(0.8),
624 name = cms.string(
"FatJetPFCands"),
625 idx_name = cms.string(
"pFCandsIdx"),
626 nameSV = cms.string(
"FatJetSVs"),
627 idx_nameSV = cms.string(
"sVIdx"),
629 process.customAK4ConstituentsTable = cms.EDProducer(
"PatJetConstituentTableProducer",
630 candidates = candInput,
631 jets = cms.InputTag(
"finalJetsPuppi"),
632 jet_radius = cms.double(0.4),
633 name = cms.string(
"JetPFCands"),
634 idx_name = cms.string(
"pFCandsIdx"),
635 nameSV = cms.string(
"JetSVs"),
636 idx_nameSV = cms.string(
"sVIdx"),
638 process.customizedPFCandsTask.add(process.customConstituentsExtTable)
641 process.customizedPFCandsTask.add(process.finalJetsConstituentsTable)
644 process.customizedPFCandsTask.add(process.customAK8ConstituentsTable)
646 process.customizedPFCandsTask.add(process.customAK4ConstituentsTable)
655 btvNano_switch = cms.PSet(
656 btvNano_addAK4_switch = cms.untracked.bool(
True),
657 btvNano_addAK8_switch = cms.untracked.bool(
False),
658 btvNano_addallPF_switch = cms.untracked.bool(
False),
659 TaggerInput = cms.string(
"btvSF")
663 addPFCands(process,btvNano_switch.btvNano_addallPF_switch,btvNano_switch.btvNano_addAK4_switch,btvNano_switch.btvNano_addAK8_switch)
664 add_BTV(process, btvNano_switch.btvNano_addAK4_switch,btvNano_switch.btvNano_addAK8_switch,btvNano_switch.TaggerInput)
665 process.load(
"PhysicsTools.NanoAOD.btvMC_cff")
667 if btvNano_switch.btvNano_addallPF_switch:
668 process.nanoSequenceMC+=allPFPFCandsMCSequence
670 if btvNano_switch.btvNano_addAK4_switch
and btvNano_switch.btvNano_addAK8_switch :
671 process.nanoSequenceMC+=ak4ak8PFCandsMCSequence
672 elif btvNano_switch.btvNano_addAK4_switch
and not btvNano_switch.btvNano_addAK8_switch :
673 process.nanoSequenceMC+=ak4onlyPFCandsMCSequence
674 elif not btvNano_switch.btvNano_addAK4_switch
and btvNano_switch.btvNano_addAK8_switch:
675 process.nanoSequenceMC+=ak8onlyPFCandsMCSequence
def Var(expr, valtype, doc=None, precision=-1, lazyEval=False)
def get_ParticleTransformerAK4_outputs()
def BTVCustomNanoAOD(process)
def update_jets_AK4(process)
Move PFNano (https://github.com/cms-jet/PFNano/) to NanoAOD.
def add_BTV(process, addAK4=False, addAK8=False, scheme="btvSF")
def update_jets_AK8_subjet(process)
def addPFCands(process, allPF=False, addAK4=False, addAK8=False)
def update_jets_AK8(process)
def get_ParticleNetAK4_outputs()
def get_DeepJet_outputs()
Store all output nodes, negative tagger for SF.