Skip to content

Commit c916d2e

Browse files
dstoccoaphecetche
authored andcommitted
Check for missing GBT links in MID raw data
1 parent e69e56e commit c916d2e

File tree

5 files changed

+29
-7
lines changed

5 files changed

+29
-7
lines changed

Detectors/MUON/MID/QC/include/MIDQC/GBTRawDataChecker.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ namespace mid
3333
class GBTRawDataChecker
3434
{
3535
public:
36-
void init(uint16_t feeId, uint8_t mask);
36+
void init(uint16_t gbtUniqueId, uint8_t mask);
3737
bool process(gsl::span<const ROBoard> localBoards, gsl::span<const ROFRecord> rofRecords, gsl::span<const ROFRecord> pageRecords);
3838
/// Gets the number of processed events
3939
unsigned int getNEventsProcessed() const { return mStatistics[0]; }
@@ -43,6 +43,8 @@ class GBTRawDataChecker
4343
unsigned int getNBusyRaised() const { return mStatistics[2]; }
4444
/// Gets the
4545
std::string getDebugMessage() const { return mDebugMsg; }
46+
/// Returns the GBTUniqueId
47+
uint16_t getGBTUniqueId() const { return mGBTUniqueId; }
4648
void clear(bool all = false);
4749

4850
/// Sets the delay in the electronics
@@ -96,7 +98,7 @@ class GBTRawDataChecker
9698
std::array<unsigned long int, 3> mStatistics{}; /// Processed events statistics
9799
std::unordered_map<uint8_t, Mask> mMasks; /// Masks
98100
uint8_t mCrateMask{0xFF}; /// Crate mask
99-
uint16_t mFeeId{0}; /// FeeId
101+
uint16_t mGBTUniqueId{0}; /// GBTUniqueId
100102
uint16_t mResetVal{0}; /// Reset value
101103
ElectronicsDelay mElectronicsDelay{}; /// Delays in the electronics
102104
uint32_t mSyncTrigger{raw::sORB}; /// Trigger for synchronization

Detectors/MUON/MID/QC/include/MIDQC/RawDataChecker.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ class RawDataChecker
3434
public:
3535
void init(const CrateMasks& masks);
3636
bool process(gsl::span<const ROBoard> localBoards, gsl::span<const ROFRecord> rofRecords, gsl::span<const ROFRecord> pageRecords);
37+
bool checkMissingLinks(bool clear = true);
3738
/// Gets the number of processed events
3839
unsigned int getNEventsProcessed() const;
3940
/// Gets the number of faulty events

Detectors/MUON/MID/QC/src/GBTRawDataChecker.cxx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@ namespace o2
2525
namespace mid
2626
{
2727

28-
void GBTRawDataChecker::init(uint16_t feeId, uint8_t mask)
28+
void GBTRawDataChecker::init(uint16_t gbtUniqueId, uint8_t mask)
2929
{
3030
/// Initializer
31-
mFeeId = feeId;
31+
mGBTUniqueId = gbtUniqueId;
3232
mCrateMask = mask;
3333
}
3434

@@ -421,11 +421,8 @@ bool GBTRawDataChecker::checkEvents(bool isTriggered)
421421
for (auto& evtIdxItem : orderedIndexes) {
422422
// All of these boards have the same timestamp
423423
GBT gbtEvent;
424-
// bool busyRaised = false;
425424
for (auto& evtPair : evtIdxItem.second) {
426425
auto& boardInfo = boards[evtPair.first][evtPair.second];
427-
uint8_t triggerId = boardInfo.board.triggerWord;
428-
auto elinkId = getElinkId(boardInfo.board);
429426

430427
if (raw::isLoc(boardInfo.board.statusWord)) {
431428
gbtEvent.locs.push_back(boardInfo.board);

Detectors/MUON/MID/QC/src/RawDataChecker.cxx

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include "MIDQC/RawDataChecker.h"
1818

1919
#include <unordered_map>
20+
#include "fmt/format.h"
2021
#include "MIDRaw/CrateParameters.h"
2122

2223
namespace o2
@@ -56,6 +57,22 @@ bool RawDataChecker::process(gsl::span<const ROBoard> localBoards, gsl::span<con
5657
return isOk;
5758
}
5859

60+
bool RawDataChecker::checkMissingLinks(bool clear)
61+
{
62+
/// Checks for missing links
63+
if (clear) {
64+
mDebugMsg.clear();
65+
}
66+
bool isOk = true;
67+
for (auto& checker : mCheckers) {
68+
if (checker.getNEventsProcessed() == 0) {
69+
isOk = false;
70+
mDebugMsg += fmt::format("Missing info from GBT 0x{:02x}\n", checker.getGBTUniqueId());
71+
}
72+
}
73+
return isOk;
74+
}
75+
5976
void RawDataChecker::setSyncTrigger(uint32_t syncTrigger)
6077
{
6178
/// Sets the trigger use to verify if all data of an event where received

Detectors/MUON/MID/Workflow/src/RawCheckerSpec.cxx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,11 @@ class RawCheckerDeviceDPL
7777
mOutFile.open(outFilename.c_str());
7878

7979
auto stop = [this]() {
80+
if constexpr (std::is_same_v<RAWCHECKER, RawDataChecker>) {
81+
if (!mChecker.checkMissingLinks()) {
82+
mOutFile << mChecker.getDebugMessage() << "\n";
83+
}
84+
}
8085
bool hasProcessed = (mChecker.getNEventsProcessed() > 0);
8186
double scaleFactor = (mChecker.getNEventsProcessed() > 0) ? 1.e6 / static_cast<double>(mChecker.getNEventsProcessed()) : 0.;
8287
LOG(info) << "Processing time / " << mChecker.getNEventsProcessed() << " BCs: full: " << mTimer.count() * scaleFactor << " us checker: " << mTimerAlgo.count() * scaleFactor << " us";

0 commit comments

Comments
 (0)