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.

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 }

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

Referenced by RawDataSelector::produce().

◆ select() [2/3]

std::unique_ptr< FEDRawDataCollection > RawDataFEDSelector::select ( const edm::Handle< FEDRawDataCollection > &  rawData,
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.

62  {
63  setRange(list);
64  return select(rawData);
65 }

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

◆ setRange() [1/2]

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

Definition at line 25 of file RawDataFEDSelector.h.

25 { fedRange = range; };

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.

26 { fedList = list; };

References 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().

FastTimerService_cff.range
range
Definition: FastTimerService_cff.py:34
mps_fire.i
i
Definition: mps_fire.py:428
FEDNumbering::lastFEDId
static constexpr int lastFEDId()
Definition: FEDNumbering.h:19
l1tstage2_dqm_sourceclient-live_cfg.rawData
rawData
Definition: l1tstage2_dqm_sourceclient-live_cfg.py:163
RawDataFEDSelector::fedList
std::vector< int > fedList
Definition: RawDataFEDSelector.h:36
FEDRawData::data
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
Definition: FEDRawData.cc:24
FEDRawData
Definition: FEDRawData.h:19
RawDataFEDSelector::fedRange
std::pair< int, int > fedRange
Definition: RawDataFEDSelector.h:35
RawDataFEDSelector::setRange
void setRange(const std::pair< int, int > &range)
Definition: RawDataFEDSelector.h:25
FEDRawData::size
size_t size() const
Lenght of the data buffer in bytes.
Definition: FEDRawData.h:45
FEDRawData::resize
void resize(size_t newsize)
Definition: FEDRawData.cc:28
RawDataFEDSelector::select
std::unique_ptr< FEDRawDataCollection > select(const edm::Handle< FEDRawDataCollection > &rawData)
Definition: RawDataFEDSelector.cc:17
findQualityFiles.size
size
Write out results.
Definition: findQualityFiles.py:443