CMS 3D CMS Logo

Public Member Functions | Private Attributes

DTDigiToRawModule Class Reference

#include <DTDigiToRawModule.h>

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

List of all members.

Public Member Functions

 DTDigiToRawModule (const edm::ParameterSet &pset)
 Constructor.
virtual void produce (edm::Event &, const edm::EventSetup &)
virtual ~DTDigiToRawModule ()
 Destructor.

Private Attributes

int dduID
bool debug
bool digibyType
std::string digicoll
int maxFEDid_
int minFEDid_
DTDigiToRawpacker
bool useStandardFEDid_

Detailed Description

Definition at line 11 of file DTDigiToRawModule.h.


Constructor & Destructor Documentation

DTDigiToRawModule::DTDigiToRawModule ( const edm::ParameterSet pset)

Constructor.

Definition at line 21 of file DTDigiToRawModule.cc.

References gather_cfg::cout, debug, and edm::ParameterSet::getUntrackedParameter().

                                                              {
  produces<FEDRawDataCollection>();
  
  dduID = ps.getUntrackedParameter<int>("dduID", 770);
  debug = ps.getUntrackedParameter<bool>("debugMode", false);
  digicoll = ps.getUntrackedParameter<string>("digiColl", "dtunpacker");
  digibyType = ps.getUntrackedParameter<bool>("digibytype", true);
  
  useStandardFEDid_ = ps.getUntrackedParameter<bool>("useStandardFEDid", true);
  minFEDid_ = ps.getUntrackedParameter<int>("minFEDid", 770);
  maxFEDid_ = ps.getUntrackedParameter<int>("maxFEDid", 775);
  
  packer = new DTDigiToRaw(ps);
  if (debug) cout << "[DTDigiToRawModule]: constructor" << endl;
}
DTDigiToRawModule::~DTDigiToRawModule ( ) [virtual]

Destructor.

Definition at line 37 of file DTDigiToRawModule.cc.

References gather_cfg::cout, and debug.

                                     {
  delete packer;
  if (debug) cout << "[DTDigiToRawModule]: destructor" << endl;
}

Member Function Documentation

void DTDigiToRawModule::produce ( edm::Event e,
const edm::EventSetup iSetup 
) [virtual]

Implements edm::EDProducer.

Definition at line 43 of file DTDigiToRawModule.cc.

References evf::compute_crc(), FEDRawData::data(), edm::EventID::event(), edm::EventSetup::get(), edm::Event::getByLabel(), edm::Event::getByType(), edm::EventBase::id(), errorMatrix2Lands_multiChannel::id, Association::map, FEDNumbering::MAXDTFEDID, FEDNumbering::MINDTFEDID, edm::Event::put(), FEDTrailer::set(), FEDHeader::set(), and FEDRawData::size().

                                                                   {

  auto_ptr<FEDRawDataCollection> fed_buffers(new FEDRawDataCollection);
  
  // Take digis from the event
  Handle<DTDigiCollection> digis;
  if (digibyType) {
    e.getByType(digis);
  }
  else {
    e.getByLabel(digicoll, digis);
  }
  
  // Load DTMap
  edm::ESHandle<DTReadOutMapping> map;
  iSetup.get<DTReadOutMappingRcd>().get( map );
  
  // Create the packed data
  int FEDIDmin = 0, FEDIDMax = 0;
  if (useStandardFEDid_){
    FEDIDmin = FEDNumbering::MINDTFEDID;
    FEDIDMax = FEDNumbering::MAXDTFEDID;
  }
  else {
    FEDIDmin = minFEDid_;
    FEDIDMax = maxFEDid_;
  }
  
  for (int id=FEDIDmin; id<=FEDIDMax; ++id){
    
    packer->SetdduID(id);
    FEDRawData* rawData = packer->createFedBuffers(*digis, map);

    FEDRawData& fedRawData = fed_buffers->FEDData(id);
    fedRawData = *rawData;
    delete rawData;

    FEDHeader dtFEDHeader(fedRawData.data());
    dtFEDHeader.set(fedRawData.data(), 0, e.id().event(), 0, id);
    
    FEDTrailer dtFEDTrailer(fedRawData.data()+(fedRawData.size()-8));
    dtFEDTrailer.set(fedRawData.data()+(fedRawData.size()-8), fedRawData.size()/8, evf::compute_crc(fedRawData.data(),fedRawData.size()), 0, 0);

  }
  // Put the raw data to the event
  e.put(fed_buffers);
  
}

Member Data Documentation

int DTDigiToRawModule::dduID [private]

Definition at line 25 of file DTDigiToRawModule.h.

bool DTDigiToRawModule::debug [private]

Definition at line 26 of file DTDigiToRawModule.h.

Definition at line 27 of file DTDigiToRawModule.h.

std::string DTDigiToRawModule::digicoll [private]

Definition at line 28 of file DTDigiToRawModule.h.

Definition at line 32 of file DTDigiToRawModule.h.

Definition at line 31 of file DTDigiToRawModule.h.

Definition at line 23 of file DTDigiToRawModule.h.

Definition at line 30 of file DTDigiToRawModule.h.