14#include <boost/format.hpp>
15#include "InfoLogger/InfoLogger.hxx"
28void StuDecoder::init()
32 auto feeID = o2::raw::RDHUtils::getFEEID(header);
45 bool vbit = ((
buffer[0] >> 31) & 0x1);
50 mIsFullPayload = (
buffer[1] & 0x1);
55 if (payloadsize != getPaloadSizeFull()) {
62 if (payloadsize != getPaloadSizeShort()) {
69 std::cout <<
"==== paylaod size ===\n";
71 while ((currentpos <
buffer.size())) {
72 auto currentword =
buffer[currentpos++];
73 std::cout << std::dec << (currentpos - 1) <<
") 0x" << std::hex << currentword << std::endl;
88 mL1GammaHighThreshold =
buffer[3];
89 mShortPayloadRate =
buffer[4];
91 mL1JetHighThreshold =
buffer[6];
92 mL1GammaLowThreshold =
buffer[9];
93 mL1JetLowThreshold =
buffer[12];
95 mRegionEnable =
buffer[14];
96 mFrameReceived =
buffer[15];
100 int offset = getCFGWords();
104 offset += (2 * getL1JetIndexWords() + getL0indexWords());
112 offset += (2 * getL1GammaIndexWords());
119void StuDecoder::decodeL1JetPatchIndices(
const uint32_t*
buffer)
121 int offset = getL1JetIndexWords();
125 std::cout << std::dec <<
i <<
") 0x" << std::hex <<
buffer[
i] <<
" <- Jet-high-word\n";
128 std::cout << std::dec <<
i <<
") 0x" << std::hex <<
buffer[
offset +
i] <<
" <- Jet-low-word\n";
132 int nSubregionEta = getSubregionsEta();
133 int nSubregionPhi = getSubregionsPhi();
134 bool isFired =
false;
138 for (Int_t ix = 0;
ix < nSubregionEta - (jetSize - 1);
ix++) {
141 for (Int_t iy = 0;
iy < nSubregionPhi - (jetSize - 1);
iy++) {
142 isFired = (mSTU ==
STUtype_t::ESTU) ? (row_JetHigh & (1 << (nSubregionPhi - jetSize - iy))) : (row_JetHigh & (1 <<
iy));
144 mL1JetHighPatchIndex.push_back(((ix << 8) & 0xFF00) | (iy & 0xFF));
146 isFired = (mSTU ==
STUtype_t::ESTU) ? (row_JetLow & (1 << (nSubregionPhi - jetSize - iy))) : (row_JetLow & (1 <<
iy));
148 mL1JetLowPatchIndex.push_back(((ix << 8) & 0xFF00) | (iy & 0xFF));
156void StuDecoder::decodeL1GammaPatchIndices(
const uint32_t*
buffer)
158 const int offset = getL1GammaIndexWords();
162 std::cout << std::dec <<
i <<
") 0x" << std::hex <<
buffer[
i] <<
" <- Gamma-high-word\n";
165 std::cout << std::dec <<
i <<
") 0x" << std::hex <<
buffer[
offset +
i] <<
" <- Gamma-low-word\n";
176 for (Int_t itru = 0; itru < nTRU2; itru++) {
177 gammaHigh[2 * itru][2 * iphi] = (
buffer[iphi * nTRU2 + itru] >> 0 & 0xFF);
178 gammaHigh[2 * itru][2 * iphi + 1] = (
buffer[iphi * nTRU2 + itru] >> 8 & 0xFF);
179 gammaHigh[2 * itru + 1][2 * iphi] = (
buffer[iphi * nTRU2 + itru] >> 16 & 0xFF);
180 gammaHigh[2 * itru + 1][2 * iphi + 1] = (
buffer[iphi * nTRU2 + itru] >> 24 & 0xFF);
182 gammaLow[2 * itru][2 * iphi] = (
buffer[
offset + iphi * nTRU2 + itru] >> 0 & 0xFF);
183 gammaLow[2 * itru][2 * iphi + 1] = (
buffer[
offset + iphi * nTRU2 + itru] >> 8 & 0xFF);
184 gammaLow[2 * itru + 1][2 * iphi] = (
buffer[
offset + iphi * nTRU2 + itru] >> 16 & 0xFF);
185 gammaLow[2 * itru + 1][2 * iphi + 1] = (
buffer[
offset + iphi * nTRU2 + itru] >> 24 & 0xFF);
192 for (Int_t itru = 0; itru < (nTRU - 2); itru++) {
193 if ((gammaHigh[itru][iphi] >> ieta) & 0x1) {
194 mL1GammaHighPatchIndex.push_back(((iphi << 10) & 0x7C00) | ((ieta << 5) & 0x03E0) | ((itru << 0) & 0x001F));
196 if ((gammaLow[itru][iphi] >> ieta) & 0x1) {
197 mL1GammaLowPatchIndex.push_back(((iphi << 10) & 0x7C00) | ((ieta << 5) & 0x03E0) | ((itru << 0) & 0x001F));
201 for (Int_t itru = (nTRU - 2); itru < nTRU; itru++) {
202 short iphi_tmp = (iphi % 2 + 2 * (
int)(iphi / 6));
203 short ieta_tmp = (ieta + 8 * ((
int)(iphi / 2) % 3));
204 if ((gammaHigh[itru][iphi] >> ieta) & 0x1) {
205 mL1GammaHighPatchIndex.push_back(((iphi_tmp << 10) & 0x7C00) | ((ieta_tmp << 5) & 0x03E0) | ((itru << 0) & 0x001F));
207 if ((gammaLow[itru][iphi] >> ieta) & 0x1) {
208 mL1GammaLowPatchIndex.push_back(((iphi_tmp << 10) & 0x7C00) | ((ieta_tmp << 5) & 0x03E0) | ((itru << 0) & 0x001F));
217void StuDecoder::decodeFastOrADC(
const uint32_t*
buffer)
219 for (
int i = 0;
i < getRawWords();
i++) {
221 std::cout << std::dec <<
i <<
") 0x" << std::hex <<
buffer[
i] <<
" <- FasrOR-word\n";
223 mFastOrADC.push_back(int16_t(
buffer[
i] & 0xFFFF));
224 mFastOrADC.push_back(int16_t(
buffer[
i] >> 16) & 0xFFFF);
237 std::cout <<
"Rho :" << std::dec <<
getRho() << std::endl;
239 std::cout <<
"RegionEnable :" << std::hex <<
"0x" <<
getRegionEnable() << std::endl;
240 std::cout <<
"FrameReceived :" << std::dec <<
getFrameReceived() << std::endl;
241 std::cout <<
"ParchSize :" << std::dec <<
getParchSize() << std::endl;
242 std::cout <<
"FWversion :" << std::hex <<
"0x" <<
getFWversion() << std::endl;
const std::vector< uint32_t > & getPayloadWords() const
Get the payload words (as 32 bit words) contributing to the current payload.
Reader for raw data produced by the Readout application in in-memory format.
const o2::header::RDHAny & getRawHeader() const
access to the raw header of the current page
const RawPayload & getPayload() const
access to the full raw payload (single or multiple DMA pages)
Handling of STU reconstruction errors.
@ SHORT_PAYLOAD_SIZE_UNEXPECTED
short payload size unexpected
@ OLD_PAYLOAD_VERSION
unsupported old payload version
@ FEEID_UNEXPECTED
FeeID index unexpected.
@ FULL_PAYLOAD_SIZE_UNEXPECTED
full payload size unexpected
int32_t getL1GammaLowThreshold() const
StuDecoder(RawReaderMemory &reader)
Constructor.
int32_t getFrameReceivedSTU() const
bool isFullPayload() const
int32_t getFWversion() const
int32_t getL1GammaHighThreshold() const
int32_t getFrameReceived() const
int32_t getL1JetHighThreshold() const
int32_t getL1JetLowThreshold() const
int32_t getParchSize() const
void decode()
Decode the STU stream.
int getNumberOfTRUs() const
int32_t getRegionEnable() const
constexpr int FeeID[2]
FEE_ID in RDH.
constexpr int NchannelsOverEta
number of FastORs over Eta for full- and 2/3-size SMs
constexpr int NchannelsOverPhi
number of FastORs over Phi for full- and 2/3-size SMs