CMS 3D CMS Logo

Public Member Functions | Private Attributes

ESZeroSuppressionProducer Class Reference

#include <ESZeroSuppressionProducer.h>

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

List of all members.

Public Member Functions

 ESZeroSuppressionProducer (const edm::ParameterSet &ps)
virtual void produce (edm::Event &event, const edm::EventSetup &eventSetup)
virtual ~ESZeroSuppressionProducer ()

Private Attributes

std::string digiProducer_
std::string ESdigiCollection_
edm::ESHandle< ESPedestalsespeds_
edm::ESHandle< ESThresholdsesthresholds_
std::string ESZSdigiCollection_

Detailed Description

Definition at line 20 of file ESZeroSuppressionProducer.h.


Constructor & Destructor Documentation

ESZeroSuppressionProducer::ESZeroSuppressionProducer ( const edm::ParameterSet ps) [explicit]

Definition at line 5 of file ESZeroSuppressionProducer.cc.

References digiProducer_, ESdigiCollection_, ESZSdigiCollection_, and edm::ParameterSet::getParameter().

                                                                              {

  digiProducer_   = ps.getParameter<std::string>("digiProducer");
  ESdigiCollection_ = ps.getParameter<std::string>("ESdigiCollection");
  ESZSdigiCollection_ = ps.getParameter<std::string>("ESZSdigiCollection");
 
  produces<ESDigiCollection>(ESZSdigiCollection_);
}
ESZeroSuppressionProducer::~ESZeroSuppressionProducer ( ) [virtual]

Definition at line 14 of file ESZeroSuppressionProducer.cc.

                                                      { 

}

Member Function Documentation

void ESZeroSuppressionProducer::produce ( edm::Event event,
const edm::EventSetup eventSetup 
) [virtual]

Produces the EDM products,

Implements edm::EDProducer.

Definition at line 18 of file ESZeroSuppressionProducer.cc.

References ESSample::adc(), digiProducer_, ESdigiCollection_, espeds_, esthresholds_, ESZSdigiCollection_, ESCondObjectContainer< T >::find(), edm::EventSetup::get(), ESThresholds::getTS2Threshold(), i, ESDataFrame::id(), edm::HandleBase::isValid(), edm::ESHandle< T >::product(), and ESDataFrame::sample().

                                                                                        {

  eventSetup.get<ESThresholdsRcd>().get(esthresholds_);
  const ESThresholds *thresholds = esthresholds_.product();

  eventSetup.get<ESPedestalsRcd>().get(espeds_);
  const ESPedestals *pedestals = espeds_.product();

  float ts2Threshold = thresholds->getTS2Threshold();

  edm::Handle<ESDigiCollection> ESDigis;

  bool fullESDigis = true;
  event.getByLabel(digiProducer_, ESDigis);
  if (!ESDigis.isValid()) {
    edm::LogError("ZeroSuppressionError") << "Error! can't get the product " << ESdigiCollection_.c_str() ;
    fullESDigis = false;
  }  

  std::auto_ptr<ESDigiCollection> ESZSDigis(new ESDigiCollection());
  
  if (fullESDigis) {
    ESDigiCollection::const_iterator i;
    for (i=ESDigis->begin(); i!=ESDigis->end(); ++i) {            

      ESDataFrame dataframe = (*i);

      ESPedestals::const_iterator it_ped = pedestals->find(dataframe.id());

      if (dataframe.sample(1).adc() > (ts2Threshold+it_ped->getMean())) {
        //std::cout<<dataframe.sample(1).adc()<<" "<<ts2Threshold+it_ped->getMean()<<std::endl;
        (*ESZSDigis).push_back(*i);
      }
    }
  }     
  
  event.put(ESZSDigis, ESZSdigiCollection_);  
}

Member Data Documentation

Definition at line 33 of file ESZeroSuppressionProducer.h.

Referenced by ESZeroSuppressionProducer(), and produce().

Definition at line 34 of file ESZeroSuppressionProducer.h.

Referenced by ESZeroSuppressionProducer(), and produce().

Definition at line 38 of file ESZeroSuppressionProducer.h.

Referenced by produce().

Definition at line 37 of file ESZeroSuppressionProducer.h.

Referenced by produce().

Definition at line 35 of file ESZeroSuppressionProducer.h.

Referenced by ESZeroSuppressionProducer(), and produce().