CMS 3D CMS Logo

Public Member Functions | Private Attributes

RawDataCollectorModule Class Reference

#include <RawDataCollectorModule.h>

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

List of all members.

Public Member Functions

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

Private Attributes

bool useCurrentProcessOnly_

Detailed Description

Definition at line 12 of file RawDataCollectorModule.h.


Constructor & Destructor Documentation

RawDataCollectorModule::RawDataCollectorModule ( const edm::ParameterSet pset)

Constructor.

Definition at line 23 of file RawDataCollectorModule.cc.

References edm::ParameterSet::getParameter().

                                                                          {

  useCurrentProcessOnly_ = pset.getParameter<bool>("currentProcessOnly") ; 
    
  produces<FEDRawDataCollection>();
}
RawDataCollectorModule::~RawDataCollectorModule ( ) [virtual]

Destructor.

Definition at line 30 of file RawDataCollectorModule.cc.

                                               {

}

Member Function Documentation

void RawDataCollectorModule::produce ( edm::Event e,
const edm::EventSetup c 
) [virtual]

Get Data from all FEDs

Implements edm::EDProducer.

Definition at line 35 of file RawDataCollectorModule.cc.

References gather_cfg::cout, FEDRawData::data(), data, FEDRawDataCollection::FEDData(), edm::Event::getManyByType(), i, j, gen::k, FEDNumbering::MAXFEDID, edm::Event::processHistory(), edm::Event::put(), edm::ProcessHistory::rbegin(), FEDRawData::resize(), findQualityFiles::size, and FEDRawData::size().

                                                                  {

 std::vector< Handle<FEDRawDataCollection> > rawData;
 e.getManyByType(rawData);

 std::auto_ptr<FEDRawDataCollection> producedData(new FEDRawDataCollection);

 for (unsigned int i=0; i< rawData.size(); ++i ) { 

   const FEDRawDataCollection *rdc=rawData[i].product();

   if ( useCurrentProcessOnly_ &&
        ( rawData[i].provenance()->processName() != e.processHistory().rbegin()->processName() ) )
       continue ; // skip all raw collections not produced by the current process

   for ( int j=0; j< FEDNumbering::MAXFEDID; ++j ) {
     const FEDRawData & fedData = rdc->FEDData(j);
     size_t size=fedData.size();

     if ( size > 0 ) {
       // this fed has data -- lets copy it
       FEDRawData & fedDataProd = producedData->FEDData(j);
       if ( fedDataProd.size() != 0 ) {
         std::cout << " More than one FEDRawDataCollection with data in FED ";
         std::cout << j << " Skipping the 2nd\n";
         continue;
       } 
       fedDataProd.resize(size);
       unsigned char *dataProd=fedDataProd.data();
       const unsigned char *data=fedData.data();
       for ( unsigned int k=0; k<size; ++k ) {
         dataProd[k]=data[k];
       }
     }
   }
 }

 // Insert the new product in the event  
 e.put(producedData);  

}

Member Data Documentation

Definition at line 25 of file RawDataCollectorModule.h.