Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix L1 candidate matching in HLTMuonL1TFilter #37110

Merged
merged 2 commits into from
Mar 2, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions HLTrigger/Muon/plugins/HLTMuonL1TFilter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
#include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
#include "FWCore/Utilities/interface/InputTag.h"
#include "DataFormats/Math/interface/deltaR.h"
#include "TMath.h"

#include <vector>
Expand All @@ -27,6 +28,8 @@ HLTMuonL1TFilter::HLTMuonL1TFilter(const edm::ParameterSet& iConfig)
previousCandToken_(consumes<trigger::TriggerFilterObjectWithRefs>(previousCandTag_)),
maxEta_(iConfig.getParameter<double>("MaxEta")),
minPt_(iConfig.getParameter<double>("MinPt")),
maxDR_(iConfig.getParameter<double>("MaxDeltaR")),
maxDR2_(maxDR_ * maxDR_),
minN_(iConfig.getParameter<int>("MinN")),
centralBxOnly_(iConfig.getParameter<bool>("CentralBxOnly")) {
//set the quality bit mask
Expand All @@ -38,7 +41,11 @@ HLTMuonL1TFilter::HLTMuonL1TFilter(const edm::ParameterSet& iConfig)
// }
qualityBitMask_ |= 1 << selectQualitie;
}

//make sure cut parameter for candidate matching is strictly positive
if (maxDR_ <= 0.) {
throw cms::Exception("HLTMuonL1TFilterConfiguration")
<< "invalid value for parameter \"MaxDeltaR\" (must be > 0): " << maxDR_;
}
// dump parameters for debugging
if (edm::isDebugEnabled()) {
ostringstream ss;
Expand Down Expand Up @@ -67,6 +74,7 @@ void HLTMuonL1TFilter::fillDescriptions(edm::ConfigurationDescriptions& descript
desc.add<edm::InputTag>("PreviousCandTag", edm::InputTag(""));
desc.add<double>("MaxEta", 2.5);
desc.add<double>("MinPt", 0.0);
desc.add<double>("MaxDeltaR", 0.3);
desc.add<int>("MinN", 1);
desc.add<bool>("CentralBxOnly", true);
{
Expand Down Expand Up @@ -110,7 +118,15 @@ bool HLTMuonL1TFilter::hltFilter(edm::Event& iEvent,
MuonRef muon(allMuons, distance(allMuons->begin(allMuons->getFirstBX()), it));

// Only select muons that were selected in the previous level
if (find(prevMuons.begin(), prevMuons.end(), muon) == prevMuons.end())
bool matchPrevL1 = false;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

deltaR2 is a rather expensive operation (ok, better than deltaR): I would suggest to move this check after all other, cheaper, ones

int prevSize = prevMuons.size();
for (int it2 = 0; it2 < prevSize; it2++) {
if (deltaR2(muon->eta(), muon->phi(), prevMuons[it2]->eta(), prevMuons[it2]->phi()) < maxDR2_) {
matchPrevL1 = true;
break;
}
}
if (!matchPrevL1)
continue;

//check maxEta cut
Expand Down
4 changes: 4 additions & 0 deletions HLTrigger/Muon/plugins/HLTMuonL1TFilter.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ class HLTMuonL1TFilter : public HLTFilter {
/// pT threshold
double minPt_;

/// max dRs for L1 candidate matching
double maxDR_;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you decide to touch the code, these and all other private class members can also be made const

double maxDR2_;

/// Quality codes:
/// to be updated with new L1 quality definitions
int qualityBitMask_;
Expand Down