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 ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducer ()
 
- 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 ()
 
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, std::unordered_multimap< std::string, edm::ProductResolverIndex > const &iIndicies, std::string const &moduleLabel)
 
virtual ~ProducerBase () noexcept(false)
 
- 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
 
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
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
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)
 
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
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)
 
- 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 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, produce(), subtractorCMN, subtractorPed, GlobalPosition_Frontier_DevDB_cff::tag, and edm::vector_transform().

21  : inputTags(conf.getParameter<std::vector<edm::InputTag> >("DigiProducersList")),
22  inputTokensDigi(edm::vector_transform(inputTags, [this](edm::InputTag const & tag){return consumes<edm::DetSetVector<SiStripDigi> >(tag);})),
23  inputTokensRawDigi(edm::vector_transform(inputTags, [this](edm::InputTag const & tag){return consumes<edm::DetSetVector<SiStripRawDigi> >(tag);})),
26 
27  produces< edm::DetSetVector<SiStripProcessedRawDigi> >("");
28 }
std::vector< edm::EDGetTokenT< edm::DetSetVector< SiStripRawDigi > > > inputTokensRawDigi
std::unique_ptr< SiStripPedestalsSubtractor > subtractorPed
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::auto_ptr< SiStripCommonModeNoiseSubtractor > create_SubtractorCMN(const edm::ParameterSet &)
std::vector< edm::EDGetTokenT< edm::DetSetVector< SiStripDigi > > > inputTokensDigi
std::unique_ptr< SiStripCommonModeNoiseSubtractor > subtractorCMN
static std::auto_ptr< SiStripPedestalsSubtractor > create_SubtractorPed(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 popcon2dropbox::copy(), edm::DetSet< T >::data, gainHandle, SiStripGain::getRange(), SiStripGain::getStripGain(), and edm::DetSetVector< T >::insert().

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

103  {
104 
105  //Apply Gains
106  SiStripApvGain::Range detGainRange = gainHandle->getRange(detId);
107  for(std::vector<float>::iterator it=digis.begin(); it<digis.end(); ++it)
108  (*it)/= (gainHandle->getStripGain(it-digis.begin(), detGainRange));
109 
110  //Insert as DetSet
112  copy(digis.begin(), digis.end(), back_inserter(ds.data) );
113  output.insert(ds);
114 }
static float getStripGain(const uint16_t &strip, const SiStripApvGain::Range &range)
Definition: SiStripGain.h:68
std::pair< ContainerIterator, ContainerIterator > Range
void insert(detset const &s)
Insert the given DetSet.
Definition: DetSetVector.h:235
const SiStripApvGain::Range getRange(uint32_t detID) const
Definition: SiStripGain.h:66
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(), diffTreeTool::index, inputTags, edm::HandleBase::isValid(), and zs_process().

Referenced by produce().

54  {
55 
56  for( typename std::vector<edm::EDGetTokenT<T> >::const_iterator
57  token = tokens.begin(); token != tokens.end(); ++token ) {
58  unsigned index(token - tokens.begin());
59  e.getByToken(*token, handle);
60  if( handle.isValid() && !handle->empty() ) {
61  edm::LogInfo("Input") << inputTags.at(index);
62  return inputTags.at(index).instance();
63  }
64  }
65  return "Input Not Found";
66 }
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:460
bool isValid() const
Definition: HandleBase.h:74
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, create_public_lumi_plots::transform, and vr_process().

Referenced by produce(), and zs_process().

82  {
83  for(edm::DetSetVector<SiStripRawDigi>::const_iterator detset=input.begin(); detset!=input.end(); ++detset) {
84  std::vector<float> digis;
85  transform(detset->begin(), detset->end(), back_inserter(digis), boost::bind(&SiStripRawDigi::adc , _1));
86  subtractorCMN->subtract(detset->id, 0, digis);
87  common_process( detset->id, digis, output);
88  }
89 }
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:361
std::unique_ptr< SiStripCommonModeNoiseSubtractor > subtractorCMN
iterator begin()
Return an iterator to the first DetSet.
Definition: DetSetVector.h:346
collection_type::const_iterator const_iterator
Definition: DetSetVector.h:104
void SiStripProcessedRawDigiProducer::produce ( edm::Event e,
const edm::EventSetup es 
)
private

Definition at line 31 of file SiStripProcessedRawDigiProducer.cc.

References findInput(), gainHandle, edm::EventSetup::get(), inputTokensDigi, inputTokensRawDigi, diffTwoXMLs::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(), HTMLExport.HTMLExportStatic::export(), and SiStripProcessedRawDigiProducer().

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

92  {
93  for(edm::DetSetVector<SiStripRawDigi>::const_iterator detset=input.begin(); detset!=input.end(); ++detset) {
94  std::vector<int16_t> int_digis(detset->size());
95  subtractorPed->subtract(*detset,int_digis);
96  std::vector<float> digis(int_digis.begin(), int_digis.end());
97  subtractorCMN->subtract(detset->id, 0, digis);
98  common_process( detset->id, digis, output);
99  }
100 }
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:361
std::unique_ptr< SiStripCommonModeNoiseSubtractor > subtractorCMN
iterator begin()
Return an iterator to the first DetSet.
Definition: DetSetVector.h:346
collection_type::const_iterator const_iterator
Definition: DetSetVector.h:104
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(), edm::DetSetVector< T >::end(), and pr_process().

Referenced by findInput(), and produce().

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

Member Data Documentation

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

Definition at line 42 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 40 of file SiStripProcessedRawDigiProducer.h.

Referenced by produce().

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

Definition at line 41 of file SiStripProcessedRawDigiProducer.h.

Referenced by produce(), and SiStripProcessedRawDigiProducer().

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