diff --git a/DQMOffline/Trigger/interface/HLTMuonMatchAndPlot.h b/DQMOffline/Trigger/interface/HLTMuonMatchAndPlot.h index 17bb7530b26c7..f2038e998029c 100644 --- a/DQMOffline/Trigger/interface/HLTMuonMatchAndPlot.h +++ b/DQMOffline/Trigger/interface/HLTMuonMatchAndPlot.h @@ -35,8 +35,6 @@ #include "DataFormats/BeamSpot/interface/BeamSpot.h" #include "DataFormats/Math/interface/deltaR.h" -#include "CommonTools/Utils/interface/StringCutObjectSelector.h" - #include #include "TFile.h" #include "TNtuple.h" @@ -83,18 +81,9 @@ class HLTMuonMatchAndPlot { // Internal Methods void book1D(DQMStore::IBooker &, std::string, const std::string &, std::string); void book2D(DQMStore::IBooker &, const std::string &, const std::string &, const std::string &, const std::string &); - reco::MuonCollection selectedMuons(const reco::MuonCollection &, - const reco::BeamSpot &, - bool, - const StringCutObjectSelector &, - double, - double); - - trigger::TriggerObjectCollection selectedTriggerObjects( - const trigger::TriggerObjectCollection &, - const trigger::TriggerEvent &, - bool hasTriggerCuts, - const StringCutObjectSelector &triggerSelector); + reco::MuonCollection selectedMuons(const reco::MuonCollection &, const reco::BeamSpot &, bool); + trigger::TriggerObjectCollection selectedTriggerObjects(const trigger::TriggerObjectCollection &, + const trigger::TriggerEvent &); // Input from Configuration File std::string hltProcessName_; @@ -113,21 +102,20 @@ class HLTMuonMatchAndPlot { bool isLastFilter_; std::map hists_; - // Selectors - bool hasTargetRecoCuts; - bool hasProbeRecoCuts; - - StringCutObjectSelector targetMuonSelector_; + double targetMuonEtaMax_; + double targetMuonEtaMin_; + bool targetIsMuonGlb_; double targetZ0Cut_; double targetD0Cut_; double targetptCutZ_; double targetptCutJpsi_; - StringCutObjectSelector probeMuonSelector_; + double probeMuonEtaMax_; + double probeMuonEtaMin_; + bool probeIsMuonGlb_; double probeZ0Cut_; double probeD0Cut_; - - StringCutObjectSelector triggerSelector_; - bool hasTriggerCuts_; + double triggerEtaMaxCut_; + double triggerEtaMinCut_; }; #endif diff --git a/DQMOffline/Trigger/python/HLTMuonOfflineAnalyzer_cff.py b/DQMOffline/Trigger/python/HLTMuonOfflineAnalyzer_cff.py index 58d3dd1386dbd..6dcb08dca8fbc 100644 --- a/DQMOffline/Trigger/python/HLTMuonOfflineAnalyzer_cff.py +++ b/DQMOffline/Trigger/python/HLTMuonOfflineAnalyzer_cff.py @@ -5,8 +5,11 @@ globalMuonParams = cms.PSet( d0Cut = cms.untracked.double(2.0), z0Cut = cms.untracked.double(25.0), - recoCuts = cms.untracked.string("isGlobalMuon && abs(eta) < 2.4"), - hltCuts = cms.untracked.string("abs(eta) < 2.4"), + recoMaxEtaCut = cms.untracked.double(2.4), + recoMinEtaCut = cms.untracked.double(0.0), + recoGlbMuCut = cms.untracked.bool(True), + hltMaxEtaCut = cms.untracked.double(2.4), + hltMinEtaCut = cms.untracked.double(0.0), ) globalAnalyzerTnP = hltMuonOfflineAnalyzer.clone() diff --git a/DQMOffline/Trigger/python/HLTMuonOfflineAnalyzer_cfi.py b/DQMOffline/Trigger/python/HLTMuonOfflineAnalyzer_cfi.py index 3e68ba363b5b5..1da43b8c5ef59 100644 --- a/DQMOffline/Trigger/python/HLTMuonOfflineAnalyzer_cfi.py +++ b/DQMOffline/Trigger/python/HLTMuonOfflineAnalyzer_cfi.py @@ -94,8 +94,11 @@ d0Cut = cms.untracked.double(2.0), z0Cut = cms.untracked.double(25.0), ## cuts - recoCuts = cms.untracked.string("isGlobalMuon && abs(eta) < 2.4"), - hltCuts = cms.untracked.string("abs(eta) < 2.4"), + recoMaxEtaCut = cms.untracked.double(2.4), + recoMinEtaCut = cms.untracked.double(0.0), + recoGlbMuCut = cms.untracked.bool(True), + hltMaxEtaCut = cms.untracked.double(2.4), + hltMinEtaCut = cms.untracked.double(0.0), ), ## If this PSet is empty, then no "tag and probe" plots are produced; @@ -106,8 +109,11 @@ d0Cut = cms.untracked.double(2.0), z0Cut = cms.untracked.double(25.0), ## cuts - recoCuts = cms.untracked.string("isGlobalMuon && abs(eta) < 2.4"), - hltCuts = cms.untracked.string("abs(eta) < 2.4"), + recoMaxEtaCut = cms.untracked.double(2.4), + recoMinEtaCut = cms.untracked.double(0.0), + recoGlbMuCut = cms.untracked.bool(True), + hltMaxEtaCut = cms.untracked.double(2.4), + hltMinEtaCut = cms.untracked.double(0.0), ), ) diff --git a/DQMOffline/Trigger/python/HLTMuonOfflineAnalyzer_cosmics_cff.py b/DQMOffline/Trigger/python/HLTMuonOfflineAnalyzer_cosmics_cff.py index 6e4b2c07a1a13..735d30e94ee6b 100644 --- a/DQMOffline/Trigger/python/HLTMuonOfflineAnalyzer_cosmics_cff.py +++ b/DQMOffline/Trigger/python/HLTMuonOfflineAnalyzer_cosmics_cff.py @@ -5,23 +5,31 @@ barrelMuonParams = cms.PSet( d0Cut = cms.untracked.double(1000.0), z0Cut = cms.untracked.double(1000.0), - recoCuts = cms.untracked.string("isStandAloneMuon && abs(eta) < 0.9"), - hltCuts = cms.untracked.string("abs(eta) < 0.9"), + recoMaxEtaCut = cms.untracked.double(0.9), + recoMinEtaCut = cms.untracked.double(0.0), + recoGlbMuCut = cms.untracked.bool(False), #is a SA muon + hltMaxEtaCut = cms.untracked.double(0.9), + hltMinEtaCut = cms.untracked.double(0.0), ) endcapMuonParams = cms.PSet( d0Cut = cms.untracked.double(1000.0), z0Cut = cms.untracked.double(1000.0), - recoCuts = cms.untracked.string("isStandAloneMuon && abs(eta) > 1.4 && " - "abs(eta) < 2.0"), - hltCuts = cms.untracked.string("abs(eta) > 1.4 && abs(eta) < 2.0"), + recoMaxEtaCut = cms.untracked.double(2.0), + recoMinEtaCut = cms.untracked.double(1.4), + recoGlbMuCut = cms.untracked.bool(False), #is a SA muon + hltMaxEtaCut = cms.untracked.double(2.0), + hltMinEtaCut = cms.untracked.double(1.4), ) allMuonParams = cms.PSet( d0Cut = cms.untracked.double(1000.0), z0Cut = cms.untracked.double(1000.0), - recoCuts = cms.untracked.string("isStandAloneMuon && abs(eta) < 2.0"), - hltCuts = cms.untracked.string("abs(eta) < 2.0"), + recoMaxEtaCut = cms.untracked.double(2.0), + recoMinEtaCut = cms.untracked.double(0.0), + recoGlbMuCut = cms.untracked.bool(False), #is a SA muon + hltMaxEtaCut = cms.untracked.double(2.0), + hltMinEtaCut = cms.untracked.double(0.0), ) barrelAnalyzer = hltMuonOfflineAnalyzer.clone( diff --git a/DQMOffline/Trigger/src/HLTMuonMatchAndPlot.cc b/DQMOffline/Trigger/src/HLTMuonMatchAndPlot.cc index 68cd94612d19d..887978aba06d2 100644 --- a/DQMOffline/Trigger/src/HLTMuonMatchAndPlot.cc +++ b/DQMOffline/Trigger/src/HLTMuonMatchAndPlot.cc @@ -43,18 +43,20 @@ HLTMuonMatchAndPlot::HLTMuonMatchAndPlot(const ParameterSet& pset, string hltPat hltPath_(std::move(hltPath)), moduleLabel_(std::move(moduleLabel)), isLastFilter_(islastfilter), - hasTargetRecoCuts(targetParams_.exists("recoCuts")), - hasProbeRecoCuts(probeParams_.exists("recoCuts")), - targetMuonSelector_(targetParams_.getUntrackedParameter("recoCuts", "")), + targetMuonEtaMax_(targetParams_.getUntrackedParameter("recoMaxEtaCut", 0.)), + targetMuonEtaMin_(targetParams_.getUntrackedParameter("recoMinEtaCut", 0.)), + targetIsMuonGlb_(targetParams_.getUntrackedParameter("recoGlbMuCut", false)), targetZ0Cut_(targetParams_.getUntrackedParameter("z0Cut", 0.)), targetD0Cut_(targetParams_.getUntrackedParameter("d0Cut", 0.)), targetptCutZ_(targetParams_.getUntrackedParameter("ptCut_Z", 20.)), targetptCutJpsi_(targetParams_.getUntrackedParameter("ptCut_Jpsi", 20.)), - probeMuonSelector_(probeParams_.getUntrackedParameter("recoCuts", "")), + probeMuonEtaMax_(probeParams_.getUntrackedParameter("recoMaxEtaCut", 0.)), + probeMuonEtaMin_(probeParams_.getUntrackedParameter("recoMinEtaCut", 0.)), + probeIsMuonGlb_(probeParams_.getUntrackedParameter("recoGlbMuCut", false)), probeZ0Cut_(probeParams_.getUntrackedParameter("z0Cut", 0.)), probeD0Cut_(probeParams_.getUntrackedParameter("d0Cut", 0.)), - triggerSelector_(targetParams_.getUntrackedParameter("hltCuts", "")), - hasTriggerCuts_(targetParams_.exists("hltCuts")) { + triggerEtaMaxCut_(targetParams_.getUntrackedParameter("hltMaxEtaCut", 0.)), + triggerEtaMinCut_(targetParams_.getUntrackedParameter("hltMinEtaCut", 0.)) { // Create std::map from ParameterSets. fillMapFromPSet(binParams_, pset, "binParams"); fillMapFromPSet(plotCuts_, pset, "plotCuts"); @@ -173,13 +175,10 @@ void HLTMuonMatchAndPlot::analyze(Handle& allMuons, */ // Select objects based on the configuration. - MuonCollection targetMuons = - selectedMuons(*allMuons, *beamSpot, hasTargetRecoCuts, targetMuonSelector_, targetD0Cut_, targetZ0Cut_); - MuonCollection probeMuons = - selectedMuons(*allMuons, *beamSpot, hasProbeRecoCuts, probeMuonSelector_, probeD0Cut_, probeZ0Cut_); + MuonCollection targetMuons = selectedMuons(*allMuons, *beamSpot, true); + MuonCollection probeMuons = selectedMuons(*allMuons, *beamSpot, false); TriggerObjectCollection allTriggerObjects = triggerSummary->getObjects(); - TriggerObjectCollection hltMuons = - selectedTriggerObjects(allTriggerObjects, *triggerSummary, hasTriggerCuts_, triggerSelector_); + TriggerObjectCollection hltMuons = selectedTriggerObjects(allTriggerObjects, *triggerSummary); // Fill plots for HLT muons. // Find the best trigger object matches for the targetMuons. @@ -374,47 +373,41 @@ vector HLTMuonMatchAndPlot::matchByDeltaR(const vector& collection1, MuonCollection HLTMuonMatchAndPlot::selectedMuons(const MuonCollection& allMuons, const BeamSpot& beamSpot, - bool hasRecoCuts, - const StringCutObjectSelector& selector, - double d0Cut, - double z0Cut) { - // If there is no selector (recoCuts does not exists), return an empty collection. - if (!hasRecoCuts) - return MuonCollection(); - + bool isTargetMuons) { MuonCollection reducedMuons; + double RecoMuonEtaMax = isTargetMuons ? targetMuonEtaMax_ : probeMuonEtaMax_; + double RecoMuonEtaMin = isTargetMuons ? targetMuonEtaMin_ : probeMuonEtaMin_; + bool IsMuonGlb = isTargetMuons ? targetIsMuonGlb_ : probeIsMuonGlb_; + double d0Cut = isTargetMuons ? targetD0Cut_ : probeD0Cut_; + double z0Cut = isTargetMuons ? targetZ0Cut_ : probeZ0Cut_; + for (auto const& mu : allMuons) { const Track* track = nullptr; if (mu.isTrackerMuon()) track = &*mu.innerTrack(); else if (mu.isStandAloneMuon()) track = &*mu.outerTrack(); - if (track && selector(mu) && fabs(track->dxy(beamSpot.position())) < d0Cut && - fabs(track->dz(beamSpot.position())) < z0Cut) + // minimun ID (requested for cosmics) is being a StandAlone muon + bool muID = IsMuonGlb ? mu.isGlobalMuon() : mu.isStandAloneMuon(); + if (track && muID && abs(mu.eta()) < RecoMuonEtaMax && abs(mu.eta()) >= RecoMuonEtaMin && + fabs(track->dxy(beamSpot.position())) < d0Cut && fabs(track->dz(beamSpot.position())) < z0Cut) reducedMuons.push_back(mu); } return reducedMuons; } -TriggerObjectCollection HLTMuonMatchAndPlot::selectedTriggerObjects( - const TriggerObjectCollection& triggerObjects, - const TriggerEvent& triggerSummary, - bool hasTriggerCuts, - const StringCutObjectSelector& triggerSelector) { - if (!hasTriggerCuts) - return TriggerObjectCollection(); - +TriggerObjectCollection HLTMuonMatchAndPlot::selectedTriggerObjects(const TriggerObjectCollection& triggerObjects, + const TriggerEvent& triggerSummary) { InputTag filterTag(moduleLabel_, "", hltProcessName_); size_t filterIndex = triggerSummary.filterIndex(filterTag); TriggerObjectCollection selectedObjects; - if (filterIndex < triggerSummary.sizeFilters()) { const Keys& keys = triggerSummary.filterKeys(filterIndex); for (unsigned short key : keys) { TriggerObject foundObject = triggerObjects[key]; - if (triggerSelector(foundObject)) + if (abs(foundObject.eta()) < triggerEtaMaxCut_ && abs(foundObject.eta()) >= triggerEtaMinCut_) selectedObjects.push_back(foundObject); } }