Project
Loading...
Searching...
No Matches
GBTRawDataChecker.h
Go to the documentation of this file.
1// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3// All rights not expressly granted are reserved.
4//
5// This software is distributed under the terms of the GNU General Public
6// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7//
8// In applying this license CERN does not waive the privileges and immunities
9// granted to it by virtue of its status as an Intergovernmental Organization
10// or submit itself to any jurisdiction.
11
16#ifndef O2_MID_GBTRawDataChecker_H
17#define O2_MID_GBTRawDataChecker_H
18
19#include <cstdint>
20#include <map>
21#include <string>
22#include <unordered_map>
23#include <vector>
24#include <gsl/gsl>
28
29namespace o2
30{
31namespace mid
32{
34{
35 public:
36 void init(uint16_t gbtUniqueId, uint8_t mask);
37 bool process(gsl::span<const ROBoard> localBoards, gsl::span<const ROFRecord> rofRecords, gsl::span<const ROFRecord> pageRecords);
39 unsigned int getNEventsProcessed() const { return mStatistics[0]; }
41 unsigned int getNEventsFaulty() const { return mStatistics[1]; }
43 unsigned int getNBusyRaised() const { return mStatistics[2]; }
45 std::string getDebugMessage() const { return mDebugMsg; }
47 uint16_t getGBTUniqueId() const { return mGBTUniqueId; }
48 void clear(bool all = false);
49
51 void setElectronicsDelay(const ElectronicsDelay& electronicsDelay) { mElectronicsDelay = electronicsDelay; }
52
54 void setSyncTrigger(uint32_t syncTrigger) { mSyncTrigger = syncTrigger; }
55
56 private:
57 struct Mask {
58 std::array<uint16_t, 4> patternsBP{};
59 std::array<uint16_t, 4> patternsNBP{};
60 };
61
62 struct GBT {
63 std::vector<ROBoard> regs{};
64 std::vector<ROBoard> locs{};
65 std::vector<long int> pages{};
66 };
67
68 struct BoardInfo {
69 ROBoard board{};
70 o2::InteractionRecord interactionRecord{};
71 long int page{-1};
72 };
73
74 struct BusyInfo {
75 bool isBusy{0};
76 o2::InteractionRecord interactionRecord{};
77 };
78
79 void clearChecked(bool isTriggered, bool clearTrigEvents);
80 bool checkEvent(bool isTriggered, const std::vector<ROBoard>& regs, const std::vector<ROBoard>& locs, const InteractionRecord& ir);
81 bool checkEvents(bool isTriggered);
82 bool checkConsistency(const ROBoard& board);
83 bool checkConsistency(const std::vector<ROBoard>& boards);
84 bool checkMasks(const std::vector<ROBoard>& locs);
85 bool checkLocalBoardSize(const ROBoard& board);
86 bool checkLocalBoardSize(const std::vector<ROBoard>& boards);
87 bool checkRegLocConsistency(const std::vector<ROBoard>& regs, const std::vector<ROBoard>& locs, const InteractionRecord& ir);
88 uint8_t getElinkId(const ROBoard& board) const;
89 InteractionRecord getRawIR(uint8_t id, bool isTrigger, InteractionRecord ir) const;
90 unsigned int getLastCompleteTrigEvent();
91 bool isCompleteSelfTrigEvent(const o2::InteractionRecord& ir) const;
92 std::string printBoards(const std::vector<ROBoard>& boards) const;
93 bool runCheckEvents(unsigned int completeMask);
94 void sortEvents(bool isTriggered);
95
96 std::string mEventDebugMsg{};
97 std::string mDebugMsg{};
98 std::array<unsigned long int, 3> mStatistics{};
99 std::unordered_map<uint8_t, Mask> mMasks;
100 uint8_t mCrateMask{0xFF};
101 uint16_t mGBTUniqueId{0};
102 uint16_t mResetVal{0};
103 ElectronicsDelay mElectronicsDelay{};
104 uint32_t mSyncTrigger{raw::sORB};
105
106 std::map<o2::InteractionRecord, uint16_t> mTrigEvents{};
107
108 std::array<std::vector<BusyInfo>, 10> mBusyPeriods{};
109
110 std::array<std::vector<BoardInfo>, 10> mBoardsTrig{};
111 std::array<std::vector<BoardInfo>, 10> mBoardsSelfTrig{};
112
113 std::unordered_map<uint64_t, std::vector<std::pair<uint8_t, size_t>>> mOrderedIndexesTrig{};
114 std::unordered_map<uint64_t, std::vector<std::pair<uint8_t, size_t>>> mOrderedIndexesSelfTrig{};
115
116 std::unordered_map<uint8_t, long int> mLastIndexTrig{};
117 std::unordered_map<uint8_t, long int> mLastIndexSelfTrig{};
118
119 o2::InteractionRecord mLastCompleteIRTrig{};
120 o2::InteractionRecord mLastCompleteIRSelfTrig{};
121};
122} // namespace mid
123} // namespace o2
124
125#endif /* O2_MID_GBTRawDataChecker_H */
Delay parameters for MID electronics.
unsigned short int uint16_t
unsigned int uint32_t
zsPage * page
Timeframe settings Average distance in cm of events merged into Randomize distance around average distance of merged events Simulate correct bunch interactions instead of placing only the average number of events A value[n] sets TFlen for[n] collisions in Number of bunches per trainsort Number of bunch trains Instantaneous interaction rate Do not simulate border Total number of collisions to be placed in the interior of all time Do not select random but walk over array of events in stride steps h Event generator settings h configStandalone Use CPU for GPU Force usage of the specified GPU device no CPU fallback Continue processing after an error First event to process
Definition of the MID event record.
Structure to store the readout board information.
std::string getDebugMessage() const
Gets the.
unsigned int getNBusyRaised() const
Gets the number of busy raised.
void setSyncTrigger(uint32_t syncTrigger)
Sets the trigger use to verify if all data of an event where received.
uint16_t getGBTUniqueId() const
Returns the GBTUniqueId.
void init(uint16_t gbtUniqueId, uint8_t mask)
unsigned int getNEventsFaulty() const
Gets the number of faulty events.
unsigned int getNEventsProcessed() const
Gets the number of processed events.
void setElectronicsDelay(const ElectronicsDelay &electronicsDelay)
Sets the delay in the electronics.
GLint GLuint mask
Definition glcorearb.h:291
simClustering correlation clear()
@ GBT
GBT encoded raw data.
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
bool isBusy()
o2::InteractionRecord ir(0, 0)