CMS 3D CMS Logo

Public Member Functions | Private Attributes

EcalZeroSuppressionProducer Class Reference

#include <EcalZeroSuppressionProducer.h>

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

List of all members.

Public Member Functions

 EcalZeroSuppressionProducer (const edm::ParameterSet &params)
void initCalibrations (const edm::EventSetup &eventSetup)
virtual void produce (edm::Event &event, const edm::EventSetup &eventSetup)
virtual ~EcalZeroSuppressionProducer ()

Private Attributes

std::string digiProducer_
std::string EBdigiCollection_
std::string EBZSdigiCollection_
std::string EEdigiCollection_
std::string EEZSdigiCollection_
double glbBarrelThreshold_
double glbEndcapThreshold_
EcalZeroSuppressor< EBDataFrametheBarrelZeroSuppressor_
EcalZeroSuppressor< EEDataFrametheEndcapZeroSuppressor_

Detailed Description

Definition at line 23 of file EcalZeroSuppressionProducer.h.


Constructor & Destructor Documentation

EcalZeroSuppressionProducer::EcalZeroSuppressionProducer ( const edm::ParameterSet params) [explicit]

Definition at line 4 of file EcalZeroSuppressionProducer.cc.

References digiProducer_, EBdigiCollection_, EBZSdigiCollection_, EEdigiCollection_, EEZSdigiCollection_, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), glbBarrelThreshold_, and glbEndcapThreshold_.

{
  digiProducer_   = params.getParameter<std::string>("digiProducer");
  EBdigiCollection_ = params.getParameter<std::string>("EBdigiCollection");
  EEdigiCollection_ = params.getParameter<std::string>("EEdigiCollection");
  EBZSdigiCollection_ = params.getParameter<std::string>("EBZSdigiCollection");
  EEZSdigiCollection_ = params.getParameter<std::string>("EEZSdigiCollection");

  // initialize the default values for the thresholds in number of noise sigmas

  glbBarrelThreshold_ = params.getUntrackedParameter<double>("glbBarrelThreshold",0.2);
  glbEndcapThreshold_ = params.getUntrackedParameter<double>("glbEndcapThreshold",0.4);

  produces<EBDigiCollection>(EBZSdigiCollection_);
  produces<EEDigiCollection>(EEZSdigiCollection_);

}
EcalZeroSuppressionProducer::~EcalZeroSuppressionProducer ( ) [virtual]

Definition at line 23 of file EcalZeroSuppressionProducer.cc.

{ }

Member Function Documentation

void EcalZeroSuppressionProducer::initCalibrations ( const edm::EventSetup eventSetup)

Definition at line 119 of file EcalZeroSuppressionProducer.cc.

References edm::EventSetup::get(), edm::ESHandle< T >::product(), EcalZeroSuppressor< C >::setPedestals(), theBarrelZeroSuppressor_, and theEndcapZeroSuppressor_.

Referenced by produce().

                                                                                   {

  // Pedestals from event setup
                                                                                                                                                             
  edm::ESHandle<EcalPedestals> dbPed;
  eventSetup.get<EcalPedestalsRcd>().get( dbPed );
  const EcalPedestals * thePedestals=dbPed.product();

  theBarrelZeroSuppressor_.setPedestals( thePedestals );
  theEndcapZeroSuppressor_.setPedestals( thePedestals );
                                                                                                                                                             
}
void EcalZeroSuppressionProducer::produce ( edm::Event event,
const edm::EventSetup eventSetup 
) [virtual]

Produces the EDM products,

Implements edm::EDProducer.

Definition at line 27 of file EcalZeroSuppressionProducer.cc.

References EcalZeroSuppressor< C >::accept(), digiProducer_, EBdigiCollection_, EBZSdigiCollection_, EEdigiCollection_, EEZSdigiCollection_, glbBarrelThreshold_, glbEndcapThreshold_, initCalibrations(), edm::HandleBase::isValid(), edm::Handle< T >::product(), edm::DataFrameContainer::size(), MCScenario_CRAFT1_22X::sorter(), theBarrelZeroSuppressor_, and theEndcapZeroSuppressor_.

{
  
  // Get Inputs

  initCalibrations(eventSetup);
  
  edm::Handle< EBDigiCollection > pEBDigis;
  edm::Handle< EEDigiCollection > pEEDigis;
  
  const EBDigiCollection* fullBarrelDigis =0;
  const EEDigiCollection* fullEndcapDigis =0;
  
  event.getByLabel( digiProducer_, pEBDigis);
  if (pEBDigis.isValid()){ 
    fullBarrelDigis = pEBDigis.product(); // get a ptr to the produc
    edm::LogInfo("ZeroSuppressionInfo") << "total # fullBarrelDigis: " << fullBarrelDigis->size() ;
  } else {
    edm::LogError("ZeroSuppressionError") << "Error! can't get the product " << EBdigiCollection_.c_str() ;
  }
  
  event.getByLabel( digiProducer_, pEEDigis);
  if (pEEDigis.isValid()){ 
    fullEndcapDigis = pEEDigis.product(); // get a ptr to the product
    edm::LogInfo("ZeroSuppressionInfo") << "total # fullEndcapDigis: " << fullEndcapDigis->size() ;
  } else {
    edm::LogError("ZeroSuppressionError") << "Error! can't get the product " << EEdigiCollection_.c_str() ;
  }

  // collection of zero suppressed digis to put in the event
  
  std::auto_ptr< EBDigiCollection > gzsBarrelDigis(new EBDigiCollection());
  std::auto_ptr< EEDigiCollection > gzsEndcapDigis(new EEDigiCollection());

  CaloDigiCollectionSorter sorter(5);

  // Barrel zero suppression

  if (fullBarrelDigis) {

    for(EBDigiCollection::const_iterator digiItr = (*fullBarrelDigis).begin();
        digiItr != (*fullBarrelDigis).end(); ++digiItr)
      {
        
        bool isAccepted = theBarrelZeroSuppressor_.accept(*digiItr, glbBarrelThreshold_);
        if (isAccepted) {
          (*gzsBarrelDigis).push_back(digiItr->id(), digiItr->begin());
        }
        
      }
    edm::LogInfo("ZeroSuppressionInfo") << "EB Digis: " << gzsBarrelDigis->size();


    //std::vector<EBDataFrame> sortedDigisEB = sorter.sortedVector(*gzsBarrelDigis);
    //LogDebug("ZeroSuppressionDump") << "Top 10 EB digis";
    //for(int i = 0; i < std::min(10,(int) sortedDigisEB.size()); ++i) 
    //  {
    //    LogDebug("ZeroSuppressionDump") << sortedDigisEB[i];
    //  }
  }
  
  // Endcap zero suppression

  if (fullEndcapDigis) {

    for(EEDigiCollection::const_iterator digiItr = (*fullEndcapDigis).begin();
        digiItr != (*fullEndcapDigis).end(); ++digiItr)
      {
        
        bool isAccepted = theEndcapZeroSuppressor_.accept(*digiItr, glbEndcapThreshold_);
        if (isAccepted) {
          (*gzsEndcapDigis).push_back(digiItr->id(), digiItr->begin());
        }
        
      }
    edm::LogInfo("ZeroSuppressionInfo") << "EB Digis: " << gzsBarrelDigis->size();
    
    //    std::vector<EEDataFrame> sortedDigisEE = sorter.sortedVector(*gzsEndcapDigis);
    //LogDebug("ZeroSuppressionDump")  << "Top 10 EE digis";
    //for(int i = 0; i < std::min(10,(int) sortedDigisEE.size()); ++i) 
    //  {
    //    LogDebug("ZeroSuppressionDump") << sortedDigisEE[i];
    //  }
  
  }
  // Step D: Put outputs into event
  event.put(gzsBarrelDigis, EBZSdigiCollection_);
  event.put(gzsEndcapDigis, EEZSdigiCollection_);

}

Member Data Documentation

Definition at line 43 of file EcalZeroSuppressionProducer.h.

Referenced by EcalZeroSuppressionProducer(), and produce().

Definition at line 44 of file EcalZeroSuppressionProducer.h.

Referenced by EcalZeroSuppressionProducer(), and produce().

Definition at line 46 of file EcalZeroSuppressionProducer.h.

Referenced by EcalZeroSuppressionProducer(), and produce().

Definition at line 45 of file EcalZeroSuppressionProducer.h.

Referenced by EcalZeroSuppressionProducer(), and produce().

Definition at line 47 of file EcalZeroSuppressionProducer.h.

Referenced by EcalZeroSuppressionProducer(), and produce().

Definition at line 40 of file EcalZeroSuppressionProducer.h.

Referenced by EcalZeroSuppressionProducer(), and produce().

Definition at line 41 of file EcalZeroSuppressionProducer.h.

Referenced by EcalZeroSuppressionProducer(), and produce().

Definition at line 49 of file EcalZeroSuppressionProducer.h.

Referenced by initCalibrations(), and produce().

Definition at line 50 of file EcalZeroSuppressionProducer.h.

Referenced by initCalibrations(), and produce().