CMS 3D CMS Logo

Public Member Functions | Private Attributes

ESRawToDigi Class Reference

#include <ESRawToDigi.h>

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

List of all members.

Public Member Functions

 ESRawToDigi (const edm::ParameterSet &ps)
void produce (edm::Event &e, const edm::EventSetup &es)
virtual ~ESRawToDigi ()

Private Attributes

bool debug_
std::string ESdigiCollection_
ESUnpackerESUnpacker_
edm::InputTag fedsListLabel_
bool regional_
edm::InputTag sourceTag_

Detailed Description

Definition at line 14 of file ESRawToDigi.h.


Constructor & Destructor Documentation

ESRawToDigi::ESRawToDigi ( const edm::ParameterSet ps)

Definition at line 13 of file ESRawToDigi.cc.

References debug_, ESdigiCollection_, ESUnpacker_, fedsListLabel_, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), regional_, and sourceTag_.

{
  sourceTag_        = ps.getParameter<edm::InputTag>("sourceTag");
  ESdigiCollection_ = ps.getParameter<std::string>("ESdigiCollection");
  regional_         = ps.getUntrackedParameter<bool>("DoRegional",false);
  fedsListLabel_    = ps.getUntrackedParameter<edm::InputTag>("ESFedsListLabel", edm::InputTag(":esfedslist"));
  debug_            = ps.getUntrackedParameter<bool>("debugMode", false);

  ESUnpacker_ = new ESUnpacker(ps);

  produces<ESRawDataCollection>();
  produces<ESLocalRawDataCollection>();
  produces<ESDigiCollection>();
}
ESRawToDigi::~ESRawToDigi ( ) [virtual]

Definition at line 28 of file ESRawToDigi.cc.

References ESUnpacker_.

                         {

  delete ESUnpacker_;

}

Member Function Documentation

void ESRawToDigi::produce ( edm::Event e,
const edm::EventSetup es 
) [virtual]

Implements edm::EDProducer.

Definition at line 34 of file ESRawToDigi.cc.

References gather_cfg::cout, debug_, ESdigiCollection_, ESUnpacker_, fedsListLabel_, edm::Event::getByLabel(), i, ESUnpacker::interpretRawData(), edm::HandleBase::isValid(), LogDebug, FEDNumbering::MAXPreShowerFEDID, FEDNumbering::MINPreShowerFEDID, edm::Event::put(), regional_, FEDRawData::size(), and sourceTag_.

                                                              {

  // Input
  edm::Handle<FEDRawDataCollection> rawdata;
  e.getByLabel(sourceTag_, rawdata);
  if (!rawdata.isValid()) {
    LogDebug("") << "ESRawToDigi : Error! can't get rawdata!" << std::endl;
  }
  
  std::vector<int> esFeds_to_unpack;
  if (regional_) {
    edm::Handle<ESListOfFEDS> fedslist;
    e.getByLabel(fedsListLabel_, fedslist);
    esFeds_to_unpack = fedslist->GetList();
  }

  // Output
  std::auto_ptr<ESRawDataCollection> productDCC(new ESRawDataCollection);
  std::auto_ptr<ESLocalRawDataCollection> productKCHIP(new ESLocalRawDataCollection);
  std::auto_ptr<ESDigiCollection> productDigis(new ESDigiCollection);  
  
  ESDigiCollection digis;

  if (regional_) {
    for (unsigned int i=0; i<esFeds_to_unpack.size(); ++i) {
      
      const FEDRawData& fedRawData = rawdata->FEDData(esFeds_to_unpack[i]);
      ESUnpacker_->interpretRawData(esFeds_to_unpack[i], fedRawData, *productDCC, *productKCHIP, *productDigis);
      
      if (debug_) std::cout<<"FED : "<<esFeds_to_unpack[i]<<" Data size : "<<fedRawData.size()<<" (Bytes)"<<std::endl;
    }   
  } else {
    for (int fedId=FEDNumbering::MINPreShowerFEDID; fedId<=FEDNumbering::MAXPreShowerFEDID; ++fedId) {
      
      const FEDRawData& fedRawData = rawdata->FEDData(fedId);
      ESUnpacker_->interpretRawData(fedId, fedRawData, *productDCC, *productKCHIP, *productDigis);
      
      if (debug_) std::cout<<"FED : "<<fedId<<" Data size : "<<fedRawData.size()<<" (Bytes)"<<std::endl;
    }   
  }

  e.put(productDCC);
  e.put(productKCHIP);
  e.put(productDigis, ESdigiCollection_);
}

Member Data Documentation

bool ESRawToDigi::debug_ [private]

Definition at line 30 of file ESRawToDigi.h.

Referenced by ESRawToDigi(), and produce().

std::string ESRawToDigi::ESdigiCollection_ [private]

Definition at line 27 of file ESRawToDigi.h.

Referenced by ESRawToDigi(), and produce().

Definition at line 32 of file ESRawToDigi.h.

Referenced by ESRawToDigi(), produce(), and ~ESRawToDigi().

Definition at line 26 of file ESRawToDigi.h.

Referenced by ESRawToDigi(), and produce().

bool ESRawToDigi::regional_ [private]

Definition at line 28 of file ESRawToDigi.h.

Referenced by ESRawToDigi(), and produce().

Definition at line 25 of file ESRawToDigi.h.

Referenced by ESRawToDigi(), and produce().