diff --git a/DQMOffline/JetMET/interface/JetAnalyzer.h b/DQMOffline/JetMET/interface/JetAnalyzer.h index d63e609d5cc99..fa9155fa08e58 100644 --- a/DQMOffline/JetMET/interface/JetAnalyzer.h +++ b/DQMOffline/JetMET/interface/JetAnalyzer.h @@ -108,10 +108,12 @@ class JetAnalyzer : public DQMEDAnalyzer { edm::EDGetTokenT gtToken_; edm::EDGetTokenT caloJetsToken_; edm::EDGetTokenT pfJetsToken_; + edm::EDGetTokenT puppiJetsToken_; edm::EDGetTokenT pfMetToken_; edm::EDGetTokenT caloMetToken_; edm::EDGetTokenT patMetToken_; + edm::EDGetTokenT puppiMetToken_; edm::EDGetTokenT MuonsToken_; edm::EDGetTokenT patJetsToken_; @@ -786,6 +788,7 @@ class JetAnalyzer : public DQMEDAnalyzer { bool isCaloJet_; bool isPFJet_; bool isMiniAODJet_; + bool isPUPPIJet_; bool fill_jet_high_level_histo; diff --git a/DQMOffline/JetMET/python/jetAnalyzer_cff.py b/DQMOffline/JetMET/python/jetAnalyzer_cff.py index a580d6b8468be..bbb94af79c661 100644 --- a/DQMOffline/JetMET/python/jetAnalyzer_cff.py +++ b/DQMOffline/JetMET/python/jetAnalyzer_cff.py @@ -9,6 +9,11 @@ *jetDQMAnalyzerAk4PFCHSCleaned ) +_jetDQMAnalyzerSequenceWithPUPPI = cms.Sequence(jetDQMAnalyzerAk4CaloCleaned + *jetDQMAnalyzerAk4PFUncleaned*jetDQMAnalyzerAk4PFCleaned + *jetDQMAnalyzerAk4PFCHSCleaned*jetDQMAnalizerAk4PUPPICleaned + ) + jetDQMAnalyzerSequenceCosmics = cms.Sequence(jetDQMAnalyzerAk4CaloUncleaned) jetDQMAnalyzerSequenceMiniAOD = cms.Sequence(jetDQMAnalyzerAk4PFCHSUncleanedMiniAOD*jetDQMAnalyzerAk4PFCHSCleanedMiniAOD*jetDQMAnalyzerAk8PFPUPPICleanedMiniAOD*jetDQMAnalyzerAk4PFCHSPuppiCleanedMiniAOD) @@ -37,6 +42,7 @@ * jetDQMAnalyzerAkCs4PF ) from Configuration.ProcessModifiers.pp_on_AA_cff import pp_on_AA +(~pp_on_AA).toReplaceWith(jetDQMAnalyzerSequence, _jetDQMAnalyzerSequenceWithPUPPI) pp_on_AA.toReplaceWith( jetDQMAnalyzerSequence, _jetDQMAnalyzerSequenceHI ) pp_on_AA.toModify( jetDQMAnalyzerAkPU4Calo, srcVtx = cms.untracked.InputTag("offlinePrimaryVertices") ) pp_on_AA.toModify( jetDQMAnalyzerAkPU3PF, srcVtx = cms.untracked.InputTag("offlinePrimaryVertices") ) diff --git a/DQMOffline/JetMET/python/jetAnalyzer_cfi.py b/DQMOffline/JetMET/python/jetAnalyzer_cfi.py index 2febf51f5efb1..dd875f2ea9473 100644 --- a/DQMOffline/JetMET/python/jetAnalyzer_cfi.py +++ b/DQMOffline/JetMET/python/jetAnalyzer_cfi.py @@ -144,6 +144,16 @@ fillCHShistos = True ) +jetDQMAnalizerAk4PUPPICleaned=jetDQMAnalyzerAk4PFCleaned.clone( + JetType = cms.string('puppi'), + jetsrc = "ak4PFJetsPuppi", + METCollectionLabel = "pfMetPuppi", + JetCorrections = "ak4PFPuppiL1FastL2L3ResidualCorrector", + JetIDVersion = "RUN2ULPUPPI", + JetIDQuality = cms.string("TIGHT"), + fillCHShistos = True, +) + jetDQMAnalyzerAk4PFCHSUncleanedMiniAOD=jetDQMAnalyzerAk4PFUncleaned.clone( filljetHighLevel = True, CleaningParameters = cleaningParameters.clone( diff --git a/DQMOffline/JetMET/python/jetMETDQMOfflineSource_cff.py b/DQMOffline/JetMET/python/jetMETDQMOfflineSource_cff.py index 4974943039a40..574cca92bdbc6 100644 --- a/DQMOffline/JetMET/python/jetMETDQMOfflineSource_cff.py +++ b/DQMOffline/JetMET/python/jetMETDQMOfflineSource_cff.py @@ -42,6 +42,21 @@ inputIsCorrected = False ) +pileupJetIdCalculatorPUPPIDQM=pileupJetIdCalculator.clone( + jets = "ak4PFJetsPuppi", + jec = "AK4PFPuppi", + applyJec = True, + inputIsCorrected = False +) + +pileupJetIdEvaluatorPUPPIDQM=pileupJetIdEvaluator.clone( + jets = "ak4PFJetsPuppi", + jetids = "pileupJetIdCalculatorPUPPIDQM", + jec = "AK4PFPuppi", + applyJec = True, + inputIsCorrected = False +) + from JetMETCorrections.Configuration.JetCorrectors_cff import ak4CaloL2L3ResidualCorrectorChain,ak4CaloL2L3ResidualCorrector,ak4CaloResidualCorrector,ak4CaloL2L3Corrector,ak4CaloL3AbsoluteCorrector,ak4CaloL2RelativeCorrector dqmAk4CaloL2L3ResidualCorrector = ak4CaloL2L3ResidualCorrector.clone() @@ -77,6 +92,13 @@ dqmAk4PFCHSL1FastL2L3Corrector ) +from JetMETCorrections.Configuration.JetCorrectors_cff import ak4PFPuppiL1FastL2L3ResidualCorrectorChain,ak4PFPuppiL1FastL2L3ResidualCorrector,ak4PFPuppiL1FastL2L3Corrector,ak4PFPuppiResidualCorrector,ak4PFPuppiL3AbsoluteCorrector,ak4PFPuppiL2RelativeCorrector,ak4PFPuppiL1FastjetCorrector + +dqmAk4PFPuppiL1FastL2L3ResidualCorrector = ak4PFPuppiL1FastL2L3ResidualCorrector.clone() +dqmAk4PFPuppiL1FastL2L3ResidualCorrectorChain = cms.Sequence( + dqmAk4PFPuppiL1FastL2L3ResidualCorrector +) + HBHENoiseFilterResultProducerDQM=HBHENoiseFilterResultProducer.clone() jetPreDQMTask = cms.Task(ak4CaloL2RelativeCorrector, @@ -89,9 +111,27 @@ ak4PFCHSL1FastjetCorrector, ak4PFCHSL2RelativeCorrector, ak4PFCHSL3AbsoluteCorrector, - ak4PFCHSResidualCorrector + ak4PFCHSResidualCorrector, +) + +_jetPreDQMTaskWithPUPPI = cms.Task(ak4CaloL2RelativeCorrector, + ak4CaloL3AbsoluteCorrector, + ak4CaloResidualCorrector, + ak4PFL1FastjetCorrector, + ak4PFL2RelativeCorrector, + ak4PFL3AbsoluteCorrector, + ak4PFResidualCorrector, + ak4PFCHSL1FastjetCorrector, + ak4PFCHSL2RelativeCorrector, + ak4PFCHSL3AbsoluteCorrector, + ak4PFCHSResidualCorrector, + ak4PFPuppiL1FastjetCorrector, + ak4PFPuppiL2RelativeCorrector, + ak4PFPuppiL3AbsoluteCorrector, + ak4PFPuppiResidualCorrector, ) jetPreDQMSeq=cms.Sequence(jetPreDQMTask) +_jetPreDQMSeqWithPUPPI=cms.Sequence(_jetPreDQMTaskWithPUPPI) from JetMETCorrections.Type1MET.correctedMet_cff import pfMetT1 from JetMETCorrections.Type1MET.correctionTermsPfMetType0PFCandidate_cff import * @@ -115,6 +155,21 @@ *METDQMAnalyzerSequence *pfCandidateDQMAnalyzer) +_jetMETDQMOfflineSourceWithPUPPI = cms.Sequence(AnalyzeSUSYDQM*QGTagger* + pileupJetIdCalculatorCHSDQM*pileupJetIdEvaluatorCHSDQM* + pileupJetIdCalculatorDQM*pileupJetIdEvaluatorDQM* + pileupJetIdCalculatorPUPPIDQM*pileupJetIdEvaluatorPUPPIDQM* + _jetPreDQMSeqWithPUPPI* + dqmAk4CaloL2L3ResidualCorrectorChain*dqmAk4PFL1FastL2L3ResidualCorrectorChain*dqmAk4PFCHSL1FastL2L3ResidualCorrectorChain*dqmAk4PFCHSL1FastL2L3CorrectorChain*dqmAk4PFPuppiL1FastL2L3ResidualCorrectorChain* + cms.ignore(goodOfflinePrimaryVerticesDQM)* + dqmCorrPfMetType1*pfMETT1*jetDQMAnalyzerSequence*HBHENoiseFilterResultProducer* + cms.ignore(CSCTightHaloFilterDQM)*cms.ignore(CSCTightHalo2015FilterDQM)*cms.ignore(eeBadScFilterDQM)*cms.ignore(EcalDeadCellTriggerPrimitiveFilterDQM)*cms.ignore(EcalDeadCellBoundaryEnergyFilterDQM)*cms.ignore(HcalStripHaloFilterDQM) + *METDQMAnalyzerSequence + *pfCandidateDQMAnalyzer) + +from Configuration.ProcessModifiers.pp_on_AA_cff import pp_on_AA +(~pp_on_AA).toReplaceWith(jetMETDQMOfflineSource, _jetMETDQMOfflineSourceWithPUPPI) + from Configuration.Eras.Modifier_phase1Pixel_cff import phase1Pixel jetMETDQMOfflineRedoProductsMiniAOD = cms.Sequence(cms.ignore(goodOfflinePrimaryVerticesDQMforMiniAOD)) diff --git a/DQMOffline/JetMET/python/metDQMConfig_cff.py b/DQMOffline/JetMET/python/metDQMConfig_cff.py index 8e2980922d71f..fc2270c8b348b 100644 --- a/DQMOffline/JetMET/python/metDQMConfig_cff.py +++ b/DQMOffline/JetMET/python/metDQMConfig_cff.py @@ -1,12 +1,17 @@ import FWCore.ParameterSet.Config as cms +from Configuration.ProcessModifiers.pp_on_AA_cff import pp_on_AA from DQMOffline.JetMET.metDQMConfig_cfi import * #correction for type 1 done in JetMETDQMOfflineSource now METDQMAnalyzerSequence = cms.Sequence(caloMetDQMAnalyzer*pfMetDQMAnalyzer*pfChMetDQMAnalyzer*pfMetT1DQMAnalyzer) +_METDQMAnalyzerSequenceWithPUPPI = cms.Sequence(caloMetDQMAnalyzer*pfMetDQMAnalyzer*pfChMetDQMAnalyzer*pfMetT1DQMAnalyzer*pfMetPUPPIDQMAnalyzer) + METDQMAnalyzerSequenceMiniAOD = cms.Sequence(pfMetDQMAnalyzerMiniAOD*pfPuppiMetDQMAnalyzerMiniAOD) METDQMAnalyzerSequenceCosmics = cms.Sequence(caloMetDQMAnalyzer) METDQMAnalyzerSequenceHI = cms.Sequence(caloMetDQMAnalyzer*pfMetDQMAnalyzer) + +(~pp_on_AA).toReplaceWith(METDQMAnalyzerSequence, _METDQMAnalyzerSequenceWithPUPPI) \ No newline at end of file diff --git a/DQMOffline/JetMET/python/metDQMConfig_cfi.py b/DQMOffline/JetMET/python/metDQMConfig_cfi.py index 7dd570a8a799b..d5dbfcf783323 100644 --- a/DQMOffline/JetMET/python/metDQMConfig_cfi.py +++ b/DQMOffline/JetMET/python/metDQMConfig_cfi.py @@ -207,6 +207,12 @@ Filter = True ), ) +pfMetPUPPIDQMAnalyzer = pfMetDQMAnalyzer.clone( + METType = 'pf', + METCollectionLabel = "pfMetPuppi", + JetCollectionLabel = "ak4PFJetsPuppi", + JetCorrections = "dqmAk4PuppiL2L3ResidualCorrector", +) pfMetDQMAnalyzerMiniAOD = pfMetDQMAnalyzer.clone( fillMetHighLevel = True,#fills only lumisec plots fillCandidateMaps = False, diff --git a/DQMOffline/JetMET/src/JetAnalyzer.cc b/DQMOffline/JetMET/src/JetAnalyzer.cc index c096db298cec4..e488e05c8d9d9 100644 --- a/DQMOffline/JetMET/src/JetAnalyzer.cc +++ b/DQMOffline/JetMET/src/JetAnalyzer.cc @@ -79,6 +79,7 @@ JetAnalyzer::JetAnalyzer(const edm::ParameterSet& pSet) isCaloJet_ = (std::string("calo") == jetType_); //isJPTJet_ = (std::string("jpt") ==jetType_); isPFJet_ = (std::string("pf") == jetType_); + isPUPPIJet_ = (std::string("puppi") == jetType_); isMiniAODJet_ = (std::string("miniaod") == jetType_); jetCorrectorTag_ = pSet.getParameter("JetCorrections"); if (!isMiniAODJet_) { //in MiniAOD jet is already corrected @@ -98,6 +99,12 @@ JetAnalyzer::JetAnalyzer(const edm::ParameterSet& pSet) pfMetToken_ = consumes(edm::InputTag(pSet.getParameter("METCollectionLabel"))); } + if (isPUPPIJet_) { + puppiJetsToken_ = consumes(mInputCollection_); + MuonsToken_ = consumes(pSet.getParameter("muonsrc")); + puppiMetToken_ = + consumes(edm::InputTag(pSet.getParameter("METCollectionLabel"))); + } if (isMiniAODJet_) { patJetsToken_ = consumes(mInputCollection_); patMetToken_ = consumes(edm::InputTag(pSet.getParameter("METCollectionLabel"))); @@ -149,7 +156,7 @@ JetAnalyzer::JetAnalyzer(const edm::ParameterSet& pSet) } //Jet ID definitions for PFJets - if (isPFJet_ || isMiniAODJet_) { + if (isPFJet_ || isMiniAODJet_ || isPUPPIJet_) { if (JetIDVersion_ == "FIRSTDATA") { pfjetidversion = PFJetIDSelectionFunctor::FIRSTDATA; } else if (JetIDVersion_ == "RUNIISTARTUP") { @@ -283,11 +290,12 @@ void JetAnalyzer::bookHistograms(DQMStore::IBooker& ibooker, edm::Run const& iRu DirName = "JetMET/Jet/Uncleaned" + mInputCollection_.label(); } - jetME = ibooker.book1D("jetReco", "jetReco", 4, 1, 5); + jetME = ibooker.book1D("jetReco", "jetReco", 5, 1, 5); jetME->setBinLabel(1, "CaloJets", 1); jetME->setBinLabel(2, "PFJets", 1); jetME->setBinLabel(3, "JPTJets", 1); jetME->setBinLabel(4, "MiniAODJets", 1); + jetME->setBinLabel(5, "PUPPIJets", 1); map_of_MEs.insert(std::pair(DirName + "/" + "jetReco", jetME)); @@ -870,7 +878,7 @@ void JetAnalyzer::bookHistograms(DQMStore::IBooker& ibooker, edm::Run const& iRu mMuMultiplicity_highPt_Barrel)); } // - if (isMiniAODJet_ || isPFJet_) { + if (isMiniAODJet_ || isPFJet_ || isPUPPIJet_) { if (!filljetsubstruc_) { //not available for ak8 -> so just take out mMVAPUJIDDiscriminant_lowPt_Barrel = ibooker.book1D("MVAPUJIDDiscriminant_lowPt_Barrel", "MVAPUJIDDiscriminant_lowPt_Barrel", 50, -1.00, 1.00); @@ -2394,6 +2402,7 @@ void JetAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetu edm::Handle jptJets; edm::Handle pfJets; edm::Handle patJets; + edm::Handle puppiJets; edm::Handle Muons; @@ -2464,6 +2473,63 @@ void JetAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetu } } } + if (isPUPPIJet_) { + iEvent.getByToken(puppiJetsToken_, puppiJets); + double pt0 = -1; + double pt1 = -1; + //fill it only for cleaned jets + if (jetCleaningFlag_ && Muons.isValid() && Muons->size() > 1) { + for (unsigned int i = 0; i < Muons->size(); i++) { + bool pass_muon_id = false; + bool pass_muon_iso = false; + double dxy = fabs((*Muons)[i].muonBestTrack()->dxy()); + double dz = fabs((*Muons)[i].muonBestTrack()->dz()); + if (numPV > 0) { + dxy = fabs((*Muons)[i].muonBestTrack()->dxy((*vertexHandle)[0].position())); + dz = fabs((*Muons)[i].muonBestTrack()->dz((*vertexHandle)[0].position())); + } + if ((*Muons)[i].pt() > 20 && fabs((*Muons)[i].eta()) < 2.3) { + if ((*Muons)[i].isGlobalMuon() && (*Muons)[i].isPFMuon() && + (*Muons)[i].globalTrack()->hitPattern().numberOfValidMuonHits() > 0 && + (*Muons)[i].numberOfMatchedStations() > 1 && dxy < 0.2 && (*Muons)[i].numberOfMatchedStations() > 1 && + dz < 0.5 && (*Muons)[i].innerTrack()->hitPattern().numberOfValidPixelHits() > 0 && + (*Muons)[i].innerTrack()->hitPattern().trackerLayersWithMeasurement() > 5) { + pass_muon_id = true; + } + // Muon pf isolation DB corrected + float muonIsoPFdb = + ((*Muons)[i].pfIsolationR04().sumChargedHadronPt + + std::max(0., + (*Muons)[i].pfIsolationR04().sumNeutralHadronEt + (*Muons)[i].pfIsolationR04().sumPhotonEt - + 0.5 * (*Muons)[i].pfIsolationR04().sumPUPt)) / + (*Muons)[i].pt(); + if (muonIsoPFdb < 0.12) { + pass_muon_iso = true; + } + + if (pass_muon_id && pass_muon_iso) { + if ((*Muons)[i].pt() > pt0) { + mu_index1 = mu_index0; + pt1 = pt0; + mu_index0 = i; + pt0 = (*Muons)[i].pt(); + } else if ((*Muons)[i].pt() > pt1) { + mu_index1 = i; + pt1 = (*Muons)[i].pt(); + } + } + } + } + if (mu_index0 >= 0 && mu_index1 >= 0) { + if ((*Muons)[mu_index0].charge() * (*Muons)[mu_index1].charge() < 0) { + zCand = (*Muons)[mu_index0].polarP4() + (*Muons)[mu_index1].polarP4(); + if (fabs(zCand.M() - 91.) < 20 && zCand.Pt() > 30) { + pass_Z_selection = true; + } + } + } + } + } if (isMiniAODJet_) iEvent.getByToken(patJetsToken_, patJets); @@ -2482,6 +2548,8 @@ void JetAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetu //if (isJPTJet_) jetCollectionIsValid = jptJets.isValid(); if (isPFJet_) jetCollectionIsValid = pfJets.isValid(); + if (isPUPPIJet_) + jetCollectionIsValid = puppiJets.isValid(); if (isMiniAODJet_) jetCollectionIsValid = patJets.isValid(); @@ -2503,6 +2571,9 @@ void JetAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetu collSize = pfJets->size(); if (isMiniAODJet_) collSize = patJets->size(); + if (isPUPPIJet_) { + collSize = puppiJets->size(); + } double scale = -1; //now start changes for jets @@ -2560,6 +2631,9 @@ void JetAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetu if (isPFJet_) { correctedJet = (*pfJets)[ijet]; } + if (isPUPPIJet_) { + correctedJet = (*puppiJets)[ijet]; + } if (isMiniAODJet_) { correctedJet = (*patJets)[ijet]; }