File indexing completed on 2025-01-27 02:50:26
0001 import FWCore.ParameterSet.Config as cms
0002 import copy
0003
0004 from PhysicsTools.NanoAOD.nanoDQM_cfi import nanoDQM
0005 from PhysicsTools.NanoAOD.nanoDQM_tools_cff import *
0006 from PhysicsTools.NanoAOD.nano_eras_cff import *
0007
0008 nanojmeDQM = nanoDQM.clone()
0009
0010
0011
0012
0013
0014
0015 _ak4puppiplots = cms.VPSet(
0016 Count1D('_size', 20, -0.5, 19.5, 'AK4 PF Puppi jets with JECs applied.')
0017 )
0018 for plot in nanojmeDQM.vplots.Jet.plots:
0019 if plot.name.value()=="_size": continue
0020 _ak4puppiplots.append(plot)
0021
0022 _ak4puppiplots.extend([
0023 Plot1D('chHadMultiplicity','chHadMultiplicity', 10, 0, 40,'(Puppi-weighted) number of charged hadrons in the jet'),
0024 Plot1D('neHadMultiplicity','neHadMultiplicity', 10, 0, 40,'(Puppi-weighted) number of neutral hadrons in the jet'),
0025 Plot1D('phoMultiplicity','phoMultiplicity', 10, 0, 40,'(Puppi-weighted) number of photons in the jet'),
0026 Plot1D('elMultiplicity','elMultiplicity', 5, 0, 10,'(Puppi-weighted) number of electrons in the jet'),
0027 Plot1D('muMultiplicity','muMultiplicity', 5, 0, 10,'(Puppi-weighted) number of muons in the jet'),
0028 Plot1D('hfEMMultiplicity','hfEMMultiplicity', 5, 0, 10,'(Puppi-weighted) number of HF EMs in the jet'),
0029 Plot1D('hfHadMultiplicity','hfHadMultiplicity', 5, 0, 10,'(Puppi-weighted) number of HF hadrons in the jet'),
0030 Plot1D('puId_dR2Mean','puId_dR2Mean',20, 0, 0.2,"pT^2-weighted average square distance of jet constituents from the jet axis (PileUp ID BDT input variable)"),
0031 Plot1D('puId_majW','puId_majW',10, 0, 0.5, "major axis of jet ellipsoid in eta-phi plane (PileUp ID BDT input variable)"),
0032 Plot1D('puId_minW','puId_minW',10, 0, 0.5, "minor axis of jet ellipsoid in eta-phi plane (PileUp ID BDT input variable)"),
0033 Plot1D('puId_frac01','puId_frac01',10, 0, 1, "fraction of constituents' pT contained within dR <0.1 (PileUp ID BDT input variable)"),
0034 Plot1D('puId_frac02','puId_frac02',10, 0, 1, "fraction of constituents' pT contained within 0.1< dR <0.2 (PileUp ID BDT input variable)"),
0035 Plot1D('puId_frac03','puId_frac03',10, 0, 1, "fraction of constituents' pT contained within 0.2< dR <0.3 (PileUp ID BDT input variable)"),
0036 Plot1D('puId_frac04','puId_frac04',10, 0, 1, "fraction of constituents' pT contained within 0.3< dR <0.4 (PileUp ID BDT input variable)"),
0037 Plot1D('puId_ptD','puId_ptD',10, 0, 1, "pT-weighted average pT of constituents (PileUp ID BDT input variable)"),
0038 Plot1D('puId_beta','puId_beta',10, 0, 1, "fraction of pT of charged constituents associated to PV (PileUp ID BDT input variable)"),
0039 Plot1D('puId_pull','puId_pull',10, 0, 0.05, "magnitude of pull vector (PileUp ID BDT input variable)"),
0040 Plot1D('puId_jetR','puId_jetR',10, 0, 1, "fraction of jet pT carried by the leading constituent (PileUp ID BDT input variable)"),
0041 Plot1D('puId_jetRchg','puId_jetRchg',10, 0, 1, "fraction of jet pT carried by the leading charged constituent (PileUp ID BDT input variable)"),
0042 Plot1D('puId_nCharged','puId_nCharged',10, 0, 40, "number of charged constituents (PileUp ID BDT input variable)"),
0043 Plot1D('qgl_axis2','qgl_axis2',10, 0, 0.4, "ellipse minor jet axis (Quark vs Gluon likelihood input variable)"),
0044 Plot1D('qgl_ptD','qgl_ptD',10, 0, 1, "pT-weighted average pT of constituents (Quark vs Gluon likelihood input variable)"),
0045 Plot1D('qgl_mult','qgl_mult', 10, 0, 50, "PF candidates multiplicity (Quark vs Gluon likelihood input variable)"),
0046 Plot1D('btagDeepFlavG','btagDeepFlavG',20, -1, 1, "DeepFlavour gluon tag raw score"),
0047 Plot1D('btagDeepFlavUDS','btagDeepFlavUDS',20, -1, 1, "DeepFlavour uds tag raw score"),
0048 Plot1D('particleNetAK4_B','particleNetAK4_B',20, -1, 1, "ParticleNetAK4 tagger b vs all (udsg, c) discriminator"),
0049 Plot1D('particleNetAK4_CvsL','particleNetAK4_CvsL',20, -1, 1,"ParticleNetAK4 tagger c vs udsg discriminator"),
0050 Plot1D('particleNetAK4_CvsB','particleNetAK4_CvsB',20, -1, 1,"ParticleNetAK4 tagger c vs b discriminator"),
0051 Plot1D('particleNetAK4_QvsG','particleNetAK4_QvsG',20, -1, 1,"ParticleNetAK4 tagger uds vs g discriminator"),
0052 Plot1D('particleNetAK4_G','particleNetAK4_G',20, -1, 1, "ParticleNetAK4 tagger g raw score"),
0053 Plot1D('particleNetAK4_puIdDisc','particleNetAK4_puIdDisc',20, -1, 1,"ParticleNetAK4 tagger pileup jet discriminator"),
0054 Plot1D('leadConstNeHadEF','leadConstNeHadEF',10, 0, 1,"Leading PF neutral hadron constituent energy fraction w.r.t jet raw energy"),
0055 Plot1D('leadConstChHadEF','leadConstChHadEF',10, 0, 1,"Leading PF charged hadron constituent energy fraction w.r.t jet raw energy"),
0056 Plot1D('leadConstPhotonEF','leadConstPhotonEF',10, 0, 1,"Leading PF photon constituent energy fraction w.r.t jet raw energy"),
0057 Plot1D('leadConstElectronEF','leadConstElectronEF',10, 0, 1,"Leading PF electron constituent energy fraction w.r.t jet raw energy"),
0058 Plot1D('leadConstMuonEF','leadConstMuonEF',10, 0, 1,"Leading PF muon constituent energy fraction w.r.t jet raw energy"),
0059 Plot1D('leadConstHFHADEF','leadConstHFHADEF',10, 0, 1,"Leading PF HF HAD constituent energy fraction w.r.t jet raw energy"),
0060 Plot1D('leadConstHFEMEF','leadConstHFEMEF',10, 0, 1,"Leading PF HF EM constituent energy fraction w.r.t jet raw energy"),
0061 Plot1D('leadConstNeHadPuppiWeight','leadConstNeHadPuppiWeight',10, 0, 1,"Leading PF neutral hadron constituent puppi weight"),
0062 Plot1D('leadConstChHadPuppiWeight','leadConstChHadPuppiWeight',10, 0, 1,"Leading PF charged hadron constituent puppi weight"),
0063 Plot1D('leadConstPhotonPuppiWeight','leadConstPhotonPuppiWeight',10, 0, 1,"Leading PF photon constituent puppi weight"),
0064 Plot1D('leadConstElectronPuppiWeight','leadConstElectronPuppiWeight',10, 0, 1,"Leading PF electron constituent puppi weight"),
0065 Plot1D('leadConstMuonPuppiWeight','leadConstMuonPuppiWeight',10, 0, 1,"Leading PF muon constituent puppi weight"),
0066 Plot1D('leadConstHFHADPuppiWeight','leadConstHFHADPuppiWeight',10, 0, 1,"Leading PF HF HAD constituent puppi weight"),
0067 Plot1D('leadConstHFEMPuppiWeight','leadConstHFEMPuppiWeight',10, 0, 1,"Leading PF HF EM constituent puppi weight"),
0068 ])
0069
0070
0071
0072
0073
0074
0075 _ak4chsplots = cms.VPSet(
0076 Count1D('_size', 20, -0.5, 19.5, 'AK4 PF CHS jets with JECs applied.')
0077 )
0078 for plot in _ak4puppiplots:
0079 if plot.name.value()=="_size": continue
0080 _ak4chsplots.append(plot)
0081 _ak4chsplots.extend([
0082 Plot1D('chFPV1EF', 'chFPV1EF', 20, 0, 2, 'charged fromPV==1 Energy Fraction (component of the total charged Energy Fraction).'),
0083 Plot1D('chFPV2EF', 'chFPV2EF', 20, 0, 2, 'charged fromPV==2 Energy Fraction (component of the total charged Energy Fraction).'),
0084 Plot1D('chFPV3EF', 'chFPV3EF', 20, 0, 2, 'charged fromPV==3 Energy Fraction (component of the total charged Energy Fraction).'),
0085 ])
0086
0087
0088
0089
0090
0091
0092
0093 nanojmeDQM.vplots.Jet.plots = _ak4puppiplots
0094 nanojmeDQM.vplots.JetPuppi = cms.PSet(
0095 sels = nanojmeDQM.vplots.Jet.sels,
0096 plots = _ak4puppiplots
0097 )
0098 nanojmeDQM.vplots.JetCHS = cms.PSet(
0099 sels = nanojmeDQM.vplots.Jet.sels,
0100 plots = _ak4chsplots
0101 )
0102
0103
0104
0105
0106
0107
0108
0109
0110 nanojmeDQM.vplots.FatJet.plots.extend([
0111 Plot1D('chHadMultiplicity','chHadMultiplicity', 10, 0, 40,'(Puppi-weighted) number of charged hadrons in the jet'),
0112 Plot1D('neHadMultiplicity','neHadMultiplicity', 10, 0, 40,'(Puppi-weighted) number of neutral hadrons in the jet'),
0113 Plot1D('phoMultiplicity','phoMultiplicity', 10, 0, 40,'(Puppi-weighted) number of photons in the jet'),
0114 Plot1D('elMultiplicity','elMultiplicity', 5, 0, 10,'(Puppi-weighted) number of electrons in the jet'),
0115 Plot1D('muMultiplicity','muMultiplicity', 5, 0, 10,'(Puppi-weighted) number of muons in the jet'),
0116 Plot1D('hfEMMultiplicity','hfEMMultiplicity', 5, 0, 10,'(Puppi-weighted) number of HF EMs in the jet'),
0117 Plot1D('hfHadMultiplicity','hfHadMultiplicity', 5, 0, 10,'(Puppi-weighted) number of HF hadrons in the jet'),
0118 Plot1D('neEmEF','neEmEF',20, 0, 1,'neutral Electromagnetic Energy Fraction'),
0119 Plot1D('neHEF','neHEF',20, 0, 1,'neutral Hadron Energy Fraction'),
0120 ])
0121
0122
0123
0124
0125
0126
0127 nanojmeDQM.vplots.FatJetForJEC = cms.PSet(
0128 sels = cms.PSet(
0129 CentralPt30 = cms.string('abs(eta) < 2.4 && pt > 30'),
0130 ForwardPt30 = cms.string('abs(eta) > 2.4 && pt > 30')
0131 ),
0132 plots = cms.VPSet(
0133 Count1D('_size', 20, -0.5, 19.5, 'AK8 PF Puppi jets with JECs applied. Reclustered for JEC studies so only minimal info stored.'),
0134 Plot1D('area', 'area', 20, 0.2, 0.8, 'jet catchment area, for JECs'),
0135 Plot1D('eta', 'eta', 20, -6, 6, 'eta'),
0136 Plot1D('mass', 'mass', 20, 0, 200, 'mass'),
0137 Plot1D('phi', 'phi', 20, -3.14159, 3.14159, 'phi'),
0138 Plot1D('pt', 'pt', 20, 0, 400, 'pt'),
0139 Plot1D('rawFactor', 'rawFactor', 20, -0.5, 0.5, '1 - Factor to get back to raw pT'),
0140 Plot1D('chHadMultiplicity','chHadMultiplicity', 10, 0, 40,'(Puppi-weighted) number of charged hadrons in the jet'),
0141 Plot1D('neHadMultiplicity','neHadMultiplicity', 10, 0, 40,'(Puppi-weighted) number of neutral hadrons in the jet'),
0142 Plot1D('phoMultiplicity','phoMultiplicity', 10, 0, 40,'(Puppi-weighted) number of photons in the jet'),
0143 Plot1D('elMultiplicity','elMultiplicity', 5, 0, 10,'(Puppi-weighted) number of electrons in the jet'),
0144 Plot1D('muMultiplicity','muMultiplicity', 5, 0, 10,'(Puppi-weighted) number of muons in the jet'),
0145 Plot1D('hfEMMultiplicity','hfEMMultiplicity', 5, 0, 10,'(Puppi-weighted) number of HF EMs in the jet'),
0146 Plot1D('hfHadMultiplicity','hfHadMultiplicity', 5, 0, 10,'(Puppi-weighted) number of HF hadrons in the jet'),
0147 Plot1D('nElectrons', 'nElectrons', 5, -0.5, 4.5, 'number of electrons in the jet'),
0148 Plot1D('nMuons', 'nMuons', 4, -0.5, 3.5, 'number of muons in the jet'),
0149 Plot1D('hadronFlavour', 'hadronFlavour', 6, -0.5, 5.5, 'flavour from hadron ghost clustering'),
0150 Plot1D('partonFlavour', 'partonFlavour', 40, -9.5, 30.5, 'flavour from parton matching'),
0151 Plot1D('chEmEF', 'chEmEF', 20, 0, 1, 'charged Electromagnetic Energy Fraction'),
0152 Plot1D('chHEF', 'chHEF', 20, 0, 2, 'charged Hadron Energy Fraction'),
0153 Plot1D('neEmEF', 'neEmEF', 20, 0.3, 0.4, 'neutral Electromagnetic Energy Fraction'),
0154 Plot1D('neHEF', 'neHEF', 20, 0.01, 0.2, 'neutral Hadron Energy Fraction'),
0155 Plot1D('hfEmEF', 'hfEmEF', 20, 0, 1, 'electromagnetic energy fraction in HF'),
0156 Plot1D('hfHEF', 'hfHEF', 20, 0, 1, 'hadronic energy fraction in HF'),
0157 Plot1D('muEF', 'muEF', 20, -1, 1, 'muon Energy Fraction'),
0158 NoPlot('genJetIdx'),
0159 ),
0160 )
0161
0162
0163
0164
0165
0166
0167 nanojmeDQM.vplots.JetCalo = cms.PSet(
0168 sels = cms.PSet(
0169 CentralPt30 = cms.string('abs(eta) < 2.4 && pt > 30'),
0170 ForwardPt30 = cms.string('abs(eta) > 2.4 && pt > 30')
0171 ),
0172 plots = cms.VPSet(
0173 Count1D('_size', 20, -0.5, 19.5, 'AK4 Calo jets (slimmedCaloJets)'),
0174 Plot1D('area', 'area', 20, 0.2, 0.8, 'jet catchment area'),
0175 Plot1D('eta', 'eta', 20, -6, 6, 'eta'),
0176 Plot1D('mass', 'mass', 20, 0, 200, 'mass'),
0177 Plot1D('phi', 'phi', 20, -3.14159, 3.14159, 'phi'),
0178 Plot1D('pt', 'pt', 20, 0, 400, 'pt'),
0179 Plot1D('rawFactor', 'rawFactor', 20, -0.5, 0.5, '1 - Factor to get back to raw pT'),
0180 Plot1D('emf', 'emf', 20, 0, 1, 'electromagnetic energy fraction'),
0181 Plot1D('hadronFlavour', 'hadronFlavour', 6, -0.5, 5.5, 'flavour from hadron ghost clustering'),
0182 Plot1D('partonFlavour', 'partonFlavour', 40, -9.5, 30.5, 'flavour from parton matching'),
0183 NoPlot('genJetIdx'),
0184 ),
0185 )
0186
0187
0188
0189
0190
0191
0192 _ak4genplots = cms.VPSet(
0193 Count1D('_size', 20, -0.5, 19.5, 'AK4 Gen jets (made with visible genparticles) with pt > 3 GeV. Sourced from slimmedGenJets')
0194 )
0195 for plot in nanojmeDQM.vplots.GenJet.plots:
0196 if plot.name.value()=="_size": continue
0197 _ak4genplots.append(plot)
0198
0199 _ak4genplots.extend([
0200 Plot1D('nConstituents', 'nConstituents', 20, 0, 80, 'Number of particles in the jet'),
0201 Plot1D('chHadMultiplicity','chHadMultiplicity',10, 0, 40,'number of charged hadrons in the jet'),
0202 Plot1D('neHadMultiplicity','neHadMultiplicity',10, 0, 40,'number of neutral hadrons in the jet'),
0203 Plot1D('chEmMultiplicity','chEmMultiplicity',5,0,10,'number of charged EM particles in the jet'),
0204 Plot1D('neEmMultiplicity','neEmMultiplicity',10,0,40,'number of neutral EM particles in the jet'),
0205 Plot1D('muMultiplicity','muMultiplicity',5,0,10,'number of muons in the jet'),
0206 Plot1D('chHEF','chHEF',20,0,2,'charged Hadron Energy Fraction'),
0207 Plot1D('neHEF','neHEF',20,0,1,'neutral Hadron Energy Fraction'),
0208 Plot1D('chEmEF','chEmEF',20,0, 1,'charged Electromagnetic Energy Fraction'),
0209 Plot1D('neEmEF','neEmEF',20,0, 1,'neutral Electromagnetic Energy Fraction'),
0210 Plot1D('muEF','muEF',20,0, 1, 'muon Energy Fraction')
0211 ]
0212 )
0213 nanojmeDQM.vplots.GenJet.plots = _ak4genplots
0214
0215
0216
0217
0218
0219
0220 nanojmeDQM.vplots.GenJetAK8.plots.extend([
0221 Plot1D('nConstituents', 'nConstituents', 20, 0, 80, 'Number of particles in the jet'),
0222 ]
0223 )
0224
0225
0226
0227
0228
0229 nanojmeDQM.vplots.GenJetAK8ForJEC = cms.PSet(
0230 plots = cms.VPSet(
0231 Count1D('_size', 20, -0.5, 19.5, 'AK8 Gen jets (made with visible genparticles) with pt > 10 GeV. Reclustered for JEC studies.'),
0232 Plot1D('eta', 'eta', 20, -6, 6, 'eta'),
0233 Plot1D('mass', 'mass', 20, 0, 200, 'mass'),
0234 Plot1D('phi', 'phi', 20, -3.14159, 3.14159, 'phi'),
0235 Plot1D('pt', 'pt', 20, 0, 400, 'pt'),
0236 Plot1D('nConstituents', 'nConstituents', 20, 0, 80, 'Number of particles in the jet'),
0237 Plot1D('chHadMultiplicity','chHadMultiplicity',10, 0, 40,'number of charged hadrons in the jet'),
0238 Plot1D('neHadMultiplicity','neHadMultiplicity',10, 0, 40,'number of neutral hadrons in the jet'),
0239 Plot1D('chEmMultiplicity','chEmMultiplicity',5,0,10,'number of charged EM particles in the jet'),
0240 Plot1D('neEmMultiplicity','neEmMultiplicity',10,0,40,'number of neutral EM particles in the jet'),
0241 Plot1D('muMultiplicity','muMultiplicity',5,0,10,'number of muons in the jet'),
0242 Plot1D('chHEF','chHEF',20,0,2,'charged Hadron Energy Fraction'),
0243 Plot1D('neHEF','neHEF',20,0,1,'neutral Hadron Energy Fraction'),
0244 Plot1D('chEmEF','chEmEF',20,0, 1,'charged Electromagnetic Energy Fraction'),
0245 Plot1D('neEmEF','neEmEF',20,0, 1,'neutral Electromagnetic Energy Fraction'),
0246 Plot1D('muEF','muEF',20,0, 1, 'muon Energy Fraction')
0247 ),
0248 )
0249
0250
0251
0252 nanojmeDQMMC = nanojmeDQM.clone()
0253
0254 nanojmeDQMMC.vplots.LowPtElectron.sels.Prompt = cms.string("genPartFlav == 1")
0255 nanojmeDQMMC.vplots.Muon.sels.Prompt = cms.string("genPartFlav == 1")
0256 nanojmeDQMMC.vplots.Photon.sels.Prompt = cms.string("genPartFlav == 1")
0257 nanojmeDQMMC.vplots.Tau.sels.Prompt = cms.string("genPartFlav == 5")
0258 nanojmeDQMMC.vplots.Jet.sels.Prompt = cms.string("genJetIdx != 1")
0259 nanojmeDQMMC.vplots.Jet.sels.PromptB = cms.string("genJetIdx != 1 && hadronFlavour == 5")
0260
0261
0262
0263
0264
0265
0266
0267
0268
0269 (~run2_nanoAOD_ANY).toModify(
0270 nanojmeDQM.vplots.Jet,
0271 plots = _ak4puppiplots,
0272 ).toModify(
0273 nanojmeDQM.vplots,
0274 JetPuppi = None
0275 )
0276 (~run2_nanoAOD_ANY).toModify(
0277 nanojmeDQMMC.vplots.JetCHS.sels,
0278 Prompt = nanojmeDQMMC.vplots.Jet.sels.Prompt,
0279 PromptB = nanojmeDQMMC.vplots.Jet.sels.PromptB
0280 )
0281
0282
0283
0284 run2_nanoAOD_ANY.toModify(
0285 nanojmeDQM.vplots.Jet,
0286 plots = _ak4chsplots,
0287 ).toModify(
0288 nanojmeDQM.vplots,
0289 JetCHS = None
0290 )
0291 run2_nanoAOD_ANY.toModify(
0292 nanojmeDQMMC.vplots.JetPuppi.sels,
0293 Prompt = nanojmeDQMMC.vplots.Jet.sels.Prompt,
0294 PromptB = nanojmeDQMMC.vplots.Jet.sels.PromptB
0295 )
0296
0297 from DQMServices.Core.DQMQualityTester import DQMQualityTester
0298 nanoDQMQTester = DQMQualityTester(
0299 qtList = cms.untracked.FileInPath('PhysicsTools/NanoAOD/test/dqmQualityTests.xml'),
0300 prescaleFactor = cms.untracked.int32(1),
0301 testInEventloop = cms.untracked.bool(False),
0302 qtestOnEndLumi = cms.untracked.bool(False),
0303 verboseQT = cms.untracked.bool(True)
0304 )
0305
0306 nanojmeHarvest = cms.Sequence( nanoDQMQTester )