forked from AliceO2Group/AliceO2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTriggerMappingErrors.h
More file actions
310 lines (260 loc) · 10.9 KB
/
Copy pathTriggerMappingErrors.h
File metadata and controls
310 lines (260 loc) · 10.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
// All rights not expressly granted are reserved.
//
// This software is distributed under the terms of the GNU General Public
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
//
// In applying this license CERN does not waive the privileges and immunities
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.
#ifndef ALICEO2_EMCAL_TRIGGERMAPPINGERRORS_H
#define ALICEO2_EMCAL_TRIGGERMAPPINGERRORS_H
#include <exception>
#include <string>
namespace o2
{
namespace emcal
{
/// \class TRUIndexException
/// \brief Error handling of faulty TRU indices
/// \ingroup EMCALbase
class TRUIndexException final : public std::exception
{
public:
/// \brief Constructor
/// \param truindex Index of the TRU
TRUIndexException(unsigned int truindex) : std::exception(), mTRUIndex(truindex), mErrorMessage()
{
mErrorMessage = "Invalid TRU Index: " + std::to_string(truindex);
}
/// \brief Destructor
~TRUIndexException() noexcept final = default;
/// \brief Get error message
/// \return Error message of the exception
const char* what() const noexcept final
{
return mErrorMessage.data();
}
/// \brief Get the index of the TRU raising the exception
/// \return Index of the TRU
unsigned int getTRUIndex() const noexcept { return mTRUIndex; }
private:
std::string mErrorMessage; ///< Buffer for the error message
unsigned int mTRUIndex; ///< Index of the TRU
};
/// \class FastORIndexException
/// \brief Error handling of faulty FastOR indices
/// \ingroup EMCALbase
class FastORIndexException final : public std::exception
{
public:
/// \brief Constructor
/// \param fastorindex Index of the FastOR
FastORIndexException(unsigned int fastorindex) : std::exception(), mFastORIndex(fastorindex), mErrorMessage()
{
mErrorMessage = "Invalid FastOR Index: " + std::to_string(fastorindex);
}
/// \brief Destructor
~FastORIndexException() noexcept final = default;
/// \brief Get error message
/// \return Error message of the exception
const char* what() const noexcept final
{
return mErrorMessage.data();
}
/// \brief Get the index of the FastOR raising the exception
/// \return Index of the FastOR
unsigned int getFastORIndex() const noexcept { return mFastORIndex; }
private:
std::string mErrorMessage; ///< Buffer for the error message
unsigned int mFastORIndex; ///< Index of the FastOR
};
/// \class FastORPositionExceptionTRU
/// \brief Handling of invalid positions of a FastOR within a TRU
/// \ingroup EMCALbase
class FastORPositionExceptionTRU final : public std::exception
{
public:
/// \brief Constructor
/// \param truID Index of the TRU
/// \param etaColumn Column of the FastOR with the faulty position in eta direction
/// \param phiRow Row of the FastOR with the faulty position in row direction
FastORPositionExceptionTRU(unsigned int truID, unsigned int etaColumn, unsigned int phiRow) : std::exception(),
mErrorMessage(),
mTRUID(truID),
mEtaColumn(etaColumn),
mPhiRow(phiRow)
{
mErrorMessage = "Invalid FastOR position in TRU " + std::to_string(truID) + ": eta = " + std::to_string(etaColumn) + ", phi = " + std::to_string(phiRow) + ")";
}
/// \brief Destructor
~FastORPositionExceptionTRU() noexcept final = default;
/// \brief Get error message
/// \return Error message of the exception
const char* what() const noexcept final
{
return mErrorMessage.data();
}
/// \brief Get the TRU ID for which the position is invalid
/// \return TRU ID
unsigned int getTRUID() const noexcept { return mTRUID; }
/// \brief Get the column in eta of the FastOR with the invalid position
/// \return Column of the FastOR
unsigned int getFastOREtaColumn() const noexcept { return mEtaColumn; }
/// \brief Get the row in phi of the FastOR with the invalid position
/// \return Row of the FastOR
unsigned int getFastORPhiRow() const noexcept { return mPhiRow; }
private:
std::string mErrorMessage; ///< Buffer for the error message
unsigned int mTRUID; ///< ID of the TRU
unsigned int mEtaColumn; ///< Column of the FastOR in eta direction
unsigned int mPhiRow; ///< Row of the FastOR in phi direction
};
/// \class FastORPositionExceptionSupermodule
/// \brief Handling of invalid positions of a FastOR within a supermodule
/// \ingroup EMCALbase
class FastORPositionExceptionSupermodule final : public std::exception
{
public:
/// \brief Constructor
/// \param supermoduleID Index of the supermodule
/// \param etaColumn Column of the FastOR with the faulty position in eta direction
/// \param phiRow Row of the FastOR with the faulty position in row direction
FastORPositionExceptionSupermodule(unsigned int supermoduleID, unsigned int etaColumn, unsigned int phiRow) : std::exception(),
mErrorMessage(),
mSupermoduleID(supermoduleID),
mEtaColumn(etaColumn),
mPhiRow(phiRow)
{
mErrorMessage = "Invalid FastOR position in supermodule " + std::to_string(supermoduleID) + ": eta = " + std::to_string(etaColumn) + ", phi = " + std::to_string(phiRow) + ")";
}
/// \brief Destructor
~FastORPositionExceptionSupermodule() noexcept final = default;
/// \brief Get error message
/// \return Error message of the exception
const char* what() const noexcept final
{
return mErrorMessage.data();
}
/// \brief Get the supermodule ID for which the position is invalid
/// \return Supermodule ID
unsigned int getSupermoduleID() const noexcept { return mSupermoduleID; }
/// \brief Get the column in eta of the FastOR with the invalid position
/// \return Column of the FastOR
unsigned int getFastOREtaColumn() const noexcept { return mEtaColumn; }
/// \brief Get the row in phi of the FastOR with the invalid position
/// \return Row of the FastOR
unsigned int getFastORPhiRow() const noexcept { return mPhiRow; }
private:
std::string mErrorMessage; ///< Buffer for error message
unsigned int mSupermoduleID; ///< ID of the supermodule
unsigned int mEtaColumn; ///< Column of the FastOR in eta direction
unsigned int mPhiRow; ///< Row of the FastOR in phi direction
};
/// \class FastORPositionExceptionEMCAL
/// \brief Handling of invalid positions of a FastOR in the detector
/// \ingroup EMCALbase
class FastORPositionExceptionEMCAL final : public std::exception
{
public:
/// \brief Constructor
/// \param etaColumn Column of the FastOR with the faulty position in eta direction
/// \param phiRow Row of the FastOR with the faulty position in row direction
FastORPositionExceptionEMCAL(unsigned int etaColumn, unsigned int phiRow) : std::exception(), mErrorMessage(), mEtaColumn(etaColumn), mPhiRow(phiRow)
{
mErrorMessage = "Invalid FastOR position: eta = " + std::to_string(etaColumn) + ", phi = " + std::to_string(phiRow) + ")";
}
/// \brief Destructor
~FastORPositionExceptionEMCAL() noexcept final = default;
/// \brief Get error message
/// \return Error message of the exception
const char* what() const noexcept final
{
return mErrorMessage.data();
}
/// \brief Get the column in eta of the FastOR with the invalid position
/// \return Column of the FastOR
unsigned int getFastOREtaColumn() const noexcept { return mEtaColumn; }
/// \brief Get the row in phi of the FastOR with the invalid position
/// \return Row of the FastOR
unsigned int getFastORPhiRow() const noexcept { return mPhiRow; }
private:
std::string mErrorMessage; ///< Buffer for error message
unsigned int mEtaColumn; ///< Column of the FastOR in eta direction
unsigned int mPhiRow; ///< Row of the FastOR in phi direction
};
/// \class PHOSRegionException
/// \brief Handling of invalid PHOS regions
/// \ingroup EMCALbase
class PHOSRegionException final : public std::exception
{
public:
/// \brief Constructor
/// \param phosregion Index of the PHOS region
PHOSRegionException(unsigned int phosregion) : std::exception(), mErrorMessage(), mPHOSRegion(phosregion)
{
mErrorMessage = "Invalid PHOS region: " + std::to_string(phosregion);
}
/// \brief Destructor
~PHOSRegionException() noexcept final = default;
/// \brief Get error message
/// \return Error message of the exception
const char* what() const noexcept final
{
return mErrorMessage.data();
}
/// \brief Get index of the PHOS region
/// \return PHOS region index
unsigned int getPHOSRegion() const noexcept { return mPHOSRegion; }
private:
std::string mErrorMessage; ///< Buffer for error message
unsigned int mPHOSRegion; ///< PHOS region
};
/// \class GeometryNotSetException
/// \brief Handling cases where the geometry is required but not defined
/// \ingroup EMCALbase
class GeometryNotSetException final : public std::exception
{
public:
/// \brief Constructor
GeometryNotSetException() = default;
/// \brief Destructor
~GeometryNotSetException() noexcept final = default;
/// \brief Access to error message
/// \return Error message
const char* what() const noexcept final
{
return "Geometry not available";
}
};
/// \class L0sizeInvalidException
/// \brief Handlig access of L0 index mapping with invalid patch size
/// \ingroup EMCALbase
class L0sizeInvalidException final : public std::exception
{
public:
/// \brief Constructor
/// \param l0size Size of the L0 patch
L0sizeInvalidException(unsigned int l0size) : std::exception(), mErrorMessage(), mL0size(l0size)
{
mErrorMessage = "L0 patch size invalid: " + std::to_string(l0size);
}
/// \brief Destructor
~L0sizeInvalidException() noexcept final = default;
/// \brief Access to error message
/// \return Error message
const char* what() const noexcept final
{
return mErrorMessage.data();
}
/// \brief Get the size of the L0 patch
/// \return Size of the L0 patch
unsigned int getL0size() const noexcept { return mL0size; }
private:
std::string mErrorMessage; ///< Buffer for error message
unsigned int mL0size; ///< Size of the L0 patch
};
} // namespace emcal
} // namespace o2
#endif // ALICEO2_EMCAL_TRIGGERMAPPINGERRORS_H