CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
SiStripProcessedRawDigiProducer Class Reference

#include <SiStripProcessedRawDigiProducer.h>

Inheritance diagram for SiStripProcessedRawDigiProducer:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 SiStripProcessedRawDigiProducer (edm::ParameterSet const &)
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducer () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
 ~ProducerBase () noexcept(false) override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

void common_process (const uint32_t, std::vector< float > &, edm::DetSetVector< SiStripProcessedRawDigi > &)
 
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 > &)
 
void produce (edm::Event &e, const edm::EventSetup &es) override
 
void vr_process (const edm::DetSetVector< SiStripRawDigi > &, edm::DetSetVector< SiStripProcessedRawDigi > &)
 
void zs_process (const edm::DetSetVector< SiStripDigi > &, edm::DetSetVector< SiStripProcessedRawDigi > &)
 

Private Attributes

edm::ESHandle< SiStripGaingainHandle
 
std::vector< edm::InputTaginputTags
 
std::vector< edm::EDGetTokenT< edm::DetSetVector< SiStripDigi > > > inputTokensDigi
 
std::vector< edm::EDGetTokenT< edm::DetSetVector< SiStripRawDigi > > > inputTokensRawDigi
 
std::unique_ptr< SiStripCommonModeNoiseSubtractorsubtractorCMN
 
std::unique_ptr< SiStripPedestalsSubtractorsubtractorPed
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex >>
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- Protected Member Functions inherited from edm::ProducerBase
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Definition at line 22 of file SiStripProcessedRawDigiProducer.h.

Constructor & Destructor Documentation

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

Definition at line 20 of file SiStripProcessedRawDigiProducer.cc.

References SiStripRawProcessingFactory::create_SubtractorCMN(), SiStripRawProcessingFactory::create_SubtractorPed(), inputTags, inputTokensRawDigi, subtractorCMN, subtractorPed, GlobalPosition_Frontier_DevDB_cff::tag, and edm::vector_transform().

21  : inputTags(conf.getParameter<std::vector<edm::InputTag> >("DigiProducersList")),
23  inputTags, [this](edm::InputTag const& tag) { return consumes<edm::DetSetVector<SiStripDigi> >(tag); })),
25  inputTags, [this](edm::InputTag const& tag) { return consumes<edm::DetSetVector<SiStripRawDigi> >(tag); })),
28  produces<edm::DetSetVector<SiStripProcessedRawDigi> >("");
29 }
std::vector< edm::EDGetTokenT< edm::DetSetVector< SiStripRawDigi > > > inputTokensRawDigi
std::unique_ptr< SiStripPedestalsSubtractor > subtractorPed
static std::unique_ptr< SiStripPedestalsSubtractor > create_SubtractorPed(const edm::ParameterSet &)
std::vector< edm::EDGetTokenT< edm::DetSetVector< SiStripDigi > > > inputTokensDigi
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
std::unique_ptr< SiStripCommonModeNoiseSubtractor > subtractorCMN
static std::unique_ptr< SiStripCommonModeNoiseSubtractor > create_SubtractorCMN(const edm::ParameterSet &)

Member Function Documentation

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

Definition at line 103 of file SiStripProcessedRawDigiProducer.cc.

References filterCSVwithJSON::copy, edm::DetSet< T >::data, gainHandle, SiStripGain::getRange(), SiStripGain::getStripGain(), and edm::DetSetVector< T >::insert().

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

105  {
106  //Apply Gains
107  SiStripApvGain::Range detGainRange = gainHandle->getRange(detId);
108  for (std::vector<float>::iterator it = digis.begin(); it < digis.end(); ++it)
109  (*it) /= (gainHandle->getStripGain(it - digis.begin(), detGainRange));
110 
111  //Insert as DetSet
113  copy(digis.begin(), digis.end(), back_inserter(ds.data));
114  output.insert(ds);
115 }
static float getStripGain(const uint16_t &strip, const SiStripApvGain::Range &range)
Definition: SiStripGain.h:73
std::pair< ContainerIterator, ContainerIterator > Range
void insert(detset const &s)
Insert the given DetSet.
Definition: DetSetVector.h:220
const SiStripApvGain::Range getRange(uint32_t detID) const
Definition: SiStripGain.h:71
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 54 of file SiStripProcessedRawDigiProducer.cc.

References edm::Event::getByToken(), inputTags, edm::HandleBase::isValid(), and unpackBuffers-CaloStage2::token.

Referenced by produce().

56  {
57  for (typename std::vector<edm::EDGetTokenT<T> >::const_iterator token = tokens.begin(); token != tokens.end();
58  ++token) {
59  unsigned index(token - tokens.begin());
60  e.getByToken(*token, handle);
61  if (handle.isValid() && !handle->empty()) {
62  edm::LogInfo("Input") << inputTags.at(index);
63  return inputTags.at(index).instance();
64  }
65  }
66  return "Input Not Found";
67 }
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:525
bool isValid() const
Definition: HandleBase.h:70
void SiStripProcessedRawDigiProducer::pr_process ( const edm::DetSetVector< SiStripRawDigi > &  input,
edm::DetSetVector< SiStripProcessedRawDigi > &  output 
)
private

Definition at line 82 of file SiStripProcessedRawDigiProducer.cc.

References SiStripRawDigi::adc(), edm::DetSetVector< T >::begin(), common_process(), edm::DetSetVector< T >::end(), subtractorCMN, and HcalDetIdTransform::transform().

Referenced by produce().

83  {
84  for (edm::DetSetVector<SiStripRawDigi>::const_iterator detset = input.begin(); detset != input.end(); ++detset) {
85  std::vector<float> digis;
86  transform(detset->begin(), detset->end(), back_inserter(digis), boost::bind(&SiStripRawDigi::adc, _1));
87  subtractorCMN->subtract(detset->id, 0, digis);
88  common_process(detset->id, digis, output);
89  }
90 }
const uint16_t & adc() const
void common_process(const uint32_t, std::vector< float > &, edm::DetSetVector< SiStripProcessedRawDigi > &)
iterator end()
Return the off-the-end iterator.
Definition: DetSetVector.h:325
std::unique_ptr< SiStripCommonModeNoiseSubtractor > subtractorCMN
iterator begin()
Return an iterator to the first DetSet.
Definition: DetSetVector.h:314
collection_type::const_iterator const_iterator
Definition: DetSetVector.h:102
unsigned transform(const HcalDetId &id, unsigned transformCode)
void SiStripProcessedRawDigiProducer::produce ( edm::Event e,
const edm::EventSetup es 
)
overrideprivate

Definition at line 31 of file SiStripProcessedRawDigiProducer.cc.

References findInput(), gainHandle, edm::EventSetup::get(), CommPDSkim_cfg::inputDigis, inputTokensDigi, inputTokensRawDigi, label, eostools::move(), convertSQLitetoXML_cfg::output, pr_process(), edm::Event::put(), AlCaHLTBitMon_QueryRunRegistry::string, subtractorCMN, subtractorPed, vr_process(), and zs_process().

Referenced by JSONExport.JsonExport::export(), HTMLExport.HTMLExport::export(), and HTMLExport.HTMLExportStatic::export().

31  {
32  std::unique_ptr<edm::DetSetVector<SiStripProcessedRawDigi> > output(new edm::DetSetVector<SiStripProcessedRawDigi>());
35 
36  es.get<SiStripGainRcd>().get(gainHandle);
37  subtractorPed->init(es);
38  subtractorCMN->init(es);
39 
40  std::string label = findInput(inputRawdigis, inputTokensRawDigi, e);
41  if ("VirginRaw" == label)
42  vr_process(*inputRawdigis, *output);
43  else if ("ProcessedRaw" == label)
44  pr_process(*inputRawdigis, *output);
45  else if ("ZeroSuppressed" == findInput(inputDigis, inputTokensDigi, e))
46  zs_process(*inputDigis, *output);
47  else
48  edm::LogError("Input Not Found");
49 
50  e.put(std::move(output));
51 }
std::vector< edm::EDGetTokenT< edm::DetSetVector< SiStripRawDigi > > > inputTokensRawDigi
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:131
std::unique_ptr< SiStripPedestalsSubtractor > subtractorPed
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 > &)
char const * label
std::vector< edm::EDGetTokenT< edm::DetSetVector< SiStripDigi > > > inputTokensDigi
std::unique_ptr< SiStripCommonModeNoiseSubtractor > subtractorCMN
void zs_process(const edm::DetSetVector< SiStripDigi > &, edm::DetSetVector< SiStripProcessedRawDigi > &)
T get() const
Definition: EventSetup.h:73
def move(src, dest)
Definition: eostools.py:511
void vr_process(const edm::DetSetVector< SiStripRawDigi > &, edm::DetSetVector< SiStripProcessedRawDigi > &)
void SiStripProcessedRawDigiProducer::vr_process ( const edm::DetSetVector< SiStripRawDigi > &  input,
edm::DetSetVector< SiStripProcessedRawDigi > &  output 
)
private

Definition at line 92 of file SiStripProcessedRawDigiProducer.cc.

References edm::DetSetVector< T >::begin(), common_process(), edm::DetSetVector< T >::end(), subtractorCMN, and subtractorPed.

Referenced by produce().

93  {
94  for (edm::DetSetVector<SiStripRawDigi>::const_iterator detset = input.begin(); detset != input.end(); ++detset) {
95  std::vector<int16_t> int_digis(detset->size());
96  subtractorPed->subtract(*detset, int_digis);
97  std::vector<float> digis(int_digis.begin(), int_digis.end());
98  subtractorCMN->subtract(detset->id, 0, digis);
99  common_process(detset->id, digis, output);
100  }
101 }
std::unique_ptr< SiStripPedestalsSubtractor > subtractorPed
void common_process(const uint32_t, std::vector< float > &, edm::DetSetVector< SiStripProcessedRawDigi > &)
iterator end()
Return the off-the-end iterator.
Definition: DetSetVector.h:325
std::unique_ptr< SiStripCommonModeNoiseSubtractor > subtractorCMN
iterator begin()
Return an iterator to the first DetSet.
Definition: DetSetVector.h:314
collection_type::const_iterator const_iterator
Definition: DetSetVector.h:102
void SiStripProcessedRawDigiProducer::zs_process ( const edm::DetSetVector< SiStripDigi > &  input,
edm::DetSetVector< SiStripProcessedRawDigi > &  output 
)
private

Definition at line 69 of file SiStripProcessedRawDigiProducer.cc.

References edm::DetSetVector< T >::begin(), common_process(), and edm::DetSetVector< T >::end().

Referenced by produce().

70  {
71  std::vector<float> digis;
72  for (edm::DetSetVector<SiStripDigi>::const_iterator detset = input.begin(); detset != input.end(); ++detset) {
73  digis.clear();
74  for (edm::DetSet<SiStripDigi>::const_iterator digi = detset->begin(); digi != detset->end(); ++digi) {
75  digis.resize(digi->strip(), 0);
76  digis.push_back(digi->adc());
77  }
78  common_process(detset->id, digis, output);
79  }
80 }
void common_process(const uint32_t, std::vector< float > &, edm::DetSetVector< SiStripProcessedRawDigi > &)
iterator end()
Return the off-the-end iterator.
Definition: DetSetVector.h:325
iterator begin()
Return an iterator to the first DetSet.
Definition: DetSetVector.h:314
collection_type::const_iterator const_iterator
Definition: DetSet.h:32
collection_type::const_iterator const_iterator
Definition: DetSetVector.h:102

Member Data Documentation

edm::ESHandle<SiStripGain> SiStripProcessedRawDigiProducer::gainHandle
private

Definition at line 39 of file SiStripProcessedRawDigiProducer.h.

Referenced by common_process(), and produce().

std::vector<edm::InputTag> SiStripProcessedRawDigiProducer::inputTags
private
std::vector<edm::EDGetTokenT<edm::DetSetVector<SiStripDigi> > > SiStripProcessedRawDigiProducer::inputTokensDigi
private

Definition at line 37 of file SiStripProcessedRawDigiProducer.h.

Referenced by produce().

std::vector<edm::EDGetTokenT<edm::DetSetVector<SiStripRawDigi> > > SiStripProcessedRawDigiProducer::inputTokensRawDigi
private

Definition at line 38 of file SiStripProcessedRawDigiProducer.h.

Referenced by produce(), and SiStripProcessedRawDigiProducer().

std::unique_ptr<SiStripCommonModeNoiseSubtractor> SiStripProcessedRawDigiProducer::subtractorCMN
private
std::unique_ptr<SiStripPedestalsSubtractor> SiStripProcessedRawDigiProducer::subtractorPed
private