CMS 3D CMS Logo

Public Member Functions | Private Attributes

RawDataFEDSelector Class Reference

#include <RawDataFEDSelector.h>

List of all members.

Public Member Functions

 RawDataFEDSelector ()
 Constructor.
std::auto_ptr
< FEDRawDataCollection
select (const edm::Handle< FEDRawDataCollection > &rawData, const std::vector< int > &list)
std::auto_ptr
< FEDRawDataCollection
select (const edm::Handle< FEDRawDataCollection > &rawData)
std::auto_ptr
< FEDRawDataCollection
select (const edm::Handle< FEDRawDataCollection > &rawData, const std::pair< int, int > &range)
void setRange (const std::pair< int, int > &range)
void setRange (const std::vector< int > &list)
virtual ~RawDataFEDSelector ()
 Destructor.

Private Attributes

std::vector< int > fedList
std::pair< int, int > fedRange

Detailed Description

Author:
M. Zanetti CERN

Definition at line 18 of file RawDataFEDSelector.h.


Constructor & Destructor Documentation

RawDataFEDSelector::RawDataFEDSelector ( ) [inline]

Constructor.

Definition at line 23 of file RawDataFEDSelector.h.

{};
virtual RawDataFEDSelector::~RawDataFEDSelector ( ) [inline, virtual]

Destructor.

Definition at line 26 of file RawDataFEDSelector.h.

{};

Member Function Documentation

auto_ptr< FEDRawDataCollection > RawDataFEDSelector::select ( const edm::Handle< FEDRawDataCollection > &  rawData)

Definition at line 17 of file RawDataFEDSelector.cc.

References FEDRawData::data(), i, FEDNumbering::lastFEDId(), FEDRawData::resize(), findQualityFiles::size, and FEDRawData::size().

Referenced by RawDataSelector::produce().

                                                                                                      {

  auto_ptr<FEDRawDataCollection> selectedRawData(new FEDRawDataCollection);

  // if vector of FED indexes is defined, loop over it
  if (fedList.size()) {
    vector<int>::const_iterator it = fedList.begin();
    vector<int>::const_iterator itEnd = fedList.end();
    for (;it != itEnd; ++it) {  
    
      const FEDRawData & fedData = rawData->FEDData(*it);
      size_t size=fedData.size();
    
      FEDRawData & fedDataProd = selectedRawData->FEDData(*it);
      fedDataProd.resize(size);
    
      memcpy(fedDataProd.data(),fedData.data(),size);
    }
  }

  // if vector of FED indexes is NOT defined, loop over it FED range
  else {
    
    // FED range is <0,0> (i.e. neither the list nor the rage are defined) copy the entire payload 
    if (fedRange.second==0) setRange(pair<int,int>(0,FEDNumbering::lastFEDId()));

    for (int i = fedRange.first; i <= fedRange.second; ++i) {

      const FEDRawData & fedData = rawData->FEDData(i);
      size_t size=fedData.size();
    
      FEDRawData & fedDataProd = selectedRawData->FEDData(i);
      fedDataProd.resize(size);
    
      memcpy(fedDataProd.data(),fedData.data(),size);
    }
  }
  
  return selectedRawData; 
} 
std::auto_ptr<FEDRawDataCollection> RawDataFEDSelector::select ( const edm::Handle< FEDRawDataCollection > &  rawData,
const std::vector< int > &  list 
)
std::auto_ptr<FEDRawDataCollection> RawDataFEDSelector::select ( const edm::Handle< FEDRawDataCollection > &  rawData,
const std::pair< int, int > &  range 
)
void RawDataFEDSelector::setRange ( const std::pair< int, int > &  range) [inline]

Definition at line 28 of file RawDataFEDSelector.h.

References fedRange.

{fedRange = range;};
void RawDataFEDSelector::setRange ( const std::vector< int > &  list) [inline]

Definition at line 29 of file RawDataFEDSelector.h.

References fedList, and list().

{fedList = list;};

Member Data Documentation

std::vector<int> RawDataFEDSelector::fedList [private]

Definition at line 39 of file RawDataFEDSelector.h.

Referenced by setRange().

std::pair<int,int> RawDataFEDSelector::fedRange [private]

Definition at line 38 of file RawDataFEDSelector.h.

Referenced by setRange().