Skip to content

Commit

Permalink
Adapt HLT filters to new AlgoBlock container
Browse files Browse the repository at this point in the history
  • Loading branch information
Benjamin Huber committed Apr 9, 2024
1 parent 1804b88 commit 10009ae
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 36 deletions.
43 changes: 20 additions & 23 deletions HLTrigger/HLTfilters/plugins/HLTDoubletDZ.cc
Expand Up @@ -47,7 +47,7 @@ HLTDoubletDZ<l1t::P2GTCandidate, l1t::P2GTCandidate>::HLTDoubletDZ(const edm::Pa
originTag2_(iConfig.getParameter<std::vector<edm::InputTag>>("originTag2")),
electronToken_(edm::EDGetTokenT<reco::ElectronCollection>()),
l1GTAlgoBlockTag_(iConfig.template getParameter<edm::InputTag>("l1GTAlgoBlockTag")),
algoBlockToken_(consumes<std::vector<l1t::P2GTAlgoBlock>>(l1GTAlgoBlockTag_)),
algoBlockToken_(consumes<l1t::P2GTAlgoBlockMap>(l1GTAlgoBlockTag_)),
l1GTAlgoName1_(iConfig.template getParameter<std::string>("l1GTAlgoName1")),
l1GTAlgoName2_(iConfig.template getParameter<std::string>("l1GTAlgoName2")),
triggerType1_(iConfig.getParameter<int>("triggerType1")),
Expand Down Expand Up @@ -394,29 +394,26 @@ bool HLTDoubletDZ<l1t::P2GTCandidate, l1t::P2GTCandidate>::getCollections(
std::vector<l1t::P2GTCandidateRef>& coll1,
std::vector<l1t::P2GTCandidateRef>& coll2,
trigger::TriggerFilterObjectWithRefs& filterproduct) const {
const std::vector<l1t::P2GTAlgoBlock>& algos = iEvent.get(algoBlockToken_);

if (!algos.empty()) {
for (const l1t::P2GTAlgoBlock& algo : algos) {
if (algo.algoName() == l1GTAlgoName1_ && algo.decisionBeforeBxMaskAndPrescale()) {
const l1t::P2GTCandidateVectorRef& objects = algo.trigObjects();
for (const l1t::P2GTCandidateRef& obj : objects) {
if ((triggerType1_ == trigger::TriggerObjectType::TriggerL1TkMu && obj->isMuon()) ||
(triggerType1_ == trigger::TriggerObjectType::TriggerL1TkEle && obj->isElectron()) ||
(triggerType1_ == trigger::TriggerObjectType::TriggerL1TkEm && obj->isPhoton())) {
coll1.push_back(obj);
}
}
const l1t::P2GTAlgoBlockMap& algos = iEvent.get(algoBlockToken_);

if (algos.count(l1GTAlgoName1_) > 0 && algos.at(l1GTAlgoName1_).decisionBeforeBxMaskAndPrescale()) {
const l1t::P2GTCandidateVectorRef& objects = algos.at(l1GTAlgoName1_).trigObjects();
for (const l1t::P2GTCandidateRef& obj : objects) {
if ((triggerType1_ == trigger::TriggerObjectType::TriggerL1TkMu && obj->isMuon()) ||
(triggerType1_ == trigger::TriggerObjectType::TriggerL1TkEle && obj->isElectron()) ||
(triggerType1_ == trigger::TriggerObjectType::TriggerL1TkEm && obj->isPhoton())) {
coll1.push_back(obj);
}
if (algo.algoName() == l1GTAlgoName2_ && algo.decisionBeforeBxMaskAndPrescale()) {
const l1t::P2GTCandidateVectorRef& objects = algo.trigObjects();
for (const l1t::P2GTCandidateRef& obj : objects) {
if ((triggerType2_ == trigger::TriggerObjectType::TriggerL1TkMu && obj->isMuon()) ||
(triggerType2_ == trigger::TriggerObjectType::TriggerL1TkEle && obj->isElectron()) ||
(triggerType2_ == trigger::TriggerObjectType::TriggerL1TkEm && obj->isPhoton())) {
coll2.push_back(obj);
}
}
}
}

if (algos.count(l1GTAlgoName2_) > 0 && algos.at(l1GTAlgoName2_).decisionBeforeBxMaskAndPrescale()) {
const l1t::P2GTCandidateVectorRef& objects = algos.at(l1GTAlgoName2_).trigObjects();
for (const l1t::P2GTCandidateRef& obj : objects) {
if ((triggerType2_ == trigger::TriggerObjectType::TriggerL1TkMu && obj->isMuon()) ||
(triggerType2_ == trigger::TriggerObjectType::TriggerL1TkEle && obj->isElectron()) ||
(triggerType2_ == trigger::TriggerObjectType::TriggerL1TkEm && obj->isPhoton())) {
coll2.push_back(obj);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion HLTrigger/HLTfilters/plugins/HLTDoubletDZ.h
Expand Up @@ -57,7 +57,7 @@ class HLTDoubletDZ : public HLTFilter {
const edm::EDGetTokenT<trigger::TriggerFilterObjectWithRefs> inputToken2_;
const edm::EDGetTokenT<reco::ElectronCollection> electronToken_;
const edm::InputTag l1GTAlgoBlockTag_;
const edm::EDGetTokenT<std::vector<l1t::P2GTAlgoBlock>> algoBlockToken_;
const edm::EDGetTokenT<l1t::P2GTAlgoBlockMap> algoBlockToken_;
const std::string l1GTAlgoName1_;
const std::string l1GTAlgoName2_;
const int triggerType1_;
Expand Down
20 changes: 9 additions & 11 deletions HLTrigger/Muon/plugins/HLTMuonTrkL1TkMuFilter.cc
Expand Up @@ -29,7 +29,7 @@ HLTMuonTrkL1TkMuFilter::HLTMuonTrkL1TkMuFilter(const edm::ParameterSet& iConfig)
m_candsTag = iConfig.getParameter<edm::InputTag>("inputCandCollection");
m_candsToken = consumes<reco::RecoChargedCandidateCollection>(m_candsTag);
m_l1GTAlgoBlockTag = iConfig.getParameter<edm::InputTag>("l1GTAlgoBlockTag");
m_algoBlockToken = consumes<std::vector<l1t::P2GTAlgoBlock>>(m_l1GTAlgoBlockTag);
m_algoBlockToken = consumes<l1t::P2GTAlgoBlockMap>(m_l1GTAlgoBlockTag);
m_l1GTAlgoNames = iConfig.getParameter<std::vector<std::string>>("l1GTAlgoNames");
m_minTrkHits = iConfig.getParameter<int>("minTrkHits");
m_minMuonHits = iConfig.getParameter<int>("minMuonHits");
Expand Down Expand Up @@ -76,16 +76,14 @@ bool HLTMuonTrkL1TkMuFilter::hltFilter(edm::Event& iEvent,
if (m_l1GTAlgoBlockTag == edm::InputTag("") || m_l1GTAlgoNames.empty())
check_l1match = false;
if (check_l1match) {
const std::vector<l1t::P2GTAlgoBlock>& algos = iEvent.get(m_algoBlockToken);
for (const l1t::P2GTAlgoBlock& algo : algos) {
for (auto& algoName : m_l1GTAlgoNames) {
if (algo.algoName() == algoName && algo.decisionBeforeBxMaskAndPrescale()) {
const l1t::P2GTCandidateVectorRef& objects = algo.trigObjects();
for (const l1t::P2GTCandidateRef& obj : objects) {
if (obj->objectType() == l1t::P2GTCandidate::ObjectType::GMTTkMuons) {
vl1cands.push_back(obj);
LogDebug("HLTMuonTrkL1TkMuFilter") << "Found P2GTCandidate ObjectType::GMTTkMuons" << std::endl;
}
const l1t::P2GTAlgoBlockMap& algos = iEvent.get(m_algoBlockToken);
for (auto& algoName : m_l1GTAlgoNames) {
if (algos.count(algoName) > 0 && algos.at(algoName).decisionBeforeBxMaskAndPrescale()) {
const l1t::P2GTCandidateVectorRef& objects = algos.at(algoName).trigObjects();
for (const l1t::P2GTCandidateRef& obj : objects) {
if (obj->objectType() == l1t::P2GTCandidate::ObjectType::GMTTkMuons) {
vl1cands.push_back(obj);
LogDebug("HLTMuonTrkL1TkMuFilter") << "Found P2GTCandidate ObjectType::GMTTkMuons" << std::endl;
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion HLTrigger/Muon/plugins/HLTMuonTrkL1TkMuFilter.h
Expand Up @@ -29,7 +29,7 @@ class HLTMuonTrkL1TkMuFilter : public HLTFilter {
edm::InputTag m_candsTag; // input collection of candidates to be referenced
edm::EDGetTokenT<reco::RecoChargedCandidateCollection> m_candsToken; // input collection of candidates to be referenced
edm::InputTag m_l1GTAlgoBlockTag;
edm::EDGetTokenT<std::vector<l1t::P2GTAlgoBlock>> m_algoBlockToken;
edm::EDGetTokenT<l1t::P2GTAlgoBlockMap> m_algoBlockToken;
std::vector<std::string> m_l1GTAlgoNames;
int m_minTrkHits;
int m_minMuonHits;
Expand Down

0 comments on commit 10009ae

Please sign in to comment.