CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

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::auto_ptr
< SiStripCommonModeNoiseSubtractor
subtractorCMN
 
std::auto_ptr
< SiStripPedestalsSubtractor
subtractorPed
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- 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::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- 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 18 of file SiStripProcessedRawDigiProducer.cc.

References GlobalPosition_Frontier_DevDB_cff::tag.

19  : inputTags(conf.getParameter<std::vector<edm::InputTag> >("DigiProducersList")),
20  inputTokensDigi(edm::vector_transform(inputTags, [this](edm::InputTag const & tag){return consumes<edm::DetSetVector<SiStripDigi> >(tag);})),
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::vector< edm::EDGetTokenT< edm::DetSetVector< SiStripDigi > > > inputTokensDigi
tuple conf
Definition: dbtoconf.py:185

Member Function Documentation

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

Definition at line 101 of file SiStripProcessedRawDigiProducer.cc.

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

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

101  {
102 
103  //Apply Gains
104  SiStripApvGain::Range detGainRange = gainHandle->getRange(detId);
105  for(std::vector<float>::iterator it=digis.begin(); it<digis.end(); it++)
106  (*it)/= (gainHandle->getStripGain(it-digis.begin(), detGainRange));
107 
108  //Insert as DetSet
110  copy(digis.begin(), digis.end(), back_inserter(ds.data) );
111  output.insert(ds);
112 }
std::pair< ContainerIterator, ContainerIterator > Range
void insert(detset const &s)
Insert the given DetSet.
Definition: DetSetVector.h:237
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 52 of file SiStripProcessedRawDigiProducer.cc.

References edm::Event::getByToken(), cmsHarvester::index, inputTags, and edm::HandleBase::isValid().

Referenced by produce().

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

Definition at line 80 of file SiStripProcessedRawDigiProducer.cc.

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

Referenced by produce().

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

Implements edm::EDProducer.

Definition at line 29 of file SiStripProcessedRawDigiProducer.cc.

References findInput(), gainHandle, edm::EventSetup::get(), CommPDSkim_cfg::inputDigis, inputTokensDigi, inputTokensRawDigi, diffTwoXMLs::label, 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().

29  {
30 
31  std::auto_ptr< edm::DetSetVector<SiStripProcessedRawDigi> > output(new edm::DetSetVector<SiStripProcessedRawDigi>());
34 
35  es.get<SiStripGainRcd>().get(gainHandle);
36  subtractorPed->init(es);
37  subtractorCMN->init(es);
38 
39  std::string label = findInput(inputRawdigis, inputTokensRawDigi, e);
40  if( "VirginRaw" == label ) vr_process(*inputRawdigis, *output);
41  else if( "ProcessedRaw" == label ) pr_process(*inputRawdigis, *output);
42  else if( "ZeroSuppressed" == findInput(inputDigis, inputTokensDigi, e) ) zs_process(*inputDigis, *output);
43  else
44  edm::LogError("Input Not Found");
45 
46  e.put(output);
47 }
std::vector< edm::EDGetTokenT< edm::DetSetVector< SiStripRawDigi > > > inputTokensRawDigi
std::auto_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 > &)
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:116
std::vector< edm::EDGetTokenT< edm::DetSetVector< SiStripDigi > > > inputTokensDigi
std::auto_ptr< SiStripCommonModeNoiseSubtractor > subtractorCMN
const T & get() const
Definition: EventSetup.h:55
void zs_process(const edm::DetSetVector< SiStripDigi > &, edm::DetSetVector< SiStripProcessedRawDigi > &)
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 90 of file SiStripProcessedRawDigiProducer.cc.

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

Referenced by produce().

90  {
91  for(edm::DetSetVector<SiStripRawDigi>::const_iterator detset=input.begin(); detset!=input.end(); detset++) {
92  std::vector<int16_t> int_digis(detset->size());
93  subtractorPed->subtract(*detset,int_digis);
94  std::vector<float> digis(int_digis.begin(), int_digis.end());
95  subtractorCMN->subtract(detset->id, 0, digis);
96  common_process( detset->id, digis, output);
97  }
98 }
std::auto_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:363
std::auto_ptr< SiStripCommonModeNoiseSubtractor > subtractorCMN
iterator begin()
Return an iterator to the first DetSet.
Definition: DetSetVector.h:348
collection_type::const_iterator const_iterator
Definition: DetSetVector.h:106
void SiStripProcessedRawDigiProducer::zs_process ( const edm::DetSetVector< SiStripDigi > &  input,
edm::DetSetVector< SiStripProcessedRawDigi > &  output 
)
private

Definition at line 67 of file SiStripProcessedRawDigiProducer.cc.

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

Referenced by produce().

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

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().

std::auto_ptr<SiStripCommonModeNoiseSubtractor> SiStripProcessedRawDigiProducer::subtractorCMN
private

Definition at line 45 of file SiStripProcessedRawDigiProducer.h.

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

std::auto_ptr<SiStripPedestalsSubtractor> SiStripProcessedRawDigiProducer::subtractorPed
private

Definition at line 44 of file SiStripProcessedRawDigiProducer.h.

Referenced by produce(), and vr_process().