Skip to content

Commit

Permalink
Addressing perrota's comments
Browse files Browse the repository at this point in the history
  • Loading branch information
caruta authored Jul 28, 2023
1 parent 094ff48 commit 6017962
Showing 1 changed file with 14 additions and 21 deletions.
35 changes: 14 additions & 21 deletions DQMOffline/Trigger/src/HLTMuonMatchAndPlot.cc
Original file line number Diff line number Diff line change
Expand Up @@ -175,13 +175,10 @@ void HLTMuonMatchAndPlot::analyze(Handle<MuonCollection>& 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.
Expand Down Expand Up @@ -376,23 +373,22 @@ vector<size_t> HLTMuonMatchAndPlot::matchByDeltaR(const vector<T1>& 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);
Expand All @@ -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);
}
}
Expand Down

0 comments on commit 6017962

Please sign in to comment.