diff --git a/DQMOffline/Trigger/interface/HLTMuonMatchAndPlot.h b/DQMOffline/Trigger/interface/HLTMuonMatchAndPlot.h index 4f6aecfc84b68..96d8931ec5f5c 100755 --- a/DQMOffline/Trigger/interface/HLTMuonMatchAndPlot.h +++ b/DQMOffline/Trigger/interface/HLTMuonMatchAndPlot.h @@ -67,7 +67,7 @@ class HLTMuonMatchAndPlot const std::vector&); // Analyzer Methods - void beginRun(const edm::Run &, const edm::EventSetup &); + void beginRun(DQMStore::IBooker &, const edm::Run &, const edm::EventSetup &); void analyze(edm::Handle &, edm::Handle &, edm::Handle &, edm::Handle &, edm::Handle &); @@ -84,8 +84,8 @@ class HLTMuonMatchAndPlot private: // Internal Methods - void book1D(std::string, std::string, std::string); - void book2D(std::string, std::string, std::string, std::string); + void book1D(DQMStore::IBooker &, std::string, std::string, std::string); + void book2D(DQMStore::IBooker &, std::string, std::string, std::string, std::string); reco::MuonCollection selectedMuons( const reco::MuonCollection &, const reco::BeamSpot &, @@ -111,7 +111,6 @@ class HLTMuonMatchAndPlot unsigned int cutMinPt_; std::string hltPath_; std::vector moduleLabels_; - DQMStore * dbe_; std::map hists_; // Selectors diff --git a/DQMOffline/Trigger/interface/HLTMuonMatchAndPlotContainer.h b/DQMOffline/Trigger/interface/HLTMuonMatchAndPlotContainer.h index 4df40bd129bb4..b32be639eaf19 100644 --- a/DQMOffline/Trigger/interface/HLTMuonMatchAndPlotContainer.h +++ b/DQMOffline/Trigger/interface/HLTMuonMatchAndPlotContainer.h @@ -57,7 +57,7 @@ class HLTMuonMatchAndPlotContainer const std::vector&); // Analyzer Methods - void beginRun(const edm::Run &, const edm::EventSetup &); + void beginRun(DQMStore::IBooker &, const edm::Run &, const edm::EventSetup &); void analyze(const edm::Event &, const edm::EventSetup &); void endRun(const edm::Run &, const edm::EventSetup &); diff --git a/DQMOffline/Trigger/src/HLTMuonCertSummary.cc b/DQMOffline/Trigger/src/HLTMuonCertSummary.cc index e450cde1ef4c8..01c2834b5845b 100644 --- a/DQMOffline/Trigger/src/HLTMuonCertSummary.cc +++ b/DQMOffline/Trigger/src/HLTMuonCertSummary.cc @@ -34,7 +34,7 @@ // user include files #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "DQMServices/Core/interface/DQMEDHarvester.h" #include "FWCore/Framework/interface/Event.h" @@ -56,24 +56,21 @@ using namespace std; // class decleration // -class HLTMuonCertSummary : public edm::EDAnalyzer { +class HLTMuonCertSummary : public DQMEDHarvester { public: explicit HLTMuonCertSummary(const edm::ParameterSet& pset); ~HLTMuonCertSummary(); - virtual void beginJob() override ; - virtual void analyze(const edm::Event&, const edm::EventSetup&) override; - virtual void endJob() override ; + virtual void beginJob(); virtual void beginRun(const edm::Run&, const edm::EventSetup&) override ; - virtual void endRun(const edm::Run&, const edm::EventSetup&) override ; + virtual void dqmEndJob(DQMStore::IBooker &, DQMStore::IGetter &) override ; private: - DQMStore *dbe_; edm::ParameterSet parameters_; bool verbose_; @@ -88,15 +85,7 @@ HLTMuonCertSummary::HLTMuonCertSummary(const edm::ParameterSet& pset) { using namespace edm; - dbe_ = 0; - dbe_ = edm::Service().operator->(); - if (!dbe_) { - LogInfo ("DQMGenericClient") << "Can't find DQMStore, no results will be saved" - << endl; - } else { - dbe_->setVerbose(0); - } - + parameters_ = pset; verbose_ = parameters_.getUntrackedParameter("verbose", false); @@ -105,37 +94,27 @@ HLTMuonCertSummary::HLTMuonCertSummary(const edm::ParameterSet& pset) } + HLTMuonCertSummary::~HLTMuonCertSummary() { + } + // // member functions // -// ------------ method called to for each event ------------ -void -HLTMuonCertSummary::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) -{ - using namespace edm; - - if(verbose_) LogInfo ("HLTMuonVal") << ">>> Analyze (HLTMuonCertSummary) <<<" << std::endl; - -} - // ------------ method called once each job just before starting event loop ------------ void HLTMuonCertSummary::beginJob() { -} -// ------------ method called once each job just after ending the event loop ------------ -void -HLTMuonCertSummary::endJob() -{ } + + // ------------ method called just before starting a new run ------------ void HLTMuonCertSummary::beginRun(const edm::Run& run, const edm::EventSetup& c) @@ -147,18 +126,15 @@ HLTMuonCertSummary::beginRun(const edm::Run& run, const edm::EventSetup& c) } + + // ------------ method called right after a run ends ------------ void -HLTMuonCertSummary::endRun(const edm::Run& run, const edm::EventSetup& c) +HLTMuonCertSummary::dqmEndJob(DQMStore::IBooker & iBooker, DQMStore::IGetter & iGetter) { - + using namespace edm; if(verbose_) LogInfo ("HLTMuonVal") << ">>> EndRun (HLTMuonCertSummary) <<<" << std::endl; - - if(!dbe_) { - LogInfo ("DQMGenericClient") << "No dqmstore... skipping processing step" << endl; - return; - } std::vector histoNameVector; @@ -167,19 +143,19 @@ HLTMuonCertSummary::endRun(const edm::Run& run, const edm::EventSetup& c) - dbe_->setCurrentFolder("HLT/EventInfo/muonQuality"); + iBooker.setCurrentFolder("HLT/EventInfo/muonQuality"); - MonitorElement* reportSummary = dbe_->bookFloat("HLT_MUON_REPORT_SUMMARY"); + MonitorElement* reportSummary = iBooker.bookFloat("HLT_MUON_REPORT_SUMMARY"); int SummaryBitResult = 100; - MonitorElement* CertificationSummary = dbe_->bookFloat("HLT_MUON_CERTIFICATION_SUMMARY"); + MonitorElement* CertificationSummary = iBooker.bookFloat("HLT_MUON_CERTIFICATION_SUMMARY"); //for now these will hold values from eta/phi tests for spikes/holes - MonitorElement* reportSummaryMap = dbe_->book2D("HLT_MUON_ReportSummaryMap","HLT_MUON: ReportSummaryMap",6,-0.5,5.5,1,-0.5,0.5); - MonitorElement* CertificationSummaryMap = dbe_->book2D("HLT_MUON_CertificationSummaryMap","HLT_MUON: CertificationSummaryMap",6,-0.5,5.5,1,-0.5,0.5); + MonitorElement* reportSummaryMap = iBooker.book2D("HLT_MUON_ReportSummaryMap","HLT_MUON: ReportSummaryMap",6,-0.5,5.5,1,-0.5,0.5); + MonitorElement* CertificationSummaryMap = iBooker.book2D("HLT_MUON_CertificationSummaryMap","HLT_MUON: CertificationSummaryMap",6,-0.5,5.5,1,-0.5,0.5); TH2 * reportSummaryMapTH2 = reportSummaryMap->getTH2F(); @@ -213,7 +189,7 @@ HLTMuonCertSummary::endRun(const edm::Run& run, const edm::EventSetup& c) histoNameVector.push_back("HLT/Muon/Distributions/HLT_Mu5/allMuons/recEffEta_L3Filtered"); // to do: what do we want in certification contents? - // dbe_->setCurrentFolder("Egamma/EventInfo/CertificationContents/"); + // iBooker.setCurrentFolder("Egamma/EventInfo/CertificationContents/"); // //looping over histograms to be tested @@ -227,7 +203,7 @@ HLTMuonCertSummary::endRun(const edm::Run& run, const edm::EventSetup& c) MonitorElement * TestHist=0; - TestHist = dbe_->get(HistoName); + TestHist = iGetter.get(HistoName); bool validMe = TestHist!=0; if(verbose_) LogInfo ("HLTMuonVal") << " is valid? " << validMe << "\n"; @@ -254,8 +230,8 @@ HLTMuonCertSummary::endRun(const edm::Run& run, const edm::EventSetup& c) //book and fill float for each test done - dbe_->setCurrentFolder("HLT/EventInfo/muonQuality/"); - MonitorElement * qValueInt = dbe_->bookFloat(histNameNoPath+"_HLT_Mu5_"+qtname); + iBooker.setCurrentFolder("HLT/EventInfo/muonQuality/"); + MonitorElement * qValueInt = iBooker.bookFloat(histNameNoPath+"_HLT_Mu5_"+qtname); qValueInt->Fill(qtstatus); // We're assuming that you want all of the bits to go into the decision @@ -311,18 +287,17 @@ HLTMuonCertSummary::endRun(const edm::Run& run, const edm::EventSetup& c) // Set the final bits - dbe_->setCurrentFolder("HLT/EventInfo/reportSummaryContents"); - MonitorElement* muonHLTQualityBinaryBit = dbe_->bookFloat ("HLT_Muon"); + iBooker.setCurrentFolder("HLT/EventInfo/reportSummaryContents"); + MonitorElement* muonHLTQualityBinaryBit = iBooker.bookFloat ("HLT_Muon"); if (SummaryBitResult == 100){ muonHLTQualityBinaryBit->Fill(1); } else { muonHLTQualityBinaryBit->Fill(0); - } - - + } } + DEFINE_FWK_MODULE(HLTMuonCertSummary); diff --git a/DQMOffline/Trigger/src/HLTMuonMatchAndPlot.cc b/DQMOffline/Trigger/src/HLTMuonMatchAndPlot.cc index c528ed51c7698..5e3c9bd69f145 100644 --- a/DQMOffline/Trigger/src/HLTMuonMatchAndPlot.cc +++ b/DQMOffline/Trigger/src/HLTMuonMatchAndPlot.cc @@ -55,10 +55,6 @@ HLTMuonMatchAndPlot::HLTMuonMatchAndPlot(const ParameterSet & pset, fillMapFromPSet(binParams_, pset, "binParams"); fillMapFromPSet(plotCuts_, pset, "plotCuts"); - // Prepare the DQMStore object. - dbe_ = edm::Service().operator->(); - dbe_->setVerbose(0); - // Get the trigger level. triggerLevel_ = "L3"; TPRegexp levelRegexp("L[1-3]"); @@ -82,7 +78,8 @@ HLTMuonMatchAndPlot::HLTMuonMatchAndPlot(const ParameterSet & pset, } -void HLTMuonMatchAndPlot::beginRun(const edm::Run& iRun, +void HLTMuonMatchAndPlot::beginRun(DQMStore::IBooker & iBooker, + const edm::Run& iRun, const edm::EventSetup& iSetup) { @@ -93,45 +90,45 @@ void HLTMuonMatchAndPlot::beginRun(const edm::Run& iRun, string pathSansSuffix = hltPath_; if (hltPath_.rfind("_v") < hltPath_.length()) pathSansSuffix = hltPath_.substr(0, hltPath_.rfind("_v")); - dbe_->setCurrentFolder(baseDir + pathSansSuffix); + iBooker.setCurrentFolder(baseDir + pathSansSuffix); // Form is book1D(name, binningType, title) where 'binningType' is used // to fetch the bin settings from binParams_. - book1D("deltaR", "deltaR", ";#Deltar(reco, HLT);"); - book1D("hltPt", "pt", ";p_{T} of HLT object"); - book1D("hltEta", "eta", ";#eta of HLT object"); - book1D("hltPhi", "phi", ";#phi of HLT object"); - book1D("resolutionEta", "resolutionEta", ";#eta^{reco}-#eta^{HLT};"); - book1D("resolutionPhi", "resolutionPhi", ";#phi^{reco}-#phi^{HLT};"); - book1D("resolutionPt", "resolutionRel", + book1D(iBooker, "deltaR", "deltaR", ";#Deltar(reco, HLT);"); + book1D(iBooker, "hltPt", "pt", ";p_{T} of HLT object"); + book1D(iBooker, "hltEta", "eta", ";#eta of HLT object"); + book1D(iBooker, "hltPhi", "phi", ";#phi of HLT object"); + book1D(iBooker, "resolutionEta", "resolutionEta", ";#eta^{reco}-#eta^{HLT};"); + book1D(iBooker, "resolutionPhi", "resolutionPhi", ";#phi^{reco}-#phi^{HLT};"); + book1D(iBooker, "resolutionPt", "resolutionRel", ";(p_{T}^{reco}-p_{T}^{HLT})/|p_{T}^{reco}|;"); for (size_t i = 0; i < 2; i++) { string suffix = EFFICIENCY_SUFFIXES[i]; - book1D("efficiencyEta_" + suffix, "eta", ";#eta;"); - book1D("efficiencyPhi_" + suffix, "phi", ";#phi;"); - book1D("efficiencyTurnOn_" + suffix, "pt", ";p_{T};"); - book1D("efficiencyD0_" + suffix, "d0", ";d0;"); - book1D("efficiencyZ0_" + suffix, "z0", ";z0;"); - book1D("efficiencyCharge_" + suffix, "charge", ";charge;"); - book1D("efficiencyVertex_" + suffix, "NVertex", ";NVertex;"); - - book2D("efficiencyPhiVsEta_" + suffix, "etaCoarse", "phiCoarse", - ";#eta;#phi"); - - book1D("fakerateEta_" + suffix, "eta", ";#eta;"); - book1D("fakerateVertex_" + suffix, "NVertex", ";NVertex;"); - book1D("fakeratePhi_" + suffix, "phi", ";#phi;"); - book1D("fakerateTurnOn_" + suffix, "pt", ";p_{T};"); - - book1D("massVsEtaZ_" + suffix, "etaCoarse", ";#eta"); - book1D("massVsEtaJpsi_" + suffix, "etaCoarse", ";#eta"); - book1D("massVsPtZ_" + suffix, "ptCoarse", ";p_{T}"); - book1D("massVsPtJpsi_" + suffix, "ptCoarse", ";p_{T}"); - book1D("massVsVertexZ_" + suffix, "NVertex", ";NVertex"); - book1D("massVsVertexJpsi_" + suffix, "NVertex", ";NVertex"); + book1D(iBooker, "efficiencyEta_" + suffix, "eta", ";#eta;"); + book1D(iBooker, "efficiencyPhi_" + suffix, "phi", ";#phi;"); + book1D(iBooker, "efficiencyTurnOn_" + suffix, "pt", ";p_{T};"); + book1D(iBooker, "efficiencyD0_" + suffix, "d0", ";d0;"); + book1D(iBooker, "efficiencyZ0_" + suffix, "z0", ";z0;"); + book1D(iBooker, "efficiencyCharge_" + suffix, "charge", ";charge;"); + book1D(iBooker, "efficiencyVertex_" + suffix, "NVertex", ";NVertex;"); + + book2D(iBooker, "efficiencyPhiVsEta_" + suffix, "etaCoarse", + "phiCoarse", ";#eta;#phi"); + + book1D(iBooker, "fakerateEta_" + suffix, "eta", ";#eta;"); + book1D(iBooker, "fakerateVertex_" + suffix, "NVertex", ";NVertex;"); + book1D(iBooker, "fakeratePhi_" + suffix, "phi", ";#phi;"); + book1D(iBooker, "fakerateTurnOn_" + suffix, "pt", ";p_{T};"); + + book1D(iBooker, "massVsEtaZ_" + suffix, "etaCoarse", ";#eta"); + book1D(iBooker, "massVsEtaJpsi_" + suffix, "etaCoarse", ";#eta"); + book1D(iBooker, "massVsPtZ_" + suffix, "ptCoarse", ";p_{T}"); + book1D(iBooker, "massVsPtJpsi_" + suffix, "ptCoarse", ";p_{T}"); + book1D(iBooker, "massVsVertexZ_" + suffix, "NVertex", ";NVertex"); + book1D(iBooker, "massVsVertexJpsi_" + suffix, "NVertex", ";NVertex"); } @@ -509,7 +506,8 @@ HLTMuonMatchAndPlot::selectedTriggerObjects( -void HLTMuonMatchAndPlot::book1D(string name, string binningType, string title) +void HLTMuonMatchAndPlot::book1D(DQMStore::IBooker & iBooker, string name, + string binningType, string title) { /* Properly delete the array of floats that has been allocated on @@ -522,7 +520,7 @@ void HLTMuonMatchAndPlot::book1D(string name, string binningType, string title) float * edges = 0; fillEdges(nBins, edges, binParams_[binningType]); - hists_[name] = dbe_->book1D(name, title, nBins, edges); + hists_[name] = iBooker.book1D(name, title, nBins, edges); if (hists_[name]) if (hists_[name]->getTH1F()->GetSumw2N()) hists_[name]->getTH1F()->Sumw2(); @@ -535,8 +533,9 @@ void HLTMuonMatchAndPlot::book1D(string name, string binningType, string title) void -HLTMuonMatchAndPlot::book2D(string name, string binningTypeX, - string binningTypeY, string title) +HLTMuonMatchAndPlot::book2D(DQMStore::IBooker & iBooker, string name, + string binningTypeX, string binningTypeY, + string title) { /* Properly delete the arrays of floats that have been allocated on @@ -553,8 +552,8 @@ HLTMuonMatchAndPlot::book2D(string name, string binningTypeX, float * edgesY = 0; fillEdges(nBinsY, edgesY, binParams_[binningTypeY]); - hists_[name] = dbe_->book2D(name.c_str(), title.c_str(), - nBinsX, edgesX, nBinsY, edgesY); + hists_[name] = iBooker.book2D(name.c_str(), title.c_str(), + nBinsX, edgesX, nBinsY, edgesY); if (hists_[name]) if (hists_[name]->getTH2F()->GetSumw2N()) hists_[name]->getTH2F()->Sumw2(); diff --git a/DQMOffline/Trigger/src/HLTMuonMatchAndPlotContainer.cc b/DQMOffline/Trigger/src/HLTMuonMatchAndPlotContainer.cc index 834e2ecb3a610..f3ad57dada175 100644 --- a/DQMOffline/Trigger/src/HLTMuonMatchAndPlotContainer.cc +++ b/DQMOffline/Trigger/src/HLTMuonMatchAndPlotContainer.cc @@ -50,7 +50,8 @@ void HLTMuonMatchAndPlotContainer::addPlotter(const edm::ParameterSet &pset , st } -void HLTMuonMatchAndPlotContainer::beginRun(const edm::Run & iRun, +void HLTMuonMatchAndPlotContainer::beginRun(DQMStore::IBooker & iBooker, + const edm::Run & iRun, const edm::EventSetup & iSetup) { @@ -59,7 +60,7 @@ void HLTMuonMatchAndPlotContainer::beginRun(const edm::Run & iRun, for (; iter != end; ++iter) { - iter->beginRun(iRun, iSetup); + iter->beginRun(iBooker, iRun, iSetup); } } diff --git a/DQMOffline/Trigger/src/HLTMuonOfflineAnalyzer.cc b/DQMOffline/Trigger/src/HLTMuonOfflineAnalyzer.cc index 53a9aaa3dd17b..b261d25fe5869 100644 --- a/DQMOffline/Trigger/src/HLTMuonOfflineAnalyzer.cc +++ b/DQMOffline/Trigger/src/HLTMuonOfflineAnalyzer.cc @@ -19,7 +19,7 @@ #include "DQMServices/Core/interface/DQMStore.h" #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "DQMServices/Core/interface/DQMEDAnalyzer.h" #include "FWCore/Framework/interface/ConsumesCollector.h" #include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" @@ -40,7 +40,7 @@ -class HLTMuonOfflineAnalyzer : public edm::EDAnalyzer { +class HLTMuonOfflineAnalyzer : public DQMEDAnalyzer { public: @@ -49,11 +49,12 @@ class HLTMuonOfflineAnalyzer : public edm::EDAnalyzer { private: // Analyzer Methods - virtual void beginJob() override; - virtual void beginRun(const edm::Run &, const edm::EventSetup &) override; + virtual void beginJob(); + virtual void dqmBeginRun(const edm::Run &, const edm::EventSetup &) override; + virtual void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override; virtual void analyze(const edm::Event &, const edm::EventSetup &) override; virtual void endRun(const edm::Run &, const edm::EventSetup &) override; - virtual void endJob() override; + virtual void endJob(); // Extra Methods std::vector moduleLabels(std::string); @@ -61,16 +62,12 @@ class HLTMuonOfflineAnalyzer : public edm::EDAnalyzer { // Input from Configuration File edm::ParameterSet pset_; std::string hltProcessName_; - std::string destination_; std::vector hltPathsToCheck_; // Member Variables HLTMuonMatchAndPlotContainer plotterContainer_; HLTConfigProvider hltConfig_; - // Access to the DQM - DQMStore * dbe_; - }; @@ -93,16 +90,10 @@ typedef vector vstring; HLTMuonOfflineAnalyzer::HLTMuonOfflineAnalyzer(const ParameterSet& pset) : pset_(pset), hltProcessName_(pset.getParameter("hltProcessName")), - destination_(pset.getUntrackedParameter("destination")), hltPathsToCheck_(pset.getParameter("hltPathsToCheck")), plotterContainer_(consumesCollector(),pset) { - // Prepare the DQMStore object. - dbe_ = edm::Service().operator->(); - dbe_->setVerbose(0); - dbe_->setCurrentFolder(destination_); - } @@ -127,8 +118,8 @@ HLTMuonOfflineAnalyzer::moduleLabels(string path) void -HLTMuonOfflineAnalyzer::beginRun(const edm::Run & iRun, - const edm::EventSetup & iSetup) +HLTMuonOfflineAnalyzer::dqmBeginRun(const edm::Run & iRun, + const edm::EventSetup & iSetup) { // Initialize hltConfig @@ -157,10 +148,21 @@ HLTMuonOfflineAnalyzer::beginRun(const edm::Run & iRun, } } - plotterContainer_.beginRun(iRun, iSetup); +} + + + +void +HLTMuonOfflineAnalyzer::bookHistograms(DQMStore::IBooker & iBooker, + edm::Run const & iRun, edm::EventSetup const & iSetup) +{ + + plotterContainer_.beginRun(iBooker, iRun, iSetup); } + + void HLTMuonOfflineAnalyzer::analyze(const Event& iEvent, const EventSetup& iSetup) diff --git a/HLTriggerOffline/Muon/interface/HLTMuonPlotter.h b/HLTriggerOffline/Muon/interface/HLTMuonPlotter.h index 6eb43ecd75205..38e5378359687 100755 --- a/HLTriggerOffline/Muon/interface/HLTMuonPlotter.h +++ b/HLTriggerOffline/Muon/interface/HLTMuonPlotter.h @@ -67,7 +67,7 @@ class HLTMuonPlotter { ); void beginJob(); - void beginRun(const edm::Run &, const edm::EventSetup &); + void beginRun(DQMStore::IBooker &, const edm::Run &, const edm::EventSetup &); void analyze(const edm::Event &, const edm::EventSetup &); static boost::tuple< @@ -111,7 +111,8 @@ class HLTMuonPlotter { const std::vector&, const std::vector< std::vector< const reco::RecoChargedCandidate *> >& ); - void bookHist(std::string, std::string, std::string, std::string); + void bookHist(DQMStore::IBooker &, std::string, + std::string, std::string, std::string); std::string hltPath_; std::string hltProcessName_; @@ -139,7 +140,6 @@ class HLTMuonPlotter { L1MuonMatcherAlgo l1Matcher_; - DQMStore* dbe_; std::map elements_; }; diff --git a/HLTriggerOffline/Muon/interface/HLTMuonValidator.h b/HLTriggerOffline/Muon/interface/HLTMuonValidator.h deleted file mode 100755 index 183c7a69f8047..0000000000000 --- a/HLTriggerOffline/Muon/interface/HLTMuonValidator.h +++ /dev/null @@ -1,142 +0,0 @@ -#ifndef HLTriggerOffline_Muon_HLTMuonValidator_H -#define HLTriggerOffline_Muon_HLTMuonValidator_H - -/** \class HLTMuonValidator - * Generate histograms for muon trigger efficiencies - * Documentation available on the CMS TWiki: - * https://twiki.cern.ch/twiki/bin/view/CMS/MuonHLTOfflinePerformance - * - * \author J. Klukas, M. Vander Donckt, J. Alcaraz - */ - -#include "HLTriggerOffline/Muon/interface/L1MuonMatcherAlgo.h" - -#include "FWCore/Framework/interface/EDAnalyzer.h" -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/MakerMacros.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "FWCore/Utilities/interface/InputTag.h" - -#include "DataFormats/Common/interface/RefToBase.h" -#include "DataFormats/TrackReco/interface/Track.h" -#include "DataFormats/Candidate/interface/Particle.h" -#include "DataFormats/Candidate/interface/Candidate.h" -#include "DataFormats/HepMCCandidate/interface/GenParticle.h" -#include "DataFormats/L1Trigger/interface/L1MuonParticle.h" -#include "DataFormats/L1Trigger/interface/L1MuonParticleFwd.h" -#include "DataFormats/RecoCandidate/interface/RecoChargedCandidate.h" -#include "DataFormats/RecoCandidate/interface/RecoChargedCandidateFwd.h" -#include "DataFormats/HLTReco/interface/TriggerEventWithRefs.h" -#include "DataFormats/HLTReco/interface/TriggerEvent.h" -#include "DataFormats/MuonReco/interface/Muon.h" -#include "DataFormats/MuonReco/interface/MuonFwd.h" - -#include "HLTrigger/HLTcore/interface/HLTConfigProvider.h" - -#include "CommonTools/Utils/interface/StringCutObjectSelector.h" - -#include "DQMServices/Core/interface/DQMStore.h" -#include "DQMServices/Core/interface/MonitorElement.h" - - -#include -#include -#include -#include -#include -#include - -#include "TPRegexp.h" - - - -const unsigned int kNull = (unsigned int) -1; - - - -class HLTMuonValidator : public edm::EDAnalyzer { - - public: - HLTMuonValidator(const edm::ParameterSet &); - virtual void beginJob(); - virtual void beginRun(const edm::Run &, const edm::EventSetup &); - virtual void analyze(const edm::Event &, const edm::EventSetup &); - - private: - - struct MatchStruct { - const reco::Candidate * candBase; - const l1extra::L1MuonParticle * candL1; - std::vector candHlt; - MatchStruct() { - candBase = 0; - candL1 = 0; - } - MatchStruct(const reco::Candidate * cand) { - candBase = cand; - candL1 = 0; - } - bool operator<(MatchStruct match) { - return candBase->pt() < match.candBase->pt(); - } - bool operator>(MatchStruct match) { - return candBase->pt() > match.candBase->pt(); - } - }; - struct matchesByDescendingPt { - bool operator() (MatchStruct a, MatchStruct b) { - return a.candBase->pt() > b.candBase->pt(); - } - }; - - void initializeHists(); - void analyzePath(const edm::Event &, - const std::string &, const std::string &, - const std::vector&, - edm::Handle); - void findMatches( - std::vector &, - std::vector, - std::vector< std::vector< const reco::RecoChargedCandidate *> > - ); - void bookHist(std::string, std::string, std::string, std::string); - - std::string hltProcessName_; - - std::vector hltPathsToCheck_; - std::set hltPaths_; - std::map > filterLabels_; - - std::string genParticleLabel_; - std::string recMuonLabel_; - std::string l1CandLabel_; - std::string l2CandLabel_; - std::string l3CandLabel_; - - std::vector parametersEta_; - std::vector parametersPhi_; - std::vector parametersTurnOn_; - - std::map cutsMinPt_; - - double cutMaxEta_; - unsigned int cutMotherId_; - std::vector cutsDr_; - std::string genMuonCut_; - std::string recMuonCut_; - - StringCutObjectSelector * genMuonSelector_; - StringCutObjectSelector * recMuonSelector_; - - HLTConfigProvider hltConfig_; - - L1MuonMatcherAlgo l1Matcher_; - - DQMStore* dbe_; - std::map elements_; - std::map > stepLabels_; - -}; - -#endif diff --git a/HLTriggerOffline/Muon/src/HLTMuonPlotter.cc b/HLTriggerOffline/Muon/src/HLTMuonPlotter.cc index 95f91596c5428..abfaeff69027f 100644 --- a/HLTriggerOffline/Muon/src/HLTMuonPlotter.cc +++ b/HLTriggerOffline/Muon/src/HLTMuonPlotter.cc @@ -62,9 +62,6 @@ HLTMuonPlotter::HLTMuonPlotter(const ParameterSet & pset, genMuonSelector_ = 0; recMuonSelector_ = 0; - dbe_ = Service().operator->(); - dbe_->setVerbose(0); - //set tokens hltTriggerSummaryRAW_ = tokens.get<0>(); genParticleLabel_ = tokens.get<1>(); @@ -77,12 +74,14 @@ HLTMuonPlotter::HLTMuonPlotter(const ParameterSet & pset, void HLTMuonPlotter::beginJob() { + } void -HLTMuonPlotter::beginRun(const Run & iRun, const EventSetup & iSetup) +HLTMuonPlotter::beginRun(DQMStore::IBooker & iBooker, + const Run & iRun, const EventSetup & iSetup) { static int runNumber = 0; @@ -109,28 +108,25 @@ HLTMuonPlotter::beginRun(const Run & iRun, const EventSetup & iSetup) if (cutMinPt_ < 0.) cutMinPt_ = 0.; string baseDir = "HLT/Muon/Distributions/"; - dbe_->setCurrentFolder(baseDir + hltPath_); + iBooker.setCurrentFolder(baseDir + hltPath_); vector sources(2); sources[0] = "gen"; sources[1] = "rec"; - if (dbe_->get(baseDir + hltPath_ + "/CutMinPt") == 0) { - - elements_["CutMinPt" ] = dbe_->bookFloat("CutMinPt" ); - elements_["CutMaxEta"] = dbe_->bookFloat("CutMaxEta"); - elements_["CutMinPt" ]->Fill(cutMinPt_); - elements_["CutMaxEta"]->Fill(cutMaxEta_); - - for (size_t i = 0; i < sources.size(); i++) { - string source = sources[i]; - for (size_t j = 0; j < stepLabels_.size(); j++) { - bookHist(hltPath_, stepLabels_[j], source, "Eta"); - bookHist(hltPath_, stepLabels_[j], source, "Phi"); - bookHist(hltPath_, stepLabels_[j], source, "MaxPt1"); - bookHist(hltPath_, stepLabels_[j], source, "MaxPt2"); - } - } + elements_["CutMinPt" ] = iBooker.bookFloat("CutMinPt" ); + elements_["CutMaxEta"] = iBooker.bookFloat("CutMaxEta"); + elements_["CutMinPt" ]->Fill(cutMinPt_); + elements_["CutMaxEta"]->Fill(cutMaxEta_); + + for (size_t i = 0; i < sources.size(); i++) { + string source = sources[i]; + for (size_t j = 0; j < stepLabels_.size(); j++) { + bookHist(iBooker, hltPath_, stepLabels_[j], source, "Eta"); + bookHist(iBooker, hltPath_, stepLabels_[j], source, "Phi"); + bookHist(iBooker, hltPath_, stepLabels_[j], source, "MaxPt1"); + bookHist(iBooker, hltPath_, stepLabels_[j], source, "MaxPt2"); + } } } @@ -395,7 +391,8 @@ HLTMuonPlotter::findMatches( void -HLTMuonPlotter::bookHist(string path, string label, +HLTMuonPlotter::bookHist(DQMStore::IBooker & iBooker, + string path, string label, string source, string type) { @@ -426,7 +423,7 @@ HLTMuonPlotter::bookHist(string path, string label, } h->Sumw2(); - elements_[name] = dbe_->book1D(name, h); + elements_[name] = iBooker.book1D(name, h); delete h; } diff --git a/HLTriggerOffline/Muon/src/HLTMuonValidator.cc b/HLTriggerOffline/Muon/src/HLTMuonValidator.cc index 1e90f9eef8b6a..1b1cf0f3289c1 100644 --- a/HLTriggerOffline/Muon/src/HLTMuonValidator.cc +++ b/HLTriggerOffline/Muon/src/HLTMuonValidator.cc @@ -17,7 +17,7 @@ #include "HLTriggerOffline/Muon/interface/HLTMuonPlotter.h" #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "DQMServices/Core/interface/DQMEDAnalyzer.h" #include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" @@ -39,7 +39,7 @@ -class HLTMuonValidator : public edm::EDAnalyzer { +class HLTMuonValidator : public DQMEDAnalyzer { public: @@ -48,11 +48,12 @@ class HLTMuonValidator : public edm::EDAnalyzer { private: // Analyzer Methods - virtual void beginJob() override; - virtual void beginRun(const edm::Run &, const edm::EventSetup &) override; + virtual void beginJob(); + virtual void dqmBeginRun(const edm::Run &, const edm::EventSetup &) override; + virtual void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override; virtual void analyze(const edm::Event &, const edm::EventSetup &) override; virtual void endRun(const edm::Run &, const edm::EventSetup &) override; - virtual void endJob() override; + virtual void endJob(); // Extra Methods std::vector moduleLabels(std::string); @@ -71,9 +72,6 @@ class HLTMuonValidator : public edm::EDAnalyzer { edm::EDGetTokenT, edm::EDGetTokenT > myTokens_; - // Access to the DQM - DQMStore * dbe_; - }; @@ -121,6 +119,8 @@ HLTMuonValidator::moduleLabels(string path) { } + + vector HLTMuonValidator::stepLabels(const vector& modules) { vector steps(1, "All"); @@ -147,9 +147,10 @@ HLTMuonValidator::stepLabels(const vector& modules) { } + void -HLTMuonValidator::beginRun(const edm::Run & iRun, - const edm::EventSetup & iSetup) +HLTMuonValidator::dqmBeginRun(const edm::Run & iRun, + const edm::EventSetup & iSetup) { // Initialize hltConfig bool changedConfig; @@ -185,25 +186,36 @@ HLTMuonValidator::beginRun(const edm::Run & iRun, analyzers_.push_back(analyzer); } } - + +} + + + +void HLTMuonValidator::bookHistograms(DQMStore::IBooker & iBooker, + edm::Run const & iRun, + edm::EventSetup const & iSetup) +{ + // Call the beginRun (which books all the histograms) vector::iterator iter; for (iter = analyzers_.begin(); iter != analyzers_.end(); ++iter) { - iter->beginRun(iRun, iSetup); + iter->beginRun(iBooker, iRun, iSetup); } } + + void HLTMuonValidator::analyze(const Event& iEvent, - const EventSetup& iSetup) + const EventSetup& iSetup) { - + vector::iterator iter; for (iter = analyzers_.begin(); iter != analyzers_.end(); ++iter) { iter->analyze(iEvent, iSetup); } - + } @@ -211,13 +223,14 @@ HLTMuonValidator::analyze(const Event& iEvent, void HLTMuonValidator::beginJob() { + } void HLTMuonValidator::endRun(const edm::Run & iRun, - const edm::EventSetup& iSetup) + const edm::EventSetup& iSetup) { // vector::iterator iter; @@ -232,6 +245,7 @@ HLTMuonValidator::endRun(const edm::Run & iRun, void HLTMuonValidator::endJob() { + }