diff --git a/HLTriggerOffline/Egamma/interface/EmDQM.h b/HLTriggerOffline/Egamma/interface/EmDQM.h index 74334cd8bf4ee..936de951e6728 100644 --- a/HLTriggerOffline/Egamma/interface/EmDQM.h +++ b/HLTriggerOffline/Egamma/interface/EmDQM.h @@ -15,6 +15,7 @@ #include "DataFormats/Common/interface/RefToBase.h" #include "DQMServices/Core/interface/DQMStore.h" #include "DQMServices/Core/interface/MonitorElement.h" +#include "DQMServices/Core/interface/DQMEDAnalyzer.h" #include "DataFormats/Common/interface/Handle.h" #include "DataFormats/Common/interface/TriggerResults.h" #include "DataFormats/HLTReco/interface/TriggerEventWithRefs.h" @@ -59,7 +60,7 @@ class HistoFiller { EmDQM* dqm; }; -class EmDQM : public edm::EDAnalyzer{ +class EmDQM : public DQMEDAnalyzer{ public: friend class HistoFiller; @@ -78,12 +79,12 @@ class EmDQM : public edm::EDAnalyzer{ void beginJob(); void endJob(); - void beginRun(edm::Run const&, edm::EventSetup const&); + void dqmBeginRun(edm::Run const&, edm::EventSetup const&); + void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override; void endRun(edm::Run const&, edm::EventSetup const&); private: // interface to DQM framework - DQMStore * dbe; std::string dirname_; HistoFiller* histoFillerEle; diff --git a/HLTriggerOffline/Egamma/interface/EmDQMReco.h b/HLTriggerOffline/Egamma/interface/EmDQMReco.h index 32b442fa9a986..fd60f150d57f0 100644 --- a/HLTriggerOffline/Egamma/interface/EmDQMReco.h +++ b/HLTriggerOffline/Egamma/interface/EmDQMReco.h @@ -13,6 +13,7 @@ #include "DataFormats/Common/interface/RefToBase.h" #include "DQMServices/Core/interface/DQMStore.h" #include "DQMServices/Core/interface/MonitorElement.h" +#include "DQMServices/Core/interface/DQMEDAnalyzer.h" #include "DataFormats/HepMCCandidate/interface/GenParticle.h" #include "DataFormats/EgammaCandidates/interface/GsfElectron.h" #include @@ -39,7 +40,7 @@ class HistoFillerReco { EmDQMReco* dqm; }; -class EmDQMReco : public edm::EDAnalyzer{ +class EmDQMReco : public DQMEDAnalyzer{ //---------------------------------------- @@ -57,6 +58,7 @@ class EmDQMReco : public edm::EDAnalyzer{ * for the histogram TITLE where the first %s is replaced with et,eta or phi. */ FourVectorMonitorElements(EmDQMReco *_parent, + DQMStore::IBooker &iBooker, const std::string &histogramNameTemplate, const std::string &histogramTitleTemplate); @@ -91,7 +93,8 @@ class EmDQMReco : public edm::EDAnalyzer{ void analyze(const edm::Event & event, const edm::EventSetup&); void beginJob(); void endJob(); - void beginRun( const edm::Run&, const edm::EventSetup& ); + void dqmBeginRun( const edm::Run&, const edm::EventSetup& ); + void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override; private: // Input from cfg file @@ -222,7 +225,6 @@ class EmDQMReco : public edm::EDAnalyzer{ // int prescale; // interface to DQM framework - DQMStore * dbe; std::string dirname_; HistoFillerReco* histoFillerEle; diff --git a/HLTriggerOffline/Egamma/src/EmDQM.cc b/HLTriggerOffline/Egamma/src/EmDQM.cc index 1ba94798a27ed..472c2ce0991ad 100644 --- a/HLTriggerOffline/Egamma/src/EmDQM.cc +++ b/HLTriggerOffline/Egamma/src/EmDQM.cc @@ -11,10 +11,6 @@ using namespace ROOT::Math::VectorUtil ; //////////////////////////////////////////////////////////////////////////////// EmDQM::EmDQM(const edm::ParameterSet& pset_) : pset(pset_) { - - dbe = edm::Service().operator->(); - dbe->setVerbose(0); - // are we running in automatic configuration mode with the HLTConfigProvider // or with a per path python config file autoConfMode_ = pset.getUntrackedParameter("autoConfMode", false); @@ -72,7 +68,7 @@ EmDQM::beginJob() } void -EmDQM::beginRun(edm::Run const &iRun, edm::EventSetup const &iSetup) +EmDQM::dqmBeginRun(edm::Run const &iRun, edm::EventSetup const &iSetup) { bool changed(true); if (hltConfig_.init(iRun, iSetup, triggerObject_.process(), changed)) { @@ -298,191 +294,13 @@ EmDQM::beginRun(edm::Run const &iRun, edm::EventSetup const &iSetup) hltCollectionLabelsFoundPerPath.reserve(paramSets.size()); hltCollectionLabelsMissedPerPath.reserve(paramSets.size()); + //////////////////////////////////////////////////////////// // loop over all the trigger path parameter sets //////////////////////////////////////////////////////////// for (std::vector::iterator psetIt = paramSets.begin(); psetIt != paramSets.end(); ++psetIt) { - SetVarsFromPSet(psetIt); hltCollectionLabelsFoundPerPath.push_back(hltCollectionLabelsFound); hltCollectionLabelsMissedPerPath.push_back(hltCollectionLabelsMissed); - - // if init returns TRUE, initialisation has succeeded! - - //edm::Service fs; - dbe->setCurrentFolder(dirname_); - - //////////////////////////////////////////////////////////// - // Set up Histogram of Effiency vs Step. // - // theHLTCollectionLabels is a vector of InputTags // - // from the configuration file. // - //////////////////////////////////////////////////////////// - // Et & eta distributions - std::vector etahist; - std::vector phihist; - std::vector ethist; - std::vector etahistmatch; - std::vector phihistmatch; - std::vector ethistmatch; - std::vector histEtOfHltObjMatchToGen; - std::vector histEtaOfHltObjMatchToGen; - std::vector histPhiOfHltObjMatchToGen; - // Plots of efficiency per step - MonitorElement* total; - MonitorElement* totalmatch; - //generator histograms - MonitorElement* etgen; - MonitorElement* etagen; - MonitorElement* phigen; - - std::string histName="total_eff"; - std::string histTitle = "total events passing"; - if (!mcMatchedOnly_) { - // This plot will have bins equal to 2+(number of - // HLTCollectionLabels in the config file) - total = dbe->book1D(histName.c_str(),histTitle.c_str(),numOfHLTCollectionLabels+2,0,numOfHLTCollectionLabels+2); - total->setBinLabel(numOfHLTCollectionLabels+1,"Total"); - total->setBinLabel(numOfHLTCollectionLabels+2,"Gen"); - for (unsigned int u=0; usetBinLabel(u+1,theHLTCollectionLabels[u].label().c_str());} - } - - histName="total_eff_MC_matched"; - histTitle="total events passing (mc matched)"; - totalmatch = dbe->book1D(histName.c_str(),histTitle.c_str(),numOfHLTCollectionLabels+2,0,numOfHLTCollectionLabels+2); - totalmatch->setBinLabel(numOfHLTCollectionLabels+1,"Total"); - totalmatch->setBinLabel(numOfHLTCollectionLabels+2,"Gen"); - for (unsigned int u=0; usetBinLabel(u+1,theHLTCollectionLabels[u].label().c_str());} - - MonitorElement* tmphisto; - //MonitorElement* tmpiso; - - //////////////////////////////////////////////////////////// - // Set up generator-level histograms // - //////////////////////////////////////////////////////////// - std::string pdgIdString; - switch(pdgGen) { - case 11: - pdgIdString="Electron";break; - case 22: - pdgIdString="Photon";break; - default: - pdgIdString="Particle"; - } - - histName = "gen_et"; - histTitle= "E_{T} of " + pdgIdString + "s" ; - etgen = dbe->book1D(histName.c_str(),histTitle.c_str(),nbins_,plotPtMin,plotPtMax); - histName = "gen_eta"; - histTitle= "#eta of "+ pdgIdString +"s " ; - etagen = dbe->book1D(histName.c_str(),histTitle.c_str(),nbins_,-etaMax_, etaMax_); - histName = "gen_phi"; - histTitle= "#phi of "+ pdgIdString +"s " ; - if (!noPhiPlots_) phigen = dbe->book1D(histName.c_str(),histTitle.c_str(),nbins_,-phiMax_, phiMax_); - - //////////////////////////////////////////////////////////// - // Set up histograms of HLT objects // - //////////////////////////////////////////////////////////// - // Determine what strings to use for histogram titles - std::vector HltHistTitle; - if ( theHLTCollectionHumanNames.size() == numOfHLTCollectionLabels && useHumanReadableHistTitles_ ) { - HltHistTitle = theHLTCollectionHumanNames; - } else { - for (unsigned int i =0; i < numOfHLTCollectionLabels; i++) { - HltHistTitle.push_back(theHLTCollectionLabels[i].label()); - } - } - - for(unsigned int i = 0; i< numOfHLTCollectionLabels ; i++){ - if (!mcMatchedOnly_) { - // Et distribution of HLT objects passing filter i - histName = theHLTCollectionLabels[i].label()+"et_all"; - histTitle = HltHistTitle[i]+" Et (ALL)"; - tmphisto = dbe->book1D(histName.c_str(),histTitle.c_str(),nbins_,plotPtMin,plotPtMax); - ethist.push_back(tmphisto); - - // Eta distribution of HLT objects passing filter i - histName = theHLTCollectionLabels[i].label()+"eta_all"; - histTitle = HltHistTitle[i]+" #eta (ALL)"; - tmphisto = dbe->book1D(histName.c_str(),histTitle.c_str(),nbins_,-etaMax_, etaMax_); - etahist.push_back(tmphisto); - - if (!noPhiPlots_) { - // Phi distribution of HLT objects passing filter i - histName = theHLTCollectionLabels[i].label()+"phi_all"; - histTitle = HltHistTitle[i]+" #phi (ALL)"; - tmphisto = dbe->book1D(histName.c_str(),histTitle.c_str(),nbins_,-phiMax_, phiMax_); - phihist.push_back(tmphisto); - } - - - // Et distribution of HLT object that is closest delta-R match to sorted gen particle(s) - histName = theHLTCollectionLabels[i].label()+"et"; - histTitle = HltHistTitle[i]+" Et"; - tmphisto = dbe->book1D(histName.c_str(),histTitle.c_str(),nbins_,plotPtMin,plotPtMax); - histEtOfHltObjMatchToGen.push_back(tmphisto); - - // eta distribution of HLT object that is closest delta-R match to sorted gen particle(s) - histName = theHLTCollectionLabels[i].label()+"eta"; - histTitle = HltHistTitle[i]+" eta"; - tmphisto = dbe->book1D(histName.c_str(),histTitle.c_str(),nbins_,-etaMax_, etaMax_); - histEtaOfHltObjMatchToGen.push_back(tmphisto); - - if (!noPhiPlots_) { - // phi distribution of HLT object that is closest delta-R match to sorted gen particle(s) - histName = theHLTCollectionLabels[i].label()+"phi"; - histTitle = HltHistTitle[i]+" phi"; - tmphisto = dbe->book1D(histName.c_str(),histTitle.c_str(),nbins_,-phiMax_, phiMax_); - histPhiOfHltObjMatchToGen.push_back(tmphisto); - } - } - - // Et distribution of gen object matching HLT object passing filter i - histName = theHLTCollectionLabels[i].label()+"et_MC_matched"; - histTitle = HltHistTitle[i]+" Et (MC matched)"; - tmphisto = dbe->book1D(histName.c_str(),histTitle.c_str(),nbins_,plotPtMin,plotPtMax); - ethistmatch.push_back(tmphisto); - - // Eta distribution of gen object matching HLT object passing filter i - histName = theHLTCollectionLabels[i].label()+"eta_MC_matched"; - histTitle = HltHistTitle[i]+" #eta (MC matched)"; - tmphisto = dbe->book1D(histName.c_str(),histTitle.c_str(),nbins_,-etaMax_, etaMax_); - etahistmatch.push_back(tmphisto); - - if (!noPhiPlots_) { - // Phi distribution of gen object matching HLT object passing filter i - histName = theHLTCollectionLabels[i].label()+"phi_MC_matched"; - histTitle = HltHistTitle[i]+" #phi (MC matched)"; - tmphisto = dbe->book1D(histName.c_str(),histTitle.c_str(),nbins_,-phiMax_, phiMax_); - phihistmatch.push_back(tmphisto); - } - } - - // Et & eta distributions - etahists.push_back(etahist); - phihists.push_back(phihist); - ethists.push_back(ethist); - etahistmatchs.push_back(etahistmatch); - phihistmatchs.push_back(phihistmatch); - ethistmatchs.push_back(ethistmatch); - histEtOfHltObjMatchToGens.push_back(histEtOfHltObjMatchToGen); - histEtaOfHltObjMatchToGens.push_back(histEtaOfHltObjMatchToGen); - histPhiOfHltObjMatchToGens.push_back(histPhiOfHltObjMatchToGen); - // commented out because uses data not included in HTLDEBUG and uses - // Isolation distributions - //etahistisos.push_back(etahistiso); - //phihistisos.push_back(phihistiso); - //ethistisos.push_back(ethistiso); - //etahistisomatchs.push_back(etahistisomatch); - //phihistisomatchs.push_back(phihistisomatch); - //ethistisomatchs.push_back(ethistisomatch); - //histEtIsoOfHltObjMatchToGens.push_back(histEtIsoOfHltObjMatchToGen); - //histEtaIsoOfHltObjMatchToGens.push_back(histEtaIsoOfHltObjMatchToGen); - //histPhiIsoOfHltObjMatchToGens.push_back(histPhiIsoOfHltObjMatchToGen); - - totals.push_back(total); - totalmatchs.push_back(totalmatch); - etgens.push_back(etgen); - etagens.push_back(etagen); - phigens.push_back(phigen); } if (changed) { @@ -498,6 +316,196 @@ EmDQM::beginRun(edm::Run const &iRun, edm::EventSetup const &iSetup) } } +void +EmDQM::bookHistograms(DQMStore::IBooker &iBooker, edm::Run const &iRun, edm::EventSetup const &iSetup) +{ + //////////////////////////////////////////////////////////// + // loop over all the trigger path parameter sets + //////////////////////////////////////////////////////////// + for (std::vector::iterator psetIt = paramSets.begin(); psetIt != paramSets.end(); ++psetIt) { + SetVarsFromPSet(psetIt); + + iBooker.setCurrentFolder(dirname_); + + //////////////////////////////////////////////////////////// + // Set up Histogram of Effiency vs Step. // + // theHLTCollectionLabels is a vector of InputTags // + // from the configuration file. // + //////////////////////////////////////////////////////////// + // Et & eta distributions + std::vector etahist; + std::vector phihist; + std::vector ethist; + std::vector etahistmatch; + std::vector phihistmatch; + std::vector ethistmatch; + std::vector histEtOfHltObjMatchToGen; + std::vector histEtaOfHltObjMatchToGen; + std::vector histPhiOfHltObjMatchToGen; + // Plots of efficiency per step + MonitorElement* total; + MonitorElement* totalmatch; + //generator histograms + MonitorElement* etgen; + MonitorElement* etagen; + MonitorElement* phigen; + + std::string histName="total_eff"; + std::string histTitle = "total events passing"; + if (!mcMatchedOnly_) { + // This plot will have bins equal to 2+(number of + // HLTCollectionLabels in the config file) + total = iBooker.book1D(histName.c_str(),histTitle.c_str(),numOfHLTCollectionLabels+2,0,numOfHLTCollectionLabels+2); + total->setBinLabel(numOfHLTCollectionLabels+1,"Total"); + total->setBinLabel(numOfHLTCollectionLabels+2,"Gen"); + for (unsigned int u=0; usetBinLabel(u+1,theHLTCollectionLabels[u].label().c_str()); + } + } + + histName="total_eff_MC_matched"; + histTitle="total events passing (mc matched)"; + totalmatch = iBooker.book1D(histName.c_str(),histTitle.c_str(),numOfHLTCollectionLabels+2,0,numOfHLTCollectionLabels+2); + totalmatch->setBinLabel(numOfHLTCollectionLabels+1,"Total"); + totalmatch->setBinLabel(numOfHLTCollectionLabels+2,"Gen"); + for (unsigned int u=0; usetBinLabel(u+1,theHLTCollectionLabels[u].label().c_str()); + } + + MonitorElement* tmphisto; + //MonitorElement* tmpiso; + + //////////////////////////////////////////////////////////// + // Set up generator-level histograms // + //////////////////////////////////////////////////////////// + std::string pdgIdString; + switch(pdgGen) { + case 11: + pdgIdString="Electron";break; + case 22: + pdgIdString="Photon";break; + default: + pdgIdString="Particle"; + } + + histName = "gen_et"; + histTitle= "E_{T} of " + pdgIdString + "s" ; + etgen = iBooker.book1D(histName.c_str(),histTitle.c_str(),nbins_,plotPtMin,plotPtMax); + histName = "gen_eta"; + histTitle= "#eta of "+ pdgIdString +"s " ; + etagen = iBooker.book1D(histName.c_str(),histTitle.c_str(),nbins_,-etaMax_, etaMax_); + histName = "gen_phi"; + histTitle= "#phi of "+ pdgIdString +"s " ; + if (!noPhiPlots_) phigen = iBooker.book1D(histName.c_str(),histTitle.c_str(),nbins_,-phiMax_, phiMax_); + + //////////////////////////////////////////////////////////// + // Set up histograms of HLT objects // + //////////////////////////////////////////////////////////// + // Determine what strings to use for histogram titles + std::vector HltHistTitle; + if ( theHLTCollectionHumanNames.size() == numOfHLTCollectionLabels && useHumanReadableHistTitles_ ) { + HltHistTitle = theHLTCollectionHumanNames; + } else { + for (unsigned int i =0; i < numOfHLTCollectionLabels; i++) { + HltHistTitle.push_back(theHLTCollectionLabels[i].label()); + } + } + + for(unsigned int i = 0; i< numOfHLTCollectionLabels ; i++){ + if (!mcMatchedOnly_) { + // Et distribution of HLT objects passing filter i + histName = theHLTCollectionLabels[i].label()+"et_all"; + histTitle = HltHistTitle[i]+" Et (ALL)"; + tmphisto = iBooker.book1D(histName.c_str(),histTitle.c_str(),nbins_,plotPtMin,plotPtMax); + ethist.push_back(tmphisto); + + // Eta distribution of HLT objects passing filter i + histName = theHLTCollectionLabels[i].label()+"eta_all"; + histTitle = HltHistTitle[i]+" #eta (ALL)"; + tmphisto = iBooker.book1D(histName.c_str(),histTitle.c_str(),nbins_,-etaMax_, etaMax_); + etahist.push_back(tmphisto); + + if (!noPhiPlots_) { + // Phi distribution of HLT objects passing filter i + histName = theHLTCollectionLabels[i].label()+"phi_all"; + histTitle = HltHistTitle[i]+" #phi (ALL)"; + tmphisto = iBooker.book1D(histName.c_str(),histTitle.c_str(),nbins_,-phiMax_, phiMax_); + phihist.push_back(tmphisto); + } + + + // Et distribution of HLT object that is closest delta-R match to sorted gen particle(s) + histName = theHLTCollectionLabels[i].label()+"et"; + histTitle = HltHistTitle[i]+" Et"; + tmphisto = iBooker.book1D(histName.c_str(),histTitle.c_str(),nbins_,plotPtMin,plotPtMax); + histEtOfHltObjMatchToGen.push_back(tmphisto); + + // eta distribution of HLT object that is closest delta-R match to sorted gen particle(s) + histName = theHLTCollectionLabels[i].label()+"eta"; + histTitle = HltHistTitle[i]+" eta"; + tmphisto = iBooker.book1D(histName.c_str(),histTitle.c_str(),nbins_,-etaMax_, etaMax_); + histEtaOfHltObjMatchToGen.push_back(tmphisto); + + if (!noPhiPlots_) { + // phi distribution of HLT object that is closest delta-R match to sorted gen particle(s) + histName = theHLTCollectionLabels[i].label()+"phi"; + histTitle = HltHistTitle[i]+" phi"; + tmphisto = iBooker.book1D(histName.c_str(),histTitle.c_str(),nbins_,-phiMax_, phiMax_); + histPhiOfHltObjMatchToGen.push_back(tmphisto); + } + } + + // Et distribution of gen object matching HLT object passing filter i + histName = theHLTCollectionLabels[i].label()+"et_MC_matched"; + histTitle = HltHistTitle[i]+" Et (MC matched)"; + tmphisto = iBooker.book1D(histName.c_str(),histTitle.c_str(),nbins_,plotPtMin,plotPtMax); + ethistmatch.push_back(tmphisto); + + // Eta distribution of gen object matching HLT object passing filter i + histName = theHLTCollectionLabels[i].label()+"eta_MC_matched"; + histTitle = HltHistTitle[i]+" #eta (MC matched)"; + tmphisto = iBooker.book1D(histName.c_str(),histTitle.c_str(),nbins_,-etaMax_, etaMax_); + etahistmatch.push_back(tmphisto); + + if (!noPhiPlots_) { + // Phi distribution of gen object matching HLT object passing filter i + histName = theHLTCollectionLabels[i].label()+"phi_MC_matched"; + histTitle = HltHistTitle[i]+" #phi (MC matched)"; + tmphisto = iBooker.book1D(histName.c_str(),histTitle.c_str(),nbins_,-phiMax_, phiMax_); + phihistmatch.push_back(tmphisto); + } + } + + // Et & eta distributions + etahists.push_back(etahist); + phihists.push_back(phihist); + ethists.push_back(ethist); + etahistmatchs.push_back(etahistmatch); + phihistmatchs.push_back(phihistmatch); + ethistmatchs.push_back(ethistmatch); + histEtOfHltObjMatchToGens.push_back(histEtOfHltObjMatchToGen); + histEtaOfHltObjMatchToGens.push_back(histEtaOfHltObjMatchToGen); + histPhiOfHltObjMatchToGens.push_back(histPhiOfHltObjMatchToGen); + // commented out because uses data not included in HTLDEBUG and uses + // Isolation distributions + //etahistisos.push_back(etahistiso); + //phihistisos.push_back(phihistiso); + //ethistisos.push_back(ethistiso); + //etahistisomatchs.push_back(etahistisomatch); + //phihistisomatchs.push_back(phihistisomatch); + //ethistisomatchs.push_back(ethistisomatch); + //histEtIsoOfHltObjMatchToGens.push_back(histEtIsoOfHltObjMatchToGen); + //histEtaIsoOfHltObjMatchToGens.push_back(histEtaIsoOfHltObjMatchToGen); + //histPhiIsoOfHltObjMatchToGens.push_back(histPhiIsoOfHltObjMatchToGen); + + totals.push_back(total); + totalmatchs.push_back(totalmatch); + etgens.push_back(etgen); + etagens.push_back(etagen); + phigens.push_back(phigen); + } +} + //////////////////////////////////////////////////////////////////////////////// // Destructor // //////////////////////////////////////////////////////////////////////////////// @@ -1427,7 +1435,6 @@ EmDQM::makePSetForElectronGenericFilter(const std::string& moduleName) void EmDQM::SetVarsFromPSet(std::vector::iterator psetIt) { dirname_="HLT/HLTEgammaValidation/"+psetIt->getParameter("@module_label"); - dbe->setCurrentFolder(dirname_); pathIndex = psetIt->getUntrackedParameter("pathIndex", 0); // parameters for generator study diff --git a/HLTriggerOffline/Egamma/src/EmDQMReco.cc b/HLTriggerOffline/Egamma/src/EmDQMReco.cc index 9b2e6ce783aef..6b0f7d207e6b1 100644 --- a/HLTriggerOffline/Egamma/src/EmDQMReco.cc +++ b/HLTriggerOffline/Egamma/src/EmDQMReco.cc @@ -46,6 +46,7 @@ using namespace ROOT::Math::VectorUtil ; // class EmDQMReco::FourVectorMonitorElements //---------------------------------------------------------------------- EmDQMReco::FourVectorMonitorElements::FourVectorMonitorElements(EmDQMReco *_parent, + DQMStore::IBooker &iBooker, const std::string &histogramNameTemplate, const std::string &histogramTitleTemplate ) : @@ -58,7 +59,7 @@ EmDQMReco::FourVectorMonitorElements::FourVectorMonitorElements(EmDQMReco *_pare // et histName = boost::str(boost::format(histogramNameTemplate) % "et"); histTitle = boost::str(boost::format(histogramTitleTemplate) % "E_{T}"); - etMonitorElement = parent->dbe->book1D(histName.c_str(), + etMonitorElement = iBooker.book1D(histName.c_str(), histTitle.c_str(), parent->plotBins, parent->plotPtMin, @@ -67,7 +68,7 @@ EmDQMReco::FourVectorMonitorElements::FourVectorMonitorElements(EmDQMReco *_pare // eta histName = boost::str(boost::format(histogramNameTemplate) % "eta"); histTitle= boost::str(boost::format(histogramTitleTemplate) % "#eta"); - etaMonitorElement = parent->dbe->book1D(histName.c_str(), + etaMonitorElement = iBooker.book1D(histName.c_str(), histTitle.c_str(), parent->plotBins, - parent->plotEtaMax, @@ -76,7 +77,7 @@ EmDQMReco::FourVectorMonitorElements::FourVectorMonitorElements(EmDQMReco *_pare // phi histName = boost::str(boost::format(histogramNameTemplate) % "phi"); histTitle= boost::str(boost::format(histogramTitleTemplate) % "#phi"); - phiMonitorElement = parent->dbe->book1D(histName.c_str(), + phiMonitorElement = iBooker.book1D(histName.c_str(), histTitle.c_str(), parent->plotBins, - parent->plotPhiMax, @@ -100,16 +101,10 @@ EmDQMReco::FourVectorMonitorElements::fill(const math::XYZTLorentzVector &moment //////////////////////////////////////////////////////////////////////////////// EmDQMReco::EmDQMReco(const edm::ParameterSet& pset) { - - dbe = edm::Service < DQMStore > ().operator->(); - dbe->setVerbose(0); - - //////////////////////////////////////////////////////////// // Read from configuration file // //////////////////////////////////////////////////////////// dirname_="HLT/HLTEgammaValidation/"+pset.getParameter("@module_label"); - dbe->setCurrentFolder(dirname_); // parameters for generator study reqNum = pset.getParameter("reqNum"); @@ -202,30 +197,24 @@ EmDQMReco::EmDQMReco(const edm::ParameterSet& pset) } - - /// /// /// -void EmDQMReco::beginRun(const edm::Run& iRun, const edm::EventSetup& iSetup ) { +void EmDQMReco::dqmBeginRun(const edm::Run& iRun, const edm::EventSetup& iSetup ) { bool isHltConfigChanged = false; // change of cfg at run boundaries? isHltConfigInitialized_ = hltConfig_.init( iRun, iSetup, "HLT", isHltConfigChanged ); } - - - - //////////////////////////////////////////////////////////////////////////////// -// method called once each job just before starting event loop // +// book DQM histograms // //////////////////////////////////////////////////////////////////////////////// void -EmDQMReco::beginJob() +EmDQMReco::bookHistograms(DQMStore::IBooker &iBooker, edm::Run const &iRun, edm::EventSetup const &iSetup) { //edm::Service fs; - dbe->setCurrentFolder(dirname_); + iBooker.setCurrentFolder(dirname_); //////////////////////////////////////////////////////////// // Set up Histogram of Effiency vs Step. // @@ -237,14 +226,14 @@ EmDQMReco::beginJob() std::string histTitle = "total events passing"; // This plot will have bins equal to 2+(number of // HLTCollectionLabels in the config file) - totalreco = dbe->book1D(histName.c_str(),histTitle.c_str(),numOfHLTCollectionLabels+2,0,numOfHLTCollectionLabels+2); + totalreco = iBooker.book1D(histName.c_str(),histTitle.c_str(),numOfHLTCollectionLabels+2,0,numOfHLTCollectionLabels+2); totalreco->setBinLabel(numOfHLTCollectionLabels+1,"Total"); totalreco->setBinLabel(numOfHLTCollectionLabels+2,"Reco"); for (unsigned int u=0; usetBinLabel(u+1,theHLTCollectionLabels[u].label().c_str());} histName="total_eff_RECO_matched"; histTitle="total events passing (Reco matched)"; - totalmatchreco = dbe->book1D(histName.c_str(),histTitle.c_str(),numOfHLTCollectionLabels+2,0,numOfHLTCollectionLabels+2); + totalmatchreco = iBooker.book1D(histName.c_str(),histTitle.c_str(),numOfHLTCollectionLabels+2,0,numOfHLTCollectionLabels+2); totalmatchreco->setBinLabel(numOfHLTCollectionLabels+1,"Total"); totalmatchreco->setBinLabel(numOfHLTCollectionLabels+2,"Reco"); for (unsigned int u=0; usetBinLabel(u+1,theHLTCollectionLabels[u].label().c_str());} @@ -270,7 +259,7 @@ EmDQMReco::beginJob() // reco // (note that reset(..) must be used to set the value of the scoped_ptr...) histReco.reset( - new FourVectorMonitorElements(this, + new FourVectorMonitorElements(this, iBooker, "reco_%s", // pattern for histogram name "%s of " + pdgIdString + "s" )); @@ -279,7 +268,7 @@ EmDQMReco::beginJob() // monpath histRecoMonpath.reset( - new FourVectorMonitorElements(this, + new FourVectorMonitorElements(this, iBooker, "reco_%s_monpath", // pattern for histogram name "%s of " + pdgIdString + "s monpath" ) @@ -290,7 +279,7 @@ EmDQMReco::beginJob() // TODO: WHAT ARE THESE HISTOGRAMS FOR ? THEY SEEM NEVER REFERENCED ANYWHERE IN THIS FILE... // final X monpath histMonpath.reset( - new FourVectorMonitorElements(this, + new FourVectorMonitorElements(this, iBooker, "final_%s_monpath", // pattern for histogram name "Final %s Monpath" ) @@ -320,22 +309,22 @@ EmDQMReco::beginJob() // // Et // histName = theHLTCollectionLabels[i].label()+"et_all"; // histTitle = HltHistTitle[i]+" Et (ALL)"; -// tmphisto = dbe->book1D(histName.c_str(),histTitle.c_str(),plotBins,plotPtMin,plotPtMax); +// tmphisto = iBooker.book1D(histName.c_str(),histTitle.c_str(),plotBins,plotPtMin,plotPtMax); // ethist.push_back(tmphisto); // // // Eta // histName = theHLTCollectionLabels[i].label()+"eta_all"; // histTitle = HltHistTitle[i]+" #eta (ALL)"; -// tmphisto = dbe->book1D(histName.c_str(),histTitle.c_str(),plotBins,-plotEtaMax,plotEtaMax); +// tmphisto = iBooker.book1D(histName.c_str(),histTitle.c_str(),plotBins,-plotEtaMax,plotEtaMax); // etahist.push_back(tmphisto); // // // phi // histName = theHLTCollectionLabels[i].label()+"phi_all"; // histTitle = HltHistTitle[i]+" #phi (ALL)"; -// tmphisto = dbe->book1D(histName.c_str(),histTitle.c_str(),plotBins,-plotPhiMax,plotPhiMax); +// tmphisto = iBooker.book1D(histName.c_str(),histTitle.c_str(),plotBins,-plotPhiMax,plotPhiMax); // phiHist.push_back(tmphisto); - standardHist.push_back(new FourVectorMonitorElements(this, + standardHist.push_back(new FourVectorMonitorElements(this, iBooker, theHLTCollectionLabels[i].label()+"%s_all", // histogram name HltHistTitle[i]+" %s (ALL)" // histogram title )); @@ -347,21 +336,21 @@ EmDQMReco::beginJob() // Et // histName = theHLTCollectionLabels[i].label()+"et_RECO_matched"; // histTitle = HltHistTitle[i]+" Et (RECO matched)"; -// tmphisto = dbe->book1D(histName.c_str(),histTitle.c_str(),plotBins,plotPtMin,plotPtMax); +// tmphisto = iBooker.book1D(histName.c_str(),histTitle.c_str(),plotBins,plotPtMin,plotPtMax); // ethistmatchreco.push_back(tmphisto); // // Eta // histName = theHLTCollectionLabels[i].label()+"eta_RECO_matched"; // histTitle = HltHistTitle[i]+" #eta (RECO matched)"; -// tmphisto = dbe->book1D(histName.c_str(),histTitle.c_str(),plotBins,-plotEtaMax,plotEtaMax); +// tmphisto = iBooker.book1D(histName.c_str(),histTitle.c_str(),plotBins,-plotEtaMax,plotEtaMax); // etahistmatchreco.push_back(tmphisto); // // // phi // histName = theHLTCollectionLabels[i].label()+"phi_RECO_matched"; // histTitle = HltHistTitle[i]+" #phi (RECO matched)"; -// tmphisto = dbe->book1D(histName.c_str(),histTitle.c_str(),plotBins,-plotPhiMax,plotPhiMax); +// tmphisto = iBooker.book1D(histName.c_str(),histTitle.c_str(),plotBins,-plotPhiMax,plotPhiMax); // phiHistMatchReco.push_back(tmphisto); - histMatchReco.push_back(new FourVectorMonitorElements(this, + histMatchReco.push_back(new FourVectorMonitorElements(this, iBooker, theHLTCollectionLabels[i].label()+"%s_RECO_matched", // histogram name HltHistTitle[i]+" %s (RECO matched)" // histogram title )); @@ -373,22 +362,22 @@ EmDQMReco::beginJob() // // Et // histName = theHLTCollectionLabels[i].label()+"et_RECO_matched_monpath"; // histTitle = HltHistTitle[i]+" Et (RECO matched, monpath)"; -// tmphisto = dbe->book1D(histName.c_str(),histTitle.c_str(),plotBins,plotPtMin,plotPtMax); +// tmphisto = iBooker.book1D(histName.c_str(),histTitle.c_str(),plotBins,plotPtMin,plotPtMax); // ethistmatchrecomonpath.push_back(tmphisto); // // // Eta // histName = theHLTCollectionLabels[i].label()+"eta_RECO_matched_monpath"; // histTitle = HltHistTitle[i]+" #eta (RECO matched, monpath)"; -// tmphisto = dbe->book1D(histName.c_str(),histTitle.c_str(),plotBins,-plotEtaMax,plotEtaMax); +// tmphisto = iBooker.book1D(histName.c_str(),histTitle.c_str(),plotBins,-plotEtaMax,plotEtaMax); // etahistmatchrecomonpath.push_back(tmphisto); // // // phi // histName = theHLTCollectionLabels[i].label()+"phi_RECO_matched_monpath"; // histTitle = HltHistTitle[i]+" #phi (RECO matched, monpath)"; -// tmphisto = dbe->book1D(histName.c_str(),histTitle.c_str(),plotBins,-plotPhiMax,plotPhiMax); +// tmphisto = iBooker.book1D(histName.c_str(),histTitle.c_str(),plotBins,-plotPhiMax,plotPhiMax); // phiHistMatchRecoMonPath.push_back(tmphisto); - histMatchRecoMonPath.push_back(new FourVectorMonitorElements(this, + histMatchRecoMonPath.push_back(new FourVectorMonitorElements(this, iBooker, theHLTCollectionLabels[i].label()+"%s_RECO_matched_monpath", // histogram name HltHistTitle[i]+" %s (RECO matched, monpath)" // histogram title )); @@ -399,22 +388,22 @@ EmDQMReco::beginJob() // Et // histName = theHLTCollectionLabels[i].label()+"et_reco"; // histTitle = HltHistTitle[i]+" Et (reco)"; -// tmphisto = dbe->book1D(histName.c_str(),histTitle.c_str(),plotBins,plotPtMin,plotPtMax); +// tmphisto = iBooker.book1D(histName.c_str(),histTitle.c_str(),plotBins,plotPtMin,plotPtMax); // histEtOfHltObjMatchToReco.push_back(tmphisto); // // // eta // histName = theHLTCollectionLabels[i].label()+"eta_reco"; // histTitle = HltHistTitle[i]+" eta (reco)"; -// tmphisto = dbe->book1D(histName.c_str(),histTitle.c_str(),plotBins,-plotEtaMax,plotEtaMax); +// tmphisto = iBooker.book1D(histName.c_str(),histTitle.c_str(),plotBins,-plotEtaMax,plotEtaMax); // histEtaOfHltObjMatchToReco.push_back(tmphisto); // // // phi // histName = theHLTCollectionLabels[i].label()+"phi_reco"; // histTitle = HltHistTitle[i]+" phi (reco)"; -// tmphisto = dbe->book1D(histName.c_str(),histTitle.c_str(),plotBins,-plotPhiMax,plotPhiMax); +// tmphisto = iBooker.book1D(histName.c_str(),histTitle.c_str(),plotBins,-plotPhiMax,plotPhiMax); // histPhiOfHltObjMatchToReco.push_back(tmphisto); - histHltObjMatchToReco.push_back(new FourVectorMonitorElements(this, + histHltObjMatchToReco.push_back(new FourVectorMonitorElements(this, iBooker, theHLTCollectionLabels[i].label()+"%s_reco", // histogram name HltHistTitle[i]+" %s (reco)" // histogram title )); @@ -444,19 +433,19 @@ EmDQMReco::beginJob() // X = eta histName = theHLTCollectionLabels[i].label()+"eta_isolation_all"; histTitle = HltHistTitle[i]+" isolation vs #eta (all)"; - tmpiso = dbe->book2D(histName.c_str(),histTitle.c_str(),plotBins,-plotEtaMax,plotEtaMax,plotBins,plotBounds[i].first,plotBounds[i].second); + tmpiso = iBooker.book2D(histName.c_str(),histTitle.c_str(),plotBins,-plotEtaMax,plotEtaMax,plotBins,plotBounds[i].first,plotBounds[i].second); etahistiso.push_back(tmpiso); // X = et histName = theHLTCollectionLabels[i].label()+"et_isolation_all"; histTitle = HltHistTitle[i]+" isolation vs Et (all)"; - tmpiso = dbe->book2D(histName.c_str(),histTitle.c_str(),plotBins,plotPtMin,plotPtMax,plotBins,plotBounds[i].first,plotBounds[i].second); + tmpiso = iBooker.book2D(histName.c_str(),histTitle.c_str(),plotBins,plotPtMin,plotPtMax,plotBins,plotBounds[i].first,plotBounds[i].second); ethistiso.push_back(tmpiso); // X = phi histName = theHLTCollectionLabels[i].label()+"phi_isolation_all"; histTitle = HltHistTitle[i]+" isolation vs #phi (all)"; - tmpiso = dbe->book2D(histName.c_str(),histTitle.c_str(),plotBins,-plotPhiMax,plotPhiMax,plotBins,plotBounds[i].first,plotBounds[i].second); + tmpiso = iBooker.book2D(histName.c_str(),histTitle.c_str(),plotBins,-plotPhiMax,plotPhiMax,plotBins,plotBounds[i].first,plotBounds[i].second); phiHistIso.push_back(tmpiso); //-------------------- @@ -466,19 +455,19 @@ EmDQMReco::beginJob() // X = eta histName = theHLTCollectionLabels[i].label()+"eta_isolation_RECO_matched"; histTitle = HltHistTitle[i]+" isolation vs #eta (reco matched)"; - tmpiso = dbe->book2D(histName.c_str(),histTitle.c_str(),plotBins,-plotEtaMax,plotEtaMax,plotBins,plotBounds[i].first,plotBounds[i].second); + tmpiso = iBooker.book2D(histName.c_str(),histTitle.c_str(),plotBins,-plotEtaMax,plotEtaMax,plotBins,plotBounds[i].first,plotBounds[i].second); etahistisomatchreco.push_back(tmpiso); // X = et histName = theHLTCollectionLabels[i].label()+"et_isolation_RECO_matched"; histTitle = HltHistTitle[i]+" isolation vs Et (reco matched)"; - tmpiso = dbe->book2D(histName.c_str(),histTitle.c_str(),plotBins,plotPtMin,plotPtMax,plotBins,plotBounds[i].first,plotBounds[i].second); + tmpiso = iBooker.book2D(histName.c_str(),histTitle.c_str(),plotBins,plotPtMin,plotPtMax,plotBins,plotBounds[i].first,plotBounds[i].second); ethistisomatchreco.push_back(tmpiso); // X = eta histName = theHLTCollectionLabels[i].label()+"phi_isolation_RECO_matched"; histTitle = HltHistTitle[i]+" isolation vs #phi (reco matched)"; - tmpiso = dbe->book2D(histName.c_str(),histTitle.c_str(),plotBins,-plotPhiMax,plotPhiMax,plotBins,plotBounds[i].first,plotBounds[i].second); + tmpiso = iBooker.book2D(histName.c_str(),histTitle.c_str(),plotBins,-plotPhiMax,plotPhiMax,plotBins,plotBounds[i].first,plotBounds[i].second); phiHistIsoMatchReco.push_back(tmpiso); //-------------------- @@ -489,24 +478,23 @@ EmDQMReco::beginJob() // X = eta histName = theHLTCollectionLabels[i].label()+"eta_isolation_reco"; histTitle = HltHistTitle[i]+" isolation vs #eta (reco)"; - tmpiso = dbe->book2D(histName.c_str(),histTitle.c_str(),plotBins,-plotEtaMax,plotEtaMax,plotBins,plotBounds[i].first,plotBounds[i].second); + tmpiso = iBooker.book2D(histName.c_str(),histTitle.c_str(),plotBins,-plotEtaMax,plotEtaMax,plotBins,plotBounds[i].first,plotBounds[i].second); histEtaIsoOfHltObjMatchToReco.push_back(tmpiso); // X = et histName = theHLTCollectionLabels[i].label()+"et_isolation_reco"; histTitle = HltHistTitle[i]+" isolation vs Et (reco)"; - tmpiso = dbe->book2D(histName.c_str(),histTitle.c_str(),plotBins,plotPtMin,plotPtMax,plotBins,plotBounds[i].first,plotBounds[i].second); + tmpiso = iBooker.book2D(histName.c_str(),histTitle.c_str(),plotBins,plotPtMin,plotPtMax,plotBins,plotBounds[i].first,plotBounds[i].second); histEtIsoOfHltObjMatchToReco.push_back(tmpiso); // X = phi histName = theHLTCollectionLabels[i].label()+"phi_isolation_reco"; histTitle = HltHistTitle[i]+" isolation vs #phi (reco)"; - tmpiso = dbe->book2D(histName.c_str(),histTitle.c_str(),plotBins,-plotPhiMax,plotPhiMax,plotBins,plotBounds[i].first,plotBounds[i].second); + tmpiso = iBooker.book2D(histName.c_str(),histTitle.c_str(),plotBins,-plotPhiMax,plotPhiMax,plotBins,plotBounds[i].first,plotBounds[i].second); histPhiIsoOfHltObjMatchToReco.push_back(tmpiso); //-------------------- } // END of HLT histograms - } } diff --git a/HLTriggerOffline/Egamma/test/egammaHltValidate.py b/HLTriggerOffline/Egamma/test/egammaHltValidate.py index c528b332c77d5..ef04a53e364ea 100755 --- a/HLTriggerOffline/Egamma/test/egammaHltValidate.py +++ b/HLTriggerOffline/Egamma/test/egammaHltValidate.py @@ -27,22 +27,22 @@ # as we explicitly require the release in the DBS query ? knownDatasets = { "diGamma" : { - "dataset": "/RelValH130GGgluonfusion/CMSSW_%(version)s*/GEN-SIM-DIGI-RAW-HLTDEBUG", + "dataset": "/RelValH130GGgluonfusion*/CMSSW_%(version)s*/GEN-SIM-DIGI-RAW-HLTDEBUG", "output": "DiGamma_%(version)s.root", }, "photonJet" : { - "dataset": "/RelValPhotonJets_Pt_10/CMSSW_%(version)s*/GEN-SIM-DIGI-RAW-HLTDEBUG", + "dataset": "/RelValPhotonJets_Pt_10*/CMSSW_%(version)s*/GEN-SIM-DIGI-RAW-HLTDEBUG", "output": "GammaJet_%(version)s.root", }, "zee" : { - "dataset": "/RelValZEE/CMSSW_%(version)s*/GEN-SIM-DIGI-RAW-HLTDEBUG", + "dataset": "/RelValZEE*/CMSSW_%(version)s*/GEN-SIM-DIGI-RAW-HLTDEBUG", "output": "ZEE_%(version)s.root", }, "wen" : { - "dataset": "/RelValWE/CMSSW_%(version)s*/GEN-SIM-DIGI-RAW-HLTDEBUG", + "dataset": "/RelValWE*/CMSSW_%(version)s*/GEN-SIM-DIGI-RAW-HLTDEBUG", "output": "WEN_%(version)s.root", }, } @@ -365,7 +365,7 @@ def getCMSSWVersionFromEnvironment(): dest="isData", default = False, action = "store_true", - help="run on real data file (works only together with EmDQMFeeder at the moment)", + help="run on real data file", ) (options, ARGV) = parser.parse_args() @@ -442,7 +442,7 @@ def getCMSSWVersionFromEnvironment(): "cd -", ]) - cmd_parts.append("dbs lsf --path=" + datasetToCheck) + cmd_parts.append("das_client.py --query='file dataset=" + datasetToCheck + "'") FILES=os.popen(" && ".join(cmd_parts)).readlines() @@ -577,13 +577,13 @@ def getCMSSWVersionFromEnvironment(): print >> fout,"#----------------------------------------" #---------------------------------------- -# run on real data with EmDQMFeeder -if options.isData and absoluteInputConfigFile.find("testEmDQMFeeder_cfg.py") != -1: +# run on real data +if options.isData and absoluteInputConfigFile.find("testEmDQM_cfg.py") != -1: print >> fout print >> fout,"#----------------------------------------" print >> fout,"# Running on real data sample" print >> fout,"#----------------------------------------" - print >> fout,"process.dqmFeeder.isData = cms.bool(True)" + print >> fout,"process.emdqm.isData = cms.bool(True)" print >> fout,"#----------------------------------------" #---------------------------------------- diff --git a/HLTriggerOffline/Egamma/test/testEmDQM_cfg.py b/HLTriggerOffline/Egamma/test/testEmDQM_cfg.py index 6557b30cc21c1..a7b95a8180273 100644 --- a/HLTriggerOffline/Egamma/test/testEmDQM_cfg.py +++ b/HLTriggerOffline/Egamma/test/testEmDQM_cfg.py @@ -62,5 +62,5 @@ process.ppost = cms.EndPath(process.post+process.dqmSaver) #---------------------------------------- -# End of original testEmDQMFeeder_cfg.py +# End of original testEmDQM_cfg.py #----------------------------------------