CMS 3D CMS Logo

RawDataFEDSelector.cc
Go to the documentation of this file.
1 //
2 // Original Author: Marco ZANETTI
3 // Created: Mon Jan 28 18:22:13 CET 2008
4 
6 
10 
11 #include <cstdio>
12 #include <cstring>
13 
14 using namespace std;
15 using namespace edm;
16 
17 std::unique_ptr<FEDRawDataCollection> RawDataFEDSelector::select(const Handle<FEDRawDataCollection>& rawData) {
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 }
54 
55 std::unique_ptr<FEDRawDataCollection> RawDataFEDSelector::select(const Handle<FEDRawDataCollection>& rawData,
56  const pair<int, int>& range) {
57  setRange(range);
58  return select(rawData);
59 }
60 
61 std::unique_ptr<FEDRawDataCollection> RawDataFEDSelector::select(const Handle<FEDRawDataCollection>& rawData,
62  const vector<int>& list) {
63  setRange(list);
64  return select(rawData);
65 }
FEDNumbering.h
FastTimerService_cff.range
range
Definition: FastTimerService_cff.py:34
mps_fire.i
i
Definition: mps_fire.py:428
hcaldqm::constants::fedList
const std::vector< unsigned int > fedList
Definition: Constants.h:62
FEDNumbering::lastFEDId
static constexpr int lastFEDId()
Definition: FEDNumbering.h:19
edm
HLT enums.
Definition: AlignableModifier.h:19
singleTopDQM_cfi.select
select
Definition: singleTopDQM_cfi.py:50
l1tstage2_dqm_sourceclient-live_cfg.rawData
rawData
Definition: l1tstage2_dqm_sourceclient-live_cfg.py:162
FEDRawData.h
edm::Handle< FEDRawDataCollection >
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.h
FEDRawDataCollection.h
FEDRawData::size
size_t size() const
Lenght of the data buffer in bytes.
Definition: FEDRawData.h:45
std
Definition: JetResolutionObject.h:76
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