CMS 3D CMS Logo

Classes | Public Member Functions | Private Member Functions | Private Attributes

ShallowDigisProducer Class Reference

#include <ShallowDigisProducer.h>

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

List of all members.

Classes

struct  products

Public Member Functions

 ShallowDigisProducer (const edm::ParameterSet &)

Private Member Functions

template<class T >
bool findInput (edm::Handle< T > &, const edm::Event &)
void insert (products &, edm::Event &)
void produce (edm::Event &, const edm::EventSetup &)
template<class T >
void recordDigis (const T &, products &)

Private Attributes

std::vector< edm::InputTaginputTags
edm::ESHandle< SiStripNoisesnoiseHandle

Detailed Description

Definition at line 10 of file ShallowDigisProducer.h.


Constructor & Destructor Documentation

ShallowDigisProducer::ShallowDigisProducer ( const edm::ParameterSet conf) [explicit]

Definition at line 14 of file ShallowDigisProducer.cc.

  : inputTags(conf.getParameter<std::vector<edm::InputTag> >("DigiProducersList")) 
{
  produces<std::vector<unsigned> >("id");
  produces<std::vector<unsigned> >("subdet");
  produces<std::vector<unsigned> >("strip");
  produces<std::vector<unsigned> >("adc");
  produces<std::vector<float> >("noise");
}  

Member Function Documentation

template<class T >
bool ShallowDigisProducer::findInput ( edm::Handle< T > &  handle,
const edm::Event e 
) [inline, private]

Definition at line 64 of file ShallowDigisProducer.cc.

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

Referenced by produce().

                                                   {
  BOOST_FOREACH( const edm::InputTag inputTag, inputTags) {
    e.getByLabel(inputTag, handle);
    if( handle.isValid() && !handle->empty() ) {
      LogDebug("Input") << inputTag;
      return true;
    }
  }
  return false;
}
void ShallowDigisProducer::insert ( products p,
edm::Event e 
) [private]

Definition at line 25 of file ShallowDigisProducer.cc.

References ShallowDigisProducer::products::adc, ShallowDigisProducer::products::id, ShallowDigisProducer::products::noise, edm::Event::put(), ShallowDigisProducer::products::strip, and ShallowDigisProducer::products::subdet.

Referenced by produce().

                                 {
  e.put(p.id,     "id");
  e.put(p.subdet, "subdet");
  e.put(p.strip,  "strip");
  e.put(p.adc,    "adc");
  e.put(p.noise,  "noise");
}
void ShallowDigisProducer::produce ( edm::Event e,
const edm::EventSetup es 
) [private, virtual]

Implements edm::EDProducer.

Definition at line 50 of file ShallowDigisProducer.cc.

References findInput(), edm::EventSetup::get(), insert(), noiseHandle, AlCaHLTBitMon_ParallelJobs::p, and recordDigis().

                                              {  
  products p;
  edm::Handle< edm::DetSetVector<SiStripDigi> >     inputOld;  
  edm::Handle< edmNew::DetSetVector<SiStripDigi> >  inputNew;  
  es.get<SiStripNoisesRcd>().get(noiseHandle);
  if( findInput(inputOld, e) ) recordDigis(*inputOld, p); else 
    if( findInput(inputNew, e) ) recordDigis(*inputNew, p); else
      edm::LogWarning("Input Not Found");
  insert(p,e);
}
template<class T >
void ShallowDigisProducer::recordDigis ( const T digiCollection,
products p 
) [inline, private]

Definition at line 36 of file ShallowDigisProducer.cc.

References SiStripDigi::adc(), ShallowDigisProducer::products::adc, ShallowDigisProducer::products::id, ShallowDigisProducer::products::noise, noiseHandle, ShallowDigisProducer::products::strip, SiStripDigi::strip(), and ShallowDigisProducer::products::subdet.

Referenced by produce().

                                                  {
  BOOST_FOREACH(const typename T::value_type set, digiCollection) {
    SiStripNoises::Range detNoiseRange = noiseHandle->getRange(set.detId());
    BOOST_FOREACH(const SiStripDigi digi, set) {
      p.id->push_back(set.detId());
      p.subdet->push_back((set.detId()>>25)&0x7);
      p.strip->push_back(digi.strip());
      p.adc->push_back(digi.adc());
      p.noise->push_back(noiseHandle->getNoise( digi.strip(), detNoiseRange));
    }
  }
}

Member Data Documentation

Definition at line 30 of file ShallowDigisProducer.h.

Referenced by findInput().

Definition at line 31 of file ShallowDigisProducer.h.

Referenced by produce(), and recordDigis().