From 436863b38a5e37e16db4c483f44e005f7f7216a3 Mon Sep 17 00:00:00 2001 From: Javier Date: Tue, 25 Apr 2023 13:20:17 +0200 Subject: [PATCH] Backport of PRs #41196 and #41375 --- DQMServices/Core/interface/DQMStore.h | 3 +++ .../Core/python/nanoDQMIO_perLSoutput_cff.py | 8 +++---- DQMServices/Core/src/DQMStore.cc | 23 +++++++++++++++---- 3 files changed, 26 insertions(+), 8 deletions(-) diff --git a/DQMServices/Core/interface/DQMStore.h b/DQMServices/Core/interface/DQMStore.h index aeee70b341cc5..9add4570b2fd8 100644 --- a/DQMServices/Core/interface/DQMStore.h +++ b/DQMServices/Core/interface/DQMStore.h @@ -751,6 +751,8 @@ namespace dqm { void printTrace(std::string const& message); // print a log message if ME matches trackME_. void debugTrackME(const char* message, MonitorElement* me_local, MonitorElement* me_global) const; + // accesor to keep MEsToSave_ private + const auto& getMEsToSave() const { return MEsToSave_; } private: // MEComparison is a name-only comparison on MEs and Paths, allowing @@ -792,6 +794,7 @@ namespace dqm { // Book MEs by lumi by default whenever possible. bool doSaveByLumi_; + // Book MEs by lumi from list in DQMServices/Core/python/DQMStore_cfi.py std::vector MEsToSave_; //just if perLS is ON // if non-empty, debugTrackME calls will log some information whenever a diff --git a/DQMServices/Core/python/nanoDQMIO_perLSoutput_cff.py b/DQMServices/Core/python/nanoDQMIO_perLSoutput_cff.py index 17040ccf9403f..3f3458a925aa6 100644 --- a/DQMServices/Core/python/nanoDQMIO_perLSoutput_cff.py +++ b/DQMServices/Core/python/nanoDQMIO_perLSoutput_cff.py @@ -139,16 +139,16 @@ "SiStrip/MechanicalView/MainDiagonal Position", "SiStrip/MechanicalView/NumberOfClustersInPixel", "SiStrip/MechanicalView/NumberOfClustersInStrip", - "Tracking/TrackParameters/GeneralProperties/Chi2oNDF_lumiFlag_GenTk", - "Tracking/TrackParameters/GeneralProperties/NumberOfRecHitsPerTrack_lumiFlag_GenTk", - "Tracking/TrackParameters/GeneralProperties/NumberOfTracks_lumiFlag_GenTk", + "Tracking/TrackParameters/generalTracks/LSanalysis/Chi2oNDF_lumiFlag_GenTk", + "Tracking/TrackParameters/generalTracks/LSanalysis/NumberOfRecHitsPerTrack_lumiFlag_GenTk", + "Tracking/TrackParameters/generalTracks/LSanalysis/NumberOfTracks_lumiFlag_GenTk", "Tracking/TrackParameters/highPurityTracks/pt_1/GeneralProperties/SIPDxyToPV_GenTk", "Tracking/TrackParameters/highPurityTracks/pt_1/GeneralProperties/SIPDzToPV_GenTk", "Tracking/TrackParameters/highPurityTracks/pt_1/GeneralProperties/SIP3DToPV_GenTk", "Tracking/TrackParameters/generalTracks/HitProperties/NumberOfMissingOuterRecHitsPerTrack_GenTk", "Tracking/TrackParameters/generalTracks/HitProperties/NumberMORecHitsPerTrackVsPt_GenTk", "OfflinePV/offlinePrimaryVertices/tagVtxProb", - "OfflinePV/offlinePrimaryVertice/tagType", + "OfflinePV/offlinePrimaryVertices/tagType", "OfflinePV/Resolution/PV/pull_x", "OfflinePV/Resolution/PV/pull_y", "OfflinePV/Resolution/PV/pull_z", diff --git a/DQMServices/Core/src/DQMStore.cc b/DQMServices/Core/src/DQMStore.cc index 0f95d9f75d56e..d4c2c2738371c 100644 --- a/DQMServices/Core/src/DQMStore.cc +++ b/DQMServices/Core/src/DQMStore.cc @@ -99,15 +99,30 @@ namespace dqm::implementation { MonitorElementData medata; medata.key_.path_ = path; medata.key_.kind_ = kind; - medata.key_.scope_ = this->scope_; + + const auto& MEs = store_->getMEsToSave(); + + if (not MEs.empty()) { + bool pathInList = false; + for (const auto& thepath : MEs) { + if (fullpath == thepath) { + medata.key_.scope_ = MonitorElementData::Scope::LUMI; + pathInList = true; + break; + } + } + if (not pathInList) + medata.key_.scope_ = this->scope_; + } else + medata.key_.scope_ = this->scope_; // will be (0,0) ( = prototype) in the common case. // This branching is for harvesting, where we have run/lumi in the booker. - if (this->scope_ == MonitorElementData::Scope::JOB) { + if (medata.key_.scope_ == MonitorElementData::Scope::JOB) { medata.key_.id_ = edm::LuminosityBlockID(); - } else if (this->scope_ == MonitorElementData::Scope::RUN) { + } else if (medata.key_.scope_ == MonitorElementData::Scope::RUN) { medata.key_.id_ = edm::LuminosityBlockID(this->runlumi_.run(), 0); - } else if (this->scope_ == MonitorElementData::Scope::LUMI) { + } else if (medata.key_.scope_ == MonitorElementData::Scope::LUMI) { // In the messy case of legacy-booking a LUMI ME in beginRun (or // similar), where we don't have a valid lumi number yet, make sure to // book a prototype instead.