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 all commits
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
26 changes: 21 additions & 5 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 @@ -109,10 +117,6 @@ bool HLTMuonL1TFilter::hltFilter(edm::Event& iEvent,
for (auto it = allMuons->begin(ibx); it != allMuons->end(ibx); it++) {
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())
continue;

//check maxEta cut
if (fabs(muon->eta()) > maxEta_)
continue;
Expand All @@ -128,6 +132,18 @@ bool HLTMuonL1TFilter::hltFilter(edm::Event& iEvent,
continue;
}

// Only select muons that were selected in the previous level
bool matchPrevL1 = false;
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;

//we have a good candidate
n++;
filterproduct.addObject(TriggerL1Mu, muon);
Expand Down
12 changes: 8 additions & 4 deletions HLTrigger/Muon/plugins/HLTMuonL1TFilter.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,20 +33,24 @@ class HLTMuonL1TFilter : public HLTFilter {
edm::EDGetTokenT<trigger::TriggerFilterObjectWithRefs> previousCandToken_;

/// max Eta cut
double maxEta_;
const double maxEta_;

/// pT threshold
double minPt_;
const double minPt_;

/// max dRs for L1 candidate matching
const double maxDR_;
const double maxDR2_;

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

/// min N objects
double minN_;
const double minN_;

/// use central bx only muons
bool centralBxOnly_;
const bool centralBxOnly_;
};

#endif //HLTMuonL1TFilter_h