CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
SiStripProcessedRawDigiProducer Class Reference
Inheritance diagram for SiStripProcessedRawDigiProducer:
edm::stream::EDProducer<>

Public Member Functions

 SiStripProcessedRawDigiProducer (edm::ParameterSet const &)
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

Private Member Functions

void common_process (const uint32_t, std::vector< float > &, edm::DetSetVector< SiStripProcessedRawDigi > &, const SiStripGain &)
 
template<class T >
std::string findInput (edm::Handle< T > &handle, const std::vector< edm::EDGetTokenT< T > > &tokens, const edm::Event &e)
 
void pr_process (const edm::DetSetVector< SiStripRawDigi > &, edm::DetSetVector< SiStripProcessedRawDigi > &, const SiStripGain &)
 
void produce (edm::Event &e, const edm::EventSetup &es) override
 
void vr_process (const edm::DetSetVector< SiStripRawDigi > &, edm::DetSetVector< SiStripProcessedRawDigi > &, const SiStripGain &)
 
void zs_process (const edm::DetSetVector< SiStripDigi > &, edm::DetSetVector< SiStripProcessedRawDigi > &, const SiStripGain &)
 

Private Attributes

const edm::ESGetToken< SiStripGain, SiStripGainRcdgainToken_
 
const std::vector< edm::InputTaginputTags_
 
const std::vector< edm::EDGetTokenT< edm::DetSetVector< SiStripDigi > > > inputTokensDigi_
 
const std::vector< edm::EDGetTokenT< edm::DetSetVector< SiStripRawDigi > > > inputTokensRawDigi_
 
std::unique_ptr< SiStripCommonModeNoiseSubtractorsubtractorCMN_
 
std::unique_ptr< SiStripPedestalsSubtractorsubtractorPed_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 

Detailed Description

Definition at line 25 of file SiStripProcessedRawDigiProducer.cc.

Constructor & Destructor Documentation

◆ SiStripProcessedRawDigiProducer()

SiStripProcessedRawDigiProducer::SiStripProcessedRawDigiProducer ( edm::ParameterSet const &  conf)
explicit

Definition at line 57 of file SiStripProcessedRawDigiProducer.cc.

References makeGlobalPositionRcd_cfg::tag.

58  : inputTags_(conf.getParameter<std::vector<edm::InputTag> >("DigiProducersList")),
60  inputTags_, [this](edm::InputTag const& tag) { return consumes<edm::DetSetVector<SiStripDigi> >(tag); })),
62  inputTags_, [this](edm::InputTag const& tag) { return consumes<edm::DetSetVector<SiStripRawDigi> >(tag); })),
66  produces<edm::DetSetVector<SiStripProcessedRawDigi> >("");
67 }
const edm::ESGetToken< SiStripGain, SiStripGainRcd > gainToken_
ESGetTokenH3DDVariant esConsumes(std::string const &Record, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
const std::vector< edm::EDGetTokenT< edm::DetSetVector< SiStripRawDigi > > > inputTokensRawDigi_
std::unique_ptr< SiStripCommonModeNoiseSubtractor > subtractorCMN_
const std::vector< edm::InputTag > inputTags_
auto vector_transform(std::vector< InputType > const &input, Function predicate) -> std::vector< typename std::remove_cv< typename std::remove_reference< decltype(predicate(input.front()))>::type >::type >
Definition: transform.h:11
static std::unique_ptr< SiStripCommonModeNoiseSubtractor > create_SubtractorCMN(const edm::ParameterSet &, edm::ConsumesCollector)
const std::vector< edm::EDGetTokenT< edm::DetSetVector< SiStripDigi > > > inputTokensDigi_
static std::unique_ptr< SiStripPedestalsSubtractor > create_SubtractorPed(const edm::ParameterSet &, edm::ConsumesCollector)
std::unique_ptr< SiStripPedestalsSubtractor > subtractorPed_

Member Function Documentation

◆ common_process()

void SiStripProcessedRawDigiProducer::common_process ( const uint32_t  detId,
std::vector< float > &  digis,
edm::DetSetVector< SiStripProcessedRawDigi > &  output,
const SiStripGain gain 
)
private

Definition at line 145 of file SiStripProcessedRawDigiProducer.cc.

References filterCSVwithJSON::copy, edm::DetSet< T >::data, hcalRecHitTable_cff::detId, PedestalClient_cfi::gain, and ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it.

Referenced by pr_process(), vr_process(), and zs_process().

148  {
149  //Apply Gains
150  SiStripApvGain::Range detGainRange = gain.getRange(detId);
151  for (auto& it : digis)
152  it /= (gain.getStripGain(it - *digis.begin(), detGainRange));
153 
154  //Insert as DetSet
156  copy(digis.begin(), digis.end(), back_inserter(ds.data));
157  output.insert(ds);
158 }
std::pair< ContainerIterator, ContainerIterator > Range
Definition: output.py:1

◆ findInput()

template<class T >
std::string SiStripProcessedRawDigiProducer::findInput ( edm::Handle< T > &  handle,
const std::vector< edm::EDGetTokenT< T > > &  tokens,
const edm::Event e 
)
inlineprivate

Definition at line 92 of file SiStripProcessedRawDigiProducer.cc.

References MillePedeFileConverter_cfg::e, patZpeak::handle, inputTags_, unpackBuffers-CaloStage2::token, and trackerHitRTTI::vector.

Referenced by produce().

94  {
95  for (typename std::vector<edm::EDGetTokenT<T> >::const_iterator token = tokens.begin(); token != tokens.end();
96  ++token) {
97  unsigned index(token - tokens.begin());
98  e.getByToken(*token, handle);
99  if (handle.isValid() && !handle->empty()) {
100  edm::LogInfo("Input") << inputTags_.at(index);
101  return inputTags_.at(index).instance();
102  }
103  }
104  return "Input Not Found";
105 }
const std::vector< edm::InputTag > inputTags_
Log< level::Info, false > LogInfo

◆ pr_process()

void SiStripProcessedRawDigiProducer::pr_process ( const edm::DetSetVector< SiStripRawDigi > &  input,
edm::DetSetVector< SiStripProcessedRawDigi > &  output,
const SiStripGain gain 
)
private

Definition at line 121 of file SiStripProcessedRawDigiProducer.cc.

References SiStripRawDigi::adc(), common_process(), PedestalClient_cfi::gain, input, subtractorCMN_, and HcalDetIdTransform::transform().

Referenced by produce().

123  {
124  for (const auto& detset : input) {
125  std::vector<float> digis;
126  transform(
127  detset.begin(), detset.end(), back_inserter(digis), std::bind(&SiStripRawDigi::adc, std::placeholders::_1));
128  subtractorCMN_->subtract(detset.id, 0, digis);
129  common_process(detset.id, digis, output, gain);
130  }
131 }
void common_process(const uint32_t, std::vector< float > &, edm::DetSetVector< SiStripProcessedRawDigi > &, const SiStripGain &)
std::unique_ptr< SiStripCommonModeNoiseSubtractor > subtractorCMN_
uint16_t adc() const
static std::string const input
Definition: EdmProvDump.cc:50
Definition: output.py:1
unsigned transform(const HcalDetId &id, unsigned transformCode)

◆ produce()

void SiStripProcessedRawDigiProducer::produce ( edm::Event e,
const edm::EventSetup es 
)
overrideprivate

Definition at line 69 of file SiStripProcessedRawDigiProducer.cc.

References MillePedeFileConverter_cfg::e, findInput(), PedestalClient_cfi::gain, gainToken_, edm::EventSetup::getData(), CommPDSkim_cfg::inputDigis, inputTokensDigi_, inputTokensRawDigi_, label, eostools::move(), convertSQLitetoXML_cfg::output, pr_process(), AlCaHLTBitMon_QueryRunRegistry::string, subtractorCMN_, subtractorPed_, vr_process(), and zs_process().

69  {
70  std::unique_ptr<edm::DetSetVector<SiStripProcessedRawDigi> > output(new edm::DetSetVector<SiStripProcessedRawDigi>());
73 
74  const auto& gain = es.getData(gainToken_);
75  subtractorPed_->init(es);
76  subtractorCMN_->init(es);
77 
78  std::string label = findInput(inputRawdigis, inputTokensRawDigi_, e);
79  if ("VirginRaw" == label)
80  vr_process(*inputRawdigis, *output, gain);
81  else if ("ProcessedRaw" == label)
82  pr_process(*inputRawdigis, *output, gain);
83  else if ("ZeroSuppressed" == findInput(inputDigis, inputTokensDigi_, e))
85  else
86  edm::LogError("Input Not Found");
87 
88  e.put(std::move(output));
89 }
const edm::ESGetToken< SiStripGain, SiStripGainRcd > gainToken_
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
void zs_process(const edm::DetSetVector< SiStripDigi > &, edm::DetSetVector< SiStripProcessedRawDigi > &, const SiStripGain &)
const std::vector< edm::EDGetTokenT< edm::DetSetVector< SiStripRawDigi > > > inputTokensRawDigi_
std::unique_ptr< SiStripCommonModeNoiseSubtractor > subtractorCMN_
Log< level::Error, false > LogError
std::string findInput(edm::Handle< T > &handle, const std::vector< edm::EDGetTokenT< T > > &tokens, const edm::Event &e)
char const * label
const std::vector< edm::EDGetTokenT< edm::DetSetVector< SiStripDigi > > > inputTokensDigi_
void pr_process(const edm::DetSetVector< SiStripRawDigi > &, edm::DetSetVector< SiStripProcessedRawDigi > &, const SiStripGain &)
std::unique_ptr< SiStripPedestalsSubtractor > subtractorPed_
Definition: output.py:1
void vr_process(const edm::DetSetVector< SiStripRawDigi > &, edm::DetSetVector< SiStripProcessedRawDigi > &, const SiStripGain &)
def move(src, dest)
Definition: eostools.py:511

◆ vr_process()

void SiStripProcessedRawDigiProducer::vr_process ( const edm::DetSetVector< SiStripRawDigi > &  input,
edm::DetSetVector< SiStripProcessedRawDigi > &  output,
const SiStripGain gain 
)
private

Definition at line 133 of file SiStripProcessedRawDigiProducer.cc.

References common_process(), PedestalClient_cfi::gain, input, subtractorCMN_, and subtractorPed_.

Referenced by produce().

135  {
136  for (const auto& detset : input) {
137  std::vector<int16_t> int_digis(detset.size());
138  subtractorPed_->subtract(detset, int_digis);
139  std::vector<float> digis(int_digis.begin(), int_digis.end());
140  subtractorCMN_->subtract(detset.id, 0, digis);
141  common_process(detset.id, digis, output, gain);
142  }
143 }
void common_process(const uint32_t, std::vector< float > &, edm::DetSetVector< SiStripProcessedRawDigi > &, const SiStripGain &)
std::unique_ptr< SiStripCommonModeNoiseSubtractor > subtractorCMN_
static std::string const input
Definition: EdmProvDump.cc:50
std::unique_ptr< SiStripPedestalsSubtractor > subtractorPed_
Definition: output.py:1

◆ zs_process()

void SiStripProcessedRawDigiProducer::zs_process ( const edm::DetSetVector< SiStripDigi > &  input,
edm::DetSetVector< SiStripProcessedRawDigi > &  output,
const SiStripGain gain 
)
private

Definition at line 107 of file SiStripProcessedRawDigiProducer.cc.

References common_process(), PedestalClient_cfi::gain, and input.

Referenced by produce().

109  {
110  std::vector<float> digis;
111  for (const auto& detset : input) {
112  digis.clear();
113  for (const auto& digi : detset) {
114  digis.resize(digi.strip(), 0);
115  digis.push_back(digi.adc());
116  }
117  common_process(detset.id, digis, output, gain);
118  }
119 }
void common_process(const uint32_t, std::vector< float > &, edm::DetSetVector< SiStripProcessedRawDigi > &, const SiStripGain &)
static std::string const input
Definition: EdmProvDump.cc:50
Definition: output.py:1

Member Data Documentation

◆ gainToken_

const edm::ESGetToken<SiStripGain, SiStripGainRcd> SiStripProcessedRawDigiProducer::gainToken_
private

Definition at line 51 of file SiStripProcessedRawDigiProducer.cc.

Referenced by produce().

◆ inputTags_

const std::vector<edm::InputTag> SiStripProcessedRawDigiProducer::inputTags_
private

Definition at line 48 of file SiStripProcessedRawDigiProducer.cc.

Referenced by findInput().

◆ inputTokensDigi_

const std::vector<edm::EDGetTokenT<edm::DetSetVector<SiStripDigi> > > SiStripProcessedRawDigiProducer::inputTokensDigi_
private

Definition at line 49 of file SiStripProcessedRawDigiProducer.cc.

Referenced by produce().

◆ inputTokensRawDigi_

const std::vector<edm::EDGetTokenT<edm::DetSetVector<SiStripRawDigi> > > SiStripProcessedRawDigiProducer::inputTokensRawDigi_
private

Definition at line 50 of file SiStripProcessedRawDigiProducer.cc.

Referenced by produce().

◆ subtractorCMN_

std::unique_ptr<SiStripCommonModeNoiseSubtractor> SiStripProcessedRawDigiProducer::subtractorCMN_
private

Definition at line 54 of file SiStripProcessedRawDigiProducer.cc.

Referenced by pr_process(), produce(), and vr_process().

◆ subtractorPed_

std::unique_ptr<SiStripPedestalsSubtractor> SiStripProcessedRawDigiProducer::subtractorPed_
private

Definition at line 53 of file SiStripProcessedRawDigiProducer.cc.

Referenced by produce(), and vr_process().