CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

EcalFEDWithCRCErrorProducer Class Reference

#include <filter/EcalFEDWithCRCErrorProducer/src/EcalFEDWithCRCErrorProducer.cc>

Inheritance diagram for EcalFEDWithCRCErrorProducer:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

List of all members.

Public Member Functions

 EcalFEDWithCRCErrorProducer (const edm::ParameterSet &)
 ~EcalFEDWithCRCErrorProducer ()

Private Member Functions

virtual void produce (edm::Event &, const edm::EventSetup &)

Private Attributes

edm::InputTag DataLabel_
std::vector< int > fedUnpackList_
bool writeAllEcalFEDs_

Detailed Description

Description: <one line="" class="" summary>="">

Implementation: <Notes on="" implementation>="">

Definition at line 46 of file EcalFEDWithCRCErrorProducer.cc.


Constructor & Destructor Documentation

EcalFEDWithCRCErrorProducer::EcalFEDWithCRCErrorProducer ( const edm::ParameterSet iConfig) [explicit]

Definition at line 67 of file EcalFEDWithCRCErrorProducer.cc.

References DataLabel_, fedUnpackList_, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), i, FEDNumbering::MAXECALFEDID, FEDNumbering::MINECALFEDID, and writeAllEcalFEDs_.

{
  //now do what ever initialization is needed

  DataLabel_     = iConfig.getParameter<edm::InputTag>("InputLabel");
  fedUnpackList_ = iConfig.getUntrackedParameter< std::vector<int> >("FEDs", std::vector<int>());
  writeAllEcalFEDs_ = iConfig.getUntrackedParameter<bool >("writeAllEcalFED", false);
  if (fedUnpackList_.empty()) 
    for (int i=FEDNumbering::MINECALFEDID; i<=FEDNumbering::MAXECALFEDID; i++)
      fedUnpackList_.push_back(i);

  produces< FEDRawDataCollection >();
}
EcalFEDWithCRCErrorProducer::~EcalFEDWithCRCErrorProducer ( )

Definition at line 82 of file EcalFEDWithCRCErrorProducer.cc.

{
 
  // do anything here that needs to be done at desctruction time
  // (e.g. close files, deallocate resources etc.)

}

Member Function Documentation

void EcalFEDWithCRCErrorProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
) [private, virtual]

Implements edm::EDProducer.

Definition at line 97 of file EcalFEDWithCRCErrorProducer.cc.

References data, FEDRawData::data(), DataLabel_, fedUnpackList_, edm::Event::getByLabel(), i, gen::k, edm::Event::put(), lumiPlot::rawdata, FEDRawData::resize(), FEDRawData::size(), and writeAllEcalFEDs_.

{
  using namespace edm;

  edm::Handle<FEDRawDataCollection> rawdata;  
  iEvent.getByLabel(DataLabel_,rawdata);

  std::auto_ptr<FEDRawDataCollection> producedData(new FEDRawDataCollection);
  // get fed raw data and SM id

  // loop over FEDS
  for (std::vector<int>::const_iterator i=fedUnpackList_.begin(); i!=fedUnpackList_.end(); i++) 
    {

      // get fed raw data and SM id
      const FEDRawData & fedData = rawdata->FEDData(*i);
      int length = fedData.size()/sizeof(uint64_t);

      //    LogDebug("EcalRawToDigi") << "raw data length: " << length ;
      //if data size is not null interpret data
      if ( length >= 1 )
        {
            uint64_t * pData = (uint64_t *)(fedData.data());
            //When crc error is found return true
            uint64_t * fedTrailer = pData + (length - 1);
            bool crcError = (*fedTrailer >> 2 ) & 0x1; 
            // this fed has data -- lets copy it
            if (writeAllEcalFEDs_ || crcError)
              {
                FEDRawData & fedDataProd = producedData->FEDData(*i);
                if ( fedDataProd.size() != 0 ) 
                  {
                    //                std::cout << " More than one FEDRawDataCollection with data in FED ";
                    //                std::cout << j << " Skipping the 2nd\n";
                    continue;
                  }
                fedDataProd.resize(fedData.size());
                unsigned char *dataProd=fedDataProd.data();
                const unsigned char *data=fedData.data();
                for ( unsigned int k=0; k<fedData.size(); ++k ) 
                  {
                    dataProd[k]=data[k];
                  }
              }
        }
    }
  
  iEvent.put(producedData);  
}

Member Data Documentation

Definition at line 57 of file EcalFEDWithCRCErrorProducer.cc.

Referenced by EcalFEDWithCRCErrorProducer(), and produce().

std::vector<int> EcalFEDWithCRCErrorProducer::fedUnpackList_ [private]

Definition at line 58 of file EcalFEDWithCRCErrorProducer.cc.

Referenced by EcalFEDWithCRCErrorProducer(), and produce().

Definition at line 59 of file EcalFEDWithCRCErrorProducer.cc.

Referenced by EcalFEDWithCRCErrorProducer(), and produce().