diff --git a/Validation/RecoParticleFlow/plugins/OffsetAnalyzerDQM.cc b/Validation/RecoParticleFlow/plugins/OffsetAnalyzerDQM.cc index 7fd2b7204d6d6..d37d801bcef48 100644 --- a/Validation/RecoParticleFlow/plugins/OffsetAnalyzerDQM.cc +++ b/Validation/RecoParticleFlow/plugins/OffsetAnalyzerDQM.cc @@ -163,6 +163,7 @@ void OffsetAnalyzerDQM::analyze(const edm::Event& iEvent, const edm::EventSetup& int npv = 0; for (unsigned int i = 0; i < nPVall; i++) { const auto& pv = vertexHandle->at(i); + th1dPlots["pv_z"].fill(pv.z()); if (!pv.isFake() && pv.ndof() >= 4 && fabs(pv.z()) <= 24.0 && fabs(pv.position().rho()) <= 2.0) { npv++; diff --git a/Validation/RecoParticleFlow/plugins/PFJetAnalyzerDQM.cc b/Validation/RecoParticleFlow/plugins/PFJetAnalyzerDQM.cc index 1a92fa45956fd..f5c9e396cce83 100644 --- a/Validation/RecoParticleFlow/plugins/PFJetAnalyzerDQM.cc +++ b/Validation/RecoParticleFlow/plugins/PFJetAnalyzerDQM.cc @@ -114,13 +114,18 @@ class PFJetAnalyzerDQM : public DQMEDAnalyzer { std::vector jetResponsePlots; std::vector jetResponsePlots_noJEC; std::vector genJetPlots; + std::vector genJetPlots_matched; + std::vector genJetPlots_unmatched; + std::vector recoJetPlots; + std::vector recoJetPlots_matched; + std::vector recoJetPlots_unmatched; // Is this data or MC? bool isMC; float jetDeltaR; - bool genJetsOn; + bool genJetsOn, recoJetsOn; std::string jetCollectionName; @@ -133,6 +138,11 @@ class PFJetAnalyzerDQM : public DQMEDAnalyzer { void fillJetResponse(edm::View& recoJetCollection, edm::View& genJetCollection); void prepareJetResponsePlots(const std::vector& genjet_plots_pset); void prepareGenJetPlots(const std::vector& genjet_plots_pset); + void prepareGenJetMatchedPlots(const std::vector& genjet_plots_pset); + void prepareGenJetUnmatchedPlots(const std::vector& genjet_plots_pset); + void prepareRecoJetPlots(const std::vector& recojet_plots_pset); + void prepareRecoJetMatchedPlots(const std::vector& recojet_plots_pset); + void prepareRecoJetUnmatchedPlots(const std::vector& recojet_plots_pset); }; void PFJetAnalyzerDQM::prepareJetResponsePlots(const std::vector& response_plots) { @@ -188,6 +198,121 @@ void PFJetAnalyzerDQM::prepareGenJetPlots(const std::vector& } } +void PFJetAnalyzerDQM::prepareGenJetMatchedPlots(const std::vector& genjet_plots_pset) { + for (auto& pset : genjet_plots_pset) { + const auto name = pset.getParameter("name") + "_matched"; + const auto title = "Matched " + pset.getParameter("title"); + + //Low and high edges of the eta bins for jets to pass to be filled into this histogram + const auto ptbins_d = pset.getParameter>("ptBins"); + std::vector ptbins(ptbins_d.begin(), ptbins_d.end()); + + const auto etabin_low = pset.getParameter("etaBinLow"); + const auto etabin_high = pset.getParameter("etaBinHigh"); + + genJetPlots_matched.push_back(Plot1DInBinVariable( + name, + title, + std::make_unique(name.c_str(), title.c_str(), static_cast(ptbins.size()) - 1, ptbins.data()), + 0.0, + 0.0, + etabin_low, + etabin_high)); + } +} + +void PFJetAnalyzerDQM::prepareGenJetUnmatchedPlots(const std::vector& genjet_plots_pset) { + for (auto& pset : genjet_plots_pset) { + const auto name = pset.getParameter("name") + "_unmatched"; + const auto title = "Unmatched " + pset.getParameter("title"); + + //Low and high edges of the eta bins for jets to pass to be filled into this histogram + const auto ptbins_d = pset.getParameter>("ptBins"); + std::vector ptbins(ptbins_d.begin(), ptbins_d.end()); + + const auto etabin_low = pset.getParameter("etaBinLow"); + const auto etabin_high = pset.getParameter("etaBinHigh"); + + genJetPlots_unmatched.push_back(Plot1DInBinVariable( + name, + title, + std::make_unique(name.c_str(), title.c_str(), static_cast(ptbins.size()) - 1, ptbins.data()), + 0.0, + 0.0, + etabin_low, + etabin_high)); + } +} + +void PFJetAnalyzerDQM::prepareRecoJetPlots(const std::vector& recojet_plots_pset) { + for (auto& pset : recojet_plots_pset) { + const auto name = pset.getParameter("name"); + const auto title = pset.getParameter("title"); + + //Low and high edges of the eta bins for jets to pass to be filled into this histogram + const auto ptbins_d = pset.getParameter>("ptBins"); + std::vector ptbins(ptbins_d.begin(), ptbins_d.end()); + + const auto etabin_low = pset.getParameter("etaBinLow"); + const auto etabin_high = pset.getParameter("etaBinHigh"); + + recoJetPlots.push_back(Plot1DInBinVariable( + name, + title, + std::make_unique(name.c_str(), title.c_str(), static_cast(ptbins.size()) - 1, ptbins.data()), + 0.0, + 0.0, + etabin_low, + etabin_high)); + } +} + +void PFJetAnalyzerDQM::prepareRecoJetMatchedPlots(const std::vector& recojet_plots_pset) { + for (auto& pset : recojet_plots_pset) { + const auto name = pset.getParameter("name") + "_matched"; + const auto title = "Matched " + pset.getParameter("title"); + + //Low and high edges of the eta bins for jets to pass to be filled into this histogram + const auto ptbins_d = pset.getParameter>("ptBins"); + std::vector ptbins(ptbins_d.begin(), ptbins_d.end()); + + const auto etabin_low = pset.getParameter("etaBinLow"); + const auto etabin_high = pset.getParameter("etaBinHigh"); + + recoJetPlots_matched.push_back(Plot1DInBinVariable( + name, + title, + std::make_unique(name.c_str(), title.c_str(), static_cast(ptbins.size()) - 1, ptbins.data()), + 0.0, + 0.0, + etabin_low, + etabin_high)); + } +} + +void PFJetAnalyzerDQM::prepareRecoJetUnmatchedPlots(const std::vector& recojet_plots_pset) { + for (auto& pset : recojet_plots_pset) { + const auto name = pset.getParameter("name") + "_unmatched"; + const auto title = "Unmatched " + pset.getParameter("title"); + + //Low and high edges of the eta bins for jets to pass to be filled into this histogram + const auto ptbins_d = pset.getParameter>("ptBins"); + std::vector ptbins(ptbins_d.begin(), ptbins_d.end()); + + const auto etabin_low = pset.getParameter("etaBinLow"); + const auto etabin_high = pset.getParameter("etaBinHigh"); + + recoJetPlots_unmatched.push_back(Plot1DInBinVariable( + name, + title, + std::make_unique(name.c_str(), title.c_str(), static_cast(ptbins.size()) - 1, ptbins.data()), + 0.0, + 0.0, + etabin_low, + etabin_high)); + } +} + PFJetAnalyzerDQM::PFJetAnalyzerDQM(const edm::ParameterSet& iConfig) { recoJetsLabel = iConfig.getParameter("recoJetCollection"); genJetsLabel = iConfig.getParameter("genJetCollection"); @@ -200,6 +325,7 @@ PFJetAnalyzerDQM::PFJetAnalyzerDQM(const edm::ParameterSet& iConfig) { //for turn genJet on/off genJetsOn = iConfig.getParameter("genJetsOn"); + recoJetsOn = iConfig.getParameter("recoJetsOn"); //Create all jet response plots in bins of genjet pt and eta const auto& response_plots = iConfig.getParameter>("responsePlots"); @@ -207,6 +333,13 @@ PFJetAnalyzerDQM::PFJetAnalyzerDQM(const edm::ParameterSet& iConfig) { const auto& genjet_plots = iConfig.getParameter>("genJetPlots"); prepareGenJetPlots(genjet_plots); + prepareGenJetMatchedPlots(genjet_plots); + prepareGenJetUnmatchedPlots(genjet_plots); + + const auto& recojet_plots = iConfig.getParameter>("recoJetPlots"); + prepareRecoJetPlots(recojet_plots); + prepareRecoJetMatchedPlots(recojet_plots); + prepareRecoJetUnmatchedPlots(recojet_plots); recoJetsToken = consumes>(recoJetsLabel); genJetsToken = consumes>(genJetsLabel); @@ -215,7 +348,37 @@ PFJetAnalyzerDQM::PFJetAnalyzerDQM(const edm::ParameterSet& iConfig) { void PFJetAnalyzerDQM::fillJetResponse(edm::View& recoJetCollection, edm::View& genJetCollection) { //match gen jets to reco jets, require minimum jetDeltaR, choose closest, do not try to match charge std::vector matchIndices; + std::vector matchIndicesReco; PFB::match(genJetCollection, recoJetCollection, matchIndices, false, jetDeltaR); + PFB::match(recoJetCollection, genJetCollection, matchIndicesReco, false, jetDeltaR); + + //Fill recojet pt if recoJetOn + for (unsigned int i = 0; i < recoJetCollection.size(); i++) { + const auto& recoJet = recoJetCollection.at(i); + const auto pt_reco = recoJet.pt(); + const auto eta_reco = abs(recoJet.eta()); + const int iMatch_reco = matchIndicesReco[i]; + if (recoJetsOn) { + for (auto& plot : recoJetPlots) { + if (plot.isInEtaBin(eta_reco)) { + plot.fill(pt_reco); + } + } + if (iMatch_reco != -1) { + for (auto& plot : recoJetPlots_matched) { + if (plot.isInEtaBin(eta_reco)) { + plot.fill(pt_reco); + } + } + } else { + for (auto& plot : recoJetPlots_unmatched) { + if (plot.isInEtaBin(eta_reco)) { + plot.fill(pt_reco); + } + } + } + } + } for (unsigned int i = 0; i < genJetCollection.size(); i++) { const auto& genJet = genJetCollection.at(i); @@ -231,6 +394,21 @@ void PFJetAnalyzerDQM::fillJetResponse(edm::View& recoJetCollection, e } } } + if (recoJetsOn) { + if (iMatch != -1) { + for (auto& plot : genJetPlots_matched) { + if (plot.isInEtaBin(eta_gen)) { + plot.fill(pt_gen); + } + } + } else { + for (auto& plot : genJetPlots_unmatched) { + if (plot.isInEtaBin(eta_gen)) { + plot.fill(pt_gen); + } + } + } + } //If gen jet had a matched reco jet if (iMatch != -1) { @@ -263,12 +441,31 @@ void PFJetAnalyzerDQM::bookHistograms(DQMStore::IBooker& booker, edm::Run const& for (auto& plot : jetResponsePlots) { plot.book(booker); } + //Book plots for noJEC booker.setCurrentFolder("ParticleFlow/JetResponse/" + jetCollectionName + "/noJEC/"); for (auto& plot : jetResponsePlots_noJEC) { plot.book(booker); } - + if (recoJetsOn) { + booker.setCurrentFolder("ParticleFlow/JetResponse/" + jetCollectionName + "/noJEC/"); + for (auto& plot : genJetPlots_matched) { + plot.book(booker); + } + for (auto& plot : genJetPlots_unmatched) { + plot.book(booker); + } + booker.setCurrentFolder("ParticleFlow/JetResponse/" + jetCollectionName + "/JEC/"); + for (auto& plot : recoJetPlots) { + plot.book(booker); + } + for (auto& plot : recoJetPlots_matched) { + plot.book(booker); + } + for (auto& plot : recoJetPlots_unmatched) { + plot.book(booker); + } + } //Book plots for gen-jet pt spectra if (genJetsOn) { booker.setCurrentFolder("ParticleFlow/GenJets/"); @@ -277,7 +474,6 @@ void PFJetAnalyzerDQM::bookHistograms(DQMStore::IBooker& booker, edm::Run const& } } } - void PFJetAnalyzerDQM::analyze(const edm::Event& iEvent, const edm::EventSetup&) { edm::Handle> recoJetCollectionHandle; iEvent.getByToken(recoJetsToken, recoJetCollectionHandle); diff --git a/Validation/RecoParticleFlow/plugins/PFJetDQMPostProcessor.cc b/Validation/RecoParticleFlow/plugins/PFJetDQMPostProcessor.cc index be379ccf94a90..8fc742849e900 100644 --- a/Validation/RecoParticleFlow/plugins/PFJetDQMPostProcessor.cc +++ b/Validation/RecoParticleFlow/plugins/PFJetDQMPostProcessor.cc @@ -18,6 +18,7 @@ #include "DQMServices/Core/interface/DQMStore.h" #include "TCanvas.h" +#include "TGraphAsymmErrors.h" // // class declaration @@ -43,6 +44,7 @@ class PFJetDQMPostProcessor : public DQMEDHarvester { std::vector jetResponseDir; std::string genjetDir; + std::string offsetDir; std::vector ptBins; std::vector etaBins; @@ -70,6 +72,7 @@ class PFJetDQMPostProcessor : public DQMEDHarvester { PFJetDQMPostProcessor::PFJetDQMPostProcessor(const edm::ParameterSet& iConfig) { jetResponseDir = iConfig.getParameter>("jetResponseDir"); genjetDir = iConfig.getParameter("genjetDir"); + offsetDir = iConfig.getParameter("offsetDir"); ptBins = iConfig.getParameter>("ptBins"); etaBins = iConfig.getParameter>("etaBins"); recoptcut = iConfig.getParameter("recoPtCut"); @@ -83,36 +86,54 @@ void PFJetDQMPostProcessor::dqmEndJob(DQMStore::IBooker& ibook_, DQMStore::IGett iget_.setCurrentFolder(genjetDir); std::vector sME_genjets = iget_.getMEs(); std::for_each(sME_genjets.begin(), sME_genjets.end(), [&](auto& s) { s.insert(0, genjetDir); }); - //for (unsigned int i=0; i sME_offset = iget_.getMEs(); + std::for_each(sME_offset.begin(), sME_offset.end(), [&](auto& s) { s.insert(0, offsetDir); }); iget_.setCurrentFolder(jetResponseDir[idir]); std::vector sME_response = iget_.getMEs(); std::for_each(sME_response.begin(), sME_response.end(), [&](auto& s) { s.insert(0, jetResponseDir[idir]); }); - //for (unsigned int i=0; i vME_efficiency; + std::vector vME_purity; std::vector vME_presponse; + std::vector vME_presponse_mean; + std::vector vME_presponse_median; std::vector vME_preso; std::vector vME_preso_rms; + std::vector vME_ratePUJet; MonitorElement* me; TH1F* h_resp; - TH1F* h_genjet_pt; + TH1F *h_genjet_pt, *h_genjet_matched_pt; // *h_genjet_unmatched_pt; + TH1F *h_recojet_pt, *h_recojet_matched_pt, *h_recojet_unmatched_pt; + + stitle = offsetDir + "mu"; + std::vector::const_iterator it = std::find(sME_offset.begin(), sME_offset.end(), stitle); + if (it == sME_offset.end()) + continue; + me = iget_.get(stitle); + int nEvents = ((TH1F*)me->getTH1F())->GetEntries(); + iget_.setCurrentFolder(jetResponseDir[idir]); + bool isNoJEC = (jetResponseDir[idir].find("noJEC") != std::string::npos); + bool isJEC = false; + if (!isNoJEC) + isJEC = (jetResponseDir[idir].find("JEC") != std::string::npos); // // Response distributions // for (unsigned int ieta = 1; ieta < etaBins.size(); ++ieta) { stitle = genjetDir + "genjet_pt" + "_eta" + seta(etaBins[ieta]); - //std::cout << ieta << " " << stitle << std::endl; std::vector::const_iterator it = std::find(sME_genjets.begin(), sME_genjets.end(), stitle); if (it == sME_genjets.end()) @@ -120,17 +141,63 @@ void PFJetDQMPostProcessor::dqmEndJob(DQMStore::IBooker& ibook_, DQMStore::IGett me = iget_.get(stitle); h_genjet_pt = (TH1F*)me->getTH1F(); + if (isNoJEC) { + // getting the histogram for matched gen jets + stitle = jetResponseDir[idir] + "genjet_pt" + "_eta" + seta(etaBins[ieta]) + "_matched"; + me = iget_.get(stitle); + h_genjet_matched_pt = (TH1F*)me->getTH1F(); + + /*// getting the histogram for unmatched gen jets + stitle = jetResponseDir[idir] + "genjet_pt" + "_eta" + seta(etaBins[ieta]) + "_unmatched"; + me = iget_.get(stitle); + h_genjet_unmatched_pt = (TH1F*)me->getTH1F();*/ + } + if (isJEC) { + // getting the histogram for reco jets + stitle = jetResponseDir[idir] + "recojet_pt" + "_eta" + seta(etaBins[ieta]); + me = iget_.get(stitle); + h_recojet_pt = (TH1F*)me->getTH1F(); + + // getting the histogram for matched reco jets + stitle = jetResponseDir[idir] + "recojet_pt" + "_eta" + seta(etaBins[ieta]) + "_matched"; + me = iget_.get(stitle); + h_recojet_matched_pt = (TH1F*)me->getTH1F(); + + // getting the histogram for unmatched reco jets + stitle = jetResponseDir[idir] + "recojet_pt" + "_eta" + seta(etaBins[ieta]) + "_unmatched"; + me = iget_.get(stitle); + h_recojet_unmatched_pt = (TH1F*)me->getTH1F(); + } + stitle = "presponse_eta" + seta(etaBins[ieta]); // adding "Raw" to the title of raw jet response histograms - if (jetResponseDir[idir].find("noJEC") != std::string::npos) { + if (isNoJEC) { sprintf(ctitle, "Raw Jet pT response, %4.1f<|#eta|<%4.1f", etaBins[ieta - 1], etaBins[ieta]); } else { sprintf(ctitle, "Jet pT response, %4.1f<|#eta|<%4.1f", etaBins[ieta - 1], etaBins[ieta]); } TH1F* h_presponse = new TH1F(stitle.c_str(), ctitle, nPtBins, ptBinsArray); - stitle = "preso_eta" + seta(etaBins[ieta]); + stitle = "presponse_eta" + seta(etaBins[ieta]) + "_mean"; + // adding "Raw" to the title of raw jet response histograms if (jetResponseDir[idir].find("noJEC") != std::string::npos) { + sprintf(ctitle, "Raw Jet pT response using Mean, %4.1f<|#eta|<%4.1f", etaBins[ieta - 1], etaBins[ieta]); + } else { + sprintf(ctitle, "Jet pT response using Mean, %4.1f<|#eta|<%4.1f", etaBins[ieta - 1], etaBins[ieta]); + } + TH1F* h_presponse_mean = new TH1F(stitle.c_str(), ctitle, nPtBins, ptBinsArray); + + stitle = "presponse_eta" + seta(etaBins[ieta]) + "_median"; + // adding "Raw" to the title of raw jet response histograms + if (isNoJEC) { + sprintf(ctitle, "Raw Jet pT response using Med., %4.1f<|#eta|<%4.1f", etaBins[ieta - 1], etaBins[ieta]); + } else { + sprintf(ctitle, "Jet pT response using Med., %4.1f<|#eta|<%4.1f", etaBins[ieta - 1], etaBins[ieta]); + } + TH1F* h_presponse_median = new TH1F(stitle.c_str(), ctitle, nPtBins, ptBinsArray); + + stitle = "preso_eta" + seta(etaBins[ieta]); + if (isNoJEC) { sprintf(ctitle, "Raw Jet pT resolution, %4.1f<|#eta|<%4.1f", etaBins[ieta - 1], etaBins[ieta]); } else { sprintf(ctitle, "Jet pT resolution, %4.1f<|#eta|<%4.1f", etaBins[ieta - 1], etaBins[ieta]); @@ -145,6 +212,31 @@ void PFJetDQMPostProcessor::dqmEndJob(DQMStore::IBooker& ibook_, DQMStore::IGett } TH1F* h_preso_rms = new TH1F(stitle.c_str(), ctitle, nPtBins, ptBinsArray); + //Booking histogram for Jet Efficiency vs pT + stitle = "efficiency_eta" + seta(etaBins[ieta]); + sprintf(ctitle, "Efficiency, %4.1f<|#eta|<%4.1f", etaBins[ieta - 1], etaBins[ieta]); + TH1F* h_efficiency = new TH1F(stitle.c_str(), ctitle, nPtBins, ptBinsArray); + + //Booking histogram for Jet Purity vs pT + stitle = "purity_eta" + seta(etaBins[ieta]); + sprintf(ctitle, "Purity, %4.1f<|#eta|<%4.1f", etaBins[ieta - 1], etaBins[ieta]); + TH1F* h_purity = new TH1F(stitle.c_str(), ctitle, nPtBins, ptBinsArray); + + //Booking histogram for #PU jets vs pT + stitle = "ratePUJet_eta" + seta(etaBins[ieta]); + sprintf(ctitle, "PU Jet Rate, %4.1f<|#eta|<%4.1f", etaBins[ieta - 1], etaBins[ieta]); + TH1F* h_ratePUJet = new TH1F(stitle.c_str(), ctitle, nPtBins, ptBinsArray); + + if (isNoJEC) { + h_efficiency->Divide(h_genjet_matched_pt, h_genjet_pt, 1, 1, "B"); + } + if (isJEC) { + h_purity->Divide(h_recojet_matched_pt, h_recojet_pt, 1, 1, "B"); + h_ratePUJet = (TH1F*)h_recojet_unmatched_pt->Clone(); + h_ratePUJet->SetName("h_ratePUJet"); + h_ratePUJet->Scale(1. / double(nEvents)); + } + for (unsigned int ipt = 0; ipt < ptBins.size() - 1; ++ipt) { stitle = jetResponseDir[idir] + "reso_dist_" + spt(ptBins[ipt], ptBins[ipt + 1]) + "_eta" + seta(etaBins[ieta]); std::vector::const_iterator it = std::find(sME_response.begin(), sME_response.end(), stitle); @@ -184,12 +276,55 @@ void PFJetDQMPostProcessor::dqmEndJob(DQMStore::IBooker& ibook_, DQMStore::IGett h_preso_rms->SetBinContent(ipt + 1, std); h_preso_rms->SetBinError(ipt + 1, err); + // Mean-based + h_presponse_mean->SetBinContent(ipt + 1, h_resp->GetMean()); + h_presponse_mean->SetBinError(ipt + 1, h_resp->GetMeanError()); + + // Median-based + if (h_resp->GetEntries() > 0) { + int numBins = h_resp->GetXaxis()->GetNbins(); + Double_t x1[numBins]; + Double_t y1[numBins]; + for (int i = 0; i < numBins; i++) { + x1[i] = h_resp->GetBinCenter(i + 1); + y1[i] = h_resp->GetBinContent(i + 1) > 0 ? h_resp->GetBinContent(i + 1) : 0.0; + } + const auto x = x1, y = y1; + double median = TMath::Median(numBins, x, y); + h_presponse_median->SetBinContent(ipt + 1, median); + h_presponse_median->SetBinError(ipt + 1, 1.2533 * (h_resp->GetMeanError())); + } + } // ipt + if (isNoJEC) { + stitle = "efficiency_eta" + seta(etaBins[ieta]); + me = ibook_.book1D(stitle.c_str(), h_efficiency); + vME_efficiency.push_back(me); + } + + if (isJEC) { + stitle = "purity_eta" + seta(etaBins[ieta]); + me = ibook_.book1D(stitle.c_str(), h_purity); + vME_purity.push_back(me); + + stitle = "ratePUJet_eta" + seta(etaBins[ieta]); + me = ibook_.book1D(stitle.c_str(), h_ratePUJet); + vME_ratePUJet.push_back(me); + } + stitle = "presponse_eta" + seta(etaBins[ieta]); me = ibook_.book1D(stitle.c_str(), h_presponse); vME_presponse.push_back(me); + stitle = "presponse_eta" + seta(etaBins[ieta]) + "_mean"; + me = ibook_.book1D(stitle.c_str(), h_presponse_mean); + vME_presponse_mean.push_back(me); + + stitle = "presponse_eta" + seta(etaBins[ieta]) + "_median"; + me = ibook_.book1D(stitle.c_str(), h_presponse_median); + vME_presponse_median.push_back(me); + stitle = "preso_eta" + seta(etaBins[ieta]); me = ibook_.book1D(stitle.c_str(), h_preso); vME_preso.push_back(me); @@ -204,8 +339,26 @@ void PFJetDQMPostProcessor::dqmEndJob(DQMStore::IBooker& ibook_, DQMStore::IGett // Checks // if (debug) { + if (isNoJEC) { + for (std::vector::const_iterator i = vME_efficiency.begin(); i != vME_efficiency.end(); ++i) + (*i)->getTH1F()->Print(); + } + if (isJEC) { + for (std::vector::const_iterator i = vME_purity.begin(); i != vME_purity.end(); ++i) + (*i)->getTH1F()->Print(); + for (std::vector::const_iterator i = vME_ratePUJet.begin(); i != vME_ratePUJet.end(); ++i) + (*i)->getTH1F()->Print(); + } + for (std::vector::const_iterator i = vME_presponse.begin(); i != vME_presponse.end(); ++i) (*i)->getTH1F()->Print(); + for (std::vector::const_iterator i = vME_presponse_mean.begin(); i != vME_presponse_mean.end(); + ++i) + (*i)->getTH1F()->Print(); + for (std::vector::const_iterator i = vME_presponse_median.begin(); + i != vME_presponse_median.end(); + ++i) + (*i)->getTH1F()->Print(); for (std::vector::const_iterator i = vME_preso.begin(); i != vME_preso.end(); ++i) (*i)->getTH1F()->Print(); for (std::vector::const_iterator i = vME_preso_rms.begin(); i != vME_preso_rms.end(); ++i) @@ -262,7 +415,7 @@ void PFJetDQMPostProcessor::fitResponse(TH1F* hreso, hreso->Fit("fg2", "RQN"); fitlow = fg2->GetParameter(0) - 1.5 * fg2->GetParameter(1); - fitlow = TMath::Max(15. / ptlow, fitlow); + fitlow = TMath::Max(recoptcut / ptlow, fitlow); fithigh = fg2->GetParameter(0) + 1.5 * fg2->GetParameter(1); fg2->SetRange(fitlow, fithigh); diff --git a/Validation/RecoParticleFlow/python/defaults_cfi.py b/Validation/RecoParticleFlow/python/defaults_cfi.py index 80fdf342f9f26..393258d8ea521 100644 --- a/Validation/RecoParticleFlow/python/defaults_cfi.py +++ b/Validation/RecoParticleFlow/python/defaults_cfi.py @@ -15,6 +15,10 @@ def genjet_distribution_name(ietabin): eta_string = "{0:.1f}".format(etabins[ietabin+1]).replace(".", "") return "genjet_pt_eta{0}".format(eta_string) +def recojet_distribution_name(ietabin): + eta_string = "{0:.1f}".format(etabins[ietabin+1]).replace(".", "") + return "recojet_pt_eta{0}".format(eta_string) + jetResponseDir = 'ParticleFlow/JetResponse/' genjetDir = 'ParticleFlow/GenJets/' @@ -28,10 +32,11 @@ def genjet_distribution_name(ietabin): 4.191, 4.363, 4.538, 4.716, 4.889, 5.191] muLowOffset = 0 -muHighOffset = 100 +muHighOffset = 400 npvLowOffset = 0 npvHighOffset = 100 +pvzHighOffset = 100 eBinsOffset = 1000 eLowOffset = 0 diff --git a/Validation/RecoParticleFlow/python/offsetAnalyzerDQM_cff.py b/Validation/RecoParticleFlow/python/offsetAnalyzerDQM_cff.py index b7a0ca8669281..b023099028fba 100644 --- a/Validation/RecoParticleFlow/python/offsetAnalyzerDQM_cff.py +++ b/Validation/RecoParticleFlow/python/offsetAnalyzerDQM_cff.py @@ -50,14 +50,14 @@ def createOffsetVPSet(): def createTH1DVPSet(): plots = [] #hname, title, xmax - toplot = ( ("mu", "#mu", default.muHighOffset), ("npv", "N_{PV}", default.npvHighOffset) ) + toplot = ( ("mu", "#mu", 0, default.muHighOffset), ("npv", "N_{PV}", 0, default.npvHighOffset), ("pv_z", "z_{PV}", -default.pvzHighOffset, default.pvzHighOffset) ) - for hname, title, xmax in toplot : + for hname, title, xmin, xmax in toplot : plots += [ plotPSet( hname, hname + ";" + title, default.offsetDir, - xmax, 0, xmax + xmax-xmin, xmin, xmax )] return plots @@ -92,4 +92,3 @@ def createTH1DVPSet(): npvHigh = cms.untracked.int32( default.npvHighOffset ) ) - diff --git a/Validation/RecoParticleFlow/python/particleFlowDQM_cff.py b/Validation/RecoParticleFlow/python/particleFlowDQM_cff.py index 1c1eaa86129a4..787b6e3ec30a7 100644 --- a/Validation/RecoParticleFlow/python/particleFlowDQM_cff.py +++ b/Validation/RecoParticleFlow/python/particleFlowDQM_cff.py @@ -1,6 +1,6 @@ import FWCore.ParameterSet.Config as cms import Validation.RecoParticleFlow.defaults_cfi as default -from Validation.RecoParticleFlow.defaults_cfi import ptbins, etabins, response_distribution_name, genjet_distribution_name,jetResponseDir,genjetDir +from Validation.RecoParticleFlow.defaults_cfi import ptbins, etabins, response_distribution_name, genjet_distribution_name, recojet_distribution_name, jetResponseDir,genjetDir, offsetDir #----- ----- ----- ----- ----- ----- ----- ----- # @@ -34,7 +34,7 @@ def createResponsePlots(ptbins, etabins): response_plots += [make_response_plot_pset( response_distribution_name(iptbin, ietabin), - "Jet response (pT/pTgen) in {0} <= pt < {1}, {2} <= |eta| < {3}".format(ptbins[iptbin], ptbins[iptbin+1], etabins[ietabin], etabins[ietabin+1]), + "Jet response (pT/pTgen) in {0} <= pt < {1}, {2} <= |eta| < {3})".format(ptbins[iptbin], ptbins[iptbin+1], etabins[ietabin], etabins[ietabin+1]), 100, 0.0, 3.0, ptbins[iptbin], ptbins[iptbin+1], etabins[ietabin], etabins[ietabin+1] )] return response_plots @@ -47,7 +47,22 @@ def createGenJetPlots(ptbins, etabins): plots += [ cms.PSet( name = cms.string(genjet_distribution_name(ietabin)), - title = cms.string("GenJet pT ({0} <= |eta| <= {1}".format(eta_low, eta_high)), + title = cms.string("GenJet pT ({0} <= |eta| <= {1})".format(eta_low, eta_high)), + ptBins = cms.vdouble(ptbins), + etaBinLow = cms.double(eta_low), + etaBinHigh = cms.double(eta_high), + )] + return plots + +def createRecoJetPlots(ptbins, etabins): + plots = [] + for ietabin in range(len(etabins)-1): + eta_low = etabins[ietabin] + eta_high = etabins[ietabin + 1] + plots += [ + cms.PSet( + name = cms.string(recojet_distribution_name(ietabin)), + title = cms.string("RecoJet ({0} <= |eta| <= {1})".format(eta_low, eta_high)), ptBins = cms.vdouble(ptbins), etaBinLow = cms.double(eta_low), etaBinHigh = cms.double(eta_high), @@ -70,15 +85,17 @@ def createGenJetPlots(ptbins, etabins): # turn gen jets on or off genJetsOn = cms.bool(True), + recoJetsOn = cms.bool(True), responsePlots = cms.VPSet(createResponsePlots(ptbins, etabins)), - genJetPlots = cms.VPSet(createGenJetPlots(ptbins, etabins)) - + genJetPlots = cms.VPSet(createGenJetPlots(ptbins, etabins)), + recoJetPlots = cms.VPSet(createRecoJetPlots(ptbins, etabins)), ) pfPuppiJetAnalyzerDQM = pfJetAnalyzerDQM.clone( recoJetCollection = 'slimmedJetsPuppi', - genJetsOn = False + genJetsOn = False, + recoJetsOn = True ) vjetResponseDir = [jetResponseDir + "slimmedJets/JEC/", @@ -87,13 +104,12 @@ def createGenJetPlots(ptbins, etabins): jetResponseDir + "slimmedJetsPuppi/noJEC/"] pfJetDQMPostProcessor = cms.EDProducer("PFJetDQMPostProcessor", - jetResponseDir = cms.vstring( vjetResponseDir ), genjetDir = cms.string( genjetDir ), + offsetDir = cms.string( offsetDir ), ptBins = cms.vdouble( ptbins ), etaBins = cms.vdouble( etabins ), - recoPtCut = cms.double( 15. ) - + recoPtCut = cms.double( 10. ) ) diff --git a/Validation/RecoParticleFlow/test/compare.py b/Validation/RecoParticleFlow/test/compare.py index e2830d9e3e276..bb384b14acb0a 100644 --- a/Validation/RecoParticleFlow/test/compare.py +++ b/Validation/RecoParticleFlow/test/compare.py @@ -112,14 +112,30 @@ def parse_args(): JetFolderDirs = ["JetResponse/slimmedJets/JEC", "JetResponse/slimmedJets/noJEC", "JetResponse/slimmedJetsPuppi/JEC", "JetResponse/slimmedJetsPuppi/noJEC"] for JetFolderDir in JetFolderDirs: + plots += [(JetFolderDir, "efficiency_pt", ["efficiency_eta05", "efficiency_eta13", + "efficiency_eta21","efficiency_eta25","efficiency_eta30","efficiency_eta50"])] + plots += [(JetFolderDir, "purity_pt", ["purity_eta05", "purity_eta13", + "purity_eta21","purity_eta25","purity_eta30","purity_eta50"])] + plots += [(JetFolderDir, "ratePUJet_pt", ["ratePUJet_eta05", "ratePUJet_eta13", + "ratePUJet_eta21","ratePUJet_eta25","ratePUJet_eta30","ratePUJet_eta50"])] plots += [(JetFolderDir, "reso_pt", ["preso_eta05", "preso_eta13", "preso_eta21","preso_eta25","preso_eta30","preso_eta50"])] plots += [(JetFolderDir, "reso_pt_rms", ["preso_eta05_rms", - "preso_eta13_rms","preso_eta21_rms","preso_eta25_rms","preso_eta30_rms", - "preso_eta50_rms"])] + "preso_eta13_rms","preso_eta21_rms", + "preso_eta25_rms","preso_eta30_rms", + "preso_eta50_rms"])] plots += [(JetFolderDir, "response_pt", ["presponse_eta05", - "presponse_eta13", "presponse_eta21", "presponse_eta25", "presponse_eta30", - "presponse_eta50"])] + "presponse_eta13", "presponse_eta21", + "presponse_eta25", "presponse_eta30", + "presponse_eta50"])] + plots += [(JetFolderDir, "response_pt_mean", ["presponse_eta05_mean", + "presponse_eta13_mean", "presponse_eta21_mean", + "presponse_eta25_mean", "presponse_eta30_mean", + "presponse_eta50_mean"])] + plots += [(JetFolderDir, "response_pt_median", ["presponse_eta05_median", + "presponse_eta13_median", "presponse_eta21_median", "presponse_eta25_median", + "presponse_eta30_median", "presponse_eta50_median"])] + for iptbin in range(len(ptbins)-1): pthistograms = [] for ietabin in range(len(etabins)-1): @@ -239,10 +255,28 @@ def main(): styledict_response = {"xlog": True, "xgrid":False, "ygrid":False, "xtitle":"GenJet pT (GeV)", "ytitle":"Jet response", "xtitleoffset":7.7,"ytitleoffset":3.8,"adjustMarginLeft":0.00} + + styledict_rate = {"xlog": True, "xgrid":False, "ygrid":False, + "xtitle":"RecoJet pT (GeV)", "ytitle":"PU Jet rate (#PUJets/event)", "stat": True, + "xtitleoffset":7.7,"ytitleoffset":3.8,"adjustMarginLeft":0.00} + + styledict_efficiency = {"xlog": True, "xgrid":False, "ygrid":False, + "xtitle":"GenJet pT (GeV)", "ytitle":"Efficiency", "stat": True, + "xtitleoffset":7.7,"ytitleoffset":3.8,"adjustMarginLeft":0.00} + + styledict_purity = {"xlog": True, "xgrid":False, "ygrid":False, + "xtitle":"RecoJet pT (GeV)", "ytitle":"Purity", "stat": True, + "xtitleoffset":7.7,"ytitleoffset":3.8,"adjustMarginLeft":0.00} + plot_opts = { + "efficiency_pt": styledict_efficiency, + "purity_pt": styledict_purity, + "ratePUJet_pt": styledict_rate, "reso_pt": styledict_resolution, "reso_pt_rms": styledict_resolution, - "response_pt": styledict_response + "response_pt": styledict_response, + "response_pt_mean": styledict_response, + "response_pt_median": styledict_response, } for iptbin in range(len(ptbins)-1): plot_opts["response_{0:.0f}_{1:.0f}".format(ptbins[iptbin], ptbins[iptbin+1])] = {"stat": True}