CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
RawDataFEDSelector Class Reference

#include <RawDataFEDSelector.h>

Public Member Functions

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

Private Attributes

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

Detailed Description

Author
M. Zanetti CERN

Definition at line 17 of file RawDataFEDSelector.h.

Constructor & Destructor Documentation

◆ RawDataFEDSelector()

RawDataFEDSelector::RawDataFEDSelector ( )
inline

Constructor.

Definition at line 20 of file RawDataFEDSelector.h.

20 {};

◆ ~RawDataFEDSelector()

virtual RawDataFEDSelector::~RawDataFEDSelector ( )
inlinevirtual

Destructor.

Definition at line 23 of file RawDataFEDSelector.h.

23 {};

Member Function Documentation

◆ select() [1/3]

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

Definition at line 17 of file RawDataFEDSelector.cc.

References FEDRawData::data(), hcaldqm::constants::fedList, mps_fire::i, ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, FEDNumbering::lastFEDId(), l1tstage2_dqm_sourceclient-live_cfg::rawData, FEDRawData::resize(), and FEDRawData::size().

Referenced by RawDataSelector::produce().

17  {
18  auto selectedRawData = std::make_unique<FEDRawDataCollection>();
19 
20  // if vector of FED indexes is defined, loop over it
21  if (!fedList.empty()) {
22  vector<int>::const_iterator it = fedList.begin();
23  vector<int>::const_iterator itEnd = fedList.end();
24  for (; it != itEnd; ++it) {
25  const FEDRawData& fedData = rawData->FEDData(*it);
26  size_t size = fedData.size();
27 
28  FEDRawData& fedDataProd = selectedRawData->FEDData(*it);
29  fedDataProd.resize(size);
30 
31  memcpy(fedDataProd.data(), fedData.data(), size);
32  }
33  }
34 
35  // if vector of FED indexes is NOT defined, loop over it FED range
36  else {
37  // FED range is <0,0> (i.e. neither the list nor the rage are defined) copy the entire payload
38  if (fedRange.second == 0)
39  setRange(pair<int, int>(0, FEDNumbering::lastFEDId()));
40 
41  for (int i = fedRange.first; i <= fedRange.second; ++i) {
42  const FEDRawData& fedData = rawData->FEDData(i);
43  size_t size = fedData.size();
44 
45  FEDRawData& fedDataProd = selectedRawData->FEDData(i);
46  fedDataProd.resize(size);
47 
48  memcpy(fedDataProd.data(), fedData.data(), size);
49  }
50  }
51 
52  return selectedRawData;
53 }
size
Write out results.
void setRange(const std::pair< int, int > &range)
size_t size() const
Lenght of the data buffer in bytes.
Definition: FEDRawData.h:48
std::pair< int, int > fedRange
std::vector< int > fedList
void resize(size_t newsize, size_t wordsize=8)
Definition: FEDRawData.cc:28
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
Definition: FEDRawData.cc:24
static constexpr int lastFEDId()
Definition: FEDNumbering.h:19

◆ select() [2/3]

std::unique_ptr< FEDRawDataCollection > RawDataFEDSelector::select ( const edm::Handle< FEDRawDataCollection > &  rawData,
const std::pair< int, int > &  range 
)

Definition at line 55 of file RawDataFEDSelector.cc.

References FastTimerService_cff::range, l1tstage2_dqm_sourceclient-live_cfg::rawData, and singleTopDQM_cfi::select.

56  {
57  setRange(range);
58  return select(rawData);
59 }
std::unique_ptr< FEDRawDataCollection > select(const edm::Handle< FEDRawDataCollection > &rawData)
void setRange(const std::pair< int, int > &range)

◆ select() [3/3]

std::unique_ptr< FEDRawDataCollection > RawDataFEDSelector::select ( const edm::Handle< FEDRawDataCollection > &  rawData,
const std::vector< int > &  list 
)

Definition at line 61 of file RawDataFEDSelector.cc.

References l1tstage2_dqm_sourceclient-live_cfg::rawData, and singleTopDQM_cfi::select.

62  {
63  setRange(list);
64  return select(rawData);
65 }
std::unique_ptr< FEDRawDataCollection > select(const edm::Handle< FEDRawDataCollection > &rawData)
void setRange(const std::pair< int, int > &range)

◆ setRange() [1/2]

void RawDataFEDSelector::setRange ( const std::pair< int, int > &  range)
inline

Definition at line 25 of file RawDataFEDSelector.h.

References fedRange, and FastTimerService_cff::range.

◆ setRange() [2/2]

void RawDataFEDSelector::setRange ( const std::vector< int > &  list)
inline

Definition at line 26 of file RawDataFEDSelector.h.

References fedList.

26 { fedList = list; };
std::vector< int > fedList

Member Data Documentation

◆ fedList

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

Definition at line 36 of file RawDataFEDSelector.h.

Referenced by setRange().

◆ fedRange

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

Definition at line 35 of file RawDataFEDSelector.h.

Referenced by setRange().