1 import FWCore.ParameterSet.Config
as cms
11 jetPuppiCorrFactorsNano = patJetCorrFactors.clone(src=
'slimmedJetsPuppi',
12 levels = cms.vstring(
'L1FastJet',
16 payload = cms.string(
'AK4PFPuppi'),
17 primaryVertices = cms.InputTag(
"offlineSlimmedPrimaryVertices"),
22 updatedJetsPuppi = updatedPatJets.clone(
24 jetSource=
'slimmedJetsPuppi',
25 jetCorrFactorsSource=cms.VInputTag(cms.InputTag(
"jetPuppiCorrFactorsNano") ),
28 tightJetPuppiId = cms.EDProducer(
"PatJetIDValueMapProducer",
29 filterParams=cms.PSet(
30 version = cms.string(
'RUN2ULPUPPI'),
31 quality = cms.string(
'TIGHT'),
33 src = cms.InputTag(
"updatedJetsPuppi")
35 tightJetPuppiIdLepVeto = cms.EDProducer(
"PatJetIDValueMapProducer",
36 filterParams=cms.PSet(
37 version = cms.string(
'RUN2ULPUPPI'),
38 quality = cms.string(
'TIGHTLEPVETO'),
40 src = cms.InputTag(
"updatedJetsPuppi")
44 from RecoJets.JetProducers.hfJetShowerShape_cfi
import hfJetShowerShape
45 hfJetPuppiShowerShapeforNanoAOD = hfJetShowerShape.clone(jets=
"updatedJetsPuppi",vertices=
"offlineSlimmedPrimaryVertices")
47 updatedJetsPuppiWithUserData = cms.EDProducer(
"PATJetUserDataEmbedder",
48 src = cms.InputTag(
"updatedJetsPuppi"),
49 userFloats = cms.PSet(
50 hfsigmaEtaEta = cms.InputTag(
'hfJetPuppiShowerShapeforNanoAOD:sigmaEtaEta'),
51 hfsigmaPhiPhi = cms.InputTag(
'hfJetPuppiShowerShapeforNanoAOD:sigmaPhiPhi'),
54 tightId = cms.InputTag(
"tightJetPuppiId"),
55 tightIdLepVeto = cms.InputTag(
"tightJetPuppiIdLepVeto"),
56 hfcentralEtaStripSize = cms.InputTag(
'hfJetPuppiShowerShapeforNanoAOD:centralEtaStripSize'),
57 hfadjacentEtaStripsSize = cms.InputTag(
'hfJetPuppiShowerShapeforNanoAOD:adjacentEtaStripsSize'),
61 finalJetsPuppi = cms.EDFilter(
"PATJetRefSelector",
62 src = cms.InputTag(
"updatedJetsPuppiWithUserData"),
63 cut = cms.string(
"pt > 15")
67 jetPuppiTable = cms.EDProducer(
"SimpleCandidateFlatTableProducer",
68 src = cms.InputTag(
"linkedObjects",
"jets"),
70 name = cms.string(
"Jet"),
71 doc = cms.string(
"slimmedJetsPuppi, i.e. ak4 PFJets Puppi with JECs applied, after basic selection (" + finalJetsPuppi.cut.value()+
")"),
72 singleton = cms.bool(
False),
73 extension = cms.bool(
False),
74 externalVariables = cms.PSet(),
75 variables = cms.PSet(P4Vars,
76 area =
Var(
"jetArea()", float, doc=
"jet catchment area, for JECs",precision=10),
77 nMuons =
Var(
"?hasOverlaps('muons')?overlaps('muons').size():0", int, doc=
"number of muons in the jet"),
78 muonIdx1 =
Var(
"?overlaps('muons').size()>0?overlaps('muons')[0].key():-1", int, doc=
"index of first matching muon"),
79 muonIdx2 =
Var(
"?overlaps('muons').size()>1?overlaps('muons')[1].key():-1", int, doc=
"index of second matching muon"),
80 electronIdx1 =
Var(
"?overlaps('electrons').size()>0?overlaps('electrons')[0].key():-1", int, doc=
"index of first matching electron"),
81 electronIdx2 =
Var(
"?overlaps('electrons').size()>1?overlaps('electrons')[1].key():-1", int, doc=
"index of second matching electron"),
82 nElectrons =
Var(
"?hasOverlaps('electrons')?overlaps('electrons').size():0", int, doc=
"number of electrons in the jet"),
83 btagDeepB =
Var(
"?(bDiscriminator('pfDeepCSVJetTags:probb')+bDiscriminator('pfDeepCSVJetTags:probbb'))>=0?bDiscriminator('pfDeepCSVJetTags:probb')+bDiscriminator('pfDeepCSVJetTags:probbb'):-1",float,doc=
"DeepCSV b+bb tag discriminator",precision=10),
84 btagDeepFlavB =
Var(
"bDiscriminator('pfDeepFlavourJetTags:probb')+bDiscriminator('pfDeepFlavourJetTags:probbb')+bDiscriminator('pfDeepFlavourJetTags:problepb')",float,doc=
"DeepJet b+bb+lepb tag discriminator",precision=10),
85 btagCSVV2 =
Var(
"bDiscriminator('pfCombinedInclusiveSecondaryVertexV2BJetTags')",float,doc=
" pfCombinedInclusiveSecondaryVertexV2 b-tag discriminator (aka CSVV2)",precision=10),
86 btagDeepCvL =
Var(
"?bDiscriminator('pfDeepCSVJetTags:probc')>=0?bDiscriminator('pfDeepCSVJetTags:probc')/(bDiscriminator('pfDeepCSVJetTags:probc')+bDiscriminator('pfDeepCSVJetTags:probudsg')):-1", float,doc=
"DeepCSV c vs udsg discriminator",precision=10),
87 btagDeepCvB =
Var(
"?bDiscriminator('pfDeepCSVJetTags:probc')>=0?bDiscriminator('pfDeepCSVJetTags:probc')/(bDiscriminator('pfDeepCSVJetTags:probc')+bDiscriminator('pfDeepCSVJetTags:probb')+bDiscriminator('pfDeepCSVJetTags:probbb')):-1",float,doc=
"DeepCSV c vs b+bb discriminator",precision=10),
88 btagDeepFlavCvL =
Var(
"?(bDiscriminator('pfDeepFlavourJetTags:probc')+bDiscriminator('pfDeepFlavourJetTags:probuds')+bDiscriminator('pfDeepFlavourJetTags:probg'))>0?bDiscriminator('pfDeepFlavourJetTags:probc')/(bDiscriminator('pfDeepFlavourJetTags:probc')+bDiscriminator('pfDeepFlavourJetTags:probuds')+bDiscriminator('pfDeepFlavourJetTags:probg')):-1",float,doc=
"DeepJet c vs uds+g discriminator",precision=10),
89 btagDeepFlavCvB =
Var(
"?(bDiscriminator('pfDeepFlavourJetTags:probc')+bDiscriminator('pfDeepFlavourJetTags:probb')+bDiscriminator('pfDeepFlavourJetTags:probbb')+bDiscriminator('pfDeepFlavourJetTags:problepb'))>0?bDiscriminator('pfDeepFlavourJetTags:probc')/(bDiscriminator('pfDeepFlavourJetTags:probc')+bDiscriminator('pfDeepFlavourJetTags:probb')+bDiscriminator('pfDeepFlavourJetTags:probbb')+bDiscriminator('pfDeepFlavourJetTags:problepb')):-1",float,doc=
"DeepJet c vs b+bb+lepb discriminator",precision=10),
90 btagDeepFlavQG =
Var(
"?(bDiscriminator('pfDeepFlavourJetTags:probg')+bDiscriminator('pfDeepFlavourJetTags:probuds'))>0?bDiscriminator('pfDeepFlavourJetTags:probg')/(bDiscriminator('pfDeepFlavourJetTags:probg')+bDiscriminator('pfDeepFlavourJetTags:probuds')):-1",float,doc=
"DeepJet g vs uds discriminator",precision=10),
91 jetId =
Var(
"userInt('tightId')*2+4*userInt('tightIdLepVeto')",int,doc=
"Jet ID flag: bit2 is tight, bit3 is tightLepVeto"),
92 hfsigmaEtaEta =
Var(
"userFloat('hfsigmaEtaEta')",float,doc=
"sigmaEtaEta for HF jets (noise discriminating variable)",precision=10),
93 hfsigmaPhiPhi =
Var(
"userFloat('hfsigmaPhiPhi')",float,doc=
"sigmaPhiPhi for HF jets (noise discriminating variable)",precision=10),
94 hfcentralEtaStripSize =
Var(
"userInt('hfcentralEtaStripSize')", int, doc=
"eta size of the central tower strip in HF (noise discriminating variable)"),
95 hfadjacentEtaStripsSize =
Var(
"userInt('hfadjacentEtaStripsSize')", int, doc=
"eta size of the strips next to the central tower strip in HF (noise discriminating variable)"),
96 nConstituents =
Var(
"numberOfDaughters()",
"uint8",doc=
"Number of particles in the jet"),
97 rawFactor =
Var(
"1.-jecFactor('Uncorrected')",float,doc=
"1 - Factor to get back to raw pT",precision=6),
98 chHEF =
Var(
"chargedHadronEnergyFraction()", float, doc=
"charged Hadron Energy Fraction", precision= 6),
99 neHEF =
Var(
"neutralHadronEnergyFraction()", float, doc=
"neutral Hadron Energy Fraction", precision= 6),
100 chEmEF =
Var(
"chargedEmEnergyFraction()", float, doc=
"charged Electromagnetic Energy Fraction", precision= 6),
101 neEmEF =
Var(
"neutralEmEnergyFraction()", float, doc=
"neutral Electromagnetic Energy Fraction", precision= 6),
102 muEF =
Var(
"muonEnergyFraction()", float, doc=
"muon Energy Fraction", precision= 6),
107 jetPuppiTable.variables.pt.precision=10
112 basicJetsPuppiForMetForT1METNano = cms.EDProducer(
"PATJetCleanerForType1MET",
113 src = updatedJetsPuppiWithUserData.src,
114 jetCorrEtaMax = cms.double(9.9),
115 jetCorrLabel = cms.InputTag(
"L3Absolute"),
116 jetCorrLabelRes = cms.InputTag(
"L2L3Residual"),
117 offsetCorrLabel = cms.InputTag(
"L1FastJet"),
118 skipEM = cms.bool(
False),
119 skipEMfractionThreshold = cms.double(0.9),
120 skipMuonSelection = cms.string(
'isGlobalMuon | isStandAloneMuon'),
121 skipMuons = cms.bool(
True),
122 type1JetPtThreshold = cms.double(0.0),
123 calcMuonSubtrRawPtAsValueMap = cms.bool(
True)
126 updatedJetsPuppiWithUserData.userFloats.muonSubtrRawPt = cms.InputTag(
"basicJetsPuppiForMetForT1METNano:MuonSubtrRawPt")
128 corrT1METJetPuppiTable = cms.EDProducer(
"SimpleCandidateFlatTableProducer",
129 src = finalJetsPuppi.src,
130 cut = cms.string(
"pt<15 && abs(eta)<9.9"),
131 name = cms.string(
"CorrT1METJet"),
132 doc = cms.string(
"Additional low-pt ak4 Puppi jets for Type-1 MET re-correction"),
133 singleton = cms.bool(
False),
134 extension = cms.bool(
False),
135 variables = cms.PSet(
136 rawPt =
Var(
"pt()*jecFactor('Uncorrected')",float,precision=10),
137 eta =
Var(
"eta", float,precision=12),
138 phi =
Var(
"phi", float, precision=12),
139 area =
Var(
"jetArea()", float, doc=
"jet catchment area, for JECs",precision=10),
143 corrT1METJetPuppiTable.variables.muonSubtrFactor =
Var(
"1-userFloat('muonSubtrRawPt')/(pt()*jecFactor('Uncorrected'))",float,doc=
"1-(muon-subtracted raw pt)/(raw pt)",precision=6)
144 jetPuppiTable.variables.muonSubtrFactor =
Var(
"1-userFloat('muonSubtrRawPt')/(pt()*jecFactor('Uncorrected'))",float,doc=
"1-(muon-subtracted raw pt)/(raw pt)",precision=6)
146 jetPuppiForMETTask = cms.Task(basicJetsPuppiForMetForT1METNano,corrT1METJetPuppiTable)
149 jetPuppiUserDataTask = cms.Task(tightJetPuppiId, tightJetPuppiIdLepVeto, hfJetPuppiShowerShapeforNanoAOD)
152 jetPuppiTask = cms.Task(jetPuppiCorrFactorsNano,updatedJetsPuppi,jetPuppiUserDataTask,updatedJetsPuppiWithUserData,finalJetsPuppi)
155 jetPuppiTablesTask = cms.Task(jetPuppiTable)
def Var(expr, valtype, compression=None, doc=None, mcOnly=False, precision=-1)