Project
Loading...
Searching...
No Matches
GeometryBase.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
12#ifndef ALICEO2_EMCAL_GEOMETRYBASE_H
13#define ALICEO2_EMCAL_GEOMETRYBASE_H
14
15#include <string>
16
17namespace o2
18{
19namespace emcal
20{
27 DCAL_EXT = 4
28}; // possible SM Type
29
33
34const std::string DEFAULT_GEOMETRY = "EMCAL_COMPLETE12SMV1_DCAL_8SM";
35
39class GeometryNotInitializedException final : public std::exception
40{
41 public:
44
46 ~GeometryNotInitializedException() noexcept final = default;
47
50 const char* what() const noexcept { return "Geometry not initialized"; }
51};
52
56class InvalidModuleException final : public std::exception
57{
58 public:
62 InvalidModuleException(int nModule, int nMax) : std::exception(),
63 mModule(nModule),
64 mMax(nMax),
65 mMessage("Invalid Module [ " + std::to_string(mModule) + "|" + std::to_string(mMax) + "]")
66 {
67 }
68
70 ~InvalidModuleException() noexcept final = default;
71
74 int GetModuleID() const noexcept { return mModule; }
75
78 int GetMaxNumberOfModules() const noexcept { return mMax; }
79
82 const char* what() const noexcept final { return mMessage.c_str(); }
83
84 private:
85 int mModule;
86 int mMax;
87 std::string mMessage;
88};
89
93class InvalidPositionException final : public std::exception
94{
95 public:
99 InvalidPositionException(double eta, double phi) : std::exception(),
100 mEta(eta),
101 mPhi(phi),
102 mMessage("Position phi (" + std::to_string(mPhi) + "), eta(" + std::to_string(mEta) + ") not im EMCAL")
103 {
104 }
105
107 ~InvalidPositionException() noexcept final = default;
108
111 double getEta() const noexcept { return mEta; }
112
115 double getPhi() const noexcept { return mPhi; }
116
119 const char* what() const noexcept final { return mMessage.data(); }
120
121 private:
122 double mEta = 0.;
123 double mPhi = 0.;
124 std::string mMessage;
125};
126
130class InvalidCellIDException final : public std::exception
131{
132 public:
135 InvalidCellIDException(int cellID) : std::exception(),
136 mCellID(cellID),
137 mMessage("Cell ID " + std::to_string(mCellID) + " outside limits.")
138 {
139 }
140
142 ~InvalidCellIDException() noexcept final = default;
143
146 int getCellID() const noexcept { return mCellID; }
147
150 const char* what() const noexcept final { return mMessage.data(); }
151
152 private:
153 int mCellID;
154 std::string mMessage;
155};
156
160class InvalidSupermoduleTypeException final : public std::exception
161{
162 public:
165
167 ~InvalidSupermoduleTypeException() noexcept final = default;
168
170 const char* what() const noexcept final { return "Uknown SuperModule Type !!"; }
171};
172
176class SupermoduleIndexException final : public std::exception
177{
178 public:
182 SupermoduleIndexException(int supermodule, int maxSupermodules) : std::exception(),
183 mSupermoduleIndex(supermodule),
184 mMaxSupermodules(maxSupermodules)
185 {
186 mMessage = "Invalid supermodule ID " + std::to_string(mSupermoduleIndex) + ", max " + std::to_string(mMaxSupermodules);
187 }
188
190 ~SupermoduleIndexException() noexcept final = default;
191
194 int getSupermodule() const noexcept { return mSupermoduleIndex; }
195
198 int getMaxSupermodule() const noexcept { return mMaxSupermodules; }
199
202 const char* what() const noexcept final { return mMessage.data(); }
203
204 private:
205 int mSupermoduleIndex;
206 int mMaxSupermodules;
207 std::string mMessage;
208};
209
213class RowColException final : public std::exception
214{
215 public:
219 RowColException(int row, int col) : mRow(row), mCol(col), mMessage("")
220 {
221 mMessage = "Invalid position: row " + std::to_string(mRow) + ", col " + std::to_string(mCol);
222 }
223
225 ~RowColException() noexcept final = default;
226
229 int getRow() const noexcept { return mRow; }
230
233 int getCol() const noexcept { return mCol; }
234
237 const char* what() const noexcept final { return mMessage.data(); }
238
239 private:
240 int mRow, mCol;
241 std::string mMessage;
242};
243
244} // namespace emcal
245} // namespace o2
246
247#endif
uint32_t supermodule
Definition RawData.h:3
uint32_t col
Definition RawData.h:4
Error handling access to non-initialized geometry.
~GeometryNotInitializedException() noexcept final=default
Destructor.
const char * what() const noexcept
Access to error message.
GeometryNotInitializedException()=default
Constructor.
Exception handling non-existing cell IDs.
InvalidCellIDException(int cellID)
Constructor, setting cell ID raising the exception.
int getCellID() const noexcept
Access to cell ID raising the exception.
~InvalidCellIDException() noexcept final=default
Destructor.
const char * what() const noexcept final
Access to error message of the exception.
Error Handling when an invalid module ID (outside the limits) is called.
int GetMaxNumberOfModules() const noexcept
Get number of modules.
InvalidModuleException(int nModule, int nMax)
Constructor.
~InvalidModuleException() noexcept final=default
Destructor.
const char * what() const noexcept final
Access to error message.
int GetModuleID() const noexcept
Get ID of the module raising the exception.
Exception handling errors due to positions not in the EMCAL area.
double getEta() const noexcept
Access to eta coordinate raising the exception.
const char * what() const noexcept final
Access to error message of the exception.
~InvalidPositionException() noexcept final=default
Destructor.
double getPhi() const noexcept
Access to phi corrdinate raising the exception.
InvalidPositionException(double eta, double phi)
Constructor, setting the position raising the exception.
Exception handling improper or uninitialized supermodule types.
InvalidSupermoduleTypeException()=default
constructor
~InvalidSupermoduleTypeException() noexcept final=default
Destructor.
const char * what() const noexcept final
Access to error message of the exception.
Handling error for invalid positions in row-column space.
~RowColException() noexcept final=default
Destructor.
const char * what() const noexcept final
Access tp error message of the exception.
int getRow() const noexcept
Get row of the position raising the exception.
RowColException(int row, int col)
Constructor, initializing the exception with invalid row-column position.
int getCol() const noexcept
Get column of the position raising the exception.
Handling error due to invalid supermodule.
SupermoduleIndexException(int supermodule, int maxSupermodules)
Constructor, initializing the exception.
int getMaxSupermodule() const noexcept
Access to maximum number of supermodules.
~SupermoduleIndexException() noexcept final=default
Destructor.
const char * what() const noexcept final
Access to error message of the exception.
int getSupermodule() const noexcept
Access to supermodule index raising the exception.
const std::string DEFAULT_GEOMETRY
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
Defining DataPointCompositeObject explicitly as copiable.
std::string to_string(gsl::span< T, Size > span)
Definition common.h:52
std::vector< int > row