diff --git a/DQMOffline/Trigger/src/HLTMuonMatchAndPlot.cc b/DQMOffline/Trigger/src/HLTMuonMatchAndPlot.cc index 837b91000eaf9..887978aba06d2 100644 --- a/DQMOffline/Trigger/src/HLTMuonMatchAndPlot.cc +++ b/DQMOffline/Trigger/src/HLTMuonMatchAndPlot.cc @@ -175,13 +175,10 @@ void HLTMuonMatchAndPlot::analyze(Handle& allMuons, */ // Select objects based on the configuration. - MuonCollection targetMuons = selectedMuons( - *allMuons, *beamSpot, targetMuonEtaMax_, targetMuonEtaMin_, targetIsMuonGlb_, targetD0Cut_, targetZ0Cut_); - MuonCollection probeMuons = selectedMuons( - *allMuons, *beamSpot, probeMuonEtaMax_, probeMuonEtaMin_, probeIsMuonGlb_, probeD0Cut_, probeZ0Cut_); + MuonCollection targetMuons = selectedMuons(*allMuons, *beamSpot, true); + MuonCollection probeMuons = selectedMuons(*allMuons, *beamSpot, false); TriggerObjectCollection allTriggerObjects = triggerSummary->getObjects(); - TriggerObjectCollection hltMuons = - selectedTriggerObjects(allTriggerObjects, *triggerSummary, triggerEtaMaxCut_, triggerEtaMinCut_); + TriggerObjectCollection hltMuons = selectedTriggerObjects(allTriggerObjects, *triggerSummary); // Fill plots for HLT muons. // Find the best trigger object matches for the targetMuons. @@ -376,23 +373,22 @@ vector HLTMuonMatchAndPlot::matchByDeltaR(const vector& collection1, MuonCollection HLTMuonMatchAndPlot::selectedMuons(const MuonCollection& allMuons, const BeamSpot& beamSpot, - double RecoMuonEtaMax, - double RecoMuonEtaMin, - bool IsMuonGlb, - double d0Cut, - double z0Cut) { + 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(); - bool muID = true; - if (IsMuonGlb) - muID = mu.isGlobalMuon(); - else - muID = mu.isStandAloneMuon(); // minimun ID (requested for cosmics) + // 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); @@ -402,19 +398,16 @@ MuonCollection HLTMuonMatchAndPlot::selectedMuons(const MuonCollection& allMuons } TriggerObjectCollection HLTMuonMatchAndPlot::selectedTriggerObjects(const TriggerObjectCollection& triggerObjects, - const TriggerEvent& triggerSummary, - double triggerEtaMaxCut, - double triggerEtaMinCut) { + 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 (abs(foundObject.eta()) < triggerEtaMaxCut && abs(foundObject.eta()) >= triggerEtaMinCut) + if (abs(foundObject.eta()) < triggerEtaMaxCut_ && abs(foundObject.eta()) >= triggerEtaMinCut_) selectedObjects.push_back(foundObject); } }