Skip to content

Commit 4031cc8

Browse files
authored
[FOCAL-8] Use FEE ID to distinguish the subsystems (#1730)
- Pads: Only 1 FEE, 0xcafe - Pixels: all other FEEs
1 parent 1779850 commit 4031cc8

1 file changed

Lines changed: 9 additions & 12 deletions

File tree

Modules/FOCAL/src/TestbeamRawTask.cxx

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
///
1616

1717
#include <algorithm>
18+
#include <iomanip>
1819
#include <iostream>
1920
#include <unordered_set>
2021

@@ -319,8 +320,7 @@ void TestbeamRawTask::monitorData(o2::framework::ProcessingContext& ctx)
319320
}
320321
int inputs = 0;
321322
std::vector<char> rawbuffer;
322-
int currentendpoint = 0;
323-
int currentsource = 0;
323+
uint16_t currentfee = 0;
324324
for (const auto& rawData : framework::InputRecordWalker(ctx.inputs())) {
325325
if (rawData.header != nullptr && rawData.payload != nullptr) {
326326
const auto payloadSize = o2::framework::DataRefUtils::getPayloadSize(rawData);
@@ -340,30 +340,27 @@ void TestbeamRawTask::monitorData(o2::framework::ProcessingContext& ctx)
340340
if (o2::raw::RDHUtils::getStop(rdh)) {
341341
ILOG(Debug, Support) << "Stop bit received - processing payload" << ENDM;
342342
// Data ready
343-
if (currentsource == 0x2b) { // Use source ID 43 for pads
343+
if (currentfee == 0xcafe) { // Use FEE ID 0xcafe for PAD data
344344
// Pad data
345345
if (!mDisablePads) {
346346
ILOG(Debug, Support) << "Processing PAD data" << ENDM;
347347
auto payloadsizeGBT = rawbuffer.size() * sizeof(char) / sizeof(o2::focal::PadGBTWord);
348348
processPadPayload(gsl::span<const o2::focal::PadGBTWord>(reinterpret_cast<const o2::focal::PadGBTWord*>(rawbuffer.data()), payloadsizeGBT));
349349
}
350-
} else if (currentsource == 0x20) { // Use source ID 32 (ITS) for pixels
350+
} else { // All other FEEs are pixel FEEs
351351
// Pixel data
352352
if (!mDisablePixels) {
353353
auto feeID = o2::raw::RDHUtils::getFEEID(rdh);
354354
ILOG(Debug, Support) << "Processing Pixel data from FEE " << feeID << ENDM;
355355
auto payloadsizeGBT = rawbuffer.size() * sizeof(char) / sizeof(o2::itsmft::GBTWord);
356356
processPixelPayload(gsl::span<const o2::itsmft::GBTWord>(reinterpret_cast<const o2::itsmft::GBTWord*>(rawbuffer.data()), payloadsizeGBT), feeID);
357357
}
358-
} else {
359-
ILOG(Error, Support) << "Unsupported endpoint " << currentendpoint << ENDM;
360358
}
361359
rawbuffer.clear();
362360
} else {
363361
ILOG(Debug, Support) << "New HBF or Timeframe" << ENDM;
364-
currentendpoint = o2::raw::RDHUtils::getEndPointID(rdh);
365-
currentsource = o2::raw::RDHUtils::getSourceID(rdh);
366-
ILOG(Debug, Support) << "Using endpoint " << currentendpoint;
362+
currentfee = o2::raw::RDHUtils::getFEEID(rdh);
363+
ILOG(Debug, Support) << "Using FEE ID: 0x" << std::hex << currentfee << std::dec << ENDM;
367364
rawbuffer.clear();
368365
}
369366
}
@@ -373,15 +370,15 @@ void TestbeamRawTask::monitorData(o2::framework::ProcessingContext& ctx)
373370

374371
// non-0 payload size:
375372
auto payloadsize = o2::raw::RDHUtils::getMemorySize(rdh) - o2::raw::RDHUtils::getHeaderSize(rdh);
376-
int endpoint = static_cast<int>(o2::raw::RDHUtils::getEndPointID(rdh));
373+
auto fee = static_cast<int>(o2::raw::RDHUtils::getFEEID(rdh));
377374
ILOG(Debug, Support) << "Next RDH: " << ENDM;
378-
ILOG(Debug, Support) << "Found endpoint " << endpoint << ENDM;
375+
ILOG(Debug, Support) << "Found fee 0x" << std::hex << fee << std::dec << " (System " << (fee == 0xcafe ? "Pads" : "Pixels") << ")" << ENDM;
379376
ILOG(Debug, Support) << "Found trigger BC: " << o2::raw::RDHUtils::getTriggerBC(rdh) << ENDM;
380377
ILOG(Debug, Support) << "Found trigger Oribt: " << o2::raw::RDHUtils::getTriggerOrbit(rdh) << ENDM;
381378
ILOG(Debug, Support) << "Found payload size: " << payloadsize << ENDM;
382379
ILOG(Debug, Support) << "Found offset to next: " << o2::raw::RDHUtils::getOffsetToNext(rdh) << ENDM;
383380
ILOG(Debug, Support) << "Stop bit: " << (o2::raw::RDHUtils::getStop(rdh) ? "yes" : "no") << ENDM;
384-
ILOG(Debug, Support) << "Number of GBT words: " << (payloadsize * sizeof(char) / (endpoint == 1 ? sizeof(o2::focal::PadGBTWord) : sizeof(o2::itsmft::GBTWord))) << ENDM;
381+
ILOG(Debug, Support) << "Number of GBT words: " << (payloadsize * sizeof(char) / (fee == 0xcafe ? sizeof(o2::focal::PadGBTWord) : sizeof(o2::itsmft::GBTWord))) << ENDM;
385382
auto page_payload = databuffer.subspan(currentpos + o2::raw::RDHUtils::getHeaderSize(rdh), payloadsize);
386383
std::copy(page_payload.begin(), page_payload.end(), std::back_inserter(rawbuffer));
387384
currentpos += o2::raw::RDHUtils::getOffsetToNext(rdh);

0 commit comments

Comments
 (0)