diff --git a/DPGAnalysis/MuonTools/plugins/MuNtupleCSCTnPFiller.cc b/DPGAnalysis/MuonTools/plugins/MuNtupleCSCTnPFiller.cc index c7bda2002e4f2..944a6bd45552d 100644 --- a/DPGAnalysis/MuonTools/plugins/MuNtupleCSCTnPFiller.cc +++ b/DPGAnalysis/MuonTools/plugins/MuNtupleCSCTnPFiller.cc @@ -532,38 +532,29 @@ bool MuNtupleCSCTnPFiller::hasTrigger(std::vector& trigIndices, const trigger::TriggerObjectCollection& trigObjs, edm::Handle& trigEvent, const reco::Muon& muon) { - double matchDeltaR = 999.; - - for (const auto& trigIndex : trigIndices) { - const std::vector moduleLabels(m_hltConfig.moduleLabels(trigIndex)); - - // find index of the last module: - const unsigned moduleIndex = m_hltConfig.size(trigIndex) - 2; - - // find index of HLT trigger name: - const unsigned hltFilterIndex = trigEvent->filterIndex(edm::InputTag(moduleLabels[moduleIndex], "", "HLT")); + float dRMatch = 999.; + for (int trigIdx : trigIndices) { + const std::vector trigModuleLabels = m_hltConfig.moduleLabels(trigIdx); + const unsigned trigModuleIndex = + std::find(trigModuleLabels.begin(), trigModuleLabels.end(), "hltBoolEnd") - trigModuleLabels.begin() - 1; + const unsigned hltFilterIndex = trigEvent->filterIndex(edm::InputTag(trigModuleLabels[trigModuleIndex], "", "HLT")); if (hltFilterIndex < trigEvent->sizeFilters()) { - const trigger::Keys triggerKeys(trigEvent->filterKeys(hltFilterIndex)); - const trigger::Vids triggerVids(trigEvent->filterIds(hltFilterIndex)); - - const size_t nTriggers = triggerVids.size(); - - for (size_t iTrig = 0; iTrig < nTriggers; ++iTrig) { - // loop over all trigger objects: - const trigger::TriggerObject trigObject = trigObjs[triggerKeys[iTrig]]; - - double dR = deltaR(muon, trigObject); - if (dR < matchDeltaR) - matchDeltaR = dR; - - } // loop over different trigger objects - - } // if trigger is in event (should apply hltFilter with used trigger...) + const trigger::Keys keys = trigEvent->filterKeys(hltFilterIndex); + const trigger::Vids vids = trigEvent->filterIds(hltFilterIndex); + const unsigned nTriggers = vids.size(); + + for (unsigned iTrig = 0; iTrig < nTriggers; ++iTrig) { + trigger::TriggerObject trigObj = trigObjs[keys[iTrig]]; + float dR = deltaR(muon, trigObj); + if (dR < dRMatch) + dRMatch = dR; + } + } + } - } // loop over muon candidates + return dRMatch < 0.1; //CB should get it programmable - return matchDeltaR < 0.1; //CB should get it programmable } //bool MuNtupleCSCTnPFiller::muonTagSelection(const reco::Muon & muon,edm::Handle> tracks) diff --git a/DPGAnalysis/MuonTools/plugins/MuNtupleMuonFiller.cc b/DPGAnalysis/MuonTools/plugins/MuNtupleMuonFiller.cc index f2b3fb75a8ea7..1aeac6bf91b57 100644 --- a/DPGAnalysis/MuonTools/plugins/MuNtupleMuonFiller.cc +++ b/DPGAnalysis/MuonTools/plugins/MuNtupleMuonFiller.cc @@ -414,6 +414,10 @@ void MuNtupleMuonFiller::fill(edm::Event& ev) { addColumn(tabMatches, "x", matches_x, "X position of the extrapolated track on the matched chamber"); addColumn(tabMatches, "y", matches_y, "Y position of the extrapolated track on the matched chamber"); + addColumn(tabMatches, "wheel", matches_wheel, "Matched chamber wheel"); + addColumn(tabMatches, "sector", matches_sector, "Matched chamber sector"); + addColumn(tabMatches, "station", matches_station, "Matched chamber station"); + addColumn( tabMatches, "phi", matches_phi, "Phi of the (x,y) position on the matched chamber (global reference frame)"); addColumn( @@ -453,39 +457,28 @@ bool MuNtupleMuonFiller::hasTrigger(std::vector& trigIndices, const trigger::TriggerObjectCollection& trigObjs, edm::Handle& trigEvent, const reco::Muon& muon) { - double matchDeltaR = 999.; - - for (const auto& trigIndex : trigIndices) { - const std::vector moduleLabels(m_hltConfig.moduleLabels(trigIndex)); - - // find index of the last module: - const unsigned moduleIndex = m_hltConfig.size(trigIndex) - 2; - - // find index of HLT trigger name: - const unsigned hltFilterIndex = trigEvent->filterIndex(edm::InputTag(moduleLabels[moduleIndex], "", "HLT")); + float dRMatch = 999.; + for (int trigIdx : trigIndices) { + const std::vector trigModuleLabels = m_hltConfig.moduleLabels(trigIdx); + const unsigned trigModuleIndex = + std::find(trigModuleLabels.begin(), trigModuleLabels.end(), "hltBoolEnd") - trigModuleLabels.begin() - 1; + const unsigned hltFilterIndex = trigEvent->filterIndex(edm::InputTag(trigModuleLabels[trigModuleIndex], "", "HLT")); if (hltFilterIndex < trigEvent->sizeFilters()) { - const trigger::Keys triggerKeys(trigEvent->filterKeys(hltFilterIndex)); - const trigger::Vids triggerVids(trigEvent->filterIds(hltFilterIndex)); - - const size_t nTriggers = triggerVids.size(); - - for (size_t iTrig = 0; iTrig < nTriggers; ++iTrig) { - // loop over all trigger objects: - const trigger::TriggerObject trigObject = trigObjs[triggerKeys[iTrig]]; - - double dR = deltaR(muon, trigObject); - - if (dR < matchDeltaR) - matchDeltaR = dR; - - } // loop over different trigger objects - - } // if trigger is in event (should apply hltFilter with used trigger...) - - } // loop over muon candidates + const trigger::Keys keys = trigEvent->filterKeys(hltFilterIndex); + const trigger::Vids vids = trigEvent->filterIds(hltFilterIndex); + const unsigned nTriggers = vids.size(); + + for (unsigned iTrig = 0; iTrig < nTriggers; ++iTrig) { + trigger::TriggerObject trigObj = trigObjs[keys[iTrig]]; + float dR = deltaR(muon, trigObj); + if (dR < dRMatch) + dRMatch = dR; + } + } + } - return matchDeltaR < 0.1; //CB should get it programmable + return dRMatch < 0.1; //CB should get it programmable } #include "FWCore/PluginManager/interface/ModuleDef.h"