10 #ifndef HERD_REFFRAME_H_ 11 #define HERD_REFFRAME_H_ 28 const std::array<std::string, 3>
CooName{
"X",
"Y",
"Z"};
29 inline std::ostream &
operator<<(std::ostream &out,
const Coo &coo) {
return out << CooName[static_cast<int>(coo)]; }
30 inline std::string
operator+(
const std::string &str,
const Coo &coo) {
return str +
CooName[
static_cast<int>(coo)]; }
47 const std::array<std::string, NAxes>
AxisName{
"X",
"Y",
"Z"};
48 inline std::ostream &
operator<<(std::ostream &out,
const Axis &axis) {
return out << AxisName[static_cast<int>(axis)]; }
49 inline std::string
operator+(
const std::string &str,
const Axis &axis) {
50 return str +
AxisName[
static_cast<int>(axis)];
74 constexpr std::array<RefFrame::Direction, RefFrame::NDirections>
Directions{
81 "Xpos",
"Xneg",
"Ypos",
"Yneg",
"Zpos",
"Zneg",
"XnegYneg",
"XposYneg",
"XnegYpos",
"XposYpos"};
84 return out << DirectionName[static_cast<int>(direction)];
104 const std::array<std::string, NViews>
ViewName{
"XY",
"XZ",
"YZ"};
105 inline std::ostream &
operator<<(std::ostream &out,
const View &view) {
return out << ViewName[static_cast<int>(view)]; }
107 return str +
ViewName[
static_cast<int>(view)];
124 const std::array<std::string, NSides>
SideName{
"Xpos",
"Xneg",
"Ypos",
"Yneg",
"TOP"};
125 inline std::ostream &
operator<<(std::ostream &out,
const Side &side) {
return out << SideName[static_cast<int>(side)]; }
127 return str +
SideName[
static_cast<int>(side)];
131 template <RefFrame::Axis T>
struct Ortog {};
143 template <>
struct Ortog<RefFrame::Axis::Z> {
166 throw Exception(
"RefFrame::AxesOf: Invalid view");
213 throw std::runtime_error(
"RefFrame::ToAxis: unknown direction");
215 throw std::runtime_error(
"RefFrame::ToAxis: unknown direction");
251 throw std::runtime_error(
"RefFrame::NormalAxis: unknown side");
271 throw std::runtime_error(
"RefFrame::NormalAxis: unknown side");
295 throw std::runtime_error(
"RefFrame::NormalAxis: unknown side");
308 throw std::runtime_error(
"RefFrame::NormalAxis: called with ax1 = ax2");
314 if ((ax1 ==
Axis::X && ax2 == Axis::Z) || (ax1 == Axis::Z && ax2 ==
Axis::X)) {
317 if ((ax1 == Axis::Z && ax2 ==
Axis::Y) || (ax1 ==
Axis::Y && ax2 == Axis::Z)) {
332 std::pair<Axis, Axis> normalAxes;
339 }
else if (ax == Axis::Z) {
343 throw Herd::Exception(
"RefFrame::NormalAxes: called with invalid axis");
357 throw std::runtime_error(
358 "RefFrame:::IsPositive called with direction = to XposYpos or XnegYpos or XnegYneg or XposYneg");
constexpr std::array< Coo, 3 > Coos
Definition: RefFrame.h:27
Coo
Aliases for the three space coordinates. RefFrame.h common/RefFrame.h.
Definition: RefFrame.h:26
CssGeoParams.h CssGeoParams class declaration.
Definition: CaloPDCalibrationAlgo.h:24
std::string operator+(const std::string &str, const Coo &coo)
Definition: RefFrame.h:30
bool IsPositive(Direction dir)
Tells if a direction is positive or not.
Definition: RefFrame.h:354
constexpr int NSides
The number of sides (i.e. (number of elements of Side) - 1).
Definition: RefFrame.h:115
RefFrame::Axis ordinate
Definition: RefFrame.h:151
Base struct to get the two axes orthogonal to a direction.
Definition: RefFrame.h:131
Base struct to get the two axes of a given view.
Definition: RefFrame.h:149
const std::array< std::string, NViews > ViewName
Definition: RefFrame.h:104
Axis ToAxis(Coo coo)
Associates an axis to a coordinate .
Definition: RefFrame.h:191
constexpr int NViews
The number of views (i.e. (number of elements of View) - 1).
Definition: RefFrame.h:95
const std::array< std::string, 3 > CooName
Definition: RefFrame.h:28
const std::array< std::string, NAxes > AxisName
Definition: RefFrame.h:47
Side
Aliases for the five sides. RefFrame.h common/RefFrame.h.
Definition: RefFrame.h:113
constexpr int NAxes
The number of axes (i.e. (number of elements of Axis) - 1).
Definition: RefFrame.h:38
Axis
Aliases for the axes. RefFrame.h common/RefFrame.h.
Definition: RefFrame.h:36
Coo ToCoo(Axis axis)
Associates a coordinate to an axis.
Definition: RefFrame.h:182
constexpr std::array< View, NViews > Views
Array of all the views.
Definition: RefFrame.h:103
RefFrame::ViewAxes AxesOf(RefFrame::View view)
Definition: RefFrame.h:154
const std::array< std::string, RefFrame::NDirections > DirectionName
Definition: RefFrame.h:80
Direction NormalDirection(Side side)
Definition: RefFrame.h:280
std::pair< Axis, Axis > NormalAxes(Axis ax)
Given one axes get the other two ;)
Definition: RefFrame.h:331
constexpr std::array< RefFrame::Direction, RefFrame::NDirections > Directions
Definition: RefFrame.h:74
Axis NormalAxis(Side side)
Definition: RefFrame.h:238
const std::array< std::string, NSides > SideName
Definition: RefFrame.h:124
constexpr int NDirections
The number of directions (i.e. (number of elements of Direction) - 1).
Definition: RefFrame.h:72
constexpr std::array< Side, NSides > Sides
Array of all the sides.
Definition: RefFrame.h:123
Definition: Exception.h:24
RefFrame::Axis abscissa
Definition: RefFrame.h:150
std::ostream & operator<<(std::ostream &out, const Coo &coo)
Definition: RefFrame.h:29
View
Aliases for the three 2D projection planes. RefFrame.h common/RefFrame.h.
Definition: RefFrame.h:93
constexpr std::array< Axis, NAxes > Axes
Array of all the axes.
Definition: RefFrame.h:46
Direction
Aliases for the six axis directions. RefFrame.h common/RefFrame.h.
Definition: RefFrame.h:57