CMS 3D CMS Logo

Public Member Functions | Private Types | Private Attributes

RawDataCollectorByLabel Class Reference

#include <RawDataCollectorByLabel.h>

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

List of all members.

Public Member Functions

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

Private Types

typedef std::vector
< edm::InputTag >
::const_iterator 
tag_iterator_t

Private Attributes

std::vector< edm::InputTaginputTags_
int verbose_

Detailed Description

Definition at line 15 of file RawDataCollectorByLabel.h.


Member Typedef Documentation

typedef std::vector<edm::InputTag>::const_iterator RawDataCollectorByLabel::tag_iterator_t [private]

Definition at line 28 of file RawDataCollectorByLabel.h.


Constructor & Destructor Documentation

RawDataCollectorByLabel::RawDataCollectorByLabel ( const edm::ParameterSet pset)

Constructor.

Definition at line 23 of file RawDataCollectorByLabel.cc.

References edm::ParameterSet::getParameter(), and edm::ParameterSet::getUntrackedParameter().

                                                                            {

  inputTags_ = pset.getParameter<std::vector<InputTag> >("RawCollectionList");
  verbose_ = pset.getUntrackedParameter<int>("verbose",0);

  produces<FEDRawDataCollection>();
}
RawDataCollectorByLabel::~RawDataCollectorByLabel ( ) [virtual]

Destructor.

Definition at line 31 of file RawDataCollectorByLabel.cc.

                                                 {

}

Member Function Documentation

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

Get Data from all FEDs

Implements edm::EDProducer.

Definition at line 36 of file RawDataCollectorByLabel.cc.

References gather_cfg::cout, FEDRawData::data(), AlCaHLTBitMon_QueryRunRegistry::data, FEDRawDataCollection::FEDData(), edm::Event::getByLabel(), i, LaserDQM_cfg::input, j, gen::k, FEDNumbering::MAXFEDID, edm::Event::put(), FEDRawData::resize(), findQualityFiles::size, and FEDRawData::size().

                                                                   {

 std::vector< Handle<FEDRawDataCollection> > rawData;
 for(tag_iterator_t inputTag = inputTags_.begin(); inputTag != inputTags_.end(); ++inputTag ) {
   Handle<FEDRawDataCollection> input;
   if (e.getByLabel(*inputTag,input)){
     rawData.push_back(input);
   }
   //else{     //skipping the inputtag requested. but this is a normal operation to bare data & MC. silent warning   }
 }

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

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

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

   if ( verbose_ > 0 ) {
     std::cout << "\nRAW collection #" << i+1 << std::endl;
     std::cout << "branch name = " << rawData[i].provenance()->branchName() << std::endl;
     std::cout << "process index = " << rawData[i].provenance()->productID().processIndex() << std::endl;
   }

   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
       if(verbose_ > 1) std::cout << "Copying data from FED #" << j << std::endl;
       FEDRawData & fedDataProd = producedData->FEDData(j);
       if ( fedDataProd.size() != 0 ) {
         if(verbose_ > 1) {
           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 30 of file RawDataCollectorByLabel.h.

Definition at line 31 of file RawDataCollectorByLabel.h.