diff --git a/AnalysisAlgos/SiStripClusterInfoProducer/plugins/SealModules.cc b/AnalysisAlgos/SiStripClusterInfoProducer/plugins/SealModules.cc deleted file mode 100644 index ebe98c1137682..0000000000000 --- a/AnalysisAlgos/SiStripClusterInfoProducer/plugins/SealModules.cc +++ /dev/null @@ -1,8 +0,0 @@ - -#include "FWCore/PluginManager/interface/ModuleDef.h" - -#include "FWCore/Framework/interface/MakerMacros.h" - -#include "AnalysisAlgos/SiStripClusterInfoProducer/plugins/SiStripProcessedRawDigiProducer.h" - -DEFINE_FWK_MODULE(SiStripProcessedRawDigiProducer); diff --git a/AnalysisAlgos/SiStripClusterInfoProducer/plugins/SiStripProcessedRawDigiProducer.cc b/AnalysisAlgos/SiStripClusterInfoProducer/plugins/SiStripProcessedRawDigiProducer.cc index 04ea834f65969..0a9d4b79d66f7 100644 --- a/AnalysisAlgos/SiStripClusterInfoProducer/plugins/SiStripProcessedRawDigiProducer.cc +++ b/AnalysisAlgos/SiStripClusterInfoProducer/plugins/SiStripProcessedRawDigiProducer.cc @@ -1,16 +1,58 @@ -#include "AnalysisAlgos/SiStripClusterInfoProducer/plugins/SiStripProcessedRawDigiProducer.h" +// system includes +#include +#include +#include +// user includes +#include "CalibFormats/SiStripObjects/interface/SiStripGain.h" +#include "CalibTracker/Records/interface/SiStripGainRcd.h" +#include "DataFormats/Common/interface/DetSetVector.h" +#include "DataFormats/SiStripDigi/interface/SiStripDigi.h" +#include "DataFormats/SiStripDigi/interface/SiStripProcessedRawDigi.h" +#include "DataFormats/SiStripDigi/interface/SiStripRawDigi.h" +#include "FWCore/Framework/interface/stream/EDProducer.h" #include "FWCore/Framework/interface/Event.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/Framework/interface/Frameworkfwd.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/Utilities/interface/InputTag.h" #include "FWCore/Utilities/interface/transform.h" +#include "RecoLocalTracker/SiStripZeroSuppression/interface/SiStripCommonModeNoiseSubtractor.h" +#include "RecoLocalTracker/SiStripZeroSuppression/interface/SiStripPedestalsSubtractor.h" +#include "RecoLocalTracker/SiStripZeroSuppression/interface/SiStripRawProcessingFactory.h" -#include "DataFormats/SiStripDigi/interface/SiStripDigi.h" -#include "DataFormats/SiStripDigi/interface/SiStripRawDigi.h" -#include "DataFormats/SiStripDigi/interface/SiStripProcessedRawDigi.h" +class SiStripProcessedRawDigiProducer : public edm::stream::EDProducer<> { +public: + explicit SiStripProcessedRawDigiProducer(edm::ParameterSet const&); -#include +private: + void produce(edm::Event& e, const edm::EventSetup& es) override; + template + std::string findInput(edm::Handle& handle, const std::vector >& tokens, const edm::Event& e); + + 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&); + + const std::vector inputTags_; + const std::vector > > inputTokensDigi_; + const std::vector > > inputTokensRawDigi_; + const edm::ESGetToken gainToken_; + + std::unique_ptr subtractorPed_; + std::unique_ptr subtractorCMN_; +}; SiStripProcessedRawDigiProducer::SiStripProcessedRawDigiProducer(edm::ParameterSet const& conf) : inputTags_(conf.getParameter >("DigiProducersList")), @@ -66,37 +108,37 @@ void SiStripProcessedRawDigiProducer::zs_process(const edm::DetSetVector& output, const SiStripGain& gain) { std::vector digis; - for (edm::DetSetVector::const_iterator detset = input.begin(); detset != input.end(); ++detset) { + for (const auto& detset : input) { digis.clear(); - for (edm::DetSet::const_iterator digi = detset->begin(); digi != detset->end(); ++digi) { - digis.resize(digi->strip(), 0); - digis.push_back(digi->adc()); + for (const auto& digi : detset) { + digis.resize(digi.strip(), 0); + digis.push_back(digi.adc()); } - common_process(detset->id, digis, output, gain); + common_process(detset.id, digis, output, gain); } } void SiStripProcessedRawDigiProducer::pr_process(const edm::DetSetVector& input, edm::DetSetVector& output, const SiStripGain& gain) { - for (edm::DetSetVector::const_iterator detset = input.begin(); detset != input.end(); ++detset) { + for (const auto& detset : input) { 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, gain); + 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, gain); } } void SiStripProcessedRawDigiProducer::vr_process(const edm::DetSetVector& input, 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); + for (const auto& detset : input) { + 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, gain); + subtractorCMN_->subtract(detset.id, 0, digis); + common_process(detset.id, digis, output, gain); } } @@ -106,11 +148,16 @@ void SiStripProcessedRawDigiProducer::common_process(const uint32_t detId, const SiStripGain& gain) { //Apply Gains SiStripApvGain::Range detGainRange = gain.getRange(detId); - for (std::vector::iterator it = digis.begin(); it < digis.end(); ++it) - (*it) /= (gain.getStripGain(it - digis.begin(), detGainRange)); + for (auto& it : digis) + it /= (gain.getStripGain(it - *digis.begin(), detGainRange)); //Insert as DetSet edm::DetSet ds(detId); copy(digis.begin(), digis.end(), back_inserter(ds.data)); output.insert(ds); } + +#include "FWCore/PluginManager/interface/ModuleDef.h" +#include "FWCore/Framework/interface/MakerMacros.h" + +DEFINE_FWK_MODULE(SiStripProcessedRawDigiProducer); diff --git a/AnalysisAlgos/SiStripClusterInfoProducer/plugins/SiStripProcessedRawDigiProducer.h b/AnalysisAlgos/SiStripClusterInfoProducer/plugins/SiStripProcessedRawDigiProducer.h deleted file mode 100644 index b383316806919..0000000000000 --- a/AnalysisAlgos/SiStripClusterInfoProducer/plugins/SiStripProcessedRawDigiProducer.h +++ /dev/null @@ -1,54 +0,0 @@ -#ifndef AnalysisAlgos_SiStripClusterInfoProducer_SiStripProcessedRawDigiProducer_H -#define AnalysisAlgos_SiStripClusterInfoProducer_SiStripProcessedRawDigiProducer_H - -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDProducer.h" -#include "FWCore/Utilities/interface/InputTag.h" - -#include "RecoLocalTracker/SiStripZeroSuppression/interface/SiStripPedestalsSubtractor.h" -#include "RecoLocalTracker/SiStripZeroSuppression/interface/SiStripCommonModeNoiseSubtractor.h" -#include "RecoLocalTracker/SiStripZeroSuppression/interface/SiStripRawProcessingFactory.h" - -#include "CalibFormats/SiStripObjects/interface/SiStripGain.h" -#include "CalibTracker/Records/interface/SiStripGainRcd.h" - -#include "DataFormats/Common/interface/DetSetVector.h" -#include "DataFormats/SiStripDigi/interface/SiStripDigi.h" -#include "DataFormats/SiStripDigi/interface/SiStripRawDigi.h" -#include -#include - -class SiStripProcessedRawDigi; - -class SiStripProcessedRawDigiProducer : public edm::EDProducer { -public: - explicit SiStripProcessedRawDigiProducer(edm::ParameterSet const&); - -private: - void produce(edm::Event& e, const edm::EventSetup& es) override; - template - std::string findInput(edm::Handle& handle, const std::vector >& tokens, const edm::Event& e); - - 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_; - - std::unique_ptr subtractorPed_; - std::unique_ptr subtractorCMN_; -}; -#endif