Skip to content

Commit 88d792a

Browse files
committed
added TF id in RDH dump
1 parent 83c3a91 commit 88d792a

File tree

4 files changed

+36
-3
lines changed

4 files changed

+36
-3
lines changed

doc/releaseNotes.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -370,3 +370,4 @@ This file describes the main feature changes for each readout.exe released versi
370370
- Updated configuration parameters:
371371
- added equipment-*.saveErrorPagesMax and equipment-*.saveErrorPagesPath to save to disk data pages found with errors (up to given maximum, in given path).
372372
- equipment-*.rdhDumpWarningEnabled default set to 1 (now that RDH warning messages auto-muted on flood).
373+
- o2-readout-rawreader: added print of TF id when RDH dump enabled. To enable this feature, one must specify a value for timeframePeriodOrbits (typically 128 or 256) in the command line parameters. TF ids generated are relative to the beginning of the file.

src/RdhUtils.cxx

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,29 @@ void RdhHandle::dumpRdh(long offset, bool singleLine)
1919
{
2020
if (singleLine) {
2121
if (!RdhHeaderPrinted) {
22-
printf(" Offset RDH Header Block Offset System FEE CRU Link Trigger Trigger Pages Stop Packet\n");
23-
printf(" v size size next id id id id orbit BC type count bit count\n");
22+
printf(" Offset RDH Header Block Offset System FEE CRU Link Trigger Trigger Pages Stop Packet");
23+
if (tfId) {
24+
printf(" TF");
25+
}
26+
printf("\n");
27+
28+
printf(" v size size next id id id id orbit BC type count bit count\n");
2429
RdhHeaderPrinted = true;
2530
}
2631
if (offset == -1) {
2732
printf("0x%p", (void*)rdhPtr);
2833
} else {
2934
printf("0x%08lX", offset);
3035
}
31-
printf(" %02d %02d %7d %7d %5d %4d %4d %4d 0x%08X:%03X 0x%08X %2d %2d %03d\n",
36+
printf(" %02d %02d %7d %7d %5d %5d %4d %4d 0x%08X:%03X 0x%08X %2d %2d %03d",
3237
(int)getHeaderVersion(), (int)getHeaderSize(), (int)getMemorySize(), (int)getOffsetNextPacket(),
3338
(int)getSystemId(), (int)getFeeId(), (int)getCruId(), (int)getLinkId(),
3439
getTriggerOrbit(), getTriggerBC(), (int)getTriggerType(),
3540
(int)getPagesCounter(), (int)getStopBit(), (int)getPacketCounter());
41+
if (tfId) {
42+
printf(" %6d", (int)tfId);
43+
}
44+
printf("\n");
3645

3746
} else {
3847
if (offset == -1) {

src/RdhUtils.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,14 @@ class RdhHandle
6060
inline uint16_t getCruId() { return (uint16_t)rdhPtr->cruId; }
6161
inline uint8_t getEndPointId() { return (uint8_t)rdhPtr->dpwId; }
6262

63+
uint64_t computeTimeframeId(const uint32_t firstTimeframeHbOrbitBegin, const uint32_t timeframePeriodOrbits) {
64+
tfId = 1 + (getHbOrbit() - firstTimeframeHbOrbitBegin) / timeframePeriodOrbits;
65+
return tfId;
66+
}
67+
6368
private:
6469
o2::Header::RAWDataHeader* rdhPtr; // pointer to RDH in memory
70+
uint64_t tfId = 0; // computed timeframeId
6571
};
6672

6773
// Utility class to access/parse/check the content of a contiguous memory block consisting of RDH+data

src/readRaw.cxx

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ int main(int argc, const char* argv[])
4040
bool checkContinuousTriggerOrder = false;
4141
bool isAutoPageSize = false; // flag set when no known page size in file
4242

43+
uint32_t timeframePeriodOrbits = 0;
44+
uint32_t firstTimeframeHbOrbitBegin = 0;
45+
bool isDefinedFirstTimeframeHbOrbitBegin = 0;
46+
4347
// parse input arguments
4448
// format is a list of key=value pairs
4549

@@ -56,6 +60,7 @@ int main(int argc, const char* argv[])
5660
" dumpData=(int) : dump the data pages. If -1, all bytes. Otherwise, the first bytes only, as specified.\n"
5761
" dumpDataInline=(int) : if set, each packet raw content is printed (hex dump style).\n"
5862
" fileReadVerbose=(int) : if set, more information is printed when reading/decoding file.\n"
63+
" timeframePeriodOrbits=(int) : if set, TF id computed (and printed, when dump enabled) for each RDH. Typically, 128 or 256.\n"
5964
" \n",
6065
argv[0]);
6166
return -1;
@@ -104,6 +109,8 @@ int main(int argc, const char* argv[])
104109
fileReadVerbose = std::stoi(value);
105110
} else if (key == "checkContinuousTriggerOrder") {
106111
checkContinuousTriggerOrder = std::stoi(value);
112+
} else if (key == "timeframePeriodOrbits") {
113+
timeframePeriodOrbits = (uint32_t) std::stoi(value);
107114
} else {
108115
ERRLOG("unknown option %s\n", key.c_str());
109116
}
@@ -328,6 +335,16 @@ int main(int argc, const char* argv[])
328335
RDHBlockCount++;
329336
RdhHandle h(((uint8_t*)data) + pageOffset);
330337

338+
// guess TF id
339+
if (timeframePeriodOrbits) {
340+
if (!isDefinedFirstTimeframeHbOrbitBegin) {
341+
// use first orbit for TF id computation
342+
firstTimeframeHbOrbitBegin = h.getHbOrbit();
343+
isDefinedFirstTimeframeHbOrbitBegin = 1;
344+
}
345+
h.computeTimeframeId(firstTimeframeHbOrbitBegin, timeframePeriodOrbits);
346+
}
347+
331348
if (dumpRDH) {
332349
h.dumpRdh(pageOffset + blockOffset, 1);
333350
}

0 commit comments

Comments
 (0)