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
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 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
std::vector< ConsumesInfoconsumesInfo () const
 
 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 (std::string const &iProcessName, std::string const &iModuleLabel, bool iPrint, std::vector< char const * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) 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
 
- 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 GlobalPosition_Frontier_DevDB_cff::tag.

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);})),
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

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, 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 }
std::pair< ContainerIterator, ContainerIterator > Range
void insert(detset const &s)
Insert the given DetSet.
Definition: DetSetVector.h:235
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(), cmsHarvester::index, inputTags, edm::HandleBase::isValid(), and unpackBuffers-CaloStage2::token.

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:462
bool isValid() const
Definition: HandleBase.h:75
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 create_public_lumi_plots::transform.

Referenced by produce().

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::auto_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 
)
privatevirtual

Implements edm::EDProducer.

Definition at line 31 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().

31  {
32 
33  std::auto_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(output);
49 }
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:121
std::vector< edm::EDGetTokenT< edm::DetSetVector< SiStripDigi > > > inputTokensDigi
std::auto_ptr< SiStripCommonModeNoiseSubtractor > subtractorCMN
const T & get() const
Definition: EventSetup.h:56
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 92 of file SiStripProcessedRawDigiProducer.cc.

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

Referenced by 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::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:361
std::auto_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(), and edm::DetSetVector< T >::end().

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

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