diff --git a/DQMOffline/L1Trigger/interface/L1TMuonDQMOffline.h b/DQMOffline/L1Trigger/interface/L1TMuonDQMOffline.h index ff1a529e2bf3b..a0dde577aee23 100644 --- a/DQMOffline/L1Trigger/interface/L1TMuonDQMOffline.h +++ b/DQMOffline/L1Trigger/interface/L1TMuonDQMOffline.h @@ -21,6 +21,7 @@ #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/LuminosityBlock.h" #include "FWCore/Framework/interface/MakerMacros.h" +#include "FWCore/Common/interface/TriggerNames.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "DQMServices/Core/interface/DQMStore.h" #include "FWCore/ServiceRegistry/interface/Service.h" diff --git a/DQMOffline/L1Trigger/python/L1TEtSumJetOffline_cfi.py b/DQMOffline/L1Trigger/python/L1TEtSumJetOffline_cfi.py index 812cda8a4cb9c..11e82c63b549b 100644 --- a/DQMOffline/L1Trigger/python/L1TEtSumJetOffline_cfi.py +++ b/DQMOffline/L1Trigger/python/L1TEtSumJetOffline_cfi.py @@ -87,7 +87,7 @@ from L1Trigger.L1TNtuples.L1TPFMetNoMuProducer_cfi import l1tPFMetNoMu l1tPFMetNoMuForDQM = l1tPFMetNoMu.clone( - pfMETCollection= 'pfMETT1', + pfMETCollection= 'pfMet', ## Was 'pfMETT1', threw errors - AWB 2022.09.28 muonCollection= 'muons' ) diff --git a/DQMOffline/L1Trigger/src/L1TCommon.cc b/DQMOffline/L1Trigger/src/L1TCommon.cc index 71bf090657620..ab2ff652ca4d5 100644 --- a/DQMOffline/L1Trigger/src/L1TCommon.cc +++ b/DQMOffline/L1Trigger/src/L1TCommon.cc @@ -101,8 +101,19 @@ namespace dqmoffline { const std::string triggerProcess) { std::vector results; for (auto trigger : triggers) { - unsigned int hltIndexOffset(2); - unsigned int moduleIndex = hltConfig.size(trigger) - hltIndexOffset; + // For some reason various modules now come *after* "hltBoolEnd" + // Really just want module one index before "hltBoolEnd" - AWB 2022.09.28 + unsigned int moduleIndex = 999999; + for (int ii = 0; ii < int(hltConfig.size(trigger)); ii++) { + if (hltConfig.moduleLabels(trigger)[ii] == "hltBoolEnd") { + moduleIndex = ii - 1; + break; + } + } + if (moduleIndex == 999999) { + edm::LogError("L1TCommon") << " Found no module label in trigger " << trigger << std::endl; + continue; + } const std::vector &modules(hltConfig.moduleLabels(trigger)); std::string module(modules[moduleIndex]); edm::InputTag filterInputTag = edm::InputTag(module, "", triggerProcess); diff --git a/DQMOffline/L1Trigger/src/L1TMuonDQMOffline.cc b/DQMOffline/L1Trigger/src/L1TMuonDQMOffline.cc index 882ee34aa9eea..889e5656704a7 100644 --- a/DQMOffline/L1Trigger/src/L1TMuonDQMOffline.cc +++ b/DQMOffline/L1Trigger/src/L1TMuonDQMOffline.cc @@ -155,7 +155,7 @@ L1TMuonDQMOffline::L1TMuonDQMOffline(const ParameterSet& ps) m_minTagProbeDR(0.5), m_maxHltMuonDR(0.1) { if (m_verbose) - cout << "[L1TMuonDQMOffline:] ____________ Storage initialization ____________ " << endl; + edm::LogInfo("L1TMuonDQMOffline") << "____________ Storage initialization ____________ " << endl; for (const auto& cutsPSet : m_cutsVPSet) { const auto qCut = cutsPSet.getUntrackedParameter("qualCut"); @@ -176,7 +176,7 @@ L1TMuonDQMOffline::~L1TMuonDQMOffline() {} //---------------------------------------------------------------------- void L1TMuonDQMOffline::dqmBeginRun(const edm::Run& run, const edm::EventSetup& iSetup) { if (m_verbose) - cout << "[L1TMuonDQMOffline:] Called beginRun." << endl; + edm::LogInfo("L1TMuonDQMOffline") << "Called beginRun." << endl; bool changed = true; m_hltConfig.init(run, iSetup, m_trigProcess, changed); } @@ -201,15 +201,20 @@ void L1TMuonDQMOffline::bookHistograms(DQMStore::IBooker& ibooker, const edm::Ru if (tmpName.Contains(tNamePattern)) { tIndex = int(ipath); m_trigIndices.push_back(tIndex); + if (m_verbose) + edm::LogInfo("L1TMuonDQMOffline") << "Found trigger " << tmpName << " with index " << tIndex << endl; } } if (tIndex < 0 && m_verbose) - cout << "[L1TMuonDQMOffline:] Warning: Could not find trigger " << (*trigNamesIt) << endl; + edm::LogInfo("L1TMuonDQMOffline") << "Warning: Could not find trigger " << (*trigNamesIt) << endl; } } //_____________________________________________________________________ void L1TMuonDQMOffline::analyze(const Event& iEvent, const EventSetup& eventSetup) { + if (m_verbose) + edm::LogInfo("L1TMuonDQMOffline") << "\nProcessing new event in analyze" << endl; + auto const propagator = m_propagatorSetup.init(eventSetup); Handle muons; @@ -225,6 +230,22 @@ void L1TMuonDQMOffline::analyze(const Event& iEvent, const EventSetup& eventSetu edm::Handle trigEvent; iEvent.getByToken(m_trigInputTag, trigEvent); + // Only process event if at least one trigger fired + bool pass_HLT = false; + for (const auto& tIndex : m_trigIndices) { + if (trigResults->accept(tIndex)) { + if (m_verbose) + edm::LogInfo("L1TMuonDQMOffline") << "Fired trigger " << m_hltConfig.triggerName(tIndex) << endl; + pass_HLT = true; + break; + } + } + if (not pass_HLT) { + if (m_verbose) + edm::LogInfo("L1TMuonDQMOffline") << "Did not fire any triggers - quitting" << endl; + return; + } + const auto nVtx = getNVertices(vertex); const Vertex primaryVertex = getPrimaryVertex(vertex, beamSpot); @@ -234,7 +255,9 @@ void L1TMuonDQMOffline::analyze(const Event& iEvent, const EventSetup& eventSetu getMuonGmtPairs(gmtCands, propagator); if (m_verbose) - cout << "[L1TMuonDQMOffline:] Computing efficiencies" << endl; + edm::LogInfo("L1TMuonDQMOffline") << "Computing efficiencies with " << m_MuonGmtPairs.size() << " muonGmtPairs, " + << m_TightMuons.size() << " tight muons, " << m_ProbeMuons.size() + << " probe muons" << endl; vector::const_iterator muonGmtPairsIt = m_MuonGmtPairs.begin(); vector::const_iterator muonGmtPairsEnd = m_MuonGmtPairs.end(); @@ -261,6 +284,10 @@ void L1TMuonDQMOffline::analyze(const Event& iEvent, const EventSetup& eventSetu if (muonGmtPairsIt->gmtQual() >= qualCut) { std::get<2>(histoKeyRes) = qualLevel; m_ResolutionHistos[histoKeyRes]->Fill(varToFill); + if (m_verbose) + edm::LogInfo("L1TMuonDQMOffline") + << "Filled resolution histo[" << std::get<0>(histoKeyRes) << ", " << std::get<1>(histoKeyRes) + << ", " << std::get<2>(histoKeyRes) << "] with " << varToFill << endl; } } } @@ -294,6 +321,9 @@ void L1TMuonDQMOffline::analyze(const Event& iEvent, const EventSetup& eventSetu // Fill denominators if (var == kEffEta) { m_EfficiencyDenEtaHistos[gmtPtCut]->Fill(varToFill); + if (m_verbose) + edm::LogInfo("L1TMuonDQMOffline") + << "Filled eff denom eta histo[" << gmtPtCut << "] with " << varToFill << endl; } else { std::get<0>(histoKeyEffDenVar) = var; // Fill for the global eta and for TF eta region that the probe muon is in @@ -301,10 +331,17 @@ void L1TMuonDQMOffline::analyze(const Event& iEvent, const EventSetup& eventSetu if (var == kEffPt) { if (cutsCounter == 0) { m_EfficiencyDenPtHistos[regToFill]->Fill(varToFill); + if (m_verbose) + edm::LogInfo("L1TMuonDQMOffline") + << "Filled eff denom pT histo[" << regToFill << "] with " << varToFill << endl; } } else { std::get<2>(histoKeyEffDenVar) = regToFill; m_EfficiencyDenVarHistos[histoKeyEffDenVar]->Fill(varToFill); + if (m_verbose) + edm::LogInfo("L1TMuonDQMOffline") << "Filled eff denom histo[" << std::get<0>(histoKeyEffDenVar) + << ", " << std::get<1>(histoKeyEffDenVar) << ", " + << std::get<2>(histoKeyEffDenVar) << "] with " << varToFill << endl; } } } @@ -315,12 +352,21 @@ void L1TMuonDQMOffline::analyze(const Event& iEvent, const EventSetup& eventSetu if (var == kEffEta) { m_histoKeyEffNumEtaType histoKeyEffNumEta = {gmtPtCut, qualLevel}; m_EfficiencyNumEtaHistos[histoKeyEffNumEta]->Fill(varToFill); + if (m_verbose) + edm::LogInfo("L1TMuonDQMOffline") + << "Filled eff num eta histo[" << std::get<0>(histoKeyEffNumEta) << ", " + << std::get<1>(histoKeyEffNumEta) << "] with " << varToFill << endl; } else { std::get<3>(histoKeyEffNumVar) = qualLevel; // Fill for the global eta and for TF eta region that the probe muon is in for (const auto regToFill : regsToFill) { std::get<2>(histoKeyEffNumVar) = regToFill; m_EfficiencyNumVarHistos[histoKeyEffNumVar]->Fill(varToFill); + if (m_verbose) + edm::LogInfo("L1TMuonDQMOffline") + << "Filled eff num histo[" << std::get<0>(histoKeyEffNumVar) << ", " + << std::get<1>(histoKeyEffNumVar) << ", " << std::get<2>(histoKeyEffNumVar) << ", " + << std::get<3>(histoKeyEffNumVar) << "] with " << varToFill << endl; } } } @@ -331,13 +377,13 @@ void L1TMuonDQMOffline::analyze(const Event& iEvent, const EventSetup& eventSetu } if (m_verbose) - cout << "[L1TMuonDQMOffline:] Computation finished" << endl; + edm::LogInfo("L1TMuonDQMOffline") << "Computation finished" << endl; } //_____________________________________________________________________ void L1TMuonDQMOffline::bookControlHistos(DQMStore::IBooker& ibooker) { if (m_verbose) - cout << "[L1TMuonDQMOffline:] Booking Control Plot Histos" << endl; + edm::LogInfo("L1TMuonDQMOffline") << "Booking Control Plot Histos" << endl; ibooker.setCurrentFolder(m_HistFolder + "/control_variables"); @@ -412,7 +458,7 @@ void L1TMuonDQMOffline::bookEfficiencyHistos(DQMStore::IBooker& ibooker) { void L1TMuonDQMOffline::bookResolutionHistos(DQMStore::IBooker& ibooker) { if (m_verbose) - cout << "[L1TMuonOffline:] Booking Resolution Plot Histos" << endl; + edm::LogInfo("L1TMuonDQMOffline") << "Booking Resolution Plot Histos" << endl; ibooker.setCurrentFolder(m_HistFolder + "/resolution"); for (const auto var : m_resTypes) { @@ -478,7 +524,7 @@ const reco::Vertex L1TMuonDQMOffline::getPrimaryVertex(Handle& //_____________________________________________________________________ void L1TMuonDQMOffline::getTightMuons(edm::Handle& muons, const Vertex& vertex) { if (m_verbose) - cout << "[L1TMuonDQMOffline:] Getting tight muons" << endl; + edm::LogInfo("L1TMuonDQMOffline") << "Getting tight muons" << endl; m_TightMuons.clear(); MuonCollection::const_iterator muonIt = muons->begin(); MuonCollection::const_iterator muonEnd = muons->end(); @@ -495,7 +541,7 @@ void L1TMuonDQMOffline::getTightMuons(edm::Handle& muons, void L1TMuonDQMOffline::getProbeMuons(Handle& trigResults, edm::Handle& trigEvent) { if (m_verbose) - cout << "[L1TMuonDQMOffline:] getting probe muons" << endl; + edm::LogInfo("L1TMuonDQMOffline") << "getting probe muons" << endl; m_ProbeMuons.clear(); std::vector tagMuonsInHist; @@ -557,7 +603,7 @@ void L1TMuonDQMOffline::getMuonGmtPairs(edm::Handle& gmtC PropagateToMuon const& propagator) { m_MuonGmtPairs.clear(); if (m_verbose) - cout << "[L1TMuonDQMOffline:] Getting muon GMT pairs" << endl; + edm::LogInfo("L1TMuonDQMOffline") << "Getting muon GMT pairs" << endl; vector::const_iterator probeMuIt = m_ProbeMuons.begin(); vector::const_iterator probeMuEnd = m_ProbeMuons.end(); @@ -598,15 +644,36 @@ double L1TMuonDQMOffline::matchHlt(edm::Handle& triggerEvent, cons for (; trigIndexIt != trigIndexEnd; ++trigIndexIt) { const vector moduleLabels(m_hltConfig.moduleLabels(*trigIndexIt)); - const unsigned moduleIndex = m_hltConfig.size((*trigIndexIt)) - 2; + // For some reason various modules now come *after* "hltBoolEnd" + // Really just want module one index before "hltBoolEnd" - AWB 2022.09.28 + // const unsigned moduleIndex = m_hltConfig.size((*trigIndexIt)) - 2; + unsigned int moduleIndex = 999999; + for (int ii = 0; ii < int(moduleLabels.size()); ii++) { + if (moduleLabels[ii] == "hltBoolEnd") { + moduleIndex = ii - 1; + break; + } + } + if (moduleIndex == 999999) { + edm::LogError("L1TMuonDQMOffline") << "Found no module label in trigger " << (*trigIndexIt) << endl; + continue; + } + const unsigned hltFilterIndex = triggerEvent->filterIndex(InputTag(moduleLabels[moduleIndex], "", m_trigProcess)); if (hltFilterIndex < triggerEvent->sizeFilters()) { const Keys triggerKeys(triggerEvent->filterKeys(hltFilterIndex)); const Vids triggerVids(triggerEvent->filterIds(hltFilterIndex)); const unsigned nTriggers = triggerVids.size(); + for (size_t iTrig = 0; iTrig < nTriggers; ++iTrig) { const TriggerObject trigObject = trigObjs[triggerKeys[iTrig]]; + if (m_verbose) + edm::LogInfo("L1TMuonDQMOffline") << "Found trigObject with pt = " << trigObject.pt() + << ", eta = " << trigObject.eta() << ", phi = " << trigObject.phi() << endl; + if (m_verbose) + edm::LogInfo("L1TMuonDQMOffline") << "Compare to muon with pt = " << (*mu).pt() << ", eta = " << (*mu).eta() + << ", phi = " << (*mu).phi() << endl; double dRtmp = deltaR((*mu), trigObject); if (dRtmp < matchDeltaR) matchDeltaR = dRtmp;