Project
Loading...
Searching...
No Matches
ErrorMap.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
12#include "MCHBase/ErrorMap.h"
13
14#include <utility>
15
16namespace o2::mch
17{
18
20{
21 uint64_t r = a;
22 r = (r << 32) & 0xFFFFFFFF00000000 | b;
23 return r;
24}
25
26std::pair<uint32_t, uint32_t> decode(uint64_t x)
27{
28 uint32_t a = static_cast<uint32_t>((x & 0xFFFFFFFF00000000) >> 32);
29 uint32_t b = static_cast<uint32_t>(x & 0xFFFFFFFF);
30 return std::make_pair(a, b);
31}
32
34{
35 auto [itError, isNew] = mErrors[errorType].emplace(encode(id0, id1), Error{errorType, id0, id1, n});
36 if (!isNew) {
37 itError->second.count += n;
38 }
39}
40
42{
43 auto [itError, isNew] = mErrors[error.type].emplace(encode(error.id0, error.id1), error);
44 if (!isNew) {
45 itError->second.count += error.count;
46 }
47}
48
49void ErrorMap::add(gsl::span<const Error> errors)
50{
51 for (auto error : errors) {
52 add(error);
53 }
54}
55
56void ErrorMap::add(const ErrorMap& errors)
57{
58 errors.forEach([this](Error error) {
59 add(error);
60 });
61}
62
64{
65 uint64_t n{0};
66 forEach([&n](Error error) {
67 n += error.count;
68 });
69 return n;
70}
71
73{
74 uint64_t n{0};
75 forEach(type, [&n](Error error) {
76 n += error.count;
77 });
78 return n;
79}
80
82{
83 uint64_t n{0};
85 n += error.count;
86 });
87 return n;
88}
89
91{
92 for (const auto& typeErrors : mErrors) {
93 for (auto error : typeErrors.second) {
94 f(error.second);
95 }
96 }
97}
98
100{
101 for (const auto& [thisType, errors] : mErrors) {
102 if (thisType == type) {
103 for (auto error : errors) {
104 f(error.second);
105 }
106 }
107 }
108}
109
111{
112 for (const auto& [thisType, errors] : mErrors) {
113 if (errorGroup(thisType) == group) {
114 for (auto error : errors) {
115 f(error.second);
116 }
117 }
118 }
119}
120
121} // namespace o2::mch
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 Number of events to Number of iterations to Number of iterations to Number of initial iterations excluded from const char Directory with events to Events directory is and not inside events Show standalone event Run event generator maximum time bin of continuous for triggered for automatic continuous for automatic continuous triggered uint64_t
char error[CURL_ERROR_SIZE]
A container class to summarize errors encountered during processing.
Definition ErrorMap.h:38
void forEach(ErrorFunction f) const
Definition ErrorMap.cxx:90
uint64_t getNumberOfErrors() const
Definition ErrorMap.cxx:63
void add(ErrorType errorType, uint32_t id0, uint32_t id1, uint64_t n=1)
Definition ErrorMap.cxx:33
std::function< void(Error error)> ErrorFunction
Definition ErrorMap.h:40
GLdouble n
Definition glcorearb.h:1982
GLint GLenum GLint x
Definition glcorearb.h:403
GLdouble f
Definition glcorearb.h:310
GLboolean GLboolean GLboolean b
Definition glcorearb.h:1233
GLint GLint GLsizei GLint GLenum GLenum type
Definition glcorearb.h:275
GLboolean GLuint group
Definition glcorearb.h:3991
GLboolean r
Definition glcorearb.h:1233
GLboolean GLboolean GLboolean GLboolean a
Definition glcorearb.h:1233
constexpr ErrorGroup errorGroup(ErrorType error)
Definition Error.h:66
uint64_t encode(uint32_t a, uint32_t b)
Definition ErrorMap.cxx:19
ErrorGroup
Definition Error.h:31
ErrorType
Definition Error.h:54
std::pair< uint32_t, uint32_t > decode(uint64_t x)
Definition ErrorMap.cxx:26