CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

SiStripProcessedRawDigiProducer Class Reference

#include <SiStripProcessedRawDigiProducer.h>

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

List of all members.

Public Member Functions

 SiStripProcessedRawDigiProducer (edm::ParameterSet const &)

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

Detailed Description

Definition at line 22 of file SiStripProcessedRawDigiProducer.h.


Constructor & Destructor Documentation

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

Definition at line 17 of file SiStripProcessedRawDigiProducer.cc.

  : inputTags(conf.getParameter<std::vector<edm::InputTag> >("DigiProducersList")),
    subtractorPed(SiStripRawProcessingFactory::create_SubtractorPed(conf)),
    subtractorCMN(SiStripRawProcessingFactory::create_SubtractorCMN(conf)){

  produces< edm::DetSetVector<SiStripProcessedRawDigi> >("");
}

Member Function Documentation

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

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

                                                                                                                 {

  //Apply Gains
  SiStripApvGain::Range detGainRange =  gainHandle->getRange(detId);   
  for(std::vector<float>::iterator it=digis.begin(); it<digis.end(); it++) 
    (*it)/= (gainHandle->getStripGain(it-digis.begin(), detGainRange));

  //Insert as DetSet
  edm::DetSet<SiStripProcessedRawDigi> ds(detId);
  copy(digis.begin(), digis.end(), back_inserter(ds.data) ); 
  output.insert(ds);
}
template<class T >
std::string SiStripProcessedRawDigiProducer::findInput ( edm::Handle< T > &  handle,
const edm::Event e 
) [inline, private]

Definition at line 49 of file SiStripProcessedRawDigiProducer.cc.

References edm::Event::getByLabel(), inputTags, and edm::HandleBase::isValid().

Referenced by produce().

                                                    {

  for( std::vector<edm::InputTag>::const_iterator 
         inputTag = inputTags.begin(); inputTag != inputTags.end(); ++inputTag ) {
    
    e.getByLabel(*inputTag, handle);
    if( handle.isValid() && !handle->empty() ) {
      edm::LogInfo("Input") << *inputTag;
      return inputTag->instance();
    }
  }
  return "Input Not Found";
}
void SiStripProcessedRawDigiProducer::pr_process ( const edm::DetSetVector< SiStripRawDigi > &  input,
edm::DetSetVector< SiStripProcessedRawDigi > &  output 
) [private]

Definition at line 78 of file SiStripProcessedRawDigiProducer.cc.

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

Referenced by produce().

                                                                                                            {
  for(edm::DetSetVector<SiStripRawDigi>::const_iterator detset=input.begin(); detset!=input.end(); detset++) {
    std::vector<float> digis;
    transform(detset->begin(), detset->end(), back_inserter(digis), boost::bind(&SiStripRawDigi::adc , _1));
    subtractorCMN->subtract(detset->id, 0, digis);
    common_process( detset->id, digis, output);
  }
}
void SiStripProcessedRawDigiProducer::produce ( edm::Event e,
const edm::EventSetup es 
) [private, virtual]

Implements edm::EDProducer.

Definition at line 26 of file SiStripProcessedRawDigiProducer.cc.

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

                                              {

  std::auto_ptr< edm::DetSetVector<SiStripProcessedRawDigi> > output(new edm::DetSetVector<SiStripProcessedRawDigi>());
  edm::Handle< edm::DetSetVector<SiStripDigi> > inputDigis; 
  edm::Handle< edm::DetSetVector<SiStripRawDigi> > inputRawdigis; 

  es.get<SiStripGainRcd>().get(gainHandle);
  subtractorPed->init(es);
  subtractorCMN->init(es);
  
  std::string label = findInput(inputRawdigis, e);
  if(      "VirginRaw"  == label )  vr_process(*inputRawdigis, *output); 
  else if( "ProcessedRaw" == label )  pr_process(*inputRawdigis, *output); 
  else if( "ZeroSuppressed" == findInput(inputDigis,e) ) zs_process(*inputDigis, *output);
  else 
    edm::LogError("Input Not Found");

  e.put(output);
}
void SiStripProcessedRawDigiProducer::vr_process ( const edm::DetSetVector< SiStripRawDigi > &  input,
edm::DetSetVector< SiStripProcessedRawDigi > &  output 
) [private]

Definition at line 88 of file SiStripProcessedRawDigiProducer.cc.

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

Referenced by produce().

                                                                                                            {
  for(edm::DetSetVector<SiStripRawDigi>::const_iterator detset=input.begin(); detset!=input.end(); detset++) {
    std::vector<int16_t> int_digis(detset->size());
    subtractorPed->subtract(*detset,int_digis);
    std::vector<float> digis(int_digis.begin(), int_digis.end());
    subtractorCMN->subtract(detset->id, 0, digis);
    common_process( detset->id, digis, output);
  }
}
void SiStripProcessedRawDigiProducer::zs_process ( const edm::DetSetVector< SiStripDigi > &  input,
edm::DetSetVector< SiStripProcessedRawDigi > &  output 
) [private]

Definition at line 65 of file SiStripProcessedRawDigiProducer.cc.

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

Referenced by produce().

                                                                                                         {
  std::vector<float> digis;
  for(edm::DetSetVector<SiStripDigi>::const_iterator detset = input.begin(); detset != input.end(); detset++ )  {
    digis.clear();
    for(edm::DetSet<SiStripDigi>::const_iterator digi = detset->begin();  digi != detset->end();  digi++) {
      digis.resize( digi->strip(), 0);
      digis.push_back( digi->adc() );
    }
    common_process( detset->id, digis, output);
  }
}

Member Data Documentation

Definition at line 40 of file SiStripProcessedRawDigiProducer.h.

Referenced by common_process(), and produce().

Definition at line 39 of file SiStripProcessedRawDigiProducer.h.

Referenced by findInput().

Definition at line 43 of file SiStripProcessedRawDigiProducer.h.

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

Definition at line 42 of file SiStripProcessedRawDigiProducer.h.

Referenced by produce(), and vr_process().