ACTS
Experiment-independent tracking
Loading...
Searching...
No Matches
grid_axis.hpp
1// This file is part of the ACTS project.
2//
3// Copyright (C) 2016 CERN for the benefit of the ACTS project
4//
5// This Source Code Form is subject to the terms of the Mozilla Public
6// License, v. 2.0. If a copy of the MPL was not distributed with this
7// file, You can obtain one at https://mozilla.org/MPL/2.0/.
8
9#pragma once
10
11// Project include(s)
12#include "detray/definitions/detail/qualifiers.hpp"
13
14// System include(s)
15#include <ostream>
16
17namespace detray::axis {
18
24enum class bounds {
25 e_open = 0,
26 e_closed = 1,
27 e_circular = 2,
28};
29
35enum class label {
36 e_x = 0,
37 e_y = 1,
38 e_z = 2,
39 e_r = 0,
40 e_phi = 1,
41 e_rphi = 0,
42 e_cyl_z = 1,
43};
44
49enum class binning {
50 e_regular = 0,
51 e_irregular = 1,
52};
53
54// Print the values of an enum by identifier
55#define ENUM_PRINT(x) \
56 case x: \
57 os << #x; \
58 break
59
60DETRAY_HOST inline std::ostream& operator<<(std::ostream& os, bounds b) {
61 switch (b) {
62 using enum bounds;
63 ENUM_PRINT(e_open);
64 ENUM_PRINT(e_closed);
65 ENUM_PRINT(e_circular);
66 }
67 return os;
68}
69
70DETRAY_HOST inline std::ostream& operator<<(std::ostream& os, label l) {
71 switch (l) {
72 using enum label;
73 case e_x:
74 // e_r and e_rphi have same value (0)
75 os << "e_x/e_r/e_rphi";
76 break;
77 case e_y:
78 // e_phi and e_cyl_z have same value (1)
79 os << "e_y/e_phi/e_cyl_z";
80 break;
81 ENUM_PRINT(e_z);
82 }
83 return os;
84}
85
86DETRAY_HOST inline std::ostream& operator<<(std::ostream& os, binning b) {
87 switch (b) {
88 using enum binning;
89 ENUM_PRINT(e_regular);
90 ENUM_PRINT(e_irregular);
91 }
92 return os;
93}
94
95#undef ENUM_PRINT
96
97} // namespace detray::axis