Skip to content
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
11 changes: 11 additions & 0 deletions HLTrigger/Configuration/python/customizeHLTforCMSSW.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,16 @@ def customizeHLTfor43025(process):

return process

def customizeHLTfor43549(process):
""" This customization is related to ticket https://its.cern.ch/jira/browse/CMSHLT-2975
If all 3 input tags L1CandTag, InpuLinks and inputMuonCollection are null (hence not consumed)
it means that the HLTMuonL3PreFilter should be configured such that the flag requireL3MuonTrajectorySeed is true
"""
for filter in filters_by_type(process, "HLTMuonL3PreFilter"):
if (filter.L1CandTag == cms.InputTag("") and filter.InputLinks == cms.InputTag("") and filter.inputMuonCollection == cms.InputTag("")):
filter.requireL3MuonTrajectorySeed = cms.bool(True)

return process

# CMSSW version specific customizations
def customizeHLTforCMSSW(process, menuType="GRun"):
Expand All @@ -260,5 +270,6 @@ def customizeHLTforCMSSW(process, menuType="GRun"):
# process = customiseFor12718(process)

process = customizeHLTfor43025(process)
process = customizeHLTfor43549(process)

return process
26 changes: 22 additions & 4 deletions HLTrigger/Muon/plugins/HLTMuonL3PreFilter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,13 @@ HLTMuonL3PreFilter::HLTMuonL3PreFilter(const ParameterSet& iConfig)
candToken_(consumes<reco::RecoChargedCandidateCollection>(candTag_)),
previousCandTag_(iConfig.getParameter<InputTag>("PreviousCandTag")),
previousCandToken_(consumes<trigger::TriggerFilterObjectWithRefs>(previousCandTag_)),
requireL3MuonTrajectorySeed_(iConfig.getParameter<bool>("requireL3MuonTrajectorySeed")),
l1CandTag_(iConfig.getParameter<InputTag>("L1CandTag")),
l1CandToken_(consumes<trigger::TriggerFilterObjectWithRefs>(l1CandTag_)),
l1CandToken_(requireL3MuonTrajectorySeed_ ? edm::EDGetTokenT<trigger::TriggerFilterObjectWithRefs>()
: consumes<trigger::TriggerFilterObjectWithRefs>(l1CandTag_)),
recoMuTag_(iConfig.getParameter<InputTag>("inputMuonCollection")),
recoMuToken_(consumes<reco::MuonCollection>(recoMuTag_)),
recoMuToken_(requireL3MuonTrajectorySeed_ ? edm::EDGetTokenT<reco::MuonCollection>()
: consumes<reco::MuonCollection>(recoMuTag_)),
min_N_(iConfig.getParameter<int>("MinN")),
max_Eta_(iConfig.getParameter<double>("MaxEta")),
min_Nhits_(iConfig.getParameter<int>("MinNhits")),
Expand All @@ -72,7 +75,8 @@ HLTMuonL3PreFilter::HLTMuonL3PreFilter(const ParameterSet& iConfig)

devDebug_(false),
theL3LinksLabel(iConfig.getParameter<InputTag>("InputLinks")),
linkToken_(consumes<reco::MuonTrackLinksCollection>(theL3LinksLabel)) {
linkToken_(requireL3MuonTrajectorySeed_ ? edm::EDGetTokenT<reco::MuonTrackLinksCollection>()
: consumes<reco::MuonTrackLinksCollection>(theL3LinksLabel)) {
if (L1MatchingdR_ <= 0.) {
throw cms::Exception("HLTMuonL3PreFilterConfiguration")
<< "invalid value for parameter \"L1MatchingdR\" (must be > 0): " << L1MatchingdR_;
Expand Down Expand Up @@ -119,6 +123,7 @@ void HLTMuonL3PreFilter::fillDescriptions(edm::ConfigurationDescriptions& descri
desc.add<double>("L1MatchingdR", 0.3);
desc.add<bool>("MatchToPreviousCand", true);
desc.add<edm::InputTag>("InputLinks", edm::InputTag(""));
desc.add<bool>("requireL3MuonTrajectorySeed", false);
PropagateToMuonSetup::fillPSetDescription(desc);
descriptions.add("hltMuonL3PreFilter", desc);
}
Expand Down Expand Up @@ -171,6 +176,14 @@ bool HLTMuonL3PreFilter::hltFilter(Event& iEvent,

if (tk->seedRef().isNonnull()) {
auto a = dynamic_cast<const L3MuonTrajectorySeed*>(tk->seedRef().get());

if (requireL3MuonTrajectorySeed_ && not a) {
throw cms::Exception("HLTMuonL3PreFilter")
<< "requireL3MuonTrajectorySeed is required to be true, but cannot cast the input "
"RecoChargedCandidateCollection to a L3MuonTrajectorySeed./n Please cross-check the configuration of this "
"module";
}

useL3MTS = a != nullptr;
}

Expand Down Expand Up @@ -268,7 +281,12 @@ bool HLTMuonL3PreFilter::hltFilter(Event& iEvent,

// now loop on L3 from L1
edm::Handle<reco::MuonCollection> recomuons;
iEvent.getByToken(recoMuToken_, recomuons);

// do the consume only if the MuonToL3s is not empty
// this happens certainly if requireL3MuonTrajectorySeed_ is true
if (!MuonToL3s.empty()) {
iEvent.getByToken(recoMuToken_, recomuons);
}

for (const auto& MuonToL3s_it : MuonToL3s) {
const reco::Muon& muon(recomuons->at(MuonToL3s_it.first));
Expand Down
5 changes: 3 additions & 2 deletions HLTrigger/Muon/plugins/HLTMuonL3PreFilter.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,9 @@ class HLTMuonL3PreFilter : public HLTFilter {
const edm::EDGetTokenT<reco::RecoChargedCandidateCollection> candToken_; // token identifying product contains muons
const edm::InputTag previousCandTag_; // input tag identifying product contains muons passing the previous level
const edm::EDGetTokenT<trigger::TriggerFilterObjectWithRefs>
previousCandToken_; // token identifying product contains muons passing the previous level
const edm::InputTag l1CandTag_; // input tag identifying product contains muons passing the L1 level
previousCandToken_; // token identifying product contains muons passing the previous level
const bool requireL3MuonTrajectorySeed_; // bool requiring that there is a L3Muon trajectory seed
const edm::InputTag l1CandTag_; // input tag identifying product contains muons passing the L1 level
const edm::EDGetTokenT<trigger::TriggerFilterObjectWithRefs>
l1CandToken_; // token identifying product contains muons passing the L1 level
const edm::InputTag recoMuTag_; // input tag identifying reco muons
Expand Down