diff --git a/DQMOffline/Trigger/interface/HLTTauDQML1Plotter.h b/DQMOffline/Trigger/interface/HLTTauDQML1Plotter.h index ca8fd4e230885..4e4fc98300a25 100644 --- a/DQMOffline/Trigger/interface/HLTTauDQML1Plotter.h +++ b/DQMOffline/Trigger/interface/HLTTauDQML1Plotter.h @@ -3,6 +3,7 @@ #define HLTTauDQML1Plotter_h #include "DQMOffline/Trigger/interface/HLTTauDQMPlotter.h" +#include "DQMOffline/Trigger/interface/IWrapper.h" #include "FWCore/Utilities/interface/InputTag.h" @@ -25,7 +26,7 @@ class HLTTauDQML1Plotter : private HLTTauDQMPlotter { using HLTTauDQMPlotter::isValid; - void bookHistograms(DQMStore::IBooker& iBooker); + void bookHistograms(IWrapper &iWrapper, DQMStore::IBooker &iBooker); void analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup, const HLTTauDQMOfflineObjects& refC); private: diff --git a/DQMOffline/Trigger/interface/HLTTauDQMOfflineSource.h b/DQMOffline/Trigger/interface/HLTTauDQMOfflineSource.h index d431e082dcdbc..bd8a1458b9327 100644 --- a/DQMOffline/Trigger/interface/HLTTauDQMOfflineSource.h +++ b/DQMOffline/Trigger/interface/HLTTauDQMOfflineSource.h @@ -13,6 +13,7 @@ #include "DQMServices/Core/interface/DQMEDAnalyzer.h" //Plotters +#include "DQMOffline/Trigger/interface/IWrapper.h" #include "DQMOffline/Trigger/interface/HLTTauDQML1Plotter.h" #include "DQMOffline/Trigger/interface/HLTTauDQMPathPlotter.h" #include "DQMOffline/Trigger/interface/HLTTauDQMPathSummaryPlotter.h" @@ -44,12 +45,13 @@ class HLTTauDQMOfflineSource : public DQMEDAnalyzer { edm::EDGetTokenT triggerEventToken_; // For path plotters - const std::string pathRegexString_; const std::regex pathRegex_; const int nPtBins_, nEtaBins_, nPhiBins_; const double ptMax_, highPtMax_, l1MatchDr_, hltMatchDr_; const std::string dqmBaseFolder_; + IWrapper *iWrapper; + HLTConfigProvider HLTCP_; //Reference diff --git a/DQMOffline/Trigger/interface/HLTTauDQMPathPlotter.h b/DQMOffline/Trigger/interface/HLTTauDQMPathPlotter.h index 7fd4150f918da..b5adcc457561c 100644 --- a/DQMOffline/Trigger/interface/HLTTauDQMPathPlotter.h +++ b/DQMOffline/Trigger/interface/HLTTauDQMPathPlotter.h @@ -4,6 +4,7 @@ #include "DQMOffline/Trigger/interface/HLTTauDQMPlotter.h" #include "DQMOffline/Trigger/interface/HLTTauDQMPath.h" +#include "DQMOffline/Trigger/interface/IWrapper.h" namespace edm { class Event; @@ -35,7 +36,7 @@ class HLTTauDQMPathPlotter : private HLTTauDQMPlotter { using HLTTauDQMPlotter::isValid; - void bookHistograms(DQMStore::IBooker &iBooker); + void bookHistograms(IWrapper & iWrapper, DQMStore::IBooker &iBooker); void analyze(const edm::TriggerResults &triggerResults, const trigger::TriggerEvent &triggerEvent, diff --git a/DQMOffline/Trigger/interface/HLTTauDQMPathSummaryPlotter.h b/DQMOffline/Trigger/interface/HLTTauDQMPathSummaryPlotter.h index beed0859f76bc..96e0e3ea75a13 100644 --- a/DQMOffline/Trigger/interface/HLTTauDQMPathSummaryPlotter.h +++ b/DQMOffline/Trigger/interface/HLTTauDQMPathSummaryPlotter.h @@ -3,6 +3,7 @@ #define HLTTauDQMPathSummaryPlotter_h #include "DQMOffline/Trigger/interface/HLTTauDQMPlotter.h" +#include "DQMOffline/Trigger/interface/IWrapper.h" #include @@ -25,7 +26,7 @@ class HLTTauDQMPathSummaryPlotter : private HLTTauDQMPlotter { using HLTTauDQMPlotter::isValid; void setPathObjects(const std::vector& pathObjects) { pathObjects_ = pathObjects; } - void bookHistograms(DQMStore::IBooker& iBooker); + void bookHistograms(IWrapper &iWrapper, DQMStore::IBooker &iBooker); void analyze(const edm::TriggerResults& triggerResults, const trigger::TriggerEvent& triggerEvent, diff --git a/DQMOffline/Trigger/interface/HLTTauDQMTagAndProbePlotter.h b/DQMOffline/Trigger/interface/HLTTauDQMTagAndProbePlotter.h index 85c3d248f375c..99d7f80f1e485 100644 --- a/DQMOffline/Trigger/interface/HLTTauDQMTagAndProbePlotter.h +++ b/DQMOffline/Trigger/interface/HLTTauDQMTagAndProbePlotter.h @@ -4,6 +4,7 @@ #include "DQMOffline/Trigger/interface/HLTTauDQMPlotter.h" #include "DQMOffline/Trigger/interface/HLTTauDQMPath.h" +#include "DQMOffline/Trigger/interface/IWrapper.h" //#include "CommonTools/TriggerUtils/interface/GenericTriggerEventFlag.h" #include "FWCore/Common/interface/TriggerNames.h" @@ -29,7 +30,7 @@ class HLTTauDQMTagAndProbePlotter : private HLTTauDQMPlotter { using HLTTauDQMPlotter::isValid; - void bookHistograms(DQMStore::IBooker &iBooker, edm::Run const &iRun, edm::EventSetup const &iSetup); + void bookHistograms(IWrapper &iWrapper, DQMStore::IBooker &iBooker, edm::Run const &iRun, edm::EventSetup const &iSetup); void analyze(edm::Event const &iEvent, const edm::TriggerResults &triggerResults, diff --git a/DQMOffline/Trigger/interface/IWrapper.h b/DQMOffline/Trigger/interface/IWrapper.h new file mode 100644 index 0000000000000..96433041a8412 --- /dev/null +++ b/DQMOffline/Trigger/interface/IWrapper.h @@ -0,0 +1,26 @@ +#ifndef __IWrapper__ +#define __IWrapper__ + +#include "FWCore/ParameterSet/interface/ParameterSet.h" + +#include "DQMServices/Core/interface/DQMStore.h" +typedef dqm::legacy::DQMStore DQMStore; +#include "DQMServices/Core/interface/MonitorElement.h" +typedef dqm::legacy::MonitorElement MonitorElement; + +enum PL {kEverything, kVital}; + +class IWrapper { + public: + IWrapper(const edm::ParameterSet&); + ~IWrapper(); + + MonitorElement* book1D(DQMStore::IBooker& iBooker, TString const &name, TString const &title, int const nchX, double const lowX, double const highX, int level = kEverything); + MonitorElement* book2D(DQMStore::IBooker& iBooker, TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, int level = kEverything); + + private: + PL plotlevel; + int cAllHistograms; + int cPlottedHistograms; +}; +#endif diff --git a/DQMOffline/Trigger/plugins/HLTTauDQMOfflineSource.cc b/DQMOffline/Trigger/plugins/HLTTauDQMOfflineSource.cc index 7fed02f28a01f..575e0e6a6aa0b 100644 --- a/DQMOffline/Trigger/plugins/HLTTauDQMOfflineSource.cc +++ b/DQMOffline/Trigger/plugins/HLTTauDQMOfflineSource.cc @@ -18,8 +18,7 @@ HLTTauDQMOfflineSource::HLTTauDQMOfflineSource(const edm::ParameterSet& ps) triggerResultsToken_(consumes(triggerResultsSrc_)), triggerEventSrc_(ps.getUntrackedParameter("TriggerEventSrc")), triggerEventToken_(consumes(triggerEventSrc_)), - pathRegexString_(ps.getUntrackedParameter("Paths")), - pathRegex_(pathRegexString_), + pathRegex_(ps.getUntrackedParameter("Paths")), nPtBins_(ps.getUntrackedParameter("PtHistoBins", 20)), nEtaBins_(ps.getUntrackedParameter("EtaHistoBins", 12)), nPhiBins_(ps.getUntrackedParameter("PhiHistoBins", 18)), @@ -33,6 +32,8 @@ HLTTauDQMOfflineSource::HLTTauDQMOfflineSource(const edm::ParameterSet& ps) edm::ParameterSet matching = ps.getParameter("Matching"); doRefAnalysis_ = matching.getUntrackedParameter("doMatching"); + iWrapper = new IWrapper(ps); + if (ps.exists("L1Plotter") && !ps.exists("TagAndProbe")) { l1Plotter_ = std::make_unique(ps.getUntrackedParameter("L1Plotter"), consumesCollector(), @@ -76,7 +77,7 @@ void HLTTauDQMOfflineSource::dqmBeginRun(const edm::Run& iRun, const edm::EventS // Find all paths to monitor std::vector foundPaths; std::smatch what; - LogDebug("HLTTauDQMOffline") << "Looking for paths with regex " << pathRegexString_; + LogDebug("HLTTauDQMOffline") << "Looking for paths with regex " << pathRegex_; for (const std::string& pathName : HLTCP_.triggerNames()) { if (std::regex_search(pathName, what, pathRegex_)) { LogDebug("HLTTauDQMOffline") << "Found path " << pathName; @@ -164,16 +165,16 @@ void HLTTauDQMOfflineSource::bookHistograms(DQMStore::IBooker& iBooker, const edm::Run& iRun, const EventSetup& iSetup) { if (l1Plotter_) { - l1Plotter_->bookHistograms(iBooker); + l1Plotter_->bookHistograms(*iWrapper,iBooker); } for (auto& pathPlotter : pathPlotters_) { - pathPlotter.bookHistograms(iBooker); + pathPlotter.bookHistograms(*iWrapper,iBooker); } for (auto& tpPlotter : tagandprobePlotters_) { - tpPlotter->bookHistograms(iBooker, iRun, iSetup); + tpPlotter->bookHistograms(*iWrapper,iBooker, iRun, iSetup); } if (pathSummaryPlotter_) { - pathSummaryPlotter_->bookHistograms(iBooker); + pathSummaryPlotter_->bookHistograms(*iWrapper,iBooker); } } diff --git a/DQMOffline/Trigger/plugins/HLTTauRefProducer.cc b/DQMOffline/Trigger/plugins/HLTTauRefProducer.cc index 812c1e228362e..7a4bf7a802499 100644 --- a/DQMOffline/Trigger/plugins/HLTTauRefProducer.cc +++ b/DQMOffline/Trigger/plugins/HLTTauRefProducer.cc @@ -185,6 +185,7 @@ void HLTTauRefProducer::doPFTaus(edm::StreamID iID, edm::Event& iEvent) const { pftau.phi() > phiMinPFTau_ && pftau.phi() < phiMaxPFTau_) { reco::PFTauRef thePFTau{pftaus, i}; bool passAll{true}; + for (auto const& token : PFTauDis_) { edm::Handle pftaudis; if (iEvent.getByToken(token, pftaudis)) { @@ -197,6 +198,7 @@ void HLTTauRefProducer::doPFTaus(edm::StreamID iID, edm::Event& iEvent) const { break; } } + int idx = 0; for (auto const& token : PFTauDisCont_) { edm::Handle pftaudis; diff --git a/DQMOffline/Trigger/python/HLTTauDQMOffline_cfi.py b/DQMOffline/Trigger/python/HLTTauDQMOffline_cfi.py index 28c3171adbe38..2b7d815229c85 100644 --- a/DQMOffline/Trigger/python/HLTTauDQMOffline_cfi.py +++ b/DQMOffline/Trigger/python/HLTTauDQMOffline_cfi.py @@ -1,5 +1,4 @@ import FWCore.ParameterSet.Config as cms -from Configuration.ProcessModifiers.tau_readOldDiscriminatorFormat_cff import tau_readOldDiscriminatorFormat hltTauDQMofflineProcess = "HLT" @@ -7,18 +6,13 @@ TauRefProducer = cms.EDProducer("HLTTauRefProducer", PFTaus = cms.untracked.PSet( + PFTauDiscriminatorContainers = cms.untracked.VInputTag(), + PFTauDiscriminatorContainerWPs = cms.untracked.vstring(), PFTauDiscriminators = cms.untracked.VInputTag( - cms.InputTag("hpsPFTauDiscriminationByDecayModeFinding") - ), - PFTauDiscriminatorContainers = cms.untracked.VInputTag( - cms.InputTag("hpsPFTauBasicDiscriminators"), - cms.InputTag("hpsPFTauDiscriminationByMuonRejection3"), - cms.InputTag("hpsPFTauDiscriminationByMVA6ElectronRejection") - ), - PFTauDiscriminatorContainerWPs = cms.untracked.vstring( - "ByLooseCombinedIsolationDBSumPtCorr3Hits", - "ByLooseMuonRejection3", - "_Tight" + cms.InputTag("hpsPFTauDiscriminationByDecayModeFinding"), + cms.InputTag("hpsPFTauDiscriminationByLooseCombinedIsolationDBSumPtCorr3Hits"), + cms.InputTag("hpsPFTauDiscriminationByLooseMuonRejection3"), + cms.InputTag("hpsPFTauDiscriminationByMVA6TightElectronRejection") ), doPFTaus = cms.untracked.bool(True), ptMin = cms.untracked.double(15.0), @@ -79,24 +73,15 @@ PhiMax = cms.untracked.double(3.15) ) -tau_readOldDiscriminatorFormat.toModify(TauRefProducer.PFTaus, - PFTauDiscriminators = cms.untracked.VInputTag( - cms.InputTag("hpsPFTauDiscriminationByDecayModeFinding"), - cms.InputTag("hpsPFTauDiscriminationByLooseCombinedIsolationDBSumPtCorr3Hits"), - cms.InputTag("hpsPFTauDiscriminationByLooseMuonRejection3"), - cms.InputTag("hpsPFTauDiscriminationByMVA6TightElectronRejection"), - cms.InputTag("hpsPFTauDiscriminationByDecayModeFinding") - ), - PFTauDiscriminatorContainers = cms.untracked.VInputTag(), - PFTauDiscriminatorContainerWPs = cms.untracked.vstring() -) - #----------------------------------MONITORS-------------------------------------------------------------------------- +kEverything = 0 +kVital = 1 from DQMServices.Core.DQMEDAnalyzer import DQMEDAnalyzer hltTauOfflineMonitor_PFTaus = DQMEDAnalyzer('HLTTauDQMOfflineSource', HLTProcessName = cms.untracked.string(hltTauDQMofflineProcess), DQMBaseFolder = cms.untracked.string("HLT/TAU/PFTaus"), + PlotLevel = cms.untracked.int32(kVital), TriggerResultsSrc = cms.untracked.InputTag("TriggerResults", "", hltTauDQMofflineProcess), TriggerEventSrc = cms.untracked.InputTag("hltTriggerSummaryAOD", "", hltTauDQMofflineProcess), L1Plotter = cms.untracked.PSet( diff --git a/DQMOffline/Trigger/src/HLTTauDQML1Plotter.cc b/DQMOffline/Trigger/src/HLTTauDQML1Plotter.cc index 81f3588c01757..32a6549708357 100644 --- a/DQMOffline/Trigger/src/HLTTauDQML1Plotter.cc +++ b/DQMOffline/Trigger/src/HLTTauDQML1Plotter.cc @@ -46,7 +46,7 @@ HLTTauDQML1Plotter::HLTTauDQML1Plotter(const edm::ParameterSet& ps, configValid_ = true; } -void HLTTauDQML1Plotter::bookHistograms(DQMStore::IBooker& iBooker) { +void HLTTauDQML1Plotter::bookHistograms(IWrapper &iWrapper, DQMStore::IBooker &iBooker) { if (!configValid_) return; @@ -62,98 +62,94 @@ void HLTTauDQML1Plotter::bookHistograms(DQMStore::IBooker& iBooker) { //Create the histograms iBooker.setCurrentFolder(triggerTag()); - l1tauEt_ = iBooker.book1D("L1TauEt", "L1 #tau E_{T};L1 #tau E_{T};entries", binsEt_, 0, maxPt_); - l1tauEta_ = iBooker.book1D("L1TauEta", "L1 #tau #eta;L1 #tau #eta;entries", binsEta_, -maxEta_, maxEta_); - l1tauPhi_ = iBooker.book1D("L1TauPhi", "L1 #tau #phi;L1 #tau #phi;entries", binsPhi_, minPhi, maxPhi); + l1tauEt_ = iWrapper.book1D(iBooker, "L1TauEt", "L1 #tau E_{T};L1 #tau E_{T};entries", binsEt_, 0, maxPt_, kVital); + l1tauEta_ = iWrapper.book1D(iBooker, "L1TauEta", "L1 #tau #eta;L1 #tau #eta;entries", binsEta_, -maxEta_, maxEta_); + l1tauPhi_ = iWrapper.book1D(iBooker, "L1TauPhi", "L1 #tau #phi;L1 #tau #phi;entries", binsPhi_, minPhi, maxPhi); - l1isotauEt_ = iBooker.book1D("L1IsoTauEt", "L1 isolated #tau E_{T};L1 #tau E_{T};entries", binsEt_, 0, maxPt_); + l1isotauEt_ = iWrapper.book1D(iBooker, "L1IsoTauEt", "L1 isolated #tau E_{T};L1 #tau E_{T};entries", binsEt_, 0, maxPt_, kVital); l1isotauEta_ = - iBooker.book1D("L1IsoTauEta", "L1 isolated #tau #eta;L1 #tau #eta;entries", binsEta_, -maxEta_, maxEta_); - l1isotauPhi_ = iBooker.book1D("L1IsoTauPhi", "L1 isolated #tau #phi;L1 #tau #phi;entries", binsPhi_, minPhi, maxPhi); + iWrapper.book1D(iBooker, "L1IsoTauEta", "L1 isolated #tau #eta;L1 #tau #eta;entries", binsEta_, -maxEta_, maxEta_); + l1isotauPhi_ = iWrapper.book1D(iBooker, "L1IsoTauPhi", "L1 isolated #tau #phi;L1 #tau #phi;entries", binsPhi_, minPhi, maxPhi); - l1etmEt_ = iBooker.book1D("L1ETM", "L1 ETM E_{T};L1 ETM E_{T};entries", binsEt_, 0, maxPt_); - l1etmPhi_ = iBooker.book1D("L1ETMPhi", "L1 ETM #phi;L1 ETM #phi;entries", binsPhi_, minPhi, maxPhi); + l1etmEt_ = iWrapper.book1D(iBooker, "L1ETM", "L1 ETM E_{T};L1 ETM E_{T};entries", binsEt_, 0, maxPt_, kVital); + l1etmPhi_ = iWrapper.book1D(iBooker, "L1ETMPhi", "L1 ETM #phi;L1 ETM #phi;entries", binsPhi_, minPhi, maxPhi); snprintf(buffer, BUFMAX, "L1 leading #tau E_{T};L1 #tau E_{T};entries"); - firstTauEt_ = iBooker.book1D("L1LeadTauEt", buffer, binsEt_, 0, maxPt_); + firstTauEt_ = iWrapper.book1D(iBooker, "L1LeadTauEt", buffer, binsEt_, 0, maxPt_, kVital); snprintf(buffer, BUFMAX, "L1 leading #tau #eta;L1 #tau #eta;entries"); - firstTauEta_ = iBooker.book1D("L1LeadTauEta", buffer, binsEta_, -maxEta_, maxEta_); + firstTauEta_ = iWrapper.book1D(iBooker, "L1LeadTauEta", buffer, binsEta_, -maxEta_, maxEta_); snprintf(buffer, BUFMAX, "L1 leading #tau #phi;L1 #tau #phi;entries"); - firstTauPhi_ = iBooker.book1D("L1LeadTauPhi", buffer, binsPhi_, minPhi, maxPhi); + firstTauPhi_ = iWrapper.book1D(iBooker, "L1LeadTauPhi", buffer, binsPhi_, minPhi, maxPhi); snprintf(buffer, BUFMAX, "L1 second-leading #tau E_{T};L1 #tau E_{T};entries"); - secondTauEt_ = iBooker.book1D("L1SecondTauEt", buffer, binsEt_, 0, maxPt_); + secondTauEt_ = iWrapper.book1D(iBooker, "L1SecondTauEt", buffer, binsEt_, 0, maxPt_, kVital); snprintf(buffer, BUFMAX, "L1 second-leading #tau #eta;L1 #tau #eta;entries"); - secondTauEta_ = iBooker.book1D("L1SecondTauEta", buffer, binsEta_, -maxEta_, maxEta_); + secondTauEta_ = iWrapper.book1D(iBooker, "L1SecondTauEta", buffer, binsEta_, -maxEta_, maxEta_); snprintf(buffer, BUFMAX, "L1 second-leading #tau #phi;L1 #tau #phi;entries"); - secondTauPhi_ = iBooker.book1D("L1SecondTauPhi", buffer, binsPhi_, minPhi, maxPhi); + secondTauPhi_ = iWrapper.book1D(iBooker, "L1SecondTauPhi", buffer, binsPhi_, minPhi, maxPhi); snprintf(buffer, BUFMAX, "L1 leading isolated #tau E_{T};L1 #tau E_{T};entries"); - firstIsoTauEt_ = iBooker.book1D("L1LeadIsoTauEt", buffer, binsEt_, 0, maxPt_); + firstIsoTauEt_ = iWrapper.book1D(iBooker, "L1LeadIsoTauEt", buffer, binsEt_, 0, maxPt_, kVital); snprintf(buffer, BUFMAX, "L1 leading isolated #tau #eta;L1 #tau #eta;entries"); - firstIsoTauEta_ = iBooker.book1D("L1LeadIsoTauEta", buffer, binsEta_, -maxEta_, maxEta_); + firstIsoTauEta_ = iWrapper.book1D(iBooker, "L1LeadIsoTauEta", buffer, binsEta_, -maxEta_, maxEta_); snprintf(buffer, BUFMAX, "L1 leading isolated #tau #phi;L1 #tau #phi;entries"); - firstIsoTauPhi_ = iBooker.book1D("L1LeadIsoTauPhi", buffer, binsPhi_, minPhi, maxPhi); + firstIsoTauPhi_ = iWrapper.book1D(iBooker, "L1LeadIsoTauPhi", buffer, binsPhi_, minPhi, maxPhi); snprintf(buffer, BUFMAX, "L1 second-leading isolated #tau E_{T};L1 #tau E_{T};entries"); - secondIsoTauEt_ = iBooker.book1D("L1SecondIsoTauEt", buffer, binsEt_, 0, maxPt_); + secondIsoTauEt_ = iWrapper.book1D(iBooker, "L1SecondIsoTauEt", buffer, binsEt_, 0, maxPt_, kVital); snprintf(buffer, BUFMAX, "L1 second-leading isolated #tau #eta;L1 #tau #eta;entries"); - secondIsoTauEta_ = iBooker.book1D("L1SecondIsoTauEta", buffer, binsEta_, -maxEta_, maxEta_); + secondIsoTauEta_ = iWrapper.book1D(iBooker, "L1SecondIsoTauEta", buffer, binsEta_, -maxEta_, maxEta_); snprintf(buffer, BUFMAX, "L1 second-leading isolated #tau #phi;L1 #tau #phi;entries"); - secondIsoTauPhi_ = iBooker.book1D("L1SecondIsoTauPhi", buffer, binsPhi_, minPhi, maxPhi); + secondIsoTauPhi_ = iWrapper.book1D(iBooker, "L1SecondIsoTauPhi", buffer, binsPhi_, minPhi, maxPhi); if (doRefAnalysis_) { - l1tauEtRes_ = iBooker.book1D( - "L1TauEtResol", "L1 #tau E_{T} resolution;[L1 #tau E_{T}-Ref #tau E_{T}]/Ref #tau E_{T};entries", 60, -1, 4); + l1tauEtRes_ = iWrapper.book1D(iBooker, + "L1TauEtResol", "L1 #tau E_{T} resolution;[L1 #tau E_{T}-Ref #tau E_{T}]/Ref #tau E_{T};entries", 60, -1, 4, kVital); l1isotauEtRes_ = - iBooker.book1D("L1IsoTauEtResol", + iWrapper.book1D(iBooker, "L1IsoTauEtResol", "L1 isolated #tau E_{T} resolution;[L1 #tau E_{T}-Ref #tau E_{T}]/Ref #tau E_{T};entries", - 60, - -1, - 4); + 60, -1, 4, kVital); iBooker.setCurrentFolder(triggerTag() + "/helpers"); l1tauEtEffNum_ = - iBooker.book1D("L1TauEtEffNum", "L1 #tau E_{T} Efficiency;Ref #tau E_{T};entries", binsEt_, 0, maxPt_); - l1tauHighEtEffNum_ = iBooker.book1D( - "L1TauHighEtEffNum", "L1 #tau E_{T} Efficiency (high E_{T});Ref #tau E_{T};entries", binsEt_, 0, maxHighPt_); + iWrapper.book1D(iBooker, "L1TauEtEffNum", "L1 #tau E_{T} Efficiency;Ref #tau E_{T};entries", binsEt_, 0, maxPt_, kVital); + l1tauHighEtEffNum_ = iWrapper.book1D(iBooker, + "L1TauHighEtEffNum", "L1 #tau E_{T} Efficiency (high E_{T});Ref #tau E_{T};entries", binsEt_, 0, maxHighPt_, kVital); l1tauEtEffDenom_ = - iBooker.book1D("L1TauEtEffDenom", "L1 #tau E_{T} Denominator;Ref #tau E_{T};entries", binsEt_, 0, maxPt_); - l1tauHighEtEffDenom_ = iBooker.book1D("L1TauHighEtEffDenom", + iWrapper.book1D(iBooker, "L1TauEtEffDenom", "L1 #tau E_{T} Denominator;Ref #tau E_{T};entries", binsEt_, 0, maxPt_); + l1tauHighEtEffDenom_ = iWrapper.book1D(iBooker, "L1TauHighEtEffDenom", "L1 #tau E_{T} Denominator (high E_{T});Ref #tau E_{T};Efficiency", - binsEt_, - 0, - maxHighPt_); + binsEt_, 0, maxHighPt_, kVital); l1tauEtaEffNum_ = - iBooker.book1D("L1TauEtaEffNum", "L1 #tau #eta Efficiency;Ref #tau #eta;entries", binsEta_, -maxEta_, maxEta_); - l1tauEtaEffDenom_ = iBooker.book1D( + iWrapper.book1D(iBooker, "L1TauEtaEffNum", "L1 #tau #eta Efficiency;Ref #tau #eta;entries", binsEta_, -maxEta_, maxEta_); + l1tauEtaEffDenom_ = iWrapper.book1D(iBooker, "L1TauEtaEffDenom", "L1 #tau #eta Denominator;Ref #tau #eta;entries", binsEta_, -maxEta_, maxEta_); l1tauPhiEffNum_ = - iBooker.book1D("L1TauPhiEffNum", "L1 #tau #phi Efficiency;Ref #tau #phi;entries", binsPhi_, minPhi, maxPhi); - l1tauPhiEffDenom_ = iBooker.book1D( + iWrapper.book1D(iBooker, "L1TauPhiEffNum", "L1 #tau #phi Efficiency;Ref #tau #phi;entries", binsPhi_, minPhi, maxPhi); + l1tauPhiEffDenom_ = iWrapper.book1D(iBooker, "L1TauPhiEffDenom", "L1 #tau #phi Denominator;Ref #tau #phi;Efficiency", binsPhi_, minPhi, maxPhi); - l1isotauEtEffNum_ = iBooker.book1D( - "L1IsoTauEtEffNum", "L1 isolated #tau E_{T} Efficiency;Ref #tau E_{T};entries", binsEt_, 0, maxPt_); - l1isotauEtEffDenom_ = iBooker.book1D( - "L1IsoTauEtEffDenom", "L1 isolated #tau E_{T} Denominator;Ref #tau E_{T};entries", binsEt_, 0, maxPt_); + l1isotauEtEffNum_ = iWrapper.book1D(iBooker, + "L1IsoTauEtEffNum", "L1 isolated #tau E_{T} Efficiency;Ref #tau E_{T};entries", binsEt_, 0, maxPt_, kVital); + l1isotauEtEffDenom_ = iWrapper.book1D(iBooker, + "L1IsoTauEtEffDenom", "L1 isolated #tau E_{T} Denominator;Ref #tau E_{T};entries", binsEt_, 0, maxPt_, kVital); - l1isotauEtaEffNum_ = iBooker.book1D( + l1isotauEtaEffNum_ = iWrapper.book1D(iBooker, "L1IsoTauEtaEffNum", "L1 isolated #tau #eta Efficiency;Ref #tau #eta;entries", binsEta_, -maxEta_, maxEta_); - l1isotauEtaEffDenom_ = iBooker.book1D( + l1isotauEtaEffDenom_ = iWrapper.book1D(iBooker, "L1IsoTauEtaEffDenom", "L1 isolated #tau #eta Denominator;Ref #tau #eta;entries", binsEta_, -maxEta_, maxEta_); - l1isotauPhiEffNum_ = iBooker.book1D( + l1isotauPhiEffNum_ = iWrapper.book1D(iBooker, "L1IsoTauPhiEffNum", "L1 isolated #tau #phi Efficiency;Ref #tau #phi;entries", binsPhi_, minPhi, maxPhi); - l1isotauPhiEffDenom_ = iBooker.book1D( + l1isotauPhiEffDenom_ = iWrapper.book1D(iBooker, "L1IsoTauPhiEffDenom", "L1 isolated #tau #phi Denominator;Ref #tau #phi;Efficiency", binsPhi_, minPhi, maxPhi); - l1etmEtEffNum_ = iBooker.book1D("L1ETMEtEffNum", "L1 ETM Efficiency;Ref MET;entries", binsEt_, 0, maxPt_); - l1etmEtEffDenom_ = iBooker.book1D("L1ETMEtEffDenom", "L1 ETM Denominator;Ref MET;entries", binsEt_, 0, maxPt_); + l1etmEtEffNum_ = iWrapper.book1D(iBooker, "L1ETMEtEffNum", "L1 ETM Efficiency;Ref MET;entries", binsEt_, 0, maxPt_); + l1etmEtEffDenom_ = iWrapper.book1D(iBooker, "L1ETMEtEffDenom", "L1 ETM Denominator;Ref MET;entries", binsEt_, 0, maxPt_); } } @@ -169,19 +165,19 @@ void HLTTauDQML1Plotter::analyze(const edm::Event& iEvent, if (doRefAnalysis_) { //Tau reference for (auto const& tau : refC.taus) { - l1tauEtEffDenom_->Fill(tau.pt()); - l1tauHighEtEffDenom_->Fill(tau.pt()); + if(l1tauEtEffDenom_) l1tauEtEffDenom_->Fill(tau.pt()); + if(l1tauHighEtEffDenom_) l1tauHighEtEffDenom_->Fill(tau.pt()); - l1tauEtaEffDenom_->Fill(tau.eta()); + if(l1tauEtaEffDenom_) l1tauEtaEffDenom_->Fill(tau.eta()); - l1tauPhiEffDenom_->Fill(tau.phi()); + if(l1tauPhiEffDenom_) l1tauPhiEffDenom_->Fill(tau.phi()); - l1isotauEtEffDenom_->Fill(tau.pt()); - l1isotauEtaEffDenom_->Fill(tau.eta()); - l1isotauPhiEffDenom_->Fill(tau.phi()); + if(l1isotauEtEffDenom_) l1isotauEtEffDenom_->Fill(tau.pt()); + if(l1isotauEtaEffDenom_) l1isotauEtaEffDenom_->Fill(tau.eta()); + if(l1isotauPhiEffDenom_) l1isotauPhiEffDenom_->Fill(tau.phi()); } if (!refC.met.empty()) - l1etmEtEffDenom_->Fill(refC.met[0].pt()); + if(l1etmEtEffDenom_) l1etmEtEffDenom_->Fill(refC.met[0].pt()); } //Analyze L1 Objects (Tau+Jets) @@ -205,14 +201,14 @@ void HLTTauDQML1Plotter::analyze(const edm::Event& iEvent, if (i.hwIso() > 0) l1isotaus.push_back(i.p4()); if (!doRefAnalysis_) { - l1tauEt_->Fill(i.et()); - l1tauEta_->Fill(i.eta()); - l1tauPhi_->Fill(i.phi()); + if(l1tauEt_) l1tauEt_->Fill(i.et()); + if(l1tauEta_) l1tauEta_->Fill(i.eta()); + if(l1tauPhi_) l1tauPhi_->Fill(i.phi()); pathTaus.push_back(i.p4()); - l1isotauEt_->Fill(i.et()); - l1isotauEta_->Fill(i.eta()); - l1isotauPhi_->Fill(i.phi()); + if(l1isotauEt_) l1isotauEt_->Fill(i.et()); + if(l1isotauEta_) l1isotauEta_->Fill(i.eta()); + if(l1isotauPhi_) l1isotauPhi_->Fill(i.phi()); if (i.hwIso() > 0) pathIsoTaus.push_back(i.p4()); } @@ -228,7 +224,7 @@ void HLTTauDQML1Plotter::analyze(const edm::Event& iEvent, for (auto it = sums->begin(ibx); it != sums->end(ibx); it++) { auto type = static_cast(it->getType()); if (type == l1t::EtSum::EtSumType::kMissingEt) - l1etmEt_->Fill(it->et()); + if(l1etmEt_) l1etmEt_->Fill(it->et()); } } } @@ -242,30 +238,30 @@ void HLTTauDQML1Plotter::analyze(const edm::Event& iEvent, for (auto const& tau : refC.taus) { std::pair m = match(tau, l1taus, matchDeltaR_); if (m.first) { - l1tauEt_->Fill(m.second.pt()); - l1tauEta_->Fill(m.second.eta()); - l1tauPhi_->Fill(m.second.phi()); + if(l1tauEt_) l1tauEt_->Fill(m.second.pt()); + if(l1tauEta_) l1tauEta_->Fill(m.second.eta()); + if(l1tauPhi_) l1tauPhi_->Fill(m.second.phi()); - l1tauEtEffNum_->Fill(tau.pt()); - l1tauHighEtEffNum_->Fill(tau.pt()); - l1tauEtaEffNum_->Fill(tau.eta()); - l1tauPhiEffNum_->Fill(tau.phi()); + if(l1tauEtEffNum_) l1tauEtEffNum_->Fill(tau.pt()); + if(l1tauHighEtEffNum_) l1tauHighEtEffNum_->Fill(tau.pt()); + if(l1tauEtaEffNum_) l1tauEtaEffNum_->Fill(tau.eta()); + if(l1tauPhiEffNum_) l1tauPhiEffNum_->Fill(tau.phi()); - l1tauEtRes_->Fill((m.second.pt() - tau.pt()) / tau.pt()); + if(l1tauEtRes_) l1tauEtRes_->Fill((m.second.pt() - tau.pt()) / tau.pt()); pathTaus.push_back(m.second); } m = match(tau, l1isotaus, matchDeltaR_); if (m.first) { - l1isotauEt_->Fill(m.second.pt()); - l1isotauEta_->Fill(m.second.eta()); - l1isotauPhi_->Fill(m.second.phi()); + if(l1isotauEt_) l1isotauEt_->Fill(m.second.pt()); + if(l1isotauEta_) l1isotauEta_->Fill(m.second.eta()); + if(l1isotauPhi_) l1isotauPhi_->Fill(m.second.phi()); - l1isotauEtEffNum_->Fill(tau.pt()); - l1isotauEtaEffNum_->Fill(tau.eta()); - l1isotauPhiEffNum_->Fill(tau.phi()); + if(l1isotauEtEffNum_) l1isotauEtEffNum_->Fill(tau.pt()); + if(l1isotauEtaEffNum_) l1isotauEtaEffNum_->Fill(tau.eta()); + if(l1isotauPhiEffNum_) l1isotauPhiEffNum_->Fill(tau.phi()); - l1isotauEtRes_->Fill((m.second.pt() - tau.pt()) / tau.pt()); + if(l1isotauEtRes_) l1isotauEtRes_->Fill((m.second.pt() - tau.pt()) / tau.pt()); pathIsoTaus.push_back(m.second); } @@ -276,11 +272,11 @@ void HLTTauDQML1Plotter::analyze(const edm::Event& iEvent, for (auto it = sums->begin(ibx); it != sums->end(ibx); it++) { auto type = static_cast(it->getType()); if (type == l1t::EtSum::EtSumType::kMissingEt) { - l1etmEt_->Fill(it->et()); - l1etmPhi_->Fill(it->phi()); + if(l1etmEt_) l1etmEt_->Fill(it->et()); + if(l1etmPhi_) l1etmPhi_->Fill(it->phi()); if (it->et() > l1ETMMin_) { - l1etmEtEffNum_->Fill(it->et()); + if(l1etmEtEffNum_) l1etmEtEffNum_->Fill(it->et()); } } } @@ -292,25 +288,25 @@ void HLTTauDQML1Plotter::analyze(const edm::Event& iEvent, if (pathTaus.size() > 1) std::sort(pathTaus.begin(), pathTaus.end(), [](const LV& a, const LV& b) { return a.pt() > b.pt(); }); if (!pathTaus.empty()) { - firstTauEt_->Fill(pathTaus[0].pt()); - firstTauEta_->Fill(pathTaus[0].eta()); - firstTauPhi_->Fill(pathTaus[0].phi()); + if(firstTauEt_) firstTauEt_->Fill(pathTaus[0].pt()); + if(firstTauEta_) firstTauEta_->Fill(pathTaus[0].eta()); + if(firstTauPhi_) firstTauPhi_->Fill(pathTaus[0].phi()); } if (pathTaus.size() > 1) { - secondTauEt_->Fill(pathTaus[1].pt()); - secondTauEta_->Fill(pathTaus[1].eta()); - secondTauPhi_->Fill(pathTaus[1].phi()); + if(secondTauEt_) secondTauEt_->Fill(pathTaus[1].pt()); + if(secondTauEta_) secondTauEta_->Fill(pathTaus[1].eta()); + if(secondTauPhi_) secondTauPhi_->Fill(pathTaus[1].phi()); } if (pathIsoTaus.size() > 1) std::sort(pathIsoTaus.begin(), pathIsoTaus.end(), [](const LV& a, const LV& b) { return a.pt() > b.pt(); }); if (!pathIsoTaus.empty()) { - firstIsoTauEt_->Fill(pathIsoTaus[0].pt()); - firstIsoTauEta_->Fill(pathIsoTaus[0].eta()); - firstIsoTauPhi_->Fill(pathIsoTaus[0].phi()); + if(firstIsoTauEt_) firstIsoTauEt_->Fill(pathIsoTaus[0].pt()); + if(firstIsoTauEta_) firstIsoTauEta_->Fill(pathIsoTaus[0].eta()); + if(firstIsoTauPhi_) firstIsoTauPhi_->Fill(pathIsoTaus[0].phi()); } if (pathIsoTaus.size() > 1) { - secondIsoTauEt_->Fill(pathIsoTaus[1].pt()); - secondIsoTauEta_->Fill(pathIsoTaus[1].eta()); - secondIsoTauPhi_->Fill(pathIsoTaus[1].phi()); + if(secondIsoTauEt_) secondIsoTauEt_->Fill(pathIsoTaus[1].pt()); + if(secondIsoTauEta_) secondIsoTauEta_->Fill(pathIsoTaus[1].eta()); + if(secondIsoTauPhi_) secondIsoTauPhi_->Fill(pathIsoTaus[1].phi()); } } diff --git a/DQMOffline/Trigger/src/HLTTauDQMPathPlotter.cc b/DQMOffline/Trigger/src/HLTTauDQMPathPlotter.cc index fdd69a246a402..606cf57877a6d 100644 --- a/DQMOffline/Trigger/src/HLTTauDQMPathPlotter.cc +++ b/DQMOffline/Trigger/src/HLTTauDQMPathPlotter.cc @@ -38,142 +38,130 @@ HLTTauDQMPathPlotter::HLTTauDQMPathPlotter(const std::string& pathName, } #include -void HLTTauDQMPathPlotter::bookHistograms(DQMStore::IBooker& iBooker) { +//void HLTTauDQMPathPlotter::bookHistograms(DQMStore::IBooker& iBooker) { +void HLTTauDQMPathPlotter::bookHistograms(IWrapper & iWrapper, DQMStore::IBooker &iBooker) { if (!isValid()) return; // Book histograms iBooker.setCurrentFolder(triggerTag()); - hAcceptedEvents_ = iBooker.book1D( - "EventsPerFilter", "Accepted Events per filter;;entries", hltPath_.filtersSize(), 0, hltPath_.filtersSize()); + hAcceptedEvents_ = iWrapper.book1D(iBooker, + "EventsPerFilter", "Accepted Events per filter;;entries", hltPath_.filtersSize(), 0, hltPath_.filtersSize(), kEverything); for (size_t i = 0; i < hltPath_.filtersSize(); ++i) { - hAcceptedEvents_->setBinLabel(i + 1, hltPath_.getFilterName(i)); + if(hAcceptedEvents_) hAcceptedEvents_->setBinLabel(i + 1, hltPath_.getFilterName(i)); } // Efficiency helpers if (doRefAnalysis_) { iBooker.setCurrentFolder(triggerTag() + "/helpers"); if (hltPath_.hasL2Taus()) { - hL2TrigTauEtEffNum_ = - iBooker.book1D("L2TrigTauEtEffNum", "L2 #tau p_{T} efficiency;Ref #tau p_{T};entries", ptbins_, 0, ptmax_); - hL2TrigTauEtEffDenom_ = iBooker.book1D( - "L2TrigTauEtEffDenom", "L2 #tau p_{T} denominator;Ref #tau p_{T};Efficiency", ptbins_, 0, ptmax_); + hL2TrigTauEtEffNum_ = iWrapper.book1D(iBooker, "L2TrigTauEtEffNum", "L2 #tau p_{T} efficiency;Ref #tau p_{T};entries", ptbins_, 0, ptmax_, kVital); + hL2TrigTauEtEffDenom_ = iWrapper.book1D(iBooker, + "L2TrigTauEtEffDenom", "L2 #tau p_{T} denominator;Ref #tau p_{T};Efficiency", ptbins_, 0, ptmax_, kVital); hL2TrigTauEtaEffNum_ = - iBooker.book1D("L2TrigTauEtaEffNum", "L2 #tau #eta efficiency;Ref #tau #eta;entries", etabins_, -2.5, 2.5); - hL2TrigTauEtaEffDenom_ = iBooker.book1D( - "L2TrigTauEtaEffDenom", "L2 #tau #eta denominator;Ref #tau #eta;Efficiency", etabins_, -2.5, 2.5); + iWrapper.book1D(iBooker, "L2TrigTauEtaEffNum", "L2 #tau #eta efficiency;Ref #tau #eta;entries", etabins_, -2.5, 2.5, kEverything); + hL2TrigTauEtaEffDenom_ = iWrapper.book1D(iBooker, + "L2TrigTauEtaEffDenom", "L2 #tau #eta denominator;Ref #tau #eta;Efficiency", etabins_, -2.5, 2.5, kEverything); hL2TrigTauPhiEffNum_ = - iBooker.book1D("L2TrigTauPhiEffNum", "L2 #tau #phi efficiency;Ref #tau #phi;entries", phibins_, -3.2, 3.2); - hL2TrigTauPhiEffDenom_ = iBooker.book1D( + iWrapper.book1D(iBooker, "L2TrigTauPhiEffNum", "L2 #tau #phi efficiency;Ref #tau #phi;entries", phibins_, -3.2, 3.2, kEverything); + hL2TrigTauPhiEffDenom_ = iWrapper.book1D(iBooker, "L2TrigTauPhiEffDenom", "L2 #tau #phi denominator;Ref #tau #phi;Efficiency", phibins_, -3.2, 3.2); - hL2TrigTauHighEtEffNum_ = iBooker.book1D("L2TrigTauHighEtEffNum", + hL2TrigTauHighEtEffNum_ = iWrapper.book1D(iBooker, "L2TrigTauHighEtEffNum", "L2 #tau p_{T} efficiency (high p_{T});Ref #tau p_{T};entries", ptbins_, 0, - highptmax_); - hL2TrigTauHighEtEffDenom_ = iBooker.book1D("L2TrigTauHighEtEffDenom", + highptmax_, kVital); + hL2TrigTauHighEtEffDenom_ = iWrapper.book1D(iBooker, "L2TrigTauHighEtEffDenom", "L2 #tau p_{T} denominator (high p_{T});Ref #tau p_{T};Efficiency", ptbins_, 0, - highptmax_); + highptmax_, kVital); } if (hltPath_.hasL3Taus()) { hL3TrigTauEtEffNum_ = - iBooker.book1D("L3TrigTauEtEffNum", "L3 #tau p_{T} efficiency;Ref #tau p_{T};entries", ptbins_, 0, ptmax_); - hL3TrigTauEtEffDenom_ = iBooker.book1D( - "L3TrigTauEtEffDenom", "L3 #tau p_{T} denominator;Ref #tau p_{T};Efficiency", ptbins_, 0, ptmax_); + iWrapper.book1D(iBooker, "L3TrigTauEtEffNum", "L3 #tau p_{T} efficiency;Ref #tau p_{T};entries", ptbins_, 0, ptmax_, kEverything); + hL3TrigTauEtEffDenom_ = iWrapper.book1D(iBooker, "L3TrigTauEtEffDenom", "L3 #tau p_{T} denominator;Ref #tau p_{T};Efficiency", ptbins_, 0, ptmax_, kVital); hL3TrigTauEtaEffNum_ = - iBooker.book1D("L3TrigTauEtaEffNum", "L3 #tau #eta efficiency;Ref #tau #eta;entries", etabins_, -2.5, 2.5); - hL3TrigTauEtaEffDenom_ = iBooker.book1D( - "L3TrigTauEtaEffDenom", "L3 #tau #eta denominator;Ref #tau #eta;Efficiency", etabins_, -2.5, 2.5); + iWrapper.book1D(iBooker, "L3TrigTauEtaEffNum", "L3 #tau #eta efficiency;Ref #tau #eta;entries", etabins_, -2.5, 2.5, kVital); + hL3TrigTauEtaEffDenom_ = iWrapper.book1D(iBooker, "L3TrigTauEtaEffDenom", "L3 #tau #eta denominator;Ref #tau #eta;Efficiency", etabins_, -2.5, 2.5, kEverything); hL3TrigTauPhiEffNum_ = - iBooker.book1D("L3TrigTauPhiEffNum", "L3 #tau #phi efficiency;Ref #tau #phi;entries", phibins_, -3.2, 3.2); - hL3TrigTauPhiEffDenom_ = iBooker.book1D( - "L3TrigTauPhiEffDenom", "L3 #tau #phi denominator;Ref #tau #phi;Efficiency", phibins_, -3.2, 3.2); - hL3TrigTauHighEtEffNum_ = iBooker.book1D("L3TrigTauHighEtEffNum", + iWrapper.book1D(iBooker, "L3TrigTauPhiEffNum", "L3 #tau #phi efficiency;Ref #tau #phi;entries", phibins_, -3.2, 3.2, kEverything); + hL3TrigTauPhiEffDenom_ = iWrapper.book1D(iBooker, "L3TrigTauPhiEffDenom", "L3 #tau #phi denominator;Ref #tau #phi;Efficiency", phibins_, -3.2, 3.2, kEverything); + hL3TrigTauHighEtEffNum_ = iWrapper.book1D(iBooker, "L3TrigTauHighEtEffNum", "L3 #tau p_{T} efficiency (high p_{T});Ref #tau p_{T};entries", ptbins_, 0, - highptmax_); - hL3TrigTauHighEtEffDenom_ = iBooker.book1D("L3TrigTauHighEtEffDenom", + highptmax_, kVital); + hL3TrigTauHighEtEffDenom_ = iWrapper.book1D(iBooker, "L3TrigTauHighEtEffDenom", "L3 #tau p_{T} denominator (high p_{T});Ref #tau p_{T};Efficiency", ptbins_, 0, - highptmax_); - hL3TrigTauEtaPhiEffNum_ = iBooker.book2D( - "L3TrigTauEtaPhiEffNum", "L3 efficiency in eta-phi plane", etabins_, -2.5, 2.5, phibins_, -3.2, 3.2); - hL3TrigTauEtaPhiEffDenom_ = iBooker.book2D( - "L3TrigTauEtaPhiEffDenom", "L3 denominator in eta-phi plane", etabins_, -2.5, 2.5, phibins_, -3.2, 3.2); - hL3TrigTauEtaPhiEffDenom_->setOption("COL"); + highptmax_, kVital); + hL3TrigTauEtaPhiEffNum_ = iWrapper.book2D(iBooker, "L3TrigTauEtaPhiEffNum", "L3 efficiency in eta-phi plane", etabins_, -2.5, 2.5, phibins_, -3.2, 3.2, kEverything); + hL3TrigTauEtaPhiEffDenom_ = iWrapper.book2D(iBooker, "L3TrigTauEtaPhiEffDenom", "L3 denominator in eta-phi plane", etabins_, -2.5, 2.5, phibins_, -3.2, 3.2, kEverything); + if(hL3TrigTauEtaPhiEffDenom_) hL3TrigTauEtaPhiEffDenom_->setOption("COL"); } if (hltPath_.hasL2Electrons()) { - hL2TrigElectronEtEffNum_ = iBooker.book1D( - "L2TrigElectronEtEffNum", "L2 electron p_{T} efficiency;Ref electron p_{T};entries", ptbins_, 0, ptmax_); - hL2TrigElectronEtEffDenom_ = iBooker.book1D( - "L2TrigElectronEtEffDenom", "L2 electron p_{T} denominator;Ref electron p_{T};Efficiency", ptbins_, 0, ptmax_); - hL2TrigElectronEtaEffNum_ = iBooker.book1D( - "L2TrigElectronEtaEffNum", "L2 electron #eta efficiency;Ref electron #eta;entries", etabins_, -2.5, 2.5); - hL2TrigElectronEtaEffDenom_ = iBooker.book1D( - "L2TrigElectronEtaEffDenom", "L2 electron #eta denominator;Ref electron #eta;Efficiency", etabins_, -2.5, 2.5); - hL2TrigElectronPhiEffNum_ = iBooker.book1D( - "L2TrigElectronPhiEffNum", "L2 electron #phi efficiency;Ref electron #phi;entries", phibins_, -3.2, 3.2); - hL2TrigElectronPhiEffDenom_ = iBooker.book1D( - "L2TrigElectronPhiEffDenom", "L2 electron #phi denominator;Ref electron #phi;Efficiency", phibins_, -3.2, 3.2); + hL2TrigElectronEtEffNum_ = iWrapper.book1D(iBooker, "L2TrigElectronEtEffNum", "L2 electron p_{T} efficiency;Ref electron p_{T};entries", ptbins_, 0, ptmax_, kVital); + hL2TrigElectronEtEffDenom_ = iWrapper.book1D(iBooker, "L2TrigElectronEtEffDenom", "L2 electron p_{T} denominator;Ref electron p_{T};Efficiency", ptbins_, 0, ptmax_, kVital); + hL2TrigElectronEtaEffNum_ = iWrapper.book1D(iBooker, "L2TrigElectronEtaEffNum", "L2 electron #eta efficiency;Ref electron #eta;entries", etabins_, -2.5, 2.5, kEverything); + hL2TrigElectronEtaEffDenom_ = iWrapper.book1D(iBooker, "L2TrigElectronEtaEffDenom", "L2 electron #eta denominator;Ref electron #eta;Efficiency", etabins_, -2.5, 2.5, kEverything); + hL2TrigElectronPhiEffNum_ = iWrapper.book1D(iBooker, "L2TrigElectronPhiEffNum", "L2 electron #phi efficiency;Ref electron #phi;entries", phibins_, -3.2, 3.2, kEverything); + hL2TrigElectronPhiEffDenom_ = iWrapper.book1D(iBooker, "L2TrigElectronPhiEffDenom", "L2 electron #phi denominator;Ref electron #phi;Efficiency", phibins_, -3.2, 3.2, kEverything); } if (hltPath_.hasL3Electrons()) { - hL3TrigElectronEtEffNum_ = iBooker.book1D( - "L3TrigElectronEtEffNum", "L3 electron p_{T} efficiency;Ref electron p_{T};entries", ptbins_, 0, ptmax_); - hL3TrigElectronEtEffDenom_ = iBooker.book1D( - "L3TrigElectronEtEffDenom", "L3 electron p_{T} denominator;Ref electron p_{T};Efficiency", ptbins_, 0, ptmax_); - hL3TrigElectronEtaEffNum_ = iBooker.book1D( - "L3TrigElectronEtaEffNum", "L3 electron #eta efficiency;Ref electron #eta;entries", etabins_, -2.5, 2.5); - hL3TrigElectronEtaEffDenom_ = iBooker.book1D( - "L3TrigElectronEtaEffDenom", "L3 electron #eta denominator;Ref electron #eta;Efficiency", etabins_, -2.5, 2.5); - hL3TrigElectronPhiEffNum_ = iBooker.book1D( - "L3TrigElectronPhiEffNum", "L3 electron #phi efficiency;Ref electron #phi;entries", phibins_, -3.2, 3.2); - hL3TrigElectronPhiEffDenom_ = iBooker.book1D( - "L3TrigElectronPhiEffDenom", "L3 electron #phi denominator;Ref electron #phi;Efficiency", phibins_, -3.2, 3.2); + hL3TrigElectronEtEffNum_ = iWrapper.book1D(iBooker, + "L3TrigElectronEtEffNum", "L3 electron p_{T} efficiency;Ref electron p_{T};entries", ptbins_, 0, ptmax_, kVital); + hL3TrigElectronEtEffDenom_ = iWrapper.book1D(iBooker, + "L3TrigElectronEtEffDenom", "L3 electron p_{T} denominator;Ref electron p_{T};Efficiency", ptbins_, 0, ptmax_, kVital); + hL3TrigElectronEtaEffNum_ = iWrapper.book1D(iBooker, + "L3TrigElectronEtaEffNum", "L3 electron #eta efficiency;Ref electron #eta;entries", etabins_, -2.5, 2.5, kEverything); + hL3TrigElectronEtaEffDenom_ = iWrapper.book1D(iBooker, + "L3TrigElectronEtaEffDenom", "L3 electron #eta denominator;Ref electron #eta;Efficiency", etabins_, -2.5, 2.5, kEverything); + hL3TrigElectronPhiEffNum_ = iWrapper.book1D(iBooker, + "L3TrigElectronPhiEffNum", "L3 electron #phi efficiency;Ref electron #phi;entries", phibins_, -3.2, 3.2, kEverything); + hL3TrigElectronPhiEffDenom_ = iWrapper.book1D(iBooker, + "L3TrigElectronPhiEffDenom", "L3 electron #phi denominator;Ref electron #phi;Efficiency", phibins_, -3.2, 3.2, kEverything); } if (hltPath_.hasL2Muons()) { hL2TrigMuonEtEffNum_ = - iBooker.book1D("L2TrigMuonEtEffNum", "L2 muon p_{T} efficiency;Ref muon p_{T};entries", ptbins_, 0, ptmax_); - hL2TrigMuonEtEffDenom_ = iBooker.book1D( - "L2TrigMuonEtEffDenom", "L2 muon p_{T} denominator;Ref muon p_{T};Efficiency", ptbins_, 0, ptmax_); + iWrapper.book1D(iBooker, "L2TrigMuonEtEffNum", "L2 muon p_{T} efficiency;Ref muon p_{T};entries", ptbins_, 0, ptmax_, kVital); + hL2TrigMuonEtEffDenom_ = iWrapper.book1D(iBooker, "L2TrigMuonEtEffDenom", "L2 muon p_{T} denominator;Ref muon p_{T};Efficiency", ptbins_, 0, ptmax_, kVital); hL2TrigMuonEtaEffNum_ = - iBooker.book1D("L2TrigMuonEtaEffNum", "L2 muon #eta efficiency;Ref muon #eta;entries", etabins_, -2.5, 2.5); - hL2TrigMuonEtaEffDenom_ = iBooker.book1D( - "L2TrigMuonEtaEffDenom", "L2 muon #eta denominator;Ref muon #eta;Efficiency", etabins_, -2.5, 2.5); + iWrapper.book1D(iBooker, "L2TrigMuonEtaEffNum", "L2 muon #eta efficiency;Ref muon #eta;entries", etabins_, -2.5, 2.5, kVital); + hL2TrigMuonEtaEffDenom_ = iWrapper.book1D(iBooker, + "L2TrigMuonEtaEffDenom", "L2 muon #eta denominator;Ref muon #eta;Efficiency", etabins_, -2.5, 2.5, kEverything); hL2TrigMuonPhiEffNum_ = - iBooker.book1D("L2TrigMuonPhiEffNum", "L2 muon #phi efficiency;Ref muon #phi;entries", phibins_, -3.2, 3.2); - hL2TrigMuonPhiEffDenom_ = iBooker.book1D( - "L2TrigMuonPhiEffDenom", "L2 muon #phi denominator;Ref muon #phi;Efficiency", phibins_, -3.2, 3.2); + iWrapper.book1D(iBooker, "L2TrigMuonPhiEffNum", "L2 muon #phi efficiency;Ref muon #phi;entries", phibins_, -3.2, 3.2, kEverything); + hL2TrigMuonPhiEffDenom_ = iWrapper.book1D(iBooker, + "L2TrigMuonPhiEffDenom", "L2 muon #phi denominator;Ref muon #phi;Efficiency", phibins_, -3.2, 3.2, kEverything); } if (hltPath_.hasL3Muons()) { hL3TrigMuonEtEffNum_ = - iBooker.book1D("L3TrigMuonEtEffNum", "L3 muon p_{T} efficiency;Ref muon p_{T};entries", ptbins_, 0, ptmax_); - hL3TrigMuonEtEffDenom_ = iBooker.book1D( - "L3TrigMuonEtEffDenom", "L3 muon p_{T} denominator;Ref muon p_{T};Efficiency", ptbins_, 0, ptmax_); + iWrapper.book1D(iBooker, "L3TrigMuonEtEffNum", "L3 muon p_{T} efficiency;Ref muon p_{T};entries", ptbins_, 0, ptmax_, kVital); + hL3TrigMuonEtEffDenom_ = iWrapper.book1D(iBooker, + "L3TrigMuonEtEffDenom", "L3 muon p_{T} denominator;Ref muon p_{T};Efficiency", ptbins_, 0, ptmax_, kVital); hL3TrigMuonEtaEffNum_ = - iBooker.book1D("L3TrigMuonEtaEffNum", "L3 muon #eta efficiency;Ref muon #eta;entries", etabins_, -2.5, 2.5); - hL3TrigMuonEtaEffDenom_ = iBooker.book1D( - "L3TrigMuonEtaEffDenom", "L3 muon #eta denominator;Ref muon #eta;Efficiency", etabins_, -2.5, 2.5); + iWrapper.book1D(iBooker, "L3TrigMuonEtaEffNum", "L3 muon #eta efficiency;Ref muon #eta;entries", etabins_, -2.5, 2.5, kEverything); + hL3TrigMuonEtaEffDenom_ = iWrapper.book1D(iBooker, + "L3TrigMuonEtaEffDenom", "L3 muon #eta denominator;Ref muon #eta;Efficiency", etabins_, -2.5, 2.5, kEverything); hL3TrigMuonPhiEffNum_ = - iBooker.book1D("L3TrigMuonPhiEffNum", "L3 muon #phi efficiency;Ref muon #phi;entries", phibins_, -3.2, 3.2); - hL3TrigMuonPhiEffDenom_ = iBooker.book1D( - "L3TrigMuonPhiEffDenom", "L3 muon #phi denominator;Ref muon #phi;Efficiency", phibins_, -3.2, 3.2); + iWrapper.book1D(iBooker, "L3TrigMuonPhiEffNum", "L3 muon #phi efficiency;Ref muon #phi;entries", phibins_, -3.2, 3.2, kEverything); + hL3TrigMuonPhiEffDenom_ = iWrapper.book1D(iBooker, + "L3TrigMuonPhiEffDenom", "L3 muon #phi denominator;Ref muon #phi;Efficiency", phibins_, -3.2, 3.2, kEverything); } if (hltPath_.hasL2CaloMET()) { hL2TrigMETEtEffNum_ = - iBooker.book1D("L2TrigMETEtEffNum", "L2 MET efficiency;Ref MET;entries", ptbins_, 0, ptmax_); + iWrapper.book1D(iBooker, "L2TrigMETEtEffNum", "L2 MET efficiency;Ref MET;entries", ptbins_, 0, ptmax_, kVital); hL2TrigMETEtEffDenom_ = - iBooker.book1D("L2TrigMETEtEffDenom", "L2 MET denominator;Ref MET;Efficiency", ptbins_, 0, ptmax_); + iWrapper.book1D(iBooker, "L2TrigMETEtEffDenom", "L2 MET denominator;Ref MET;Efficiency", ptbins_, 0, ptmax_, kVital); } iBooker.setCurrentFolder(triggerTag()); @@ -196,36 +184,36 @@ void HLTTauDQMPathPlotter::bookHistograms(DQMStore::IBooker& iBooker) { nmet = hltPath_.getFilterMET(lastMatchedMETFilter); auto create = [&](const std::string& name) { if (name == "tau-met") { - this->hMass_ = iBooker.book1D( + this->hMass_ = iWrapper.book1D(iBooker, "ReferenceMass", "Transverse mass of reference " + name + ";Reference transverse mass;entries", 100, 0, 500); } else { - this->hMass_ = iBooker.book1D( + this->hMass_ = iWrapper.book1D(iBooker, "ReferenceMass", "Invariant mass of reference " + name + ";Reference invariant mass;entries", 100, 0, 500); } }; LogDebug("HLTTauDQMOffline") << "Path " << hltPath_.getPathName() << " number of taus " << ntaus << " electrons " << neles << " muons " << nmus; if (ntaus > 0) { - hTrigTauEt_ = iBooker.book1D("TrigTauEt", "Triggered #tau p_{T};#tau p_{T};entries", ptbins_, 0, ptmax_); - hTrigTauEta_ = iBooker.book1D("TrigTauEta", "Triggered #tau #eta;#tau #eta;entries", etabins_, -2.5, 2.5); - hTrigTauPhi_ = iBooker.book1D("TrigTauPhi", "Triggered #tau #phi;#tau #phi;entries", phibins_, -3.2, 3.2); + hTrigTauEt_ = iWrapper.book1D(iBooker, "TrigTauEt", "Triggered #tau p_{T};#tau p_{T};entries", ptbins_, 0, ptmax_); + hTrigTauEta_ = iWrapper.book1D(iBooker, "TrigTauEta", "Triggered #tau #eta;#tau #eta;entries", etabins_, -2.5, 2.5); + hTrigTauPhi_ = iWrapper.book1D(iBooker, "TrigTauPhi", "Triggered #tau #phi;#tau #phi;entries", phibins_, -3.2, 3.2); } if (neles > 0) { hTrigElectronEt_ = - iBooker.book1D("TrigElectronEt", "Triggered electron p_{T};electron p_{T};entries", ptbins_, 0, ptmax_); + iWrapper.book1D(iBooker, "TrigElectronEt", "Triggered electron p_{T};electron p_{T};entries", ptbins_, 0, ptmax_); hTrigElectronEta_ = - iBooker.book1D("TrigElectronEta", "Triggered electron #eta;electron #eta;entries", etabins_, -2.5, 2.5); + iWrapper.book1D(iBooker, "TrigElectronEta", "Triggered electron #eta;electron #eta;entries", etabins_, -2.5, 2.5); hTrigElectronPhi_ = - iBooker.book1D("TrigElectronPhi", "Triggered electron #phi;electron #phi;entries", phibins_, -3.2, 3.2); + iWrapper.book1D(iBooker, "TrigElectronPhi", "Triggered electron #phi;electron #phi;entries", phibins_, -3.2, 3.2); } if (nmus > 0) { - hTrigMuonEt_ = iBooker.book1D("TrigMuonEt", "Triggered muon p_{T};muon p_{T};entries", ptbins_, 0, ptmax_); - hTrigMuonEta_ = iBooker.book1D("TrigMuonEta", "Triggered muon #eta;muon #eta;entries", etabins_, -2.5, 2.5); - hTrigMuonPhi_ = iBooker.book1D("TrigMuonPhi", "Triggered muon #phi;muon #phi;entries", phibins_, -3.2, 3.2); + hTrigMuonEt_ = iWrapper.book1D(iBooker, "TrigMuonEt", "Triggered muon p_{T};muon p_{T};entries", ptbins_, 0, ptmax_); + hTrigMuonEta_ = iWrapper.book1D(iBooker, "TrigMuonEta", "Triggered muon #eta;muon #eta;entries", etabins_, -2.5, 2.5); + hTrigMuonPhi_ = iWrapper.book1D(iBooker, "TrigMuonPhi", "Triggered muon #phi;muon #phi;entries", phibins_, -3.2, 3.2); } if (nmet > 0) { - hTrigMETEt_ = iBooker.book1D("TrigMETEt", "Triggered MET E_{T};MET E_{T};entries", ptbins_, 0, ptmax_); - hTrigMETPhi_ = iBooker.book1D("TrigMETPhi", "Triggered MET #phi;MET #phi;entries", phibins_, -3.2, 3.2); + hTrigMETEt_ = iWrapper.book1D(iBooker, "TrigMETEt", "Triggered MET E_{T};MET E_{T};entries", ptbins_, 0, ptmax_); + hTrigMETPhi_ = iWrapper.book1D(iBooker, "TrigMETPhi", "Triggered MET #phi;MET #phi;entries", phibins_, -3.2, 3.2); } if (ntaus == 2 && neles == 0 && nmus == 0 && nmet == 0) create("di-tau"); @@ -271,7 +259,7 @@ void HLTTauDQMPathPlotter::analyze(const edm::TriggerResults& triggerResults, if (!matched) break; - hAcceptedEvents_->Fill(i + 0.5); + if(hAcceptedEvents_) hAcceptedEvents_->Fill(i + 0.5); lastMatchedFilter = i; if (hltPath_.getFilterName(i).find("hltMET") < hltPath_.getFilterName(i).length()) lastMatchedMETFilter = i; @@ -289,7 +277,7 @@ void HLTTauDQMPathPlotter::analyze(const edm::TriggerResults& triggerResults, } } else { for (int i = 0; i <= lastPassedFilter; ++i) { - hAcceptedEvents_->Fill(i + 0.5); + if(hAcceptedEvents_) hAcceptedEvents_->Fill(i + 0.5); } } @@ -300,10 +288,10 @@ void HLTTauDQMPathPlotter::analyze(const edm::TriggerResults& triggerResults, // Denominators if (static_cast(lastMatchedFilter) >= hltPath_.getLastFilterBeforeL2TauIndex()) { for (const LV& tau : refCollection.taus) { - hL2TrigTauEtEffDenom_->Fill(tau.pt()); - hL2TrigTauHighEtEffDenom_->Fill(tau.pt()); - hL2TrigTauEtaEffDenom_->Fill(tau.eta()); - hL2TrigTauPhiEffDenom_->Fill(tau.phi()); + if(hL2TrigTauEtEffDenom_) hL2TrigTauEtEffDenom_->Fill(tau.pt()); + if(hL2TrigTauHighEtEffDenom_) hL2TrigTauHighEtEffDenom_->Fill(tau.pt()); + if(hL2TrigTauEtaEffDenom_) hL2TrigTauEtaEffDenom_->Fill(tau.eta()); + if(hL2TrigTauPhiEffDenom_) hL2TrigTauPhiEffDenom_->Fill(tau.phi()); } } @@ -321,10 +309,10 @@ void HLTTauDQMPathPlotter::analyze(const edm::TriggerResults& triggerResults, matchedOfflineObjs); if (matched) { for (const LV& tau : matchedOfflineObjs.taus) { - hL2TrigTauEtEffNum_->Fill(tau.pt()); - hL2TrigTauHighEtEffNum_->Fill(tau.pt()); - hL2TrigTauEtaEffNum_->Fill(tau.eta()); - hL2TrigTauPhiEffNum_->Fill(tau.phi()); + if(hL2TrigTauEtEffNum_) hL2TrigTauEtEffNum_->Fill(tau.pt()); + if(hL2TrigTauHighEtEffNum_) hL2TrigTauHighEtEffNum_->Fill(tau.pt()); + if(hL2TrigTauEtaEffNum_) hL2TrigTauEtaEffNum_->Fill(tau.eta()); + if(hL2TrigTauPhiEffNum_) hL2TrigTauPhiEffNum_->Fill(tau.phi()); } } } @@ -335,11 +323,11 @@ void HLTTauDQMPathPlotter::analyze(const edm::TriggerResults& triggerResults, // Denominators if (static_cast(lastMatchedFilter) >= hltPath_.getLastFilterBeforeL3TauIndex()) { for (const LV& tau : refCollection.taus) { - hL3TrigTauEtEffDenom_->Fill(tau.pt()); - hL3TrigTauHighEtEffDenom_->Fill(tau.pt()); - hL3TrigTauEtaEffDenom_->Fill(tau.eta()); - hL3TrigTauPhiEffDenom_->Fill(tau.phi()); - hL3TrigTauEtaPhiEffDenom_->Fill(tau.eta(), tau.phi()); + if(hL3TrigTauEtEffDenom_) hL3TrigTauEtEffDenom_->Fill(tau.pt()); + if(hL3TrigTauHighEtEffDenom_) hL3TrigTauHighEtEffDenom_->Fill(tau.pt()); + if(hL3TrigTauEtaEffDenom_) hL3TrigTauEtaEffDenom_->Fill(tau.eta()); + if(hL3TrigTauPhiEffDenom_) hL3TrigTauPhiEffDenom_->Fill(tau.phi()); + if(hL3TrigTauEtaPhiEffDenom_) hL3TrigTauEtaPhiEffDenom_->Fill(tau.eta(), tau.phi()); } } @@ -357,11 +345,11 @@ void HLTTauDQMPathPlotter::analyze(const edm::TriggerResults& triggerResults, matchedOfflineObjs); if (matched) { for (const LV& tau : matchedOfflineObjs.taus) { - hL3TrigTauEtEffNum_->Fill(tau.pt()); - hL3TrigTauHighEtEffNum_->Fill(tau.pt()); - hL3TrigTauEtaEffNum_->Fill(tau.eta()); - hL3TrigTauPhiEffNum_->Fill(tau.phi()); - hL3TrigTauEtaPhiEffNum_->Fill(tau.eta(), tau.phi()); + if(hL3TrigTauEtEffNum_) hL3TrigTauEtEffNum_->Fill(tau.pt()); + if(hL3TrigTauHighEtEffNum_) hL3TrigTauHighEtEffNum_->Fill(tau.pt()); + if(hL3TrigTauEtaEffNum_) hL3TrigTauEtaEffNum_->Fill(tau.eta()); + if(hL3TrigTauPhiEffNum_) hL3TrigTauPhiEffNum_->Fill(tau.phi()); + if(hL3TrigTauEtaPhiEffNum_) hL3TrigTauEtaPhiEffNum_->Fill(tau.eta(), tau.phi()); } } } @@ -372,9 +360,9 @@ void HLTTauDQMPathPlotter::analyze(const edm::TriggerResults& triggerResults, // Denominators if (static_cast(lastMatchedFilter) >= hltPath_.getLastFilterBeforeL2ElectronIndex()) { for (const LV& electron : refCollection.electrons) { - hL2TrigElectronEtEffDenom_->Fill(electron.pt()); - hL2TrigElectronEtaEffDenom_->Fill(electron.eta()); - hL2TrigElectronPhiEffDenom_->Fill(electron.phi()); + if(hL2TrigElectronEtEffDenom_) hL2TrigElectronEtEffDenom_->Fill(electron.pt()); + if(hL2TrigElectronEtaEffDenom_) hL2TrigElectronEtaEffDenom_->Fill(electron.eta()); + if(hL2TrigElectronPhiEffDenom_) hL2TrigElectronPhiEffDenom_->Fill(electron.phi()); } } @@ -392,9 +380,9 @@ void HLTTauDQMPathPlotter::analyze(const edm::TriggerResults& triggerResults, matchedOfflineObjs); if (matched) { for (const LV& electron : matchedOfflineObjs.electrons) { - hL2TrigElectronEtEffNum_->Fill(electron.pt()); - hL2TrigElectronEtaEffNum_->Fill(electron.eta()); - hL2TrigElectronPhiEffNum_->Fill(electron.phi()); + if(hL2TrigElectronEtEffNum_) hL2TrigElectronEtEffNum_->Fill(electron.pt()); + if(hL2TrigElectronEtaEffNum_) hL2TrigElectronEtaEffNum_->Fill(electron.eta()); + if(hL2TrigElectronPhiEffNum_) hL2TrigElectronPhiEffNum_->Fill(electron.phi()); } } } @@ -405,9 +393,9 @@ void HLTTauDQMPathPlotter::analyze(const edm::TriggerResults& triggerResults, // Denominators if (static_cast(lastMatchedFilter) >= hltPath_.getLastFilterBeforeL3ElectronIndex()) { for (const LV& electron : refCollection.electrons) { - hL3TrigElectronEtEffDenom_->Fill(electron.pt()); - hL3TrigElectronEtaEffDenom_->Fill(electron.eta()); - hL3TrigElectronPhiEffDenom_->Fill(electron.phi()); + if(hL3TrigElectronEtEffDenom_) hL3TrigElectronEtEffDenom_->Fill(electron.pt()); + if(hL3TrigElectronEtaEffDenom_) hL3TrigElectronEtaEffDenom_->Fill(electron.eta()); + if(hL3TrigElectronPhiEffDenom_) hL3TrigElectronPhiEffDenom_->Fill(electron.phi()); } } @@ -425,9 +413,9 @@ void HLTTauDQMPathPlotter::analyze(const edm::TriggerResults& triggerResults, matchedOfflineObjs); if (matched) { for (const LV& electron : matchedOfflineObjs.electrons) { - hL3TrigElectronEtEffNum_->Fill(electron.pt()); - hL3TrigElectronEtaEffNum_->Fill(electron.eta()); - hL3TrigElectronPhiEffNum_->Fill(electron.phi()); + if(hL3TrigElectronEtEffNum_) hL3TrigElectronEtEffNum_->Fill(electron.pt()); + if(hL3TrigElectronEtaEffNum_) hL3TrigElectronEtaEffNum_->Fill(electron.eta()); + if(hL3TrigElectronPhiEffNum_) hL3TrigElectronPhiEffNum_->Fill(electron.phi()); } } } @@ -438,9 +426,9 @@ void HLTTauDQMPathPlotter::analyze(const edm::TriggerResults& triggerResults, // Denominators if (static_cast(lastMatchedFilter) >= hltPath_.getLastFilterBeforeL2MuonIndex()) { for (const LV& muon : refCollection.muons) { - hL2TrigMuonEtEffDenom_->Fill(muon.pt()); - hL2TrigMuonEtaEffDenom_->Fill(muon.eta()); - hL2TrigMuonPhiEffDenom_->Fill(muon.phi()); + if(hL2TrigMuonEtEffDenom_) hL2TrigMuonEtEffDenom_->Fill(muon.pt()); + if(hL2TrigMuonEtaEffDenom_) hL2TrigMuonEtaEffDenom_->Fill(muon.eta()); + if(hL2TrigMuonPhiEffDenom_) hL2TrigMuonPhiEffDenom_->Fill(muon.phi()); } } @@ -458,9 +446,9 @@ void HLTTauDQMPathPlotter::analyze(const edm::TriggerResults& triggerResults, matchedOfflineObjs); if (matched) { for (const LV& muon : matchedOfflineObjs.muons) { - hL2TrigMuonEtEffNum_->Fill(muon.pt()); - hL2TrigMuonEtaEffNum_->Fill(muon.eta()); - hL2TrigMuonPhiEffNum_->Fill(muon.phi()); + if(hL2TrigMuonEtEffNum_) hL2TrigMuonEtEffNum_->Fill(muon.pt()); + if(hL2TrigMuonEtaEffNum_) hL2TrigMuonEtaEffNum_->Fill(muon.eta()); + if(hL2TrigMuonPhiEffNum_) hL2TrigMuonPhiEffNum_->Fill(muon.phi()); } } } @@ -471,9 +459,9 @@ void HLTTauDQMPathPlotter::analyze(const edm::TriggerResults& triggerResults, // Denominators if (static_cast(lastMatchedFilter) >= hltPath_.getLastFilterBeforeL3MuonIndex()) { for (const LV& muon : refCollection.muons) { - hL3TrigMuonEtEffDenom_->Fill(muon.pt()); - hL3TrigMuonEtaEffDenom_->Fill(muon.eta()); - hL3TrigMuonPhiEffDenom_->Fill(muon.phi()); + if(hL3TrigMuonEtEffDenom_) hL3TrigMuonEtEffDenom_->Fill(muon.pt()); + if(hL3TrigMuonEtaEffDenom_) hL3TrigMuonEtaEffDenom_->Fill(muon.eta()); + if(hL3TrigMuonPhiEffDenom_) hL3TrigMuonPhiEffDenom_->Fill(muon.phi()); } } @@ -491,9 +479,9 @@ void HLTTauDQMPathPlotter::analyze(const edm::TriggerResults& triggerResults, matchedOfflineObjs); if (matched) { for (const LV& muon : matchedOfflineObjs.muons) { - hL3TrigMuonEtEffNum_->Fill(muon.pt()); - hL3TrigMuonEtaEffNum_->Fill(muon.eta()); - hL3TrigMuonPhiEffNum_->Fill(muon.phi()); + if(hL3TrigMuonEtEffNum_) hL3TrigMuonEtEffNum_->Fill(muon.pt()); + if(hL3TrigMuonEtaEffNum_) hL3TrigMuonEtaEffNum_->Fill(muon.eta()); + if(hL3TrigMuonPhiEffNum_) hL3TrigMuonPhiEffNum_->Fill(muon.phi()); } } } @@ -503,7 +491,7 @@ void HLTTauDQMPathPlotter::analyze(const edm::TriggerResults& triggerResults, if (hltPath_.hasL2CaloMET()) { // Denominators if (static_cast(firstMatchedMETFilter) >= hltPath_.getFirstFilterBeforeL2CaloMETIndex()) { - hL2TrigMETEtEffDenom_->Fill(refCollection.met[0].pt()); + if(hL2TrigMETEtEffDenom_) hL2TrigMETEtEffDenom_->Fill(refCollection.met[0].pt()); } // Numerators @@ -519,7 +507,7 @@ void HLTTauDQMPathPlotter::analyze(const edm::TriggerResults& triggerResults, matchedTriggerObjs, matchedOfflineObjs); if (matched) { - hL2TrigMETEtEffNum_->Fill(matchedOfflineObjs.met[0].pt()); + if(hL2TrigMETEtEffNum_) hL2TrigMETEtEffNum_->Fill(matchedOfflineObjs.met[0].pt()); } } } @@ -550,15 +538,15 @@ void HLTTauDQMPathPlotter::analyze(const edm::TriggerResults& triggerResults, if (ntaus == 2 && hltPath_.getFilterNElectrons(lastMatchedElectronFilter) == 0 && hltPath_.getFilterNMuons(lastMatchedMuonFilter) == 0) { // Di-tau (matchedOfflineObjs are already sorted) - hMass_->Fill((matchedOfflineObjs.taus[0] + matchedOfflineObjs.taus[1]).M()); + if(hMass_) hMass_->Fill((matchedOfflineObjs.taus[0] + matchedOfflineObjs.taus[1]).M()); } // Electron+tau else if (ntaus == 1 && hltPath_.getFilterNElectrons(lastPassedFilter) == 1) { - hMass_->Fill((matchedOfflineObjs.taus[0] + matchedOfflineObjs.electrons[0]).M()); + if(hMass_) hMass_->Fill((matchedOfflineObjs.taus[0] + matchedOfflineObjs.electrons[0]).M()); } // Muon+tau else if (ntaus == 1 && hltPath_.getFilterNMuons(lastPassedFilter) == 1) { - hMass_->Fill((matchedOfflineObjs.taus[0] + matchedOfflineObjs.muons[0]).M()); + if(hMass_) hMass_->Fill((matchedOfflineObjs.taus[0] + matchedOfflineObjs.muons[0]).M()); } // Tau+MET if (hltPath_.getFilterNTaus(lastPassedFilter) == 1 && hltPath_.getFilterMET(lastMatchedMETFilter) == 1) { @@ -568,7 +556,7 @@ void HLTTauDQMPathPlotter::analyze(const edm::TriggerResults& triggerResults, double metphi = matchedOfflineObjs.met[0].Phi(); double mT = sqrt(2 * taupt * met * (1 - cos(tauphi - metphi))); - hMass_->Fill(mT); + if(hMass_) hMass_->Fill(mT); } } } @@ -576,23 +564,23 @@ void HLTTauDQMPathPlotter::analyze(const edm::TriggerResults& triggerResults, // Triggered object kinematics for (const HLTTauDQMPath::Object& obj : triggerObjs) { if (obj.id == trigger::TriggerTau) { - hTrigTauEt_->Fill(obj.object.pt()); - hTrigTauEta_->Fill(obj.object.eta()); - hTrigTauPhi_->Fill(obj.object.phi()); + if(hTrigTauEt_) hTrigTauEt_->Fill(obj.object.pt()); + if(hTrigTauEta_) hTrigTauEta_->Fill(obj.object.eta()); + if(hTrigTauPhi_) hTrigTauPhi_->Fill(obj.object.phi()); } if (obj.id == trigger::TriggerElectron || obj.id == trigger::TriggerPhoton) { - hTrigElectronEt_->Fill(obj.object.pt()); - hTrigElectronEta_->Fill(obj.object.eta()); - hTrigElectronPhi_->Fill(obj.object.phi()); + if(hTrigElectronEt_) hTrigElectronEt_->Fill(obj.object.pt()); + if(hTrigElectronEta_) hTrigElectronEta_->Fill(obj.object.eta()); + if(hTrigElectronPhi_) hTrigElectronPhi_->Fill(obj.object.phi()); } if (obj.id == trigger::TriggerMuon) { - hTrigMuonEt_->Fill(obj.object.pt()); - hTrigMuonEta_->Fill(obj.object.eta()); - hTrigMuonPhi_->Fill(obj.object.phi()); + if(hTrigMuonEt_) hTrigMuonEt_->Fill(obj.object.pt()); + if(hTrigMuonEta_) hTrigMuonEta_->Fill(obj.object.eta()); + if(hTrigMuonPhi_) hTrigMuonPhi_->Fill(obj.object.phi()); } if (obj.id == trigger::TriggerMET) { - hTrigMETEt_->Fill(obj.object.pt()); - hTrigMETPhi_->Fill(obj.object.phi()); + if(hTrigMETEt_) hTrigMETEt_->Fill(obj.object.pt()); + if(hTrigMETPhi_) hTrigMETPhi_->Fill(obj.object.phi()); } } } diff --git a/DQMOffline/Trigger/src/HLTTauDQMPathSummaryPlotter.cc b/DQMOffline/Trigger/src/HLTTauDQMPathSummaryPlotter.cc index 3594835929664..60d7410e415f7 100644 --- a/DQMOffline/Trigger/src/HLTTauDQMPathSummaryPlotter.cc +++ b/DQMOffline/Trigger/src/HLTTauDQMPathSummaryPlotter.cc @@ -9,19 +9,18 @@ HLTTauDQMPathSummaryPlotter::HLTTauDQMPathSummaryPlotter(const edm::ParameterSet HLTTauDQMPathSummaryPlotter::~HLTTauDQMPathSummaryPlotter() = default; -void HLTTauDQMPathSummaryPlotter::bookHistograms(DQMStore::IBooker& iBooker) { +void HLTTauDQMPathSummaryPlotter::bookHistograms(IWrapper &iWrapper, DQMStore::IBooker &iBooker) { if (!isValid() || pathObjects_.empty()) return; //Create the histograms iBooker.setCurrentFolder(triggerTag() + "/helpers"); - all_events = iBooker.book1D("RefEvents", "All events", pathObjects_.size(), 0, pathObjects_.size()); - accepted_events = iBooker.book1D( - "PathTriggerBits", "Accepted Events per Path;;entries", pathObjects_.size(), 0, pathObjects_.size()); + all_events = iWrapper.book1D(iBooker, "RefEvents", "All events", pathObjects_.size(), 0, pathObjects_.size(), kEverything); + accepted_events = iWrapper.book1D(iBooker, "PathTriggerBits", "Accepted Events per Path;;entries", pathObjects_.size(), 0, pathObjects_.size(), kEverything); for (size_t i = 0; i < pathObjects_.size(); ++i) { - all_events->setBinLabel(i + 1, pathObjects_[i]->getPathName()); - accepted_events->setBinLabel(i + 1, pathObjects_[i]->getPathName()); + if(all_events) all_events->setBinLabel(i + 1, pathObjects_[i]->getPathName()); + if(accepted_events) accepted_events->setBinLabel(i + 1, pathObjects_[i]->getPathName()); } iBooker.setCurrentFolder(triggerTag()); @@ -40,7 +39,7 @@ void HLTTauDQMPathSummaryPlotter::analyze(const edm::TriggerResults& triggerResu const int lastFilter = path->filtersSize() - 1; if (path->goodOfflineEvent(lastFilter, refCollection)) { - all_events->Fill(i + 0.5); + if(all_events) all_events->Fill(i + 0.5); } if (path->fired(triggerResults)) { triggerObjs.clear(); @@ -49,16 +48,16 @@ void HLTTauDQMPathSummaryPlotter::analyze(const edm::TriggerResults& triggerResu path->getFilterObjects(triggerEvent, lastFilter, triggerObjs); if (path->offlineMatching( lastFilter, triggerObjs, refCollection, hltMatchDr_, matchedTriggerObjs, matchedOfflineObjs)) { - accepted_events->Fill(i + 0.5); + if(accepted_events) accepted_events->Fill(i + 0.5); } } } } else { for (size_t i = 0; i < pathObjects_.size(); ++i) { const HLTTauDQMPath* path = pathObjects_[i]; - all_events->Fill(i + 0.5); + if(all_events) all_events->Fill(i + 0.5); if (path->fired(triggerResults)) { - accepted_events->Fill(i + 0.5); + if(accepted_events) accepted_events->Fill(i + 0.5); } } } diff --git a/DQMOffline/Trigger/src/HLTTauDQMTagAndProbePlotter.cc b/DQMOffline/Trigger/src/HLTTauDQMTagAndProbePlotter.cc index 0c22628398590..c588ca503ac32 100644 --- a/DQMOffline/Trigger/src/HLTTauDQMTagAndProbePlotter.cc +++ b/DQMOffline/Trigger/src/HLTTauDQMTagAndProbePlotter.cc @@ -46,7 +46,7 @@ HLTTauDQMTagAndProbePlotter::HLTTauDQMTagAndProbePlotter(const edm::ParameterSet } #include -void HLTTauDQMTagAndProbePlotter::bookHistograms(DQMStore::IBooker& iBooker, +void HLTTauDQMTagAndProbePlotter::bookHistograms(IWrapper& iWrapper, DQMStore::IBooker &iBooker, edm::Run const& iRun, edm::EventSetup const& iSetup) { if (!isValid()) @@ -54,22 +54,22 @@ void HLTTauDQMTagAndProbePlotter::bookHistograms(DQMStore::IBooker& iBooker, // Efficiency helpers iBooker.setCurrentFolder(triggerTag() + "/helpers"); - h_num_pt = iBooker.book1D(xvariable + "EtEffNum", "", nbinsPt_, ptmin_, ptmax_); - h_den_pt = iBooker.book1D(xvariable + "EtEffDenom", "", nbinsPt_, ptmin_, ptmax_); + h_num_pt = iWrapper.book1D(iBooker,xvariable + "EtEffNum", "", nbinsPt_, ptmin_, ptmax_, kVital); + h_den_pt = iWrapper.book1D(iBooker,xvariable + "EtEffDenom", "", nbinsPt_, ptmin_, ptmax_, kVital); if (xvariable != "met") { - h_num_eta = iBooker.book1D(xvariable + "EtaEffNum", "", nbinsEta_, etamin_, etamax_); - h_den_eta = iBooker.book1D(xvariable + "EtaEffDenom", "", nbinsEta_, etamin_, etamax_); + h_num_eta = iWrapper.book1D(iBooker,xvariable + "EtaEffNum", "", nbinsEta_, etamin_, etamax_); + h_den_eta = iWrapper.book1D(iBooker,xvariable + "EtaEffDenom", "", nbinsEta_, etamin_, etamax_); h_num_etaphi = - iBooker.book2D(xvariable + "EtaPhiEffNum", "", nbinsEta_, etamin_, etamax_, nbinsPhi_, phimin_, phimax_); + iWrapper.book2D(iBooker,xvariable + "EtaPhiEffNum", "", nbinsEta_, etamin_, etamax_, nbinsPhi_, phimin_, phimax_); h_den_etaphi = - iBooker.book2D(xvariable + "EtaPhiEffDenom", "", nbinsEta_, etamin_, etamax_, nbinsPhi_, phimin_, phimax_); - h_den_etaphi->setOption("COL"); + iWrapper.book2D(iBooker,xvariable + "EtaPhiEffDenom", "", nbinsEta_, etamin_, etamax_, nbinsPhi_, phimin_, phimax_); + if(h_den_etaphi) h_den_etaphi->setOption("COL"); } - h_num_phi = iBooker.book1D(xvariable + "PhiEffNum", "", nbinsPhi_, phimin_, phimax_); - h_den_phi = iBooker.book1D(xvariable + "PhiEffDenom", "", nbinsPhi_, phimin_, phimax_); + h_num_phi = iWrapper.book1D(iBooker,xvariable + "PhiEffNum", "", nbinsPhi_, phimin_, phimax_); + h_den_phi = iWrapper.book1D(iBooker,xvariable + "PhiEffDenom", "", nbinsPhi_, phimin_, phimax_); iBooker.setCurrentFolder(triggerTag()); } @@ -142,12 +142,12 @@ void HLTTauDQMTagAndProbePlotter::analyze(edm::Event const& iEvent, if (hltMatched) return; // do not consider offline objects which match the tag trigger - h_den_pt->Fill(offlineObject.pt()); + if(h_den_pt) h_den_pt->Fill(offlineObject.pt()); if (xvariable != "met") { - h_den_eta->Fill(offlineObject.eta()); - h_den_etaphi->Fill(offlineObject.eta(), offlineObject.phi()); + if(h_den_eta) h_den_eta->Fill(offlineObject.eta()); + if(h_den_etaphi) h_den_etaphi->Fill(offlineObject.eta(), offlineObject.phi()); } - h_den_phi->Fill(offlineObject.phi()); + if(h_den_phi) h_den_phi->Fill(offlineObject.phi()); // applying selection for numerator passTrigger = false; @@ -164,11 +164,11 @@ void HLTTauDQMTagAndProbePlotter::analyze(edm::Event const& iEvent, if (!passTrigger) return; - h_num_pt->Fill(offlineObject.pt()); + if(h_num_pt) h_num_pt->Fill(offlineObject.pt()); if (xvariable != "met") { - h_num_eta->Fill(offlineObject.eta()); - h_num_etaphi->Fill(offlineObject.eta(), offlineObject.phi()); + if(h_num_eta) h_num_eta->Fill(offlineObject.eta()); + if(h_num_etaphi) h_num_etaphi->Fill(offlineObject.eta(), offlineObject.phi()); } - h_num_phi->Fill(offlineObject.phi()); + if(h_num_phi) h_num_phi->Fill(offlineObject.phi()); } } diff --git a/DQMOffline/Trigger/src/IWrapper.cc b/DQMOffline/Trigger/src/IWrapper.cc new file mode 100644 index 0000000000000..5bdffb4257aaf --- /dev/null +++ b/DQMOffline/Trigger/src/IWrapper.cc @@ -0,0 +1,35 @@ +#include "DQMOffline/Trigger/interface/IWrapper.h" + +IWrapper::IWrapper(const edm::ParameterSet& pset){ + plotlevel = (PL)pset.getUntrackedParameter("PlotLevel", int(kEverything)); + cAllHistograms = 0; + cPlottedHistograms = 0; +} + +IWrapper::~IWrapper(){ + std::string s_pl = "kEverything"; + if(plotlevel == 1) s_pl = "kVital"; + std::cout << "Plot level " << plotlevel << " " << s_pl << std::endl; + std::cout << "Plotting " << cPlottedHistograms << " out of " << cAllHistograms << std::endl; +} + +MonitorElement* IWrapper::book1D(DQMStore::IBooker& iBooker, TString const &name, TString const &title, int const nchX, double const lowX, double const highX, int level){ + cAllHistograms++; + if(level >= plotlevel){ + cPlottedHistograms++; + MonitorElement* me = iBooker.book1D(name, title, nchX, lowX, highX); + return me; + } + return 0; +} + +MonitorElement* IWrapper::book2D(DQMStore::IBooker& iBooker, TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, int level){ + cAllHistograms++; + if(level >= plotlevel){ + cPlottedHistograms++; + MonitorElement* me = iBooker.book2D(name, title, nchX, lowX, highX, nchY, lowY, highY); + return me; + } + return 0; +} +