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
46 jetSource=cms.InputTag(
'slimmedJetsPuppi'),
47 jetCorrections=(
'AK4PFPuppi',
49 [
'L1FastJet',
'L2Relative',
'L3Absolute',
50 'L2L3Residual']),
'None'),
51 btagDiscriminators=_btagDiscriminators,
52 postfix=
'PuppiWithDeepInfo',
54 process.load(
"Configuration.StandardSequences.MagneticField_cff")
55 process.jetPuppiCorrFactorsNano.src =
"selectedUpdatedPatJetsPuppiWithDeepInfo" 56 process.updatedJetsPuppi.jetSource =
"selectedUpdatedPatJetsPuppiWithDeepInfo" 59 process.updatedPatJetsTransientCorrectedPuppiWithDeepInfo.tagInfoSources.append(cms.InputTag(
"pfDeepFlavourTagInfosPuppiWithDeepInfo"))
60 process.updatedPatJetsTransientCorrectedPuppiWithDeepInfo.addTagInfos = cms.bool(
True)
70 _btagDiscriminators = [
71 'pfMassIndependentDeepDoubleBvLV2JetTags:probHbb',
72 'pfMassIndependentDeepDoubleCvLV2JetTags:probHcc',
73 'pfMassIndependentDeepDoubleCvBV2JetTags:probHcc',
76 _btagDiscriminators += pfParticleNetJetTagsAll
79 jetSource=cms.InputTag(
'slimmedJetsAK8'),
80 pvSource=cms.InputTag(
'offlineSlimmedPrimaryVertices'),
81 svSource=cms.InputTag(
'slimmedSecondaryVertices'),
83 jetCorrections=(
'AK8PFPuppi',
85 'L1FastJet',
'L2Relative',
'L3Absolute',
88 btagDiscriminators=_btagDiscriminators,
89 postfix=
'AK8WithDeepInfo',
93 process.jetCorrFactorsAK8.src =
"selectedUpdatedPatJetsAK8WithDeepInfo" 94 process.updatedJetsAK8.jetSource =
"selectedUpdatedPatJetsAK8WithDeepInfo" 96 process.updatedPatJetsTransientCorrectedAK8WithDeepInfo.tagInfoSources.append(cms.InputTag(
"pfDeepDoubleXTagInfosAK8WithDeepInfo"))
97 process.updatedPatJetsTransientCorrectedAK8WithDeepInfo.addTagInfos = cms.bool(
True)
104 _btagDiscriminators = [
105 'pfJetProbabilityBJetTags',
106 'pfDeepCSVJetTags:probb',
107 'pfDeepCSVJetTags:probc',
108 'pfDeepCSVJetTags:probbb',
109 'pfDeepCSVJetTags:probudsg',
113 labelName=
'SoftDropSubjetsPF',
114 jetSource=cms.InputTag(
"slimmedJetsAK8PFPuppiSoftDropPacked",
"SubJets"),
115 jetCorrections=(
'AK4PFPuppi',
116 [
'L2Relative',
'L3Absolute'],
'None'),
117 btagDiscriminators=list(_btagDiscriminators),
120 fatJets=cms.InputTag(
'slimmedJetsAK8'),
123 postfix=
'AK8SubjetsWithDeepInfo')
125 process.subJetTable.src =
'selectedUpdatedPatJetsSoftDropSubjetsPFAK8SubjetsWithDeepInfo' 134 DDX_jetNTracks =
Var(
"tagInfo(\'pfDeepDoubleX\').features().tag_info_features.jetNTracks", int, doc=
"number of tracks associated with the jet"),
135 DDX_jetNSecondaryVertices =
Var(
"tagInfo(\'pfDeepDoubleX\').features().tag_info_features.jetNSecondaryVertices", int, doc=
"number of SVs associated with the jet"),
136 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),
137 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),
138 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),
139 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),
140 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),
141 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),
142 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),
143 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),
144 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),
145 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),
146 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),
147 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),
148 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),
149 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),
150 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),
151 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),
152 DDX_trackSip3dSig_0 =
Var(
"tagInfo(\'pfDeepDoubleX\').features().tag_info_features.trackSip3dSig_0", float, doc=
"1st largest track 3D signed impact parameter significance", precision=10),
153 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),
154 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),
155 DDX_trackSip3dSig_1 =
Var(
"tagInfo(\'pfDeepDoubleX\').features().tag_info_features.trackSip3dSig_1", float, doc=
"2nd largest track 3D signed impact parameter significance", precision=10),
156 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),
157 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),
158 DDX_trackSip3dSig_2 =
Var(
"tagInfo(\'pfDeepDoubleX\').features().tag_info_features.trackSip3dSig_2", float, doc=
"3rd largest track 3D signed impact parameter significance", precision=10),
159 DDX_trackSip3dSig_3 =
Var(
"tagInfo(\'pfDeepDoubleX\').features().tag_info_features.trackSip3dSig_3", float, doc=
"4th largest track 3D signed impact parameter significance", precision=10),
160 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)
165 DeepCSVVars = cms.PSet(
215 DeepCSV_trackJetPt =
Var(
"tagInfo(\'pfDeepCSV\').taggingVariables.get(\'trackJetPt\', -999)", float, doc=
"track-based jet transverse momentum", precision=10),
216 DeepCSV_vertexCategory =
Var(
"tagInfo(\'pfDeepCSV\').taggingVariables.get(\'vertexCategory\', -999)", float, doc=
"category of secondary vertex (Reco, Pseudo, No)", precision=10),
217 DeepCSV_jetNSecondaryVertices =
Var(
"tagInfo(\'pfDeepCSV\').taggingVariables.get(\'jetNSecondaryVertices\', -999)", int, doc=
"number of reconstructed possible secondary vertices in jet"),
218 DeepCSV_jetNSelectedTracks =
Var(
"tagInfo(\'pfDeepCSV\').taggingVariables.get(\'jetNSelectedTracks\', -999)", int, doc=
"selected tracks in the jet"),
219 DeepCSV_jetNTracksEtaRel =
Var(
"tagInfo(\'pfDeepCSV\').taggingVariables.get(\'jetNTracksEtaRel\', -999)", int, doc=
"number of tracks for which etaRel is computed"),
220 DeepCSV_trackSumJetEtRatio =
Var(
"tagInfo(\'pfDeepCSV\').taggingVariables.get(\'trackSumJetEtRatio\', -999)", float, doc=
"ratio of track sum transverse energy over jet energy", precision=10),
221 DeepCSV_trackSumJetDeltaR =
Var(
"tagInfo(\'pfDeepCSV\').taggingVariables.get(\'trackSumJetDeltaR\', -999)", float, doc=
"pseudoangular distance between jet axis and track fourvector sum", precision=10),
222 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),
223 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),
224 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),
225 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),
226 DeepCSV_vertexMass =
Var(
"tagInfo(\'pfDeepCSV\').taggingVariables.get(\'vertexMass\', -999)", float, doc=
"mass of track sum at secondary vertex", precision=10),
227 DeepCSV_vertexNTracks =
Var(
"tagInfo(\'pfDeepCSV\').taggingVariables.get(\'vertexNTracks\', -999)", int, doc=
"number of tracks at secondary vertex"),
228 DeepCSV_vertexEnergyRatio =
Var(
"tagInfo(\'pfDeepCSV\').taggingVariables.get(\'vertexEnergyRatio\', -999)", float, doc=
"ratio of energy at secondary vertex over total energy", precision=10),
229 DeepCSV_vertexJetDeltaR =
Var(
"tagInfo(\'pfDeepCSV\').taggingVariables.get(\'vertexJetDeltaR\', -999)", float, doc=
"pseudoangular distance between jet axis and secondary vertex direction", precision=10),
230 DeepCSV_flightDistance2dVal =
Var(
"tagInfo(\'pfDeepCSV\').taggingVariables.get(\'flightDistance2dVal\', -999)", float, doc=
"transverse distance between primary and secondary vertex", precision=10),
231 DeepCSV_flightDistance2dSig =
Var(
"tagInfo(\'pfDeepCSV\').taggingVariables.get(\'flightDistance2dSig\', -999)", float, doc=
"transverse distance significance between primary and secondary vertex", precision=10),
232 DeepCSV_flightDistance3dVal =
Var(
"tagInfo(\'pfDeepCSV\').taggingVariables.get(\'flightDistance3dVal\', -999)", float, doc=
"distance between primary and secondary vertex", precision=10),
233 DeepCSV_flightDistance3dSig =
Var(
"tagInfo(\'pfDeepCSV\').taggingVariables.get(\'flightDistance3dSig\', -999)", float, doc=
"distance significance between primary and secondary vertex", precision=10),
239 DeepJetOutputVars = cms.PSet(
240 btagDeepFlavB_b=
Var(
"bDiscriminator('pfDeepFlavourJetTags:probb')",
242 doc=
"DeepJet b tag probability",
244 btagDeepFlavB_bb=
Var(
"bDiscriminator('pfDeepFlavourJetTags:probbb')",
246 doc=
"DeepJet bb tag probability",
248 btagDeepFlavB_lepb=
Var(
"bDiscriminator('pfDeepFlavourJetTags:problepb')",
250 doc=
"DeepJet lepb tag probability",
252 btagDeepFlavC=
Var(
"bDiscriminator('pfDeepFlavourJetTags:probc')",
254 doc=
"DeepJet c tag probability",
256 btagDeepFlavUDS=
Var(
"bDiscriminator('pfDeepFlavourJetTags:probuds')",
258 doc=
"DeepJet uds tag probability",
260 btagDeepFlavG=
Var(
"bDiscriminator('pfDeepFlavourJetTags:probg')",
262 doc=
"DeepJet gluon tag probability",
267 btagNegDeepFlavB =
Var(
"bDiscriminator('pfNegativeDeepFlavourJetTags:probb')+bDiscriminator('pfNegativeDeepFlavourJetTags:probbb')+bDiscriminator('pfNegativeDeepFlavourJetTags:problepb')",
269 doc=
"Negative DeepJet b+bb+lepb tag discriminator",
271 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",
273 doc=
"Negative DeepJet c vs uds+g discriminator",
275 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",
277 doc=
"Negative DeepJet c vs b+bb+lepb discriminator",
279 btagNegDeepFlavQG =
Var(
"?(bDiscriminator('pfNegativeDeepFlavourJetTags:probg')+bDiscriminator('pfNegativeDeepFlavourJetTags:probuds'))>0?bDiscriminator('pfNegativeDeepFlavourJetTags:probg')/(bDiscriminator('pfNegativeDeepFlavourJetTags:probg')+bDiscriminator('pfNegativeDeepFlavourJetTags:probuds')):-1",
281 doc=
"Negative DeepJet g vs uds discriminator",
283 btagNegDeepFlavB_b =
Var(
"bDiscriminator('pfNegativeDeepFlavourJetTags:probb')",
285 doc=
"Negative DeepJet b tag probability",
287 btagNegDeepFlavB_bb =
Var(
"bDiscriminator('pfNegativeDeepFlavourJetTags:probbb')",
289 doc=
"Negative DeepJet bb tag probability",
291 btagNegDeepFlavB_lepb =
Var(
"bDiscriminator('pfNegativeDeepFlavourJetTags:problepb')",
293 doc=
"Negative DeepJet lepb tag probability",
295 btagNegDeepFlavC =
Var(
"bDiscriminator('pfNegativeDeepFlavourJetTags:probc')",
297 doc=
"Negative DeepJet c tag probability",
299 btagNegDeepFlavUDS =
Var(
"bDiscriminator('pfNegativeDeepFlavourJetTags:probuds')",
301 doc=
"Negative DeepJet uds tag probability",
303 btagNegDeepFlavG =
Var(
"bDiscriminator('pfNegativeDeepFlavourJetTags:probg')",
305 doc=
"Negative DeepJet gluon tag probability",
308 return DeepJetOutputVars
312 ParticleNetAK4OutputVars = cms.PSet(
314 btagPNetProbB =
Var(
"?bDiscriminator('pfParticleNetFromMiniAODAK4PuppiCentralJetTags:probb')>0?bDiscriminator('pfParticleNetFromMiniAODAK4PuppiCentralJetTags:probb'):-1",
316 doc=
"ParticleNet b tag probability",
318 btagPNetProbC =
Var(
"?bDiscriminator('pfParticleNetFromMiniAODAK4PuppiCentralJetTags:probc')>0?bDiscriminator('pfParticleNetFromMiniAODAK4PuppiCentralJetTags:probc'):-1",
320 doc=
"ParticleNet c tag probability",
322 btagPNetProbUDS =
Var(
"?bDiscriminator('pfParticleNetFromMiniAODAK4PuppiCentralJetTags:probuds')>0?bDiscriminator('pfParticleNetFromMiniAODAK4PuppiCentralJetTags:probuds'):-1",
324 doc=
"ParticleNet uds tag probability",
326 btagPNetProbG =
Var(
"?bDiscriminator('pfParticleNetFromMiniAODAK4PuppiCentralJetTags:probg')>0?bDiscriminator('pfParticleNetFromMiniAODAK4PuppiCentralJetTags:probg'):-1",
328 doc=
"ParticleNet gluon tag probability",
332 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",
334 doc=
"Negative ParticleNet b vs. udscg",
336 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",
338 doc=
"Negative ParticleNet c vs. udsg",
340 btagNegPNetCvB =
Var(
"?(bDiscriminator('pfNegativeParticleNetFromMiniAODAK4PuppiCentralJetTags:probc')+bDiscriminator('pfNegativeParticleNetFromMiniAODAK4PuppiCentralJetTags:probb'))>0?(bDiscriminator('pfNegativeParticleNetFromMiniAODAK4PuppiCentralJetTags:probc'))/(bDiscriminator('pfNegativeParticleNetFromMiniAODAK4PuppiCentralJetTags:probc')+bDiscriminator('pfNegativeParticleNetFromMiniAODAK4PuppiCentralJetTags:probb')):-1",
342 doc=
"Negative ParticleNet c vs. b",
344 btagNegPNetProbB =
Var(
"?bDiscriminator('pfNegativeParticleNetFromMiniAODAK4PuppiCentralJetTags:probb')>0?bDiscriminator('pfNegativeParticleNetFromMiniAODAK4PuppiCentralJetTags:probb'):-1",
346 doc=
"Negative ParticleNet b tag probability",
348 btagNegPNetProbC =
Var(
"?bDiscriminator('pfNegativeParticleNetFromMiniAODAK4PuppiCentralJetTags:probc')>0?bDiscriminator('pfNegativeParticleNetFromMiniAODAK4PuppiCentralJetTags:probc'):-1",
350 doc=
"Negative ParticleNet c tag probability",
352 btagNegPNetProbUDS =
Var(
"?bDiscriminator('pfNegativeParticleNetFromMiniAODAK4PuppiCentralJetTags:probuds')>0?bDiscriminator('pfNegativeParticleNetFromMiniAODAK4PuppiCentralJetTags:probuds'):-1",
354 doc=
"Negative ParticleNet uds tag probability",
356 btagNegPNetProbG =
Var(
"?bDiscriminator('pfNegativeParticleNetFromMiniAODAK4PuppiCentralJetTags:probg')>0?bDiscriminator('pfNegativeParticleNetFromMiniAODAK4PuppiCentralJetTags:probg'):-1",
358 doc=
"Negative ParticleNet gluon tag probability",
362 return ParticleNetAK4OutputVars
365 ParticleTransformerAK4OutputVars = cms.PSet(
366 btagRobustParTAK4B_b=
Var(
"bDiscriminator('pfParticleTransformerAK4JetTags:probb')",
368 doc=
"RobustParTAK4 b tag probability",
370 btagRobustParTAK4B_bb=
Var(
"bDiscriminator('pfParticleTransformerAK4JetTags:probbb')",
372 doc=
"RobustParTAK4 bb tag probability",
374 btagRobustParTAK4B_lepb=
Var(
"bDiscriminator('pfParticleTransformerAK4JetTags:problepb')",
376 doc=
"RobustParTAK4 lepb tag probability",
378 btagRobustParTAK4C=
Var(
"bDiscriminator('pfParticleTransformerAK4JetTags:probc')",
380 doc=
"RobustParTAK4 c tag probability",
382 btagRobustParTAK4UDS=
Var(
"bDiscriminator('pfParticleTransformerAK4JetTags:probuds')",
384 doc=
"RobustParTAK4 uds tag probability",
386 btagRobustParTAK4G=
Var(
"bDiscriminator('pfParticleTransformerAK4JetTags:probg')",
388 doc=
"RobustParTAK4 gluon tag probability",
392 btagNegRobustParTAK4B =
Var(
"bDiscriminator('pfNegativeParticleTransformerAK4JetTags:probb')+bDiscriminator('pfNegativeParticleTransformerAK4JetTags:probbb')+bDiscriminator('pfNegativeParticleTransformerAK4JetTags:problepb')",
394 doc=
"Negative RobustParTAK4 b+bb+lepb tag discriminator",
396 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",
398 doc=
"Negative RobustParTAK4 c vs uds+g discriminator",
400 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",
402 doc=
"Negative RobustParTAK4 c vs b+bb+lepb discriminator",
404 btagNegRobustParTAK4QG =
Var(
"?(bDiscriminator('pfNegativeParticleTransformerAK4JetTags:probg')+bDiscriminator('pfNegativeParticleTransformerAK4JetTags:probuds'))>0?bDiscriminator('pfNegativeParticleTransformerAK4JetTags:probg')/(bDiscriminator('pfNegativeParticleTransformerAK4JetTags:probg')+bDiscriminator('pfNegativeParticleTransformerAK4JetTags:probuds')):-1",
406 doc=
"Negative RobustParTAK4 g vs uds discriminator",
408 btagNegRobustParTAK4B_b =
Var(
"bDiscriminator('pfNegativeParticleTransformerAK4JetTags:probb')",
410 doc=
"Negative RobustParTAK4 b tag probability",
412 btagNegRobustParTAK4B_bb =
Var(
"bDiscriminator('pfNegativeParticleTransformerAK4JetTags:probbb')",
414 doc=
"Negative RobustParTAK4 bb tag probability",
416 btagNegRobustParTAK4B_lepb =
Var(
"bDiscriminator('pfNegativeParticleTransformerAK4JetTags:problepb')",
418 doc=
"Negative RobustParTAK4 lepb tag probability",
420 btagNegRobustParTAK4C =
Var(
"bDiscriminator('pfNegativeParticleTransformerAK4JetTags:probc')",
422 doc=
"Negative RobustParTAK4 c tag probability",
424 btagNegRobustParTAK4UDS =
Var(
"bDiscriminator('pfNegativeParticleTransformerAK4JetTags:probuds')",
426 doc=
"Negative RobustParTAK4 uds tag probability",
428 btagNegRobustParTAK4G =
Var(
"bDiscriminator('pfNegativeParticleTransformerAK4JetTags:probg')",
430 doc=
"Negative RobustParTAK4 gluon tag probability",
434 return ParticleTransformerAK4OutputVars
436 def add_BTV(process, addAK4=False, addAK8=False, scheme="btvSF"):
437 process.customizeJetTask = cms.Task()
438 process.schedule.associate(process.customizeJetTask)
440 CommonVars = cms.PSet(
441 Proba=
Var(
"bDiscriminator('pfJetProbabilityBJetTags')",
443 doc=
"Jet Probability (Usage:BTV)",
445 ProbaN=
Var(
"bDiscriminator('pfNegativeOnlyJetProbabilityBJetTags')",
447 doc=
"Negative-only Jet Probability (Usage:BTV)",
449 Bprob=
Var(
"bDiscriminator('pfJetBProbabilityBJetTags')",
451 doc=
"Jet B Probability (Usage:BTV)",
453 BprobN=
Var(
"bDiscriminator('pfNegativeOnlyJetBProbabilityBJetTags')",
455 doc=
"Negative-only Jet B Probability (Usage:BTV)",
460 HadronCountingVars = cms.PSet(
461 nBHadrons=
Var(
"jetFlavourInfo().getbHadrons().size()",
463 doc=
"number of b-hadrons"),
464 nCHadrons=
Var(
"jetFlavourInfo().getcHadrons().size()",
466 doc=
"number of c-hadrons")
471 if scheme ==
"btvSF":
475 elif scheme ==
"DeepJet":
479 elif scheme ==
"RobustParTAK4":
485 process.customJetExtTable = cms.EDProducer(
486 "SimplePATJetFlatTableProducer",
487 src=jetPuppiTable.src,
488 cut=jetPuppiTable.cut,
489 name=jetPuppiTable.name,
490 doc=jetPuppiTable.doc,
491 singleton=cms.bool(
False),
492 extension=cms.bool(
True),
503 (run3_nanoAOD_122 | run3_nanoAOD_124).toModify(
504 process.jetPuppiTable.variables,
505 btagRobustParTAK4B =
None,
506 btagRobustParTAK4CvL =
None,
507 btagRobustParTAK4CvB =
None,
508 btagRobustParTAK4QG =
None,
513 process.customAK4ConstituentsForDeepJetTable = cms.EDProducer(
"PatJetDeepJetTableProducer",
514 jets = cms.InputTag(
"linkedObjects",
"jets"),
515 n_cpf=cms.uint32(_n_cpf),
516 n_npf=cms.uint32(_n_npf),
517 n_sv=cms.uint32(_n_sv)
519 process.customizeJetTask.add(process.customJetExtTable)
520 process.customizeJetTask.add(process.customAK4ConstituentsForDeepJetTable)
525 process.customFatJetExtTable = cms.EDProducer(
526 "SimplePATJetFlatTableProducer",
529 name=fatJetTable.name,
531 singleton=cms.bool(
False),
532 extension=cms.bool(
True),
541 process.customSubJetExtTable = cms.EDProducer(
542 "SimplePATJetFlatTableProducer",
545 name=subJetTable.name,
547 singleton=cms.bool(
False),
548 extension=cms.bool(
True),
554 process.customizeJetTask.add(process.customFatJetExtTable)
555 process.customizeJetTask.add(process.customSubJetExtTable)
560 def addPFCands(process, allPF = False, addAK4=False, addAK8=False):
561 process.customizedPFCandsTask = cms.Task()
562 process.schedule.associate(process.customizedPFCandsTask)
564 process.finalJetsAK8Constituents = cms.EDProducer(
"PatJetConstituentPtrSelector",
565 src = cms.InputTag(
"finalJetsAK8"),
568 process.finalJetsAK4Constituents = cms.EDProducer(
"PatJetConstituentPtrSelector",
569 src = cms.InputTag(
"finalJetsPuppi"),
573 candInput = cms.InputTag(
"packedPFCandidates")
575 candList = cms.VInputTag(cms.InputTag(
"finalJetsAK4Constituents",
"constituents"))
576 process.customizedPFCandsTask.add(process.finalJetsAK4Constituents)
577 process.finalJetsConstituentsTable = cms.EDProducer(
"PackedCandidatePtrMerger", src = candList, skipNulls = cms.bool(
True), warnOnSkip = cms.bool(
True))
578 candInput = cms.InputTag(
"finalJetsConstituentsTable")
580 candList = cms.VInputTag(cms.InputTag(
"finalJetsAK8Constituents",
"constituents"))
581 process.customizedPFCandsTask.add(process.finalJetsAK8Constituents)
582 process.finalJetsConstituentsTable = cms.EDProducer(
"PackedCandidatePtrMerger", src = candList, skipNulls = cms.bool(
True), warnOnSkip = cms.bool(
True))
583 candInput = cms.InputTag(
"finalJetsConstituentsTable")
585 candList = cms.VInputTag(cms.InputTag(
"finalJetsAK4Constituents",
"constituents"), cms.InputTag(
"finalJetsAK8Constituents",
"constituents"))
586 process.customizedPFCandsTask.add(process.finalJetsAK4Constituents)
587 process.customizedPFCandsTask.add(process.finalJetsAK8Constituents)
588 process.finalJetsConstituentsTable = cms.EDProducer(
"PackedCandidatePtrMerger", src = candList, skipNulls = cms.bool(
True), warnOnSkip = cms.bool(
True))
589 candInput = cms.InputTag(
"finalJetsConstituentsTable")
591 process.customConstituentsExtTable = cms.EDProducer(
"SimplePATCandidateFlatTableProducer",
593 cut = cms.string(
""),
594 name = cms.string(
"PFCands"),
595 doc = cms.string(
"interesting particles from AK4 and AK8 jets"),
596 singleton = cms.bool(
False),
597 extension = cms.bool(
False),
598 variables = cms.PSet(CandVars,
599 puppiWeight =
Var(
"puppiWeight()", float, doc=
"Puppi weight",precision=10),
600 puppiWeightNoLep =
Var(
"puppiWeightNoLep()", float, doc=
"Puppi weight removing leptons",precision=10),
601 vtxChi2 =
Var(
"?hasTrackDetails()?vertexChi2():-1", float, doc=
"vertex chi2",precision=10),
602 trkChi2 =
Var(
"?hasTrackDetails()?pseudoTrack().normalizedChi2():-1", float, doc=
"normalized trk chi2", precision=10),
603 dz =
Var(
"?hasTrackDetails()?dz():-1", float, doc=
"pf dz", precision=10),
604 dzErr =
Var(
"?hasTrackDetails()?dzError():-1", float, doc=
"pf dz err", precision=10),
605 d0 =
Var(
"?hasTrackDetails()?dxy():-1", float, doc=
"pf d0", precision=10),
606 d0Err =
Var(
"?hasTrackDetails()?dxyError():-1", float, doc=
"pf d0 err", precision=10),
607 pvAssocQuality =
Var(
"pvAssociationQuality()", int, doc=
"primary vertex association quality. 0: NotReconstructedPrimary, 1: OtherDeltaZ, 4: CompatibilityBTag, 5: CompatibilityDz, 6: UsedInFitLoose, 7: UsedInFitTight"),
608 lostInnerHits =
Var(
"lostInnerHits()", int, doc=
"lost inner hits. -1: validHitInFirstPixelBarrelLayer, 0: noLostInnerHits, 1: oneLostInnerHit, 2: moreLostInnerHits"),
609 lostOuterHits =
Var(
"?hasTrackDetails()?pseudoTrack().hitPattern().numberOfLostHits('MISSING_OUTER_HITS'):0", int, doc=
"lost outer hits"),
610 numberOfHits =
Var(
"numberOfHits()", int, doc=
"number of hits"),
611 numberOfPixelHits =
Var(
"numberOfPixelHits()", int, doc=
"number of pixel hits"),
612 trkQuality =
Var(
"?hasTrackDetails()?pseudoTrack().qualityMask():0", int, doc=
"track quality mask"),
613 trkHighPurity =
Var(
"?hasTrackDetails()?pseudoTrack().quality('highPurity'):0", bool, doc=
"track is high purity"),
614 trkAlgo =
Var(
"?hasTrackDetails()?pseudoTrack().algo():-1", int, doc=
"track algorithm"),
615 trkP =
Var(
"?hasTrackDetails()?pseudoTrack().p():-1", float, doc=
"track momemtum", precision=-1),
616 trkPt =
Var(
"?hasTrackDetails()?pseudoTrack().pt():-1", float, doc=
"track pt", precision=-1),
617 trkEta =
Var(
"?hasTrackDetails()?pseudoTrack().eta():-1", float, doc=
"track pt", precision=12),
618 trkPhi =
Var(
"?hasTrackDetails()?pseudoTrack().phi():-1", float, doc=
"track phi", precision=12),
621 process.customAK8ConstituentsTable = cms.EDProducer(
"PatJetConstituentTableProducer",
622 candidates = candInput,
623 jets = cms.InputTag(
"finalJetsAK8"),
624 jet_radius = cms.double(0.8),
625 name = cms.string(
"FatJetPFCands"),
626 idx_name = cms.string(
"pFCandsIdx"),
627 nameSV = cms.string(
"FatJetSVs"),
628 idx_nameSV = cms.string(
"sVIdx"),
630 process.customAK4ConstituentsTable = cms.EDProducer(
"PatJetConstituentTableProducer",
631 candidates = candInput,
632 jets = cms.InputTag(
"finalJetsPuppi"),
633 jet_radius = cms.double(0.4),
634 name = cms.string(
"JetPFCands"),
635 idx_name = cms.string(
"pFCandsIdx"),
636 nameSV = cms.string(
"JetSVs"),
637 idx_nameSV = cms.string(
"sVIdx"),
639 process.customizedPFCandsTask.add(process.customConstituentsExtTable)
642 process.customizedPFCandsTask.add(process.finalJetsConstituentsTable)
645 process.customizedPFCandsTask.add(process.customAK8ConstituentsTable)
647 process.customizedPFCandsTask.add(process.customAK4ConstituentsTable)
656 btvNano_switch = cms.PSet(
657 btvNano_addAK4_switch = cms.untracked.bool(
True),
658 btvNano_addAK8_switch = cms.untracked.bool(
False),
659 btvNano_addallPF_switch = cms.untracked.bool(
False),
660 TaggerInput = cms.string(
"btvSF")
664 addPFCands(process,btvNano_switch.btvNano_addallPF_switch,btvNano_switch.btvNano_addAK4_switch,btvNano_switch.btvNano_addAK8_switch)
665 add_BTV(process, btvNano_switch.btvNano_addAK4_switch,btvNano_switch.btvNano_addAK8_switch,btvNano_switch.TaggerInput)
666 process.load(
"PhysicsTools.NanoAOD.btvMC_cff")
668 if btvNano_switch.btvNano_addallPF_switch:
669 process.nanoSequenceMC+=allPFPFCandsMCSequence
671 if btvNano_switch.btvNano_addAK4_switch
and btvNano_switch.btvNano_addAK8_switch :
672 process.nanoSequenceMC+=ak4ak8PFCandsMCSequence
673 elif btvNano_switch.btvNano_addAK4_switch
and not btvNano_switch.btvNano_addAK8_switch :
674 process.nanoSequenceMC+=ak4onlyPFCandsMCSequence
675 elif not btvNano_switch.btvNano_addAK4_switch
and btvNano_switch.btvNano_addAK8_switch:
676 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.