Project
Loading...
Searching...
No Matches
RawDataChecker.cxx
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
18
19#include <unordered_map>
20#include "fmt/format.h"
22
23namespace o2
24{
25namespace mid
26{
27
28void RawDataChecker::init(const CrateMasks& crateMasks)
29{
31 for (uint16_t igbt = 0; igbt < crateparams::sNGBTs; ++igbt) {
32 mCheckers[igbt].setElectronicsDelay(mElectronicsDelay);
33 mCheckers[igbt].init(igbt, crateMasks.getMask(igbt));
34 }
35}
36
37bool RawDataChecker::process(gsl::span<const ROBoard> localBoards, gsl::span<const ROFRecord> rofRecords, gsl::span<const ROFRecord> pageRecords)
38{
40
41 bool isOk = true;
42 mDebugMsg.clear();
43 std::unordered_map<uint16_t, std::vector<ROFRecord>> rofs;
44 for (auto& rof : rofRecords) {
45 auto& loc = localBoards[rof.firstEntry];
46 auto crateId = raw::getCrateId(loc.boardId);
47 auto linkId = crateparams::getGBTIdFromBoardInCrate(raw::getLocId(loc.boardId));
48 auto feeId = crateparams::makeGBTUniqueId(crateId, linkId);
49 rofs[feeId].emplace_back(rof);
50 }
51
52 for (auto& item : rofs) {
53 isOk &= mCheckers[item.first].process(localBoards, item.second, pageRecords);
54 mDebugMsg += mCheckers[item.first].getDebugMessage();
55 }
56
57 return isOk;
58}
59
61{
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
76void RawDataChecker::setSyncTrigger(uint32_t syncTrigger)
77{
79 for (auto& checker : mCheckers) {
80 checker.setSyncTrigger(syncTrigger);
81 }
82}
83
85{
87 unsigned int sum = 0;
88 for (auto& checker : mCheckers) {
89 sum += checker.getNEventsProcessed();
90 }
91 return sum;
92}
93
95{
97 unsigned int sum = 0;
98 for (auto& checker : mCheckers) {
99 sum += checker.getNEventsFaulty();
100 }
101 return sum;
102}
103
105{
107 unsigned int sum = 0;
108 for (auto& checker : mCheckers) {
109 sum += checker.getNBusyRaised();
110 }
111 return sum;
112}
113
115{
117 for (auto& checker : mCheckers) {
118 checker.clear(all);
119 }
120}
121
122} // namespace mid
123} // namespace o2
MID RO crate parameters.
Class to check the raw data.
uint8_t getMask(uint16_t feeId) const
Gets the mask for the feeId.
Definition CrateMasks.h:41
void setSyncTrigger(uint32_t syncTrigger)
bool process(gsl::span< const ROBoard > localBoards, gsl::span< const ROFRecord > rofRecords, gsl::span< const ROFRecord > pageRecords)
void clear(bool all=false)
void init(const CrateMasks &masks)
unsigned int getNEventsFaulty() const
Gets the number of faulty events.
bool checkMissingLinks(bool clear=true)
unsigned int getNEventsProcessed() const
Gets the number of processed events.
unsigned int getNBusyRaised() const
Gets the number of busy raised.
float sum(float s, o2::dcs::DataPointValue v)
Definition dcs-ccdb.cxx:39
uint16_t makeGBTUniqueId(uint8_t crateId, uint8_t gbtId)
Builds the GBT unique ID from the crate ID and the GBT ID in the crate.
uint8_t getGBTIdFromBoardInCrate(uint8_t locId)
Gets the link ID in crate from the board ID.
uint8_t getCrateId(uint8_t uniqueLocId)
Definition ROBoard.h:75
uint8_t getLocId(uint8_t uniqueLocId)
Definition ROBoard.h:80
simClustering correlation clear()
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...