32 const std::unique_ptr<HGCalUnpacker<HGCalElectronicsId> >
unpacker_;
39 fedIds_(iConfig.getParameter<
std::
vector<unsigned
int> >(
"fedIds")),
40 badECONDMax_(iConfig.getParameter<unsigned
int>(
"badECONDMax")),
41 numERxsInECOND_(iConfig.getParameter<unsigned
int>(
"numERxsInECOND")),
44 .captureBlockReserved = iConfig.
getParameter<
unsigned int>(
"captureBlockReserved"),
45 .econdHeaderMarker = iConfig.
getParameter<
unsigned int>(
"econdHeaderMarker"),
46 .sLinkCaptureBlockMax = iConfig.
getParameter<
unsigned int>(
"maxCaptureBlock"),
47 .captureBlockECONDMax = iConfig.
getParameter<
unsigned int>(
"captureBlockECONDMax"),
48 .econdERXMax = iConfig.
getParameter<
unsigned int>(
"econdERXMax"),
49 .erxChannelMax = iConfig.
getParameter<
unsigned int>(
"erxChannelMax"),
50 .payloadLengthMax = iConfig.
getParameter<
unsigned int>(
"payloadLengthMax"),
51 .channelMax = iConfig.
getParameter<
unsigned int>(
"channelMax"),
52 .commonModeMax = iConfig.
getParameter<
unsigned int>(
"commonModeMax")})) {}
60 for (
const auto& fed_id :
fedIds_) {
61 const auto& fed_data = raw_data.FEDData(fed_id);
62 if (fed_data.size() == 0)
65 std::vector<uint32_t> data_32bit;
66 auto* ptr = fed_data.data();
67 size_t fed_size = fed_data.
size();
68 for (
size_t i = 0;
i < fed_size;
i += 4)
69 data_32bit.emplace_back(((*(ptr +
i) & 0xff) << 0) + (((
i + 1) < fed_size) ? ((*(ptr +
i + 1) & 0xff) << 8) : 0) +
70 (((
i + 2) < fed_size) ? ((*(ptr +
i + 2) & 0xff) << 16) : 0) +
71 (((
i + 3) < fed_size) ? ((*(ptr +
i + 3) & 0xff) << 24) : 0));
75 [
this](uint16_t , uint8_t , uint8_t ) {
return (1 <<
numERxsInECOND_) - 1; },
81 auto channeldata =
unpacker_->channelData();
83 for (
unsigned int i = 0;
i < channeldata.size();
i++) {
84 auto data = channeldata.at(
i);
86 const auto&
id =
data.id();
87 auto idraw =
id.raw();
88 auto raw =
data.raw();
89 LogDebug(
"HGCalRawToDigi:produce") <<
"id=" << idraw <<
", raw=" << raw <<
", common mode index=" << cm <<
".";
93 if (
const auto& bad_econds =
unpacker_->badECOND(); !bad_econds.empty()) {
96 <<
"Too many bad ECON-Ds: " << bad_econds.size() <<
" > " <<
badECONDMax_ <<
".";
100 for (
const auto& badECOND : bad_econds)
113 desc.add<
unsigned int>(
"maxCaptureBlock", 1)->setComment(
"maximum number of capture blocks in one S-Link");
114 desc.add<
unsigned int>(
"captureBlockReserved", 0)->setComment(
"capture block reserved pattern");
115 desc.add<
unsigned int>(
"econdHeaderMarker", 0x154)->setComment(
"ECON-D header Marker pattern");
116 desc.add<
unsigned int>(
"slinkBOE", 0x2a)->setComment(
"SLink BOE pattern");
117 desc.add<
unsigned int>(
"captureBlockECONDMax", 12)->setComment(
"maximum number of ECON-D's in one capture block");
118 desc.add<
unsigned int>(
"econdERXMax", 12)->setComment(
"maximum number of eRx's in one ECON-D");
119 desc.add<
unsigned int>(
"erxChannelMax", 37)->setComment(
"maximum number of channels in one eRx");
120 desc.add<
unsigned int>(
"payloadLengthMax", 469)->setComment(
"maximum length of payload length");
121 desc.add<
unsigned int>(
"channelMax", 7000000)->setComment(
"maximum number of channels unpacked");
122 desc.add<
unsigned int>(
"commonModeMax", 4000000)->setComment(
"maximum number of common modes unpacked");
123 desc.add<
unsigned int>(
"badECONDMax", 200)->setComment(
"maximum number of bad ECON-D's");
124 desc.add<std::vector<unsigned int> >(
"fedIds", {});
125 desc.add<
unsigned int>(
"numERxsInECOND", 12)->setComment(
"number of eRxs in each ECON-D payload");
126 descriptions.
add(
"hgcalDigis",
desc);
const edm::EDPutTokenT< HGCalDigiCollection > digisToken_
T getParameter(std::string const &) const
void push_back(T const &t)
HGCROCChannelDataFrame< HGCalDetId > HGCROCChannelDataFrameSpec
const std::vector< unsigned int > fedIds_
This class is designed to unpack raw data from HGCal, formatted as S-Links, capture blocks...
void produce(edm::Event &, const edm::EventSetup &) override
#define DEFINE_FWK_MODULE(type)
wrapper for a 32b data word identifying a readout channel in the raw data The format is the following...
HGCalRawToDigi(const edm::ParameterSet &)
const unsigned int badECONDMax_
Namespace of DDCMS conversion namespace.
const edm::EDPutTokenT< HGCalElecDigiCollection > elecDigisToken_
void add(std::string const &label, ParameterSetDescription const &psetDescription)
uint32_t sLinkBOE
S-Link BOE pattern.
char data[epos_bytes_allocation]
const std::unique_ptr< HGCalUnpacker< HGCalElectronicsId > > unpacker_
static void fillDescriptions(edm::ConfigurationDescriptions &)
Log< level::Warning, false > LogWarning
const unsigned int numERxsInECOND_
const edm::EDGetTokenT< FEDRawDataCollection > fedRawToken_