From 0a2d2826b6a096178ddfdb46a990da4e770e55e4 Mon Sep 17 00:00:00 2001 From: Marcel Andre Schneider Date: Tue, 12 Nov 2019 15:34:06 +0100 Subject: [PATCH 1/7] Remove fastmatch. Seems it was only used for QTests (or not at all?), no longer needed now. --- DQMServices/Core/interface/DQMStore.h | 23 ----- DQMServices/Core/src/DQMStore.cc | 108 ---------------------- DQMServices/Core/test/BuildFile.xml | 2 - DQMServices/Core/test/DQMFastMatchTest.cc | 47 ---------- 4 files changed, 180 deletions(-) delete mode 100644 DQMServices/Core/test/DQMFastMatchTest.cc diff --git a/DQMServices/Core/interface/DQMStore.h b/DQMServices/Core/interface/DQMStore.h index d37b4bf949079..1cc2a86db8d9f 100644 --- a/DQMServices/Core/interface/DQMStore.h +++ b/DQMServices/Core/interface/DQMStore.h @@ -71,29 +71,6 @@ namespace dqm::dqmstoreimpl { // change the ME subtype here typedef dqm::legacy::MonitorElement MonitorElement; - /** Implements RegEx patterns which occur often in a high-performant - mattern. For all other expressions, the full RegEx engine is used. - Note: this class can only be used for lat::Regexp::Wildcard-like - patterns. */ - class fastmatch { - enum MatchingHeuristicEnum { UseFull, OneStarStart, OneStarEnd, TwoStar }; - - public: - fastmatch(std::string fastString); - - bool match(std::string const& s) const; - - private: - // checks if two strings are equal, starting at the back of the strings - bool compare_strings_reverse(std::string const& pattern, std::string const& input) const; - // checks if two strings are equal, starting at the front of the strings - bool compare_strings(std::string const& pattern, std::string const& input) const; - - std::unique_ptr regexp_{nullptr}; - std::string fastString_; - MatchingHeuristicEnum matching_; - }; - class DQMStore { public: // legacy exposes the biggest API and implicitly converts to reco and diff --git a/DQMServices/Core/src/DQMStore.cc b/DQMServices/Core/src/DQMStore.cc index 3b025b7f35135..a8c08632ea889 100644 --- a/DQMServices/Core/src/DQMStore.cc +++ b/DQMServices/Core/src/DQMStore.cc @@ -108,114 +108,6 @@ namespace dqm::dqmstoreimpl { path += name; } - ///////////////////////////////////////////////////////////// - fastmatch::fastmatch(std::string fastString) : fastString_{move(fastString)}, matching_{UseFull} { - try { - regexp_ = std::make_unique(fastString_, 0, lat::Regexp::Wildcard); - regexp_->study(); - } catch (lat::Error& e) { - raiseDQMError("DQMStore", - "Invalid wildcard pattern '%s' in quality" - " test specification", - fastString_.c_str()); - } - - // count stars ( "*" ) - size_t starCount = 0; - int pos = -1; - while (true) { - pos = fastString_.find('*', pos + 1); - if ((size_t)pos == std::string::npos) - break; - ++starCount; - } - - // investigate for heuristics - if ((fastString_.find('"') != std::string::npos) || (fastString_.find(']') != std::string::npos) || - (fastString_.find('?') != std::string::npos) || (fastString_.find('\\') != std::string::npos) || - (starCount > 2)) { - // no fast version can be used - return; - } - - // match for pattern "*MyString" and "MyString*" - if (starCount == 1) { - if (boost::algorithm::starts_with(fastString_, "*")) { - matching_ = OneStarStart; - fastString_.erase(0, 1); - return; - } - - if (boost::algorithm::ends_with(fastString_, "*")) { - matching_ = OneStarEnd; - fastString_.erase(fastString_.length() - 1, 1); - return; - } - } - - // match for pattern "*MyString*" - if (starCount == 2) { - if (boost::algorithm::starts_with(fastString_, "*") && boost::algorithm::ends_with(fastString_, "*")) { - matching_ = TwoStar; - fastString_.erase(0, 1); - fastString_.erase(fastString_.size() - 1, 1); - return; - } - } - } - - bool fastmatch::compare_strings_reverse(std::string const& pattern, std::string const& input) const { - if (input.size() < pattern.size()) - return false; - - // compare the two strings character by character for equalness: - // this does not create uneeded copies of std::string. The - // boost::algorithm implementation does - auto rit_pattern = pattern.crbegin(); - auto rit_input = input.crbegin(); - - for (; rit_pattern < pattern.rend(); ++rit_pattern, ++rit_input) { - if (*rit_pattern != *rit_input) - // found a difference, fail - return false; - } - return true; - } - - bool fastmatch::compare_strings(std::string const& pattern, std::string const& input) const { - if (input.size() < pattern.size()) - return false; - - // compare the two strings character by character for equalness: - // this does not create uneeded copies of std::string. The - // boost::algorithm implementation does. - auto rit_pattern = pattern.cbegin(); - auto rit_input = input.cbegin(); - - for (; rit_pattern < pattern.end(); ++rit_pattern, ++rit_input) { - if (*rit_pattern != *rit_input) - // found a difference, fail - return false; - } - return true; - } - - bool fastmatch::match(std::string const& s) const { - switch (matching_) { - case OneStarStart: - return compare_strings_reverse(fastString_, s); - - case OneStarEnd: - return compare_strings(fastString_, s); - - case TwoStar: - return (s.find(fastString_) != std::string::npos); - - default: - return regexp_->match(s); - } - } - //IBooker methods MonitorElement* DQMStore::IBooker::bookInt(TString const& name) { return owner_->bookInt(name); } diff --git a/DQMServices/Core/test/BuildFile.xml b/DQMServices/Core/test/BuildFile.xml index cf1dedd7aadfe..d4fbc52b61a41 100644 --- a/DQMServices/Core/test/BuildFile.xml +++ b/DQMServices/Core/test/BuildFile.xml @@ -7,5 +7,3 @@ - - diff --git a/DQMServices/Core/test/DQMFastMatchTest.cc b/DQMServices/Core/test/DQMFastMatchTest.cc deleted file mode 100644 index e37d41deee6e1..0000000000000 --- a/DQMServices/Core/test/DQMFastMatchTest.cc +++ /dev/null @@ -1,47 +0,0 @@ -#include - -#include -#include "DQMServices/Core/interface/DQMStore.h" - -/* - * Test case for the fastmatch implementation used in DQMStore class - * - */ -using namespace dqm::dqmstoreimpl; - -int main(int argc, char** argv) { - std::vector input = {"MyText", "Text"}; - - std::vector > test_patterns = { - {"*Text", BOOST_BINARY(11)}, - {"MyText*", BOOST_BINARY(01)}, - {"MyTe*xt", BOOST_BINARY(01)}, - - {"*Text*", BOOST_BINARY(11)}, - {"*Te*xt", BOOST_BINARY(11)}, - {"MyT*ex*t", BOOST_BINARY(01)}, - - {"*Tex?", BOOST_BINARY(11)}, - {"[]Text*", BOOST_BINARY(10)}, - }; - - for (auto const& pattern : test_patterns) { - fastmatch fm(pattern.first); - - size_t loc = 0; - for (auto const& i : input) { - bool res = fm.match(i); - - bool formal_result = ((pattern.second & (1 << loc)) > 0); - if (res != formal_result) { - std::cout << "Error: pattern " << pattern.first << " did not work correctly on input " << i << std::endl; - return 1; - } - - loc++; - } - } - - // test was ok - return 0; -} From 1826ce0e8a673bf22c0e798bf98b31ca88ddda85 Mon Sep 17 00:00:00 2001 From: Marcel Andre Schneider Date: Tue, 12 Nov 2019 15:47:35 +0100 Subject: [PATCH 2/7] Remove bookConcurrentTransaction. --- DQMServices/Core/interface/DQMStore.h | 28 +-------------------------- 1 file changed, 1 insertion(+), 27 deletions(-) diff --git a/DQMServices/Core/interface/DQMStore.h b/DQMServices/Core/interface/DQMStore.h index 1cc2a86db8d9f..1762d7d374830 100644 --- a/DQMServices/Core/interface/DQMStore.h +++ b/DQMServices/Core/interface/DQMStore.h @@ -276,35 +276,9 @@ namespace dqm::dqmstoreimpl { } } - // Similar function used to book "global" histograms via the - // dqm::reco::MonitorElement* interface. - template - void bookConcurrentTransaction(iFunc f, uint32_t run) { - std::lock_guard guard(book_mutex_); - /* Set the run_ member only if enableMultiThread is enabled */ - if (enableMultiThread_) { - run_ = run; - moduleId_ = 0; - canSaveByLumi_ = false; - } - IBooker booker(this); - f(booker); - - /* Reset the run_ member only if enableMultiThread is enabled */ - if (enableMultiThread_) { - run_ = 0; - moduleId_ = 0; - canSaveByLumi_ = false; - } - } - - // Signature needed in the harvesting where the booking is done in - // the endJob. No handles to the run there. Two arguments ensure the - // capability of booking and getting. The method relies on the - // initialization of run, stream and module ID to 0. The mutex is - // not needed. template void meBookerGetter(iFunc f) { + std::lock_guard guard(book_mutex_); IBooker booker{this}; IGetter getter{this}; f(booker, getter); From 0c56a48b30a2f5698933e3f38e3b5306d1b272f8 Mon Sep 17 00:00:00 2001 From: Marcel Andre Schneider Date: Thu, 14 Nov 2019 16:01:48 +0100 Subject: [PATCH 3/7] Remove conurrentTransaction from FastTimerService and ThroughputService. --- HLTrigger/Timer/plugins/FastTimerService.cc | 4 ++-- HLTrigger/Timer/plugins/ThroughputService.cc | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/HLTrigger/Timer/plugins/FastTimerService.cc b/HLTrigger/Timer/plugins/FastTimerService.cc index 6ae2d25b13b99..a7f2a4650eb7e 100644 --- a/HLTrigger/Timer/plugins/FastTimerService.cc +++ b/HLTrigger/Timer/plugins/FastTimerService.cc @@ -872,8 +872,8 @@ void FastTimerService::preGlobalBeginRun(edm::GlobalContext const& gc) { }; // book MonitorElements for this stream - edm::Service()->bookConcurrentTransaction(bookTransactionCallback, - gc.luminosityBlockID().run()); + edm::Service()->bookTransaction(bookTransactionCallback, + gc.luminosityBlockID().run(), /* moduleID */ 0, /* canSaveByLumi*/ false); } } } diff --git a/HLTrigger/Timer/plugins/ThroughputService.cc b/HLTrigger/Timer/plugins/ThroughputService.cc index 60dda266e01b7..1a15c2af527a7 100644 --- a/HLTrigger/Timer/plugins/ThroughputService.cc +++ b/HLTrigger/Timer/plugins/ThroughputService.cc @@ -66,7 +66,7 @@ void ThroughputService::preGlobalBeginRun(edm::GlobalContext const& gc) { }; // book MonitorElement's for this run - edm::Service()->bookConcurrentTransaction(bookTransactionCallback, gc.luminosityBlockID().run()); + edm::Service()->bookTransaction(bookTransactionCallback, gc.luminosityBlockID().run(), /* moduleID */ 0, /* canSaveByLumi */ false); } else { std::cerr << "No DQMStore service, aborting." << std::endl; abort(); From e9bcc4e8c7bc08965d03d9d5fa93ffc530f0a09f Mon Sep 17 00:00:00 2001 From: Marcel Andre Schneider Date: Thu, 14 Nov 2019 14:43:21 +0100 Subject: [PATCH 4/7] Import EDProducer based DQMGlobalEDAnalyzer ... from the new DQMStore branch. Adapted to use edm::Service and DQMTokens. --- .../Core/interface/DQMGlobalEDAnalyzer.h | 87 +++++++++++-------- 1 file changed, 53 insertions(+), 34 deletions(-) diff --git a/DQMServices/Core/interface/DQMGlobalEDAnalyzer.h b/DQMServices/Core/interface/DQMGlobalEDAnalyzer.h index 2391a48451470..ea92f62dc79d3 100644 --- a/DQMServices/Core/interface/DQMGlobalEDAnalyzer.h +++ b/DQMServices/Core/interface/DQMGlobalEDAnalyzer.h @@ -2,57 +2,76 @@ #define DQMServices_Core_DQMGlobalEDAnalyzer_h #include "DQMServices/Core/interface/DQMStore.h" +#include "DataFormats/Histograms/interface/DQMToken.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/Run.h" -#include "FWCore/Framework/interface/global/EDAnalyzer.h" +#include "FWCore/Framework/interface/global/EDProducer.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/ServiceRegistry/interface/Service.h" template -class DQMGlobalEDAnalyzer : public edm::global::EDAnalyzer, Args...> { +class DQMGlobalEDAnalyzer + : public edm::global::EDProducer, + // DQMGlobalEDAnalyzer are fundamentally unable to produce histograms for any + // other scope than MonitorElement::Scope::RUN. + edm::EndRunProducer, + edm::Accumulator, + Args...> { public: - typedef dqm::reco::MonitorElement MonitorElement; typedef dqm::reco::DQMStore DQMStore; + typedef dqm::reco::MonitorElement MonitorElement; -private: - std::shared_ptr globalBeginRun(edm::Run const&, edm::EventSetup const&) const final; - - void globalEndRun(edm::Run const&, edm::EventSetup const&) const final; - - virtual void dqmBeginRun(edm::Run const&, edm::EventSetup const&, H&) const {} - - // this will run while holding the DQMStore lock - virtual void bookHistograms(DQMStore::IBooker&, edm::Run const&, edm::EventSetup const&, H&) const = 0; + // framework calls in the order of invocation + DQMGlobalEDAnalyzer() { + // for whatever reason we need the explicit `template` keyword here. + runToken_ = this->template produces("DQMGenerationRecoRun"); + dqmstore_ = edm::Service().operator->(); + } - void analyze(edm::StreamID, edm::Event const&, edm::EventSetup const&) const final; + std::shared_ptr globalBeginRun(edm::Run const& run, edm::EventSetup const& setup) const final { + auto h = std::make_shared(); - virtual void dqmAnalyze(edm::Event const&, edm::EventSetup const&, H const&) const = 0; -}; + dqmBeginRun(run, setup, *h); -template -std::shared_ptr DQMGlobalEDAnalyzer::globalBeginRun(edm::Run const& run, - edm::EventSetup const& setup) const { - auto h = std::make_shared(); - dqmBeginRun(run, setup, *h); - edm::Service()->bookConcurrentTransaction( + // in case of concurrent runs, this will create clones of the already + // booked MEs. + dqmstore_->bookTransaction( [&, this](DQMStore::IBooker& b) { // this runs while holding the DQMStore lock b.cd(); bookHistograms(b, run, setup, *h); }, - run.run()); - return h; -} + run.run(), /* moduleID */ 0, /* canSaveByLumi */ false); + // Populate run numbers, in case booking only books prototypes. + // We will not call enterLumi per-lumi, since this is strictly run-based. + return h; + } -template -void DQMGlobalEDAnalyzer::globalEndRun(edm::Run const&, edm::EventSetup const&) const {} + void accumulate(edm::StreamID id, edm::Event const& event, edm::EventSetup const& setup) const final { + auto const& h = *this->runCache(event.getRun().index()); + dqmAnalyze(event, setup, h); + } -template -void DQMGlobalEDAnalyzer::analyze(edm::StreamID, - edm::Event const& event, - edm::EventSetup const& setup) const { - //auto& h = const_cast(* this->runCache(event.getRun().index())); - auto const& h = *this->runCache(event.getRun().index()); - dqmAnalyze(event, setup, h); -} + void globalEndRunProduce(edm::Run& run, edm::EventSetup const& setup) const final { + auto const& h = *this->runCache(run.index()); + dqmEndRun(run, setup, h); + run.emplace(runToken_); + } + + // Subsystems could safely override this, but any changes to MEs would not be + // noticeable since the product was made already. + void globalEndRun(edm::Run const&, edm::EventSetup const&) const final{}; + + // methods to be implemented by the user, in order of invocation + virtual void dqmBeginRun(edm::Run const&, edm::EventSetup const&, H&) const {} + virtual void bookHistograms(DQMStore::IBooker&, edm::Run const&, edm::EventSetup const&, H&) const = 0; + // TODO: rename this analyze() for consistency. + virtual void dqmAnalyze(edm::Event const&, edm::EventSetup const&, H const&) const = 0; + virtual void dqmEndRun(edm::Run const&, edm::EventSetup const&, H const&) const {} + +private: + DQMStore* dqmstore_; + edm::EDPutTokenT runToken_; +}; #endif // DQMServices_Core_DQMGlobalEDAnalyzer_h From 25173bd9da1162fad019d3461cbc4d8cbcbb2abe Mon Sep 17 00:00:00 2001 From: Marcel Andre Schneider Date: Fri, 15 Nov 2019 14:46:30 +0100 Subject: [PATCH 5/7] Update configs to use DQMEDAnalyzer alias. Before, the DQMGlobalAnalyzers where still normal cms.EDAnalyzer. This does not cover HLT configs. HLT configs will also need to be fixed. --- .../python/SiStripGainsPCLWorker_cfi.py | 3 ++- DQM/HLTEvF/python/trigObjTnPSource_cfi.py | 3 ++- DQMServices/Components/python/DQMLumiMonitor_cfi.py | 3 ++- Validation/DTRecHits/python/DTRecHitQualityAll_cfi.py | 9 +++++---- Validation/DTRecHits/python/DTRecHitQuality_cfi.py | 9 +++++---- Validation/HGCalValidation/python/HGCalValidator_cfi.py | 3 ++- Validation/RecoTrack/python/MultiTrackValidator_cfi.py | 3 ++- 7 files changed, 20 insertions(+), 13 deletions(-) diff --git a/CalibTracker/SiStripChannelGain/python/SiStripGainsPCLWorker_cfi.py b/CalibTracker/SiStripChannelGain/python/SiStripGainsPCLWorker_cfi.py index 915d7a1b46446..b715ae6081dbb 100644 --- a/CalibTracker/SiStripChannelGain/python/SiStripGainsPCLWorker_cfi.py +++ b/CalibTracker/SiStripChannelGain/python/SiStripGainsPCLWorker_cfi.py @@ -1,6 +1,7 @@ import FWCore.ParameterSet.Config as cms -SiStripGainsPCLWorker = cms.EDAnalyzer( +from DQMServices.Core.DQMEDAnalyzer import DQMEDAnalyzer +SiStripGainsPCLWorker = DQMEDAnalyzer( "SiStripGainsPCLWorker", minTrackMomentum = cms.untracked.double(2), maxNrStrips = cms.untracked.uint32(8), diff --git a/DQM/HLTEvF/python/trigObjTnPSource_cfi.py b/DQM/HLTEvF/python/trigObjTnPSource_cfi.py index b20f5891607d5..e0a63262d1edf 100644 --- a/DQM/HLTEvF/python/trigObjTnPSource_cfi.py +++ b/DQM/HLTEvF/python/trigObjTnPSource_cfi.py @@ -45,7 +45,8 @@ filler = cms.PSet(var = cms.string("eta"),localCuts = cms.VPSet()) ) -trigObjTnPSource = cms.EDAnalyzer('TrigObjTnPSource', +from DQMServices.Core.DQMEDAnalyzer import DQMEDAnalyzer +trigObjTnPSource = DQMEDAnalyzer('TrigObjTnPSource', triggerEvent = cms.InputTag('hltTriggerSummaryAOD','','HLT'), triggerResults = cms.InputTag('TriggerResults','','HLT'), histColls = cms.VPSet(cms.PSet( diff --git a/DQMServices/Components/python/DQMLumiMonitor_cfi.py b/DQMServices/Components/python/DQMLumiMonitor_cfi.py index ba1cdc10b799d..877205b12e5e8 100644 --- a/DQMServices/Components/python/DQMLumiMonitor_cfi.py +++ b/DQMServices/Components/python/DQMLumiMonitor_cfi.py @@ -1,6 +1,7 @@ import FWCore.ParameterSet.Config as cms -dqmLumiMonitor = cms.EDAnalyzer("DQMLumiMonitor", +from DQMServices.Core.DQMEDAnalyzer import DQMEDAnalyzer +dqmLumiMonitor = DQMEDAnalyzer("DQMLumiMonitor", ModuleName = cms.string('Info'), FolderName = cms.string('Lumi'), PixelClusterInputTag = cms.InputTag('siPixelClusters'), diff --git a/Validation/DTRecHits/python/DTRecHitQualityAll_cfi.py b/Validation/DTRecHits/python/DTRecHitQualityAll_cfi.py index 42d07b0d5fccf..d96c345cc75d4 100644 --- a/Validation/DTRecHits/python/DTRecHitQualityAll_cfi.py +++ b/Validation/DTRecHits/python/DTRecHitQualityAll_cfi.py @@ -1,6 +1,7 @@ import FWCore.ParameterSet.Config as cms -rechivalidation = cms.EDAnalyzer("DTRecHitQuality", +from DQMServices.Core.DQMEDAnalyzer import DQMEDAnalyzer +rechivalidation = DQMEDAnalyzer("DTRecHitQuality", doStep2 = cms.untracked.bool(False), # Switches for analysis at various steps doStep1 = cms.untracked.bool(True), @@ -16,7 +17,7 @@ ) -seg2dvalidation = cms.EDAnalyzer("DTSegment2DQuality", +seg2dvalidation = DQMEDAnalyzer("DTSegment2DQuality", sigmaResPos = cms.double(0.013), simHitLabel = cms.untracked.InputTag('g4SimHits',"MuonDTHits"), segment2DLabel = cms.untracked.InputTag('dt2DSegments'), @@ -24,7 +25,7 @@ sigmaResAngle = cms.double(0.008) ) -seg2dsuperphivalidation = cms.EDAnalyzer("DTSegment2DSLPhiQuality", +seg2dsuperphivalidation = DQMEDAnalyzer("DTSegment2DSLPhiQuality", sigmaResPos = cms.double(0.013), simHitLabel = cms.untracked.InputTag('g4SimHits',"MuonDTHits"), sigmaResAngle = cms.double(0.008), @@ -34,7 +35,7 @@ local = cms.untracked.bool(False) ) -seg4dvalidation = cms.EDAnalyzer("DTSegment4DQuality", +seg4dvalidation = DQMEDAnalyzer("DTSegment4DQuality", #resolution on angle sigmaResAlpha = cms.double(0.001), sigmaResBeta = cms.double(0.007), diff --git a/Validation/DTRecHits/python/DTRecHitQuality_cfi.py b/Validation/DTRecHits/python/DTRecHitQuality_cfi.py index 76eca86d2b7f4..fbbcb760fb5e7 100644 --- a/Validation/DTRecHits/python/DTRecHitQuality_cfi.py +++ b/Validation/DTRecHits/python/DTRecHitQuality_cfi.py @@ -1,6 +1,7 @@ import FWCore.ParameterSet.Config as cms -rechivalidation = cms.EDAnalyzer("DTRecHitQuality", +from DQMServices.Core.DQMEDAnalyzer import DQMEDAnalyzer +rechivalidation = DQMEDAnalyzer("DTRecHitQuality", doStep2 = cms.untracked.bool(False), # Switches for analysis at various steps doStep1 = cms.untracked.bool(False), @@ -15,7 +16,7 @@ local = cms.untracked.bool(False) ) -seg2dvalidation = cms.EDAnalyzer("DTSegment2DQuality", +seg2dvalidation = DQMEDAnalyzer("DTSegment2DQuality", sigmaResPos = cms.double(0.013), simHitLabel = cms.untracked.InputTag('g4SimHits',"MuonDTHits"), segment2DLabel = cms.untracked.InputTag('dt2DSegments'), @@ -23,7 +24,7 @@ sigmaResAngle = cms.double(0.008) ) -seg2dsuperphivalidation = cms.EDAnalyzer("DTSegment2DSLPhiQuality", +seg2dsuperphivalidation = DQMEDAnalyzer("DTSegment2DSLPhiQuality", sigmaResPos = cms.double(0.013), simHitLabel = cms.untracked.InputTag('g4SimHits',"MuonDTHits"), sigmaResAngle = cms.double(0.008), @@ -33,7 +34,7 @@ local = cms.untracked.bool(False) ) -seg4dvalidation = cms.EDAnalyzer("DTSegment4DQuality", +seg4dvalidation = DQMEDAnalyzer("DTSegment4DQuality", #resolution on angle sigmaResAlpha = cms.double(0.001), sigmaResBeta = cms.double(0.007), diff --git a/Validation/HGCalValidation/python/HGCalValidator_cfi.py b/Validation/HGCalValidation/python/HGCalValidator_cfi.py index b44a90f2dffc8..6f16d75700696 100644 --- a/Validation/HGCalValidation/python/HGCalValidator_cfi.py +++ b/Validation/HGCalValidation/python/HGCalValidator_cfi.py @@ -3,7 +3,8 @@ from Validation.HGCalValidation.CaloParticleSelectionForEfficiency_cfi import * from Validation.HGCalValidation.HGVHistoProducerAlgoBlock_cfi import * -hgcalValidator = cms.EDAnalyzer( +from DQMServices.Core.DQMEDAnalyzer import DQMEDAnalyzer +hgcalValidator = DQMEDAnalyzer( "HGCalValidator", ### general settings ### diff --git a/Validation/RecoTrack/python/MultiTrackValidator_cfi.py b/Validation/RecoTrack/python/MultiTrackValidator_cfi.py index f66b4466f631d..1b452537c835f 100644 --- a/Validation/RecoTrack/python/MultiTrackValidator_cfi.py +++ b/Validation/RecoTrack/python/MultiTrackValidator_cfi.py @@ -5,7 +5,8 @@ from SimTracker.TrackAssociation.CosmicParametersDefinerForTP_cfi import * from Validation.RecoTrack.MTVHistoProducerAlgoForTrackerBlock_cfi import * -multiTrackValidator = cms.EDAnalyzer( +from DQMServices.Core.DQMEDAnalyzer import DQMEDAnalyzer +multiTrackValidator = DQMEDAnalyzer( "MultiTrackValidator", ### general settings ### From 041b49a4312f08d263b5911eba4d94933e7bb414 Mon Sep 17 00:00:00 2001 From: Marcel Andre Schneider Date: Thu, 12 Dec 2019 11:43:51 +0100 Subject: [PATCH 6/7] Code-format. --- DQMServices/Core/interface/DQMGlobalEDAnalyzer.h | 16 +++++++++------- HLTrigger/Timer/plugins/FastTimerService.cc | 4 ++-- HLTrigger/Timer/plugins/ThroughputService.cc | 3 ++- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/DQMServices/Core/interface/DQMGlobalEDAnalyzer.h b/DQMServices/Core/interface/DQMGlobalEDAnalyzer.h index ea92f62dc79d3..db8f63afd36fe 100644 --- a/DQMServices/Core/interface/DQMGlobalEDAnalyzer.h +++ b/DQMServices/Core/interface/DQMGlobalEDAnalyzer.h @@ -2,7 +2,7 @@ #define DQMServices_Core_DQMGlobalEDAnalyzer_h #include "DQMServices/Core/interface/DQMStore.h" -#include "DataFormats/Histograms/interface/DQMToken.h" +#include "DataFormats/Histograms/interface/DQMToken.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/Run.h" #include "FWCore/Framework/interface/global/EDProducer.h" @@ -36,12 +36,14 @@ class DQMGlobalEDAnalyzer // in case of concurrent runs, this will create clones of the already // booked MEs. dqmstore_->bookTransaction( - [&, this](DQMStore::IBooker& b) { - // this runs while holding the DQMStore lock - b.cd(); - bookHistograms(b, run, setup, *h); - }, - run.run(), /* moduleID */ 0, /* canSaveByLumi */ false); + [&, this](DQMStore::IBooker& b) { + // this runs while holding the DQMStore lock + b.cd(); + bookHistograms(b, run, setup, *h); + }, + run.run(), + /* moduleID */ 0, + /* canSaveByLumi */ false); // Populate run numbers, in case booking only books prototypes. // We will not call enterLumi per-lumi, since this is strictly run-based. return h; diff --git a/HLTrigger/Timer/plugins/FastTimerService.cc b/HLTrigger/Timer/plugins/FastTimerService.cc index a7f2a4650eb7e..dca9eef18c81f 100644 --- a/HLTrigger/Timer/plugins/FastTimerService.cc +++ b/HLTrigger/Timer/plugins/FastTimerService.cc @@ -872,8 +872,8 @@ void FastTimerService::preGlobalBeginRun(edm::GlobalContext const& gc) { }; // book MonitorElements for this stream - edm::Service()->bookTransaction(bookTransactionCallback, - gc.luminosityBlockID().run(), /* moduleID */ 0, /* canSaveByLumi*/ false); + edm::Service()->bookTransaction( + bookTransactionCallback, gc.luminosityBlockID().run(), /* moduleID */ 0, /* canSaveByLumi*/ false); } } } diff --git a/HLTrigger/Timer/plugins/ThroughputService.cc b/HLTrigger/Timer/plugins/ThroughputService.cc index 1a15c2af527a7..568a1ed0741e6 100644 --- a/HLTrigger/Timer/plugins/ThroughputService.cc +++ b/HLTrigger/Timer/plugins/ThroughputService.cc @@ -66,7 +66,8 @@ void ThroughputService::preGlobalBeginRun(edm::GlobalContext const& gc) { }; // book MonitorElement's for this run - edm::Service()->bookTransaction(bookTransactionCallback, gc.luminosityBlockID().run(), /* moduleID */ 0, /* canSaveByLumi */ false); + edm::Service()->bookTransaction( + bookTransactionCallback, gc.luminosityBlockID().run(), /* moduleID */ 0, /* canSaveByLumi */ false); } else { std::cerr << "No DQMStore service, aborting." << std::endl; abort(); From 1dd3a3d996196ec7ab5842620ff0a32969e56097 Mon Sep 17 00:00:00 2001 From: Marcel Schneider Date: Tue, 10 Dec 2019 12:04:27 +0100 Subject: [PATCH 7/7] Remove locking in meBookerGetter We can only start locking properly here once we have a reentrant booking mutex. --- DQMServices/Core/interface/DQMStore.h | 1 - 1 file changed, 1 deletion(-) diff --git a/DQMServices/Core/interface/DQMStore.h b/DQMServices/Core/interface/DQMStore.h index 1762d7d374830..61bb88a3cba27 100644 --- a/DQMServices/Core/interface/DQMStore.h +++ b/DQMServices/Core/interface/DQMStore.h @@ -278,7 +278,6 @@ namespace dqm::dqmstoreimpl { template void meBookerGetter(iFunc f) { - std::lock_guard guard(book_mutex_); IBooker booker{this}; IGetter getter{this}; f(booker, getter);