From d854f3701fba25d06dc3f8ea98164b04b3c25c5a Mon Sep 17 00:00:00 2001 From: Pieter David Date: Sat, 24 Oct 2020 11:03:49 +0200 Subject: [PATCH] Avoid ESHandle where possible --- .../SiStripProcessedRawDigiProducer.cc | 30 +++++++++++-------- .../plugins/SiStripProcessedRawDigiProducer.h | 19 ++++++++---- .../SiStripTools/interface/Multiplicities.h | 7 ++--- .../SiStripTools/plugins/APVShotsFilter.cc | 1 - .../plugins/CommonModeAnalyzer.cc | 1 - .../SiStripTools/plugins/LargeEvents.cc | 5 ++-- .../plugins/TrackerDpgAnalysis.cc | 12 ++++---- .../plugins/SiStripRawToDigiModule.cc | 2 -- .../interface/IteratedMedianCMNSubtractor.h | 5 ++-- .../interface/SiStripAPVRestorer.h | 7 ++--- .../interface/SiStripPedestalsSubtractor.h | 3 +- .../interface/TT6CMNSubtractor.h | 5 ++-- .../src/IteratedMedianCMNSubtractor.cc | 4 +-- .../src/SiStripAPVRestorer.cc | 6 ++-- .../src/SiStripPedestalsSubtractor.cc | 2 +- .../src/TT6CMNSubtractor.cc | 5 ++-- .../test/SiStripBaselineAnalyzer.cc | 5 ++-- .../test/SiStripHybridFormatAnalyzer.cc | 1 - .../test/SiStripMeanCMExtractor.cc | 5 ++-- 19 files changed, 60 insertions(+), 65 deletions(-) diff --git a/AnalysisAlgos/SiStripClusterInfoProducer/plugins/SiStripProcessedRawDigiProducer.cc b/AnalysisAlgos/SiStripClusterInfoProducer/plugins/SiStripProcessedRawDigiProducer.cc index c010a6e2644a6..04ea834f65969 100644 --- a/AnalysisAlgos/SiStripClusterInfoProducer/plugins/SiStripProcessedRawDigiProducer.cc +++ b/AnalysisAlgos/SiStripClusterInfoProducer/plugins/SiStripProcessedRawDigiProducer.cc @@ -29,17 +29,17 @@ void SiStripProcessedRawDigiProducer::produce(edm::Event& e, const edm::EventSet edm::Handle > inputDigis; edm::Handle > inputRawdigis; - gainHandle_ = es.getHandle(gainToken_); + const auto& gain = es.getData(gainToken_); subtractorPed_->init(es); subtractorCMN_->init(es); std::string label = findInput(inputRawdigis, inputTokensRawDigi_, e); if ("VirginRaw" == label) - vr_process(*inputRawdigis, *output); + vr_process(*inputRawdigis, *output, gain); else if ("ProcessedRaw" == label) - pr_process(*inputRawdigis, *output); + pr_process(*inputRawdigis, *output, gain); else if ("ZeroSuppressed" == findInput(inputDigis, inputTokensDigi_, e)) - zs_process(*inputDigis, *output); + zs_process(*inputDigis, *output, gain); else edm::LogError("Input Not Found"); @@ -63,7 +63,8 @@ inline std::string SiStripProcessedRawDigiProducer::findInput(edm::Handle& ha } void SiStripProcessedRawDigiProducer::zs_process(const edm::DetSetVector& input, - edm::DetSetVector& output) { + edm::DetSetVector& output, + const SiStripGain& gain) { std::vector digis; for (edm::DetSetVector::const_iterator detset = input.begin(); detset != input.end(); ++detset) { digis.clear(); @@ -71,39 +72,42 @@ void SiStripProcessedRawDigiProducer::zs_process(const edm::DetSetVectorstrip(), 0); digis.push_back(digi->adc()); } - common_process(detset->id, digis, output); + common_process(detset->id, digis, output, gain); } } void SiStripProcessedRawDigiProducer::pr_process(const edm::DetSetVector& input, - edm::DetSetVector& output) { + edm::DetSetVector& output, + const SiStripGain& gain) { for (edm::DetSetVector::const_iterator detset = input.begin(); detset != input.end(); ++detset) { std::vector digis; transform( detset->begin(), detset->end(), back_inserter(digis), std::bind(&SiStripRawDigi::adc, std::placeholders::_1)); subtractorCMN_->subtract(detset->id, 0, digis); - common_process(detset->id, digis, output); + common_process(detset->id, digis, output, gain); } } void SiStripProcessedRawDigiProducer::vr_process(const edm::DetSetVector& input, - edm::DetSetVector& output) { + edm::DetSetVector& output, + const SiStripGain& gain) { for (edm::DetSetVector::const_iterator detset = input.begin(); detset != input.end(); ++detset) { std::vector int_digis(detset->size()); subtractorPed_->subtract(*detset, int_digis); std::vector digis(int_digis.begin(), int_digis.end()); subtractorCMN_->subtract(detset->id, 0, digis); - common_process(detset->id, digis, output); + common_process(detset->id, digis, output, gain); } } void SiStripProcessedRawDigiProducer::common_process(const uint32_t detId, std::vector& digis, - edm::DetSetVector& output) { + edm::DetSetVector& output, + const SiStripGain& gain) { //Apply Gains - SiStripApvGain::Range detGainRange = gainHandle_->getRange(detId); + SiStripApvGain::Range detGainRange = gain.getRange(detId); for (std::vector::iterator it = digis.begin(); it < digis.end(); ++it) - (*it) /= (gainHandle_->getStripGain(it - digis.begin(), detGainRange)); + (*it) /= (gain.getStripGain(it - digis.begin(), detGainRange)); //Insert as DetSet edm::DetSet ds(detId); diff --git a/AnalysisAlgos/SiStripClusterInfoProducer/plugins/SiStripProcessedRawDigiProducer.h b/AnalysisAlgos/SiStripClusterInfoProducer/plugins/SiStripProcessedRawDigiProducer.h index 476f2330352c3..b383316806919 100644 --- a/AnalysisAlgos/SiStripClusterInfoProducer/plugins/SiStripProcessedRawDigiProducer.h +++ b/AnalysisAlgos/SiStripClusterInfoProducer/plugins/SiStripProcessedRawDigiProducer.h @@ -3,7 +3,6 @@ #include "FWCore/Framework/interface/Frameworkfwd.h" #include "FWCore/Framework/interface/EDProducer.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/Utilities/interface/InputTag.h" #include "RecoLocalTracker/SiStripZeroSuppression/interface/SiStripPedestalsSubtractor.h" @@ -30,16 +29,24 @@ class SiStripProcessedRawDigiProducer : public edm::EDProducer { template std::string findInput(edm::Handle& handle, const std::vector >& tokens, const edm::Event& e); - void vr_process(const edm::DetSetVector&, edm::DetSetVector&); - void pr_process(const edm::DetSetVector&, edm::DetSetVector&); - void zs_process(const edm::DetSetVector&, edm::DetSetVector&); - void common_process(const uint32_t, std::vector&, edm::DetSetVector&); + void vr_process(const edm::DetSetVector&, + edm::DetSetVector&, + const SiStripGain&); + void pr_process(const edm::DetSetVector&, + edm::DetSetVector&, + const SiStripGain&); + void zs_process(const edm::DetSetVector&, + edm::DetSetVector&, + const SiStripGain&); + void common_process(const uint32_t, + std::vector&, + edm::DetSetVector&, + const SiStripGain&); std::vector inputTags_; std::vector > > inputTokensDigi_; std::vector > > inputTokensRawDigi_; edm::ESGetToken gainToken_; - edm::ESHandle gainHandle_; std::unique_ptr subtractorPed_; std::unique_ptr subtractorCMN_; diff --git a/DPGAnalysis/SiStripTools/interface/Multiplicities.h b/DPGAnalysis/SiStripTools/interface/Multiplicities.h index 756976d233c5f..be62e10c99e10 100644 --- a/DPGAnalysis/SiStripTools/interface/Multiplicities.h +++ b/DPGAnalysis/SiStripTools/interface/Multiplicities.h @@ -1,7 +1,6 @@ #ifndef DPGAnalysis_SiStripTools_Multiplicities_H #define DPGAnalysis_SiStripTools_Multiplicities_H -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/Framework/interface/ConsumesCollector.h" @@ -87,16 +86,16 @@ template void SingleMultiplicity::getEvent(const edm::Event& iEvent, const edm::EventSetup& iSetup) { m_mult = 0; - edm::ESHandle qualityHandle; + const SiStripQuality* quality = nullptr; if (m_useQuality) { - qualityHandle = iSetup.getHandle(m_qualityToken); + quality = &iSetup.getData(m_qualityToken); } edm::Handle digis; iEvent.getByToken(m_collection, digis); for (typename T::const_iterator it = digis->begin(); it != digis->end(); it++) { - if (!m_useQuality || !qualityHandle->IsModuleBad(it->detId())) { + if (!m_useQuality || !quality->IsModuleBad(it->detId())) { if (m_modthr < 0 || int(it->size()) < m_modthr) { m_mult += it->size(); // mult += it->size(); diff --git a/DPGAnalysis/SiStripTools/plugins/APVShotsFilter.cc b/DPGAnalysis/SiStripTools/plugins/APVShotsFilter.cc index 899009fb09aab..e68f1e0a3b3d0 100644 --- a/DPGAnalysis/SiStripTools/plugins/APVShotsFilter.cc +++ b/DPGAnalysis/SiStripTools/plugins/APVShotsFilter.cc @@ -25,7 +25,6 @@ #include "FWCore/Framework/interface/Frameworkfwd.h" #include "FWCore/Framework/interface/EDFilter.h" #include "FWCore/Framework/interface/ESWatcher.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/MakerMacros.h" diff --git a/DPGAnalysis/SiStripTools/plugins/CommonModeAnalyzer.cc b/DPGAnalysis/SiStripTools/plugins/CommonModeAnalyzer.cc index ddb500e0b9542..7930a17936558 100644 --- a/DPGAnalysis/SiStripTools/plugins/CommonModeAnalyzer.cc +++ b/DPGAnalysis/SiStripTools/plugins/CommonModeAnalyzer.cc @@ -29,7 +29,6 @@ #include "FWCore/Framework/interface/Frameworkfwd.h" #include "FWCore/Framework/interface/EDAnalyzer.h" #include "FWCore/Framework/interface/ESWatcher.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/MakerMacros.h" diff --git a/DPGAnalysis/SiStripTools/plugins/LargeEvents.cc b/DPGAnalysis/SiStripTools/plugins/LargeEvents.cc index eb8bd2335b544..f72147f88afc3 100644 --- a/DPGAnalysis/SiStripTools/plugins/LargeEvents.cc +++ b/DPGAnalysis/SiStripTools/plugins/LargeEvents.cc @@ -26,7 +26,6 @@ #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/MakerMacros.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/Framework/interface/ESWatcher.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" @@ -66,7 +65,7 @@ class LargeEvents : public edm::EDFilter { int _absthr; int _modthr; bool _useQuality; - edm::ESHandle _qualityHandle; + const SiStripQuality* _qualityHandle = nullptr; edm::ESWatcher _qualityWatcher; edm::ESGetToken _qualityToken; }; @@ -109,7 +108,7 @@ bool LargeEvents::filter(edm::Event& iEvent, const edm::EventSetup& iSetup) { if (_useQuality) { if (_qualityWatcher.check(iSetup)) { - _qualityHandle = iSetup.getHandle(_qualityToken); + _qualityHandle = &iSetup.getData(_qualityToken); LogDebug("SiStripQualityUpdated") << "SiStripQuality has changed and it will be updated"; } } diff --git a/DPGAnalysis/SiStripTools/plugins/TrackerDpgAnalysis.cc b/DPGAnalysis/SiStripTools/plugins/TrackerDpgAnalysis.cc index cf36fdf3d3778..4cd1eeef80489 100644 --- a/DPGAnalysis/SiStripTools/plugins/TrackerDpgAnalysis.cc +++ b/DPGAnalysis/SiStripTools/plugins/TrackerDpgAnalysis.cc @@ -42,7 +42,6 @@ #include "FWCore/Framework/interface/EDAnalyzer.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/MakerMacros.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/Utilities/interface/InputTag.h" #include "FWCore/Utilities/interface/transform.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" @@ -164,8 +163,7 @@ class TrackerDpgAnalysis : public edm::EDAnalyzer { edm::ESGetToken tTopoToken_; edm::ESGetToken tkGeomToken_; edm::ESGetToken fedCablingToken_; - edm::ESHandle cabling_; - edm::ESHandle tracker_; + const TrackerGeometry* tracker_; std::multimap connections_; bool functionality_offtrackClusters_, functionality_ontrackClusters_, functionality_pixclusters_, functionality_pixvertices_, functionality_missingHits_, functionality_tracks_, functionality_vertices_, @@ -1025,7 +1023,7 @@ void TrackerDpgAnalysis::analyze(const edm::Event& iEvent, const edm::EventSetup // ------------ method called once each job just before starting event loop ------------ void TrackerDpgAnalysis::beginRun(const edm::Run& iRun, const edm::EventSetup& iSetup) { const auto& tTopo = iSetup.getData(tTopoToken_); - tracker_ = iSetup.getHandle(tkGeomToken_); + tracker_ = &iSetup.getData(tkGeomToken_); //HLT names bool changed(true); @@ -1045,10 +1043,10 @@ void TrackerDpgAnalysis::beginRun(const edm::Run& iRun, const edm::EventSetup& i TrackerMap tmap("Delays"); // cabling I (readout) - cabling_ = iSetup.getHandle(fedCablingToken_); - auto feds = cabling_->fedIds(); + const auto& cabling = iSetup.getData(fedCablingToken_); + auto feds = cabling.fedIds(); for (auto fedid = feds.begin(); fedid < feds.end(); ++fedid) { - auto connections = cabling_->fedConnections(*fedid); + auto connections = cabling.fedConnections(*fedid); for (auto conn = connections.begin(); conn < connections.end(); ++conn) { // Fill the "old" map to be used for lookup during analysis if (conn->isConnected()) diff --git a/EventFilter/SiStripRawToDigi/plugins/SiStripRawToDigiModule.cc b/EventFilter/SiStripRawToDigi/plugins/SiStripRawToDigiModule.cc index 672a412cb5886..915938178fae2 100644 --- a/EventFilter/SiStripRawToDigi/plugins/SiStripRawToDigiModule.cc +++ b/EventFilter/SiStripRawToDigi/plugins/SiStripRawToDigiModule.cc @@ -153,8 +153,6 @@ namespace sistrip { std::stringstream sss; sss << "[sistrip::RawToDigiModule::" << __func__ << "]" << " Summary of FED cabling:" << std::endl; - edm::ESHandle tTopo; - setup.get().get(tTopo); cabling_->summary(sss, &setup.getData(tTopoToken_)); LogTrace("SiStripRawToDigi") << sss.str(); } diff --git a/RecoLocalTracker/SiStripZeroSuppression/interface/IteratedMedianCMNSubtractor.h b/RecoLocalTracker/SiStripZeroSuppression/interface/IteratedMedianCMNSubtractor.h index 83fd2fb336ca2..7ddc44a8756cb 100644 --- a/RecoLocalTracker/SiStripZeroSuppression/interface/IteratedMedianCMNSubtractor.h +++ b/RecoLocalTracker/SiStripZeroSuppression/interface/IteratedMedianCMNSubtractor.h @@ -5,7 +5,6 @@ #include "CondFormats/DataRecord/interface/SiStripNoisesRcd.h" #include "CalibTracker/Records/interface/SiStripQualityRcd.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/Framework/interface/ESWatcher.h" #include "FWCore/Framework/interface/ConsumesCollector.h" @@ -34,8 +33,8 @@ class IteratedMedianCMNSubtractor : public SiStripCommonModeNoiseSubtractor { int iterations_; edm::ESGetToken noiseToken_; edm::ESGetToken qualityToken_; - edm::ESHandle noiseHandle; - edm::ESHandle qualityHandle; + const SiStripNoises* noiseHandle; + const SiStripQuality* qualityHandle; edm::ESWatcher noiseWatcher_; edm::ESWatcher qualityWatcher_; }; diff --git a/RecoLocalTracker/SiStripZeroSuppression/interface/SiStripAPVRestorer.h b/RecoLocalTracker/SiStripZeroSuppression/interface/SiStripAPVRestorer.h index dd448b9965724..c9ffbe5e8f565 100644 --- a/RecoLocalTracker/SiStripZeroSuppression/interface/SiStripAPVRestorer.h +++ b/RecoLocalTracker/SiStripZeroSuppression/interface/SiStripAPVRestorer.h @@ -5,7 +5,6 @@ #include "FWCore/Framework/interface/EventSetup.h" #include "DataFormats/Common/interface/Handle.h" #include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/Framework/interface/ESWatcher.h" #include "CondFormats/SiStripObjects/interface/SiStripNoises.h" #include "CondFormats/SiStripObjects/interface/SiStripPedestals.h" @@ -87,9 +86,9 @@ class SiStripAPVRestorer { edm::ESGetToken qualityToken_; edm::ESGetToken noiseToken_; edm::ESGetToken pedestalToken_; - edm::ESHandle qualityHandle; - edm::ESHandle noiseHandle; - edm::ESHandle pedestalHandle; + const SiStripQuality* qualityHandle; + const SiStripNoises* noiseHandle; + const SiStripPedestals* pedestalHandle; edm::ESWatcher qualityWatcher_; edm::ESWatcher noiseWatcher_; edm::ESWatcher pedestalWatcher_; diff --git a/RecoLocalTracker/SiStripZeroSuppression/interface/SiStripPedestalsSubtractor.h b/RecoLocalTracker/SiStripZeroSuppression/interface/SiStripPedestalsSubtractor.h index 67287cbdfb479..f87445a151c3f 100644 --- a/RecoLocalTracker/SiStripZeroSuppression/interface/SiStripPedestalsSubtractor.h +++ b/RecoLocalTracker/SiStripZeroSuppression/interface/SiStripPedestalsSubtractor.h @@ -1,7 +1,6 @@ #ifndef RECOLOCALTRACKER_SISTRIPZEROSUPPRESSION_SISTRIPPEDESTALSSUBTRACTOR_H #define RECOLOCALTRACKER_SISTRIPZEROSUPPRESSION_SISTRIPPEDESTALSSUBTRACTOR_H -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/Framework/interface/ESWatcher.h" #include "FWCore/Framework/interface/ConsumesCollector.h" @@ -25,7 +24,7 @@ class SiStripPedestalsSubtractor { : pedestalsToken_(iC.esConsumes()), fedmode_(mode) {} edm::ESGetToken pedestalsToken_; edm::ESWatcher pedestalsWatcher_; - edm::ESHandle pedestalsHandle; + const SiStripPedestals* pedestalsHandle; std::vector pedestals; bool fedmode_; diff --git a/RecoLocalTracker/SiStripZeroSuppression/interface/TT6CMNSubtractor.h b/RecoLocalTracker/SiStripZeroSuppression/interface/TT6CMNSubtractor.h index 4bfb9c55c7fff..dbf5594fc8105 100644 --- a/RecoLocalTracker/SiStripZeroSuppression/interface/TT6CMNSubtractor.h +++ b/RecoLocalTracker/SiStripZeroSuppression/interface/TT6CMNSubtractor.h @@ -4,7 +4,6 @@ #include "CondFormats/DataRecord/interface/SiStripNoisesRcd.h" #include "CalibTracker/Records/interface/SiStripQualityRcd.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/Framework/interface/ESWatcher.h" #include "FWCore/Framework/interface/ConsumesCollector.h" class SiStripNoises; @@ -29,8 +28,8 @@ class TT6CMNSubtractor : public SiStripCommonModeNoiseSubtractor { double cut_to_avoid_signal_; edm::ESGetToken noiseToken_; edm::ESGetToken qualityToken_; - edm::ESHandle noiseHandle; - edm::ESHandle qualityHandle; + const SiStripNoises* noiseHandle; + const SiStripQuality* qualityHandle; edm::ESWatcher noiseWatcher_; edm::ESWatcher qualityWatcher_; }; diff --git a/RecoLocalTracker/SiStripZeroSuppression/src/IteratedMedianCMNSubtractor.cc b/RecoLocalTracker/SiStripZeroSuppression/src/IteratedMedianCMNSubtractor.cc index 665307e6a27fe..7322e50d7f8ed 100644 --- a/RecoLocalTracker/SiStripZeroSuppression/src/IteratedMedianCMNSubtractor.cc +++ b/RecoLocalTracker/SiStripZeroSuppression/src/IteratedMedianCMNSubtractor.cc @@ -6,10 +6,10 @@ void IteratedMedianCMNSubtractor::init(const edm::EventSetup& es) { if (noiseWatcher_.check(es)) { - noiseHandle = es.getHandle(noiseToken_); + noiseHandle = &es.getData(noiseToken_); } if (qualityWatcher_.check(es)) { - qualityHandle = es.getHandle(qualityToken_); + qualityHandle = &es.getData(qualityToken_); } } diff --git a/RecoLocalTracker/SiStripZeroSuppression/src/SiStripAPVRestorer.cc b/RecoLocalTracker/SiStripZeroSuppression/src/SiStripAPVRestorer.cc index 3aab68774d58a..36d8adb6f930d 100644 --- a/RecoLocalTracker/SiStripZeroSuppression/src/SiStripAPVRestorer.cc +++ b/RecoLocalTracker/SiStripZeroSuppression/src/SiStripAPVRestorer.cc @@ -54,13 +54,13 @@ SiStripAPVRestorer::SiStripAPVRestorer(const edm::ParameterSet& conf, edm::Consu void SiStripAPVRestorer::init(const edm::EventSetup& es) { if (noiseWatcher_.check(es)) { - noiseHandle = es.getHandle(noiseToken_); + noiseHandle = &es.getData(noiseToken_); } if (qualityWatcher_.check(es)) { - qualityHandle = es.getHandle(qualityToken_); + qualityHandle = &es.getData(qualityToken_); } if (pedestalWatcher_.check(es)) { - pedestalHandle = es.getHandle(pedestalToken_); + pedestalHandle = &es.getData(pedestalToken_); } } diff --git a/RecoLocalTracker/SiStripZeroSuppression/src/SiStripPedestalsSubtractor.cc b/RecoLocalTracker/SiStripZeroSuppression/src/SiStripPedestalsSubtractor.cc index 130021489857b..03e321739638f 100644 --- a/RecoLocalTracker/SiStripZeroSuppression/src/SiStripPedestalsSubtractor.cc +++ b/RecoLocalTracker/SiStripZeroSuppression/src/SiStripPedestalsSubtractor.cc @@ -4,7 +4,7 @@ void SiStripPedestalsSubtractor::init(const edm::EventSetup& es) { if (pedestalsWatcher_.check(es)) { - pedestalsHandle = es.getHandle(pedestalsToken_); + pedestalsHandle = &es.getData(pedestalsToken_); } } diff --git a/RecoLocalTracker/SiStripZeroSuppression/src/TT6CMNSubtractor.cc b/RecoLocalTracker/SiStripZeroSuppression/src/TT6CMNSubtractor.cc index a219672068732..0ca373a822855 100644 --- a/RecoLocalTracker/SiStripZeroSuppression/src/TT6CMNSubtractor.cc +++ b/RecoLocalTracker/SiStripZeroSuppression/src/TT6CMNSubtractor.cc @@ -4,13 +4,12 @@ #include "CalibFormats/SiStripObjects/interface/SiStripQuality.h" #include -// FIXME use ESWatcher auto-call to get rid of init (here and in IteratedMedian void TT6CMNSubtractor::init(const edm::EventSetup& es) { if (noiseWatcher_.check(es)) { - noiseHandle = es.getHandle(noiseToken_); + noiseHandle = &es.getData(noiseToken_); } if (qualityWatcher_.check(es)) { - qualityHandle = es.getHandle(qualityToken_); + qualityHandle = &es.getData(qualityToken_); } } diff --git a/RecoLocalTracker/SiStripZeroSuppression/test/SiStripBaselineAnalyzer.cc b/RecoLocalTracker/SiStripZeroSuppression/test/SiStripBaselineAnalyzer.cc index e786f4b4ab759..51ed37e4b8ee4 100644 --- a/RecoLocalTracker/SiStripZeroSuppression/test/SiStripBaselineAnalyzer.cc +++ b/RecoLocalTracker/SiStripZeroSuppression/test/SiStripBaselineAnalyzer.cc @@ -27,7 +27,6 @@ #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/MakerMacros.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "DataFormats/Common/interface/DetSet.h" #include "DataFormats/Common/interface/DetSetVector.h" @@ -83,7 +82,7 @@ class SiStripBaselineAnalyzer : public edm::one::EDAnalyzer subtractorPed_; edm::ESGetToken pedestalsToken_; - edm::ESHandle pedestalsHandle; + const SiStripPedestals* pedestalsHandle; edm::ESWatcher pedestalsWatcher_; std::vector pedestals; @@ -165,7 +164,7 @@ void SiStripBaselineAnalyzer::analyze(const edm::Event& e, const edm::EventSetup using namespace edm; if (plotPedestals_ && actualModule_ == 0) { if (pedestalsWatcher_.check(es)) { - pedestalsHandle = es.getHandle(pedestalsToken_); + pedestalsHandle = &es.getData(pedestalsToken_); } std::vector detIdV; diff --git a/RecoLocalTracker/SiStripZeroSuppression/test/SiStripHybridFormatAnalyzer.cc b/RecoLocalTracker/SiStripZeroSuppression/test/SiStripHybridFormatAnalyzer.cc index 0dedc3797bfa0..d02fb48b14c02 100644 --- a/RecoLocalTracker/SiStripZeroSuppression/test/SiStripHybridFormatAnalyzer.cc +++ b/RecoLocalTracker/SiStripZeroSuppression/test/SiStripHybridFormatAnalyzer.cc @@ -30,7 +30,6 @@ #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/MakerMacros.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "DataFormats/Common/interface/DetSet.h" #include "DataFormats/Common/interface/DetSetVector.h" diff --git a/RecoLocalTracker/SiStripZeroSuppression/test/SiStripMeanCMExtractor.cc b/RecoLocalTracker/SiStripZeroSuppression/test/SiStripMeanCMExtractor.cc index ae90a6e29b133..8946b31624484 100644 --- a/RecoLocalTracker/SiStripZeroSuppression/test/SiStripMeanCMExtractor.cc +++ b/RecoLocalTracker/SiStripZeroSuppression/test/SiStripMeanCMExtractor.cc @@ -28,7 +28,6 @@ #include "FWCore/Framework/interface/EventSetup.h" #include "DataFormats/Common/interface/Handle.h" #include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/Framework/interface/Frameworkfwd.h" #include "FWCore/Framework/interface/one/EDProducer.h" @@ -62,7 +61,7 @@ class SiStripMeanCMExtractor : public edm::one::EDProducer<> { void init(const edm::EventSetup&); edm::ESGetToken pedestalsToken_; - edm::ESHandle pedestalHandle_; + const SiStripPedestals* pedestalHandle_; edm::ESWatcher pedestalsWatcher_; void StoreMean(const edm::DetSetVector&); @@ -99,7 +98,7 @@ void SiStripMeanCMExtractor::fillDescriptions(edm::ConfigurationDescriptions& de void SiStripMeanCMExtractor::init(const edm::EventSetup& es) { if (pedestalsWatcher_.check(es)) { - pedestalHandle_ = es.getHandle(pedestalsToken_); + pedestalHandle_ = &es.getData(pedestalsToken_); } }