From 2482bd9e954802a3b9800a439b2f0d079aea136c Mon Sep 17 00:00:00 2001
From: caruta <42809546+caruta@users.noreply.github.com>
Date: Tue, 25 Jul 2023 09:57:47 +0200
Subject: [PATCH] Fix in mu ID check

---
 DQMOffline/Trigger/src/HLTMuonMatchAndPlot.cc | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/DQMOffline/Trigger/src/HLTMuonMatchAndPlot.cc b/DQMOffline/Trigger/src/HLTMuonMatchAndPlot.cc
index 846487de6da37..8a3764b8fa1f5 100644
--- a/DQMOffline/Trigger/src/HLTMuonMatchAndPlot.cc
+++ b/DQMOffline/Trigger/src/HLTMuonMatchAndPlot.cc
@@ -59,8 +59,8 @@ HLTMuonMatchAndPlot::HLTMuonMatchAndPlot(const ParameterSet& pset, string hltPat
       probeD0Cut_(probeParams_.getUntrackedParameter<double>("d0Cut", 0.)),
       //triggerSelector_(targetParams_.getUntrackedParameter<string>("hltCuts", "")),
       triggerEtaCut_(targetParams_.getUntrackedParameter<double>("hltEtaCut", 0.))
-      //hasTriggerCuts_(targetParams_.exists("hltCuts")) 
-      {
+//hasTriggerCuts_(targetParams_.exists("hltCuts"))
+{
   // Create std::map<string, T> from ParameterSets.
   fillMapFromPSet(binParams_, pset, "binParams");
   fillMapFromPSet(plotCuts_, pset, "plotCuts");
@@ -401,8 +401,12 @@ MuonCollection HLTMuonMatchAndPlot::selectedMuons(const MuonCollection& allMuons
     else if (mu.isStandAloneMuon())
       track = &*mu.outerTrack();
     //if (track && selector(mu) && fabs(track->dxy(beamSpot.position())) < d0Cut &&
-    IsMuonGlb = (&mu)->isGlobalMuon();
-    if (track && IsMuonGlb && abs((&mu)->eta()) < RecoMuonEta && fabs(track->dxy(beamSpot.position())) < d0Cut &&
+    bool muID = false;
+    if (IsMuonGlb)
+      muID = (&mu)->isGlobalMuon();
+    else
+      muID = true;
+    if (track && muID && abs((&mu)->eta()) < RecoMuonEta && fabs(track->dxy(beamSpot.position())) < d0Cut &&
         fabs(track->dz(beamSpot.position())) < z0Cut)
       reducedMuons.push_back(mu);
   }
@@ -417,7 +421,7 @@ TriggerObjectCollection HLTMuonMatchAndPlot::selectedTriggerObjects(
     //const StringCutObjectSelector<TriggerObject>& triggerSelector) {
     double triggerEtaCut_) {
   //if (!hasTriggerCuts)
-    //return TriggerObjectCollection();
+  //return TriggerObjectCollection();
 
   InputTag filterTag(moduleLabel_, "", hltProcessName_);
   size_t filterIndex = triggerSummary.filterIndex(filterTag);
@@ -429,7 +433,7 @@ TriggerObjectCollection HLTMuonMatchAndPlot::selectedTriggerObjects(
     for (unsigned short key : keys) {
       TriggerObject foundObject = triggerObjects[key];
       //if (triggerSelector(foundObject))
-      if(abs((&foundObject)->eta()) < triggerEtaCut_)
+      if (abs((&foundObject)->eta()) < triggerEtaCut_)
         selectedObjects.push_back(foundObject);
     }
   }